From 7b69d09e8c6aa2e524dfc572c282e1e4e43985ed Mon Sep 17 00:00:00 2001 From: dabreegster Date: Thu, 8 Aug 2024 19:53:59 +0000 Subject: [PATCH] deploy: 3cf58d0d90a9370f7f1e198d2af44fb04332d2a3 --- assets/{main-bb8a4fc3.js => main-f0be41be.js} | 56 +++++++++---------- index.html | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) rename assets/{main-bb8a4fc3.js => main-f0be41be.js} (69%) diff --git a/assets/main-bb8a4fc3.js b/assets/main-f0be41be.js similarity index 69% rename from assets/main-bb8a4fc3.js rename to assets/main-f0be41be.js index c3d2412..34b6d67 100644 --- a/assets/main-bb8a4fc3.js +++ b/assets/main-f0be41be.js @@ -1,9 +1,9 @@ -var VT=Object.defineProperty;var UT=(e,t,n)=>t in e?VT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var yi=(e,t,n)=>(UT(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function Me(){}function GT(e,t){for(const n in t)e[n]=t[n];return e}function tS(e){return e()}function Cb(){return Object.create(null)}function oo(e){e.forEach(tS)}function Jg(e){return typeof e=="function"}function Xe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Xm;function xo(e,t){return e===t?!0:(Xm||(Xm=document.createElement("a")),Xm.href=t,e===Xm.href)}function qT(e){return Object.keys(e).length===0}function eS(e,...t){if(e==null){for(const r of t)r(void 0);return Me}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function nS(e){let t;return eS(e,n=>t=n)(),t}function Ge(e,t,n){e.$$.on_destroy.push(eS(t,n))}function li(e,t,n,r){if(e){const o=rS(e,t,n,r);return e[0](o)}}function rS(e,t,n,r){return e[1]&&r?GT(n.ctx.slice(),e[1](r(t))):n.ctx}function ui(e,t,n,r){if(e[2]&&r){const o=e[2](r(n));if(t.dirty===void 0)return o;if(typeof o=="object"){const l=[],h=Math.max(t.dirty.length,o.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let r=0;re.removeEventListener(t,n,r)}function HT(e){return function(t){return t.preventDefault(),e.call(this,t)}}function T_(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Vt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function ZT(e){return e===""?null:+e}function XT(e){return Array.from(e.childNodes)}function Ui(e,t){t=""+t,e.data!==t&&(e.data=t)}function wc(e,t){e.value=t??""}function Gr(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Tb(e,t,n){for(let r=0;r{const o=e.$$.callbacks[t];if(o){const l=KT(t,n,{cancelable:r});return o.slice().forEach(h=>{h.call(e,l)}),!l.defaultPrevented}return!0}}function J0(e,t){return Pd().$$.context.set(e,t),t}function Q0(e){return Pd().$$.context.get(e)}function Nn(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(r=>r.call(this,t))}const Yh=[],fi=[];let ef=[];const o0=[],iS=Promise.resolve();let s0=!1;function oS(){s0||(s0=!0,iS.then(aS))}function sS(){return oS(),iS}function vg(e){ef.push(e)}function Tu(e){o0.push(e)}const L_=new Set;let Gh=0;function aS(){if(Gh!==0)return;const e=ud;do{try{for(;Ghe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),ef=t}const sg=new Set;let yc;function ar(){yc={r:0,c:[],p:yc}}function lr(){yc.r||oo(yc.c),yc=yc.p}function Dt(e,t){e&&e.i&&(sg.delete(e),e.i(t))}function qt(e,t,n,r){if(e&&e.o){if(sg.has(e))return;sg.add(e),yc.c.push(()=>{sg.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function vo(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function $T(e,t){qt(e,1,1,()=>{t.delete(e.key)})}function tL(e,t,n,r,o,l,h,u,y,w,S,C){let P=e.length,N=l.length,R=P;const J={};for(;R--;)J[e[R].key]=R;const Y=[],K=new Map,B=new Map,G=[];for(R=N;R--;){const ft=C(o,l,R),rt=n(ft);let mt=h.get(rt);mt?r&&G.push(()=>mt.p(ft,t)):(mt=w(rt,ft),mt.c()),K.set(rt,Y[R]=mt),rt in J&&B.set(rt,Math.abs(R-J[rt]))}const H=new Set,at=new Set;function gt(ft){Dt(ft,1),ft.m(u,S),h.set(ft.key,ft),S=ft.first,N--}for(;P&&N;){const ft=Y[N-1],rt=e[P-1],mt=ft.key,Et=rt.key;ft===rt?(S=ft.first,P--,N--):K.has(Et)?!h.has(mt)||H.has(mt)?gt(ft):at.has(Et)?P--:B.get(mt)>B.get(Et)?(at.add(mt),gt(ft)):(H.add(Et),P--):(y(rt,h),P--)}for(;P--;){const ft=e[P];K.has(ft.key)||y(ft,h)}for(;N;)gt(Y[N-1]);return oo(G),Y}function Lu(e,t,n){const r=e.$$.props[t];r!==void 0&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ie(e){e&&e.c()}function we(e,t,n){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),vg(()=>{const l=e.$$.on_mount.map(tS).filter(Jg);e.$$.on_destroy?e.$$.on_destroy.push(...l):oo(l),e.$$.on_mount=[]}),o.forEach(vg)}function Se(e,t){const n=e.$$;n.fragment!==null&&(QT(n.after_update),oo(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function eL(e,t){e.$$.dirty[0]===-1&&(Yh.push(e),oS(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=N.length?N[0]:P;return w.ctx&&o(w.ctx[C],w.ctx[C]=R)&&(!w.skip_bound&&w.bound[C]&&w.bound[C](R),S&&eL(e,C)),P}):[],w.update(),S=!0,oo(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const C=XT(t.target);w.fragment&&w.fragment.l(C),C.forEach(Nt)}else w.fragment&&w.fragment.c();t.intro&&Dt(e.$$.fragment),we(e,t.target,t.anchor),aS()}ed(y)}class an{constructor(){yi(this,"$$");yi(this,"$$set")}$destroy(){Se(this,1),this.$destroy=Me}$on(t,n){if(!Jg(n))return Me;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(t){this.$$set&&!qT(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const nL="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nL);const rL="/severance_snape/assets/logo_dark-ed08d841.svg";let xn;const lS=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&lS.decode();let Yp=null;function nd(){return(Yp===null||Yp.byteLength===0)&&(Yp=new Uint8Array(xn.memory.buffer)),Yp}function xu(e,t){return e=e>>>0,lS.decode(nd().subarray(e,e+t))}const Nl=new Array(128).fill(void 0);Nl.push(void 0,null,!0,!1);let rd=Nl.length;function Dl(e){rd===Nl.length&&Nl.push(Nl.length+1);const t=rd;return rd=Nl[t],Nl[t]=e,t}function sr(e){return Nl[e]}function iL(e){e<132||(Nl[e]=rd,rd=e)}function Kh(e){const t=sr(e);return iL(e),t}function P_(e){return e==null}let Kp=null;function uS(){return(Kp===null||Kp.byteLength===0)&&(Kp=new Float64Array(xn.memory.buffer)),Kp}let Jp=null;function $n(){return(Jp===null||Jp.byteLength===0)&&(Jp=new Int32Array(xn.memory.buffer)),Jp}let _c=0;const ag=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},oL=typeof ag.encodeInto=="function"?function(e,t){return ag.encodeInto(e,t)}:function(e,t){const n=ag.encode(e);return t.set(n),{read:e.length,written:n.length}};function M_(e,t,n){if(n===void 0){const u=ag.encode(e),y=t(u.length,1)>>>0;return nd().subarray(y,y+u.length).set(u),_c=u.length,y}let r=e.length,o=t(r,1)>>>0;const l=nd();let h=0;for(;h127)break;l[o+h]=u}if(h!==r){h!==0&&(e=e.slice(h)),o=n(o,r,r=h+e.length*3,1)>>>0;const u=nd().subarray(o+h,o+r),y=oL(e,u);h+=y.written}return _c=h,o}function a0(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const o=e.description;return o==null?"Symbol":`Symbol(${o})`}if(t=="function"){const o=e.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(e)){const o=e.length;let l="[";o>0&&(l+=a0(e[0]));for(let h=1;h1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} -${e.stack}`:r}function sL(e,t){const n=t(e.length*1,1)>>>0;return nd().set(e,n/1),_c=e.length,n}function aL(e,t){return e=e>>>0,uS().subarray(e/8,e/8+t)}class lL{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();xn.__wbg_mapmodel_free(t)}constructor(t,n){try{const h=xn.__wbindgen_add_to_stack_pointer(-16),u=sL(t,xn.__wbindgen_malloc),y=_c;xn.mapmodel_new(h,u,y,n);var r=$n()[h/4+0],o=$n()[h/4+1],l=$n()[h/4+2];if(l)throw Kh(o);return this.__wbg_ptr=r>>>0,this}finally{xn.__wbindgen_add_to_stack_pointer(16)}}render(){let t,n;try{const w=xn.__wbindgen_add_to_stack_pointer(-16);xn.mapmodel_render(w,this.__wbg_ptr);var r=$n()[w/4+0],o=$n()[w/4+1],l=$n()[w/4+2],h=$n()[w/4+3],u=r,y=o;if(h)throw u=0,y=0,Kh(l);return t=u,n=y,xu(u,y)}finally{xn.__wbindgen_add_to_stack_pointer(16),xn.__wbindgen_free(t,n,1)}}compareRoute(t){let n,r;try{const S=xn.__wbindgen_add_to_stack_pointer(-16);xn.mapmodel_compareRoute(S,this.__wbg_ptr,Dl(t));var o=$n()[S/4+0],l=$n()[S/4+1],h=$n()[S/4+2],u=$n()[S/4+3],y=o,w=l;if(u)throw y=0,w=0,Kh(h);return n=y,r=w,xu(y,w)}finally{xn.__wbindgen_add_to_stack_pointer(16),xn.__wbindgen_free(n,r,1)}}makeHeatmap(){let t,n;try{const w=xn.__wbindgen_add_to_stack_pointer(-16);xn.mapmodel_makeHeatmap(w,this.__wbg_ptr);var r=$n()[w/4+0],o=$n()[w/4+1],l=$n()[w/4+2],h=$n()[w/4+3],u=r,y=o;if(h)throw u=0,y=0,Kh(l);return t=u,n=y,xu(u,y)}finally{xn.__wbindgen_add_to_stack_pointer(16),xn.__wbindgen_free(t,n,1)}}getInvertedBoundary(){let t,n;try{const w=xn.__wbindgen_add_to_stack_pointer(-16);xn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=$n()[w/4+0],o=$n()[w/4+1],l=$n()[w/4+2],h=$n()[w/4+3],u=r,y=o;if(h)throw u=0,y=0,Kh(l);return t=u,n=y,xu(u,y)}finally{xn.__wbindgen_add_to_stack_pointer(16),xn.__wbindgen_free(t,n,1)}}getBounds(){try{const o=xn.__wbindgen_add_to_stack_pointer(-16);xn.mapmodel_getBounds(o,this.__wbg_ptr);var t=$n()[o/4+0],n=$n()[o/4+1],r=aL(t,n).slice();return xn.__wbindgen_free(t,n*8,8),r}finally{xn.__wbindgen_add_to_stack_pointer(16)}}}async function uL(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function cL(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const r=xu(t,n);return Dl(r)},e.wbg.__wbindgen_is_object=function(t){const n=sr(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return sr(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return sr(t)in sr(n)},e.wbg.__wbindgen_object_drop_ref=function(t){Kh(t)},e.wbg.__wbindgen_number_get=function(t,n){const r=sr(n),o=typeof r=="number"?r:void 0;uS()[t/8+1]=P_(o)?0:o,$n()[t/4+0]=!P_(o)},e.wbg.__wbindgen_error_new=function(t,n){const r=new Error(xu(t,n));return Dl(r)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return sr(t)==sr(n)},e.wbg.__wbindgen_boolean_get=function(t){const n=sr(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_string_get=function(t,n){const r=sr(n),o=typeof r=="string"?r:void 0;var l=P_(o)?0:M_(o,xn.__wbindgen_malloc,xn.__wbindgen_realloc),h=_c;$n()[t/4+1]=h,$n()[t/4+0]=l},e.wbg.__wbindgen_object_clone_ref=function(t){const n=sr(t);return Dl(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const r=sr(t)[sr(n)];return Dl(r)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(sr(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(sr(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(sr(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(sr(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(sr(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=sr(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=sr(t).buffer;return Dl(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(sr(t));return Dl(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,r){sr(t).set(sr(n),r>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return sr(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=sr(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Dl(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const r=sr(n).stack,o=M_(r,xn.__wbindgen_malloc,xn.__wbindgen_realloc),l=_c;$n()[t/4+1]=l,$n()[t/4+0]=o},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let r,o;try{r=t,o=n,console.error(xu(t,n))}finally{xn.__wbindgen_free(r,o,1)}},e.wbg.__wbindgen_debug_string=function(t,n){const r=a0(sr(n)),o=M_(r,xn.__wbindgen_malloc,xn.__wbindgen_realloc),l=_c;$n()[t/4+1]=l,$n()[t/4+0]=o},e.wbg.__wbindgen_throw=function(t,n){throw new Error(xu(t,n))},e.wbg.__wbindgen_memory=function(){const t=xn.memory;return Dl(t)},e}function hL(e,t){return xn=e.exports,cS.__wbindgen_wasm_module=t,Kp=null,Jp=null,Yp=null,xn}async function cS(e){if(xn!==void 0)return xn;typeof e>"u"&&(e="/severance_snape/assets/backend_bg.wasm");const t=cL();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:r}=await uL(await e,t);return hL(n,r)}const qh=[];function A_(e,t){return{subscribe:zr(e,t).subscribe}}function zr(e,t=Me){let n;const r=new Set;function o(u){if(Xe(e,u)&&(e=u,n)){const y=!qh.length;for(const w of r)w[1](),qh.push(w,e);if(y){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:o,update:l,subscribe:h}}let fL=Date.now();function Qg(e){return`${e}-${fL++}`}const $0=Symbol.for("svelte-maplibre");function Mf(){return Q0($0)}function pL(e){let t=new WeakMap;return n=>{var h;let r=t.get(n.originalEvent);if(r!==void 0)return r;let l=(h=n.target.queryRenderedFeatures(n.point).find(u=>{var y;return(y=e.get(u.layer.id))==null?void 0:y.interactive}))==null?void 0:h.layer.id;return t.set(n.originalEvent,l),l}}function dL(){let e=new Map;return J0($0,{map:zr(null),source:A_(null),layer:A_(null),popupTarget:A_(null),cluster:zr(),loadedImages:zr(new Set),minzoom:zr(0),maxzoom:zr(24),layerEvent:zr(null),layerInfo:e,eventTopMost:pL(e)})}function Lb(e){return{subscribe:e.subscribe}}function tv({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let o=Mf(),l=zr(null),h=Lb(l),u={...o,[e]:Lb(l)};if(t&&(u.popupTarget=h),r){let y=zr(null);u.layerEvent=y,o.layerEvent=y}return n&&(u.cluster=zr()),J0($0,u),{...o,self:l}}function mL(){return tv({key:"source",setCluster:!0})}function gL(e=!0){return tv({key:"layer",setPopupTarget:e,setMouseEvent:e})}function yL(){return tv({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}var Md=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ev(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $g(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var hS={exports:{}};/** +var UT=Object.defineProperty;var GT=(e,t,n)=>t in e?UT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var yi=(e,t,n)=>(GT(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function Ae(){}function qT(e,t){for(const n in t)e[n]=t[n];return e}function eS(e){return e()}function Tb(){return Object.create(null)}function oo(e){e.forEach(eS)}function Jg(e){return typeof e=="function"}function Xe(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Xm;function xo(e,t){return e===t?!0:(Xm||(Xm=document.createElement("a")),Xm.href=t,e===Xm.href)}function jT(e){return Object.keys(e).length===0}function nS(e,...t){if(e==null){for(const r of t)r(void 0);return Ae}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function K0(e){let t;return nS(e,n=>t=n)(),t}function Ve(e,t,n){e.$$.on_destroy.push(nS(t,n))}function li(e,t,n,r){if(e){const i=rS(e,t,n,r);return e[0](i)}}function rS(e,t,n,r){return e[1]&&r?qT(n.ctx.slice(),e[1](r(t))):n.ctx}function ui(e,t,n,r){if(e[2]&&r){const i=e[2](r(n));if(t.dirty===void 0)return i;if(typeof i=="object"){const l=[],h=Math.max(t.dirty.length,i.length);for(let u=0;u32){const t=[],n=e.ctx.length/32;for(let r=0;re.removeEventListener(t,n,r)}function ZT(e){return function(t){return t.preventDefault(),e.call(this,t)}}function T_(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Vt(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function XT(e){return e===""?null:+e}function YT(e){return Array.from(e.childNodes)}function Ui(e,t){t=""+t,e.data!==t&&(e.data=t)}function wc(e,t){e.value=t??""}function Gr(e,t,n,r){n==null?e.style.removeProperty(t):e.style.setProperty(t,n,r?"important":"")}function Lb(e,t,n){for(let r=0;r{const i=e.$$.callbacks[t];if(i){const l=JT(t,n,{cancelable:r});return i.slice().forEach(h=>{h.call(e,l)}),!l.defaultPrevented}return!0}}function Q0(e,t){return Pd().$$.context.set(e,t),t}function $0(e){return Pd().$$.context.get(e)}function Nn(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(r=>r.call(this,t))}const Yh=[],fi=[];let ef=[];const o0=[],iS=Promise.resolve();let s0=!1;function oS(){s0||(s0=!0,iS.then(aS))}function sS(){return oS(),iS}function vg(e){ef.push(e)}function Lu(e){o0.push(e)}const L_=new Set;let Gh=0;function aS(){if(Gh!==0)return;const e=ud;do{try{for(;Ghe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),ef=t}const sg=new Set;let yc;function ar(){yc={r:0,c:[],p:yc}}function lr(){yc.r||oo(yc.c),yc=yc.p}function Dt(e,t){e&&e.i&&(sg.delete(e),e.i(t))}function jt(e,t,n,r){if(e&&e.o){if(sg.has(e))return;sg.add(e),yc.c.push(()=>{sg.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function vo(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function tL(e,t){jt(e,1,1,()=>{t.delete(e.key)})}function eL(e,t,n,r,i,l,h,u,y,w,S,C){let P=e.length,D=l.length,N=P;const K={};for(;N--;)K[e[N].key]=N;const Y=[],J=new Map,B=new Map,G=[];for(N=D;N--;){const ft=C(i,l,N),rt=n(ft);let mt=h.get(rt);mt?r&&G.push(()=>mt.p(ft,t)):(mt=w(rt,ft),mt.c()),J.set(rt,Y[N]=mt),rt in K&&B.set(rt,Math.abs(N-K[rt]))}const H=new Set,at=new Set;function gt(ft){Dt(ft,1),ft.m(u,S),h.set(ft.key,ft),S=ft.first,D--}for(;P&&D;){const ft=Y[D-1],rt=e[P-1],mt=ft.key,Et=rt.key;ft===rt?(S=ft.first,P--,D--):J.has(Et)?!h.has(mt)||H.has(mt)?gt(ft):at.has(Et)?P--:B.get(mt)>B.get(Et)?(at.add(mt),gt(ft)):(H.add(Et),P--):(y(rt,h),P--)}for(;P--;){const ft=e[P];J.has(ft.key)||y(ft,h)}for(;D;)gt(Y[D-1]);return oo(G),Y}function Pu(e,t,n){const r=e.$$.props[t];r!==void 0&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ie(e){e&&e.c()}function we(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),vg(()=>{const l=e.$$.on_mount.map(eS).filter(Jg);e.$$.on_destroy?e.$$.on_destroy.push(...l):oo(l),e.$$.on_mount=[]}),i.forEach(vg)}function Se(e,t){const n=e.$$;n.fragment!==null&&($T(n.after_update),oo(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function nL(e,t){e.$$.dirty[0]===-1&&(Yh.push(e),oS(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const N=D.length?D[0]:P;return w.ctx&&i(w.ctx[C],w.ctx[C]=N)&&(!w.skip_bound&&w.bound[C]&&w.bound[C](N),S&&nL(e,C)),P}):[],w.update(),S=!0,oo(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const C=YT(t.target);w.fragment&&w.fragment.l(C),C.forEach(Nt)}else w.fragment&&w.fragment.c();t.intro&&Dt(e.$$.fragment),we(e,t.target,t.anchor),aS()}ed(y)}class an{constructor(){yi(this,"$$");yi(this,"$$set")}$destroy(){Se(this,1),this.$destroy=Ae}$on(t,n){if(!Jg(n))return Ae;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!jT(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const rL="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(rL);const iL="/severance_snape/assets/logo_dark-ed08d841.svg";let wn;const lS=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&lS.decode();let Yp=null;function nd(){return(Yp===null||Yp.byteLength===0)&&(Yp=new Uint8Array(wn.memory.buffer)),Yp}function wu(e,t){return e=e>>>0,lS.decode(nd().subarray(e,e+t))}const Ol=new Array(128).fill(void 0);Ol.push(void 0,null,!0,!1);let rd=Ol.length;function Rl(e){rd===Ol.length&&Ol.push(Ol.length+1);const t=rd;return rd=Ol[t],Ol[t]=e,t}function sr(e){return Ol[e]}function oL(e){e<132||(Ol[e]=rd,rd=e)}function Kh(e){const t=sr(e);return oL(e),t}function P_(e){return e==null}let Kp=null;function uS(){return(Kp===null||Kp.byteLength===0)&&(Kp=new Float64Array(wn.memory.buffer)),Kp}let Jp=null;function $n(){return(Jp===null||Jp.byteLength===0)&&(Jp=new Int32Array(wn.memory.buffer)),Jp}let _c=0;const ag=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},sL=typeof ag.encodeInto=="function"?function(e,t){return ag.encodeInto(e,t)}:function(e,t){const n=ag.encode(e);return t.set(n),{read:e.length,written:n.length}};function M_(e,t,n){if(n===void 0){const u=ag.encode(e),y=t(u.length,1)>>>0;return nd().subarray(y,y+u.length).set(u),_c=u.length,y}let r=e.length,i=t(r,1)>>>0;const l=nd();let h=0;for(;h127)break;l[i+h]=u}if(h!==r){h!==0&&(e=e.slice(h)),i=n(i,r,r=h+e.length*3,1)>>>0;const u=nd().subarray(i+h,i+r),y=sL(e,u);h+=y.written}return _c=h,i}function a0(e){const t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){const i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){const i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){const i=e.length;let l="[";i>0&&(l+=a0(e[0]));for(let h=1;h1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message} +${e.stack}`:r}function aL(e,t){const n=t(e.length*1,1)>>>0;return nd().set(e,n/1),_c=e.length,n}function lL(e,t){return e=e>>>0,uS().subarray(e/8,e/8+t)}class uL{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,t}free(){const t=this.__destroy_into_raw();wn.__wbg_mapmodel_free(t)}constructor(t,n){try{const h=wn.__wbindgen_add_to_stack_pointer(-16),u=aL(t,wn.__wbindgen_malloc),y=_c;wn.mapmodel_new(h,u,y,n);var r=$n()[h/4+0],i=$n()[h/4+1],l=$n()[h/4+2];if(l)throw Kh(i);return this.__wbg_ptr=r>>>0,this}finally{wn.__wbindgen_add_to_stack_pointer(16)}}render(){let t,n;try{const w=wn.__wbindgen_add_to_stack_pointer(-16);wn.mapmodel_render(w,this.__wbg_ptr);var r=$n()[w/4+0],i=$n()[w/4+1],l=$n()[w/4+2],h=$n()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,Kh(l);return t=u,n=y,wu(u,y)}finally{wn.__wbindgen_add_to_stack_pointer(16),wn.__wbindgen_free(t,n,1)}}compareRoute(t){let n,r;try{const S=wn.__wbindgen_add_to_stack_pointer(-16);wn.mapmodel_compareRoute(S,this.__wbg_ptr,Rl(t));var i=$n()[S/4+0],l=$n()[S/4+1],h=$n()[S/4+2],u=$n()[S/4+3],y=i,w=l;if(u)throw y=0,w=0,Kh(h);return n=y,r=w,wu(y,w)}finally{wn.__wbindgen_add_to_stack_pointer(16),wn.__wbindgen_free(n,r,1)}}makeHeatmap(){let t,n;try{const w=wn.__wbindgen_add_to_stack_pointer(-16);wn.mapmodel_makeHeatmap(w,this.__wbg_ptr);var r=$n()[w/4+0],i=$n()[w/4+1],l=$n()[w/4+2],h=$n()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,Kh(l);return t=u,n=y,wu(u,y)}finally{wn.__wbindgen_add_to_stack_pointer(16),wn.__wbindgen_free(t,n,1)}}getInvertedBoundary(){let t,n;try{const w=wn.__wbindgen_add_to_stack_pointer(-16);wn.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=$n()[w/4+0],i=$n()[w/4+1],l=$n()[w/4+2],h=$n()[w/4+3],u=r,y=i;if(h)throw u=0,y=0,Kh(l);return t=u,n=y,wu(u,y)}finally{wn.__wbindgen_add_to_stack_pointer(16),wn.__wbindgen_free(t,n,1)}}getBounds(){try{const i=wn.__wbindgen_add_to_stack_pointer(-16);wn.mapmodel_getBounds(i,this.__wbg_ptr);var t=$n()[i/4+0],n=$n()[i/4+1],r=lL(t,n).slice();return wn.__wbindgen_free(t,n*8,8),r}finally{wn.__wbindgen_add_to_stack_pointer(16)}}}async function cL(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{const n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function hL(){const e={};return e.wbg={},e.wbg.__wbindgen_string_new=function(t,n){const r=wu(t,n);return Rl(r)},e.wbg.__wbindgen_is_object=function(t){const n=sr(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_undefined=function(t){return sr(t)===void 0},e.wbg.__wbindgen_in=function(t,n){return sr(t)in sr(n)},e.wbg.__wbindgen_object_drop_ref=function(t){Kh(t)},e.wbg.__wbindgen_number_get=function(t,n){const r=sr(n),i=typeof r=="number"?r:void 0;uS()[t/8+1]=P_(i)?0:i,$n()[t/4+0]=!P_(i)},e.wbg.__wbindgen_error_new=function(t,n){const r=new Error(wu(t,n));return Rl(r)},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return sr(t)==sr(n)},e.wbg.__wbindgen_boolean_get=function(t){const n=sr(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_string_get=function(t,n){const r=sr(n),i=typeof r=="string"?r:void 0;var l=P_(i)?0:M_(i,wn.__wbindgen_malloc,wn.__wbindgen_realloc),h=_c;$n()[t/4+1]=h,$n()[t/4+0]=l},e.wbg.__wbindgen_object_clone_ref=function(t){const n=sr(t);return Rl(n)},e.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(t,n){const r=sr(t)[sr(n)];return Rl(r)},e.wbg.__wbg_debug_34c9290896ec9856=function(t){console.debug(sr(t))},e.wbg.__wbg_error_e60eff06f24ab7a4=function(t){console.error(sr(t))},e.wbg.__wbg_info_d7d58472d0bab115=function(t){console.info(sr(t))},e.wbg.__wbg_log_a4530b4fe289336f=function(t){console.log(sr(t))},e.wbg.__wbg_warn_f260f49434e45e62=function(t){console.warn(sr(t))},e.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(t){let n;try{n=sr(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_buffer_a448f833075b71ba=function(t){const n=sr(t).buffer;return Rl(n)},e.wbg.__wbg_new_8f67e318f15d7254=function(t){const n=new Uint8Array(sr(t));return Rl(n)},e.wbg.__wbg_set_2357bf09366ee480=function(t,n,r){sr(t).set(sr(n),r>>>0)},e.wbg.__wbg_length_1d25fa9e4ac21ce7=function(t){return sr(t).length},e.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(t){let n;try{n=sr(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_new_abda76e883ba8a5f=function(){const t=new Error;return Rl(t)},e.wbg.__wbg_stack_658279fe44541cf6=function(t,n){const r=sr(n).stack,i=M_(r,wn.__wbindgen_malloc,wn.__wbindgen_realloc),l=_c;$n()[t/4+1]=l,$n()[t/4+0]=i},e.wbg.__wbg_error_f851667af71bcfc6=function(t,n){let r,i;try{r=t,i=n,console.error(wu(t,n))}finally{wn.__wbindgen_free(r,i,1)}},e.wbg.__wbindgen_debug_string=function(t,n){const r=a0(sr(n)),i=M_(r,wn.__wbindgen_malloc,wn.__wbindgen_realloc),l=_c;$n()[t/4+1]=l,$n()[t/4+0]=i},e.wbg.__wbindgen_throw=function(t,n){throw new Error(wu(t,n))},e.wbg.__wbindgen_memory=function(){const t=wn.memory;return Rl(t)},e}function fL(e,t){return wn=e.exports,cS.__wbindgen_wasm_module=t,Kp=null,Jp=null,Yp=null,wn}async function cS(e){if(wn!==void 0)return wn;typeof e>"u"&&(e="/severance_snape/assets/backend_bg.wasm");const t=hL();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));const{instance:n,module:r}=await cL(await e,t);return fL(n,r)}const qh=[];function A_(e,t){return{subscribe:Fr(e,t).subscribe}}function Fr(e,t=Ae){let n;const r=new Set;function i(u){if(Xe(e,u)&&(e=u,n)){const y=!qh.length;for(const w of r)w[1](),qh.push(w,e);if(y){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:l,subscribe:h}}let pL=Date.now();function Qg(e){return`${e}-${pL++}`}const tv=Symbol.for("svelte-maplibre");function Mf(){return $0(tv)}function dL(e){let t=new WeakMap;return n=>{var h;let r=t.get(n.originalEvent);if(r!==void 0)return r;let l=(h=n.target.queryRenderedFeatures(n.point).find(u=>{var y;return(y=e.get(u.layer.id))==null?void 0:y.interactive}))==null?void 0:h.layer.id;return t.set(n.originalEvent,l),l}}function mL(){let e=new Map;return Q0(tv,{map:Fr(null),source:A_(null),layer:A_(null),popupTarget:A_(null),cluster:Fr(),loadedImages:Fr(new Set),minzoom:Fr(0),maxzoom:Fr(24),layerEvent:Fr(null),layerInfo:e,eventTopMost:dL(e)})}function Pb(e){return{subscribe:e.subscribe}}function ev({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=Mf(),l=Fr(null),h=Pb(l),u={...i,[e]:Pb(l)};if(t&&(u.popupTarget=h),r){let y=Fr(null);u.layerEvent=y,i.layerEvent=y}return n&&(u.cluster=Fr()),Q0(tv,u),{...i,self:l}}function gL(){return ev({key:"source",setCluster:!0})}function yL(e=!0){return ev({key:"layer",setPopupTarget:e,setMouseEvent:e})}function _L(){return ev({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}var Md=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $g(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var hS={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(e,t){(function(n,r){e.exports=r()})(Md,function(){var n={},r={};function o(h,u,y){if(r[h]=y,h==="index"){var w="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([w],{type:"text/javascript"}))),n}}o("shared",["exports"],function(h){function u(a,i,c,p){return new(c||(c=Promise))(function(g,b){function x(A){try{L(p.next(A))}catch(D){b(D)}}function E(A){try{L(p.throw(A))}catch(D){b(D)}}function L(A){var D;A.done?g(A.value):(D=A.value,D instanceof c?D:new c(function(O){O(D)})).then(x,E)}L((p=p.apply(a,i||[])).next())})}function y(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}typeof SuppressedError=="function"&&SuppressedError;var w=S;function S(a,i){this.x=a,this.y=i}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,i){return this.clone()._rotateAround(a,i)},matMult:function(a){return this.clone()._matMult(a)},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(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var i=a.x-this.x,c=a.y-this.y;return i*i+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,i){return Math.atan2(this.x*i-this.y*a,this.x*a+this.y*i)},_matMult:function(a){var i=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=i,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var i=Math.cos(a),c=Math.sin(a),p=c*this.x+i*this.y;return this.x=i*this.x-c*this.y,this.y=p,this},_rotateAround:function(a,i){var c=Math.cos(a),p=Math.sin(a),g=i.y+p*(this.x-i.x)+c*(this.y-i.y);return this.x=i.x+c*(this.x-i.x)-p*(this.y-i.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(a){return a instanceof S?a:Array.isArray(a)?new S(a[0],a[1]):a};var C=y(w),P=N;function N(a,i,c,p){this.cx=3*a,this.bx=3*(c-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(p-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=i,this.p2x=c,this.p2y=p}N.prototype={sampleCurveX:function(a){return((this.ax*a+this.bx)*a+this.cx)*a},sampleCurveY:function(a){return((this.ay*a+this.by)*a+this.cy)*a},sampleCurveDerivativeX:function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},solveCurveX:function(a,i){if(i===void 0&&(i=1e-6),a<0)return 0;if(a>1)return 1;for(var c=a,p=0;p<8;p++){var g=this.sampleCurveX(c)-a;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(a,i){return this.sampleCurveY(this.solveCurveX(a,i))}};var R=y(P);let J,Y;function K(){return J==null&&(J=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),J}function B(){if(Y==null&&(Y=!1,K())){const i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let p=0;p<5*5;p++){const g=4*p;i.fillStyle=`rgb(${g},${g+1},${g+2})`,i.fillRect(p%5,Math.floor(p/5),1,1)}const c=i.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){Y=!0;break}}}return Y||!1}function G(a,i,c,p){const g=new R(a,i,c,p);return function(b){return g.solve(b)}}const H=G(.25,.1,.25,1);function at(a,i,c){return Math.min(c,Math.max(i,a))}function gt(a,i,c){const p=c-i,g=((a-i)%p+p)%p+i;return g===i?c:g}function ft(a,...i){for(const c of i)for(const p in c)a[p]=c[p];return a}let rt=1;function mt(a,i,c){const p={};for(const g in a)p[g]=i.call(c||this,a[g],g,a);return p}function Et(a,i,c){const p={};for(const g in a)i.call(c||this,a[g],g,a)&&(p[g]=a[g]);return p}function $(a){return Array.isArray(a)?a.map($):typeof a=="object"&&a?mt(a,$):a}const Pt={};function Qt(a){Pt[a]||(typeof console<"u"&&console.warn(a),Pt[a]=!0)}function Tt(a,i,c){return(c.y-a.y)*(i.x-a.x)>(i.y-a.y)*(c.x-a.x)}function re(a){let i=0;for(let c,p,g=0,b=a.length,x=b-1;g"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(a,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),L=new Uint8ClampedArray(p*g*4);if(yield b.copyTo(L,function(A,D,O,U,j){const Z=4*Math.max(-D,0),et=(Math.max(0,O)-O)*U*4+Z,lt=4*U,pt=Math.max(0,D),Ct=Math.max(0,O);return{rect:{x:pt,y:Ct,width:Math.min(A.width,D+U)-pt,height:Math.min(A.height,O+j)-Ct},layout:[{offset:et,stride:lt}]}}(a,i,c,p,g)),E)for(let A=0;Afe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,hr=function(a,i){if(/:\/\//.test(a.url)&&!/^https?:|^file:/.test(a.url)){const p=un(a.url);if(p)return p(a,i);if(fe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,targetMapId:kn},i)}if(!(/^file:/.test(c=a.url)||/^file:/.test(Wr())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,g){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Wr(),signal:g.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new Yn(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const L=yield E;if(g.signal.aborted)throw An();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(a,i);if(fe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,mustQueue:!0,targetMapId:kn},i)}var c;return function(p,g){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const L in p.headers)E.setRequestHeader(L,p.headers[L]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!g.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let L=E.response;if(p.type==="json")try{L=JSON.parse(E.response)}catch(A){return void x(A)}b({data:L,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const L=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new Yn(E.status,E.statusText,p.url,L))}},g.signal.addEventListener("abort",()=>{E.abort(),x(An())}),E.send(p.body)})}(a,i)};function er(a){if(!a||a.indexOf("://")<=0||a.indexOf("data:image/")===0||a.indexOf("blob:")===0)return!0;const i=new URL(a),c=window.location;return i.protocol===c.protocol&&i.host===c.host}function Kn(a,i,c){c[a]&&c[a].indexOf(i)!==-1||(c[a]=c[a]||[],c[a].push(i))}function nt(a,i,c){if(c&&c[a]){const p=c[a].indexOf(i);p!==-1&&c[a].splice(p,1)}}class xt{constructor(i,c={}){ft(this,c),this.type=i}}class ce extends xt{constructor(i,c={}){super("error",ft({error:i},c))}}class mn{on(i,c){return this._listeners=this._listeners||{},Kn(i,c,this._listeners),this}off(i,c){return nt(i,c,this._listeners),nt(i,c,this._oneTimeListeners),this}once(i,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Kn(i,c,this._oneTimeListeners),this):new Promise(p=>this.once(i,p))}fire(i,c){typeof i=="string"&&(i=new xt(i,c||{}));const p=i.type;if(this.listens(p)){i.target=this;const g=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of g)E.call(this,i);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)nt(p,E,this._oneTimeListeners),E.call(this,i);const x=this._eventedParent;x&&(ft(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(i))}else i instanceof ce&&console.error(i.error);return this}listens(i){return this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i)}setEventedParent(i,c){return this._eventedParent=i,this._eventedParentData=c,this}}var Mt={$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 He=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Tr(a,i){const c={};for(const p in a)p!=="ref"&&(c[p]=a[p]);return He.forEach(p=>{p in i&&(c[p]=i[p])}),c}function on(a,i){if(Array.isArray(a)){if(!Array.isArray(i)||a.length!==i.length)return!1;for(let c=0;c`:a.itemType.kind==="value"?"array":`array<${i}>`}return a.kind}const vt=[Hr,oe,Je,Ye,Lr,Dr,Zo,X(Ze),ut,V,q];function Q(a,i){if(i.kind==="error")return null;if(a.kind==="array"){if(i.kind==="array"&&(i.N===0&&i.itemType.kind==="value"||!Q(a.itemType,i.itemType))&&(typeof a.N!="number"||a.N===i.N))return null}else{if(a.kind===i.kind)return null;if(a.kind==="value"){for(const c of vt)if(!Q(c,i))return null}}return`Expected ${it(a)} but found ${it(i)} instead.`}function bt(a,i){return i.some(c=>c.kind===a.kind)}function dt(a,i){return i.some(c=>c==="null"?a===null:c==="array"?Array.isArray(a):c==="object"?a&&!Array.isArray(a)&&typeof a=="object":c===typeof a)}function It(a,i){return a.kind==="array"&&i.kind==="array"?a.itemType.kind===i.itemType.kind&&typeof a.N=="number":a.kind===i.kind}const Ot=.96422,Ut=.82521,Ht=4/29,xe=6/29,Le=3*xe*xe,Ue=xe*xe*xe,qe=Math.PI/180,_n=180/Math.PI;function Vn(a){return(a%=360)<0&&(a+=360),a}function nr([a,i,c,p]){let g,b;const x=nn((.2225045*(a=Zr(a))+.7168786*(i=Zr(i))+.0606169*(c=Zr(c)))/1);a===i&&i===c?g=b=x:(g=nn((.4360747*a+.3850649*i+.1430804*c)/Ot),b=nn((.0139322*a+.0971045*i+.7141733*c)/Ut));const E=116*x-16;return[E<0?0:E,500*(g-x),200*(x-b),p]}function Zr(a){return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function nn(a){return a>Ue?Math.pow(a,1/3):a/Le+Ht}function vr([a,i,c,p]){let g=(a+16)/116,b=isNaN(i)?g:g+i/500,x=isNaN(c)?g:g-c/200;return g=1*Zi(g),b=Ot*Zi(b),x=Ut*Zi(x),[$r(3.1338561*b-1.6168667*g-.4906146*x),$r(-.9787684*b+1.9161415*g+.033454*x),$r(.0719453*b-.2289914*g+1.4052427*x),p]}function $r(a){return(a=a<=.00304?12.92*a:1.055*Math.pow(a,1/2.4)-.055)<0?0:a>1?1:a}function Zi(a){return a>xe?a*a*a:Le*(a-Ht)}function lo(a){return parseInt(a.padEnd(2,a),16)/255}function gi(a,i){return Ds(i?a/100:a,0,1)}function Ds(a,i,c){return Math.min(Math.max(i,a),c)}function qd(a){return!a.some(Number.isNaN)}const wy={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 On{constructor(i,c,p,g=1,b=!0){this.r=i,this.g=c,this.b=p,this.a=g,b||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[i,c,p,g]))}static parse(i){if(i instanceof On)return i;if(typeof i!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=wy[p];if(g){const[x,E,L]=g;return[x/255,E/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[lo(p.slice(E,E+=x)),lo(p.slice(E,E+=x)),lo(p.slice(E,E+=x)),lo(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,L,A,D,O,U,j,Z,et,lt,pt,Ct]=x,yt=[D||" ",j||" ",lt].join("");if(yt===" "||yt===" /"||yt===",,"||yt===",,,"){const wt=[A,U,et].join(""),Zt=wt==="%%%"?100:wt===""?255:0;if(Zt){const Yt=[Ds(+L/Zt,0,1),Ds(+O/Zt,0,1),Ds(+Z/Zt,0,1),pt?gi(+pt,Ct):1];if(qd(Yt))return Yt}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,L,A,D,O,U,j,Z]=b,et=[L||" ",D||" ",U].join("");if(et===" "||et===" /"||et===",,"||et===",,,"){const lt=[+E,Ds(+A,0,100),Ds(+O,0,100),j?gi(+j,Z):1];if(qd(lt))return function([pt,Ct,yt,wt]){function Zt(Yt){const me=(Yt+pt/30)%12,be=Ct*Math.min(yt,1-yt);return yt-be*Math.max(-1,Math.min(me-3,9-me,1))}return pt=Vn(pt),Ct/=100,yt/=100,[Zt(0),Zt(8),Zt(4),wt]}(lt)}}}(i);return c?new On(...c,!1):void 0}get rgb(){const{r:i,g:c,b:p,a:g}=this,b=g||1/0;return this.overwriteGetter("rgb",[i/b,c/b,p/b,g])}get hcl(){return this.overwriteGetter("hcl",function(i){const[c,p,g,b]=nr(i),x=Math.sqrt(p*p+g*g);return[Math.round(1e4*x)?Vn(Math.atan2(g,p)*_n):NaN,x,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",nr(this.rgb))}overwriteGetter(i,c){return Object.defineProperty(this,i,{value:c}),c}toString(){const[i,c,p,g]=this.rgb;return`rgba(${[i,c,p].map(b=>Math.round(255*b)).join(",")},${g})`}}On.black=new On(0,0,0,1),On.white=new On(1,1,1,1),On.transparent=new On(0,0,0,0),On.red=new On(1,0,0,1);class Uf{constructor(i,c,p){this.sensitivity=i?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,c){return this.collator.compare(i,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Gf{constructor(i,c,p,g,b){this.text=i,this.image=c,this.scale=p,this.fontStack=g,this.textColor=b}}class Lo{constructor(i){this.sections=i}static fromString(i){return new Lo([new Gf(i,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(i=>i.text.length!==0||i.image&&i.image.name.length!==0)}static factory(i){return i instanceof Lo?i:Lo.fromString(i)}toString(){return this.sections.length===0?"":this.sections.map(i=>i.text).join("")}}class uo{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof uo)return i;if(typeof i=="number")return new uo([i,i,i,i]);if(Array.isArray(i)&&!(i.length<1||i.length>4)){for(const c of i)if(typeof c!="number")return;switch(i.length){case 1:i=[i[0],i[0],i[0],i[0]];break;case 2:i=[i[0],i[1],i[0],i[1]];break;case 3:i=[i[0],i[1],i[2],i[1]]}return new uo(i)}}toString(){return JSON.stringify(this.values)}}const ju=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xo{constructor(i){this.values=i.slice()}static parse(i){if(i instanceof Xo)return i;if(Array.isArray(i)&&!(i.length<1)&&i.length%2==0){for(let c=0;c=0&&a<=255&&typeof i=="number"&&i>=0&&i<=255&&typeof c=="number"&&c>=0&&c<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[a,i,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[a,i,c,p]:[a,i,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Wc(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof On||a instanceof Uf||a instanceof Lo||a instanceof uo||a instanceof Xo||a instanceof Yo)return!0;if(Array.isArray(a)){for(const i of a)if(!Wc(i))return!1;return!0}if(typeof a=="object"){for(const i in a)if(!Wc(a[i]))return!1;return!0}return!1}function Xr(a){if(a===null)return Hr;if(typeof a=="string")return Je;if(typeof a=="boolean")return Ye;if(typeof a=="number")return oe;if(a instanceof On)return Lr;if(a instanceof Uf)return ha;if(a instanceof Lo)return Dr;if(a instanceof uo)return ut;if(a instanceof Xo)return q;if(a instanceof Yo)return V;if(Array.isArray(a)){const i=a.length;let c;for(const p of a){const g=Xr(p);if(c){if(c===g)continue;c=Ze;break}c=g}return X(c||Ze,i)}return Zo}function Wu(a){const i=typeof a;return a===null?"":i==="string"||i==="number"||i==="boolean"?String(a):a instanceof On||a instanceof Lo||a instanceof uo||a instanceof Xo||a instanceof Yo?a.toString():JSON.stringify(a)}class Na{constructor(i,c){this.type=i,this.value=c}static parse(i,c){if(i.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!Wc(i[1]))return c.error("invalid value");const p=i[1];let g=Xr(p);const b=c.expectedType;return g.kind!=="array"||g.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(g=b),new Na(g,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class fr{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}const Hc={string:Je,number:oe,boolean:Ye,object:Zo};class Po{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");let p,g=1;const b=i[0];if(b==="array"){let E,L;if(i.length>2){const A=i[1];if(typeof A!="string"||!(A in Hc)||A==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Hc[A],g++}else E=Ze;if(i.length>3){if(i[2]!==null&&(typeof i[2]!="number"||i[2]<0||i[2]!==Math.floor(i[2])))return c.error('The length argument to "array" must be a positive integer literal',2);L=i[2],g++}p=X(E,L)}else{if(!Hc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Hc[b]}const x=[];for(;gi.outputDefined())}}const Zc={"to-boolean":Ye,"to-color":Lr,"to-number":oe,"to-string":Je};class Rs{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");const p=i[0];if(!Zc[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&i.length!==2)return c.error("Expected one argument.");const g=Zc[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Jl(c[0],c[1],c[2],c[3]),!p))return new On(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new fr(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(i);const g=uo.parse(c);if(g)return g}throw new fr(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(i);const g=Xo.parse(c);if(g)return g}throw new fr(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(i),c===null)return 0;const g=Number(c);if(!isNaN(g))return g}throw new fr(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Lo.fromString(Wu(this.args[0].evaluate(i)));case"resolvedImage":return Yo.fromString(Wu(this.args[0].evaluate(i)));default:return Wu(this.args[0].evaluate(i))}}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}const Hu=["Unknown","Point","LineString","Polygon"];class zn{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"?Hu[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(i){let c=this._parseColorCache[i];return c||(c=this._parseColorCache[i]=On.parse(i)),c}}class Xc{constructor(i,c,p=[],g,b=new gl,x=[]){this.registry=i,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=g,this._isConstant=c}parse(i,c,p,g,b={}){return c?this.concat(c,p,g)._parse(i,b):this._parse(i,b)}_parse(i,c){function p(g,b,x){return x==="assert"?new Po(b,[g]):x==="coerce"?new Rs(b,[g]):g}if(i!==null&&typeof i!="string"&&typeof i!="boolean"&&typeof i!="number"||(i=["literal",i]),Array.isArray(i)){if(i.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=i[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[g];if(b){let x=b.parse(i,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,L=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||L.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(E.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(E,L))return null}else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"assert")}if(!(x instanceof Na)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new zn;try{x=new Na(x.type,x.evaluate(E))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(i===void 0?"'undefined' value invalid. Use null instead.":typeof i=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,c,p){const g=typeof i=="number"?this.path.concat(i):this.path,b=p?this.scope.concat(p):this.scope;return new Xc(this.registry,this._isConstant,g,c||null,b,this.errors)}error(i,...c){const p=`${this.key}${c.map(g=>`[${g}]`).join("")}`;this.errors.push(new Hi(p,i))}checkSubtype(i,c){const p=Q(i,c);return p&&this.error(p),p}}class Ql{constructor(i,c,p){this.type=ha,this.locale=p,this.caseSensitive=i,this.diacriticSensitive=c}static parse(i,c){if(i.length!==2)return c.error("Expected one argument.");const p=i[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const g=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Ye);if(!g)return null;const b=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Ye);if(!b)return null;let x=null;return p.locale&&(x=c.parse(p.locale,1,Je),!x)?null:new Ql(g,b,x)}evaluate(i){return new Uf(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}}const Oa=8192;function Yc(a,i){a[0]=Math.min(a[0],i[0]),a[1]=Math.min(a[1],i[1]),a[2]=Math.max(a[2],i[0]),a[3]=Math.max(a[3],i[1])}function Zu(a,i){return!(a[0]<=i[0]||a[2]>=i[2]||a[1]<=i[1]||a[3]>=i[3])}function Sy(a,i){const c=(180+a[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,g=Math.pow(2,i.z);return[Math.round(c*g*Oa),Math.round(p*g*Oa)]}function jd(a,i,c){const p=a[0]-i[0],g=a[1]-i[1],b=a[0]-c[0],x=a[1]-c[1];return p*x-b*g==0&&p*b<=0&&g*x<=0}function Kc(a,i){let c=!1;for(let x=0,E=i.length;x(p=a)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-g[0])*(p[1]-g[1])/(b[1]-g[1])+g[0]&&(c=!c)}}var p,g,b;return c}function Ey(a,i){for(let c=0;c0&&E<0||x<0&&E>0}function Iy(a,i,c){for(const A of c)for(let D=0;Dc[2]){const g=.5*p;let b=a[0]-c[0]>g?-p:c[0]-a[0]>g?p:0;b===0&&(b=a[0]-c[2]>g?-p:c[2]-a[0]>g?p:0),a[0]+=b}Yc(i,a)}function Qc(a,i,c,p){const g=Math.pow(2,p.z)*Oa,b=[p.x*Oa,p.y*Oa],x=[];for(const E of a)for(const L of E){const A=[L.x+b[0],L.y+b[1]];Yd(A,i,c,g),x.push(A)}return x}function Kd(a,i,c,p){const g=Math.pow(2,p.z)*Oa,b=[p.x*Oa,p.y*Oa],x=[];for(const L of a){const A=[];for(const D of L){const O=[D.x+b[0],D.y+b[1]];Yc(i,O),A.push(O)}x.push(A)}if(i[2]-i[0]<=g/2){(E=i)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const L of x)for(const A of L)Yd(A,i,c,g)}var E;return x}class yl{constructor(i,c){this.type=Ye,this.geojson=i,this.geometries=c}static parse(i,c){if(i.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(Wc(i[1])){const p=i[1];if(p.type==="FeatureCollection"){const g=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&g.push(E),x==="MultiPolygon"&&g.push(...E)}if(g.length)return new yl(p,{type:"MultiPolygon",coordinates:g})}else if(p.type==="Feature"){const g=p.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new yl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new yl(p,p)}return c.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(i.geometry()!=null&&i.canonicalID()!=null){if(i.geometryType()==="Point")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=Jc(p.coordinates,b,x),L=Qc(c.geometry(),g,b,x);if(!Zu(g,b))return!1;for(const A of L)if(!Kc(A,E))return!1}if(p.type==="MultiPolygon"){const E=Xd(p.coordinates,b,x),L=Qc(c.geometry(),g,b,x);if(!Zu(g,b))return!1;for(const A of L)if(!Ey(A,E))return!1}return!0}(i,this.geometries);if(i.geometryType()==="LineString")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=Jc(p.coordinates,b,x),L=Kd(c.geometry(),g,b,x);if(!Zu(g,b))return!1;for(const A of L)if(!Hd(A,E))return!1}if(p.type==="MultiPolygon"){const E=Xd(p.coordinates,b,x),L=Kd(c.geometry(),g,b,x);if(!Zu(g,b))return!1;for(const A of L)if(!Zd(A,E))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class $c{constructor(i,c){this.type=c.type,this.name=i,this.boundExpression=c}static parse(i,c){if(i.length!==2||typeof i[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const p=i[1];return c.scope.has(p)?new $c(p,c.scope.get(p)):c.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}}class Mo{constructor(i,c,p,g){this.name=i,this.type=c,this._evaluate=p,this.args=g}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}static parse(i,c){const p=i[0],g=Mo.definitions[p];if(!g)return c.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(g)?g[0]:g.type,x=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===i.length-1);let L=null;for(const[A,D]of E){L=new Xc(c.registry,Xu,c.path,null,c.scope);const O=[];let U=!1;for(let j=1;j{return U=O,Array.isArray(U)?`(${U.map(it).join(", ")})`:`(${it(U.type)}...)`;var U}).join(" | "),D=[];for(let O=1;O{c=i?c&&Xu(p):c&&p instanceof Na}),!!c&&th(a)&&Ku(a,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function th(a){if(a instanceof Mo&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof yl)return!1;let i=!0;return a.eachChild(c=>{i&&!th(c)&&(i=!1)}),i}function Yu(a){if(a instanceof Mo&&a.name==="feature-state")return!1;let i=!0;return a.eachChild(c=>{i&&!Yu(c)&&(i=!1)}),i}function Ku(a,i){if(a instanceof Mo&&i.indexOf(a.name)>=0)return!1;let c=!0;return a.eachChild(p=>{c&&!Ku(p,i)&&(c=!1)}),c}function Ju(a,i){const c=a.length-1;let p,g,b=0,x=c,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=a[E],g=a[E+1],p<=i){if(E===c||ii))throw new fr("Input is not a number.");x=E-1}return 0}class Qu{constructor(i,c,p){this.type=i,this.input=c,this.labels=[],this.outputs=[];for(const[g,b]of p)this.labels.push(g),this.outputs.push(b)}static parse(i,c){if(i.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return c.error("Expected an even number of arguments.");const p=c.parse(i[1],1,oe);if(!p)return null;const g=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let x=1;x=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=c.parse(L,D,b);if(!O)return null;b=b||O.type,g.push([E,O])}return new Qu(b,p,g)}evaluate(i){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(i);const g=this.input.evaluate(i);if(g<=c[0])return p[0].evaluate(i);const b=c.length;return g>=c[b-1]?p[b-1].evaluate(i):p[Ju(c,g)].evaluate(i)}eachChild(i){i(this.input);for(const c of this.outputs)i(c)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Cy(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ty=Jd;function Jd(a,i,c,p){this.cx=3*a,this.bx=3*(c-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(p-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=i,this.p2x=c,this.p2y=p}Jd.prototype={sampleCurveX:function(a){return((this.ax*a+this.bx)*a+this.cx)*a},sampleCurveY:function(a){return((this.ay*a+this.by)*a+this.cy)*a},sampleCurveDerivativeX:function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},solveCurveX:function(a,i){if(i===void 0&&(i=1e-6),a<0)return 0;if(a>1)return 1;for(var c=a,p=0;p<8;p++){var g=this.sampleCurveX(c)-a;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(a,i){return this.sampleCurveY(this.solveCurveX(a,i))}};var Ly=Cy(Ty);function _l(a,i,c){return a+c*(i-a)}function eh(a,i,c){return a.map((p,g)=>_l(p,i[g],c))}const Xi={number:_l,color:function(a,i,c,p="rgb"){switch(p){case"rgb":{const[g,b,x,E]=eh(a.rgb,i.rgb,c);return new On(g,b,x,E,!1)}case"hcl":{const[g,b,x,E]=a.hcl,[L,A,D,O]=i.hcl;let U,j;if(isNaN(g)||isNaN(L))isNaN(g)?isNaN(L)?U=NaN:(U=L,x!==1&&x!==0||(j=A)):(U=g,D!==1&&D!==0||(j=b));else{let Ct=L-g;L>g&&Ct>180?Ct-=360:L180&&(Ct+=360),U=g+c*Ct}const[Z,et,lt,pt]=function([Ct,yt,wt,Zt]){return Ct=isNaN(Ct)?0:Ct*qe,vr([wt,Math.cos(Ct)*yt,Math.sin(Ct)*yt,Zt])}([U,j??_l(b,A,c),_l(x,D,c),_l(E,O,c)]);return new On(Z,et,lt,pt,!1)}case"lab":{const[g,b,x,E]=vr(eh(a.lab,i.lab,c));return new On(g,b,x,E,!1)}}},array:eh,padding:function(a,i,c){return new uo(eh(a.values,i.values,c))},variableAnchorOffsetCollection:function(a,i,c){const p=a.values,g=i.values;if(p.length!==g.length)throw new fr(`Cannot interpolate values of different length. from: ${a.toString()}, to: ${i.toString()}`);const b=[];for(let x=0;xtypeof D!="number"||D<0||D>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:A}}}if(i.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(b=c.parse(b,2,oe),!b)return null;const E=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Lr:c.expectedType&&c.expectedType.kind!=="value"&&(L=c.expectedType);for(let A=0;A=D)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const Z=c.parse(O,j,L);if(!Z)return null;L=L||Z.type,E.push([D,Z])}return It(L,oe)||It(L,Lr)||It(L,ut)||It(L,q)||It(L,X(oe))?new Ai(L,p,g,b,E):c.error(`Type ${it(L)} is not interpolatable.`)}evaluate(i){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(i);const g=this.input.evaluate(i);if(g<=c[0])return p[0].evaluate(i);const b=c.length;if(g>=c[b-1])return p[b-1].evaluate(i);const x=Ju(c,g),E=Ai.interpolationFactor(this.interpolation,g,c[x],c[x+1]),L=p[x].evaluate(i),A=p[x+1].evaluate(i);switch(this.operator){case"interpolate":return Xi[this.type.kind](L,A,E);case"interpolate-hcl":return Xi.color(L,A,E,"hcl");case"interpolate-lab":return Xi.color(L,A,E,"lab")}}eachChild(i){i(this.input);for(const c of this.outputs)i(c)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}}function Pn(a,i,c,p){const g=p-c,b=a-c;return g===0?0:i===1?b/g:(Math.pow(i,b)-1)/(Math.pow(i,g)-1)}class nh{constructor(i,c){this.type=i,this.args=c}static parse(i,c){if(i.length<2)return c.error("Expectected at least one argument.");let p=null;const g=c.expectedType;g&&g.kind!=="value"&&(p=g);const b=[];for(const E of i.slice(1)){const L=c.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=g&&b.some(E=>Q(g,E.type));return new nh(x?Ze:p,b)}evaluate(i){let c,p=null,g=0;for(const b of this.args)if(g++,p=b.evaluate(i),p&&p instanceof Yo&&!p.available&&(c||(c=p.name),p=null,g===this.args.length&&(p=c)),p!==null)break;return p}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}}class rh{constructor(i,c){this.type=c.type,this.bindings=[].concat(i),this.result=c}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(const c of this.bindings)i(c[1]);i(this.result)}static parse(i,c){if(i.length<4)return c.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new fr(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new fr(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}}class jf{constructor(i,c){this.type=Ye,this.needle=i,this.haystack=c}static parse(i,c){if(i.length!==3)return c.error(`Expected 2 arguments, but found ${i.length-1} instead.`);const p=c.parse(i[1],1,Ze),g=c.parse(i[2],2,Ze);return p&&g?bt(p.type,[Ye,Je,oe,Hr,Ze])?new jf(p,g):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(p.type)} instead`):null}evaluate(i){const c=this.needle.evaluate(i),p=this.haystack.evaluate(i);if(!p)return!1;if(!dt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${it(Xr(c))} instead.`);if(!dt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${it(Xr(p))} instead.`);return p.indexOf(c)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}}class ih{constructor(i,c,p){this.type=oe,this.needle=i,this.haystack=c,this.fromIndex=p}static parse(i,c){if(i.length<=2||i.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const p=c.parse(i[1],1,Ze),g=c.parse(i[2],2,Ze);if(!p||!g)return null;if(!bt(p.type,[Ye,Je,oe,Hr,Ze]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(p.type)} instead`);if(i.length===4){const b=c.parse(i[3],3,oe);return b?new ih(p,g,b):null}return new ih(p,g)}evaluate(i){const c=this.needle.evaluate(i),p=this.haystack.evaluate(i);if(!dt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${it(Xr(c))} instead.`);if(!dt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${it(Xr(p))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(i);return p.indexOf(c,g)}return p.indexOf(c)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}}class Wf{constructor(i,c,p,g,b,x){this.inputType=i,this.type=c,this.input=p,this.cases=g,this.outputs=b,this.otherwise=x}static parse(i,c){if(i.length<5)return c.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return c.error("Expected an even number of arguments.");let p,g;c.expectedType&&c.expectedType.kind!=="value"&&(g=c.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Z=="number"&&Math.floor(Z)!==Z)return U.error("Numeric branch labels must be integer values.");if(p){if(U.checkSubtype(p,Xr(Z)))return null}else p=Xr(Z);if(b[String(Z)]!==void 0)return U.error("Branch labels must be unique.");b[String(Z)]=x.length}const j=c.parse(O,A,g);if(!j)return null;g=g||j.type,x.push(j)}const E=c.parse(i[1],1,Ze);if(!E)return null;const L=c.parse(i[i.length-1],i.length-1,g);return L?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new Wf(p,g,E,b,x,L):null}evaluate(i){const c=this.input.evaluate(i);return(Xr(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}}class Hf{constructor(i,c,p){this.type=i,this.branches=c,this.otherwise=p}static parse(i,c){if(i.length<4)return c.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const g=[];for(let x=1;xc.outputDefined())&&this.otherwise.outputDefined()}}class oh{constructor(i,c,p,g){this.type=i,this.input=c,this.beginIndex=p,this.endIndex=g}static parse(i,c){if(i.length<=2||i.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);const p=c.parse(i[1],1,Ze),g=c.parse(i[2],2,oe);if(!p||!g)return null;if(!bt(p.type,[X(Ze),Je,Ze]))return c.error(`Expected first argument to be of type array or string, but found ${it(p.type)} instead`);if(i.length===4){const b=c.parse(i[3],3,oe);return b?new oh(p.type,p,g,b):null}return new oh(p.type,p,g)}evaluate(i){const c=this.input.evaluate(i),p=this.beginIndex.evaluate(i);if(!dt(c,["string","array"]))throw new fr(`Expected first argument to be of type array or string, but found ${it(Xr(c))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(i);return c.slice(p,g)}return c.slice(p)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}}function Qd(a,i){return a==="=="||a==="!="?i.kind==="boolean"||i.kind==="string"||i.kind==="number"||i.kind==="null"||i.kind==="value":i.kind==="string"||i.kind==="number"||i.kind==="value"}function $d(a,i,c,p){return p.compare(i,c)===0}function $l(a,i,c){const p=a!=="=="&&a!=="!=";return class fS{constructor(b,x,E){this.type=Ye,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let L=x.parse(b[1],1,Ze);if(!L)return null;if(!Qd(E,L.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${it(L.type)}'.`);let A=x.parse(b[2],2,Ze);if(!A)return null;if(!Qd(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${it(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${it(L.type)}' and '${it(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new Po(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new Po(L.type,[A])));let D=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(D=x.parse(b[3],3,ha),!D)return null}return new fS(L,A,D)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new fr(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!=="string"||A.kind!=="string")return i(b,x,E)}return this.collator?c(b,x,E,this.collator.evaluate(b)):i(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Py=$l("==",function(a,i,c){return i===c},$d),My=$l("!=",function(a,i,c){return i!==c},function(a,i,c,p){return!$d(0,i,c,p)}),Ay=$l("<",function(a,i,c){return i",function(a,i,c){return i>c},function(a,i,c,p){return p.compare(i,c)>0}),Dy=$l("<=",function(a,i,c){return i<=c},function(a,i,c,p){return p.compare(i,c)<=0}),Ry=$l(">=",function(a,i,c){return i>=c},function(a,i,c,p){return p.compare(i,c)>=0});class Zf{constructor(i,c,p,g,b){this.type=Je,this.number=i,this.locale=c,this.currency=p,this.minFractionDigits=g,this.maxFractionDigits=b}static parse(i,c){if(i.length!==3)return c.error("Expected two arguments.");const p=c.parse(i[1],1,oe);if(!p)return null;const g=i[2];if(typeof g!="object"||Array.isArray(g))return c.error("NumberFormat options argument must be an object.");let b=null;if(g.locale&&(b=c.parse(g.locale,1,Je),!b))return null;let x=null;if(g.currency&&(x=c.parse(g.currency,1,Je),!x))return null;let E=null;if(g["min-fraction-digits"]&&(E=c.parse(g["min-fraction-digits"],1,oe),!E))return null;let L=null;return g["max-fraction-digits"]&&(L=c.parse(g["max-fraction-digits"],1,oe),!L)?null:new Zf(p,b,x,E,L)}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}}class sh{constructor(i){this.type=Dr,this.sections=i}static parse(i,c){if(i.length<2)return c.error("Expected at least one argument.");const p=i[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const g=[];let b=!1;for(let x=1;x<=i.length-1;++x){const E=i[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let L=null;if(E["font-scale"]&&(L=c.parse(E["font-scale"],1,oe),!L))return null;let A=null;if(E["text-font"]&&(A=c.parse(E["text-font"],1,X(Je)),!A))return null;let D=null;if(E["text-color"]&&(D=c.parse(E["text-color"],1,Lr),!D))return null;const O=g[g.length-1];O.scale=L,O.font=A,O.textColor=D}else{const L=c.parse(i[x],1,Ze);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,g.push({content:L,scale:null,font:null,textColor:null})}}return new sh(g)}evaluate(i){return new Lo(this.sections.map(c=>{const p=c.content.evaluate(i);return Xr(p)===V?new Gf("",p,null,null,null):new Gf(Wu(p),null,c.scale?c.scale.evaluate(i):null,c.font?c.font.evaluate(i).join(","):null,c.textColor?c.textColor.evaluate(i):null)}))}eachChild(i){for(const c of this.sections)i(c.content),c.scale&&i(c.scale),c.font&&i(c.font),c.textColor&&i(c.textColor)}outputDefined(){return!1}}class Xf{constructor(i){this.type=V,this.input=i}static parse(i,c){if(i.length!==2)return c.error("Expected two arguments.");const p=c.parse(i[1],1,Je);return p?new Xf(p):c.error("No image name provided.")}evaluate(i){const c=this.input.evaluate(i),p=Yo.fromString(c);return p&&i.availableImages&&(p.available=i.availableImages.indexOf(c)>-1),p}eachChild(i){i(this.input)}outputDefined(){return!1}}class Yf{constructor(i){this.type=oe,this.input=i}static parse(i,c){if(i.length!==2)return c.error(`Expected 1 argument, but found ${i.length-1} instead.`);const p=c.parse(i[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${it(p.type)} instead.`):new Yf(p):null}evaluate(i){const c=this.input.evaluate(i);if(typeof c=="string"||Array.isArray(c))return c.length;throw new fr(`Expected value to be of type string or array, but found ${it(Xr(c))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}}const tu={"==":Py,"!=":My,">":ky,"<":Ay,">=":Ry,"<=":Dy,array:Po,at:qf,boolean:Po,case:Hf,coalesce:nh,collator:Ql,format:sh,image:Xf,in:jf,"index-of":ih,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:Yf,let:rh,literal:Na,match:Wf,number:Po,"number-format":Zf,object:Po,slice:oh,step:Qu,string:Po,"to-boolean":Rs,"to-color":Rs,"to-number":Rs,"to-string":Rs,var:$c,within:yl};function tm(a,[i,c,p,g]){i=i.evaluate(a),c=c.evaluate(a),p=p.evaluate(a);const b=g?g.evaluate(a):1,x=Jl(i,c,p,b);if(x)throw new fr(x);return new On(i/255,c/255,p/255,b,!1)}function em(a,i){return a in i}function Kf(a,i){const c=i[a];return c===void 0?null:c}function vl(a){return{type:a}}function nm(a){return{result:"success",value:a}}function eu(a){return{result:"error",value:a}}function nu(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function rm(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Jf(a){return!!a.expression&&a.expression.interpolated}function En(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function ah(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Ny(a){return a}function im(a,i){const c=i.type==="color",p=a.stops&&typeof a.stops[0][0]=="object",g=p||!(p||a.property!==void 0),b=a.type||(Jf(i)?"exponential":"interval");if(c||i.type==="padding"){const D=c?On.parse:uo.parse;(a=Ho({},a)).stops&&(a.stops=a.stops.map(O=>[O[0],D(O[1])])),a.default=D(a.default?a.default:i.default)}if(a.colorSpace&&(x=a.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${a.colorSpace}"`);var x;let E,L,A;if(b==="exponential")E=vn;else if(b==="interval")E=Oy;else if(b==="categorical"){E=Rr,L=Object.create(null);for(const D of a.stops)L[D[0]]=D[1];A=typeof a.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=Qf}if(p){const D={},O=[];for(let Z=0;ZZ[0]),evaluate:({zoom:Z},et)=>vn({stops:U,base:a.base},i,Z).evaluate(Z,et)}}if(g){const D=b==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ai.interpolationFactor.bind(void 0,D),zoomStops:a.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(a,i,O,L,A)}}return{kind:"source",evaluate(D,O){const U=O&&O.properties?O.properties[a.property]:void 0;return U===void 0?$u(a.default,i.default):E(a,i,U,L,A)}}}function $u(a,i,c){return a!==void 0?a:i!==void 0?i:c!==void 0?c:void 0}function Rr(a,i,c,p,g){return $u(typeof c===g?p[c]:void 0,a.default,i.default)}function Oy(a,i,c){if(En(c)!=="number")return $u(a.default,i.default);const p=a.stops.length;if(p===1||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[p-1][0])return a.stops[p-1][1];const g=Ju(a.stops.map(b=>b[0]),c);return a.stops[g][1]}function vn(a,i,c){const p=a.base!==void 0?a.base:1;if(En(c)!=="number")return $u(a.default,i.default);const g=a.stops.length;if(g===1||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[g-1][0])return a.stops[g-1][1];const b=Ju(a.stops.map(D=>D[0]),c),x=function(D,O,U,j){const Z=j-U,et=D-U;return Z===0?0:O===1?et/Z:(Math.pow(O,et)-1)/(Math.pow(O,Z)-1)}(c,p,a.stops[b][0],a.stops[b+1][0]),E=a.stops[b][1],L=a.stops[b+1][1],A=Xi[i.type]||Ny;return typeof E.evaluate=="function"?{evaluate(...D){const O=E.evaluate.apply(void 0,D),U=L.evaluate.apply(void 0,D);if(O!==void 0&&U!==void 0)return A(O,U,x,a.colorSpace)}}:A(E,L,x,a.colorSpace)}function Qf(a,i,c){switch(i.type){case"color":c=On.parse(c);break;case"formatted":c=Lo.fromString(c.toString());break;case"resolvedImage":c=Yo.fromString(c.toString());break;case"padding":c=uo.parse(c);break;default:En(c)===i.type||i.type==="enum"&&i.values[c]||(c=void 0)}return $u(c,a.default,i.default)}Mo.register(tu,{error:[{kind:"error"},[Je],(a,[i])=>{throw new fr(i.evaluate(a))}],typeof:[Je,[Ze],(a,[i])=>it(Xr(i.evaluate(a)))],"to-rgba":[X(oe,4),[Lr],(a,[i])=>{const[c,p,g,b]=i.evaluate(a).rgb;return[255*c,255*p,255*g,b]}],rgb:[Lr,[oe,oe,oe],tm],rgba:[Lr,[oe,oe,oe,oe],tm],has:{type:Ye,overloads:[[[Je],(a,[i])=>em(i.evaluate(a),a.properties())],[[Je,Zo],(a,[i,c])=>em(i.evaluate(a),c.evaluate(a))]]},get:{type:Ze,overloads:[[[Je],(a,[i])=>Kf(i.evaluate(a),a.properties())],[[Je,Zo],(a,[i,c])=>Kf(i.evaluate(a),c.evaluate(a))]]},"feature-state":[Ze,[Je],(a,[i])=>Kf(i.evaluate(a),a.featureState||{})],properties:[Zo,[],a=>a.properties()],"geometry-type":[Je,[],a=>a.geometryType()],id:[Ze,[],a=>a.id()],zoom:[oe,[],a=>a.globals.zoom],"heatmap-density":[oe,[],a=>a.globals.heatmapDensity||0],"line-progress":[oe,[],a=>a.globals.lineProgress||0],accumulated:[Ze,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[oe,vl(oe),(a,i)=>{let c=0;for(const p of i)c+=p.evaluate(a);return c}],"*":[oe,vl(oe),(a,i)=>{let c=1;for(const p of i)c*=p.evaluate(a);return c}],"-":{type:oe,overloads:[[[oe,oe],(a,[i,c])=>i.evaluate(a)-c.evaluate(a)],[[oe],(a,[i])=>-i.evaluate(a)]]},"/":[oe,[oe,oe],(a,[i,c])=>i.evaluate(a)/c.evaluate(a)],"%":[oe,[oe,oe],(a,[i,c])=>i.evaluate(a)%c.evaluate(a)],ln2:[oe,[],()=>Math.LN2],pi:[oe,[],()=>Math.PI],e:[oe,[],()=>Math.E],"^":[oe,[oe,oe],(a,[i,c])=>Math.pow(i.evaluate(a),c.evaluate(a))],sqrt:[oe,[oe],(a,[i])=>Math.sqrt(i.evaluate(a))],log10:[oe,[oe],(a,[i])=>Math.log(i.evaluate(a))/Math.LN10],ln:[oe,[oe],(a,[i])=>Math.log(i.evaluate(a))],log2:[oe,[oe],(a,[i])=>Math.log(i.evaluate(a))/Math.LN2],sin:[oe,[oe],(a,[i])=>Math.sin(i.evaluate(a))],cos:[oe,[oe],(a,[i])=>Math.cos(i.evaluate(a))],tan:[oe,[oe],(a,[i])=>Math.tan(i.evaluate(a))],asin:[oe,[oe],(a,[i])=>Math.asin(i.evaluate(a))],acos:[oe,[oe],(a,[i])=>Math.acos(i.evaluate(a))],atan:[oe,[oe],(a,[i])=>Math.atan(i.evaluate(a))],min:[oe,vl(oe),(a,i)=>Math.min(...i.map(c=>c.evaluate(a)))],max:[oe,vl(oe),(a,i)=>Math.max(...i.map(c=>c.evaluate(a)))],abs:[oe,[oe],(a,[i])=>Math.abs(i.evaluate(a))],round:[oe,[oe],(a,[i])=>{const c=i.evaluate(a);return c<0?-Math.round(-c):Math.round(c)}],floor:[oe,[oe],(a,[i])=>Math.floor(i.evaluate(a))],ceil:[oe,[oe],(a,[i])=>Math.ceil(i.evaluate(a))],"filter-==":[Ye,[Je,Ze],(a,[i,c])=>a.properties()[i.value]===c.value],"filter-id-==":[Ye,[Ze],(a,[i])=>a.id()===i.value],"filter-type-==":[Ye,[Je],(a,[i])=>a.geometryType()===i.value],"filter-<":[Ye,[Je,Ze],(a,[i,c])=>{const p=a.properties()[i.value],g=c.value;return typeof p==typeof g&&p{const c=a.id(),p=i.value;return typeof c==typeof p&&c":[Ye,[Je,Ze],(a,[i,c])=>{const p=a.properties()[i.value],g=c.value;return typeof p==typeof g&&p>g}],"filter-id->":[Ye,[Ze],(a,[i])=>{const c=a.id(),p=i.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ye,[Je,Ze],(a,[i,c])=>{const p=a.properties()[i.value],g=c.value;return typeof p==typeof g&&p<=g}],"filter-id-<=":[Ye,[Ze],(a,[i])=>{const c=a.id(),p=i.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ye,[Je,Ze],(a,[i,c])=>{const p=a.properties()[i.value],g=c.value;return typeof p==typeof g&&p>=g}],"filter-id->=":[Ye,[Ze],(a,[i])=>{const c=a.id(),p=i.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ye,[Ze],(a,[i])=>i.value in a.properties()],"filter-has-id":[Ye,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[Ye,[X(Je)],(a,[i])=>i.value.indexOf(a.geometryType())>=0],"filter-id-in":[Ye,[X(Ze)],(a,[i])=>i.value.indexOf(a.id())>=0],"filter-in-small":[Ye,[Je,X(Ze)],(a,[i,c])=>c.value.indexOf(a.properties()[i.value])>=0],"filter-in-large":[Ye,[Je,X(Ze)],(a,[i,c])=>function(p,g,b,x){for(;b<=x;){const E=b+x>>1;if(g[E]===p)return!0;g[E]>p?x=E-1:b=E+1}return!1}(a.properties()[i.value],c.value,0,c.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(a,[i,c])=>i.evaluate(a)&&c.evaluate(a)],[vl(Ye),(a,i)=>{for(const c of i)if(!c.evaluate(a))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(a,[i,c])=>i.evaluate(a)||c.evaluate(a)],[vl(Ye),(a,i)=>{for(const c of i)if(c.evaluate(a))return!0;return!1}]]},"!":[Ye,[Ye],(a,[i])=>!i.evaluate(a)],"is-supported-script":[Ye,[Je],(a,[i])=>{const c=a.globals&&a.globals.isSupportedScript;return!c||c(i.evaluate(a))}],upcase:[Je,[Je],(a,[i])=>i.evaluate(a).toUpperCase()],downcase:[Je,[Je],(a,[i])=>i.evaluate(a).toLowerCase()],concat:[Je,vl(Ze),(a,i)=>i.map(c=>Wu(c.evaluate(a))).join("")],"resolved-locale":[Je,[ha],(a,[i])=>i.evaluate(a).resolvedLocale()]});class Jn{constructor(i,c){var p;this.expression=i,this._warningHistory={},this._evaluator=new zn,this._defaultValue=c?(p=c).type==="color"&&ah(p.default)?new On(0,0,0,0):p.type==="color"?On.parse(p.default)||null:p.type==="padding"?uo.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Xo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(i,c,p,g,b,x){return this._evaluator.globals=i,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(i,c,p,g,b,x){this._evaluator.globals=i,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new fr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function Wn(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in tu}function bl(a,i){const c=new Xc(tu,Xu,[],i?function(g){const b={color:Lr,string:Je,number:oe,enum:Je,boolean:Ye,formatted:Dr,padding:ut,resolvedImage:V,variableAnchorOffsetCollection:q};return g.type==="array"?X(b[g.value]||Ze,g.length):b[g.type]}(i):void 0),p=c.parse(a,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?nm(new Jn(p,i)):eu(c.errors)}class lh{constructor(i,c){this.kind=i,this._styleExpression=c,this.isStateDependent=i!=="constant"&&!Yu(c.expression)}evaluateWithoutErrorHandling(i,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(i,c,p,g,b,x)}evaluate(i,c,p,g,b,x){return this._styleExpression.evaluate(i,c,p,g,b,x)}}class $f{constructor(i,c,p,g){this.kind=i,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=i!=="camera"&&!Yu(c.expression),this.interpolationType=g}evaluateWithoutErrorHandling(i,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(i,c,p,g,b,x)}evaluate(i,c,p,g,b,x){return this._styleExpression.evaluate(i,c,p,g,b,x)}interpolationFactor(i,c,p){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,i,c,p):0}}function om(a,i){const c=bl(a,i);if(c.result==="error")return c;const p=c.value.expression,g=th(p);if(!g&&!nu(i))return eu([new Hi("","data expressions not supported")]);const b=Ku(p,["zoom"]);if(!b&&!rm(i))return eu([new Hi("","zoom expressions not supported")]);const x=ch(p);return x||b?x instanceof Hi?eu([x]):x instanceof Ai&&!Jf(i)?eu([new Hi("",'"interpolate" expressions cannot be used with this property')]):nm(x?new $f(g?"camera":"composite",c.value,x.labels,x instanceof Ai?x.interpolation:void 0):new lh(g?"constant":"source",c.value)):eu([new Hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class uh{constructor(i,c){this._parameters=i,this._specification=c,Ho(this,im(this._parameters,this._specification))}static deserialize(i){return new uh(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}function ch(a){let i=null;if(a instanceof rh)i=ch(a.result);else if(a instanceof nh){for(const c of a.args)if(i=ch(c),i)break}else(a instanceof Qu||a instanceof Ai)&&a.input instanceof Mo&&a.input.name==="zoom"&&(i=a);return i instanceof Hi||a.eachChild(c=>{const p=ch(c);p instanceof Hi?i=p:!i&&p?i=new Hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&p&&i!==p&&(i=new Hi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}function hh(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const i of a.slice(1))if(!hh(i)&&typeof i!="boolean")return!1;return!0;default:return!0}}const sm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fh(a){if(a==null)return{filter:()=>!0,needGeometry:!1};hh(a)||(a=dh(a));const i=bl(a,sm);if(i.result==="error")throw new Error(i.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,g)=>i.value.evaluate(c,p,{},g),needGeometry:ph(a)}}function am(a,i){return ai?1:0}function ph(a){if(!Array.isArray(a))return!1;if(a[0]==="within")return!0;for(let i=1;i"||i==="<="||i===">="?tp(a[1],a[2],i):i==="any"?(c=a.slice(1),["any"].concat(c.map(dh))):i==="all"?["all"].concat(a.slice(1).map(dh)):i==="none"?["all"].concat(a.slice(1).map(dh).map(mh)):i==="in"?lm(a[1],a.slice(2)):i==="!in"?mh(lm(a[1],a.slice(2))):i==="has"?um(a[1]):i==="!has"?mh(um(a[1])):i!=="within"||a;var c}function tp(a,i,c){switch(a){case"$type":return[`filter-type-${c}`,i];case"$id":return[`filter-id-${c}`,i];default:return[`filter-${c}`,a,i]}}function lm(a,i){if(i.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(c=>typeof c!=typeof i[0])?["filter-in-large",a,["literal",i.sort(am)]]:["filter-in-small",a,["literal",i]]}}function um(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function mh(a){return["!",a]}function ep(a){const i=typeof a;if(i==="number"||i==="boolean"||i==="string"||a==null)return JSON.stringify(a);if(Array.isArray(a)){let g="[";for(const b of a)g+=`${ep(b)},`;return`${g}]`}const c=Object.keys(a).sort();let p="{";for(let g=0;gp.maximum?[new te(i,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function hm(a){const i=a.valueSpec,c=br(a.value.type);let p,g,b,x={};const E=c!=="categorical"&&a.value.property===void 0,L=!E,A=En(a.value.stops)==="array"&&En(a.value.stops[0])==="array"&&En(a.value.stops[0][0])==="object",D=Yi({key:a.key,value:a.value,valueSpec:a.styleSpec.function,validateSpec:a.validateSpec,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(j){if(c==="identity")return[new te(j.key,j.value,'identity function may not have a "stops" property')];let Z=[];const et=j.value;return Z=Z.concat(np({key:j.key,value:et,valueSpec:j.valueSpec,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,arrayElementValidator:O})),En(et)==="array"&&et.length===0&&Z.push(new te(j.key,et,"array must have at least one stop")),Z},default:function(j){return j.validateSpec({key:j.key,value:j.value,valueSpec:i,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec})}}});return c==="identity"&&E&&D.push(new te(a.key,a.value,'missing required property "property"')),c==="identity"||a.value.stops||D.push(new te(a.key,a.value,'missing required property "stops"')),c==="exponential"&&a.valueSpec.expression&&!Jf(a.valueSpec)&&D.push(new te(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(L&&!nu(a.valueSpec)?D.push(new te(a.key,a.value,"property functions not supported")):E&&!rm(a.valueSpec)&&D.push(new te(a.key,a.value,"zoom functions not supported"))),c!=="categorical"&&!A||a.value.property!==void 0||D.push(new te(a.key,a.value,'"property" property is required')),D;function O(j){let Z=[];const et=j.value,lt=j.key;if(En(et)!=="array")return[new te(lt,et,`array expected, ${En(et)} found`)];if(et.length!==2)return[new te(lt,et,`array length 2 expected, length ${et.length} found`)];if(A){if(En(et[0])!=="object")return[new te(lt,et,`object expected, ${En(et[0])} found`)];if(et[0].zoom===void 0)return[new te(lt,et,"object stop key must have zoom")];if(et[0].value===void 0)return[new te(lt,et,"object stop key must have value")];if(b&&b>br(et[0].zoom))return[new te(lt,et[0].zoom,"stop zoom values must appear in ascending order")];br(et[0].zoom)!==b&&(b=br(et[0].zoom),g=void 0,x={}),Z=Z.concat(Yi({key:`${lt}[0]`,value:et[0],valueSpec:{zoom:{}},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{zoom:gh,value:U}}))}else Z=Z.concat(U({key:`${lt}[0]`,value:et[0],valueSpec:{},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec},et));return Wn(za(et[1]))?Z.concat([new te(`${lt}[1]`,et[1],"expressions are not allowed in function stops.")]):Z.concat(j.validateSpec({key:`${lt}[1]`,value:et[1],valueSpec:i,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec}))}function U(j,Z){const et=En(j.value),lt=br(j.value),pt=j.value!==null?j.value:Z;if(p){if(et!==p)return[new te(j.key,pt,`${et} stop domain type must match previous stop domain type ${p}`)]}else p=et;if(et!=="number"&&et!=="string"&&et!=="boolean")return[new te(j.key,pt,"stop domain value must be a number, string, or boolean")];if(et!=="number"&&c!=="categorical"){let Ct=`number expected, ${et} found`;return nu(i)&&c===void 0&&(Ct+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new te(j.key,pt,Ct)]}return c!=="categorical"||et!=="number"||isFinite(lt)&&Math.floor(lt)===lt?c!=="categorical"&&et==="number"&&g!==void 0&<new te(`${a.key}${p.key}`,a.value,p.message));const c=i.value.expression||i.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!c.outputDefined())return[new te(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!Yu(c))return[new te(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!Yu(c))return[new te(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!Ku(c,["zoom","feature-state"]))return[new te(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!th(c))return[new te(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ba(a){const i=a.key,c=a.value,p=a.valueSpec,g=[];return Array.isArray(p.values)?p.values.indexOf(br(c))===-1&&g.push(new te(i,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(br(c))===-1&&g.push(new te(i,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),g}function ru(a){return hh(za(a.value))?Fa(Ho({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):rp(a)}function rp(a){const i=a.value,c=a.key;if(En(i)!=="array")return[new te(c,i,`array expected, ${En(i)} found`)];const p=a.styleSpec;let g,b=[];if(i.length<1)return[new te(c,i,"filter array must have at least 1 element")];switch(b=b.concat(Ba({key:`${c}[0]`,value:i[0],valueSpec:p.filter_operator,style:a.style,styleSpec:a.styleSpec})),br(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&br(i[1])==="$type"&&b.push(new te(c,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":i.length!==3&&b.push(new te(c,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(g=En(i[1]),g!=="string"&&b.push(new te(`${c}[1]`,i[1],`string expected, ${g} found`)));for(let x=2;x{A in c&&i.push(new te(p,c[A],`"${A}" is prohibited for ref layers`))}),g.layers.forEach(A=>{br(A.id)===E&&(L=A)}),L?L.ref?i.push(new te(p,c.ref,"ref cannot reference another ref layer")):x=br(L.type):i.push(new te(p,c.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(c.source){const L=g.sources&&g.sources[c.source],A=L&&br(L.type);L?A==="vector"&&x==="raster"?i.push(new te(p,c.source,`layer "${c.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?i.push(new te(p,c.source,`layer "${c.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?i.push(new te(p,c.source,`layer "${c.id}" requires a vector source`)):A!=="vector"||c["source-layer"]?A==="raster-dem"&&x!=="hillshade"?i.push(new te(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||i.push(new te(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new te(p,c,`layer "${c.id}" must specify a "source-layer"`)):i.push(new te(p,c.source,`source "${c.source}" not found`))}else i.push(new te(p,c,'missing required property "source"'));return i=i.concat(Yi({key:p,value:c,valueSpec:b.layer,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,objectElementValidators:{"*":()=>[],type:()=>a.validateSpec({key:`${p}.type`,value:c.type,valueSpec:b.layer.type,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,object:c,objectKey:"type"}),filter:ru,layout:L=>Yi({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>op(Ho({layerType:x},A))}}),paint:L=>Yi({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>ip(Ho({layerType:x},A))}})}})),i}function xl(a){const i=a.value,c=a.key,p=En(i);return p!=="string"?[new te(c,i,`string expected, ${p} found`)]:[]}const fm={promoteId:function({key:a,value:i}){if(En(i)==="string")return xl({key:a,value:i});{const c=[];for(const p in i)c.push(...xl({key:`${a}.${p}`,value:i[p]}));return c}}};function pm(a){const i=a.value,c=a.key,p=a.styleSpec,g=a.style,b=a.validateSpec;if(!i.type)return[new te(c,i,'"type" is required')];const x=br(i.type);let E;switch(x){case"vector":case"raster":return E=Yi({key:c,value:i,valueSpec:p[`source_${x.replace("-","_")}`],style:a.style,styleSpec:p,objectElementValidators:fm,validateSpec:b}),E;case"raster-dem":return E=function(L){var A;const D=(A=L.sourceName)!==null&&A!==void 0?A:"",O=L.value,U=L.styleSpec,j=U.source_raster_dem,Z=L.style;let et=[];const lt=En(O);if(O===void 0)return et;if(lt!=="object")return et.push(new te("source_raster_dem",O,`object expected, ${lt} found`)),et;const pt=br(O.encoding)==="custom",Ct=["redFactor","greenFactor","blueFactor","baseShift"],yt=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const wt in O)!pt&&Ct.includes(wt)?et.push(new te(wt,O[wt],`In "${D}": "${wt}" is only valid when "encoding" is set to "custom". ${yt} encoding found`)):j[wt]?et=et.concat(L.validateSpec({key:wt,value:O[wt],valueSpec:j[wt],validateSpec:L.validateSpec,style:Z,styleSpec:U})):et.push(new te(wt,O[wt],`unknown property "${wt}"`));return et}({sourceName:c,value:i,style:a.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=Yi({key:c,value:i,valueSpec:p.source_geojson,style:g,styleSpec:p,validateSpec:b,objectElementValidators:fm}),i.cluster)for(const L in i.clusterProperties){const[A,D]=i.clusterProperties[L],O=typeof A=="string"?[A,["accumulated"],["get",L]]:A;E.push(...Fa({key:`${c}.${L}.map`,value:D,validateSpec:b,expressionContext:"cluster-map"})),E.push(...Fa({key:`${c}.${L}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return Yi({key:c,value:i,valueSpec:p.source_video,style:g,validateSpec:b,styleSpec:p});case"image":return Yi({key:c,value:i,valueSpec:p.source_image,style:g,validateSpec:b,styleSpec:p});case"canvas":return[new te(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ba({key:`${c}.type`,value:i.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:b,styleSpec:p})}}function dm(a){const i=a.value,c=a.styleSpec,p=c.light,g=a.style;let b=[];const x=En(i);if(i===void 0)return b;if(x!=="object")return b=b.concat([new te("light",i,`object expected, ${x} found`)]),b;for(const E in i){const L=E.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?a.validateSpec({key:E,value:i[E],valueSpec:c.transition,validateSpec:a.validateSpec,style:g,styleSpec:c}):p[E]?a.validateSpec({key:E,value:i[E],valueSpec:p[E],validateSpec:a.validateSpec,style:g,styleSpec:c}):[new te(E,i[E],`unknown property "${E}"`)])}return b}function mm(a){const i=a.value,c=a.styleSpec,p=c.sky,g=a.style,b=En(i);if(i===void 0)return[];if(b!=="object")return[new te("sky",i,`object expected, ${b} found`)];let x=[];for(const E in i)x=x.concat(p[E]?Ns({key:E,value:i[E],valueSpec:p[E],style:g,styleSpec:c}):[new te(E,i[E],`unknown property "${E}"`)]);return x}function ec(a){const i=a.value,c=a.styleSpec,p=c.terrain,g=a.style;let b=[];const x=En(i);if(i===void 0)return b;if(x!=="object")return b=b.concat([new te("terrain",i,`object expected, ${x} found`)]),b;for(const E in i)b=b.concat(p[E]?a.validateSpec({key:E,value:i[E],valueSpec:p[E],validateSpec:a.validateSpec,style:g,styleSpec:c}):[new te(E,i[E],`unknown property "${E}"`)]);return b}function nc(a){let i=[];const c=a.value,p=a.key;if(Array.isArray(c)){const g=[],b=[];for(const x in c)c[x].id&&g.includes(c[x].id)&&i.push(new te(p,c,`all the sprites' ids must be unique, but ${c[x].id} is duplicated`)),g.push(c[x].id),c[x].url&&b.includes(c[x].url)&&i.push(new te(p,c,`all the sprites' URLs must be unique, but ${c[x].url} is duplicated`)),b.push(c[x].url),i=i.concat(Yi({key:`${p}[${x}]`,value:c[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:a.validateSpec}));return i}return xl({key:p,value:c})}const co={"*":()=>[],array:np,boolean:function(a){const i=a.value,c=a.key,p=En(i);return p!=="boolean"?[new te(c,i,`boolean expected, ${p} found`)]:[]},number:gh,color:function(a){const i=a.key,c=a.value,p=En(c);return p!=="string"?[new te(i,c,`color expected, ${p} found`)]:On.parse(String(c))?[]:[new te(i,c,`color expected, "${c}" found`)]},constants:cm,enum:Ba,filter:ru,function:hm,layer:tc,object:Yi,source:pm,light:dm,sky:mm,terrain:ec,string:xl,formatted:function(a){return xl(a).length===0?[]:Fa(a)},resolvedImage:function(a){return xl(a).length===0?[]:Fa(a)},padding:function(a){const i=a.key,c=a.value;if(En(c)==="array"){if(c.length<1||c.length>4)return[new te(i,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let g=[];for(let b=0;b[]}})),a.constants&&(c=c.concat(cm({key:"constants",value:a.constants,style:a,styleSpec:i,validateSpec:Ns}))),iu(c)}function Os(a){return function(i){return a({...i,validateSpec:Ns})}}function iu(a){return[].concat(a).sort((i,c)=>i.line-c.line)}function hs(a){return function(...i){return iu(a.apply(this,i))}}cs.source=hs(Os(pm)),cs.sprite=hs(Os(nc)),cs.glyphs=hs(Os(sp)),cs.light=hs(Os(dm)),cs.sky=hs(Os(mm)),cs.terrain=hs(Os(ec)),cs.layer=hs(Os(tc)),cs.filter=hs(Os(ru)),cs.paintProperty=hs(Os(ip)),cs.layoutProperty=hs(Os(op));const wl=cs,Fy=wl.light,ap=wl.paintProperty,By=wl.layoutProperty;function ou(a,i){let c=!1;if(i&&i.length)for(const p of i)a.fire(new ce(new Error(p.message))),c=!0;return c}class rc{constructor(i,c,p){const g=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;const x=new Int32Array(this.arrayBuffer);i=x[0],this.d=(c=x[1])+2*(p=x[2]);for(let L=0;L=O[Z+0]&&g>=O[Z+1])?(E[j]=!0,x.push(D[j])):E[j]=!1}}}}_forEachCell(i,c,p,g,b,x,E,L){const A=this._convertToCellCoord(i),D=this._convertToCellCoord(c),O=this._convertToCellCoord(p),U=this._convertToCellCoord(g);for(let j=A;j<=O;j++)for(let Z=D;Z<=U;Z++){const et=this.d*Z+j;if((!L||L(this._convertFromCellCoord(j),this._convertFromCellCoord(Z),this._convertFromCellCoord(j+1),this._convertFromCellCoord(Z+1)))&&b.call(this,i,c,p,g,et,x,E,L))return}}_convertFromCellCoord(i){return(i-this.padding)/this.scale}_convertToCellCoord(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const i=this.cells,c=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=a[b];g[b]=zs[p].shallow.indexOf(b)>=0?x:su(x,i)}a instanceof Error&&(g.message=a.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(g.$name=p),g}throw new Error("can't serialize object of type "+typeof a)}function au(a){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||a instanceof Blob||a instanceof Error||_h(a)||Re(a)||ArrayBuffer.isView(a)||a instanceof ImageData)return a;if(Array.isArray(a))return a.map(au);if(typeof a=="object"){const i=a.$name||"Object";if(!zs[i])throw new Error(`can't deserialize unregistered class ${i}`);const{klass:c}=zs[i];if(!c)throw new Error(`can't deserialize unregistered class ${i}`);if(c.deserialize)return c.deserialize(a);const p=Object.create(c.prototype);for(const g of Object.keys(a)){if(g==="$name")continue;const b=a[g];p[g]=zs[i].shallow.indexOf(g)>=0?b:au(b)}return p}throw new Error("can't deserialize object of type "+typeof a)}class gm{constructor(){this.first=!0}update(i,c){const p=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZooma>=128&&a<=255,Arabic:a=>a>=1536&&a<=1791,"Arabic Supplement":a=>a>=1872&&a<=1919,"Arabic Extended-A":a=>a>=2208&&a<=2303,"Hangul Jamo":a=>a>=4352&&a<=4607,"Unified Canadian Aboriginal Syllabics":a=>a>=5120&&a<=5759,Khmer:a=>a>=6016&&a<=6143,"Unified Canadian Aboriginal Syllabics Extended":a=>a>=6320&&a<=6399,"General Punctuation":a=>a>=8192&&a<=8303,"Letterlike Symbols":a=>a>=8448&&a<=8527,"Number Forms":a=>a>=8528&&a<=8591,"Miscellaneous Technical":a=>a>=8960&&a<=9215,"Control Pictures":a=>a>=9216&&a<=9279,"Optical Character Recognition":a=>a>=9280&&a<=9311,"Enclosed Alphanumerics":a=>a>=9312&&a<=9471,"Geometric Shapes":a=>a>=9632&&a<=9727,"Miscellaneous Symbols":a=>a>=9728&&a<=9983,"Miscellaneous Symbols and Arrows":a=>a>=11008&&a<=11263,"CJK Radicals Supplement":a=>a>=11904&&a<=12031,"Kangxi Radicals":a=>a>=12032&&a<=12255,"Ideographic Description Characters":a=>a>=12272&&a<=12287,"CJK Symbols and Punctuation":a=>a>=12288&&a<=12351,Hiragana:a=>a>=12352&&a<=12447,Katakana:a=>a>=12448&&a<=12543,Bopomofo:a=>a>=12544&&a<=12591,"Hangul Compatibility Jamo":a=>a>=12592&&a<=12687,Kanbun:a=>a>=12688&&a<=12703,"Bopomofo Extended":a=>a>=12704&&a<=12735,"CJK Strokes":a=>a>=12736&&a<=12783,"Katakana Phonetic Extensions":a=>a>=12784&&a<=12799,"Enclosed CJK Letters and Months":a=>a>=12800&&a<=13055,"CJK Compatibility":a=>a>=13056&&a<=13311,"CJK Unified Ideographs Extension A":a=>a>=13312&&a<=19903,"Yijing Hexagram Symbols":a=>a>=19904&&a<=19967,"CJK Unified Ideographs":a=>a>=19968&&a<=40959,"Yi Syllables":a=>a>=40960&&a<=42127,"Yi Radicals":a=>a>=42128&&a<=42191,"Hangul Jamo Extended-A":a=>a>=43360&&a<=43391,"Hangul Syllables":a=>a>=44032&&a<=55215,"Hangul Jamo Extended-B":a=>a>=55216&&a<=55295,"Private Use Area":a=>a>=57344&&a<=63743,"CJK Compatibility Ideographs":a=>a>=63744&&a<=64255,"Arabic Presentation Forms-A":a=>a>=64336&&a<=65023,"Vertical Forms":a=>a>=65040&&a<=65055,"CJK Compatibility Forms":a=>a>=65072&&a<=65103,"Small Form Variants":a=>a>=65104&&a<=65135,"Arabic Presentation Forms-B":a=>a>=65136&&a<=65279,"Halfwidth and Fullwidth Forms":a=>a>=65280&&a<=65519};function lu(a){for(const i of a)if(vh(i.charCodeAt(0)))return!0;return!1}function ym(a){for(const i of a)if(!_m(i.charCodeAt(0)))return!1;return!0}function _m(a){return!(pe.Arabic(a)||pe["Arabic Supplement"](a)||pe["Arabic Extended-A"](a)||pe["Arabic Presentation Forms-A"](a)||pe["Arabic Presentation Forms-B"](a))}function vh(a){return!(a!==746&&a!==747&&(a<4352||!(pe["Bopomofo Extended"](a)||pe.Bopomofo(a)||pe["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||pe["CJK Compatibility Ideographs"](a)||pe["CJK Compatibility"](a)||pe["CJK Radicals Supplement"](a)||pe["CJK Strokes"](a)||!(!pe["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||pe["CJK Unified Ideographs Extension A"](a)||pe["CJK Unified Ideographs"](a)||pe["Enclosed CJK Letters and Months"](a)||pe["Hangul Compatibility Jamo"](a)||pe["Hangul Jamo Extended-A"](a)||pe["Hangul Jamo Extended-B"](a)||pe["Hangul Jamo"](a)||pe["Hangul Syllables"](a)||pe.Hiragana(a)||pe["Ideographic Description Characters"](a)||pe.Kanbun(a)||pe["Kangxi Radicals"](a)||pe["Katakana Phonetic Extensions"](a)||pe.Katakana(a)&&a!==12540||!(!pe["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!pe["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||pe["Unified Canadian Aboriginal Syllabics"](a)||pe["Unified Canadian Aboriginal Syllabics Extended"](a)||pe["Vertical Forms"](a)||pe["Yijing Hexagram Symbols"](a)||pe["Yi Syllables"](a)||pe["Yi Radicals"](a))))}function lp(a){return!(vh(a)||function(i){return!!(pe["Latin-1 Supplement"](i)&&(i===167||i===169||i===174||i===177||i===188||i===189||i===190||i===215||i===247)||pe["General Punctuation"](i)&&(i===8214||i===8224||i===8225||i===8240||i===8241||i===8251||i===8252||i===8258||i===8263||i===8264||i===8265||i===8273)||pe["Letterlike Symbols"](i)||pe["Number Forms"](i)||pe["Miscellaneous Technical"](i)&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||i===9003||i>=9085&&i<=9114||i>=9150&&i<=9165||i===9167||i>=9169&&i<=9179||i>=9186&&i<=9215)||pe["Control Pictures"](i)&&i!==9251||pe["Optical Character Recognition"](i)||pe["Enclosed Alphanumerics"](i)||pe["Geometric Shapes"](i)||pe["Miscellaneous Symbols"](i)&&!(i>=9754&&i<=9759)||pe["Miscellaneous Symbols and Arrows"](i)&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||pe["CJK Symbols and Punctuation"](i)||pe.Katakana(i)||pe["Private Use Area"](i)||pe["CJK Compatibility Forms"](i)||pe["Small Form Variants"](i)||pe["Halfwidth and Fullwidth Forms"](i)||i===8734||i===8756||i===8757||i>=9984&&i<=10087||i>=10102&&i<=10131||i===65532||i===65533)}(a))}function bh(a){return a>=1424&&a<=2303||pe["Arabic Presentation Forms-A"](a)||pe["Arabic Presentation Forms-B"](a)}function vm(a,i){return!(!i&&bh(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||pe.Khmer(a))}function Vy(a){for(const i of a)if(bh(i.charCodeAt(0)))return!0;return!1}const Va=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(a){this.pluginStatus=a.pluginStatus,this.pluginURL=a.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(a){this.applyArabicShaping=a.applyArabicShaping,this.processBidirectionalText=a.processBidirectionalText,this.processStyledBidirectionalText=a.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class rr{constructor(i,c){this.zoom=i,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new gm,this.transition={})}isSupportedScript(i){return function(c,p){for(const g of c)if(!vm(g.charCodeAt(0),p))return!1;return!0}(i,Va.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,c=i-Math.floor(i),p=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class ic{constructor(i,c){this.property=i,this.value=c,this.expression=function(p,g){if(ah(p))return new uh(p,g);if(Wn(p)){const b=om(p,g);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return g.type==="color"&&typeof p=="string"?b=On.parse(p):g.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Xo.parse(p)):b=uo.parse(p),{kind:"constant",evaluate:()=>b}}}(c===void 0?i.specification.default:c,i.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(i,c,p){return this.property.possiblyEvaluate(this,i,c,p)}}class xh{constructor(i){this.property=i,this.value=new ic(i,void 0)}transitioned(i,c){return new bm(this.property,this.value,c,ft({},i.transition,this.transition),i.now)}untransitioned(){return new bm(this.property,this.value,null,{},0)}}class up{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return $(this._values[i].value.value)}setValue(i,c){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new xh(this._values[i].property)),this._values[i].value=new ic(this._values[i].property,c===null?void 0:$(c))}getTransition(i){return $(this._values[i].transition)}setTransition(i,c){Object.prototype.hasOwnProperty.call(this._values,i)||(this._values[i]=new xh(this._values[i].property)),this._values[i].transition=$(c)||void 0}serialize(){const i={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(i[c]=p);const g=this.getTransition(c);g!==void 0&&(i[`${c}-transition`]=g)}return i}transitioned(i,c){const p=new xm(this._properties);for(const g of Object.keys(this._values))p._values[g]=this._values[g].transitioned(i,c._values[g]);return p}untransitioned(){const i=new xm(this._properties);for(const c of Object.keys(this._values))i._values[c]=this._values[c].untransitioned();return i}}class bm{constructor(i,c,p,g,b){this.property=i,this.value=c,this.begin=b+g.delay||0,this.end=this.begin+g.duration||0,i.specification.transition&&(g.delay||g.duration)&&(this.prior=p)}possiblyEvaluate(i,c,p){const g=i.now||0,b=this.value.possiblyEvaluate(i,c,p),x=this.prior;if(x){if(g>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(g=1)return 1;const A=L*L,D=A*L;return 4*(L<.5?D:3*(L-A)+D-.75)}(E))}}return b}}class xm{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,c,p){const g=new oc(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(i,c,p);return g}hasTransition(){for(const i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class wm{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}hasValue(i){return this._values[i].value!==void 0}getValue(i){return $(this._values[i].value)}setValue(i,c){this._values[i]=new ic(this._values[i].property,c===null?void 0:$(c))}serialize(){const i={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(i[c]=p)}return i}possiblyEvaluate(i,c,p){const g=new oc(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(i,c,p);return g}}class fs{constructor(i,c,p){this.property=i,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(i){return this.value.kind==="constant"?this.value.value:i}evaluate(i,c,p,g){return this.property.evaluate(this.value,this.parameters,i,c,p,g)}}class oc{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class Te{constructor(i){this.specification=i}possiblyEvaluate(i,c){if(i.isDataDriven())throw new Error("Value should not be data driven");return i.expression.evaluate(c)}interpolate(i,c,p){const g=Xi[this.specification.type];return g?g(i,c,p):i}}class De{constructor(i,c){this.specification=i,this.overrides=c}possiblyEvaluate(i,c,p,g){return new fs(this,i.expression.kind==="constant"||i.expression.kind==="camera"?{kind:"constant",value:i.expression.evaluate(c,null,{},p,g)}:i.expression,c)}interpolate(i,c,p){if(i.value.kind!=="constant"||c.value.kind!=="constant")return i;if(i.value.value===void 0||c.value.value===void 0)return new fs(this,{kind:"constant",value:void 0},i.parameters);const g=Xi[this.specification.type];if(g){const b=g(i.value.value,c.value.value,p);return new fs(this,{kind:"constant",value:b},i.parameters)}return i}evaluate(i,c,p,g,b,x){return i.kind==="constant"?i.value:i.evaluate(c,p,g,b,x)}}class wh extends De{possiblyEvaluate(i,c,p,g){if(i.value===void 0)return new fs(this,{kind:"constant",value:void 0},c);if(i.expression.kind==="constant"){const b=i.expression.evaluate(c,null,{},p,g),x=i.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,c);return new fs(this,{kind:"constant",value:E},c)}if(i.expression.kind==="camera"){const b=this._calculate(i.expression.evaluate({zoom:c.zoom-1}),i.expression.evaluate({zoom:c.zoom}),i.expression.evaluate({zoom:c.zoom+1}),c);return new fs(this,{kind:"constant",value:b},c)}return new fs(this,i.expression,c)}evaluate(i,c,p,g,b,x){if(i.kind==="source"){const E=i.evaluate(c,p,g,b,x);return this._calculate(E,E,E,c)}return i.kind==="composite"?this._calculate(i.evaluate({zoom:Math.floor(c.zoom)-1},p,g),i.evaluate({zoom:Math.floor(c.zoom)},p,g),i.evaluate({zoom:Math.floor(c.zoom)+1},p,g),c):i.value}_calculate(i,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:i,to:c}:{from:p,to:c}}interpolate(i){return i}}class sc{constructor(i){this.specification=i}possiblyEvaluate(i,c,p,g){if(i.value!==void 0){if(i.expression.kind==="constant"){const b=i.expression.evaluate(c,null,{},p,g);return this._calculate(b,b,b,c)}return this._calculate(i.expression.evaluate(new rr(Math.floor(c.zoom-1),c)),i.expression.evaluate(new rr(Math.floor(c.zoom),c)),i.expression.evaluate(new rr(Math.floor(c.zoom+1),c)),c)}}_calculate(i,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:i,to:c}:{from:p,to:c}}interpolate(i){return i}}class cp{constructor(i){this.specification=i}possiblyEvaluate(i,c,p,g){return!!i.expression.evaluate(c,null,{},p,g)}interpolate(){return!1}}class ho{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in i){const p=i[c];p.specification.overridable&&this.overridableProperties.push(c);const g=this.defaultPropertyValues[c]=new ic(p,void 0),b=this.defaultTransitionablePropertyValues[c]=new xh(p);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=g.possiblyEvaluate({})}}}_e("DataDrivenProperty",De),_e("DataConstantProperty",Te),_e("CrossFadedDataDrivenProperty",wh),_e("CrossFadedProperty",sc),_e("ColorRampProperty",cp);const hp="-transition";class ps extends mn{constructor(i,c){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1},i.type!=="custom"&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type!=="background"&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),c.layout&&(this._unevaluatedLayout=new wm(c.layout)),c.paint)){this._transitionablePaint=new up(c.paint);for(const p in i.paint)this.setPaintProperty(p,i.paint[p],{validate:!1});for(const p in i.layout)this.setLayoutProperty(p,i.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new oc(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return i==="visibility"?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,c,p={}){c!=null&&this._validate(By,`layers.${this.id}.layout.${i}`,i,c,p)||(i!=="visibility"?this._unevaluatedLayout.setValue(i,c):this.visibility=c)}getPaintProperty(i){return i.endsWith(hp)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}setPaintProperty(i,c,p={}){if(c!=null&&this._validate(ap,`layers.${this.id}.paint.${i}`,i,c,p))return!1;if(i.endsWith(hp))return this._transitionablePaint.setTransition(i.slice(0,-11),c||void 0),!1;{const g=this._transitionablePaint._values[i],b=g.property.specification["property-type"]==="cross-faded-data-driven",x=g.value.isDataDriven(),E=g.value;this._transitionablePaint.setValue(i,c),this._handleSpecialPaintPropertyUpdate(i);const L=this._transitionablePaint._values[i].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(i,E,L)}}_handleSpecialPaintPropertyUpdate(i){}_handleOverridablePaintPropertyUpdate(i,c,p){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||this.visibility==="none"}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,c){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,c)}serialize(){const i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),Et(i,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(i,c,p,g,b={}){return(!b||b.validate!==!1)&&ou(this,i.call(wl,{key:c,layerType:this.type,objectKey:p,value:g,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const c=this.paint.get(i);if(c instanceof fs&&nu(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const Sm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ac{constructor(i,c){this._structArray=i,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class xr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,c){return i._trim(),c&&(i.isTransferred=!0,c.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const c=Object.create(this.prototype);return c.arrayBuffer=i.arrayBuffer,c.length=i.length,c.capacity=i.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Nr(a,i=1){let c=0,p=0;return{members:a.map(g=>{const b=Sm[g.type].BYTES_PER_ELEMENT,x=c=Em(c,Math.max(i,b)),E=g.components||1;return p=Math.max(p,b),c+=b*E,{name:g.name,type:g.type,components:E,offset:x}}),size:Em(c,Math.max(p,i)),alignment:i}}function Em(a,i){return Math.ceil(a/i)*i}class lc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c){const p=this.length;return this.resize(p+1),this.emplace(p,i,c)}emplace(i,c,p){const g=2*i;return this.int16[g+0]=c,this.int16[g+1]=p,i}}lc.prototype.bytesPerElement=4,_e("StructArrayLayout2i4",lc);class fa extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,p)}emplace(i,c,p,g){const b=3*i;return this.int16[b+0]=c,this.int16[b+1]=p,this.int16[b+2]=g,i}}fa.prototype.bytesPerElement=6,_e("StructArrayLayout3i6",fa);class fp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,p,g)}emplace(i,c,p,g,b){const x=4*i;return this.int16[x+0]=c,this.int16[x+1]=p,this.int16[x+2]=g,this.int16[x+3]=b,i}}fp.prototype.bytesPerElement=8,_e("StructArrayLayout4i8",fp);class pp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,i,c,p,g,b,x)}emplace(i,c,p,g,b,x,E){const L=6*i;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,i}}pp.prototype.bytesPerElement=12,_e("StructArrayLayout2i4i12",pp);class dp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,i,c,p,g,b,x)}emplace(i,c,p,g,b,x,E){const L=4*i,A=8*i;return this.int16[L+0]=c,this.int16[L+1]=p,this.uint8[A+4]=g,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,i}}dp.prototype.bytesPerElement=8,_e("StructArrayLayout2i4ub8",dp);class uc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c){const p=this.length;return this.resize(p+1),this.emplace(p,i,c)}emplace(i,c,p){const g=2*i;return this.float32[g+0]=c,this.float32[g+1]=p,i}}uc.prototype.bytesPerElement=8,_e("StructArrayLayout2f8",uc);class Sh extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,p,g,b,x,E,L,A,D){const O=this.length;return this.resize(O+1),this.emplace(O,i,c,p,g,b,x,E,L,A,D)}emplace(i,c,p,g,b,x,E,L,A,D,O){const U=10*i;return this.uint16[U+0]=c,this.uint16[U+1]=p,this.uint16[U+2]=g,this.uint16[U+3]=b,this.uint16[U+4]=x,this.uint16[U+5]=E,this.uint16[U+6]=L,this.uint16[U+7]=A,this.uint16[U+8]=D,this.uint16[U+9]=O,i}}Sh.prototype.bytesPerElement=20,_e("StructArrayLayout10ui20",Sh);class mp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,p,g,b,x,E,L,A,D,O,U){const j=this.length;return this.resize(j+1),this.emplace(j,i,c,p,g,b,x,E,L,A,D,O,U)}emplace(i,c,p,g,b,x,E,L,A,D,O,U,j){const Z=12*i;return this.int16[Z+0]=c,this.int16[Z+1]=p,this.int16[Z+2]=g,this.int16[Z+3]=b,this.uint16[Z+4]=x,this.uint16[Z+5]=E,this.uint16[Z+6]=L,this.uint16[Z+7]=A,this.int16[Z+8]=D,this.int16[Z+9]=O,this.int16[Z+10]=U,this.int16[Z+11]=j,i}}mp.prototype.bytesPerElement=24,_e("StructArrayLayout4i4ui4i24",mp);class gp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,p)}emplace(i,c,p,g){const b=3*i;return this.float32[b+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,i}}gp.prototype.bytesPerElement=12,_e("StructArrayLayout3f12",gp);class pa extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.uint32[1*i+0]=c,i}}pa.prototype.bytesPerElement=4,_e("StructArrayLayout1ul4",pa);class Eh extends xr{_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(i,c,p,g,b,x,E,L,A){const D=this.length;return this.resize(D+1),this.emplace(D,i,c,p,g,b,x,E,L,A)}emplace(i,c,p,g,b,x,E,L,A,D){const O=10*i,U=5*i;return this.int16[O+0]=c,this.int16[O+1]=p,this.int16[O+2]=g,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[U+3]=L,this.uint16[O+8]=A,this.uint16[O+9]=D,i}}Eh.prototype.bytesPerElement=20,_e("StructArrayLayout6i1ul2ui20",Eh);class cc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,i,c,p,g,b,x)}emplace(i,c,p,g,b,x,E){const L=6*i;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,i}}cc.prototype.bytesPerElement=12,_e("StructArrayLayout2i2i2i12",cc);class Ih extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,c,p,g,b){const x=this.length;return this.resize(x+1),this.emplace(x,i,c,p,g,b)}emplace(i,c,p,g,b,x){const E=4*i,L=8*i;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=g,this.int16[L+6]=b,this.int16[L+7]=x,i}}Ih.prototype.bytesPerElement=16,_e("StructArrayLayout2f1f2i16",Ih);class hc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,p,g)}emplace(i,c,p,g,b){const x=12*i,E=3*i;return this.uint8[x+0]=c,this.uint8[x+1]=p,this.float32[E+1]=g,this.float32[E+2]=b,i}}hc.prototype.bytesPerElement=12,_e("StructArrayLayout2ub2f12",hc);class Ch extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,p)}emplace(i,c,p,g){const b=3*i;return this.uint16[b+0]=c,this.uint16[b+1]=p,this.uint16[b+2]=g,i}}Ch.prototype.bytesPerElement=6,_e("StructArrayLayout3ui6",Ch);class uu extends xr{_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(i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et,lt,pt){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et,lt,pt)}emplace(i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et,lt,pt,Ct){const yt=24*i,wt=12*i,Zt=48*i;return this.int16[yt+0]=c,this.int16[yt+1]=p,this.uint16[yt+2]=g,this.uint16[yt+3]=b,this.uint32[wt+2]=x,this.uint32[wt+3]=E,this.uint32[wt+4]=L,this.uint16[yt+10]=A,this.uint16[yt+11]=D,this.uint16[yt+12]=O,this.float32[wt+7]=U,this.float32[wt+8]=j,this.uint8[Zt+36]=Z,this.uint8[Zt+37]=et,this.uint8[Zt+38]=lt,this.uint32[wt+10]=pt,this.int16[yt+22]=Ct,i}}uu.prototype.bytesPerElement=48,_e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",uu);class Sl extends xr{_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(i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et,lt,pt,Ct,yt,wt,Zt,Yt,me,be,de,he,ie,ve){const le=this.length;return this.resize(le+1),this.emplace(le,i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et,lt,pt,Ct,yt,wt,Zt,Yt,me,be,de,he,ie,ve)}emplace(i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et,lt,pt,Ct,yt,wt,Zt,Yt,me,be,de,he,ie,ve,le){const $t=32*i,ke=16*i;return this.int16[$t+0]=c,this.int16[$t+1]=p,this.int16[$t+2]=g,this.int16[$t+3]=b,this.int16[$t+4]=x,this.int16[$t+5]=E,this.int16[$t+6]=L,this.int16[$t+7]=A,this.uint16[$t+8]=D,this.uint16[$t+9]=O,this.uint16[$t+10]=U,this.uint16[$t+11]=j,this.uint16[$t+12]=Z,this.uint16[$t+13]=et,this.uint16[$t+14]=lt,this.uint16[$t+15]=pt,this.uint16[$t+16]=Ct,this.uint16[$t+17]=yt,this.uint16[$t+18]=wt,this.uint16[$t+19]=Zt,this.uint16[$t+20]=Yt,this.uint16[$t+21]=me,this.uint16[$t+22]=be,this.uint32[ke+12]=de,this.float32[ke+13]=he,this.float32[ke+14]=ie,this.uint16[$t+30]=ve,this.uint16[$t+31]=le,i}}Sl.prototype.bytesPerElement=64,_e("StructArrayLayout8i15ui1ul2f2ui64",Sl);class Th extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.float32[1*i+0]=c,i}}Th.prototype.bytesPerElement=4,_e("StructArrayLayout1f4",Th);class Lh extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,p)}emplace(i,c,p,g){const b=3*i;return this.uint16[6*i+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,i}}Lh.prototype.bytesPerElement=12,_e("StructArrayLayout1ui2f12",Lh);class El extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,i,c,p)}emplace(i,c,p,g){const b=4*i;return this.uint32[2*i+0]=c,this.uint16[b+2]=p,this.uint16[b+3]=g,i}}El.prototype.bytesPerElement=8,_e("StructArrayLayout1ul2ui8",El);class yp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,c){const p=this.length;return this.resize(p+1),this.emplace(p,i,c)}emplace(i,c,p){const g=2*i;return this.uint16[g+0]=c,this.uint16[g+1]=p,i}}yp.prototype.bytesPerElement=4,_e("StructArrayLayout2ui4",yp);class _p extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const c=this.length;return this.resize(c+1),this.emplace(c,i)}emplace(i,c){return this.uint16[1*i+0]=c,i}}_p.prototype.bytesPerElement=2,_e("StructArrayLayout1ui2",_p);class Ph extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,i,c,p,g)}emplace(i,c,p,g,b){const x=4*i;return this.float32[x+0]=c,this.float32[x+1]=p,this.float32[x+2]=g,this.float32[x+3]=b,i}}Ph.prototype.bytesPerElement=16,_e("StructArrayLayout4f16",Ph);class Im extends ac{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 C(this.anchorPointX,this.anchorPointY)}}Im.prototype.size=20;class _ extends Eh{get(i){return new Im(this,i)}}_e("CollisionBoxArray",_);class s extends ac{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(i){this._structArray.uint8[this._pos1+37]=i}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(i){this._structArray.uint8[this._pos1+38]=i}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(i){this._structArray.uint32[this._pos4+10]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends uu{get(i){return new s(this,i)}}_e("PlacedSymbolArray",f);class d extends ac{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(i){this._structArray.uint32[this._pos4+12]=i}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]}}d.prototype.size=64;class m extends Sl{get(i){return new d(this,i)}}_e("SymbolInstanceArray",m);class v extends Th{getoffsetX(i){return this.float32[1*i+0]}}_e("GlyphOffsetArray",v);class I extends fa{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}_e("SymbolLineVertexArray",I);class T extends ac{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]}}T.prototype.size=12;class M extends Lh{get(i){return new T(this,i)}}_e("TextAnchorOffsetArray",M);class k extends ac{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]}}k.prototype.size=8;class z extends El{get(i){return new k(this,i)}}_e("FeatureIndexArray",z);class F extends lc{}class W extends lc{}class st extends lc{}class ot extends pp{}class ct extends dp{}class tt extends uc{}class _t extends Sh{}class kt extends mp{}class ht extends gp{}class St extends pa{}class Rt extends cc{}class Ft extends hc{}class Gt extends Ch{}class Jt extends yp{}const Kt=Nr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ne}=Kt;class se{constructor(i=[]){this.segments=i}prepareSegment(i,c,p,g){let b=this.segments[this.segments.length-1];return i>se.MAX_VERTEX_ARRAY_LENGTH&&Qt(`Max vertices per segment is ${se.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!b||b.vertexLength+i>se.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==g)&&(b={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},g!==void 0&&(b.sortKey=g),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const i of this.segments)for(const c in i.vaos)i.vaos[c].destroy()}static simpleSegment(i,c,p,g){return new se([{vertexOffset:i,primitiveOffset:c,vertexLength:p,primitiveLength:g,vaos:{},sortKey:0}])}}function Qe(a,i){return 256*(a=at(Math.floor(a),0,255))+at(Math.floor(i),0,255)}se.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,_e("SegmentVector",se);const ae=Nr([{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 Ne={exports:{}},$e={exports:{}};$e.exports=function(a,i){var c,p,g,b,x,E,L,A;for(p=a.length-(c=3&a.length),g=i,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,c){case 3:L^=(255&a.charCodeAt(A+2))<<16;case 2:L^=(255&a.charCodeAt(A+1))<<8;case 1:g^=L=(65535&(L=(L=(65535&(L^=255&a.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295}return g^=a.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var bn=$e.exports,Be={exports:{}};Be.exports=function(a,i){for(var c,p=a.length,g=i^p,b=0;p>=4;)c=1540483477*(65535&(c=255&a.charCodeAt(b)|(255&a.charCodeAt(++b))<<8|(255&a.charCodeAt(++b))<<16|(255&a.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:g^=(255&a.charCodeAt(b+2))<<16;case 2:g^=(255&a.charCodeAt(b+1))<<8;case 1:g=1540483477*(65535&(g^=255&a.charCodeAt(b)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var rn=bn,ln=Be.exports;Ne.exports=rn,Ne.exports.murmur3=rn,Ne.exports.murmur2=ln;var wr=y(Ne.exports);class Fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,c,p,g){this.ids.push(Ao(i)),this.positions.push(c,p,g)}getPositions(i){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=Ao(i);let p=0,g=this.ids.length-1;for(;p>1;this.ids[x]>=c?g=x:p=x+1}const b=[];for(;this.ids[p]===c;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(i,c){const p=new Float64Array(i.ids),g=new Uint32Array(i.positions);return ti(p,g,0,p.length-1),c&&c.push(p.buffer,g.buffer),{ids:p,positions:g}}static deserialize(i){const c=new Fn;return c.ids=i.ids,c.positions=i.positions,c.indexed=!0,c}}function Ao(a){const i=+a;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:wr(String(a))}function ti(a,i,c,p){for(;c>1];let b=c-1,x=p+1;for(;;){do b++;while(a[b]g);if(b>=x)break;pr(a,b,x),pr(i,3*b,3*x),pr(i,3*b+1,3*x+1),pr(i,3*b+2,3*x+2)}x-c`u_${g}`),this.type=p}setUniform(i,c,p){i.set(p.constantOr(this.value))}getBinding(i,c,p){return this.type==="color"?new Ua(i,c):new ko(i,c)}}class Yr{constructor(i,c){this.uniformNames=c.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=i.tlbr}setUniform(i,c,p,g){const b=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&i.set(b)}getBinding(i,c,p){return p.substr(0,9)==="u_pattern"?new Fs(i,c):new ko(i,c)}}class dr{constructor(i,c,p,g){this.expression=i,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(i,c,p,g,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new rr(0),c,{},g,[],b);this.paintVertexArray.resize(i),this._setPaintValue(x,i,E)}updatePaintArray(i,c,p,g){const b=this.expression.evaluate({zoom:0},p,g);this._setPaintValue(i,c,b)}_setPaintValue(i,c,p){if(this.type==="color"){const g=Ga(p);for(let b=i;b`u_${E}_t`),this.type=p,this.useIntegerZoom=g,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(i,c,p,g,b){const x=this.expression.evaluate(new rr(this.zoom),c,{},g,[],b),E=this.expression.evaluate(new rr(this.zoom+1),c,{},g,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(L,i,x,E)}updatePaintArray(i,c,p,g){const b=this.expression.evaluate({zoom:this.zoom},p,g),x=this.expression.evaluate({zoom:this.zoom+1},p,g);this._setPaintValue(i,c,b,x)}_setPaintValue(i,c,p,g){if(this.type==="color"){const b=Ga(p),x=Ga(g);for(let E=i;E`#define HAS_UNIFORM_${g}`))}return i}getBinderAttributes(){const i=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof dr||p instanceof ir)for(let g=0;g!0){this.programConfigurations={};for(const g of i)this.programConfigurations[g.id]=new Kr(g,c,p);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(i,c,p,g,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(i,c,g,b,x);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,c,p,g){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(i,this._featureMap,c,b,g)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}function Jo(a,i){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"]}[a]||[a.replace(`${i}-`,"").replace(/-/g,"_")]}function Jr(a,i,c){const p={color:{source:uc,composite:Ph},number:{source:Th,composite:uc}},g=function(b){return{"line-pattern":{source:_t,composite:_t},"fill-pattern":{source:_t,composite:_t},"fill-extrusion-pattern":{source:_t,composite:_t}}[b]}(a);return g&&g[c]||p[i][c]}_e("ConstantBinder",Bs),_e("CrossFadedConstantBinder",Yr),_e("SourceExpressionBinder",dr),_e("CrossFadedCompositeBinder",Ko),_e("CompositeExpressionBinder",ir),_e("ProgramConfiguration",Kr,{omit:["_buffers"]}),_e("ProgramConfigurationSet",mr);const Pr=8192,vp=Math.pow(2,14)-1,Cm=-vp-1;function Il(a){const i=Pr/a.extent,c=a.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function Cl(a,i){return{type:a.type,id:a.id,properties:a.properties,geometry:i?Il(a):[]}}function Mh(a,i,c,p,g){a.emplaceBack(2*i+(p+1)/2,2*c+(g+1)/2)}class qa{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(c=>c.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new W,this.indexArray=new Gt,this.segments=new se,this.programConfigurations=new mr(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,p){const g=this.layers[0],b=[];let x=null,E=!1;g.type==="circle"&&(x=g.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:L,id:A,index:D,sourceLayerIndex:O}of i){const U=this.layers[0]._featureFilter.needGeometry,j=Cl(L,U);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),j,p))continue;const Z=E?x.evaluate(j,{},p):void 0,et={id:A,properties:L.properties,type:L.type,sourceLayerIndex:O,index:D,geometry:U?j.geometry:Il(L),patterns:{},sortKey:Z};b.push(et)}E&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:D,sourceLayerIndex:O}=L,U=i[D].feature;this.addFeature(L,A,D,p),c.featureIndex.insert(U,A,D,O,this.index)}}update(i,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,ne),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,c,p,g){for(const b of c)for(const x of b){const E=x.x,L=x.y;if(E<0||E>=Pr||L<0||L>=Pr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),D=A.vertexLength;Mh(this.layoutVertexArray,E,L,-1,-1),Mh(this.layoutVertexArray,E,L,1,-1),Mh(this.layoutVertexArray,E,L,1,1),Mh(this.layoutVertexArray,E,L,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,p,{},g)}}function bp(a,i){for(let c=0;c1){if(Ah(a,i))return!0;for(let p=0;p1?c:c.sub(i)._mult(g)._add(i))}function Qv(a,i){let c,p,g,b=!1;for(let x=0;xi.y!=g.y>i.y&&i.x<(g.x-p.x)*(i.y-p.y)/(g.y-p.y)+p.x&&(b=!b)}return b}function kh(a,i){let c=!1;for(let p=0,g=a.length-1;pi.y!=x.y>i.y&&i.x<(x.x-b.x)*(i.y-b.y)/(x.y-b.y)+b.x&&(c=!c)}return c}function KI(a,i,c){const p=c[0],g=c[2];if(a.xg.x&&i.x>g.x||a.yg.y&&i.y>g.y)return!1;const b=Tt(a,i,c[0]);return b!==Tt(a,i,c[1])||b!==Tt(a,i,c[2])||b!==Tt(a,i,c[3])}function Ep(a,i,c){const p=i.paint.get(a).value;return p.kind==="constant"?p.value:c.programConfigurations.get(i.id).getMaxValue(a)}function Lm(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function Pm(a,i,c,p,g){if(!i[0]&&!i[1])return a;const b=C.convert(i)._mult(g);c==="viewport"&&b._rotate(-p);const x=[];for(let E=0;En1(lt,et))}(A,L),j=O?D*E:D;for(const Z of g)for(const et of Z){const lt=O?et:n1(et,L);let pt=j;const Ct=Mm([],[et.x,et.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=Ct[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=x.cameraToCenterDistance/Ct[3]),Tm(U,lt,pt))return!0}return!1}}function n1(a,i){const c=Mm([],[a.x,a.y,0,1],i);return new C(c[0]/c[3],c[1]/c[3])}class r1 extends qa{}let i1;_e("HeatmapBucket",r1,{omit:["layers"]});var tC={get paint(){return i1=i1||new ho({"heatmap-radius":new De(Mt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new De(Mt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Te(Mt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new cp(Mt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Te(Mt.paint_heatmap["heatmap-opacity"])})}};function qy(a,{width:i,height:c},p,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==i*c*p)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${i*c*p}`)}else g=new Uint8Array(i*c*p);return a.width=i,a.height=c,a.data=g,a}function o1(a,{width:i,height:c},p){if(i===a.width&&c===a.height)return;const g=qy({},{width:i,height:c},p);jy(a,g,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,i),height:Math.min(a.height,c)},p),a.width=i,a.height=c,a.data=g.data}function jy(a,i,c,p,g,b){if(g.width===0||g.height===0)return i;if(g.width>a.width||g.height>a.height||c.x>a.width-g.width||c.y>a.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>i.width||g.height>i.height||p.x>i.width-g.width||p.y>i.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const x=a.data,E=i.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{i[a.evaluationKey]=L;const A=a.expression.evaluate(i);g.data[x+E+0]=Math.floor(255*A.r/A.a),g.data[x+E+1]=Math.floor(255*A.g/A.a),g.data[x+E+2]=Math.floor(255*A.b/A.a),g.data[x+E+3]=Math.floor(255*A.a)};if(a.clips)for(let x=0,E=0;x80*c){p=b=a[0],g=x=a[1];for(var Z=c;Zb&&(b=E),L>x&&(x=L);A=(A=Math.max(b-p,x-g))!==0?32767/A:0}return Tp(U,j,c,p,g,A,0),j}function l1(a,i,c,p,g){var b,x;if(g===Xy(a,i,c,p)>0)for(b=i;b=i;b-=p)x=h1(b,a[b],a[b+1],x);return x&&km(x,x.next)&&(Pp(x),x=x.next),x}function pc(a,i){if(!a)return a;i||(i=a);var c,p=a;do if(c=!1,p.steiner||!km(p,p.next)&&Or(p.prev,p,p.next)!==0)p=p.next;else{if(Pp(p),(p=i=p.prev)===p.next)break;c=!0}while(c||p!==i);return i}function Tp(a,i,c,p,g,b,x){if(a){!x&&b&&function(D,O,U,j){var Z=D;do Z.z===0&&(Z.z=Hy(Z.x,Z.y,O,U,j)),Z.prevZ=Z.prev,Z.nextZ=Z.next,Z=Z.next;while(Z!==D);Z.prevZ.nextZ=null,Z.prevZ=null,function(et){var lt,pt,Ct,yt,wt,Zt,Yt,me,be=1;do{for(pt=et,et=null,wt=null,Zt=0;pt;){for(Zt++,Ct=pt,Yt=0,lt=0;lt0||me>0&&Ct;)Yt!==0&&(me===0||!Ct||pt.z<=Ct.z)?(yt=pt,pt=pt.nextZ,Yt--):(yt=Ct,Ct=Ct.nextZ,me--),wt?wt.nextZ=yt:et=yt,yt.prevZ=wt,wt=yt;pt=Ct}wt.nextZ=null,be*=2}while(Zt>1)}(Z)}(a,p,g,b);for(var E,L,A=a;a.prev!==a.next;)if(E=a.prev,L=a.next,b?aC(a,p,g,b):sC(a))i.push(E.i/c|0),i.push(a.i/c|0),i.push(L.i/c|0),Pp(a),a=L.next,A=L.next;else if((a=L)===A){x?x===1?Tp(a=lC(pc(a),i,c),i,c,p,g,b,2):x===2&&uC(a,i,c,p,g,b):Tp(pc(a),i,c,p,g,b,1);break}}}function sC(a){var i=a.prev,c=a,p=a.next;if(Or(i,c,p)>=0)return!1;for(var g=i.x,b=c.x,x=p.x,E=i.y,L=c.y,A=p.y,D=gb?g>x?g:x:b>x?b:x,j=E>L?E>A?E:A:L>A?L:A,Z=p.next;Z!==i;){if(Z.x>=D&&Z.x<=U&&Z.y>=O&&Z.y<=j&&Rh(g,E,b,L,x,A,Z.x,Z.y)&&Or(Z.prev,Z,Z.next)>=0)return!1;Z=Z.next}return!0}function aC(a,i,c,p){var g=a.prev,b=a,x=a.next;if(Or(g,b,x)>=0)return!1;for(var E=g.x,L=b.x,A=x.x,D=g.y,O=b.y,U=x.y,j=EL?E>A?E:A:L>A?L:A,lt=D>O?D>U?D:U:O>U?O:U,pt=Hy(j,Z,i,c,p),Ct=Hy(et,lt,i,c,p),yt=a.prevZ,wt=a.nextZ;yt&&yt.z>=pt&&wt&&wt.z<=Ct;){if(yt.x>=j&&yt.x<=et&&yt.y>=Z&&yt.y<=lt&&yt!==g&&yt!==x&&Rh(E,D,L,O,A,U,yt.x,yt.y)&&Or(yt.prev,yt,yt.next)>=0||(yt=yt.prevZ,wt.x>=j&&wt.x<=et&&wt.y>=Z&&wt.y<=lt&&wt!==g&&wt!==x&&Rh(E,D,L,O,A,U,wt.x,wt.y)&&Or(wt.prev,wt,wt.next)>=0))return!1;wt=wt.nextZ}for(;yt&&yt.z>=pt;){if(yt.x>=j&&yt.x<=et&&yt.y>=Z&&yt.y<=lt&&yt!==g&&yt!==x&&Rh(E,D,L,O,A,U,yt.x,yt.y)&&Or(yt.prev,yt,yt.next)>=0)return!1;yt=yt.prevZ}for(;wt&&wt.z<=Ct;){if(wt.x>=j&&wt.x<=et&&wt.y>=Z&&wt.y<=lt&&wt!==g&&wt!==x&&Rh(E,D,L,O,A,U,wt.x,wt.y)&&Or(wt.prev,wt,wt.next)>=0)return!1;wt=wt.nextZ}return!0}function lC(a,i,c){var p=a;do{var g=p.prev,b=p.next.next;!km(g,b)&&u1(g,p,p.next,b)&&Lp(g,b)&&Lp(b,g)&&(i.push(g.i/c|0),i.push(p.i/c|0),i.push(b.i/c|0),Pp(p),Pp(p.next),p=a=b),p=p.next}while(p!==a);return pc(p)}function uC(a,i,c,p,g,b){var x=a;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&dC(x,E)){var L=c1(x,E);return x=pc(x,x.next),L=pc(L,L.next),Tp(x,i,c,p,g,b,0),void Tp(L,i,c,p,g,b,0)}E=E.next}x=x.next}while(x!==a)}function cC(a,i){return a.x-i.x}function hC(a,i){var c=function(g,b){var x,E=b,L=g.x,A=g.y,D=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var O=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(O<=L&&O>D&&(D=O,x=E.x=E.x&&E.x>=Z&&L!==E.x&&Rh(Ax.x||E.x===x.x&&fC(x,E)))&&(x=E,lt=U)),E=E.next;while(E!==j);return x}(a,i);if(!c)return i;var p=c1(c,a);return pc(p,p.next),pc(c,c.next)}function fC(a,i){return Or(a.prev,a,i.prev)<0&&Or(i.next,a,a.next)<0}function Hy(a,i,c,p,g){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-c)*g|0)|a<<8))|a<<4))|a<<2))|a<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-p)*g|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function pC(a){var i=a,c=a;do(i.x=(a-x)*(b-E)&&(a-x)*(p-E)>=(c-x)*(i-E)&&(c-x)*(b-E)>=(g-x)*(p-E)}function dC(a,i){return a.next.i!==i.i&&a.prev.i!==i.i&&!function(c,p){var g=c;do{if(g.i!==c.i&&g.next.i!==c.i&&g.i!==p.i&&g.next.i!==p.i&&u1(g,g.next,c,p))return!0;g=g.next}while(g!==c);return!1}(a,i)&&(Lp(a,i)&&Lp(i,a)&&function(c,p){var g=c,b=!1,x=(c.x+p.x)/2,E=(c.y+p.y)/2;do g.y>E!=g.next.y>E&&g.next.y!==g.y&&x<(g.next.x-g.x)*(E-g.y)/(g.next.y-g.y)+g.x&&(b=!b),g=g.next;while(g!==c);return b}(a,i)&&(Or(a.prev,a,i.prev)||Or(a,i.prev,i))||km(a,i)&&Or(a.prev,a,a.next)>0&&Or(i.prev,i,i.next)>0)}function Or(a,i,c){return(i.y-a.y)*(c.x-i.x)-(i.x-a.x)*(c.y-i.y)}function km(a,i){return a.x===i.x&&a.y===i.y}function u1(a,i,c,p){var g=Rm(Or(a,i,c)),b=Rm(Or(a,i,p)),x=Rm(Or(c,p,a)),E=Rm(Or(c,p,i));return g!==b&&x!==E||!(g!==0||!Dm(a,c,i))||!(b!==0||!Dm(a,p,i))||!(x!==0||!Dm(c,a,p))||!(E!==0||!Dm(c,i,p))}function Dm(a,i,c){return i.x<=Math.max(a.x,c.x)&&i.x>=Math.min(a.x,c.x)&&i.y<=Math.max(a.y,c.y)&&i.y>=Math.min(a.y,c.y)}function Rm(a){return a>0?1:a<0?-1:0}function Lp(a,i){return Or(a.prev,a,a.next)<0?Or(a,i,a.next)>=0&&Or(a,a.prev,i)>=0:Or(a,i,a.prev)<0||Or(a,a.next,i)<0}function c1(a,i){var c=new Zy(a.i,a.x,a.y),p=new Zy(i.i,i.x,i.y),g=a.next,b=i.prev;return a.next=i,i.prev=a,c.next=g,g.prev=c,p.next=c,c.prev=p,b.next=p,p.prev=b,p}function h1(a,i,c,p){var g=new Zy(a,i,c);return p?(g.next=p.next,g.prev=p,p.next.prev=g,p.next=g):(g.prev=g,g.next=g),g}function Pp(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function Zy(a,i,c){this.i=a,this.x=i,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Xy(a,i,c,p){for(var g=0,b=i,x=c-p;b0&&c.holes.push(p+=a[g-1].length)}return c};var f1=y(Wy.exports);function mC(a,i,c,p,g){p1(a,i,c||0,p||a.length-1,g||gC)}function p1(a,i,c,p,g){for(;p>c;){if(p-c>600){var b=p-c+1,x=i-c+1,E=Math.log(b),L=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*L*(b-L)/b)*(x-b/2<0?-1:1);p1(a,i,Math.max(c,Math.floor(i-x*L/b+A)),Math.min(p,Math.floor(i+(b-x)*L/b+A)),g)}var D=a[i],O=c,U=p;for(Mp(a,c,i),g(a[p],D)>0&&Mp(a,c,p);O0;)U--}g(a[c],D)===0?Mp(a,c,U):Mp(a,++U,p),U<=i&&(c=U+1),i<=U&&(p=U-1)}}function Mp(a,i,c){var p=a[i];a[i]=a[c],a[c]=p}function gC(a,i){return ai?1:0}function Yy(a,i){const c=a.length;if(c<=1)return[a];const p=[];let g,b;for(let x=0;x1)for(let x=0;xc.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new st,this.indexArray=new Gt,this.indexArray2=new Jt,this.programConfigurations=new mr(i.layers,i.zoom),this.segments=new se,this.segments2=new se,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,p){this.hasPattern=Ky("fill",this.layers,c);const g=this.layers[0].layout.get("fill-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:D}of i){const O=this.layers[0]._featureFilter.needGeometry,U=Cl(E,O);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),U,p))continue;const j=b?g.evaluate(U,{},p,c.availableImages):void 0,Z={id:L,properties:E.properties,type:E.type,sourceLayerIndex:D,index:A,geometry:O?U.geometry:Il(E),patterns:{},sortKey:j};x.push(Z)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:D}=E;if(this.hasPattern){const O=Jy("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(i[A].feature,L,A,D,this.index)}}update(i,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,p)}addFeatures(i,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,oC),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,c,p,g,b){for(const x of Yy(c,500)){let E=0;for(const j of x)E+=j.length;const L=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=L.vertexLength,D=[],O=[];for(const j of x){if(j.length===0)continue;j!==x[0]&&O.push(D.length/2);const Z=this.segments2.prepareSegment(j.length,this.layoutVertexArray,this.indexArray2),et=Z.vertexLength;this.layoutVertexArray.emplaceBack(j[0].x,j[0].y),this.indexArray2.emplaceBack(et+j.length-1,et),D.push(j[0].x),D.push(j[0].y);for(let lt=1;lt>3}if(g--,p===1||p===2)b+=a.readSVarint(),x+=a.readSVarint(),p===1&&(i&&E.push(i),i=[]),i.push(new SC(b,x));else{if(p!==7)throw new Error("unknown command "+p);i&&i.push(i[0].clone())}}return i&&E.push(i),E},Nh.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var i=a.readVarint()+a.pos,c=1,p=0,g=0,b=0,x=1/0,E=-1/0,L=1/0,A=-1/0;a.pos>3}if(p--,c===1||c===2)(g+=a.readSVarint())E&&(E=g),(b+=a.readSVarint())A&&(A=b);else if(c!==7)throw new Error("unknown command "+c)}return[x,L,E,A]},Nh.prototype.toGeoJSON=function(a,i,c){var p,g,b=this.extent*Math.pow(2,c),x=this.extent*a,E=this.extent*i,L=this.loadGeometry(),A=Nh.types[this.type];function D(j){for(var Z=0;Z>3;g=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return g}(c))}_1.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var i=this._pbf.readVarint()+this._pbf.pos;return new CC(this._pbf,i,this.extent,this._keys,this._values)};var LC=y1;function PC(a,i,c){if(a===3){var p=new LC(c,c.readVarint()+c.pos);p.length&&(i[p.name]=p)}}cu.VectorTile=function(a,i){this.layers=a.readFields(PC,{},i)},cu.VectorTileFeature=g1,cu.VectorTileLayer=y1;const MC=cu.VectorTileFeature.types,$y=Math.pow(2,13);function Ap(a,i,c,p,g,b,x,E){a.emplaceBack(i,c,2*Math.floor(p*$y)+x,g*$y*2,b*$y*2,Math.round(E))}class t_{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(c=>c.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new ot,this.centroidVertexArray=new F,this.indexArray=new Gt,this.programConfigurations=new mr(i.layers,i.zoom),this.segments=new se,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,p){this.features=[],this.hasPattern=Ky("fill-extrusion",this.layers,c);for(const{feature:g,id:b,index:x,sourceLayerIndex:E}of i){const L=this.layers[0]._featureFilter.needGeometry,A=Cl(g,L);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),A,p))continue;const D={id:b,sourceLayerIndex:E,index:x,geometry:L?A.geometry:Il(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(Jy("fill-extrusion",this.layers,D,this.zoom,c)):this.addFeature(D,D.geometry,x,p,{}),c.featureIndex.insert(g,D.geometry,x,E,this.index,!0)}}addFeatures(i,c,p){for(const g of this.features){const{geometry:b}=g;this.addFeature(g,b,g.index,c,p)}}update(i,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,wC),this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,xC.members,!0),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(i,c,p,g,b){const x={x:0,y:0,vertexCount:0};for(const E of Yy(c,500)){let L=0;for(const Z of E)L+=Z.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Z of E){if(Z.length===0||kC(Z))continue;let et=0;for(let lt=0;lt=1){const Ct=Z[lt-1];if(!AC(pt,Ct)){A.vertexLength+4>se.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const yt=pt.sub(Ct)._perp()._unit(),wt=Ct.dist(pt);et+wt>32768&&(et=0),Ap(this.layoutVertexArray,pt.x,pt.y,yt.x,yt.y,0,0,et),Ap(this.layoutVertexArray,pt.x,pt.y,yt.x,yt.y,0,1,et),x.x+=2*pt.x,x.y+=2*pt.y,x.vertexCount+=2,et+=wt,Ap(this.layoutVertexArray,Ct.x,Ct.y,yt.x,yt.y,0,0,et),Ap(this.layoutVertexArray,Ct.x,Ct.y,yt.x,yt.y,0,1,et),x.x+=2*Ct.x,x.y+=2*Ct.y,x.vertexCount+=2;const Zt=A.vertexLength;this.indexArray.emplaceBack(Zt,Zt+2,Zt+1),this.indexArray.emplaceBack(Zt+1,Zt+2,Zt+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>se.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),MC[i.type]!=="Polygon")continue;const D=[],O=[],U=A.vertexLength;for(const Z of E)if(Z.length!==0){Z!==E[0]&&O.push(D.length/2);for(let et=0;etPr)||a.y===i.y&&(a.y<0||a.y>Pr)}function kC(a){return a.every(i=>i.x<0)||a.every(i=>i.x>Pr)||a.every(i=>i.y<0)||a.every(i=>i.y>Pr)}let v1;_e("FillExtrusionBucket",t_,{omit:["layers","features"]});var DC={get paint(){return v1=v1||new ho({"fill-extrusion-opacity":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new De(Mt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wh(Mt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new De(Mt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new De(Mt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class RC extends ps{constructor(i){super(i,DC)}createBucket(i){return new t_(i)}queryRadius(){return Lm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,c,p,g,b,x,E,L){const A=Pm(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),D=this.paint.get("fill-extrusion-height").evaluate(c,p),O=this.paint.get("fill-extrusion-base").evaluate(c,p),U=function(Z,et,lt,pt){const Ct=[];for(const yt of Z){const wt=[yt.x,yt.y,0,1];Mm(wt,wt,et),Ct.push(new C(wt[0]/wt[3],wt[1]/wt[3]))}return Ct}(A,L),j=function(Z,et,lt,pt){const Ct=[],yt=[],wt=pt[8]*et,Zt=pt[9]*et,Yt=pt[10]*et,me=pt[11]*et,be=pt[8]*lt,de=pt[9]*lt,he=pt[10]*lt,ie=pt[11]*lt;for(const ve of Z){const le=[],$t=[];for(const ke of ve){const Ee=ke.x,cn=ke.y,Qn=pt[0]*Ee+pt[4]*cn+pt[12],or=pt[1]*Ee+pt[5]*cn+pt[13],ri=pt[2]*Ee+pt[6]*cn+pt[14],Qo=pt[3]*Ee+pt[7]*cn+pt[15],po=ri+Yt,Qr=Qo+me,Ci=Qn+be,Di=or+de,mo=ri+he,go=Qo+ie,ii=new C((Qn+wt)/Qr,(or+Zt)/Qr);ii.z=po/Qr,le.push(ii);const oi=new C(Ci/go,Di/go);oi.z=mo/go,$t.push(oi)}Ct.push(le),yt.push($t)}return[Ct,yt]}(g,O,D,L);return function(Z,et,lt){let pt=1/0;xp(lt,et)&&(pt=b1(lt,et[0]));for(let Ct=0;Ctc.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new ct,this.layoutVertexArray2=new tt,this.indexArray=new Gt,this.programConfigurations=new mr(i.layers,i.zoom),this.segments=new se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(i,c,p){this.hasPattern=Ky("line",this.layers,c);const g=this.layers[0].layout.get("line-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:D}of i){const O=this.layers[0]._featureFilter.needGeometry,U=Cl(E,O);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),U,p))continue;const j=b?g.evaluate(U,{},p):void 0,Z={id:L,properties:E.properties,type:E.type,sourceLayerIndex:D,index:A,geometry:O?U.geometry:Il(E),patterns:{},sortKey:j};x.push(Z)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:D}=E;if(this.hasPattern){const O=Jy("line",this.layers,E,this.zoom,c);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(i[A].feature,L,A,D,this.index)}}update(i,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,c,this.stateDependentLayers,p)}addFeatures(i,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,FC)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,OC),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(i.properties,"mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,c,p,g,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(i,{}),L=x.get("line-cap"),A=x.get("line-miter-limit"),D=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(i);for(const O of c)this.addLine(O,i,E,L,A,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,p,b,g)}addLine(i,c,p,g,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pt=0;pt=2&&i[L-1].equals(i[L-2]);)L--;let A=0;for(;A0;if(me&&pt>A){const ie=U.dist(j);if(ie>2*D){const ve=U.sub(U.sub(j)._mult(D/ie)._round());this.updateDistance(j,ve),this.addCurrentVertex(ve,et,0,0,O),j=ve}}const de=j&&Z;let he=de?p:E?"butt":g;if(de&&he==="round"&&(Ztb&&(he="bevel"),he==="bevel"&&(Zt>2&&(he="flipbevel"),Zt100)Ct=lt.mult(-1);else{const ie=Zt*et.add(lt).mag()/et.sub(lt).mag();Ct._perp()._mult(ie*(be?-1:1))}this.addCurrentVertex(U,Ct,0,0,O),this.addCurrentVertex(U,Ct.mult(-1),0,0,O)}else if(he==="bevel"||he==="fakeround"){const ie=-Math.sqrt(Zt*Zt-1),ve=be?ie:0,le=be?0:ie;if(j&&this.addCurrentVertex(U,et,ve,le,O),he==="fakeround"){const $t=Math.round(180*Yt/Math.PI/20);for(let ke=1;ke<$t;ke++){let Ee=ke/$t;if(Ee!==.5){const Qn=Ee-.5;Ee+=Ee*Qn*(Ee-1)*((1.0904+yt*(yt*(3.55645-1.43519*yt)-3.2452))*Qn*Qn+(.848013+yt*(.215638*yt-1.06021)))}const cn=lt.sub(et)._mult(Ee)._add(et)._unit()._mult(be?-1:1);this.addHalfVertex(U,cn.x,cn.y,!1,be,0,O)}}Z&&this.addCurrentVertex(U,lt,-ve,-le,O)}else if(he==="butt")this.addCurrentVertex(U,Ct,0,0,O);else if(he==="square"){const ie=j?1:-1;this.addCurrentVertex(U,Ct,ie,ie,O)}else he==="round"&&(j&&(this.addCurrentVertex(U,et,0,0,O),this.addCurrentVertex(U,et,1,1,O,!0)),Z&&(this.addCurrentVertex(U,lt,-1,-1,O,!0),this.addCurrentVertex(U,lt,0,0,O)));if(me&&pt2*D){const ve=U.add(Z.sub(U)._mult(D/ie)._round());this.updateDistance(U,ve),this.addCurrentVertex(ve,lt,0,0,O),U=ve}}}}addCurrentVertex(i,c,p,g,b,x=!1){const E=c.y*g-c.x,L=-c.y-c.x*g;this.addHalfVertex(i,c.x+c.y*p,c.y-c.x*p,x,!1,p,b),this.addHalfVertex(i,E,L,x,!0,-g,b),this.distance>x1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(i,c,p,g,b,x))}addHalfVertex({x:i,y:c},p,g,b,x,E,L){const A=.5*(this.lineClips?this.scaledDistance*(x1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((i<<1)+(b?1:0),(c<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*g)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),L.primitiveLength++),x?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(i,c){this.distance+=i.dist(c),this.updateScaledDistance()}}let w1,S1;_e("LineBucket",e_,{omit:["layers","patternFeatures"]});var E1={get paint(){return S1=S1||new ho({"line-opacity":new De(Mt.paint_line["line-opacity"]),"line-color":new De(Mt.paint_line["line-color"]),"line-translate":new Te(Mt.paint_line["line-translate"]),"line-translate-anchor":new Te(Mt.paint_line["line-translate-anchor"]),"line-width":new De(Mt.paint_line["line-width"]),"line-gap-width":new De(Mt.paint_line["line-gap-width"]),"line-offset":new De(Mt.paint_line["line-offset"]),"line-blur":new De(Mt.paint_line["line-blur"]),"line-dasharray":new sc(Mt.paint_line["line-dasharray"]),"line-pattern":new wh(Mt.paint_line["line-pattern"]),"line-gradient":new cp(Mt.paint_line["line-gradient"])})},get layout(){return w1=w1||new ho({"line-cap":new Te(Mt.layout_line["line-cap"]),"line-join":new De(Mt.layout_line["line-join"]),"line-miter-limit":new Te(Mt.layout_line["line-miter-limit"]),"line-round-limit":new Te(Mt.layout_line["line-round-limit"]),"line-sort-key":new De(Mt.layout_line["line-sort-key"])})}};class UC extends De{possiblyEvaluate(i,c){return c=new rr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(i,c)}evaluate(i,c,p,g){return c=ft({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(i,c,p,g)}}let Nm;class GC extends ps{constructor(i){super(i,E1),this.gradientVersion=0,Nm||(Nm=new UC(E1.paint.properties["line-width"].specification),Nm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof Qu,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,c){super.recalculate(i,c),this.paint._values["line-floorwidth"]=Nm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new e_(i)}queryRadius(i){const c=i,p=I1(Ep("line-width",this,c),Ep("line-gap-width",this,c)),g=Ep("line-offset",this,c);return p/2+Math.abs(g)+Lm(this.paint.get("line-translate"))}queryIntersectsFeature(i,c,p,g,b,x,E){const L=Pm(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*I1(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),D=this.paint.get("line-offset").evaluate(c,p);return D&&(g=function(O,U){const j=[];for(let Z=0;Z=3){for(let lt=0;lt0?i+2*a:a}const qC=Nr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),jC=Nr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Nr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const WC=Nr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Nr([{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 C1=Nr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),HC=Nr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ZC(a,i,c){return a.sections.forEach(p=>{p.text=function(g,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?g=g.toLocaleUpperCase():E==="lowercase"&&(g=g.toLocaleLowerCase()),Va.applyArabicShaping&&(g=Va.applyArabicShaping(g)),g}(p.text,i,c)}),a}Nr([{name:"triangle",components:3,type:"Uint16"}]),Nr([{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"}]),Nr([{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"}]),Nr([{type:"Float32",name:"offsetX"}]),Nr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Nr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Dp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ni=24,T1=Un,L1=function(a,i,c,p,g){var b,x,E=8*g-p-1,L=(1<>1,D=-7,O=c?g-1:0,U=c?-1:1,j=a[i+O];for(O+=U,b=j&(1<<-D)-1,j>>=-D,D+=E;D>0;b=256*b+a[i+O],O+=U,D-=8);for(x=b&(1<<-D)-1,b>>=-D,D+=p;D>0;x=256*x+a[i+O],O+=U,D-=8);if(b===0)b=1-A;else{if(b===L)return x?NaN:1/0*(j?-1:1);x+=Math.pow(2,p),b-=A}return(j?-1:1)*x*Math.pow(2,b-p)},P1=function(a,i,c,p,g,b){var x,E,L,A=8*b-g-1,D=(1<>1,U=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,j=p?0:b-1,Z=p?1:-1,et=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(E=isNaN(i)?1:0,x=D):(x=Math.floor(Math.log(i)/Math.LN2),i*(L=Math.pow(2,-x))<1&&(x--,L*=2),(i+=x+O>=1?U/L:U*Math.pow(2,1-O))*L>=2&&(x++,L/=2),x+O>=D?(E=0,x=D):x+O>=1?(E=(i*L-1)*Math.pow(2,g),x+=O):(E=i*Math.pow(2,O-1)*Math.pow(2,g),x=0));g>=8;a[c+j]=255&E,j+=Z,E/=256,g-=8);for(x=x<0;a[c+j]=255&x,j+=Z,x/=256,A-=8);a[c+j-Z]|=128*et};function Un(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}Un.Varint=0,Un.Fixed64=1,Un.Bytes=2,Un.Fixed32=5;var n_=4294967296,M1=1/n_,A1=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Tl(a){return a.type===Un.Bytes?a.readVarint()+a.pos:a.pos+1}function Oh(a,i,c){return c?4294967296*i+(a>>>0):4294967296*(i>>>0)+(a>>>0)}function k1(a,i,c){var p=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));c.realloc(p);for(var g=c.pos-1;g>=a;g--)c.buf[g+p]=c.buf[g]}function XC(a,i){for(var c=0;c>>8,a[c+2]=i>>>16,a[c+3]=i>>>24}function D1(a,i){return(a[i]|a[i+1]<<8|a[i+2]<<16)+(a[i+3]<<24)}Un.prototype={destroy:function(){this.buf=null},readFields:function(a,i,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&p,a(g,i,this),this.pos===b&&this.skip(p)}return i},readMessage:function(a,i){return this.readFields(a,i,this.readVarint()+this.pos)},readFixed32:function(){var a=Om(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=D1(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=Om(this.buf,this.pos)+Om(this.buf,this.pos+4)*n_;return this.pos+=8,a},readSFixed64:function(){var a=Om(this.buf,this.pos)+D1(this.buf,this.pos+4)*n_;return this.pos+=8,a},readFloat:function(){var a=L1(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=L1(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(a){var i,c,p=this.buf;return i=127&(c=p[this.pos++]),c<128?i:(i|=(127&(c=p[this.pos++]))<<7,c<128?i:(i|=(127&(c=p[this.pos++]))<<14,c<128?i:(i|=(127&(c=p[this.pos++]))<<21,c<128?i:function(g,b,x){var E,L,A=x.buf;if(E=(112&(L=A[x.pos++]))>>4,L<128||(E|=(127&(L=A[x.pos++]))<<3,L<128)||(E|=(127&(L=A[x.pos++]))<<10,L<128)||(E|=(127&(L=A[x.pos++]))<<17,L<128)||(E|=(127&(L=A[x.pos++]))<<24,L<128)||(E|=(1&(L=A[x.pos++]))<<31,L<128))return Oh(g,E,b);throw new Error("Expected varint not more than 10 bytes")}(i|=(15&(c=p[this.pos]))<<28,a,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?(a+1)/-2:a/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var a=this.readVarint()+this.pos,i=this.pos;return this.pos=a,a-i>=12&&A1?function(c,p,g){return A1.decode(c.subarray(p,g))}(this.buf,i,a):function(c,p,g){for(var b="",x=p;x239?4:D>223?3:D>191?2:1;if(x+U>g)break;U===1?D<128&&(O=D):U===2?(192&(E=c[x+1]))==128&&(O=(31&D)<<6|63&E)<=127&&(O=null):U===3?(L=c[x+2],(192&(E=c[x+1]))==128&&(192&L)==128&&((O=(15&D)<<12|(63&E)<<6|63&L)<=2047||O>=55296&&O<=57343)&&(O=null)):U===4&&(L=c[x+2],A=c[x+3],(192&(E=c[x+1]))==128&&(192&L)==128&&(192&A)==128&&((O=(15&D)<<18|(63&E)<<12|(63&L)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,U=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=U}return b}(this.buf,i,a)},readBytes:function(){var a=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,a);return this.pos=a,i},readPackedVarint:function(a,i){if(this.type!==Un.Bytes)return a.push(this.readVarint(i));var c=Tl(this);for(a=a||[];this.pos127;);else if(i===Un.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Un.Fixed32)this.pos+=4;else{if(i!==Un.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(a,i){this.writeVarint(a<<3|i)},realloc:function(a){for(var i=this.length||16;i268435455||a<0?function(i,c){var p,g;if(i>=0?(p=i%4294967296|0,g=i/4294967296|0):(g=~(-i/4294967296),4294967295^(p=~(-i%4294967296))?p=p+1|0:(p=0,g=g+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,c),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(g,c)}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?2*-a-1:2*a)},writeBoolean:function(a){this.writeVarint(!!a)},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var i=this.pos;this.pos=function(p,g,b){for(var x,E,L=0;L55295&&x<57344){if(!E){x>56319||L+1===g.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,a,this.pos);var c=this.pos-i;c>=128&&k1(i,c,this),this.pos=i-1,this.writeVarint(c),this.pos+=c},writeFloat:function(a){this.realloc(4),P1(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),P1(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(a){var i=a.length;this.writeVarint(i),this.realloc(i);for(var c=0;c=128&&k1(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(a,i,c){this.writeTag(a,Un.Bytes),this.writeRawMessage(i,c)},writePackedVarint:function(a,i){i.length&&this.writeMessage(a,XC,i)},writePackedSVarint:function(a,i){i.length&&this.writeMessage(a,YC,i)},writePackedBoolean:function(a,i){i.length&&this.writeMessage(a,QC,i)},writePackedFloat:function(a,i){i.length&&this.writeMessage(a,KC,i)},writePackedDouble:function(a,i){i.length&&this.writeMessage(a,JC,i)},writePackedFixed32:function(a,i){i.length&&this.writeMessage(a,$C,i)},writePackedSFixed32:function(a,i){i.length&&this.writeMessage(a,tT,i)},writePackedFixed64:function(a,i){i.length&&this.writeMessage(a,eT,i)},writePackedSFixed64:function(a,i){i.length&&this.writeMessage(a,nT,i)},writeBytesField:function(a,i){this.writeTag(a,Un.Bytes),this.writeBytes(i)},writeFixed32Field:function(a,i){this.writeTag(a,Un.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(a,i){this.writeTag(a,Un.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(a,i){this.writeTag(a,Un.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(a,i){this.writeTag(a,Un.Fixed64),this.writeSFixed64(i)},writeVarintField:function(a,i){this.writeTag(a,Un.Varint),this.writeVarint(i)},writeSVarintField:function(a,i){this.writeTag(a,Un.Varint),this.writeSVarint(i)},writeStringField:function(a,i){this.writeTag(a,Un.Bytes),this.writeString(i)},writeFloatField:function(a,i){this.writeTag(a,Un.Fixed32),this.writeFloat(i)},writeDoubleField:function(a,i){this.writeTag(a,Un.Fixed64),this.writeDouble(i)},writeBooleanField:function(a,i){this.writeVarintField(a,!!i)}};var r_=y(T1);const i_=3;function rT(a,i,c){a===1&&c.readMessage(iT,i)}function iT(a,i,c){if(a===3){const{id:p,bitmap:g,width:b,height:x,left:E,top:L,advance:A}=c.readMessage(oT,{});i.push({id:p,bitmap:new Cp({width:b+2*i_,height:x+2*i_},g),metrics:{width:b,height:x,left:E,top:L,advance:A}})}}function oT(a,i,c){a===1?i.id=c.readVarint():a===2?i.bitmap=c.readBytes():a===3?i.width=c.readVarint():a===4?i.height=c.readVarint():a===5?i.left=c.readSVarint():a===6?i.top=c.readSVarint():a===7&&(i.advance=c.readVarint())}const R1=i_;function N1(a){let i=0,c=0;for(const x of a)i+=x.w*x.h,c=Math.max(c,x.w);a.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),c),h:1/0}];let g=0,b=0;for(const x of a)for(let E=p.length-1;E>=0;E--){const L=p[E];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),g=Math.max(g,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();E=0&&p>=i&&Fm[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(i,c),this.sectionIndex=this.sectionIndex.slice(i,c)}substring(i,c){const p=new Fh;return p.text=this.text.substring(i,c),p.sectionIndex=this.sectionIndex.slice(i,c),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,c)=>Math.max(i,this.sections[c].scale),0)}addTextSection(i,c){this.text+=i.text,this.sections.push(Np.forText(i.scale,i.fontStack||c));const p=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function zm(a,i,c,p,g,b,x,E,L,A,D,O,U,j,Z,et){const lt=Fh.fromFeature(a,g);let pt;O===h.ah.vertical&<.verticalizePunctuation();const{processBidirectionalText:Ct,processStyledBidirectionalText:yt}=Va;if(Ct&<.sections.length===1){pt=[];const Yt=Ct(lt.toString(),s_(lt,A,b,i,p,j,Z));for(const me of Yt){const be=new Fh;be.text=me,be.sections=lt.sections;for(let de=0;de0&&Pl>Ro&&(Ro=Pl)}else{const gs=be[gn.fontStack],Oo=gs&&gs[Ri];if(Oo&&Oo.rect)da=Oo.rect,Vs=Oo.metrics;else{const Pl=me[gn.fontStack],Vp=Pl&&Pl[Ri];if(!Vp)continue;Vs=Vp.metrics}ai=(oi-gn.scale)*ni}Us?(Yt.verticalizable=!0,Ji.push({glyph:Ri,imageName:ma,x:Qn,y:or+ai,vertical:Us,scale:gn.scale,fontStack:gn.fontStack,sectionIndex:Qi,metrics:Vs,rect:da}),Qn+=Ll*gn.scale+ke):(Ji.push({glyph:Ri,imageName:ma,x:Qn,y:or+ai,vertical:Us,scale:gn.scale,fontStack:gn.fontStack,sectionIndex:Qi,metrics:Vs,rect:da}),Qn+=Vs.advance*gn.scale+ke)}Ji.length!==0&&(ri=Math.max(Qn-ke,ri),lT(Ji,0,Ji.length-1,po,Ro)),Qn=0;const No=ie*oi+Ro;yo.lineOffset=Math.max(Ro,Ki),or+=No,Qo=Math.max(No,Qo),++Qr}var Ci;const Di=or-Rp,{horizontalAlign:mo,verticalAlign:go}=a_(ve);(function(ii,oi,Ki,yo,Ji,Ro,No,si,gn){const Qi=(oi-Ki)*Ji;let Ri=0;Ri=Ro!==No?-si*yo-Rp:(-yo*gn+.5)*No;for(const ai of ii)for(const Vs of ai.positionedGlyphs)Vs.x+=Qi,Vs.y+=Ri})(Yt.positionedLines,po,mo,go,ri,Qo,ie,Di,he.length),Yt.top+=-go*Di,Yt.bottom=Yt.top+Di,Yt.left+=-mo*ri,Yt.right=Yt.left+ri}(Zt,i,c,p,pt,x,E,L,O,A,U,et),!function(Yt){for(const me of Yt)if(me.positionedGlyphs.length!==0)return!1;return!0}(wt)&&Zt}const Fm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},sT={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 z1(a,i,c,p,g,b){if(i.imageName){const x=p[i.imageName];return x?x.displaySize[0]*i.scale*ni/b+g:0}{const x=c[i.fontStack],E=x&&x[a];return E?E.metrics.advance*i.scale+g:0}}function F1(a,i,c,p){const g=Math.pow(a-i,2);return p?a=0;let D=0;for(let U=0;Ux.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Gy([]),this.placementViewportMatrix=Gy([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=G1(this.zoom,c["text-size"]),this.iconSizeData=G1(this.zoom,c["icon-size"]);const p=this.layers[0].layout,g=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=l_(p,"text-overlap","text-allow-overlap")!=="never"||l_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>h.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=i.sourceID}createArrays(){this.text=new c_(new mr(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new c_(new mr(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new v,this.lineVertexArray=new I,this.symbolInstances=new m,this.textAnchorOffsets=new M}calculateGlyphDependencies(i,c,p,g,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),D=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!D)return;const U=c.iconDependencies,j=c.glyphDependencies,Z=c.availableImages,et=new rr(this.zoom);for(const{feature:lt,id:pt,index:Ct,sourceLayerIndex:yt}of i){const wt=g._featureFilter.needGeometry,Zt=Cl(lt,wt);if(!g._featureFilter.filter(et,Zt,p))continue;let Yt,me;if(wt||(Zt.geometry=Il(lt)),A){const de=g.getValueAndResolveTokens("text-field",Zt,p,Z),he=Lo.factory(de),ie=this.hasRTLText=this.hasRTLText||fT(he);(!ie||Va.getRTLTextPluginStatus()==="unavailable"||ie&&Va.isParsed())&&(Yt=ZC(he,g,Zt))}if(D){const de=g.getValueAndResolveTokens("icon-image",Zt,p,Z);me=de instanceof Yo?de:Yo.fromString(de)}if(!Yt&&!me)continue;const be=this.sortFeaturesByKey?O.evaluate(Zt,{},p):void 0;if(this.features.push({id:pt,text:Yt,icon:me,index:Ct,sourceLayerIndex:yt,geometry:Zt.geometry,properties:lt.properties,type:cT[lt.type],sortKey:be}),me&&(U[me.name]=!0),Yt){const de=x.evaluate(Zt,{},p).join(","),he=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.ah.vertical)>=0;for(const ie of Yt.sections)if(ie.image)U[ie.image.name]=!0;else{const ve=lu(Yt.toString()),le=ie.fontStack||de,$t=j[le]=j[le]||{};this.calculateGlyphDependencies(ie.text,$t,he,this.allowVerticalPlacement,ve)}}}b.get("symbol-placement")==="line"&&(this.features=function(lt){const pt={},Ct={},yt=[];let wt=0;function Zt(de){yt.push(lt[de]),wt++}function Yt(de,he,ie){const ve=Ct[de];return delete Ct[de],Ct[he]=ve,yt[ve].geometry[0].pop(),yt[ve].geometry[0]=yt[ve].geometry[0].concat(ie[0]),ve}function me(de,he,ie){const ve=pt[he];return delete pt[he],pt[de]=ve,yt[ve].geometry[0].shift(),yt[ve].geometry[0]=ie[0].concat(yt[ve].geometry[0]),ve}function be(de,he,ie){const ve=ie?he[0][he[0].length-1]:he[0][0];return`${de}:${ve.x}:${ve.y}`}for(let de=0;dede.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((lt,pt)=>lt.sortKey-pt.sortKey)}update(i,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(i,c,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,c){const p=this.lineVertexArray.length;if(i.segment!==void 0){let g=i.dist(c[i.segment+1]),b=i.dist(c[i.segment]);const x={};for(let E=i.segment+1;E=0;E--)x[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=c[E-1].dist(c[E]));for(let E=0;E0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(i,c){const p=i.placedSymbolArray.get(c),g=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;bg[E]-g[L]||b[L]-b[E]),x}addToSortKeyRanges(i,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((g,b,x)=>{g>=0&&x.indexOf(g)===b&&this.addIndicesForPlacedSymbol(this.text,g)}),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 q1,j1;_e("SymbolBucket",Bh,{omit:["layers","collisionBoxArray","features","compareText"]}),Bh.MAX_GLYPHS=65535,Bh.addDynamicAttributes=u_;var f_={get paint(){return j1=j1||new ho({"icon-opacity":new De(Mt.paint_symbol["icon-opacity"]),"icon-color":new De(Mt.paint_symbol["icon-color"]),"icon-halo-color":new De(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new De(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new De(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new Te(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Te(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new De(Mt.paint_symbol["text-opacity"]),"text-color":new De(Mt.paint_symbol["text-color"],{runtimeType:Lr,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new De(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new De(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new De(Mt.paint_symbol["text-halo-blur"]),"text-translate":new Te(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new Te(Mt.paint_symbol["text-translate-anchor"])})},get layout(){return q1=q1||new ho({"symbol-placement":new Te(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new Te(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Te(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new De(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Te(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Te(Mt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Te(Mt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Te(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Te(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Te(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new De(Mt.layout_symbol["icon-size"]),"icon-text-fit":new Te(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Te(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new De(Mt.layout_symbol["icon-image"]),"icon-rotate":new De(Mt.layout_symbol["icon-rotate"]),"icon-padding":new De(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new Te(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new De(Mt.layout_symbol["icon-offset"]),"icon-anchor":new De(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Te(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Te(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Te(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new De(Mt.layout_symbol["text-field"]),"text-font":new De(Mt.layout_symbol["text-font"]),"text-size":new De(Mt.layout_symbol["text-size"]),"text-max-width":new De(Mt.layout_symbol["text-max-width"]),"text-line-height":new Te(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new De(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new De(Mt.layout_symbol["text-justify"]),"text-radial-offset":new De(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Te(Mt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new De(Mt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new De(Mt.layout_symbol["text-anchor"]),"text-max-angle":new Te(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new Te(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new De(Mt.layout_symbol["text-rotate"]),"text-padding":new Te(Mt.layout_symbol["text-padding"]),"text-keep-upright":new Te(Mt.layout_symbol["text-keep-upright"]),"text-transform":new De(Mt.layout_symbol["text-transform"]),"text-offset":new De(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new Te(Mt.layout_symbol["text-allow-overlap"]),"text-overlap":new Te(Mt.layout_symbol["text-overlap"]),"text-ignore-placement":new Te(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new Te(Mt.layout_symbol["text-optional"])})}};class W1{constructor(i){if(i.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=i.property.overrides?i.property.overrides.runtimeType:Hr,this.defaultValue=i}evaluate(i){if(i.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(i.formattedSection))return c.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}_e("FormatSectionOverride",W1,{omit:["defaultValue"]});class Vm extends ps{constructor(i){super(i,f_)}recalculate(i,c){if(super.recalculate(i,c),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const g=[];for(const b of p)g.indexOf(b)<0&&g.push(b);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(i,c,p,g){const b=this.layout.get(i).evaluate(c,{},p,g),x=this._unevaluatedLayout._values[i];return x.isDataDriven()||Wn(x.value)||!b?b:function(E,L){return L.replace(/{([^{}]+)}/g,(A,D)=>E&&D in E?String(E[D]):"")}(c.properties,b)}createBucket(i){return new Bh(i)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const i of f_.paint.overridableProperties){if(!Vm.hasPaintOverride(this.layout,i))continue;const c=this.paint.get(i),p=new W1(c),g=new Jn(p,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new lh("source",g):new $f("composite",g,c.value.zoomStops),this.paint._values[i]=new fs(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(i,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&Vm.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,c){const p=i.get("text-field"),g=f_.paint.properties[c];let b=!1;const x=E=>{for(const L of E)if(g.overrides&&g.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Lo)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Na&&Xr(A.value)===Dr?x(A.value.sections):A instanceof sh?x(A.sections):A.eachChild(E))},L=p.value;L._styleExpression&&E(L._styleExpression.expression)}return b}}let H1;var pT={get paint(){return H1=H1||new ho({"background-color":new Te(Mt.paint_background["background-color"]),"background-pattern":new sc(Mt.paint_background["background-pattern"]),"background-opacity":new Te(Mt.paint_background["background-opacity"])})}};class dT extends ps{constructor(i){super(i,pT)}}let Z1;var mT={get paint(){return Z1=Z1||new ho({"raster-opacity":new Te(Mt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Te(Mt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Te(Mt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Te(Mt.paint_raster["raster-brightness-max"]),"raster-saturation":new Te(Mt.paint_raster["raster-saturation"]),"raster-contrast":new Te(Mt.paint_raster["raster-contrast"]),"raster-resampling":new Te(Mt.paint_raster["raster-resampling"]),"raster-fade-duration":new Te(Mt.paint_raster["raster-fade-duration"])})}};class gT extends ps{constructor(i){super(i,mT)}}class yT extends ps{constructor(i){super(i,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=i}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 _T{constructor(i){this._methodToThrottle=i,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 p_=63710088e-1;class pu{constructor(i,c){if(isNaN(i)||isNaN(c))throw new Error(`Invalid LngLat object: (${i}, ${c})`);if(this.lng=+i,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pu(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const c=Math.PI/180,p=this.lat*c,g=i.lat*c,b=Math.sin(p)*Math.sin(g)+Math.cos(p)*Math.cos(g)*Math.cos((i.lng-this.lng)*c);return p_*Math.acos(Math.min(b,1))}static convert(i){if(i instanceof pu)return i;if(Array.isArray(i)&&(i.length===2||i.length===3))return new pu(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&typeof i=="object"&&i!==null)return new pu(Number("lng"in i?i.lng:i.lon),Number(i.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 X1=2*Math.PI*p_;function Y1(a){return X1*Math.cos(a*Math.PI/180)}function K1(a){return(180+a)/360}function J1(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function Q1(a,i){return a/Y1(i)}function d_(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}class Um{constructor(i,c,p=0){this.x=+i,this.y=+c,this.z=+p}static fromLngLat(i,c=0){const p=pu.convert(i);return new Um(K1(p.lng),J1(p.lat),Q1(c,p.lat))}toLngLat(){return new pu(360*this.x-180,d_(this.y))}toAltitude(){return this.z*Y1(d_(this.y))}meterInMercatorCoordinateUnits(){return 1/X1*(i=d_(this.y),1/Math.cos(i*Math.PI/180));var i}}function $1(a,i,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[a*p-2*Math.PI*6378137/2,i*p-2*Math.PI*6378137/2]}class m_{constructor(i,c,p){if(i<0||i>25||p<0||p>=Math.pow(2,i)||c<0||c>=Math.pow(2,i))throw new Error(`x=${c}, y=${p}, z=${i} outside of bounds. 0<=x<${Math.pow(2,i)}, 0<=y<${Math.pow(2,i)} 0<=z<=25 `);this.z=i,this.x=c,this.y=p,this.key=zp(0,i,i,c,p)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,c,p){const g=(x=this.y,E=this.z,L=$1(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=$1(256*(b+1),256*(x+1),E),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,E,L,A;const D=function(O,U,j){let Z,et="";for(let lt=O;lt>0;lt--)Z=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,g)}isChildOf(i){const c=this.z-i.z;return c>0&&i.x===this.x>>c&&i.y===this.y>>c}getTilePoint(i){const c=Math.pow(2,this.z);return new C((i.x*c-this.x)*Pr,(i.y*c-this.y)*Pr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class tb{constructor(i,c){this.wrap=i,this.canonical=c,this.key=zp(i,c.z,c.z,c.x,c.y)}}class ms{constructor(i,c,p,g,b){if(i= z; overscaledZ = ${i}; z = ${p}`);this.overscaledZ=i,this.wrap=c,this.canonical=new m_(p,+g,+b),this.key=zp(c,i,p,g,b)}clone(){return new ms(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-i;return i>this.canonical.z?new ms(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ms(i,this.wrap,i,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(i,c){if(i>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${i}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-i;return i>this.canonical.z?zp(this.wrap*+c,i,this.canonical.z,this.canonical.x,this.canonical.y):zp(this.wrap*+c,i,i,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(i){if(i.wrap!==this.wrap)return!1;const c=this.canonical.z-i.canonical.z;return i.overscaledZ===0||i.overscaledZ>c&&i.canonical.y===this.canonical.y>>c}children(i){if(this.overscaledZ>=i)return[new ms(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,g=2*this.canonical.y;return[new ms(c,this.wrap,c,p,g),new ms(c,this.wrap,c,p+1,g),new ms(c,this.wrap,c,p,g+1),new ms(c,this.wrap,c,p+1,g+1)]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(i+1)}unpack(i,c,p){return i*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new ds({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,c,p){if(this.dim!==i.dim)throw new Error("dem dimension mismatch");let g=c*this.dim,b=c*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:g=b-1;break;case 1:b=g+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const L=-c*this.dim,A=-p*this.dim;for(let D=x;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${i} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[i]}}class rb{constructor(i,c,p,g,b){this.type="Feature",this._vectorTileFeature=i,i._z=c,i._x=p,i._y=g,this.properties=i.properties,this.id=b}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(i){this._geometry=i}toJSON(){const i={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(i[c]=this[c]);return i}}class ib{constructor(i,c){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new rc(Pr,16,0),this.grid3D=new rc(Pr,16,0),this.featureIndexArray=new z,this.promoteId=c}insert(i,c,p,g,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,g,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&L.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new cu.VectorTile(new r_(this.rawTileData)).layers,this.sourceLayerCoder=new nb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(i,c,p,g){this.loadVTLayers();const b=i.params||{},x=Pr/i.tileSize/i.scale,E=fh(b.filter),L=i.queryGeometry,A=i.queryPadding*x,D=sb(L),O=this.grid.query(D.minX-A,D.minY-A,D.maxX+A,D.maxY+A),U=sb(i.cameraQueryGeometry),j=this.grid3D.query(U.minX-A,U.minY-A,U.maxX+A,U.maxY+A,(lt,pt,Ct,yt)=>function(wt,Zt,Yt,me,be){for(const he of wt)if(Zt<=he.x&&Yt<=he.y&&me>=he.x&&be>=he.y)return!0;const de=[new C(Zt,Yt),new C(Zt,be),new C(me,be),new C(me,Yt)];if(wt.length>2){for(const he of de)if(kh(wt,he))return!0}for(let he=0;he(yt||(yt=Il(wt)),Zt.queryIntersectsFeature(L,wt,Yt,yt,this.z,i.transform,x,i.pixelPosMatrix)))}return Z}loadMatchingFeature(i,c,p,g,b,x,E,L,A,D,O){const U=this.bucketLayerIDs[c];if(x&&!function(lt,pt){for(let Ct=0;Ct=0)return!0;return!1}(x,U))return;const j=this.sourceLayerCoder.decode(p),Z=this.vtLayers[j].feature(g);if(b.needGeometry){const lt=Cl(Z,!0);if(!b.filter(new rr(this.tileID.overscaledZ),lt,this.tileID.canonical))return}else if(!b.filter(new rr(this.tileID.overscaledZ),Z))return;const et=this.getId(Z,j);for(let lt=0;lt{const E=i instanceof oc?i.get(x):null;return E&&E.evaluate?E.evaluate(c,p,g):E})}function sb(a){let i=1/0,c=1/0,p=-1/0,g=-1/0;for(const b of a)i=Math.min(i,b.x),c=Math.min(c,b.y),p=Math.max(p,b.x),g=Math.max(g,b.y);return{minX:i,minY:c,maxX:p,maxY:g}}function vT(a,i){return i-a}function ab(a,i,c,p,g){const b=[];for(let x=0;x=p&&O.x>=p||(D.x>=p?D=new C(p,D.y+(p-D.x)/(O.x-D.x)*(O.y-D.y))._round():O.x>=p&&(O=new C(p,D.y+(p-D.x)/(O.x-D.x)*(O.y-D.y))._round()),D.y>=g&&O.y>=g||(D.y>=g?D=new C(D.x+(g-D.y)/(O.y-D.y)*(O.x-D.x),g)._round():O.y>=g&&(O=new C(D.x+(g-D.y)/(O.y-D.y)*(O.x-D.x),g)._round()),L&&D.equals(L[L.length-1])||(L=[D],b.push(L)),L.push(O)))))}}return b}_e("FeatureIndex",ib,{omit:["rawTileData","sourceLayerCoder"]});class du extends C{constructor(i,c,p,g){super(i,c),this.angle=p,g!==void 0&&(this.segment=g)}clone(){return new du(this.x,this.y,this.angle,this.segment)}}function lb(a,i,c,p,g){if(i.segment===void 0||c===0)return!0;let b=i,x=i.segment+1,E=0;for(;E>-c/2;){if(x--,x<0)return!1;E-=a[x].dist(b),b=a[x]}E+=a[x].dist(a[x+1]),x++;const L=[];let A=0;for(;Ep;)A-=L.shift().angleDelta;if(A>g)return!1;x++,E+=D.dist(O)}return!0}function ub(a){let i=0;for(let c=0;cA){const Z=(A-L)/j,et=Xi.number(O.x,U.x,Z),lt=Xi.number(O.y,U.y,Z),pt=new du(et,lt,U.angleTo(O),D);return pt._round(),!x||lb(a,pt,E,x,i)?pt:void 0}L+=j}}function xT(a,i,c,p,g,b,x,E,L){const A=cb(p,b,x),D=hb(p,g),O=D*x,U=a[0].x===0||a[0].x===L||a[0].y===0||a[0].y===L;return i-O=0&&wt=0&&Zt=0&&U+A<=D){const Yt=new du(wt,Zt,Ct,Z);Yt._round(),p&&!lb(a,Yt,b,p,g)||j.push(Yt)}}O+=pt}return E||j.length||x||(j=fb(a,O/2,c,p,g,b,x,!0,L)),j}_e("Anchor",du);const Vh=Do;function pb(a,i,c,p){const g=[],b=a.image,x=b.pixelRatio,E=b.paddedRect.w-2*Vh,L=b.paddedRect.h-2*Vh,A=a.right-a.left,D=a.bottom-a.top,O=b.stretchX||[[0,E]],U=b.stretchY||[[0,L]],j=(ie,ve)=>ie+ve[1]-ve[0],Z=O.reduce(j,0),et=U.reduce(j,0),lt=E-Z,pt=L-et;let Ct=0,yt=Z,wt=0,Zt=et,Yt=0,me=lt,be=0,de=pt;if(b.content&&p){const ie=b.content;Ct=Gm(O,0,ie[0]),wt=Gm(U,0,ie[1]),yt=Gm(O,ie[0],ie[2]),Zt=Gm(U,ie[1],ie[3]),Yt=ie[0]-Ct,be=ie[1]-wt,me=ie[2]-ie[0]-yt,de=ie[3]-ie[1]-Zt}const he=(ie,ve,le,$t)=>{const ke=qm(ie.stretch-Ct,yt,A,a.left),Ee=jm(ie.fixed-Yt,me,ie.stretch,Z),cn=qm(ve.stretch-wt,Zt,D,a.top),Qn=jm(ve.fixed-be,de,ve.stretch,et),or=qm(le.stretch-Ct,yt,A,a.left),ri=jm(le.fixed-Yt,me,le.stretch,Z),Qo=qm($t.stretch-wt,Zt,D,a.top),po=jm($t.fixed-be,de,$t.stretch,et),Qr=new C(ke,cn),Ci=new C(or,cn),Di=new C(or,Qo),mo=new C(ke,Qo),go=new C(Ee/x,Qn/x),ii=new C(ri/x,po/x),oi=i*Math.PI/180;if(oi){const Ji=Math.sin(oi),Ro=Math.cos(oi),No=[Ro,-Ji,Ji,Ro];Qr._matMult(No),Ci._matMult(No),mo._matMult(No),Di._matMult(No)}const Ki=ie.stretch+ie.fixed,yo=ve.stretch+ve.fixed;return{tl:Qr,tr:Ci,bl:mo,br:Di,tex:{x:b.paddedRect.x+Vh+Ki,y:b.paddedRect.y+Vh+yo,w:le.stretch+le.fixed-Ki,h:$t.stretch+$t.fixed-yo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:go,pixelOffsetBR:ii,minFontScaleX:me/x/A,minFontScaleY:de/x/D,isSDF:c}};if(p&&(b.stretchX||b.stretchY)){const ie=db(O,lt,Z),ve=db(U,pt,et);for(let le=0;le0&&(Z=Math.max(10,Z),this.circleDiameter=Z)}else{let O=x.top*E-L[0],U=x.bottom*E+L[2],j=x.left*E-L[3],Z=x.right*E+L[1];const et=x.collisionPadding;if(et&&(j-=et[0]*E,O-=et[1]*E,Z+=et[2]*E,U+=et[3]*E),D){const lt=new C(j,O),pt=new C(Z,O),Ct=new C(j,U),yt=new C(Z,U),wt=D*Math.PI/180;lt._rotate(wt),pt._rotate(wt),Ct._rotate(wt),yt._rotate(wt),j=Math.min(lt.x,pt.x,Ct.x,yt.x),Z=Math.max(lt.x,pt.x,Ct.x,yt.x),O=Math.min(lt.y,pt.y,Ct.y,yt.y),U=Math.max(lt.y,pt.y,Ct.y,yt.y)}i.emplaceBack(c.x,c.y,j,O,Z,U,p,g,b)}this.boxEndIndex=i.length}}class wT{constructor(i=[],c=ST){if(this.data=i,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:c,compare:p}=this,g=c[i];for(;i>0;){const b=i-1>>1,x=c[b];if(p(g,x)>=0)break;c[i]=x,i=b}c[i]=g}_down(i){const{data:c,compare:p}=this,g=this.length>>1,b=c[i];for(;i=0)break;c[i]=E,i=x}c[i]=b}}function ST(a,i){return ai?1:0}function ET(a,i=1,c=!1){let p=1/0,g=1/0,b=-1/0,x=-1/0;const E=a[0];for(let j=0;jb)&&(b=Z.x),(!j||Z.y>x)&&(x=Z.y)}const L=Math.min(b-p,x-g);let A=L/2;const D=new wT([],IT);if(L===0)return new C(p,g);for(let j=p;jO.d||!O.d)&&(O=j,c&&console.log("found best %d after %d probes",Math.round(1e4*j.d)/1e4,U)),j.max-O.d<=i||(A=j.h/2,D.push(new Uh(j.p.x-A,j.p.y-A,A,a)),D.push(new Uh(j.p.x+A,j.p.y-A,A,a)),D.push(new Uh(j.p.x-A,j.p.y+A,A,a)),D.push(new Uh(j.p.x+A,j.p.y+A,A,a)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${O.d}`)),O.p}function IT(a,i){return i.max-a.max}function Uh(a,i,c,p){this.p=new C(a,i),this.h=c,this.d=function(g,b){let x=!1,E=1/0;for(let L=0;Lg.y!=Z.y>g.y&&g.x<(Z.x-j.x)*(g.y-j.y)/(Z.y-j.y)+j.x&&(x=!x),E=Math.min(E,Jv(g,j,Z))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var ki;h.ap=void 0,(ki=h.ap||(h.ap={}))[ki.center=1]="center",ki[ki.left=2]="left",ki[ki.right=3]="right",ki[ki.top=4]="top",ki[ki.bottom=5]="bottom",ki[ki["top-left"]=6]="top-left",ki[ki["top-right"]=7]="top-right",ki[ki["bottom-left"]=8]="bottom-left",ki[ki["bottom-right"]=9]="bottom-right";const mu=7,g_=Number.POSITIVE_INFINITY;function mb(a,i){return i[1]!==g_?function(c,p,g){let b=0,x=0;switch(p=Math.abs(p),g=Math.abs(g),c){case"top-right":case"top-left":case"top":x=g-mu;break;case"bottom-right":case"bottom-left":case"bottom":x=-g+mu}switch(c){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(a,i[0],i[1]):function(c,p){let g=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(c){case"top-right":case"top-left":b=x-mu;break;case"bottom-right":case"bottom-left":b=-x+mu;break;case"bottom":b=-p+mu;break;case"top":b=p-mu}switch(c){case"top-right":case"bottom-right":g=-x;break;case"top-left":case"bottom-left":g=x;break;case"left":g=p;break;case"right":g=-p}return[g,b]}(a,i[0])}function gb(a,i,c){var p;const g=a.layout,b=(p=g.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(i,{},c);if(b){const E=b.values,L=[];for(let A=0;AU*ni);D.startsWith("top")?O[1]-=mu:D.startsWith("bottom")&&(O[1]+=mu),L[A+1]=O}return new Xo(L)}const x=g.get("text-variable-anchor");if(x){let E;E=a._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(i,{},c)*ni,g_]:g.get("text-offset").evaluate(i,{},c).map(A=>A*ni);const L=[];for(const A of x)L.push(A,mb(A,E));return new Xo(L)}return null}function y_(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function CT(a,i,c,p,g,b,x,E,L,A,D){let O=b.textMaxSize.evaluate(i,{});O===void 0&&(O=x);const U=a.layers[0].layout,j=U.get("icon-offset").evaluate(i,{},D),Z=_b(c.horizontal),et=x/24,lt=a.tilePixelRatio*et,pt=a.tilePixelRatio*O/24,Ct=a.tilePixelRatio*E,yt=a.tilePixelRatio*U.get("symbol-spacing"),wt=U.get("text-padding")*a.tilePixelRatio,Zt=function($t,ke,Ee,cn=1){const Qn=$t.get("icon-padding").evaluate(ke,{},Ee),or=Qn&&Qn.values;return[or[0]*cn,or[1]*cn,or[2]*cn,or[3]*cn]}(U,i,D,a.tilePixelRatio),Yt=U.get("text-max-angle")/180*Math.PI,me=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",be=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",de=U.get("symbol-placement"),he=yt/2,ie=U.get("icon-text-fit");let ve;p&&ie!=="none"&&(a.allowVerticalPlacement&&c.vertical&&(ve=U1(p,c.vertical,ie,U.get("icon-text-fit-padding"),j,et)),Z&&(p=U1(p,Z,ie,U.get("icon-text-fit-padding"),j,et)));const le=($t,ke)=>{ke.x<0||ke.x>=Pr||ke.y<0||ke.y>=Pr||function(Ee,cn,Qn,or,ri,Qo,po,Qr,Ci,Di,mo,go,ii,oi,Ki,yo,Ji,Ro,No,si,gn,Qi,Ri,ai,Vs){const da=Ee.addToLineVertexArray(cn,Qn);let ma,Ll,Us,gs,Oo=0,Pl=0,Vp=0,wb=0,I_=-1,C_=-1;const Ml={};let Sb=wr("");if(Ee.allowVerticalPlacement&&or.vertical){const $i=Qr.layout.get("text-rotate").evaluate(gn,{},ai)+90;Us=new Wm(Ci,cn,Di,mo,go,or.vertical,ii,oi,Ki,$i),po&&(gs=new Wm(Ci,cn,Di,mo,go,po,Ji,Ro,Ki,$i))}if(ri){const $i=Qr.layout.get("icon-rotate").evaluate(gn,{}),ys=Qr.layout.get("icon-text-fit")!=="none",dc=pb(ri,$i,Ri,ys),ya=po?pb(po,$i,Ri,ys):void 0;Ll=new Wm(Ci,cn,Di,mo,go,ri,Ji,Ro,!1,$i),Oo=4*dc.length;const mc=Ee.iconSizeData;let Wa=null;mc.kind==="source"?(Wa=[ja*Qr.layout.get("icon-size").evaluate(gn,{})],Wa[0]>fu&&Qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${Op}. Reduce your "icon-size".`)):mc.kind==="composite"&&(Wa=[ja*Qi.compositeIconSizes[0].evaluate(gn,{},ai),ja*Qi.compositeIconSizes[1].evaluate(gn,{},ai)],(Wa[0]>fu||Wa[1]>fu)&&Qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${Op}. Reduce your "icon-size".`)),Ee.addSymbols(Ee.icon,dc,Wa,si,No,gn,h.ah.none,cn,da.lineStartIndex,da.lineLength,-1,ai),I_=Ee.icon.placedSymbolArray.length-1,ya&&(Pl=4*ya.length,Ee.addSymbols(Ee.icon,ya,Wa,si,No,gn,h.ah.vertical,cn,da.lineStartIndex,da.lineLength,-1,ai),C_=Ee.icon.placedSymbolArray.length-1)}const Eb=Object.keys(or.horizontal);for(const $i of Eb){const ys=or.horizontal[$i];if(!ma){Sb=wr(ys.text);const ya=Qr.layout.get("text-rotate").evaluate(gn,{},ai);ma=new Wm(Ci,cn,Di,mo,go,ys,ii,oi,Ki,ya)}const dc=ys.positionedLines.length===1;if(Vp+=yb(Ee,cn,ys,Qo,Qr,Ki,gn,yo,da,or.vertical?h.ah.horizontal:h.ah.horizontalOnly,dc?Eb:[$i],Ml,I_,Qi,ai),dc)break}or.vertical&&(wb+=yb(Ee,cn,or.vertical,Qo,Qr,Ki,gn,yo,da,h.ah.vertical,["vertical"],Ml,C_,Qi,ai));const PT=ma?ma.boxStartIndex:Ee.collisionBoxArray.length,MT=ma?ma.boxEndIndex:Ee.collisionBoxArray.length,AT=Us?Us.boxStartIndex:Ee.collisionBoxArray.length,kT=Us?Us.boxEndIndex:Ee.collisionBoxArray.length,DT=Ll?Ll.boxStartIndex:Ee.collisionBoxArray.length,RT=Ll?Ll.boxEndIndex:Ee.collisionBoxArray.length,NT=gs?gs.boxStartIndex:Ee.collisionBoxArray.length,OT=gs?gs.boxEndIndex:Ee.collisionBoxArray.length;let ga=-1;const Zm=($i,ys)=>$i&&$i.circleDiameter?Math.max($i.circleDiameter,ys):ys;ga=Zm(ma,ga),ga=Zm(Us,ga),ga=Zm(Ll,ga),ga=Zm(gs,ga);const Ib=ga>-1?1:0;Ib&&(ga*=Vs/ni),Ee.glyphOffsetArray.length>=Bh.MAX_GLYPHS&&Qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),gn.sortKey!==void 0&&Ee.addToSortKeyRanges(Ee.symbolInstances.length,gn.sortKey);const zT=gb(Qr,gn,ai),[FT,BT]=function($i,ys){const dc=$i.length,ya=ys==null?void 0:ys.values;if((ya==null?void 0:ya.length)>0)for(let mc=0;mc=0?Ml.right:-1,Ml.center>=0?Ml.center:-1,Ml.left>=0?Ml.left:-1,Ml.vertical||-1,I_,C_,Sb,PT,MT,AT,kT,DT,RT,NT,OT,Di,Vp,wb,Oo,Pl,Ib,0,ii,ga,FT,BT)}(a,ke,$t,c,p,g,ve,a.layers[0],a.collisionBoxArray,i.index,i.sourceLayerIndex,a.index,lt,[wt,wt,wt,wt],me,L,Ct,Zt,be,j,i,b,A,D,x)};if(de==="line")for(const $t of ab(i.geometry,0,0,Pr,Pr)){const ke=xT($t,yt,Yt,c.vertical||Z,p,24,pt,a.overscaling,Pr);for(const Ee of ke)Z&&TT(a,Z.text,he,Ee)||le($t,Ee)}else if(de==="line-center"){for(const $t of i.geometry)if($t.length>1){const ke=bT($t,Yt,c.vertical||Z,p,24,pt);ke&&le($t,ke)}}else if(i.type==="Polygon")for(const $t of Yy(i.geometry,0)){const ke=ET($t,16);le($t[0],new du(ke.x,ke.y,0))}else if(i.type==="LineString")for(const $t of i.geometry)le($t,new du($t[0].x,$t[0].y,0));else if(i.type==="Point")for(const $t of i.geometry)for(const ke of $t)le([ke],new du(ke.x,ke.y,0))}function yb(a,i,c,p,g,b,x,E,L,A,D,O,U,j,Z){const et=function(Ct,yt,wt,Zt,Yt,me,be,de){const he=Zt.layout.get("text-rotate").evaluate(me,{})*Math.PI/180,ie=[];for(const ve of yt.positionedLines)for(const le of ve.positionedGlyphs){if(!le.rect)continue;const $t=le.rect||{};let ke=R1+1,Ee=!0,cn=1,Qn=0;const or=(Yt||de)&&le.vertical,ri=le.metrics.advance*le.scale/2;if(de&&yt.verticalizable&&(Qn=ve.lineOffset/2-(le.imageName?-(ni-le.metrics.width*le.scale)/2:(le.scale-1)*ni)),le.imageName){const si=be[le.imageName];Ee=si.sdf,cn=si.pixelRatio,ke=Do/cn}const Qo=Yt?[le.x+ri,le.y]:[0,0];let po=Yt?[0,0]:[le.x+ri+wt[0],le.y+wt[1]-Qn],Qr=[0,0];or&&(Qr=po,po=[0,0]);const Ci=le.metrics.isDoubleResolution?2:1,Di=(le.metrics.left-ke)*le.scale-ri+po[0],mo=(-le.metrics.top-ke)*le.scale+po[1],go=Di+$t.w/Ci*le.scale/cn,ii=mo+$t.h/Ci*le.scale/cn,oi=new C(Di,mo),Ki=new C(go,mo),yo=new C(Di,ii),Ji=new C(go,ii);if(or){const si=new C(-ri,ri-Rp),gn=-Math.PI/2,Qi=ni/2-ri,Ri=new C(5-Rp-Qi,-(le.imageName?Qi:0)),ai=new C(...Qr);oi._rotateAround(gn,si)._add(Ri)._add(ai),Ki._rotateAround(gn,si)._add(Ri)._add(ai),yo._rotateAround(gn,si)._add(Ri)._add(ai),Ji._rotateAround(gn,si)._add(Ri)._add(ai)}if(he){const si=Math.sin(he),gn=Math.cos(he),Qi=[gn,-si,si,gn];oi._matMult(Qi),Ki._matMult(Qi),yo._matMult(Qi),Ji._matMult(Qi)}const Ro=new C(0,0),No=new C(0,0);ie.push({tl:oi,tr:Ki,bl:yo,br:Ji,tex:$t,writingMode:yt.writingMode,glyphOffset:Qo,sectionIndex:le.sectionIndex,isSDF:Ee,pixelOffsetTL:Ro,pixelOffsetBR:No,minFontScaleX:0,minFontScaleY:0})}return ie}(0,c,E,g,b,x,p,a.allowVerticalPlacement),lt=a.textSizeData;let pt=null;lt.kind==="source"?(pt=[ja*g.layout.get("text-size").evaluate(x,{})],pt[0]>fu&&Qt(`${a.layerIds[0]}: Value for "text-size" is >= ${Op}. Reduce your "text-size".`)):lt.kind==="composite"&&(pt=[ja*j.compositeTextSizes[0].evaluate(x,{},Z),ja*j.compositeTextSizes[1].evaluate(x,{},Z)],(pt[0]>fu||pt[1]>fu)&&Qt(`${a.layerIds[0]}: Value for "text-size" is >= ${Op}. Reduce your "text-size".`)),a.addSymbols(a.text,et,pt,E,b,x,A,i,L.lineStartIndex,L.lineLength,U,Z);for(const Ct of D)O[Ct]=a.text.placedSymbolArray.length-1;return 4*et.length}function _b(a){for(const i in a)return a[i];return null}function TT(a,i,c,p){const g=a.compareText;if(i in g){const b=g[i];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const b=vb[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(i,2,1),[E]=new Uint32Array(i,4,1);return new __(E,x,b,i)}constructor(i,c=64,p=Float64Array,g){if(isNaN(i)||i<0)throw new Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;const b=vb.indexOf(this.ArrayType),x=2*i*this.ArrayType.BYTES_PER_ELEMENT,E=i*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+E+L,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+L),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+E+L,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=i)}add(i,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=i,this.coords[this._pos++]=c,p}finish(){const i=this._pos>>1;if(i!==this.numItems)throw new Error(`Added ${i} items when expected ${this.numItems}.`);return v_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,c,p,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const D=L.pop()||0,O=L.pop()||0,U=L.pop()||0;if(O-U<=E){for(let lt=U;lt<=O;lt++){const pt=x[2*lt],Ct=x[2*lt+1];pt>=i&&pt<=p&&Ct>=c&&Ct<=g&&A.push(b[lt])}continue}const j=U+O>>1,Z=x[2*j],et=x[2*j+1];Z>=i&&Z<=p&&et>=c&&et<=g&&A.push(b[j]),(D===0?i<=Z:c<=et)&&(L.push(U),L.push(j-1),L.push(1-D)),(D===0?p>=Z:g>=et)&&(L.push(j+1),L.push(O),L.push(1-D))}return A}within(i,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:b,nodeSize:x}=this,E=[0,g.length-1,0],L=[],A=p*p;for(;E.length;){const D=E.pop()||0,O=E.pop()||0,U=E.pop()||0;if(O-U<=x){for(let lt=U;lt<=O;lt++)xb(b[2*lt],b[2*lt+1],i,c)<=A&&L.push(g[lt]);continue}const j=U+O>>1,Z=b[2*j],et=b[2*j+1];xb(Z,et,i,c)<=A&&L.push(g[j]),(D===0?i-p<=Z:c-p<=et)&&(E.push(U),E.push(j-1),E.push(1-D)),(D===0?i+p>=Z:c+p>=et)&&(E.push(j+1),E.push(O),E.push(1-D))}return L}}function v_(a,i,c,p,g,b){if(g-p<=c)return;const x=p+g>>1;bb(a,i,x,p,g,b),v_(a,i,c,p,x-1,1-b),v_(a,i,c,x+1,g,1-b)}function bb(a,i,c,p,g,b){for(;g>p;){if(g-p>600){const A=g-p+1,D=c-p+1,O=Math.log(A),U=.5*Math.exp(2*O/3),j=.5*Math.sqrt(O*U*(A-U)/A)*(D-A/2<0?-1:1);bb(a,i,c,Math.max(p,Math.floor(c-D*U/A+j)),Math.min(g,Math.floor(c+(A-D)*U/A+j)),b)}const x=i[2*c+b];let E=p,L=g;for(Fp(a,i,p,c),i[2*g+b]>x&&Fp(a,i,p,g);Ex;)L--}i[2*p+b]===x?Fp(a,i,p,L):(L++,Fp(a,i,L,g)),L<=c&&(p=L+1),c<=L&&(g=L-1)}}function Fp(a,i,c,p){b_(a,c,p),b_(i,2*c,2*p),b_(i,2*c+1,2*p+1)}function b_(a,i,c){const p=a[i];a[i]=a[c],a[c]=p}function xb(a,i,c,p){const g=a-c,b=i-p;return g*g+b*b}var x_;h.bd=void 0,(x_=h.bd||(h.bd={})).create="create",x_.load="load",x_.fullLoad="fullLoad";let Hm=null,Bp=[];const w_=1e3/60,S_="loadTime",E_="fullLoadTime",LT={mark(a){performance.mark(a)},frame(a){const i=a;Hm!=null&&Bp.push(i-Hm),Hm=i},clearMetrics(){Hm=null,Bp=[],performance.clearMeasures(S_),performance.clearMeasures(E_);for(const a in h.bd)performance.clearMarks(h.bd[a])},getPerformanceMetrics(){performance.measure(S_,h.bd.create,h.bd.load),performance.measure(E_,h.bd.create,h.bd.fullLoad);const a=performance.getEntriesByName(S_)[0].duration,i=performance.getEntriesByName(E_)[0].duration,c=Bp.length,p=1/(Bp.reduce((b,x)=>b+x,0)/c/1e3),g=Bp.filter(b=>b>w_).reduce((b,x)=>b+(x-w_)/w_,0);return{loadTime:a,fullLoadTime:i,fps:p,percentDroppedFrames:g/(c+g)*100,totalFrames:c}}};h.$=se,h.A=Dh,h.B=function(a){if(Wt==null){const i=a.navigator?a.navigator.userAgent:null;Wt=!!a.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return Wt},h.C=class{constructor(a,i){this.target=a,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new _T(()=>this.process()),this.subscription=function(c,p,g,b){return c.addEventListener(p,g,!1),{unsubscribe:()=>{c.removeEventListener(p,g,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=fe(self)?a:window}registerMessageHandler(a,i){this.messageHandlers[a]=i}sendAsync(a,i){return new Promise((c,p)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:c,reject:p},i&&i.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const E={id:g,type:"",origin:location.origin,targetMapId:a.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},a),{id:g,sourceMapId:this.mapId,origin:location.origin,data:su(a.data,b)});this.target.postMessage(x,{transfer:b})})}receive(a){const i=a.data,c=i.id;if(!(i.origin!=="file://"&&location.origin!=="file://"&&i.origin!==location.origin||i.targetMapId&&this.mapId!==i.targetMapId)){if(i.type===""){delete this.tasks[c];const p=this.abortControllers[c];return delete this.abortControllers[c],void(p&&p.abort())}if(fe(self)||i.mustQueue)return this.tasks[c]=i,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,i)}}process(){if(this.taskQueue.length===0)return;const a=this.taskQueue.shift(),i=this.tasks[a];delete this.tasks[a],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(a,i)}processTask(a,i){return u(this,void 0,void 0,function*(){if(i.type===""){const g=this.resolveRejects[a];return delete this.resolveRejects[a],g?void(i.error?g.reject(au(i.error)):g.resolve(au(i.data))):void 0}if(!this.messageHandlers[i.type])return void this.completeTask(a,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=au(i.data),p=new AbortController;this.abortControllers[a]=p;try{const g=yield this.messageHandlers[i.type](i.sourceMapId,c,p);this.completeTask(a,null,g)}catch(g){this.completeTask(a,g)}})}completeTask(a,i,c){const p=[];delete this.abortControllers[a];const g={id:a,type:"",sourceMapId:this.mapId,origin:location.origin,error:i?su(i):null,data:su(c,p)};this.target.postMessage(g,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},h.D=Te,h.E=mn,h.F=function(){var a=new Dh(16);return Dh!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},h.G=kn,h.H=function(a,i,c){var p,g,b,x,E,L,A,D,O,U,j,Z,et=c[0],lt=c[1],pt=c[2];return i===a?(a[12]=i[0]*et+i[4]*lt+i[8]*pt+i[12],a[13]=i[1]*et+i[5]*lt+i[9]*pt+i[13],a[14]=i[2]*et+i[6]*lt+i[10]*pt+i[14],a[15]=i[3]*et+i[7]*lt+i[11]*pt+i[15]):(g=i[1],b=i[2],x=i[3],E=i[4],L=i[5],A=i[6],D=i[7],O=i[8],U=i[9],j=i[10],Z=i[11],a[0]=p=i[0],a[1]=g,a[2]=b,a[3]=x,a[4]=E,a[5]=L,a[6]=A,a[7]=D,a[8]=O,a[9]=U,a[10]=j,a[11]=Z,a[12]=p*et+E*lt+O*pt+i[12],a[13]=g*et+L*lt+U*pt+i[13],a[14]=b*et+A*lt+j*pt+i[14],a[15]=x*et+D*lt+Z*pt+i[15]),a},h.I=o_,h.J=function(a,i,c){var p=c[0],g=c[1],b=c[2];return a[0]=i[0]*p,a[1]=i[1]*p,a[2]=i[2]*p,a[3]=i[3]*p,a[4]=i[4]*g,a[5]=i[5]*g,a[6]=i[6]*g,a[7]=i[7]*g,a[8]=i[8]*b,a[9]=i[9]*b,a[10]=i[10]*b,a[11]=i[11]*b,a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15],a},h.K=e1,h.L=function(a,i){const c={};for(let p=0;p{const i=window.document.createElement("video");return i.muted=!0,new Promise(c=>{i.onloadstart=()=>{c(i)};for(const p of a){const g=window.document.createElement("source");er(p)||(i.crossOrigin="Anonymous"),g.src=p,i.appendChild(g)}})},h.a3=function(){return rt++},h.a4=_,h.a5=Bh,h.a6=fh,h.a7=Cl,h.a8=rr,h.a9=rb,h.aA=$,h.aB=function(a,i){if(!a)return[{command:"setStyle",args:[i]}];let c=[];try{if(!on(a.version,i.version))return[{command:"setStyle",args:[i]}];on(a.center,i.center)||c.push({command:"setCenter",args:[i.center]}),on(a.zoom,i.zoom)||c.push({command:"setZoom",args:[i.zoom]}),on(a.bearing,i.bearing)||c.push({command:"setBearing",args:[i.bearing]}),on(a.pitch,i.pitch)||c.push({command:"setPitch",args:[i.pitch]}),on(a.sprite,i.sprite)||c.push({command:"setSprite",args:[i.sprite]}),on(a.glyphs,i.glyphs)||c.push({command:"setGlyphs",args:[i.glyphs]}),on(a.transition,i.transition)||c.push({command:"setTransition",args:[i.transition]}),on(a.light,i.light)||c.push({command:"setLight",args:[i.light]}),on(a.terrain,i.terrain)||c.push({command:"setTerrain",args:[i.terrain]}),on(a.sky,i.sky)||c.push({command:"setSky",args:[i.sky]});const p={},g=[];(function(x,E,L,A){let D;for(D in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,D)&&(Object.prototype.hasOwnProperty.call(E,D)||ls(D,L,A));for(D in E)Object.prototype.hasOwnProperty.call(E,D)&&(Object.prototype.hasOwnProperty.call(x,D)?on(x[D],E[D])||(x[D].type==="geojson"&&E[D].type==="geojson"&&Ra(x,E,D)?Hn(L,{command:"setGeoJSONSourceData",args:[D,E[D].data]}):ks(D,E,L,A)):To(D,E,L))})(a.sources,i.sources,g,p);const b=[];a.layers&&a.layers.forEach(x=>{"source"in x&&p[x.source]?c.push({command:"removeLayer",args:[x.id]}):b.push(x)}),c=c.concat(g),function(x,E,L){E=E||[];const A=(x=x||[]).map(ml),D=E.map(ml),O=x.reduce(us,{}),U=E.reduce(us,{}),j=A.slice(),Z=Object.create(null);let et,lt,pt,Ct,yt;for(let wt=0,Zt=0;wt@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,g,b)=>{const x=g||b;return i[p]=!x||x.toLowerCase(),""}),i["max-age"]){const c=parseInt(i["max-age"],10);isNaN(c)?delete i["max-age"]:i["max-age"]=c}return i},h.ab=function(a,i){const c=[];for(const p in a)p in i||c.push(p);return c},h.ac=at,h.ad=function(a,i,c){var p=Math.sin(c),g=Math.cos(c),b=i[0],x=i[1],E=i[2],L=i[3],A=i[4],D=i[5],O=i[6],U=i[7];return i!==a&&(a[8]=i[8],a[9]=i[9],a[10]=i[10],a[11]=i[11],a[12]=i[12],a[13]=i[13],a[14]=i[14],a[15]=i[15]),a[0]=b*g+A*p,a[1]=x*g+D*p,a[2]=E*g+O*p,a[3]=L*g+U*p,a[4]=A*g-b*p,a[5]=D*g-x*p,a[6]=O*g-E*p,a[7]=U*g-L*p,a},h.ae=function(a){var i=new Dh(16);return i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],i[4]=a[4],i[5]=a[5],i[6]=a[6],i[7]=a[7],i[8]=a[8],i[9]=a[9],i[10]=a[10],i[11]=a[11],i[12]=a[12],i[13]=a[13],i[14]=a[14],i[15]=a[15],i},h.af=Mm,h.ag=function(a,i){let c=0,p=0;if(a.kind==="constant")p=a.layoutSize;else if(a.kind!=="source"){const{interpolationType:g,minZoom:b,maxZoom:x}=a,E=g?at(Ai.interpolationFactor(g,i,b,x),0,1):0;a.kind==="camera"?p=Xi.number(a.minSize,a.maxSize,E):c=E}return{uSizeT:c,uSize:p}},h.ai=function(a,{uSize:i,uSizeT:c},{lowerSize:p,upperSize:g}){return a.kind==="source"?p/ja:a.kind==="composite"?Xi.number(p/ja,g/ja,c):i},h.aj=u_,h.ak=function(a,i,c,p){const g=i.y-a.y,b=i.x-a.x,x=p.y-c.y,E=p.x-c.x,L=x*b-E*g;if(L===0)return null;const A=(E*(a.y-c.y)-x*(a.x-c.x))/L;return new C(a.x+A*b,a.y+A*g)},h.al=ab,h.am=bp,h.an=Gy,h.ao=ni,h.aq=l_,h.ar=function(a,i){var c=i[0],p=i[1],g=i[2],b=i[3],x=i[4],E=i[5],L=i[6],A=i[7],D=i[8],O=i[9],U=i[10],j=i[11],Z=i[12],et=i[13],lt=i[14],pt=i[15],Ct=c*E-p*x,yt=c*L-g*x,wt=c*A-b*x,Zt=p*L-g*E,Yt=p*A-b*E,me=g*A-b*L,be=D*et-O*Z,de=D*lt-U*Z,he=D*pt-j*Z,ie=O*lt-U*et,ve=O*pt-j*et,le=U*pt-j*lt,$t=Ct*le-yt*ve+wt*ie+Zt*he-Yt*de+me*be;return $t?(a[0]=(E*le-L*ve+A*ie)*($t=1/$t),a[1]=(g*ve-p*le-b*ie)*$t,a[2]=(et*me-lt*Yt+pt*Zt)*$t,a[3]=(U*Yt-O*me-j*Zt)*$t,a[4]=(L*he-x*le-A*de)*$t,a[5]=(c*le-g*he+b*de)*$t,a[6]=(lt*wt-Z*me-pt*yt)*$t,a[7]=(D*me-U*wt+j*yt)*$t,a[8]=(x*ve-E*he+A*be)*$t,a[9]=(p*he-c*ve-b*be)*$t,a[10]=(Z*Yt-et*wt+pt*Ct)*$t,a[11]=(O*wt-D*Yt-j*Ct)*$t,a[12]=(E*de-x*ie-L*be)*$t,a[13]=(c*ie-p*de+g*be)*$t,a[14]=(et*yt-Z*Zt-lt*Ct)*$t,a[15]=(D*Zt-O*yt+U*Ct)*$t,a):null},h.as=y_,h.at=a_,h.au=__,h.av=function(){const a={},i=Mt.$version;for(const c in Mt.$root){const p=Mt.$root[c];if(p.required){let g=null;g=c==="version"?i:p.type==="array"?[]:{},g!=null&&(a[c]=g)}}return a},h.aw=gm,h.ax=Wr,h.ay=function(a){a=a.slice();const i=Object.create(null);for(let c=0;c$t*ni)}let de=x?"center":c.get("text-justify").evaluate(A,{},a.canonical);const he=c.get("symbol-placement"),ie=he==="point"?c.get("text-max-width").evaluate(A,{},a.canonical)*ni:0,ve=()=>{a.bucket.allowVerticalPlacement&&lu(wt)&&(Z.vertical=zm(et,a.glyphMap,a.glyphPositions,a.imagePositions,D,ie,b,me,"left",Yt,pt,h.ah.vertical,!0,he,U,O))};if(!x&&be){const le=new Set;if(de==="auto")for(let ke=0;keu(void 0,void 0,void 0,function*(){if(a.byteLength===0)return createImageBitmap(new ImageData(1,1));const i=new Blob([new Uint8Array(a)],{type:"image/png"});try{return createImageBitmap(i)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),h.e=ft,h.f=a=>new Promise((i,c)=>{const p=new Image;p.onload=()=>{i(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=ze})},p.onerror=()=>c(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const g=new Blob([new Uint8Array(a)],{type:"image/png"});p.src=a.byteLength?URL.createObjectURL(g):ze}),h.g=un,h.h=(a,i)=>hr(ft(a,{type:"json"}),i),h.i=fe,h.j=ce,h.k=xt,h.l=(a,i)=>hr(ft(a,{type:"arrayBuffer"}),i),h.m=hr,h.n=function(a){return new r_(a).readFields(rT,[])},h.o=Cp,h.p=N1,h.q=ho,h.r=Fy,h.s=er,h.t=ou,h.u=pe,h.v=Mt,h.w=Qt,h.x=wl,h.y=function([a,i,c]){return i+=90,i*=Math.PI/180,c*=Math.PI/180,{x:a*Math.cos(i)*Math.sin(c),y:a*Math.sin(i)*Math.sin(c),z:a*Math.cos(c)}},h.z=Xi}),o("worker",["./shared"],function(h){class u{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,q){for(const it of V){this._layerConfigs[it.id]=it;const vt=this._layers[it.id]=h.az(it);vt._featureFilter=h.a6(vt.filter),this.keyCache[it.id]&&delete this.keyCache[it.id]}for(const it of q)delete this.keyCache[it],delete this._layerConfigs[it],delete this._layers[it];this.familiesBySource={};const X=h.bh(Object.values(this._layerConfigs),this.keyCache);for(const it of X){const vt=it.map(Ut=>this._layers[Ut.id]),Q=vt[0];if(Q.visibility==="none")continue;const bt=Q.source||"";let dt=this.familiesBySource[bt];dt||(dt=this.familiesBySource[bt]={});const It=Q.sourceLayer||"_geojsonTileLayer";let Ot=dt[It];Ot||(Ot=dt[It]=[]),Ot.push(vt)}}}class y{constructor(V){const q={},X=[];for(const bt in V){const dt=V[bt],It=q[bt]={};for(const Ot in dt){const Ut=dt[+Ot];if(!Ut||Ut.bitmap.width===0||Ut.bitmap.height===0)continue;const Ht={x:0,y:0,w:Ut.bitmap.width+2,h:Ut.bitmap.height+2};X.push(Ht),It[Ot]={rect:Ht,metrics:Ut.metrics}}}const{w:it,h:vt}=h.p(X),Q=new h.o({width:it||1,height:vt||1});for(const bt in V){const dt=V[bt];for(const It in dt){const Ot=dt[+It];if(!Ot||Ot.bitmap.width===0||Ot.bitmap.height===0)continue;const Ut=q[bt][It].rect;h.o.copy(Ot.bitmap,Q,{x:0,y:0},{x:Ut.x+1,y:Ut.y+1},Ot.bitmap)}}this.image=Q,this.positions=q}}h.bi("GlyphAtlas",y);class w{constructor(V){this.tileID=new h.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,q,X,it){return h._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new h.a4;const vt=new h.bj(Object.keys(V.layers).sort()),Q=new h.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const bt={},dt={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X},It=q.familiesBySource[this.source];for(const nn in It){const vr=V.layers[nn];if(!vr)continue;vr.version===1&&h.w(`Vector tile source "${this.source}" layer "${nn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const $r=vt.encode(nn),Zi=[];for(let lo=0;lo=gi.maxzoom||gi.visibility!=="none"&&(S(lo,this.zoom,X),(bt[gi.id]=gi.createBucket({index:Q.bucketLayerIDs.length,layers:lo,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$r,sourceID:this.source})).populate(Zi,dt,this.tileID.canonical),Q.bucketLayerIDs.push(lo.map(Ds=>Ds.id)))}}const Ot=h.aE(dt.glyphDependencies,nn=>Object.keys(nn).map(Number));this.inFlightDependencies.forEach(nn=>nn==null?void 0:nn.abort()),this.inFlightDependencies=[];let Ut=Promise.resolve({});if(Object.keys(Ot).length){const nn=new AbortController;this.inFlightDependencies.push(nn),Ut=it.sendAsync({type:"GG",data:{stacks:Ot,source:this.source,tileID:this.tileID,type:"glyphs"}},nn)}const Ht=Object.keys(dt.iconDependencies);let xe=Promise.resolve({});if(Ht.length){const nn=new AbortController;this.inFlightDependencies.push(nn),xe=it.sendAsync({type:"GI",data:{icons:Ht,source:this.source,tileID:this.tileID,type:"icons"}},nn)}const Le=Object.keys(dt.patternDependencies);let Ue=Promise.resolve({});if(Le.length){const nn=new AbortController;this.inFlightDependencies.push(nn),Ue=it.sendAsync({type:"GI",data:{icons:Le,source:this.source,tileID:this.tileID,type:"patterns"}},nn)}const[qe,_n,Vn]=yield Promise.all([Ut,xe,Ue]),nr=new y(qe),Zr=new h.bl(_n,Vn);for(const nn in bt){const vr=bt[nn];vr instanceof h.a5?(S(vr.layers,this.zoom,X),h.bm({bucket:vr,glyphMap:qe,glyphPositions:nr.positions,imageMap:_n,imagePositions:Zr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):vr.hasPattern&&(vr instanceof h.bn||vr instanceof h.bo||vr instanceof h.bp)&&(S(vr.layers,this.zoom,X),vr.addFeatures(dt,this.tileID.canonical,Zr.patternPositions))}return this.status="done",{buckets:Object.values(bt).filter(nn=>!nn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:nr.image,imageAtlas:Zr,glyphMap:this.returnDependencies?qe:null,iconMap:this.returnDependencies?_n:null,glyphPositions:this.returnDependencies?nr.positions:null}})}}function S(ut,V,q){const X=new h.a8(V);for(const it of ut)it.recalculate(X,q)}class C{constructor(V,q,X){this.actor=V,this.layerIndex=q,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,q){return h._(this,void 0,void 0,function*(){const X=yield h.l(V.request,q);try{return{vectorTile:new h.bq.VectorTile(new h.br(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(it){const vt=new Uint8Array(X.data);let Q=`Unable to parse the tile at ${V.request.url}, `;throw Q+=vt[0]===31&&vt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${it.messge}`,new Error(Q)}})}loadTile(V){return h._(this,void 0,void 0,function*(){const q=V.uid,X=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request),it=new w(V);this.loading[q]=it;const vt=new AbortController;it.abort=vt;try{const Q=yield this.loadVectorTile(V,vt);if(delete this.loading[q],!Q)return null;const bt=Q.rawData,dt={};Q.expires&&(dt.expires=Q.expires),Q.cacheControl&&(dt.cacheControl=Q.cacheControl);const It={};if(X){const Ut=X.finish();Ut&&(It.resourceTiming=JSON.parse(JSON.stringify(Ut)))}it.vectorTile=Q.vectorTile;const Ot=it.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[q]=it,this.fetching[q]={rawTileData:bt,cacheControl:dt,resourceTiming:It};try{const Ut=yield Ot;return h.e({rawTileData:bt.slice(0)},Ut,dt,It)}finally{delete this.fetching[q]}}catch(Q){throw delete this.loading[q],it.status="done",this.loaded[q]=it,Q}})}reloadTile(V){return h._(this,void 0,void 0,function*(){const q=V.uid;if(!this.loaded||!this.loaded[q])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const X=this.loaded[q];if(X.showCollisionBoxes=V.showCollisionBoxes,X.status==="parsing"){const it=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor);let vt;if(this.fetching[q]){const{rawTileData:Q,cacheControl:bt,resourceTiming:dt}=this.fetching[q];delete this.fetching[q],vt=h.e({rawTileData:Q.slice(0)},it,bt,dt)}else vt=it;return vt}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return h._(this,void 0,void 0,function*(){const q=this.loading,X=V.uid;q&&q[X]&&q[X].abort&&(q[X].abort.abort(),delete q[X])})}removeTile(V){return h._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class P{constructor(){this.loaded={}}loadTile(V){return h._(this,void 0,void 0,function*(){const{uid:q,encoding:X,rawImageData:it,redFactor:vt,greenFactor:Q,blueFactor:bt,baseShift:dt}=V,It=it.width+2,Ot=it.height+2,Ut=h.b(it)?new h.R({width:It,height:Ot},yield h.bt(it,-1,-1,It,Ot)):it,Ht=new h.bu(q,Ut,X,vt,Q,bt,dt);return this.loaded=this.loaded||{},this.loaded[q]=Ht,Ht})}removeTile(V){const q=this.loaded,X=V.uid;q&&q[X]&&delete q[X]}}function N(ut,V){if(ut.length!==0){R(ut[0],V);for(var q=1;q=Math.abs(bt)?q-dt+bt:bt-dt+q,q=dt}q+X>=0!=!!V&&ut.reverse()}var J=h.bv(function ut(V,q){var X,it=V&&V.type;if(it==="FeatureCollection")for(X=0;X>31}function re(ut,V){for(var q=ut.loadGeometry(),X=ut.type,it=0,vt=0,Q=q.length,bt=0;btut},ze=Math.fround||(We=new Float32Array(1),ut=>(We[0]=+ut,We[0]));var We;const Ve=3,Ce=5,en=6;class An{constructor(V){this.options=Object.assign(Object.create(Re),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:q,minZoom:X,maxZoom:it}=this.options;q&&console.time("total time");const vt=`prepare ${V.length} points`;q&&console.time(vt),this.points=V;const Q=[];for(let dt=0;dt=X;dt--){const It=+Date.now();bt=this.trees[dt]=this._createTree(this._cluster(bt,dt)),q&&console.log("z%d: %d clusters in %dms",dt,bt.numItems,+Date.now()-It)}return q&&console.timeEnd("total time"),this}getClusters(V,q){let X=((V[0]+180)%360+360)%360-180;const it=Math.max(-90,Math.min(90,V[1]));let vt=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)X=-180,vt=180;else if(X>vt){const Ut=this.getClusters([X,it,180,Q],q),Ht=this.getClusters([-180,it,vt,Q],q);return Ut.concat(Ht)}const bt=this.trees[this._limitZoom(q)],dt=bt.range(kn(X),Yn(Q),kn(vt),Yn(it)),It=bt.data,Ot=[];for(const Ut of dt){const Ht=this.stride*Ut;Ot.push(It[Ht+Ce]>1?dn(It,Ht,this.clusterProps):this.points[It[Ht+Ve]])}return Ot}getChildren(V){const q=this._getOriginId(V),X=this._getOriginZoom(V),it="No cluster with the specified id.",vt=this.trees[X];if(!vt)throw new Error(it);const Q=vt.data;if(q*this.stride>=Q.length)throw new Error(it);const bt=this.options.radius/(this.options.extent*Math.pow(2,X-1)),dt=vt.within(Q[q*this.stride],Q[q*this.stride+1],bt),It=[];for(const Ot of dt){const Ut=Ot*this.stride;Q[Ut+4]===V&&It.push(Q[Ut+Ce]>1?dn(Q,Ut,this.clusterProps):this.points[Q[Ut+Ve]])}if(It.length===0)throw new Error(it);return It}getLeaves(V,q,X){const it=[];return this._appendLeaves(it,V,q=q||10,X=X||0,0),it}getTile(V,q,X){const it=this.trees[this._limitZoom(V)],vt=Math.pow(2,V),{extent:Q,radius:bt}=this.options,dt=bt/Q,It=(X-dt)/vt,Ot=(X+1+dt)/vt,Ut={features:[]};return this._addTileFeatures(it.range((q-dt)/vt,It,(q+1+dt)/vt,Ot),it.data,q,X,vt,Ut),q===0&&this._addTileFeatures(it.range(1-dt/vt,It,1,Ot),it.data,vt,X,vt,Ut),q===vt-1&&this._addTileFeatures(it.range(0,It,dt/vt,Ot),it.data,-1,X,vt,Ut),Ut.features.length?Ut:null}getClusterExpansionZoom(V){let q=this._getOriginZoom(V)-1;for(;q<=this.options.maxZoom;){const X=this.getChildren(V);if(q++,X.length!==1)break;V=X[0].properties.cluster_id}return q}_appendLeaves(V,q,X,it,vt){const Q=this.getChildren(q);for(const bt of Q){const dt=bt.properties;if(dt&&dt.cluster?vt+dt.point_count<=it?vt+=dt.point_count:vt=this._appendLeaves(V,dt.cluster_id,X,it,vt):vt1;let Ot,Ut,Ht;if(It)Ot=un(q,dt,this.clusterProps),Ut=q[dt],Ht=q[dt+1];else{const Ue=this.points[q[dt+Ve]];Ot=Ue.properties;const[qe,_n]=Ue.geometry.coordinates;Ut=kn(qe),Ht=Yn(_n)}const xe={type:1,geometry:[[Math.round(this.options.extent*(Ut*vt-X)),Math.round(this.options.extent*(Ht*vt-it))]],tags:Ot};let Le;Le=It||this.options.generateId?q[dt+Ve]:this.points[q[dt+Ve]].id,Le!==void 0&&(xe.id=Le),Q.features.push(xe)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,q){const{radius:X,extent:it,reduce:vt,minPoints:Q}=this.options,bt=X/(it*Math.pow(2,q)),dt=V.data,It=[],Ot=this.stride;for(let Ut=0;Utq&&(qe+=dt[Vn+Ce])}if(qe>Ue&&qe>=Q){let _n,Vn=Ht*Ue,nr=xe*Ue,Zr=-1;const nn=((Ut/Ot|0)<<5)+(q+1)+this.points.length;for(const vr of Le){const $r=vr*Ot;if(dt[$r+2]<=q)continue;dt[$r+2]=q;const Zi=dt[$r+Ce];Vn+=dt[$r]*Zi,nr+=dt[$r+1]*Zi,dt[$r+4]=nn,vt&&(_n||(_n=this._map(dt,Ut,!0),Zr=this.clusterProps.length,this.clusterProps.push(_n)),vt(_n,this._map(dt,$r)))}dt[Ut+4]=nn,It.push(Vn/qe,nr/qe,1/0,nn,-1,qe),vt&&It.push(Zr)}else{for(let _n=0;_n1)for(const _n of Le){const Vn=_n*Ot;if(!(dt[Vn+2]<=q)){dt[Vn+2]=q;for(let nr=0;nr>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,q,X){if(V[q+Ce]>1){const Q=this.clusterProps[V[q+en]];return X?Object.assign({},Q):Q}const it=this.points[V[q+Ve]].properties,vt=this.options.map(it);return X&&vt===it?Object.assign({},vt):vt}}function dn(ut,V,q){return{type:"Feature",id:ut[V+Ve],properties:un(ut,V,q),geometry:{type:"Point",coordinates:[(X=ut[V],360*(X-.5)),Wr(ut[V+1])]}};var X}function un(ut,V,q){const X=ut[V+Ce],it=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,vt=ut[V+en],Q=vt===-1?{}:Object.assign({},q[vt]);return Object.assign(Q,{cluster:!0,cluster_id:ut[V+Ve],point_count:X,point_count_abbreviated:it})}function kn(ut){return ut/360+.5}function Yn(ut){const V=Math.sin(ut*Math.PI/180),q=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return q<0?0:q>1?1:q}function Wr(ut){const V=(180-360*ut)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function hr(ut,V,q,X){for(var it,vt=X,Q=q-V>>1,bt=q-V,dt=ut[V],It=ut[V+1],Ot=ut[q],Ut=ut[q+1],Ht=V+3;Htvt)it=Ht,vt=xe;else if(xe===vt){var Le=Math.abs(Ht-Q);LeX&&(it-V>3&&hr(ut,V,it,X),ut[it+2]=vt,q-it>3&&hr(ut,it,q,X))}function er(ut,V,q,X,it,vt){var Q=it-q,bt=vt-X;if(Q!==0||bt!==0){var dt=((ut-q)*Q+(V-X)*bt)/(Q*Q+bt*bt);dt>1?(q=it,X=vt):dt>0&&(q+=Q*dt,X+=bt*dt)}return(Q=ut-q)*Q+(bt=V-X)*bt}function Kn(ut,V,q,X){var it={id:ut===void 0?null:ut,type:V,geometry:q,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(vt){var Q=vt.geometry,bt=vt.type;if(bt==="Point"||bt==="MultiPoint"||bt==="LineString")nt(vt,Q);else if(bt==="Polygon"||bt==="MultiLineString")for(var dt=0;dt0&&(Q+=X?(it*It-dt*vt)/2:Math.sqrt(Math.pow(dt-it,2)+Math.pow(It-vt,2))),it=dt,vt=It}var Ot=V.length-3;V[2]=1,hr(V,0,Ot,q),V[Ot+2]=1,V.size=Math.abs(Q),V.start=0,V.end=V.size}function Mt(ut,V,q,X){for(var it=0;it1?1:q}function on(ut,V,q,X,it,vt,Q,bt){if(X/=V,vt>=(q/=V)&&Q=X)return null;for(var dt=[],It=0;It=q&&Le=X)){var Ue=[];if(Ht==="Point"||Ht==="MultiPoint")Hn(Ut,Ue,q,X,it);else if(Ht==="LineString")To(Ut,Ue,q,X,it,!1,bt.lineMetrics);else if(Ht==="MultiLineString")ks(Ut,Ue,q,X,it,!1);else if(Ht==="Polygon")ks(Ut,Ue,q,X,it,!0);else if(Ht==="MultiPolygon")for(var qe=0;qe=q&&Q<=X&&(V.push(ut[vt]),V.push(ut[vt+1]),V.push(ut[vt+2]))}}function To(ut,V,q,X,it,vt,Q){for(var bt,dt,It=ls(ut),Ot=it===0?Ii:ml,Ut=ut.start,Ht=0;Htq&&(dt=Ot(It,xe,Le,qe,_n,q),Q&&(It.start=Ut+bt*dt)):Vn>X?nr=q&&(dt=Ot(It,xe,Le,qe,_n,q),Zr=!0),nr>X&&Vn<=X&&(dt=Ot(It,xe,Le,qe,_n,X),Zr=!0),!vt&&Zr&&(Q&&(It.end=Ut+bt*dt),V.push(It),It=ls(ut)),Q&&(Ut+=bt)}var nn=ut.length-3;xe=ut[nn],Le=ut[nn+1],Ue=ut[nn+2],(Vn=it===0?xe:Le)>=q&&Vn<=X&&Ra(It,xe,Le,Ue),nn=It.length-3,vt&&nn>=3&&(It[nn]!==It[0]||It[nn+1]!==It[1])&&Ra(It,It[0],It[1],It[2]),It.length&&V.push(It)}function ls(ut){var V=[];return V.size=ut.size,V.start=ut.start,V.end=ut.end,V}function ks(ut,V,q,X,it,vt){for(var Q=0;QQ.maxX&&(Q.maxX=Ot),Ut>Q.maxY&&(Q.maxY=Ut)}return Q}function Hr(ut,V,q,X){var it=V.geometry,vt=V.type,Q=[];if(vt==="Point"||vt==="MultiPoint")for(var bt=0;bt0&&V.size<(it?Q:X))q.numPoints+=V.length/3;else{for(var bt=[],dt=0;dtQ)&&(q.numSimplified++,bt.push(V[dt]),bt.push(V[dt+1])),q.numPoints++;it&&function(It,Ot){for(var Ut=0,Ht=0,xe=It.length,Le=xe-2;Ht0===Ot)for(Ht=0,xe=It.length;Ht24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var X=function(it,vt){var Q=[];if(it.type==="FeatureCollection")for(var bt=0;bt1&&console.time("creation"),Ht=this.tiles[Ut]=gl(ut,V,q,X,dt),this.tileCoords.push({z:V,x:q,y:X}),It)){It>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,q,X,Ht.numFeatures,Ht.numPoints,Ht.numSimplified),console.timeEnd("creation"));var xe="z"+V;this.stats[xe]=(this.stats[xe]||0)+1,this.total++}if(Ht.source=ut,it){if(V===dt.maxZoom||V===it)continue;var Le=1<1&&console.time("clipping");var Ue,qe,_n,Vn,nr,Zr,nn=.5*dt.buffer/dt.extent,vr=.5-nn,$r=.5+nn,Zi=1+nn;Ue=qe=_n=Vn=null,nr=on(ut,Ot,q-nn,q+$r,0,Ht.minX,Ht.maxX,dt),Zr=on(ut,Ot,q+vr,q+Zi,0,Ht.minX,Ht.maxX,dt),ut=null,nr&&(Ue=on(nr,Ot,X-nn,X+$r,1,Ht.minY,Ht.maxY,dt),qe=on(nr,Ot,X+vr,X+Zi,1,Ht.minY,Ht.maxY,dt),nr=null),Zr&&(_n=on(Zr,Ot,X-nn,X+$r,1,Ht.minY,Ht.maxY,dt),Vn=on(Zr,Ot,X+vr,X+Zi,1,Ht.minY,Ht.maxY,dt),Zr=null),It>1&&console.timeEnd("clipping"),bt.push(Ue||[],V+1,2*q,2*X),bt.push(qe||[],V+1,2*q,2*X+1),bt.push(_n||[],V+1,2*q+1,2*X),bt.push(Vn||[],V+1,2*q+1,2*X+1)}}},Je.prototype.getTile=function(ut,V,q){var X=this.options,it=X.extent,vt=X.debug;if(ut<0||ut>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",ut,V,q);for(var dt,It=ut,Ot=V,Ut=q;!dt&&It>0;)It--,Ot=Math.floor(Ot/2),Ut=Math.floor(Ut/2),dt=this.tiles[Ye(It,Ot,Ut)];return dt&&dt.source?(vt>1&&console.log("found parent tile z%d-%d-%d",It,Ot,Ut),vt>1&&console.time("drilling down"),this.splitTile(dt.source,It,Ot,Ut,ut,V,q),vt>1&&console.timeEnd("drilling down"),this.tiles[bt]?Ho(this.tiles[bt],it):null):null};class ha extends C{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,q){return h._(this,void 0,void 0,function*(){const X=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const it=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!it)return null;const vt=new class{constructor(bt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.W,this.length=bt.length,this._features=bt}feature(bt){return new class{constructor(dt){this._feature=dt,this.extent=h.W,this.type=dt.type,this.properties=dt.tags,"id"in dt&&!isNaN(dt.id)&&(this.id=parseInt(dt.id,10))}loadGeometry(){if(this._feature.type===1){const dt=[];for(const It of this._feature.geometry)dt.push([new h.P(It[0],It[1])]);return dt}{const dt=[];for(const It of this._feature.geometry){const Ot=[];for(const Ut of It)Ot.push(new h.P(Ut[0],Ut[1]));dt.push(Ot)}return dt}}toGeoJSON(dt,It,Ot){return Y.call(this,dt,It,Ot)}}(this._features[bt])}}(it.features);let Q=Wt(vt);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:vt,rawData:Q.buffer}})}loadData(V){return h._(this,void 0,void 0,function*(){var q;(q=this._pendingRequest)===null||q===void 0||q.abort();const X=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request);this._pendingRequest=new AbortController;try{let it=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof it!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(J(it,!0),V.filter){const Q=h.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(dt=>`${dt.key}: ${dt.message}`).join(", "));it={type:"FeatureCollection",features:it.features.filter(dt=>Q.value.evaluate({zoom:0},dt))}}this._geoJSONIndex=V.cluster?new An(function({superclusterOptions:Q,clusterProperties:bt}){if(!bt||!Q)return Q;const dt={},It={},Ot={accumulated:null,zoom:0},Ut={properties:null},Ht=Object.keys(bt);for(const xe of Ht){const[Le,Ue]=bt[xe],qe=h.by(Ue),_n=h.by(typeof Le=="string"?[Le,["accumulated"],["get",xe]]:Le);dt[xe]=qe.value,It[xe]=_n.value}return Q.map=xe=>{Ut.properties=xe;const Le={};for(const Ue of Ht)Le[Ue]=dt[Ue].evaluate(Ot,Ut);return Le},Q.reduce=(xe,Le)=>{Ut.properties=Le;for(const Ue of Ht)Ot.accumulated=xe[Ue],xe[Ue]=It[Ue].evaluate(Ot,Ut)},Q}(V)).load(it.features):function(Q,bt){return new Je(Q,bt)}(it,V.geojsonVtOptions),this.loaded={};const vt={};if(X){const Q=X.finish();Q&&(vt.resourceTiming={},vt.resourceTiming[V.source]=JSON.parse(JSON.stringify(Q)))}return vt}catch(it){if(delete this._pendingRequest,h.bz(it))return{abandoned:!0};throw it}})}reloadTile(V){const q=this.loaded;return q&&q[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,q){return h._(this,void 0,void 0,function*(){const{promoteId:X}=V;if(V.request){const it=yield h.h(V.request,q);return this._dataUpdateable=Zo(it.data,X)?Ze(it.data,X):void 0,it.data}if(typeof V.data=="string")try{const it=JSON.parse(V.data);return this._dataUpdateable=Zo(it,X)?Ze(it,X):void 0,it}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(it,vt,Q){var bt,dt,It,Ot;if(vt.removeAll&&it.clear(),vt.remove)for(const Ut of vt.remove)it.delete(Ut);if(vt.add)for(const Ut of vt.add){const Ht=Lr(Ut,Q);Ht!=null&&it.set(Ht,Ut)}if(vt.update)for(const Ut of vt.update){let Ht=it.get(Ut.id);if(Ht==null)continue;const xe=!Ut.removeAllProperties&&(((bt=Ut.removeProperties)===null||bt===void 0?void 0:bt.length)>0||((dt=Ut.addOrUpdateProperties)===null||dt===void 0?void 0:dt.length)>0);if((Ut.newGeometry||Ut.removeAllProperties||xe)&&(Ht=Object.assign({},Ht),it.set(Ut.id,Ht),xe&&(Ht.properties=Object.assign({},Ht.properties))),Ut.newGeometry&&(Ht.geometry=Ut.newGeometry),Ut.removeAllProperties)Ht.properties={};else if(((It=Ut.removeProperties)===null||It===void 0?void 0:It.length)>0)for(const Le of Ut.removeProperties)Object.prototype.hasOwnProperty.call(Ht.properties,Le)&&delete Ht.properties[Le];if(((Ot=Ut.addOrUpdateProperties)===null||Ot===void 0?void 0:Ot.length)>0)for(const{key:Le,value:Ue}of Ut.addOrUpdateProperties)Ht.properties[Le]=Ue}}(this._dataUpdateable,V.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return h._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class Dr{constructor(V){this.self=V,this.actor=new h.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(q,X)=>{if(this.externalWorkerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.externalWorkerSourceTypes[q]=X},this.self.addProtocol=h.bf,this.self.removeProtocol=h.bg,this.self.registerRTLTextPlugin=q=>{if(h.bA.isParsed())throw new Error("RTL text plugin already registered.");h.bA.setMethods(q)},this.actor.registerMessageHandler("LDT",(q,X)=>this._getDEMWorkerSource(q,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",(q,X)=>h._(this,void 0,void 0,function*(){this._getDEMWorkerSource(q,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",(q,X)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",(q,X)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",(q,X)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",(q,X)=>this._getWorkerSource(q,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("LT",(q,X)=>this._getWorkerSource(q,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",(q,X)=>this._getWorkerSource(q,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",(q,X)=>this._getWorkerSource(q,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",(q,X)=>this._getWorkerSource(q,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",(q,X)=>h._(this,void 0,void 0,function*(){if(!this.workerSources[q]||!this.workerSources[q][X.type]||!this.workerSources[q][X.type][X.source])return;const it=this.workerSources[q][X.type][X.source];delete this.workerSources[q][X.type][X.source],it.removeSource!==void 0&&it.removeSource(X)})),this.actor.registerMessageHandler("RM",q=>h._(this,void 0,void 0,function*(){delete this.layerIndexes[q],delete this.availableImages[q],delete this.workerSources[q],delete this.demWorkerSources[q]})),this.actor.registerMessageHandler("SR",(q,X)=>h._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",(q,X)=>this._syncRTLPluginState(q,X)),this.actor.registerMessageHandler("IS",(q,X)=>h._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",(q,X)=>this._setImages(q,X)),this.actor.registerMessageHandler("UL",(q,X)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(q).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",(q,X)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(q).replace(X)}))}_setImages(V,q){return h._(this,void 0,void 0,function*(){this.availableImages[V]=q;for(const X in this.workerSources[V]){const it=this.workerSources[V][X];for(const vt in it)it[vt].availableImages=q}})}_syncRTLPluginState(V,q){return h._(this,void 0,void 0,function*(){if(h.bA.isParsed())return h.bA.getState();if(q.pluginStatus!=="loading")return h.bA.setState(q),q;const X=q.pluginURL;if(this.self.importScripts(X),h.bA.isParsed()){const it={pluginStatus:"loaded",pluginURL:X};return h.bA.setState(it),it}throw h.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${X}`)})}_getAvailableImages(V){let q=this.availableImages[V];return q||(q=[]),q}_getLayerIndex(V){let q=this.layerIndexes[V];return q||(q=this.layerIndexes[V]=new u),q}_getWorkerSource(V,q,X){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][q]||(this.workerSources[V][q]={}),!this.workerSources[V][q][X]){const it={sendAsync:(vt,Q)=>(vt.targetMapId=V,this.actor.sendAsync(vt,Q))};switch(q){case"vector":this.workerSources[V][q][X]=new C(it,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][q][X]=new ha(it,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][q][X]=new this.externalWorkerSourceTypes[q](it,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][q][X]}_getDEMWorkerSource(V,q){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][q]||(this.demWorkerSources[V][q]=new P),this.demWorkerSources[V][q]}}return h.i(self)&&(self.worker=new Dr(self)),Dr}),o("index",["exports","./shared"],function(h,u){var y="4.1.3";let w,S;const C={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const m=f.boundingClientRect;return new u.P((d.clientX-m.left)/f.x-s.clientLeft,(d.clientY-m.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],m=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,m={}},_.addThrottleControl=M=>{const k=d++;return m[k]=M,k},_.removeThrottleControl=M=>{delete m[M],I()},_.getImage=(M,k,z=!0)=>new Promise((F,W)=>{N.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:k,requestParameters:M,supportImageRefresh:z,state:"queued",onError:st=>{W(st)},onSuccess:st=>{F(st)}}),I()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:k,supportImageRefresh:z,onError:F,onSuccess:W,abortController:st}=M,ot=z===!1&&!u.i(self)&&!u.g(k.url)&&(!k.headers||Object.keys(k.headers).reduce((_t,kt)=>_t&&kt==="accept",!0));f++;const ct=ot?T(k,st):u.m(k,st);try{const _t=yield ct;delete M.abortController,M.state="completed",_t.data instanceof HTMLImageElement||u.b(_t.data)?W(_t):_t.data&&W({data:yield(tt=_t.data,typeof createImageBitmap=="function"?u.d(tt):u.f(tt)),cacheControl:_t.cacheControl,expires:_t.expires})}catch(_t){delete M.abortController,F(_t)}finally{f--,I()}var tt}),I=()=>{const M=(()=>{for(const k of Object.keys(m))if(m[k]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let k=f;k0;k++){const z=s.shift();z.abortController.signal.aborted?k--:v(z)}},T=(M,k)=>new Promise((z,F)=>{const W=new Image,st=M.url,ot=M.credentials;ot&&ot==="include"?W.crossOrigin="use-credentials":(ot&&ot==="same-origin"||!u.s(st))&&(W.crossOrigin="anonymous"),k.signal.addEventListener("abort",()=>{W.src="",F(u.c())}),W.fetchPriority="high",W.onload=()=>{W.onerror=W.onload=null,z({data:W})},W.onerror=()=>{W.onerror=W.onload=null,k.signal.aborted||F(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."))},W.src=st})}(G||(G={})),G.resetRequestQueue();class H{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const m=function(v){const I=v.match(at);if(!I)throw new Error(`Unable to parse URL "${v}"`);return{protocol:I[1],authority:I[2],path:I[3]||"/",params:I[4]?I[4].split("&"):[]}}(s);return m.path+=`${f}${d}`,function(v){const I=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${I}`}(m)}setTransformRequest(s){this._transformRequestFn=s}}const at=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function gt(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var ft,rt=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};ft=new u.A(3),u.A!=Float32Array&&(ft[0]=0,ft[1]=0,ft[2]=0);var mt=function(_){var s=_[0],f=_[1];return s*s+f*f};function Et(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:m}of _){const v=`${d}${m}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:m}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class ${constructor(s,f,d,m){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,m)}update(s,f,d){const{width:m,height:v}=s,I=!(this.size&&this.size[0]===m&&this.size[1]===v||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),I)this.size=[m,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,m,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:z}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,z,m,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),d!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,d||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.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:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function Pt(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Qt extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const m=f.data||f.spriteData;return this._validateStretch(f.stretchX,m&&m.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,m&&m.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const m of s){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(m=!1);this.isLoaded()||m?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let m=this.getImage(d);m||(this.fire(new u.k("styleimagemissing",{id:d})),m=this.getImage(d)),m?f[d]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:u.w(`Image "${d}" 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:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const m={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.I(m,d);this.patterns[s]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new $(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),m=this.atlasImage;m.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:I}=this.patterns[v],T=I.x+1,M=I.y+1,k=this.getImage(v).data,z=k.width,F=k.height;u.R.copy(k,m,{x:0,y:0},{x:T,y:M},{width:z,height:F}),u.R.copy(k,m,{x:0,y:F-1},{x:T,y:M-1},{width:z,height:1}),u.R.copy(k,m,{x:0,y:0},{x:T,y:M+F},{width:z,height:1}),u.R.copy(k,m,{x:z-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(k,m,{x:0,y:0},{x:T+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),Pt(d)&&this.updateImage(f,d)}}}const Tt=1e20;function re(_,s,f,d,m,v,I,T,M){for(let k=s;k-1);M++,v[M]=T,I[M]=k,I[M+1]=Tt}for(let T=0,M=0;T65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const T=Wt.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const I=yield d.requests[v];for(const T in I)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=I[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:I[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new Wt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:T})}const I=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:I.width||60,height:I.height||60},I.data),metrics:{width:I.glyphWidth/2||24,height:I.glyphHeight/2||24,left:I.glyphLeft/2+.5||0,top:I.glyphTop/2-27.5||-8,advance:I.glyphAdvance/2||24,isDoubleResolution:!0}}}}Wt.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const m=256*s,v=m+255,I=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${m}-${v}`),"Glyphs"),T=yield u.l(I,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${v}`);const M={};for(const k of u.n(T.data))M[k.id]=k;return M})},Wt.TinySDF=class{constructor({fontSize:_=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:I="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const T=this.size=_+4*s,M=this._createCanvas(T),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${I} ${v} ${_}px ${m}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(_),I=Math.ceil(f),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),M=Math.min(this.size-this.buffer,I+Math.ceil(d)),k=T+2*this.buffer,z=M+2*this.buffer,F=Math.max(k*z,0),W=new Uint8ClampedArray(F),st={data:W,width:k,height:z,glyphWidth:T,glyphHeight:M,glyphTop:I,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return st;const{ctx:ot,buffer:ct,gridInner:tt,gridOuter:_t}=this;ot.clearRect(ct,ct,T,M),ot.fillText(_,ct,ct+I);const kt=ot.getImageData(ct,ct,T,M);_t.fill(Tt,0,F),tt.fill(0,0,F);for(let ht=0;ht0?Gt*Gt:0,tt[Ft]=Gt<0?Gt*Gt:0}}re(_t,0,0,k,z,k,this.f,this.v,this.z),re(tt,ct,ct,T,M,k,this.f,this.v,this.z);for(let ht=0;ht1&&(M=s[++T]);const z=Math.abs(k-M.left),F=Math.abs(k-M.right),W=Math.min(z,F);let st;const ot=v/d*(m+1);if(M.isDash){const ct=m-Math.abs(ot);st=Math.sqrt(W*W+ct*ct)}else st=m-Math.sqrt(W*W+ot*ot);this.data[I+k]=Math.max(0,Math.min(255,st+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],k=s[T+1];M.zeroLength?s.splice(T,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const m=this.width*this.nextRow;let v=0,I=s[v];for(let T=0;T1&&(I=s[++v]);const M=Math.abs(T-I.left),k=Math.abs(T-I.right),z=Math.min(M,k);this.data[m+T]=Math.max(0,Math.min(255,(I.isDash?z:-z)+128))}}addDash(s,f){const d=f?7:0,m=2*d+1;if(this.nextRow+m>this.height)return u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ce]}numActive(){return Object.keys(this.active).length}}const An=Math.floor(C.hardwareConcurrency/2);let dn,un;function kn(){return dn||(dn=new en),dn}en.workerCount=u.B(globalThis)?Math.max(Math.min(An,3),1):1;class Yn{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let m=0;m{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function Wr(){return un||(un=new Yn(kn(),u.G),un.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),un}function hr(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function er(_,s,f,d,m,v){const I=function(F,W,st){if(F)for(const ot of F){const ct=W[ot];if(ct&&ct.source===st&&ct.type==="fill-extrusion")return!0}else for(const ot in W){const ct=W[ot];if(ct.source===st&&ct.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,I);M.sort(Kn);const k=[];for(const F of M)k.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,v,T,hr(_.transform,F.tileID))});const z=function(F){const W={},st={};for(const ot of F){const ct=ot.queryResults,tt=ot.wrappedTileID,_t=st[tt]=st[tt]||{};for(const kt in ct){const ht=ct[kt],St=_t[kt]=_t[kt]||{},Rt=W[kt]=W[kt]||[];for(const Ft of ht)St[Ft.featureIndex]||(St[Ft.featureIndex]=!0,Rt.push(Ft))}}return W}(k);for(const F in z)z[F].forEach(W=>{const st=W.feature,ot=_.getFeatureState(st.layer["source-layer"],st.id);st.source=st.layer.source,st.layer["source-layer"]&&(st.sourceLayer=st.layer["source-layer"]),st.state=ot});return z}function Kn(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function nt(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield C.frameAsync(f),!d)return null;const m=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(m.vectorLayerIds=d.vector_layers.map(v=>v.id)),m})}class xt{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let m,v;if(s instanceof u.M)m=s,v=s;else{if(!(s instanceof xt))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(xt.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(m=s._sw,v=s._ne,!m||!v)return this}return f||d?(f.lng=Math.min(m.lng,f.lng),f.lat=Math.min(m.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new u.M(m.lng,m.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.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 u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.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(s){const{lng:f,lat:d}=u.M.convert(s);let m=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&m}static convert(s){return s instanceof xt?s:s&&new xt(s)}static fromLngLat(s,f=0){const d=360*f/40075017,m=d/Math.cos(Math.PI/180*s.lat);return new xt(new u.M(s.lng-m,s.lat-d),new u.M(s.lng+m,s.lat+d))}}class ce{constructor(s,f,d){this.bounds=xt.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),m=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),I=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=m&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,I)=>{s.reloadPromise={resolve:v,reject:I}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:m,data:d},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const d=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(d.resolve).catch(d.reject)}}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Mt extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield nt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new ce(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield G.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&s.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const m=this.map.painter.context,v=m.gl,I=d.data;s.texture=this.map.painter.getTileTexture(I.width),s.texture?s.texture.update(I,{useMipmap:!0}):(s.texture=new $(m,I,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(d){if(delete s.abortController,s.aborted)s.state="unloaded";else if(d)throw s.state="errored",d}})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class He extends Mt{constructor(s,f,d,m){super(s,f,d,m),this.type="raster-dem",this.maxzoom=22,this._options=u.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(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield G.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const I=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:I,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return C.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),m=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,I=(f.x+1+d)%d,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,m,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,I,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,m,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,I,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:m}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const m=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,f==="RT")})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.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 u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var on=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Hn extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=f}load(s){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.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,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(m){let v=1/0,I=1/0,T=-1/0,M=-1/0;for(const W of m)v=Math.min(v,W.x),I=Math.min(I,W.y),T=Math.max(T,W.x),M=Math.max(M,W.y);const k=Math.max(T-v,M-I),z=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),F=Math.pow(2,z);return new u.a0(z,Math.floor((v+T)/2*F),Math.floor((I+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new $(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class To extends Hn{constructor(s,f,d,m){super(s,f,d,m),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.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 u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.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=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,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 s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.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 $(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.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 ls extends Hn{constructor(s,f,d,m){super(s,f,d,m),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(I=>typeof I!="number"))||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(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 u.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(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new $(f,this.canvas,d.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const I=this.tiles[v];I.state!=="loaded"&&(I.state="loaded",I.texture=this.texture,m=!0)}m&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const ks={},Ra=_=>{switch(_){case"geojson":return Tr;case"image":return Hn;case"raster":return Mt;case"raster-dem":return He;case"vector":return mn;case"video":return To;case"canvas":return ls}return ks[_]},Ii="RTLPluginLoaded";class ml extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Wr()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=C.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Ii))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let us=null;function te(){return us||(us=new ml),us}class Ho{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.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(s){const f=s+this.timeAdded;fv.getLayer(k)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(k=>M.filter(z=>z.id===k)[0]));for(const k of M)I[k.id]=T}}return I}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5&&v.hasRTLText){this.hasRTLText=!0,te().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(m).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const m=this.buckets[d];m.uploadPending()&&m.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new $(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new $(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,d,m,v,I,T,M,k,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:I,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:T,queryPadding:this.queryPadding*k},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const m=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",I=m._geojsonTileLayer||m[v];if(!I)return;const T=u.a6(f&&f.filter),{z:M,x:k,y:z}=this.tileID.canonical,F={z:M,x:k,y:z};for(let W=0;Wd)m=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const d=s.wrapped().key,m=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][m];return this.data[d].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const d in this.data)for(const m of this.data[d])s(m.value)||f.push(m);for(const d of f)this.remove(d.value.tileID,d)}}class gl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const m=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},u.e(this.stateChanges[s][m],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==m&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const v in this.state[s][m])d[v]||(this.deletedStates[s][m][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][v]===null&&delete this.deletedStates[s][m][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const m=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(d in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][d]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),m=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const I in v)delete m[I]}return m}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const I in this.stateChanges[m])this.state[m][I]||(this.state[m][I]={}),u.e(this.state[m][I],this.stateChanges[m][I]),v[I]=this.state[m][I];d[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const I in this.state[m])v[I]={},this.state[m][I]={};else for(const I in this.deletedStates[m]){if(this.deletedStates[m][I]===null)this.state[m][I]={};else for(const T of Object.keys(this.deletedStates[m][I]))delete this.state[m][I][T];v[I]=this.state[m][I]}d[m]=d[m]||{},u.e(d[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const m in s)s[m].setFeatureState(d,f)}}class Hr extends u.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,I,T)=>{const M=new(Ra(v.type))(m,v,I,T);if(M.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new Hi(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new gl,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];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 s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(m){s.state="errored",m.status!==404?this._source.fire(new u.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new u.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(oe).map(s=>s.key)}getRenderableIds(s){const f=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&f.push(this._tiles[d]);return s?f.sort((d,m)=>{const v=d.tileID,I=m.tileID,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-I.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(oe).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=C.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new u.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let m=0;m1||(Math.abs(I)>1&&(Math.abs(I+M)===1?I+=M:Math.abs(I-M)===1&&(I-=M)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,I,T),m.neighboringTiles&&m.neighboringTiles[k]&&(m.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,m){for(const v in this._tiles){let I=this._tiles[v];if(m[v]||!I.hasData()||I.tileID.overscaledZ<=f||I.tileID.overscaledZ>d)continue;let T=I.tileID;for(;I&&I.tileID.overscaledZ>f+1;){const k=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[k.key],I&&I.hasData()&&(T=k)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){m[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const m=s.scaledTo(d),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const d={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let d;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new u.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(d=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(d=d.filter(z=>this._source.hasTile(z)))):d=[];const m=s.coveringZoomLevel(this._source),v=Math.max(m-Hr.maxOverzooming,this._source.minzoom),I=Math.max(m+Hr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of d)if(F.canonical.z>this._source.minzoom){const W=F.scaledTo(F.canonical.z-1);z[W.key]=W;const st=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[st.key]=st}d=d.concat(Object.values(z))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,m);if(Je(this._source.type)){const z={},F={},W=Object.keys(M),st=C.now();for(const ot of W){const ct=M[ot],tt=this._tiles[ot];if(!tt||tt.fadeEndTime!==0&&tt.fadeEndTime<=st)continue;const _t=this.findLoadedParent(ct,v);_t&&(this._addTile(_t.tileID),z[_t.tileID.key]=_t.tileID),F[ot]=ct}this._retainLoadedChildren(F,m,I,M);for(const ot in z)M[ot]||(this._coveredTiles[ot]=!0,M[ot]=z[ot]);if(f){const ot={},ct={};for(const tt of d)this._tiles[tt.key].hasData()?ot[tt.key]=tt:ct[tt.key]=tt;for(const tt in ct){const _t=ct[tt].children(this._source.maxzoom);this._tiles[_t[0].key]&&this._tiles[_t[1].key]&&this._tiles[_t[2].key]&&this._tiles[_t[3].key]&&(ot[_t[0].key]=M[_t[0].key]=_t[0],ot[_t[1].key]=M[_t[1].key]=_t[1],ot[_t[2].key]=M[_t[2].key]=_t[2],ot[_t[3].key]=M[_t[3].key]=_t[3],delete ct[tt])}for(const tt in ct){const _t=this.findLoadedParent(ct[tt],this._source.minzoom);if(_t){ot[_t.tileID.key]=M[_t.tileID.key]=_t.tileID;for(const kt in ot)ot[kt].isChildOf(_t.tileID)&&delete ot[kt]}}for(const tt in this._tiles)ot[tt]||(this._coveredTiles[tt]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const k=u.ab(this._tiles,M);for(const z of k){const F=this._tiles[z];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const d={},m={},v=Math.max(f-Hr.maxOverzooming,this._source.minzoom),I=Math.max(f+Hr.maxUnderzooming,this._source.minzoom),T={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],W=this.getTile(F);if(W&&W.hasData()){d[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(d[F[0].key]&&d[F[1].key]&&d[F[2].key]&&d[F[3].key])continue}let z=k.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const W=M.scaledTo(F);if(m[W.key])break;if(m[W.key]=!0,k=this.getTile(W),!k&&z&&(k=this._addTile(W)),k){const st=k.hasData();if((z||st)&&(d[W.key]=W),z=k.wasRequested(),st)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){d=this._loadedParentTiles[m.key];break}f.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;m=v}for(const v of f)this._loadedParentTiles[v]=d}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const d=f;return f||(f=new Ho(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),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(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.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 s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const m=[],v=this.transform;if(!v)return m;const I=d?v.getCameraQueryGeometry(s):s,T=s.map(ot=>v.pointCoordinate(ot,this.terrain)),M=I.map(ot=>v.pointCoordinate(ot,this.terrain)),k=this.getIds();let z=1/0,F=1/0,W=-1/0,st=-1/0;for(const ot of M)z=Math.min(z,ot.x),F=Math.min(F,ot.y),W=Math.max(W,ot.x),st=Math.max(st,ot.y);for(let ot=0;ot=0&&ht[1].y+kt>=0){const St=T.map(Ft=>tt.getTilePoint(Ft)),Rt=M.map(Ft=>tt.getTilePoint(Ft));m.push({tile:ct,tileID:tt,queryGeometry:St,cameraQueryGeometry:Rt,scale:_t})}}return m}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of f)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(Je(this._source.type)){const s=C.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,d){this._state.updateState(s=s||"_geojsonTileLayer",f,d)}removeFeatureState(s,f,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,d)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,d){const m=this._tiles[s];m&&m.setDependencies(f,d)}reloadTilesForDependencies(s,f){for(const d in this._tiles)this._tiles[d].hasDependency(s,f)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,f))}}function oe(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function Je(_){return _==="raster"||_==="image"||_==="video"}Hr.maxOverzooming=10,Hr.maxUnderzooming=3;class Ye{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(m-I)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Lr(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Zo{constructor(s,f,d){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let I=0;Ithis.width||m<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=m){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:m}];for(let k=0;k0}hitTestCircle(s,f,d,m,v){const I=s-d,T=s+d,M=f-d,k=f+d;if(T<0||I>this.width||k<0||M>this.height)return!1;const z=[];return this._forEachCell(I,M,T,k,this._queryCellCircle,z,{hitTest:!0,overlapMode:m,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,d,m,v,I,T,M){const{seenUids:k,hitTest:z,overlapMode:F}=T,W=this.boxCells[v];if(W!==null){const ot=this.bboxes;for(const ct of W)if(!k.box[ct]){k.box[ct]=!0;const tt=4*ct,_t=this.boxKeys[ct];if(s<=ot[tt+2]&&f<=ot[tt+3]&&d>=ot[tt+0]&&m>=ot[tt+1]&&(!M||M(_t))&&(!z||!Lr(F,_t.overlapMode))&&(I.push({key:_t,x1:ot[tt],y1:ot[tt+1],x2:ot[tt+2],y2:ot[tt+3]}),z))return!0}}const st=this.circleCells[v];if(st!==null){const ot=this.circles;for(const ct of st)if(!k.circle[ct]){k.circle[ct]=!0;const tt=3*ct,_t=this.circleKeys[ct];if(this._circleAndRectCollide(ot[tt],ot[tt+1],ot[tt+2],s,f,d,m)&&(!M||M(_t))&&(!z||!Lr(F,_t.overlapMode))){const kt=ot[tt],ht=ot[tt+1],St=ot[tt+2];if(I.push({key:_t,x1:kt-St,y1:ht-St,x2:kt+St,y2:ht+St}),z)return!0}}}return!1}_queryCellCircle(s,f,d,m,v,I,T,M){const{circle:k,seenUids:z,overlapMode:F}=T,W=this.boxCells[v];if(W!==null){const ot=this.bboxes;for(const ct of W)if(!z.box[ct]){z.box[ct]=!0;const tt=4*ct,_t=this.boxKeys[ct];if(this._circleAndRectCollide(k.x,k.y,k.radius,ot[tt+0],ot[tt+1],ot[tt+2],ot[tt+3])&&(!M||M(_t))&&!Lr(F,_t.overlapMode))return I.push(!0),!0}}const st=this.circleCells[v];if(st!==null){const ot=this.circles;for(const ct of st)if(!z.circle[ct]){z.circle[ct]=!0;const tt=3*ct,_t=this.circleKeys[ct];if(this._circlesCollide(ot[tt],ot[tt+1],ot[tt+2],k.x,k.y,k.radius)&&(!M||M(_t))&&!Lr(F,_t.overlapMode))return I.push(!0),!0}}}_forEachCell(s,f,d,m,v,I,T,M){const k=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),W=this._convertToYCellCoord(m);for(let st=k;st<=F;st++)for(let ot=z;ot<=W;ot++)if(v.call(this,s,f,d,m,this.xCellCount*ot+st,I,T,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,d,m,v,I){const T=m-s,M=v-f,k=d+I;return k*k>T*T+M*M}_circleAndRectCollide(s,f,d,m,v,I,T){const M=(I-m)/2,k=Math.abs(s-(m+M));if(k>M+d)return!1;const z=(T-v)/2,F=Math.abs(f-(v+z));if(F>z+d)return!1;if(k<=M||F<=z)return!0;const W=k-M,st=F-z;return W*W+st*st<=d*d}}function Ze(_,s,f,d,m){const v=u.F();return s?(u.J(v,v,[1/m,1/m,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ha(_,s,f,d,m){if(s){const v=u.ae(_);return u.J(v,v,[m,m,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Dr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],xe(d,d,s));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m}}function ut(_,s){return .5+_/s*.5}function V(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function q(_,s,f,d,m,v,I,T,M,k){const z=d?_.textSizeData:_.iconSizeData,F=u.ag(z,f.transform.zoom),W=[256/f.width*2+1,256/f.height*2+1],st=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;st.clear();const ot=_.lineVertexArray,ct=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,tt=f.transform.width/f.transform.height;let _t=!1;for(let kt=0;ktMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function vt(_,s,f,d,m,v,I,T,M,k,z,F,W,st,ot,ct){const tt=s/24,_t=_.lineOffsetX*tt,kt=_.lineOffsetY*tt;let ht;if(_.numGlyphs>1){const St=_.glyphStartIndex+_.numGlyphs,Rt=_.lineStartIndex,Ft=_.lineStartIndex+_.lineLength,Gt=X(tt,T,_t,kt,f,z,F,_,M,v,W,ot,ct);if(!Gt)return{notEnoughRoom:!0};const Jt=Dr(Gt.first.point,I,ct).point,Kt=Dr(Gt.last.point,I,ct).point;if(d&&!f){const ne=it(_.writingMode,Jt,Kt,st);if(ne)return ne}ht=[Gt.first];for(let ne=_.glyphStartIndex+1;ne0?Jt.point:Q(F,Gt,Rt,1,m,ct),ne=it(_.writingMode,Rt,Kt,st);if(ne)return ne}const St=Ot(tt*T.getoffsetX(_.glyphStartIndex),_t,kt,f,z,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,W,ot,ct);if(!St)return{notEnoughRoom:!0};ht=[St]}for(const St of ht)u.aj(k,St.point,St.angle);return{}}function Q(_,s,f,d,m,v){const I=Dr(_.add(_.sub(s)._unit()),m,v).point,T=f.sub(I);return f.add(T._mult(d/T.mag()))}function bt(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:I,getElevation:T,previousVertex:M,direction:k,absOffsetX:z}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),W=Dr(F,m,T);if(W.signedDistanceFromCamera>0)return f.projections[_]=W.point,W.point;const st=_-k;return Q(I===0?v:new u.P(d.getx(st),d.gety(st)),F,M,z-I+1,m,T)}function dt(_,s,f){return _._unit()._perp()._mult(s*f)}function It(_,s,f,d,m,v,I,T){const{projectionCache:M,direction:k}=T;if(M.offsets[_])return M.offsets[_];const z=f.add(s);if(_+k=m)return M.offsets[_]=z,z;const F=bt(_+k,T),W=dt(F.sub(f),I,k),st=f.add(W),ot=F.add(W);return M.offsets[_]=u.ak(v,z,st,ot)||z,M.offsets[_]}function Ot(_,s,f,d,m,v,I,T,M,k,z,F,W,st){const ot=d?_-s:_+s;let ct=ot>0?1:-1,tt=0;d&&(ct*=-1,tt=Math.PI),ct<0&&(tt+=Math.PI);let _t,kt,ht=ct>0?T+I:T+I+1,St=m,Rt=m,Ft=0,Gt=0;const Jt=Math.abs(ot),Kt=[];let ne;for(;Ft+Gt<=Jt;){if(ht+=ct,ht=M)return null;Ft+=Gt,Rt=St,kt=_t;const ae={projectionCache:F,lineVertexArray:k,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:Ft,getElevation:st,previousVertex:Rt,direction:ct,absOffsetX:Jt};if(St=bt(ht,ae),f===0)Kt.push(Rt),ne=St.sub(Rt);else{let Ne;const $e=St.sub(Rt);Ne=$e.mag()===0?dt(bt(ht+ct,ae).sub(St),f,ct):dt($e,f,ct),kt||(kt=Rt.add(Ne)),_t=It(ht,Ne,St,T,M,kt,f,ae),Kt.push(kt),ne=_t.sub(kt)}Gt=ne.mag()}const se=ne._mult((Jt-Ft)/Gt)._add(kt||Rt),Qe=tt+Math.atan2(St.y-Rt.y,St.x-Rt.x);return Kt.push(se),{point:se,angle:W?Qe:0,path:Kt}}const Ut=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ht(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(Ut,3*d)}}function xe(_,s,f){const d=s[0],m=s[1];return _[0]=f[0]*d+f[4]*m+f[12],_[1]=f[1]*d+f[5]*m+f[13],_[3]=f[3]*d+f[7]*m+f[15],_}const Le=100;class Ue{constructor(s,f=new Zo(s.width+200,s.height+200,25),d=new Zo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Le,this.screenBottomBoundary=s.height+Le,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,m,v,I){const T=this.projectAndGetPerspectiveRatio(m,s.anchorPointX,s.anchorPointY,I),M=d*T.perspectiveRatio,k=s.x1*M+T.point.x,z=s.y1*M+T.point.y,F=s.x2*M+T.point.x,W=s.y2*M+T.point.y;return!this.isInsideGrid(k,z,F,W)||f!=="always"&&this.grid.hitTest(k,z,F,W,f,v)||T.perspectiveRatio=1;rn--)$e.push(ae.path[rn]);for(let rn=1;rnDr(ln,M,ot));$e=rn.some(ln=>ln.signedDistanceFromCamera<=0)?[]:rn.map(ln=>ln.point)}let Be=[];if($e.length>0){const rn=$e[0].clone(),ln=$e[0].clone();for(let wr=1;wr<$e.length;wr++)rn.x=Math.min(rn.x,$e[wr].x),rn.y=Math.min(rn.y,$e[wr].y),ln.x=Math.max(ln.x,$e[wr].x),ln.y=Math.max(ln.y,$e[wr].y);Be=rn.x>=ne.x&&ln.x<=se.x&&rn.y>=ne.y&&ln.y<=se.y?[$e]:ln.xse.x||ln.yse.y?[]:u.al([$e],ne.x,ne.y,se.x,se.y)}for(const rn of Be){Qe.reset(rn,.25*Kt);let ln=0;ln=Qe.length<=.5*Kt?1:Math.ceil(Qe.paddedLength/bn)+1;for(let wr=0;wr=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(s,f,d,m){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function $r(_,s,f,d,m){const{horizontalAlign:v,verticalAlign:I}=u.at(_);return new u.P(-(v-.5)*s+d[0]*m,-(I-.5)*f+d[1]*m)}function Zi(_,s,f,d,m,v){const{x1:I,x2:T,y1:M,y2:k,anchorPointX:z,anchorPointY:F}=_,W=new u.P(s,f);return d&&W._rotate(m?v:-v),{x1:I+W.x,y1:M+W.y,x2:T+W.x,y2:k+W.y,anchorPointX:z,anchorPointY:F}}class lo{constructor(s,f,d,m,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Ue(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new vr(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,m){const v=d.getBucket(f),I=d.latestFeatureIndex;if(!v||!I||f.id!==v.layerIds[0])return;const T=d.collisionBoxArray,M=v.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),z=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),W=M.get("text-pitch-alignment")==="map",st=M.get("text-rotation-alignment")==="map",ot=qe(d,1,this.transform.zoom),ct=Ze(F,W,st,this.transform,ot);let tt=null;if(W){const kt=ha(F,W,st,this.transform,ot);tt=u.K([],this.transform.labelPlaneMatrix,kt)}this.retainedQueryData[v.bucketInstanceId]=new nn(v.bucketInstanceId,I,v.sourceLayerIndex,v.index,d.tileID);const _t={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:ct,labelToScreenMatrix:tt,scale:k,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const kt of v.sortKeyRanges){const{sortKey:ht,symbolInstanceStart:St,symbolInstanceEnd:Rt}=kt;s.push({sortKey:ht,symbolInstanceStart:St,symbolInstanceEnd:Rt,parameters:_t})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:_t})}attemptAnchorPlacement(s,f,d,m,v,I,T,M,k,z,F,W,st,ot,ct,tt){const _t=u.ap[s.textAnchor],kt=[s.textOffset0,s.textOffset1],ht=$r(_t,d,m,kt,v),St=this.collisionIndex.placeCollisionBox(Zi(f,ht.x,ht.y,I,T,this.transform.angle),F,M,k,z.predicate,tt);if((!ct||this.collisionIndex.placeCollisionBox(Zi(ct,ht.x,ht.y,I,T,this.transform.angle),F,M,k,z.predicate,tt).box.length!==0)&&St.box.length>0){let Rt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID].text&&(Rt=this.prevPlacement.variableOffsets[W.crossTileID].anchor),W.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[W.crossTileID]={textOffset:kt,width:d,height:m,anchor:_t,textBoxScale:v,prevAnchor:Rt},this.markUsedJustification(st,_t,W,ot),st.allowVerticalPlacement&&(this.markUsedOrientation(st,ot,W),this.placedOrientations[W.crossTileID]=ot),{shift:ht,placedGlyphBoxes:St}}}placeLayerBucketPart(s,f,d){const{bucket:m,layout:v,posMatrix:I,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:W,collisionGroup:st}=s.parameters,ot=v.get("text-optional"),ct=v.get("icon-optional"),tt=u.aq(v,"text-overlap","text-allow-overlap"),_t=tt==="always",kt=u.aq(v,"icon-overlap","icon-allow-overlap"),ht=kt==="always",St=v.get("text-rotation-alignment")==="map",Rt=v.get("text-pitch-alignment")==="map",Ft=v.get("icon-text-fit")!=="none",Gt=v.get("symbol-z-order")==="viewport-y",Jt=_t&&(ht||!m.hasIconData()||ct),Kt=ht&&(_t||!m.hasTextData()||ot);!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F);const ne=this.retainedQueryData[m.bucketInstanceId].tileID,se=this.terrain?(ae,Ne)=>this.terrain.getElevation(ne,ae,Ne):null,Qe=(ae,Ne)=>{var $e,bn;if(f[ae.crossTileID])return;if(z)return void(this.placements[ae.crossTileID]=new nr(!1,!1,!1));let Be=!1,rn=!1,ln=!0,wr=null,Fn={box:null,offscreen:null},Ao={box:null,offscreen:null},ti=null,pr=null,ei=null,ko=0,Fs=0,Ua=0;Ne.textFeatureIndex?ko=Ne.textFeatureIndex:ae.useRuntimeCollisionCircles&&(ko=ae.featureIndex),Ne.verticalTextFeatureIndex&&(Fs=Ne.verticalTextFeatureIndex);const fc=Ne.textBox;if(fc){const Yr=Kr=>{let mr=u.ah.horizontal;if(m.allowVerticalPlacement&&!Kr&&this.prevPlacement){const Jo=this.prevPlacement.placedOrientations[ae.crossTileID];Jo&&(this.placedOrientations[ae.crossTileID]=Jo,mr=Jo,this.markUsedOrientation(m,mr,ae))}return mr},dr=(Kr,mr)=>{if(m.allowVerticalPlacement&&ae.numVerticalGlyphVertices>0&&Ne.verticalTextBox){for(const Jo of m.writingModes)if(Jo===u.ah.vertical?(Fn=mr(),Ao=Fn):Fn=Kr(),Fn&&Fn.box&&Fn.box.length)break}else Fn=Kr()},ir=ae.textAnchorOffsetStartIndex,Ko=ae.textAnchorOffsetEndIndex;if(Ko===ir){const Kr=(mr,Jo)=>{const Jr=this.collisionIndex.placeCollisionBox(mr,tt,k,I,st.predicate,se);return Jr&&Jr.box&&Jr.box.length&&(this.markUsedOrientation(m,Jo,ae),this.placedOrientations[ae.crossTileID]=Jo),Jr};dr(()=>Kr(fc,u.ah.horizontal),()=>{const mr=Ne.verticalTextBox;return m.allowVerticalPlacement&&ae.numVerticalGlyphVertices>0&&mr?Kr(mr,u.ah.vertical):{box:null,offscreen:null}}),Yr(Fn&&Fn.box&&Fn.box.length)}else{let Kr=u.ap[(bn=($e=this.prevPlacement)===null||$e===void 0?void 0:$e.variableOffsets[ae.crossTileID])===null||bn===void 0?void 0:bn.anchor];const mr=(Jr,Pr,vp)=>{const Cm=Jr.x2-Jr.x1,Il=Jr.y2-Jr.y1,Cl=ae.textBoxScale,Mh=Ft&&kt==="never"?Pr:null;let qa={box:[],offscreen:!1},bp=tt==="never"?1:2,Tm="never";Kr&&bp++;for(let xp=0;xpmr(fc,Ne.iconBox,u.ah.horizontal),()=>{const Jr=Ne.verticalTextBox;return m.allowVerticalPlacement&&!(Fn&&Fn.box&&Fn.box.length)&&ae.numVerticalGlyphVertices>0&&Jr?mr(Jr,Ne.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Fn&&(Be=Fn.box,ln=Fn.offscreen);const Jo=Yr(Fn&&Fn.box);if(!Be&&this.prevPlacement){const Jr=this.prevPlacement.variableOffsets[ae.crossTileID];Jr&&(this.variableOffsets[ae.crossTileID]=Jr,this.markUsedJustification(m,Jr.anchor,ae,Jo))}}}if(ti=Fn,Be=ti&&ti.box&&ti.box.length>0,ln=ti&&ti.offscreen,ae.useRuntimeCollisionCircles){const Yr=m.text.placedSymbolArray.get(ae.centerJustifiedTextSymbolIndex),dr=u.ai(m.textSizeData,W,Yr),ir=v.get("text-padding");pr=this.collisionIndex.placeCollisionCircles(tt,Yr,m.lineVertexArray,m.glyphOffsetArray,dr,I,T,M,d,Rt,st.predicate,ae.collisionCircleDiameter,ir,se),pr.circles.length&&pr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),Be=_t||pr.circles.length>0&&!pr.collisionDetected,ln=ln&&pr.offscreen}if(Ne.iconFeatureIndex&&(Ua=Ne.iconFeatureIndex),Ne.iconBox){const Yr=dr=>{const ir=Ft&&wr?Zi(dr,wr.x,wr.y,St,Rt,this.transform.angle):dr;return this.collisionIndex.placeCollisionBox(ir,kt,k,I,st.predicate,se)};Ao&&Ao.box&&Ao.box.length&&Ne.verticalIconBox?(ei=Yr(Ne.verticalIconBox),rn=ei.box.length>0):(ei=Yr(Ne.iconBox),rn=ei.box.length>0),ln=ln&&ei.offscreen}const Ga=ot||ae.numHorizontalGlyphVertices===0&&ae.numVerticalGlyphVertices===0,Bs=ct||ae.numIconVertices===0;if(Ga||Bs?Bs?Ga||(rn=rn&&Be):Be=rn&&Be:rn=Be=rn&&Be,Be&&ti&&ti.box&&this.collisionIndex.insertCollisionBox(ti.box,tt,v.get("text-ignore-placement"),m.bucketInstanceId,Ao&&Ao.box&&Fs?Fs:ko,st.ID),rn&&ei&&this.collisionIndex.insertCollisionBox(ei.box,kt,v.get("icon-ignore-placement"),m.bucketInstanceId,Ua,st.ID),pr&&(Be&&this.collisionIndex.insertCollisionCircles(pr.circles,tt,v.get("text-ignore-placement"),m.bucketInstanceId,ko,st.ID),d)){const Yr=m.bucketInstanceId;let dr=this.collisionCircleArrays[Yr];dr===void 0&&(dr=this.collisionCircleArrays[Yr]=new Zr);for(let ir=0;ir=0;--Ne){const $e=ae[Ne];Qe(m.symbolInstances.get($e),m.collisionArrays[$e])}}else for(let ae=s.symbolInstanceStart;ae=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const m=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,I=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of I)s.text.placedSymbolArray.get(T).placedOrientation=m;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let d=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const m=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},I=f?f.variableOffsets:{},T=f?f.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],z=v[M];z?(this.opacities[M]=new Vn(z,m,k.text,k.icon),d=d||k.text!==z.text.placed||k.icon!==z.icon.placed):(this.opacities[M]=new Vn(null,m,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in v){const k=v[M];if(!this.opacities[M]){const z=new Vn(k,m,!1,!1);z.isHidden()||(this.opacities[M]=z,d=d||k.text.placed||k.icon.placed)}}for(const M in I)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=I[M]);for(const M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const m of f){const v=m.getBucket(s);v&&m.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,m.collisionBoxArray)}}updateBucketOpacities(s,f,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const m=s.layers[0],v=m.layout,I=new Vn(null,0,!1,!1,!0),T=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",W=v.get("icon-text-fit")!=="none",st=new Vn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const ot=(ct,tt,_t)=>{for(let kt=0;kt0,Ft=this.placedOrientations[tt.crossTileID],Gt=Ft===u.ah.vertical,Jt=Ft===u.ah.horizontal||Ft===u.ah.horizontalOnly;if(_t>0||kt>0){const Kt=uo(St.text);ot(s.text,_t,Gt?ju:Kt),ot(s.text,kt,Jt?ju:Kt);const ne=St.text.isHidden();[tt.rightJustifiedTextSymbolIndex,tt.centerJustifiedTextSymbolIndex,tt.leftJustifiedTextSymbolIndex].forEach(ae=>{ae>=0&&(s.text.placedSymbolArray.get(ae).hidden=ne||Gt?1:0)}),tt.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(tt.verticalPlacedTextSymbolIndex).hidden=ne||Jt?1:0);const se=this.variableOffsets[tt.crossTileID];se&&this.markUsedJustification(s,se.anchor,tt,Ft);const Qe=this.placedOrientations[tt.crossTileID];Qe&&(this.markUsedJustification(s,"left",tt,Qe),this.markUsedOrientation(s,Qe,tt))}if(Rt){const Kt=uo(St.icon),ne=!(W&&tt.verticalPlacedIconSymbolIndex&&Gt);tt.placedIconSymbolIndex>=0&&(ot(s.icon,tt.numIconVertices,ne?Kt:ju),s.icon.placedSymbolArray.get(tt.placedIconSymbolIndex).hidden=St.icon.isHidden()),tt.verticalPlacedIconSymbolIndex>=0&&(ot(s.icon,tt.numVerticalIconVertices,ne?ju:Kt),s.icon.placedSymbolArray.get(tt.verticalPlacedIconSymbolIndex).hidden=St.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Kt=s.collisionArrays[ct];if(Kt){let ne=new u.P(0,0);if(Kt.textBox||Kt.verticalTextBox){let Qe=!0;if(k){const ae=this.variableOffsets[ht];ae?(ne=$r(ae.anchor,ae.width,ae.height,ae.textOffset,ae.textBoxScale),z&&ne._rotate(F?this.transform.angle:-this.transform.angle)):Qe=!1}Kt.textBox&&gi(s.textCollisionBox.collisionVertexArray,St.text.placed,!Qe||Gt,ne.x,ne.y),Kt.verticalTextBox&&gi(s.textCollisionBox.collisionVertexArray,St.text.placed,!Qe||Jt,ne.x,ne.y)}const se=!!(!Jt&&Kt.verticalIconBox);Kt.iconBox&&gi(s.iconCollisionBox.collisionVertexArray,St.icon.placed,se,W?ne.x:0,W?ne.y:0),Kt.verticalIconBox&&gi(s.iconCollisionBox.collisionVertexArray,St.icon.placed,!se,W?ne.x:0,W?ne.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const ct=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ct.invProjMatrix,s.placementViewportMatrix=ct.viewportMatrix,s.collisionCircleArray=ct.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function gi(_,s,f,d,m){_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0)}const Ds=Math.pow(2,25),qd=Math.pow(2,24),wy=Math.pow(2,17),On=Math.pow(2,16),Uf=Math.pow(2,9),Gf=Math.pow(2,8),Lo=Math.pow(2,1);function uo(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*Ds+s*qd+f*wy+s*On+f*Uf+s*Gf+f*Lo+s}const ju=0;class Xo{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,d,m,v){const I=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&C.now()-m>2;for(;this._currentPlacementIndex>=0;){const I=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=T)&&(!I.maxzoom||I.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Xo(I)),this._inProgressLayer.continuePlacement(d[I.source],this.placement,this._showCollisionBoxes,I,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const Jl=512/u.W/2;class Wc{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(M.anchorX*Jl),y:Math.floor(M.anchorY*Jl)})),crossTileIDs:I.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:k,y:z}of T.positions)M.add(k,z);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:m,z:v}=this.tileID.canonical,{x:I,y:T,z:M}=f.canonical,k=Jl/Math.pow(2,M-v),z=(T*u.W+s.anchorY)*k,F=m*u.W*Jl;return{x:Math.floor((I*u.W+s.anchorX)*k-d*u.W*Jl),y:Math.floor(z-F)}}findMatches(s,f,d){const m=this.tileID.canonical.zs)}}class Xr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Wu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const d in this.indexes){const m=this.indexes[d],v={};for(const I in m){const T=m[I];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in I){const M=I[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,m)}else{const T=I[s.scaledTo(Number(v)).key];T&&T.findMatches(f.symbolInstances,s,m)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const fr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Hc=u.av();class Po extends u.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const m=this.sourceCaches[d].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new Yn(kn(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,m)=>this.getGlyphs(d,m)),this.dispatcher.registerMessageHandler("GI",(d,m)=>this.getImages(d,m)),this.imageManager=new Qt,this.imageManager.setEventedParent(this),this.glyphManager=new Wt(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ve(256,512),this.crossTileSymbolIndex=new Na,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),te().on(Ii,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.sourceCaches[d.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const I in this._layers){const T=this._layers[I];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,C.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Hc,{validate:!1})}_load(s,f,d){var m;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!fr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const I in v.sources)this.addSource(I,v.sources[I],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new We(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,I,T,M){return u._(this,void 0,void 0,function*(){const k=Et(v),z=T>1?"@2x":"",F={},W={};for(const{id:st,url:ot}of k){const ct=I.transformRequest(I.normalizeSpriteURL(ot,z,".json"),"SpriteJSON");F[st]=u.h(ct,M);const tt=I.transformRequest(I.normalizeSpriteURL(ot,z,".png"),"SpriteImage");W[st]=G.getImage(tt,M)}return yield Promise.all([...Object.values(F),...Object.values(W)]),function(st,ot){return u._(this,void 0,void 0,function*(){const ct={};for(const tt in st){ct[tt]={};const _t=C.getImageCanvasContext((yield ot[tt]).data),kt=(yield st[tt]).data;for(const ht in kt){const{width:St,height:Rt,x:Ft,y:Gt,sdf:Jt,pixelRatio:Kt,stretchX:ne,stretchY:se,content:Qe}=kt[ht];ct[tt][ht]={data:null,pixelRatio:Kt,sdf:Jt,stretchX:ne,stretchY:se,content:Qe,spriteData:{width:St,height:Rt,x:Ft,y:Gt,context:_t}}}}return ct})}(F,W)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const I in v){this._spritesImagesIds[I]=[];const T=this._spritesImagesIds[I]?this._spritesImagesIds[I].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[I]){const k=I==="default"?M:`${I}:${M}`;this._spritesImagesIds[I].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,v[I][M],!1):this.imageManager.addImage(k,v[I][M]),f&&(this._changedImages[k]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new u.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(m)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const m=f.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${m.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const m of s)f[m]&&d.push(f[m]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const d of f){const m=this._layers[d];m.type!=="custom"&&(s[d]=m.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const I in this._updatedSources){const T=this._updatedSources[I];if(T==="reload")this._reloadSource(I);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(I)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];d[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in d){const v=this.sourceCaches[m];!!d[m]!=!!v.used&&v.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const m=this.serialize();if(s=f.transformStyle?f.transformStyle(m,s):s,((d=f.validate)===null||d===void 0||d)&&fr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.aB(m,s),I=this._getOperationsToPerform(v);if(I.unimplemented.length>0)throw new Error(`Unimplemented: ${I.unimplemented.join(", ")}.`);if(I.operations.length===0)return!1;for(const T of I.operations)T();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":f.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":f.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":f.push(()=>{});break;default:d.push(m.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" 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(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Hr(s,f,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new u.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(s.type==="custom"){if(fr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=u.aA(s),s=u.e(s,{source:m})),this._validate(u.x.layer,`layers.${m}`,s,{arrayIndex:-1},d))return;v=u.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const I=f?this._order.indexOf(f):this._order.length;if(f&&I===-1)this.fire(new u.j(new Error(`Cannot add layer "${m}" before non-existing layer "${f}".`)));else{if(this._order.splice(I,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const T=this._removedLayers[m];delete this._removedLayers[m],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const m=f?this._order.indexOf(f):this._order.length;f&&m===-1?this.fire(new u.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===f&&m.maxzoom===d||(f!=null&&(m.minzoom=f),d!=null&&(m.maxzoom=d),this._updateLayer(m)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!u.aD(m.filter,f))return f==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(u.x.filter,`layers.${m.id}.filter`,f,null,d)||(m.filter=u.aA(f),this._updateLayer(m)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,m),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,m=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const I=v.getSource().type;I==="geojson"&&m?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||m?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,m=this.sourceCaches[d];if(m===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=m.getSource().type,I=v==="vector"?s.sourceLayer:void 0;v!=="vector"||I?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(I,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,m=this.sourceCaches[f];if(m!==void 0)return m.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,m=this.stylesheet;return u.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:f,terrain:d},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const f=I=>this._layers[I].type==="fill-extrusion",d={},m=[];for(let I=this._order.length-1;I>=0;I--){const T=this._order[I];if(f(T)){d[T]=I;for(const M of s){const k=M[T];if(k)for(const z of k)m.push(z)}}}m.sort((I,T)=>T.intersectionZ-I.intersectionZ);const v=[];for(let I=this._order.length-1;I>=0;I--){const T=this._order[I];if(f(T))for(let M=m.length-1;M>=0;M--){const k=m[M].feature;if(d[k.layer.id]{const Jt=_t.featureSortOrder;if(Jt){const Kt=Jt.indexOf(Ft.featureIndex);return Jt.indexOf(Gt.featureIndex)-Kt}return Gt.featureIndex-Ft.featureIndex});for(const Ft of Rt)St.push(Ft)}}for(const _t in ot)ot[_t].forEach(kt=>{const ht=kt.feature,St=k[T[_t].source].getFeatureState(ht.layer["source-layer"],ht.id);ht.source=ht.layer.source,ht.layer["source-layer"]&&(ht.sourceLayer=ht.layer["source-layer"]),ht.state=St});return ot}(this._layers,I,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(m,v){const I=m.getRenderableIds().map(k=>m.getTileByID(k)),T=[],M={};for(let k=0;kW.getTileByID(st)).sort((st,ot)=>ot.tileID.overscaledZ-st.tileID.overscaledZ||(st.tileID.isLessThan(ot.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(z,M[z.source],s.center.lng);I=I||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(C.now(),s.zoom))&&(this.pauseablePlacement=new Yo(s,this.map.terrain,this._order,v,f,d,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(C.now()),T=!0),I&&this.pauseablePlacement.placement.setStale()),T||I)for(const k of this._order){const z=this._layers[k];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(C.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},m){this._checkLoaded();const v=[{id:s,url:f}],I=[...Et(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",I,null,d)||(this.stylesheet.sprite=I,this._loadSprite(v,!0,m))}removeSprite(s){this._checkLoaded();const f=Et(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Et(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var Zc=u.X([{name:"a_pos",type:"Int16",components:2}]),Rs="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 Hu={prelude:zn(`#ifdef GL_ES + */(function(e,t){(function(n,r){e.exports=r()})(Md,function(){var n={},r={};function i(h,u,y){if(r[h]=y,h==="index"){var w="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([w],{type:"text/javascript"}))),n}}i("shared",["exports"],function(h){function u(a,o,c,p){return new(c||(c=Promise))(function(g,b){function x(A){try{L(p.next(A))}catch(R){b(R)}}function E(A){try{L(p.throw(A))}catch(R){b(R)}}function L(A){var R;A.done?g(A.value):(R=A.value,R instanceof c?R:new c(function(O){O(R)})).then(x,E)}L((p=p.apply(a,o||[])).next())})}function y(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}typeof SuppressedError=="function"&&SuppressedError;var w=S;function S(a,o){this.x=a,this.y=o}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,o){return this.clone()._rotateAround(a,o)},matMult:function(a){return this.clone()._matMult(a)},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(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var o=a.x-this.x,c=a.y-this.y;return o*o+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,o){return Math.atan2(this.x*o-this.y*a,this.x*a+this.y*o)},_matMult:function(a){var o=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=o,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var o=Math.cos(a),c=Math.sin(a),p=c*this.x+o*this.y;return this.x=o*this.x-c*this.y,this.y=p,this},_rotateAround:function(a,o){var c=Math.cos(a),p=Math.sin(a),g=o.y+p*(this.x-o.x)+c*(this.y-o.y);return this.x=o.x+c*(this.x-o.x)-p*(this.y-o.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(a){return a instanceof S?a:Array.isArray(a)?new S(a[0],a[1]):a};var C=y(w),P=D;function D(a,o,c,p){this.cx=3*a,this.bx=3*(c-a)-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=a,this.p1y=o,this.p2x=c,this.p2y=p}D.prototype={sampleCurveX:function(a){return((this.ax*a+this.bx)*a+this.cx)*a},sampleCurveY:function(a){return((this.ay*a+this.by)*a+this.cy)*a},sampleCurveDerivativeX:function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},solveCurveX:function(a,o){if(o===void 0&&(o=1e-6),a<0)return 0;if(a>1)return 1;for(var c=a,p=0;p<8;p++){var g=this.sampleCurveX(c)-a;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(a,o){return this.sampleCurveY(this.solveCurveX(a,o))}};var N=y(P);let K,Y;function J(){return K==null&&(K=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),K}function B(){if(Y==null&&(Y=!1,J())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const g=4*p;o.fillStyle=`rgb(${g},${g+1},${g+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const c=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&c[p]!==p){Y=!0;break}}}return Y||!1}function G(a,o,c,p){const g=new N(a,o,c,p);return function(b){return g.solve(b)}}const H=G(.25,.1,.25,1);function at(a,o,c){return Math.min(c,Math.max(o,a))}function gt(a,o,c){const p=c-o,g=((a-o)%p+p)%p+o;return g===o?c:g}function ft(a,...o){for(const c of o)for(const p in c)a[p]=c[p];return a}let rt=1;function mt(a,o,c){const p={};for(const g in a)p[g]=o.call(c||this,a[g],g,a);return p}function Et(a,o,c){const p={};for(const g in a)o.call(c||this,a[g],g,a)&&(p[g]=a[g]);return p}function $(a){return Array.isArray(a)?a.map($):typeof a=="object"&&a?mt(a,$):a}const Pt={};function Qt(a){Pt[a]||(typeof console<"u"&&console.warn(a),Pt[a]=!0)}function Tt(a,o,c){return(c.y-a.y)*(o.x-a.x)>(o.y-a.y)*(c.x-a.x)}function re(a){let o=0;for(let c,p,g=0,b=a.length,x=b-1;g"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(a,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),L=new Uint8ClampedArray(p*g*4);if(yield b.copyTo(L,function(A,R,O,U,j){const Z=4*Math.max(-R,0),et=(Math.max(0,O)-O)*U*4+Z,lt=4*U,pt=Math.max(0,R),Ct=Math.max(0,O);return{rect:{x:pt,y:Ct,width:Math.min(A.width,R+U)-pt,height:Math.min(A.height,O+j)-Ct},layout:[{offset:et,stride:lt}]}}(a,o,c,p,g)),E)for(let A=0;Afe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,hr=function(a,o){if(/:\/\//.test(a.url)&&!/^https?:|^file:/.test(a.url)){const p=cn(a.url);if(p)return p(a,o);if(fe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,targetMapId:kn},o)}if(!(/^file:/.test(c=a.url)||/^file:/.test(Wr())&&!/^\w+:/.test(c))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,g){return u(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:Wr(),signal:g.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new Yn(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const L=yield E;if(g.signal.aborted)throw An();return{data:L,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(a,o);if(fe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:a,mustQueue:!0,targetMapId:kn},o)}var c;return function(p,g){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const L in p.headers)E.setRequestHeader(L,p.headers[L]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!g.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let L=E.response;if(p.type==="json")try{L=JSON.parse(E.response)}catch(A){return void x(A)}b({data:L,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const L=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new Yn(E.status,E.statusText,p.url,L))}},g.signal.addEventListener("abort",()=>{E.abort(),x(An())}),E.send(p.body)})}(a,o)};function er(a){if(!a||a.indexOf("://")<=0||a.indexOf("data:image/")===0||a.indexOf("blob:")===0)return!0;const o=new URL(a),c=window.location;return o.protocol===c.protocol&&o.host===c.host}function Kn(a,o,c){c[a]&&c[a].indexOf(o)!==-1||(c[a]=c[a]||[],c[a].push(o))}function nt(a,o,c){if(c&&c[a]){const p=c[a].indexOf(o);p!==-1&&c[a].splice(p,1)}}class xt{constructor(o,c={}){ft(this,c),this.type=o}}class ce extends xt{constructor(o,c={}){super("error",ft({error:o},c))}}class mn{on(o,c){return this._listeners=this._listeners||{},Kn(o,c,this._listeners),this}off(o,c){return nt(o,c,this._listeners),nt(o,c,this._oneTimeListeners),this}once(o,c){return c?(this._oneTimeListeners=this._oneTimeListeners||{},Kn(o,c,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,c){typeof o=="string"&&(o=new xt(o,c||{}));const p=o.type;if(this.listens(p)){o.target=this;const g=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of g)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)nt(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(ft(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof ce&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,c){return this._eventedParent=o,this._eventedParentData=c,this}}var Mt={$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 He=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Tr(a,o){const c={};for(const p in a)p!=="ref"&&(c[p]=a[p]);return He.forEach(p=>{p in o&&(c[p]=o[p])}),c}function on(a,o){if(Array.isArray(a)){if(!Array.isArray(o)||a.length!==o.length)return!1;for(let c=0;c`:a.itemType.kind==="value"?"array":`array<${o}>`}return a.kind}const vt=[Hr,oe,Je,Ye,Lr,Rr,Zo,X(Ze),ut,V,q];function Q(a,o){if(o.kind==="error")return null;if(a.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(a.itemType,o.itemType))&&(typeof a.N!="number"||a.N===o.N))return null}else{if(a.kind===o.kind)return null;if(a.kind==="value"){for(const c of vt)if(!Q(c,o))return null}}return`Expected ${it(a)} but found ${it(o)} instead.`}function bt(a,o){return o.some(c=>c.kind===a.kind)}function dt(a,o){return o.some(c=>c==="null"?a===null:c==="array"?Array.isArray(a):c==="object"?a&&!Array.isArray(a)&&typeof a=="object":c===typeof a)}function It(a,o){return a.kind==="array"&&o.kind==="array"?a.itemType.kind===o.itemType.kind&&typeof a.N=="number":a.kind===o.kind}const Ot=.96422,Ut=.82521,Ht=4/29,xe=6/29,Le=3*xe*xe,Ge=xe*xe*xe,qe=Math.PI/180,vn=180/Math.PI;function Vn(a){return(a%=360)<0&&(a+=360),a}function nr([a,o,c,p]){let g,b;const x=nn((.2225045*(a=Zr(a))+.7168786*(o=Zr(o))+.0606169*(c=Zr(c)))/1);a===o&&o===c?g=b=x:(g=nn((.4360747*a+.3850649*o+.1430804*c)/Ot),b=nn((.0139322*a+.0971045*o+.7141733*c)/Ut));const E=116*x-16;return[E<0?0:E,500*(g-x),200*(x-b),p]}function Zr(a){return a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function nn(a){return a>Ge?Math.pow(a,1/3):a/Le+Ht}function vr([a,o,c,p]){let g=(a+16)/116,b=isNaN(o)?g:g+o/500,x=isNaN(c)?g:g-c/200;return g=1*Zi(g),b=Ot*Zi(b),x=Ut*Zi(x),[$r(3.1338561*b-1.6168667*g-.4906146*x),$r(-.9787684*b+1.9161415*g+.033454*x),$r(.0719453*b-.2289914*g+1.4052427*x),p]}function $r(a){return(a=a<=.00304?12.92*a:1.055*Math.pow(a,1/2.4)-.055)<0?0:a>1?1:a}function Zi(a){return a>xe?a*a*a:Le*(a-Ht)}function lo(a){return parseInt(a.padEnd(2,a),16)/255}function gi(a,o){return Ds(o?a/100:a,0,1)}function Ds(a,o,c){return Math.min(Math.max(o,a),c)}function qd(a){return!a.some(Number.isNaN)}const wy={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 On{constructor(o,c,p,g=1,b=!0){this.r=o,this.g=c,this.b=p,this.a=g,b||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[o,c,p,g]))}static parse(o){if(o instanceof On)return o;if(typeof o!="string")return;const c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=wy[p];if(g){const[x,E,L]=g;return[x/255,E/255,L/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[lo(p.slice(E,E+=x)),lo(p.slice(E,E+=x)),lo(p.slice(E,E+=x)),lo(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,L,A,R,O,U,j,Z,et,lt,pt,Ct]=x,yt=[R||" ",j||" ",lt].join("");if(yt===" "||yt===" /"||yt===",,"||yt===",,,"){const wt=[A,U,et].join(""),Zt=wt==="%%%"?100:wt===""?255:0;if(Zt){const Yt=[Ds(+L/Zt,0,1),Ds(+O/Zt,0,1),Ds(+Z/Zt,0,1),pt?gi(+pt,Ct):1];if(qd(Yt))return Yt}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,L,A,R,O,U,j,Z]=b,et=[L||" ",R||" ",U].join("");if(et===" "||et===" /"||et===",,"||et===",,,"){const lt=[+E,Ds(+A,0,100),Ds(+O,0,100),j?gi(+j,Z):1];if(qd(lt))return function([pt,Ct,yt,wt]){function Zt(Yt){const me=(Yt+pt/30)%12,be=Ct*Math.min(yt,1-yt);return yt-be*Math.max(-1,Math.min(me-3,9-me,1))}return pt=Vn(pt),Ct/=100,yt/=100,[Zt(0),Zt(8),Zt(4),wt]}(lt)}}}(o);return c?new On(...c,!1):void 0}get rgb(){const{r:o,g:c,b:p,a:g}=this,b=g||1/0;return this.overwriteGetter("rgb",[o/b,c/b,p/b,g])}get hcl(){return this.overwriteGetter("hcl",function(o){const[c,p,g,b]=nr(o),x=Math.sqrt(p*p+g*g);return[Math.round(1e4*x)?Vn(Math.atan2(g,p)*vn):NaN,x,c,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",nr(this.rgb))}overwriteGetter(o,c){return Object.defineProperty(this,o,{value:c}),c}toString(){const[o,c,p,g]=this.rgb;return`rgba(${[o,c,p].map(b=>Math.round(255*b)).join(",")},${g})`}}On.black=new On(0,0,0,1),On.white=new On(1,1,1,1),On.transparent=new On(0,0,0,0),On.red=new On(1,0,0,1);class Uf{constructor(o,c,p){this.sensitivity=o?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,c){return this.collator.compare(o,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Gf{constructor(o,c,p,g,b){this.text=o,this.image=c,this.scale=p,this.fontStack=g,this.textColor=b}}class Lo{constructor(o){this.sections=o}static fromString(o){return new Lo([new Gf(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 Lo?o:Lo.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class uo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof uo)return o;if(typeof o=="number")return new uo([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const c of o)if(typeof c!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new uo(o)}}toString(){return JSON.stringify(this.values)}}const Wu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xo{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Xo)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let c=0;c=0&&a<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof c=="number"&&c>=0&&c<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[a,o,c,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[a,o,c,p]:[a,o,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Wc(a){if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"||a instanceof On||a instanceof Uf||a instanceof Lo||a instanceof uo||a instanceof Xo||a instanceof Yo)return!0;if(Array.isArray(a)){for(const o of a)if(!Wc(o))return!1;return!0}if(typeof a=="object"){for(const o in a)if(!Wc(a[o]))return!1;return!0}return!1}function Xr(a){if(a===null)return Hr;if(typeof a=="string")return Je;if(typeof a=="boolean")return Ye;if(typeof a=="number")return oe;if(a instanceof On)return Lr;if(a instanceof Uf)return ha;if(a instanceof Lo)return Rr;if(a instanceof uo)return ut;if(a instanceof Xo)return q;if(a instanceof Yo)return V;if(Array.isArray(a)){const o=a.length;let c;for(const p of a){const g=Xr(p);if(c){if(c===g)continue;c=Ze;break}c=g}return X(c||Ze,o)}return Zo}function Hu(a){const o=typeof a;return a===null?"":o==="string"||o==="number"||o==="boolean"?String(a):a instanceof On||a instanceof Lo||a instanceof uo||a instanceof Xo||a instanceof Yo?a.toString():JSON.stringify(a)}class Na{constructor(o,c){this.type=o,this.value=c}static parse(o,c){if(o.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!Wc(o[1]))return c.error("invalid value");const p=o[1];let g=Xr(p);const b=c.expectedType;return g.kind!=="array"||g.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(g=b),new Na(g,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class fr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const Hc={string:Je,number:oe,boolean:Ye,object:Zo};class Po{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");let p,g=1;const b=o[0];if(b==="array"){let E,L;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in Hc)||A==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);E=Hc[A],g++}else E=Ze;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return c.error('The length argument to "array" must be a positive integer literal',2);L=o[2],g++}p=X(E,L)}else{if(!Hc[b])throw new Error(`Types doesn't contain name = ${b}`);p=Hc[b]}const x=[];for(;go.outputDefined())}}const Zc={"to-boolean":Ye,"to-color":Lr,"to-number":oe,"to-string":Je};class Rs{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[0];if(!Zc[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return c.error("Expected one argument.");const g=Zc[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:Ql(c[0],c[1],c[2],c[3]),!p))return new On(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new fr(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(const p of this.args){c=p.evaluate(o);const g=uo.parse(c);if(g)return g}throw new fr(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(const p of this.args){c=p.evaluate(o);const g=Xo.parse(c);if(g)return g}throw new fr(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(const p of this.args){if(c=p.evaluate(o),c===null)return 0;const g=Number(c);if(!isNaN(g))return g}throw new fr(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Lo.fromString(Hu(this.args[0].evaluate(o)));case"resolvedImage":return Yo.fromString(Hu(this.args[0].evaluate(o)));default:return Hu(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Zu=["Unknown","Point","LineString","Polygon"];class zn{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"?Zu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let c=this._parseColorCache[o];return c||(c=this._parseColorCache[o]=On.parse(o)),c}}class Xc{constructor(o,c,p=[],g,b=new yl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=g,this._isConstant=c}parse(o,c,p,g,b={}){return c?this.concat(c,p,g)._parse(o,b):this._parse(o,b)}_parse(o,c){function p(g,b,x){return x==="assert"?new Po(b,[g]):x==="coerce"?new Rs(b,[g]):g}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 g=o[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[g];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,L=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||L.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string")if(E.kind!=="padding"||L.kind!=="value"&&L.kind!=="number"&&L.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||L.kind!=="value"&&L.kind!=="array"){if(this.checkSubtype(E,L))return null}else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"coerce");else x=p(x,E,c.typeAnnotation||"assert")}if(!(x instanceof Na)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new zn;try{x=new Na(x.type,x.evaluate(E))}catch(L){return this.error(L.message),null}}return x}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,c,p){const g=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new Xc(this.registry,this._isConstant,g,c||null,b,this.errors)}error(o,...c){const p=`${this.key}${c.map(g=>`[${g}]`).join("")}`;this.errors.push(new Hi(p,o))}checkSubtype(o,c){const p=Q(o,c);return p&&this.error(p),p}}class $l{constructor(o,c,p){this.type=ha,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=c}static parse(o,c){if(o.length!==2)return c.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");const g=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Ye);if(!g)return null;const b=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Ye);if(!b)return null;let x=null;return p.locale&&(x=c.parse(p.locale,1,Je),!x)?null:new $l(g,b,x)}evaluate(o){return new Uf(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 Oa=8192;function Yc(a,o){a[0]=Math.min(a[0],o[0]),a[1]=Math.min(a[1],o[1]),a[2]=Math.max(a[2],o[0]),a[3]=Math.max(a[3],o[1])}function Xu(a,o){return!(a[0]<=o[0]||a[2]>=o[2]||a[1]<=o[1]||a[3]>=o[3])}function Sy(a,o){const c=(180+a[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,g=Math.pow(2,o.z);return[Math.round(c*g*Oa),Math.round(p*g*Oa)]}function jd(a,o,c){const p=a[0]-o[0],g=a[1]-o[1],b=a[0]-c[0],x=a[1]-c[1];return p*x-b*g==0&&p*b<=0&&g*x<=0}function Kc(a,o){let c=!1;for(let x=0,E=o.length;x(p=a)[1]!=(b=L[A+1])[1]>p[1]&&p[0]<(b[0]-g[0])*(p[1]-g[1])/(b[1]-g[1])+g[0]&&(c=!c)}}var p,g,b;return c}function Ey(a,o){for(let c=0;c0&&E<0||x<0&&E>0}function Iy(a,o,c){for(const A of c)for(let R=0;Rc[2]){const g=.5*p;let b=a[0]-c[0]>g?-p:c[0]-a[0]>g?p:0;b===0&&(b=a[0]-c[2]>g?-p:c[2]-a[0]>g?p:0),a[0]+=b}Yc(o,a)}function Qc(a,o,c,p){const g=Math.pow(2,p.z)*Oa,b=[p.x*Oa,p.y*Oa],x=[];for(const E of a)for(const L of E){const A=[L.x+b[0],L.y+b[1]];Yd(A,o,c,g),x.push(A)}return x}function Kd(a,o,c,p){const g=Math.pow(2,p.z)*Oa,b=[p.x*Oa,p.y*Oa],x=[];for(const L of a){const A=[];for(const R of L){const O=[R.x+b[0],R.y+b[1]];Yc(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=g/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const L of x)for(const A of L)Yd(A,o,c,g)}var E;return x}class _l{constructor(o,c){this.type=Ye,this.geojson=o,this.geometries=c}static parse(o,c){if(o.length!==2)return c.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Wc(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const g=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&g.push(E),x==="MultiPolygon"&&g.push(...E)}if(g.length)return new _l(p,{type:"MultiPolygon",coordinates:g})}else if(p.type==="Feature"){const g=p.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new _l(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new _l(p,p)}return c.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(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=Jc(p.coordinates,b,x),L=Qc(c.geometry(),g,b,x);if(!Xu(g,b))return!1;for(const A of L)if(!Kc(A,E))return!1}if(p.type==="MultiPolygon"){const E=Xd(p.coordinates,b,x),L=Qc(c.geometry(),g,b,x);if(!Xu(g,b))return!1;for(const A of L)if(!Ey(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(c,p){const g=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=c.canonicalID();if(p.type==="Polygon"){const E=Jc(p.coordinates,b,x),L=Kd(c.geometry(),g,b,x);if(!Xu(g,b))return!1;for(const A of L)if(!Hd(A,E))return!1}if(p.type==="MultiPolygon"){const E=Xd(p.coordinates,b,x),L=Kd(c.geometry(),g,b,x);if(!Xu(g,b))return!1;for(const A of L)if(!Zd(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class $c{constructor(o,c){this.type=c.type,this.name=o,this.boundExpression=c}static parse(o,c){if(o.length!==2||typeof o[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");const p=o[1];return c.scope.has(p)?new $c(p,c.scope.get(p)):c.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 Mo{constructor(o,c,p,g){this.name=o,this.type=c,this._evaluate=p,this.args=g}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,c){const p=o[0],g=Mo.definitions[p];if(!g)return c.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(g)?g[0]:g.type,x=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let L=null;for(const[A,R]of E){L=new Xc(c.registry,Yu,c.path,null,c.scope);const O=[];let U=!1;for(let j=1;j{return U=O,Array.isArray(U)?`(${U.map(it).join(", ")})`:`(${it(U.type)}...)`;var U}).join(" | "),R=[];for(let O=1;O{c=o?c&&Yu(p):c&&p instanceof Na}),!!c&&th(a)&&Ju(a,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function th(a){if(a instanceof Mo&&(a.name==="get"&&a.args.length===1||a.name==="feature-state"||a.name==="has"&&a.args.length===1||a.name==="properties"||a.name==="geometry-type"||a.name==="id"||/^filter-/.test(a.name))||a instanceof _l)return!1;let o=!0;return a.eachChild(c=>{o&&!th(c)&&(o=!1)}),o}function Ku(a){if(a instanceof Mo&&a.name==="feature-state")return!1;let o=!0;return a.eachChild(c=>{o&&!Ku(c)&&(o=!1)}),o}function Ju(a,o){if(a instanceof Mo&&o.indexOf(a.name)>=0)return!1;let c=!0;return a.eachChild(p=>{c&&!Ju(p,o)&&(c=!1)}),c}function Qu(a,o){const c=a.length-1;let p,g,b=0,x=c,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=a[E],g=a[E+1],p<=o){if(E===c||oo))throw new fr("Input is not a number.");x=E-1}return 0}class $u{constructor(o,c,p){this.type=o,this.input=c,this.labels=[],this.outputs=[];for(const[g,b]of p)this.labels.push(g),this.outputs.push(b)}static parse(o,c){if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");const p=c.parse(o[1],1,oe);if(!p)return null;const g=[];let b=null;c.expectedType&&c.expectedType.kind!=="value"&&(b=c.expectedType);for(let x=1;x=E)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=c.parse(L,R,b);if(!O)return null;b=b||O.type,g.push([E,O])}return new $u(b,p,g)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const g=this.input.evaluate(o);if(g<=c[0])return p[0].evaluate(o);const b=c.length;return g>=c[b-1]?p[b-1].evaluate(o):p[Qu(c,g)].evaluate(o)}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Cy(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ty=Jd;function Jd(a,o,c,p){this.cx=3*a,this.bx=3*(c-a)-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=a,this.p1y=o,this.p2x=c,this.p2y=p}Jd.prototype={sampleCurveX:function(a){return((this.ax*a+this.bx)*a+this.cx)*a},sampleCurveY:function(a){return((this.ay*a+this.by)*a+this.cy)*a},sampleCurveDerivativeX:function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},solveCurveX:function(a,o){if(o===void 0&&(o=1e-6),a<0)return 0;if(a>1)return 1;for(var c=a,p=0;p<8;p++){var g=this.sampleCurveX(c)-a;if(Math.abs(g)g?x=c:E=c,c=.5*(E-x)+x;return c},solve:function(a,o){return this.sampleCurveY(this.solveCurveX(a,o))}};var Ly=Cy(Ty);function vl(a,o,c){return a+c*(o-a)}function eh(a,o,c){return a.map((p,g)=>vl(p,o[g],c))}const Xi={number:vl,color:function(a,o,c,p="rgb"){switch(p){case"rgb":{const[g,b,x,E]=eh(a.rgb,o.rgb,c);return new On(g,b,x,E,!1)}case"hcl":{const[g,b,x,E]=a.hcl,[L,A,R,O]=o.hcl;let U,j;if(isNaN(g)||isNaN(L))isNaN(g)?isNaN(L)?U=NaN:(U=L,x!==1&&x!==0||(j=A)):(U=g,R!==1&&R!==0||(j=b));else{let Ct=L-g;L>g&&Ct>180?Ct-=360:L180&&(Ct+=360),U=g+c*Ct}const[Z,et,lt,pt]=function([Ct,yt,wt,Zt]){return Ct=isNaN(Ct)?0:Ct*qe,vr([wt,Math.cos(Ct)*yt,Math.sin(Ct)*yt,Zt])}([U,j??vl(b,A,c),vl(x,R,c),vl(E,O,c)]);return new On(Z,et,lt,pt,!1)}case"lab":{const[g,b,x,E]=vr(eh(a.lab,o.lab,c));return new On(g,b,x,E,!1)}}},array:eh,padding:function(a,o,c){return new uo(eh(a.values,o.values,c))},variableAnchorOffsetCollection:function(a,o,c){const p=a.values,g=o.values;if(p.length!==g.length)throw new fr(`Cannot interpolate values of different length. from: ${a.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof R!="number"||R<0||R>1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(b=c.parse(b,2,oe),!b)return null;const E=[];let L=null;p==="interpolate-hcl"||p==="interpolate-lab"?L=Lr:c.expectedType&&c.expectedType.kind!=="value"&&(L=c.expectedType);for(let A=0;A=R)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const Z=c.parse(O,j,L);if(!Z)return null;L=L||Z.type,E.push([R,Z])}return It(L,oe)||It(L,Lr)||It(L,ut)||It(L,q)||It(L,X(oe))?new Ai(L,p,g,b,E):c.error(`Type ${it(L)} is not interpolatable.`)}evaluate(o){const c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(o);const g=this.input.evaluate(o);if(g<=c[0])return p[0].evaluate(o);const b=c.length;if(g>=c[b-1])return p[b-1].evaluate(o);const x=Qu(c,g),E=Ai.interpolationFactor(this.interpolation,g,c[x],c[x+1]),L=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return Xi[this.type.kind](L,A,E);case"interpolate-hcl":return Xi.color(L,A,E,"hcl");case"interpolate-lab":return Xi.color(L,A,E,"lab")}}eachChild(o){o(this.input);for(const c of this.outputs)o(c)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Pn(a,o,c,p){const g=p-c,b=a-c;return g===0?0:o===1?b/g:(Math.pow(o,b)-1)/(Math.pow(o,g)-1)}class nh{constructor(o,c){this.type=o,this.args=c}static parse(o,c){if(o.length<2)return c.error("Expectected at least one argument.");let p=null;const g=c.expectedType;g&&g.kind!=="value"&&(p=g);const b=[];for(const E of o.slice(1)){const L=c.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!L)return null;p=p||L.type,b.push(L)}if(!p)throw new Error("No output type");const x=g&&b.some(E=>Q(g,E.type));return new nh(x?Ze:p,b)}evaluate(o){let c,p=null,g=0;for(const b of this.args)if(g++,p=b.evaluate(o),p&&p instanceof Yo&&!p.available&&(c||(c=p.name),p=null,g===this.args.length&&(p=c)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class rh{constructor(o,c){this.type=c.type,this.bindings=[].concat(o),this.result=c}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const c of this.bindings)o(c[1]);o(this.result)}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new fr(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new fr(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class jf{constructor(o,c){this.type=Ye,this.needle=o,this.haystack=c}static parse(o,c){if(o.length!==3)return c.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Ze),g=c.parse(o[2],2,Ze);return p&&g?bt(p.type,[Ye,Je,oe,Hr,Ze])?new jf(p,g):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(p.type)} instead`):null}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!dt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${it(Xr(c))} instead.`);if(!dt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${it(Xr(p))} instead.`);return p.indexOf(c)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class ih{constructor(o,c,p){this.type=oe,this.needle=o,this.haystack=c,this.fromIndex=p}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Ze),g=c.parse(o[2],2,Ze);if(!p||!g)return null;if(!bt(p.type,[Ye,Je,oe,Hr,Ze]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,oe);return b?new ih(p,g,b):null}return new ih(p,g)}evaluate(o){const c=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!dt(c,["boolean","string","number","null"]))throw new fr(`Expected first argument to be of type boolean, string, number or null, but found ${it(Xr(c))} instead.`);if(!dt(p,["string","array"]))throw new fr(`Expected second argument to be of type array or string, but found ${it(Xr(p))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(o);return p.indexOf(c,g)}return p.indexOf(c)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Wf{constructor(o,c,p,g,b,x){this.inputType=o,this.type=c,this.input=p,this.cases=g,this.outputs=b,this.otherwise=x}static parse(o,c){if(o.length<5)return c.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return c.error("Expected an even number of arguments.");let p,g;c.expectedType&&c.expectedType.kind!=="value"&&(g=c.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Z=="number"&&Math.floor(Z)!==Z)return U.error("Numeric branch labels must be integer values.");if(p){if(U.checkSubtype(p,Xr(Z)))return null}else p=Xr(Z);if(b[String(Z)]!==void 0)return U.error("Branch labels must be unique.");b[String(Z)]=x.length}const j=c.parse(O,A,g);if(!j)return null;g=g||j.type,x.push(j)}const E=c.parse(o[1],1,Ze);if(!E)return null;const L=c.parse(o[o.length-1],o.length-1,g);return L?E.type.kind!=="value"&&c.concat(1).checkSubtype(p,E.type)?null:new Wf(p,g,E,b,x,L):null}evaluate(o){const c=this.input.evaluate(o);return(Xr(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class Hf{constructor(o,c,p){this.type=o,this.branches=c,this.otherwise=p}static parse(o,c){if(o.length<4)return c.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);const g=[];for(let x=1;xc.outputDefined())&&this.otherwise.outputDefined()}}class oh{constructor(o,c,p,g){this.type=o,this.input=c,this.beginIndex=p,this.endIndex=g}static parse(o,c){if(o.length<=2||o.length>=5)return c.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=c.parse(o[1],1,Ze),g=c.parse(o[2],2,oe);if(!p||!g)return null;if(!bt(p.type,[X(Ze),Je,Ze]))return c.error(`Expected first argument to be of type array or string, but found ${it(p.type)} instead`);if(o.length===4){const b=c.parse(o[3],3,oe);return b?new oh(p.type,p,g,b):null}return new oh(p.type,p,g)}evaluate(o){const c=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!dt(c,["string","array"]))throw new fr(`Expected first argument to be of type array or string, but found ${it(Xr(c))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(o);return c.slice(p,g)}return c.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function Qd(a,o){return a==="=="||a==="!="?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 $d(a,o,c,p){return p.compare(o,c)===0}function tu(a,o,c){const p=a!=="=="&&a!=="!=";return class fS{constructor(b,x,E){this.type=Ye,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let L=x.parse(b[1],1,Ze);if(!L)return null;if(!Qd(E,L.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${it(L.type)}'.`);let A=x.parse(b[2],2,Ze);if(!A)return null;if(!Qd(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${it(A.type)}'.`);if(L.type.kind!==A.type.kind&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${it(L.type)}' and '${it(A.type)}'.`);p&&(L.type.kind==="value"&&A.type.kind!=="value"?L=new Po(A.type,[L]):L.type.kind!=="value"&&A.type.kind==="value"&&(A=new Po(L.type,[A])));let R=null;if(b.length===4){if(L.type.kind!=="string"&&A.type.kind!=="string"&&L.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(R=x.parse(b[3],3,ha),!R)return null}return new fS(L,A,R)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!==A.kind||L.kind!=="string"&&L.kind!=="number")throw new fr(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${L.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const L=Xr(x),A=Xr(E);if(L.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?c(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const Py=tu("==",function(a,o,c){return o===c},$d),My=tu("!=",function(a,o,c){return o!==c},function(a,o,c,p){return!$d(0,o,c,p)}),Ay=tu("<",function(a,o,c){return o",function(a,o,c){return o>c},function(a,o,c,p){return p.compare(o,c)>0}),Dy=tu("<=",function(a,o,c){return o<=c},function(a,o,c,p){return p.compare(o,c)<=0}),Ry=tu(">=",function(a,o,c){return o>=c},function(a,o,c,p){return p.compare(o,c)>=0});class Zf{constructor(o,c,p,g,b){this.type=Je,this.number=o,this.locale=c,this.currency=p,this.minFractionDigits=g,this.maxFractionDigits=b}static parse(o,c){if(o.length!==3)return c.error("Expected two arguments.");const p=c.parse(o[1],1,oe);if(!p)return null;const g=o[2];if(typeof g!="object"||Array.isArray(g))return c.error("NumberFormat options argument must be an object.");let b=null;if(g.locale&&(b=c.parse(g.locale,1,Je),!b))return null;let x=null;if(g.currency&&(x=c.parse(g.currency,1,Je),!x))return null;let E=null;if(g["min-fraction-digits"]&&(E=c.parse(g["min-fraction-digits"],1,oe),!E))return null;let L=null;return g["max-fraction-digits"]&&(L=c.parse(g["max-fraction-digits"],1,oe),!L)?null:new Zf(p,b,x,E,L)}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 sh{constructor(o){this.type=Rr,this.sections=o}static parse(o,c){if(o.length<2)return c.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");const g=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let L=null;if(E["font-scale"]&&(L=c.parse(E["font-scale"],1,oe),!L))return null;let A=null;if(E["text-font"]&&(A=c.parse(E["text-font"],1,X(Je)),!A))return null;let R=null;if(E["text-color"]&&(R=c.parse(E["text-color"],1,Lr),!R))return null;const O=g[g.length-1];O.scale=L,O.font=A,O.textColor=R}else{const L=c.parse(o[x],1,Ze);if(!L)return null;const A=L.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return c.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,g.push({content:L,scale:null,font:null,textColor:null})}}return new sh(g)}evaluate(o){return new Lo(this.sections.map(c=>{const p=c.content.evaluate(o);return Xr(p)===V?new Gf("",p,null,null,null):new Gf(Hu(p),null,c.scale?c.scale.evaluate(o):null,c.font?c.font.evaluate(o).join(","):null,c.textColor?c.textColor.evaluate(o):null)}))}eachChild(o){for(const c of this.sections)o(c.content),c.scale&&o(c.scale),c.font&&o(c.font),c.textColor&&o(c.textColor)}outputDefined(){return!1}}class Xf{constructor(o){this.type=V,this.input=o}static parse(o,c){if(o.length!==2)return c.error("Expected two arguments.");const p=c.parse(o[1],1,Je);return p?new Xf(p):c.error("No image name provided.")}evaluate(o){const c=this.input.evaluate(o),p=Yo.fromString(c);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(c)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class Yf{constructor(o){this.type=oe,this.input=o}static parse(o,c){if(o.length!==2)return c.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=c.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${it(p.type)} instead.`):new Yf(p):null}evaluate(o){const c=this.input.evaluate(o);if(typeof c=="string"||Array.isArray(c))return c.length;throw new fr(`Expected value to be of type string or array, but found ${it(Xr(c))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const eu={"==":Py,"!=":My,">":ky,"<":Ay,">=":Ry,"<=":Dy,array:Po,at:qf,boolean:Po,case:Hf,coalesce:nh,collator:$l,format:sh,image:Xf,in:jf,"index-of":ih,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:Yf,let:rh,literal:Na,match:Wf,number:Po,"number-format":Zf,object:Po,slice:oh,step:$u,string:Po,"to-boolean":Rs,"to-color":Rs,"to-number":Rs,"to-string":Rs,var:$c,within:_l};function tm(a,[o,c,p,g]){o=o.evaluate(a),c=c.evaluate(a),p=p.evaluate(a);const b=g?g.evaluate(a):1,x=Ql(o,c,p,b);if(x)throw new fr(x);return new On(o/255,c/255,p/255,b,!1)}function em(a,o){return a in o}function Kf(a,o){const c=o[a];return c===void 0?null:c}function bl(a){return{type:a}}function nm(a){return{result:"success",value:a}}function nu(a){return{result:"error",value:a}}function ru(a){return a["property-type"]==="data-driven"||a["property-type"]==="cross-faded-data-driven"}function rm(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")>-1}function Jf(a){return!!a.expression&&a.expression.interpolated}function En(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":a===null?"null":typeof a}function ah(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Ny(a){return a}function im(a,o){const c=o.type==="color",p=a.stops&&typeof a.stops[0][0]=="object",g=p||!(p||a.property!==void 0),b=a.type||(Jf(o)?"exponential":"interval");if(c||o.type==="padding"){const R=c?On.parse:uo.parse;(a=Ho({},a)).stops&&(a.stops=a.stops.map(O=>[O[0],R(O[1])])),a.default=R(a.default?a.default:o.default)}if(a.colorSpace&&(x=a.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${a.colorSpace}"`);var x;let E,L,A;if(b==="exponential")E=bn;else if(b==="interval")E=Oy;else if(b==="categorical"){E=Nr,L=Object.create(null);for(const R of a.stops)L[R[0]]=R[1];A=typeof a.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=Qf}if(p){const R={},O=[];for(let Z=0;ZZ[0]),evaluate:({zoom:Z},et)=>bn({stops:U,base:a.base},o,Z).evaluate(Z,et)}}if(g){const R=b==="exponential"?{name:"exponential",base:a.base!==void 0?a.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:Ai.interpolationFactor.bind(void 0,R),zoomStops:a.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(a,o,O,L,A)}}return{kind:"source",evaluate(R,O){const U=O&&O.properties?O.properties[a.property]:void 0;return U===void 0?tc(a.default,o.default):E(a,o,U,L,A)}}}function tc(a,o,c){return a!==void 0?a:o!==void 0?o:c!==void 0?c:void 0}function Nr(a,o,c,p,g){return tc(typeof c===g?p[c]:void 0,a.default,o.default)}function Oy(a,o,c){if(En(c)!=="number")return tc(a.default,o.default);const p=a.stops.length;if(p===1||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[p-1][0])return a.stops[p-1][1];const g=Qu(a.stops.map(b=>b[0]),c);return a.stops[g][1]}function bn(a,o,c){const p=a.base!==void 0?a.base:1;if(En(c)!=="number")return tc(a.default,o.default);const g=a.stops.length;if(g===1||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[g-1][0])return a.stops[g-1][1];const b=Qu(a.stops.map(R=>R[0]),c),x=function(R,O,U,j){const Z=j-U,et=R-U;return Z===0?0:O===1?et/Z:(Math.pow(O,et)-1)/(Math.pow(O,Z)-1)}(c,p,a.stops[b][0],a.stops[b+1][0]),E=a.stops[b][1],L=a.stops[b+1][1],A=Xi[o.type]||Ny;return typeof E.evaluate=="function"?{evaluate(...R){const O=E.evaluate.apply(void 0,R),U=L.evaluate.apply(void 0,R);if(O!==void 0&&U!==void 0)return A(O,U,x,a.colorSpace)}}:A(E,L,x,a.colorSpace)}function Qf(a,o,c){switch(o.type){case"color":c=On.parse(c);break;case"formatted":c=Lo.fromString(c.toString());break;case"resolvedImage":c=Yo.fromString(c.toString());break;case"padding":c=uo.parse(c);break;default:En(c)===o.type||o.type==="enum"&&o.values[c]||(c=void 0)}return tc(c,a.default,o.default)}Mo.register(eu,{error:[{kind:"error"},[Je],(a,[o])=>{throw new fr(o.evaluate(a))}],typeof:[Je,[Ze],(a,[o])=>it(Xr(o.evaluate(a)))],"to-rgba":[X(oe,4),[Lr],(a,[o])=>{const[c,p,g,b]=o.evaluate(a).rgb;return[255*c,255*p,255*g,b]}],rgb:[Lr,[oe,oe,oe],tm],rgba:[Lr,[oe,oe,oe,oe],tm],has:{type:Ye,overloads:[[[Je],(a,[o])=>em(o.evaluate(a),a.properties())],[[Je,Zo],(a,[o,c])=>em(o.evaluate(a),c.evaluate(a))]]},get:{type:Ze,overloads:[[[Je],(a,[o])=>Kf(o.evaluate(a),a.properties())],[[Je,Zo],(a,[o,c])=>Kf(o.evaluate(a),c.evaluate(a))]]},"feature-state":[Ze,[Je],(a,[o])=>Kf(o.evaluate(a),a.featureState||{})],properties:[Zo,[],a=>a.properties()],"geometry-type":[Je,[],a=>a.geometryType()],id:[Ze,[],a=>a.id()],zoom:[oe,[],a=>a.globals.zoom],"heatmap-density":[oe,[],a=>a.globals.heatmapDensity||0],"line-progress":[oe,[],a=>a.globals.lineProgress||0],accumulated:[Ze,[],a=>a.globals.accumulated===void 0?null:a.globals.accumulated],"+":[oe,bl(oe),(a,o)=>{let c=0;for(const p of o)c+=p.evaluate(a);return c}],"*":[oe,bl(oe),(a,o)=>{let c=1;for(const p of o)c*=p.evaluate(a);return c}],"-":{type:oe,overloads:[[[oe,oe],(a,[o,c])=>o.evaluate(a)-c.evaluate(a)],[[oe],(a,[o])=>-o.evaluate(a)]]},"/":[oe,[oe,oe],(a,[o,c])=>o.evaluate(a)/c.evaluate(a)],"%":[oe,[oe,oe],(a,[o,c])=>o.evaluate(a)%c.evaluate(a)],ln2:[oe,[],()=>Math.LN2],pi:[oe,[],()=>Math.PI],e:[oe,[],()=>Math.E],"^":[oe,[oe,oe],(a,[o,c])=>Math.pow(o.evaluate(a),c.evaluate(a))],sqrt:[oe,[oe],(a,[o])=>Math.sqrt(o.evaluate(a))],log10:[oe,[oe],(a,[o])=>Math.log(o.evaluate(a))/Math.LN10],ln:[oe,[oe],(a,[o])=>Math.log(o.evaluate(a))],log2:[oe,[oe],(a,[o])=>Math.log(o.evaluate(a))/Math.LN2],sin:[oe,[oe],(a,[o])=>Math.sin(o.evaluate(a))],cos:[oe,[oe],(a,[o])=>Math.cos(o.evaluate(a))],tan:[oe,[oe],(a,[o])=>Math.tan(o.evaluate(a))],asin:[oe,[oe],(a,[o])=>Math.asin(o.evaluate(a))],acos:[oe,[oe],(a,[o])=>Math.acos(o.evaluate(a))],atan:[oe,[oe],(a,[o])=>Math.atan(o.evaluate(a))],min:[oe,bl(oe),(a,o)=>Math.min(...o.map(c=>c.evaluate(a)))],max:[oe,bl(oe),(a,o)=>Math.max(...o.map(c=>c.evaluate(a)))],abs:[oe,[oe],(a,[o])=>Math.abs(o.evaluate(a))],round:[oe,[oe],(a,[o])=>{const c=o.evaluate(a);return c<0?-Math.round(-c):Math.round(c)}],floor:[oe,[oe],(a,[o])=>Math.floor(o.evaluate(a))],ceil:[oe,[oe],(a,[o])=>Math.ceil(o.evaluate(a))],"filter-==":[Ye,[Je,Ze],(a,[o,c])=>a.properties()[o.value]===c.value],"filter-id-==":[Ye,[Ze],(a,[o])=>a.id()===o.value],"filter-type-==":[Ye,[Je],(a,[o])=>a.geometryType()===o.value],"filter-<":[Ye,[Je,Ze],(a,[o,c])=>{const p=a.properties()[o.value],g=c.value;return typeof p==typeof g&&p{const c=a.id(),p=o.value;return typeof c==typeof p&&c":[Ye,[Je,Ze],(a,[o,c])=>{const p=a.properties()[o.value],g=c.value;return typeof p==typeof g&&p>g}],"filter-id->":[Ye,[Ze],(a,[o])=>{const c=a.id(),p=o.value;return typeof c==typeof p&&c>p}],"filter-<=":[Ye,[Je,Ze],(a,[o,c])=>{const p=a.properties()[o.value],g=c.value;return typeof p==typeof g&&p<=g}],"filter-id-<=":[Ye,[Ze],(a,[o])=>{const c=a.id(),p=o.value;return typeof c==typeof p&&c<=p}],"filter->=":[Ye,[Je,Ze],(a,[o,c])=>{const p=a.properties()[o.value],g=c.value;return typeof p==typeof g&&p>=g}],"filter-id->=":[Ye,[Ze],(a,[o])=>{const c=a.id(),p=o.value;return typeof c==typeof p&&c>=p}],"filter-has":[Ye,[Ze],(a,[o])=>o.value in a.properties()],"filter-has-id":[Ye,[],a=>a.id()!==null&&a.id()!==void 0],"filter-type-in":[Ye,[X(Je)],(a,[o])=>o.value.indexOf(a.geometryType())>=0],"filter-id-in":[Ye,[X(Ze)],(a,[o])=>o.value.indexOf(a.id())>=0],"filter-in-small":[Ye,[Je,X(Ze)],(a,[o,c])=>c.value.indexOf(a.properties()[o.value])>=0],"filter-in-large":[Ye,[Je,X(Ze)],(a,[o,c])=>function(p,g,b,x){for(;b<=x;){const E=b+x>>1;if(g[E]===p)return!0;g[E]>p?x=E-1:b=E+1}return!1}(a.properties()[o.value],c.value,0,c.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(a,[o,c])=>o.evaluate(a)&&c.evaluate(a)],[bl(Ye),(a,o)=>{for(const c of o)if(!c.evaluate(a))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(a,[o,c])=>o.evaluate(a)||c.evaluate(a)],[bl(Ye),(a,o)=>{for(const c of o)if(c.evaluate(a))return!0;return!1}]]},"!":[Ye,[Ye],(a,[o])=>!o.evaluate(a)],"is-supported-script":[Ye,[Je],(a,[o])=>{const c=a.globals&&a.globals.isSupportedScript;return!c||c(o.evaluate(a))}],upcase:[Je,[Je],(a,[o])=>o.evaluate(a).toUpperCase()],downcase:[Je,[Je],(a,[o])=>o.evaluate(a).toLowerCase()],concat:[Je,bl(Ze),(a,o)=>o.map(c=>Hu(c.evaluate(a))).join("")],"resolved-locale":[Je,[ha],(a,[o])=>o.evaluate(a).resolvedLocale()]});class Jn{constructor(o,c){var p;this.expression=o,this._warningHistory={},this._evaluator=new zn,this._defaultValue=c?(p=c).type==="color"&&ah(p.default)?new On(0,0,0,0):p.type==="color"?On.parse(p.default)||null:p.type==="padding"?uo.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Xo.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=c&&c.type==="enum"?c.values:null}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._evaluator.globals=o,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,c,p,g,b,x){this._evaluator.globals=o,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=g,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new fr(`Expected value to be one of ${Object.keys(this._enumValues).map(L=>JSON.stringify(L)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function Wn(a){return Array.isArray(a)&&a.length>0&&typeof a[0]=="string"&&a[0]in eu}function xl(a,o){const c=new Xc(eu,Yu,[],o?function(g){const b={color:Lr,string:Je,number:oe,enum:Je,boolean:Ye,formatted:Rr,padding:ut,resolvedImage:V,variableAnchorOffsetCollection:q};return g.type==="array"?X(b[g.value]||Ze,g.length):b[g.type]}(o):void 0),p=c.parse(a,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?nm(new Jn(p,o)):nu(c.errors)}class lh{constructor(o,c){this.kind=o,this._styleExpression=c,this.isStateDependent=o!=="constant"&&!Ku(c.expression)}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,g,b,x)}evaluate(o,c,p,g,b,x){return this._styleExpression.evaluate(o,c,p,g,b,x)}}class $f{constructor(o,c,p,g){this.kind=o,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=o!=="camera"&&!Ku(c.expression),this.interpolationType=g}evaluateWithoutErrorHandling(o,c,p,g,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,c,p,g,b,x)}evaluate(o,c,p,g,b,x){return this._styleExpression.evaluate(o,c,p,g,b,x)}interpolationFactor(o,c,p){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,o,c,p):0}}function om(a,o){const c=xl(a,o);if(c.result==="error")return c;const p=c.value.expression,g=th(p);if(!g&&!ru(o))return nu([new Hi("","data expressions not supported")]);const b=Ju(p,["zoom"]);if(!b&&!rm(o))return nu([new Hi("","zoom expressions not supported")]);const x=ch(p);return x||b?x instanceof Hi?nu([x]):x instanceof Ai&&!Jf(o)?nu([new Hi("",'"interpolate" expressions cannot be used with this property')]):nm(x?new $f(g?"camera":"composite",c.value,x.labels,x instanceof Ai?x.interpolation:void 0):new lh(g?"constant":"source",c.value)):nu([new Hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class uh{constructor(o,c){this._parameters=o,this._specification=c,Ho(this,im(this._parameters,this._specification))}static deserialize(o){return new uh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function ch(a){let o=null;if(a instanceof rh)o=ch(a.result);else if(a instanceof nh){for(const c of a.args)if(o=ch(c),o)break}else(a instanceof $u||a instanceof Ai)&&a.input instanceof Mo&&a.input.name==="zoom"&&(o=a);return o instanceof Hi||a.eachChild(c=>{const p=ch(c);p instanceof Hi?o=p:!o&&p?o=new Hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new Hi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function hh(a){if(a===!0||a===!1)return!0;if(!Array.isArray(a)||a.length===0)return!1;switch(a[0]){case"has":return a.length>=2&&a[1]!=="$id"&&a[1]!=="$type";case"in":return a.length>=3&&(typeof a[1]!="string"||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return a.length!==3||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const o of a.slice(1))if(!hh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const sm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fh(a){if(a==null)return{filter:()=>!0,needGeometry:!1};hh(a)||(a=dh(a));const o=xl(a,sm);if(o.result==="error")throw new Error(o.value.map(c=>`${c.key}: ${c.message}`).join(", "));return{filter:(c,p,g)=>o.value.evaluate(c,p,{},g),needGeometry:ph(a)}}function am(a,o){return ao?1:0}function ph(a){if(!Array.isArray(a))return!1;if(a[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?tp(a[1],a[2],o):o==="any"?(c=a.slice(1),["any"].concat(c.map(dh))):o==="all"?["all"].concat(a.slice(1).map(dh)):o==="none"?["all"].concat(a.slice(1).map(dh).map(mh)):o==="in"?lm(a[1],a.slice(2)):o==="!in"?mh(lm(a[1],a.slice(2))):o==="has"?um(a[1]):o==="!has"?mh(um(a[1])):o!=="within"||a;var c}function tp(a,o,c){switch(a){case"$type":return[`filter-type-${c}`,o];case"$id":return[`filter-id-${c}`,o];default:return[`filter-${c}`,a,o]}}function lm(a,o){if(o.length===0)return!1;switch(a){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(c=>typeof c!=typeof o[0])?["filter-in-large",a,["literal",o.sort(am)]]:["filter-in-small",a,["literal",o]]}}function um(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function mh(a){return["!",a]}function ep(a){const o=typeof a;if(o==="number"||o==="boolean"||o==="string"||a==null)return JSON.stringify(a);if(Array.isArray(a)){let g="[";for(const b of a)g+=`${ep(b)},`;return`${g}]`}const c=Object.keys(a).sort();let p="{";for(let g=0;gp.maximum?[new te(o,c,`${c} is greater than the maximum value ${p.maximum}`)]:[]}function hm(a){const o=a.valueSpec,c=br(a.value.type);let p,g,b,x={};const E=c!=="categorical"&&a.value.property===void 0,L=!E,A=En(a.value.stops)==="array"&&En(a.value.stops[0])==="array"&&En(a.value.stops[0][0])==="object",R=Yi({key:a.key,value:a.value,valueSpec:a.styleSpec.function,validateSpec:a.validateSpec,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(j){if(c==="identity")return[new te(j.key,j.value,'identity function may not have a "stops" property')];let Z=[];const et=j.value;return Z=Z.concat(np({key:j.key,value:et,valueSpec:j.valueSpec,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,arrayElementValidator:O})),En(et)==="array"&&et.length===0&&Z.push(new te(j.key,et,"array must have at least one stop")),Z},default:function(j){return j.validateSpec({key:j.key,value:j.value,valueSpec:o,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec})}}});return c==="identity"&&E&&R.push(new te(a.key,a.value,'missing required property "property"')),c==="identity"||a.value.stops||R.push(new te(a.key,a.value,'missing required property "stops"')),c==="exponential"&&a.valueSpec.expression&&!Jf(a.valueSpec)&&R.push(new te(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(L&&!ru(a.valueSpec)?R.push(new te(a.key,a.value,"property functions not supported")):E&&!rm(a.valueSpec)&&R.push(new te(a.key,a.value,"zoom functions not supported"))),c!=="categorical"&&!A||a.value.property!==void 0||R.push(new te(a.key,a.value,'"property" property is required')),R;function O(j){let Z=[];const et=j.value,lt=j.key;if(En(et)!=="array")return[new te(lt,et,`array expected, ${En(et)} found`)];if(et.length!==2)return[new te(lt,et,`array length 2 expected, length ${et.length} found`)];if(A){if(En(et[0])!=="object")return[new te(lt,et,`object expected, ${En(et[0])} found`)];if(et[0].zoom===void 0)return[new te(lt,et,"object stop key must have zoom")];if(et[0].value===void 0)return[new te(lt,et,"object stop key must have value")];if(b&&b>br(et[0].zoom))return[new te(lt,et[0].zoom,"stop zoom values must appear in ascending order")];br(et[0].zoom)!==b&&(b=br(et[0].zoom),g=void 0,x={}),Z=Z.concat(Yi({key:`${lt}[0]`,value:et[0],valueSpec:{zoom:{}},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{zoom:gh,value:U}}))}else Z=Z.concat(U({key:`${lt}[0]`,value:et[0],valueSpec:{},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec},et));return Wn(za(et[1]))?Z.concat([new te(`${lt}[1]`,et[1],"expressions are not allowed in function stops.")]):Z.concat(j.validateSpec({key:`${lt}[1]`,value:et[1],valueSpec:o,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec}))}function U(j,Z){const et=En(j.value),lt=br(j.value),pt=j.value!==null?j.value:Z;if(p){if(et!==p)return[new te(j.key,pt,`${et} stop domain type must match previous stop domain type ${p}`)]}else p=et;if(et!=="number"&&et!=="string"&&et!=="boolean")return[new te(j.key,pt,"stop domain value must be a number, string, or boolean")];if(et!=="number"&&c!=="categorical"){let Ct=`number expected, ${et} found`;return ru(o)&&c===void 0&&(Ct+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new te(j.key,pt,Ct)]}return c!=="categorical"||et!=="number"||isFinite(lt)&&Math.floor(lt)===lt?c!=="categorical"&&et==="number"&&g!==void 0&<new te(`${a.key}${p.key}`,a.value,p.message));const c=o.value.expression||o.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!c.outputDefined())return[new te(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!Ku(c))return[new te(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter"&&!Ku(c))return[new te(a.key,a.value,'"feature-state" data expressions are not supported with filters.')];if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!Ju(c,["zoom","feature-state"]))return[new te(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!th(c))return[new te(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ba(a){const o=a.key,c=a.value,p=a.valueSpec,g=[];return Array.isArray(p.values)?p.values.indexOf(br(c))===-1&&g.push(new te(o,c,`expected one of [${p.values.join(", ")}], ${JSON.stringify(c)} found`)):Object.keys(p.values).indexOf(br(c))===-1&&g.push(new te(o,c,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(c)} found`)),g}function iu(a){return hh(za(a.value))?Fa(Ho({},a,{expressionContext:"filter",valueSpec:{value:"boolean"}})):rp(a)}function rp(a){const o=a.value,c=a.key;if(En(o)!=="array")return[new te(c,o,`array expected, ${En(o)} found`)];const p=a.styleSpec;let g,b=[];if(o.length<1)return[new te(c,o,"filter array must have at least 1 element")];switch(b=b.concat(Ba({key:`${c}[0]`,value:o[0],valueSpec:p.filter_operator,style:a.style,styleSpec:a.styleSpec})),br(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&br(o[1])==="$type"&&b.push(new te(c,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new te(c,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(g=En(o[1]),g!=="string"&&b.push(new te(`${c}[1]`,o[1],`string expected, ${g} found`)));for(let x=2;x{A in c&&o.push(new te(p,c[A],`"${A}" is prohibited for ref layers`))}),g.layers.forEach(A=>{br(A.id)===E&&(L=A)}),L?L.ref?o.push(new te(p,c.ref,"ref cannot reference another ref layer")):x=br(L.type):o.push(new te(p,c.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(c.source){const L=g.sources&&g.sources[c.source],A=L&&br(L.type);L?A==="vector"&&x==="raster"?o.push(new te(p,c.source,`layer "${c.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new te(p,c.source,`layer "${c.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new te(p,c.source,`layer "${c.id}" requires a vector source`)):A!=="vector"||c["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new te(p,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!c.paint||!c.paint["line-gradient"]||A==="geojson"&&L.lineMetrics||o.push(new te(p,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new te(p,c,`layer "${c.id}" must specify a "source-layer"`)):o.push(new te(p,c.source,`source "${c.source}" not found`))}else o.push(new te(p,c,'missing required property "source"'));return o=o.concat(Yi({key:p,value:c,valueSpec:b.layer,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,objectElementValidators:{"*":()=>[],type:()=>a.validateSpec({key:`${p}.type`,value:c.type,valueSpec:b.layer.type,style:a.style,styleSpec:a.styleSpec,validateSpec:a.validateSpec,object:c,objectKey:"type"}),filter:iu,layout:L=>Yi({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>op(Ho({layerType:x},A))}}),paint:L=>Yi({layer:c,key:L.key,value:L.value,style:L.style,styleSpec:L.styleSpec,validateSpec:L.validateSpec,objectElementValidators:{"*":A=>ip(Ho({layerType:x},A))}})}})),o}function wl(a){const o=a.value,c=a.key,p=En(o);return p!=="string"?[new te(c,o,`string expected, ${p} found`)]:[]}const fm={promoteId:function({key:a,value:o}){if(En(o)==="string")return wl({key:a,value:o});{const c=[];for(const p in o)c.push(...wl({key:`${a}.${p}`,value:o[p]}));return c}}};function pm(a){const o=a.value,c=a.key,p=a.styleSpec,g=a.style,b=a.validateSpec;if(!o.type)return[new te(c,o,'"type" is required')];const x=br(o.type);let E;switch(x){case"vector":case"raster":return E=Yi({key:c,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:a.style,styleSpec:p,objectElementValidators:fm,validateSpec:b}),E;case"raster-dem":return E=function(L){var A;const R=(A=L.sourceName)!==null&&A!==void 0?A:"",O=L.value,U=L.styleSpec,j=U.source_raster_dem,Z=L.style;let et=[];const lt=En(O);if(O===void 0)return et;if(lt!=="object")return et.push(new te("source_raster_dem",O,`object expected, ${lt} found`)),et;const pt=br(O.encoding)==="custom",Ct=["redFactor","greenFactor","blueFactor","baseShift"],yt=L.value.encoding?`"${L.value.encoding}"`:"Default";for(const wt in O)!pt&&Ct.includes(wt)?et.push(new te(wt,O[wt],`In "${R}": "${wt}" is only valid when "encoding" is set to "custom". ${yt} encoding found`)):j[wt]?et=et.concat(L.validateSpec({key:wt,value:O[wt],valueSpec:j[wt],validateSpec:L.validateSpec,style:Z,styleSpec:U})):et.push(new te(wt,O[wt],`unknown property "${wt}"`));return et}({sourceName:c,value:o,style:a.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=Yi({key:c,value:o,valueSpec:p.source_geojson,style:g,styleSpec:p,validateSpec:b,objectElementValidators:fm}),o.cluster)for(const L in o.clusterProperties){const[A,R]=o.clusterProperties[L],O=typeof A=="string"?[A,["accumulated"],["get",L]]:A;E.push(...Fa({key:`${c}.${L}.map`,value:R,validateSpec:b,expressionContext:"cluster-map"})),E.push(...Fa({key:`${c}.${L}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return Yi({key:c,value:o,valueSpec:p.source_video,style:g,validateSpec:b,styleSpec:p});case"image":return Yi({key:c,value:o,valueSpec:p.source_image,style:g,validateSpec:b,styleSpec:p});case"canvas":return[new te(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ba({key:`${c}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:b,styleSpec:p})}}function dm(a){const o=a.value,c=a.styleSpec,p=c.light,g=a.style;let b=[];const x=En(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new te("light",o,`object expected, ${x} found`)]),b;for(const E in o){const L=E.match(/^(.*)-transition$/);b=b.concat(L&&p[L[1]]&&p[L[1]].transition?a.validateSpec({key:E,value:o[E],valueSpec:c.transition,validateSpec:a.validateSpec,style:g,styleSpec:c}):p[E]?a.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:a.validateSpec,style:g,styleSpec:c}):[new te(E,o[E],`unknown property "${E}"`)])}return b}function mm(a){const o=a.value,c=a.styleSpec,p=c.sky,g=a.style,b=En(o);if(o===void 0)return[];if(b!=="object")return[new te("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Ns({key:E,value:o[E],valueSpec:p[E],style:g,styleSpec:c}):[new te(E,o[E],`unknown property "${E}"`)]);return x}function nc(a){const o=a.value,c=a.styleSpec,p=c.terrain,g=a.style;let b=[];const x=En(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new te("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?a.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:a.validateSpec,style:g,styleSpec:c}):[new te(E,o[E],`unknown property "${E}"`)]);return b}function rc(a){let o=[];const c=a.value,p=a.key;if(Array.isArray(c)){const g=[],b=[];for(const x in c)c[x].id&&g.includes(c[x].id)&&o.push(new te(p,c,`all the sprites' ids must be unique, but ${c[x].id} is duplicated`)),g.push(c[x].id),c[x].url&&b.includes(c[x].url)&&o.push(new te(p,c,`all the sprites' URLs must be unique, but ${c[x].url} is duplicated`)),b.push(c[x].url),o=o.concat(Yi({key:`${p}[${x}]`,value:c[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:a.validateSpec}));return o}return wl({key:p,value:c})}const co={"*":()=>[],array:np,boolean:function(a){const o=a.value,c=a.key,p=En(o);return p!=="boolean"?[new te(c,o,`boolean expected, ${p} found`)]:[]},number:gh,color:function(a){const o=a.key,c=a.value,p=En(c);return p!=="string"?[new te(o,c,`color expected, ${p} found`)]:On.parse(String(c))?[]:[new te(o,c,`color expected, "${c}" found`)]},constants:cm,enum:Ba,filter:iu,function:hm,layer:ec,object:Yi,source:pm,light:dm,sky:mm,terrain:nc,string:wl,formatted:function(a){return wl(a).length===0?[]:Fa(a)},resolvedImage:function(a){return wl(a).length===0?[]:Fa(a)},padding:function(a){const o=a.key,c=a.value;if(En(c)==="array"){if(c.length<1||c.length>4)return[new te(o,c,`padding requires 1 to 4 values; ${c.length} values found`)];const p={type:"number"};let g=[];for(let b=0;b[]}})),a.constants&&(c=c.concat(cm({key:"constants",value:a.constants,style:a,styleSpec:o,validateSpec:Ns}))),ou(c)}function Os(a){return function(o){return a({...o,validateSpec:Ns})}}function ou(a){return[].concat(a).sort((o,c)=>o.line-c.line)}function hs(a){return function(...o){return ou(a.apply(this,o))}}cs.source=hs(Os(pm)),cs.sprite=hs(Os(rc)),cs.glyphs=hs(Os(sp)),cs.light=hs(Os(dm)),cs.sky=hs(Os(mm)),cs.terrain=hs(Os(nc)),cs.layer=hs(Os(ec)),cs.filter=hs(Os(iu)),cs.paintProperty=hs(Os(ip)),cs.layoutProperty=hs(Os(op));const Sl=cs,Fy=Sl.light,ap=Sl.paintProperty,By=Sl.layoutProperty;function su(a,o){let c=!1;if(o&&o.length)for(const p of o)a.fire(new ce(new Error(p.message))),c=!0;return c}class ic{constructor(o,c,p){const g=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(c=x[1])+2*(p=x[2]);for(let L=0;L=O[Z+0]&&g>=O[Z+1])?(E[j]=!0,x.push(R[j])):E[j]=!1}}}}_forEachCell(o,c,p,g,b,x,E,L){const A=this._convertToCellCoord(o),R=this._convertToCellCoord(c),O=this._convertToCellCoord(p),U=this._convertToCellCoord(g);for(let j=A;j<=O;j++)for(let Z=R;Z<=U;Z++){const et=this.d*Z+j;if((!L||L(this._convertFromCellCoord(j),this._convertFromCellCoord(Z),this._convertFromCellCoord(j+1),this._convertFromCellCoord(Z+1)))&&b.call(this,o,c,p,g,et,x,E,L))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,c=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=a[b];g[b]=zs[p].shallow.indexOf(b)>=0?x:au(x,o)}a instanceof Error&&(g.message=a.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(g.$name=p),g}throw new Error("can't serialize object of type "+typeof a)}function lu(a){if(a==null||typeof a=="boolean"||typeof a=="number"||typeof a=="string"||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||a instanceof Blob||a instanceof Error||_h(a)||Re(a)||ArrayBuffer.isView(a)||a instanceof ImageData)return a;if(Array.isArray(a))return a.map(lu);if(typeof a=="object"){const o=a.$name||"Object";if(!zs[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:c}=zs[o];if(!c)throw new Error(`can't deserialize unregistered class ${o}`);if(c.deserialize)return c.deserialize(a);const p=Object.create(c.prototype);for(const g of Object.keys(a)){if(g==="$name")continue;const b=a[g];p[g]=zs[o].shallow.indexOf(g)>=0?b:lu(b)}return p}throw new Error("can't deserialize object of type "+typeof a)}class gm{constructor(){this.first=!0}update(o,c){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZooma>=128&&a<=255,Arabic:a=>a>=1536&&a<=1791,"Arabic Supplement":a=>a>=1872&&a<=1919,"Arabic Extended-A":a=>a>=2208&&a<=2303,"Hangul Jamo":a=>a>=4352&&a<=4607,"Unified Canadian Aboriginal Syllabics":a=>a>=5120&&a<=5759,Khmer:a=>a>=6016&&a<=6143,"Unified Canadian Aboriginal Syllabics Extended":a=>a>=6320&&a<=6399,"General Punctuation":a=>a>=8192&&a<=8303,"Letterlike Symbols":a=>a>=8448&&a<=8527,"Number Forms":a=>a>=8528&&a<=8591,"Miscellaneous Technical":a=>a>=8960&&a<=9215,"Control Pictures":a=>a>=9216&&a<=9279,"Optical Character Recognition":a=>a>=9280&&a<=9311,"Enclosed Alphanumerics":a=>a>=9312&&a<=9471,"Geometric Shapes":a=>a>=9632&&a<=9727,"Miscellaneous Symbols":a=>a>=9728&&a<=9983,"Miscellaneous Symbols and Arrows":a=>a>=11008&&a<=11263,"CJK Radicals Supplement":a=>a>=11904&&a<=12031,"Kangxi Radicals":a=>a>=12032&&a<=12255,"Ideographic Description Characters":a=>a>=12272&&a<=12287,"CJK Symbols and Punctuation":a=>a>=12288&&a<=12351,Hiragana:a=>a>=12352&&a<=12447,Katakana:a=>a>=12448&&a<=12543,Bopomofo:a=>a>=12544&&a<=12591,"Hangul Compatibility Jamo":a=>a>=12592&&a<=12687,Kanbun:a=>a>=12688&&a<=12703,"Bopomofo Extended":a=>a>=12704&&a<=12735,"CJK Strokes":a=>a>=12736&&a<=12783,"Katakana Phonetic Extensions":a=>a>=12784&&a<=12799,"Enclosed CJK Letters and Months":a=>a>=12800&&a<=13055,"CJK Compatibility":a=>a>=13056&&a<=13311,"CJK Unified Ideographs Extension A":a=>a>=13312&&a<=19903,"Yijing Hexagram Symbols":a=>a>=19904&&a<=19967,"CJK Unified Ideographs":a=>a>=19968&&a<=40959,"Yi Syllables":a=>a>=40960&&a<=42127,"Yi Radicals":a=>a>=42128&&a<=42191,"Hangul Jamo Extended-A":a=>a>=43360&&a<=43391,"Hangul Syllables":a=>a>=44032&&a<=55215,"Hangul Jamo Extended-B":a=>a>=55216&&a<=55295,"Private Use Area":a=>a>=57344&&a<=63743,"CJK Compatibility Ideographs":a=>a>=63744&&a<=64255,"Arabic Presentation Forms-A":a=>a>=64336&&a<=65023,"Vertical Forms":a=>a>=65040&&a<=65055,"CJK Compatibility Forms":a=>a>=65072&&a<=65103,"Small Form Variants":a=>a>=65104&&a<=65135,"Arabic Presentation Forms-B":a=>a>=65136&&a<=65279,"Halfwidth and Fullwidth Forms":a=>a>=65280&&a<=65519};function uu(a){for(const o of a)if(vh(o.charCodeAt(0)))return!0;return!1}function ym(a){for(const o of a)if(!_m(o.charCodeAt(0)))return!1;return!0}function _m(a){return!(pe.Arabic(a)||pe["Arabic Supplement"](a)||pe["Arabic Extended-A"](a)||pe["Arabic Presentation Forms-A"](a)||pe["Arabic Presentation Forms-B"](a))}function vh(a){return!(a!==746&&a!==747&&(a<4352||!(pe["Bopomofo Extended"](a)||pe.Bopomofo(a)||pe["CJK Compatibility Forms"](a)&&!(a>=65097&&a<=65103)||pe["CJK Compatibility Ideographs"](a)||pe["CJK Compatibility"](a)||pe["CJK Radicals Supplement"](a)||pe["CJK Strokes"](a)||!(!pe["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||a===12336)||pe["CJK Unified Ideographs Extension A"](a)||pe["CJK Unified Ideographs"](a)||pe["Enclosed CJK Letters and Months"](a)||pe["Hangul Compatibility Jamo"](a)||pe["Hangul Jamo Extended-A"](a)||pe["Hangul Jamo Extended-B"](a)||pe["Hangul Jamo"](a)||pe["Hangul Syllables"](a)||pe.Hiragana(a)||pe["Ideographic Description Characters"](a)||pe.Kanbun(a)||pe["Kangxi Radicals"](a)||pe["Katakana Phonetic Extensions"](a)||pe.Katakana(a)&&a!==12540||!(!pe["Halfwidth and Fullwidth Forms"](a)||a===65288||a===65289||a===65293||a>=65306&&a<=65310||a===65339||a===65341||a===65343||a>=65371&&a<=65503||a===65507||a>=65512&&a<=65519)||!(!pe["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||pe["Unified Canadian Aboriginal Syllabics"](a)||pe["Unified Canadian Aboriginal Syllabics Extended"](a)||pe["Vertical Forms"](a)||pe["Yijing Hexagram Symbols"](a)||pe["Yi Syllables"](a)||pe["Yi Radicals"](a))))}function lp(a){return!(vh(a)||function(o){return!!(pe["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||pe["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)||pe["Letterlike Symbols"](o)||pe["Number Forms"](o)||pe["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)||pe["Control Pictures"](o)&&o!==9251||pe["Optical Character Recognition"](o)||pe["Enclosed Alphanumerics"](o)||pe["Geometric Shapes"](o)||pe["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||pe["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||pe["CJK Symbols and Punctuation"](o)||pe.Katakana(o)||pe["Private Use Area"](o)||pe["CJK Compatibility Forms"](o)||pe["Small Form Variants"](o)||pe["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(a))}function bh(a){return a>=1424&&a<=2303||pe["Arabic Presentation Forms-A"](a)||pe["Arabic Presentation Forms-B"](a)}function vm(a,o){return!(!o&&bh(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||pe.Khmer(a))}function Vy(a){for(const o of a)if(bh(o.charCodeAt(0)))return!0;return!1}const Va=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(a){this.pluginStatus=a.pluginStatus,this.pluginURL=a.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(a){this.applyArabicShaping=a.applyArabicShaping,this.processBidirectionalText=a.processBidirectionalText,this.processStyledBidirectionalText=a.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class rr{constructor(o,c){this.zoom=o,c?(this.now=c.now,this.fadeDuration=c.fadeDuration,this.zoomHistory=c.zoomHistory,this.transition=c.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new gm,this.transition={})}isSupportedScript(o){return function(c,p){for(const g of c)if(!vm(g.charCodeAt(0),p))return!1;return!0}(o,Va.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,c=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*c}}}class oc{constructor(o,c){this.property=o,this.value=c,this.expression=function(p,g){if(ah(p))return new uh(p,g);if(Wn(p)){const b=om(p,g);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return g.type==="color"&&typeof p=="string"?b=On.parse(p):g.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=Xo.parse(p)):b=uo.parse(p),{kind:"constant",evaluate:()=>b}}}(c===void 0?o.specification.default:c,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,c,p){return this.property.possiblyEvaluate(this,o,c,p)}}class xh{constructor(o){this.property=o,this.value=new oc(o,void 0)}transitioned(o,c){return new bm(this.property,this.value,c,ft({},o.transition,this.transition),o.now)}untransitioned(){return new bm(this.property,this.value,null,{},0)}}class up{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return $(this._values[o].value.value)}setValue(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new xh(this._values[o].property)),this._values[o].value=new oc(this._values[o].property,c===null?void 0:$(c))}getTransition(o){return $(this._values[o].transition)}setTransition(o,c){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new xh(this._values[o].property)),this._values[o].transition=$(c)||void 0}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p);const g=this.getTransition(c);g!==void 0&&(o[`${c}-transition`]=g)}return o}transitioned(o,c){const p=new xm(this._properties);for(const g of Object.keys(this._values))p._values[g]=this._values[g].transitioned(o,c._values[g]);return p}untransitioned(){const o=new xm(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].untransitioned();return o}}class bm{constructor(o,c,p,g,b){this.property=o,this.value=c,this.begin=b+g.delay||0,this.end=this.begin+g.duration||0,o.specification.transition&&(g.delay||g.duration)&&(this.prior=p)}possiblyEvaluate(o,c,p){const g=o.now||0,b=this.value.possiblyEvaluate(o,c,p),x=this.prior;if(x){if(g>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(g=1)return 1;const A=L*L,R=A*L;return 4*(L<.5?R:3*(L-A)+R-.75)}(E))}}return b}}class xm{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,c,p){const g=new sc(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(o,c,p);return g}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class wm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return $(this._values[o].value)}setValue(o,c){this._values[o]=new oc(this._values[o].property,c===null?void 0:$(c))}serialize(){const o={};for(const c of Object.keys(this._values)){const p=this.getValue(c);p!==void 0&&(o[c]=p)}return o}possiblyEvaluate(o,c,p){const g=new sc(this._properties);for(const b of Object.keys(this._values))g._values[b]=this._values[b].possiblyEvaluate(o,c,p);return g}}class fs{constructor(o,c,p){this.property=o,this.value=c,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,c,p,g){return this.property.evaluate(this.value,this.parameters,o,c,p,g)}}class sc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Te{constructor(o){this.specification=o}possiblyEvaluate(o,c){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(c)}interpolate(o,c,p){const g=Xi[this.specification.type];return g?g(o,c,p):o}}class De{constructor(o,c){this.specification=o,this.overrides=c}possiblyEvaluate(o,c,p,g){return new fs(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(c,null,{},p,g)}:o.expression,c)}interpolate(o,c,p){if(o.value.kind!=="constant"||c.value.kind!=="constant")return o;if(o.value.value===void 0||c.value.value===void 0)return new fs(this,{kind:"constant",value:void 0},o.parameters);const g=Xi[this.specification.type];if(g){const b=g(o.value.value,c.value.value,p);return new fs(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,c,p,g,b,x){return o.kind==="constant"?o.value:o.evaluate(c,p,g,b,x)}}class wh extends De{possiblyEvaluate(o,c,p,g){if(o.value===void 0)return new fs(this,{kind:"constant",value:void 0},c);if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,g),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,c);return new fs(this,{kind:"constant",value:E},c)}if(o.expression.kind==="camera"){const b=this._calculate(o.expression.evaluate({zoom:c.zoom-1}),o.expression.evaluate({zoom:c.zoom}),o.expression.evaluate({zoom:c.zoom+1}),c);return new fs(this,{kind:"constant",value:b},c)}return new fs(this,o.expression,c)}evaluate(o,c,p,g,b,x){if(o.kind==="source"){const E=o.evaluate(c,p,g,b,x);return this._calculate(E,E,E,c)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(c.zoom)-1},p,g),o.evaluate({zoom:Math.floor(c.zoom)},p,g),o.evaluate({zoom:Math.floor(c.zoom)+1},p,g),c):o.value}_calculate(o,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class ac{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,g){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(c,null,{},p,g);return this._calculate(b,b,b,c)}return this._calculate(o.expression.evaluate(new rr(Math.floor(c.zoom-1),c)),o.expression.evaluate(new rr(Math.floor(c.zoom),c)),o.expression.evaluate(new rr(Math.floor(c.zoom+1),c)),c)}}_calculate(o,c,p,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:o,to:c}:{from:p,to:c}}interpolate(o){return o}}class cp{constructor(o){this.specification=o}possiblyEvaluate(o,c,p,g){return!!o.expression.evaluate(c,null,{},p,g)}interpolate(){return!1}}class ho{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const c in o){const p=o[c];p.specification.overridable&&this.overridableProperties.push(c);const g=this.defaultPropertyValues[c]=new oc(p,void 0),b=this.defaultTransitionablePropertyValues[c]=new xh(p);this.defaultTransitioningPropertyValues[c]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=g.possiblyEvaluate({})}}}_e("DataDrivenProperty",De),_e("DataConstantProperty",Te),_e("CrossFadedDataDrivenProperty",wh),_e("CrossFadedProperty",ac),_e("ColorRampProperty",cp);const hp="-transition";class ps extends mn{constructor(o,c){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),c.layout&&(this._unevaluatedLayout=new wm(c.layout)),c.paint)){this._transitionablePaint=new up(c.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new sc(c.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,c,p={}){c!=null&&this._validate(By,`layers.${this.id}.layout.${o}`,o,c,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,c):this.visibility=c)}getPaintProperty(o){return o.endsWith(hp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,c,p={}){if(c!=null&&this._validate(ap,`layers.${this.id}.paint.${o}`,o,c,p))return!1;if(o.endsWith(hp))return this._transitionablePaint.setTransition(o.slice(0,-11),c||void 0),!1;{const g=this._transitionablePaint._values[o],b=g.property.specification["property-type"]==="cross-faded-data-driven",x=g.value.isDataDriven(),E=g.value;this._transitionablePaint.setValue(o,c),this._handleSpecialPaintPropertyUpdate(o);const L=this._transitionablePaint._values[o].value;return L.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,L)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,c,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,c){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,c)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Et(o,(c,p)=>!(c===void 0||p==="layout"&&!Object.keys(c).length||p==="paint"&&!Object.keys(c).length))}_validate(o,c,p,g,b={}){return(!b||b.validate!==!1)&&su(this,o.call(Sl,{key:c,layerType:this.type,objectKey:p,value:g,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const c=this.paint.get(o);if(c instanceof fs&&ru(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}const Sm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class lc{constructor(o,c){this._structArray=o,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class xr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,c){return o._trim(),c&&(o.isTransferred=!0,c.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const c=Object.create(this.prototype);return c.arrayBuffer=o.arrayBuffer,c.length=o.length,c.capacity=o.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Or(a,o=1){let c=0,p=0;return{members:a.map(g=>{const b=Sm[g.type].BYTES_PER_ELEMENT,x=c=Em(c,Math.max(o,b)),E=g.components||1;return p=Math.max(p,b),c+=b*E,{name:g.name,type:g.type,components:E,offset:x}}),size:Em(c,Math.max(p,o)),alignment:o}}function Em(a,o){return Math.ceil(a/o)*o}class uc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.int16[g+0]=c,this.int16[g+1]=p,o}}uc.prototype.bytesPerElement=4,_e("StructArrayLayout2i4",uc);class fa extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.int16[b+0]=c,this.int16[b+1]=p,this.int16[b+2]=g,o}}fa.prototype.bytesPerElement=6,_e("StructArrayLayout3i6",fa);class fp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=4*o;return this.int16[x+0]=c,this.int16[x+1]=p,this.int16[x+2]=g,this.int16[x+3]=b,o}}fp.prototype.bytesPerElement=8,_e("StructArrayLayout4i8",fp);class pp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}pp.prototype.bytesPerElement=12,_e("StructArrayLayout2i4i12",pp);class dp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=4*o,A=8*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.uint8[A+4]=g,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}dp.prototype.bytesPerElement=8,_e("StructArrayLayout2i4ub8",dp);class cc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.float32[g+0]=c,this.float32[g+1]=p,o}}cc.prototype.bytesPerElement=8,_e("StructArrayLayout2f8",cc);class Sh extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,R){const O=this.length;return this.resize(O+1),this.emplace(O,o,c,p,g,b,x,E,L,A,R)}emplace(o,c,p,g,b,x,E,L,A,R,O){const U=10*o;return this.uint16[U+0]=c,this.uint16[U+1]=p,this.uint16[U+2]=g,this.uint16[U+3]=b,this.uint16[U+4]=x,this.uint16[U+5]=E,this.uint16[U+6]=L,this.uint16[U+7]=A,this.uint16[U+8]=R,this.uint16[U+9]=O,o}}Sh.prototype.bytesPerElement=20,_e("StructArrayLayout10ui20",Sh);class mp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,R,O,U){const j=this.length;return this.resize(j+1),this.emplace(j,o,c,p,g,b,x,E,L,A,R,O,U)}emplace(o,c,p,g,b,x,E,L,A,R,O,U,j){const Z=12*o;return this.int16[Z+0]=c,this.int16[Z+1]=p,this.int16[Z+2]=g,this.int16[Z+3]=b,this.uint16[Z+4]=x,this.uint16[Z+5]=E,this.uint16[Z+6]=L,this.uint16[Z+7]=A,this.int16[Z+8]=R,this.int16[Z+9]=O,this.int16[Z+10]=U,this.int16[Z+11]=j,o}}mp.prototype.bytesPerElement=24,_e("StructArrayLayout4i4ui4i24",mp);class gp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.float32[b+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,o}}gp.prototype.bytesPerElement=12,_e("StructArrayLayout3f12",gp);class pa extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint32[1*o+0]=c,o}}pa.prototype.bytesPerElement=4,_e("StructArrayLayout1ul4",pa);class Eh extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A){const R=this.length;return this.resize(R+1),this.emplace(R,o,c,p,g,b,x,E,L,A)}emplace(o,c,p,g,b,x,E,L,A,R){const O=10*o,U=5*o;return this.int16[O+0]=c,this.int16[O+1]=p,this.int16[O+2]=g,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[U+3]=L,this.uint16[O+8]=A,this.uint16[O+9]=R,o}}Eh.prototype.bytesPerElement=20,_e("StructArrayLayout6i1ul2ui20",Eh);class hc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,c,p,g,b,x)}emplace(o,c,p,g,b,x,E){const L=6*o;return this.int16[L+0]=c,this.int16[L+1]=p,this.int16[L+2]=g,this.int16[L+3]=b,this.int16[L+4]=x,this.int16[L+5]=E,o}}hc.prototype.bytesPerElement=12,_e("StructArrayLayout2i2i2i12",hc);class Ih extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,c,p,g,b)}emplace(o,c,p,g,b,x){const E=4*o,L=8*o;return this.float32[E+0]=c,this.float32[E+1]=p,this.float32[E+2]=g,this.int16[L+6]=b,this.int16[L+7]=x,o}}Ih.prototype.bytesPerElement=16,_e("StructArrayLayout2f1f2i16",Ih);class fc extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=12*o,E=3*o;return this.uint8[x+0]=c,this.uint8[x+1]=p,this.float32[E+1]=g,this.float32[E+2]=b,o}}fc.prototype.bytesPerElement=12,_e("StructArrayLayout2ub2f12",fc);class Ch extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.uint16[b+0]=c,this.uint16[b+1]=p,this.uint16[b+2]=g,o}}Ch.prototype.bytesPerElement=6,_e("StructArrayLayout3ui6",Ch);class cu extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et,lt,pt){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et,lt,pt)}emplace(o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et,lt,pt,Ct){const yt=24*o,wt=12*o,Zt=48*o;return this.int16[yt+0]=c,this.int16[yt+1]=p,this.uint16[yt+2]=g,this.uint16[yt+3]=b,this.uint32[wt+2]=x,this.uint32[wt+3]=E,this.uint32[wt+4]=L,this.uint16[yt+10]=A,this.uint16[yt+11]=R,this.uint16[yt+12]=O,this.float32[wt+7]=U,this.float32[wt+8]=j,this.uint8[Zt+36]=Z,this.uint8[Zt+37]=et,this.uint8[Zt+38]=lt,this.uint32[wt+10]=pt,this.int16[yt+22]=Ct,o}}cu.prototype.bytesPerElement=48,_e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",cu);class El extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et,lt,pt,Ct,yt,wt,Zt,Yt,me,be,de,he,ie,ve){const le=this.length;return this.resize(le+1),this.emplace(le,o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et,lt,pt,Ct,yt,wt,Zt,Yt,me,be,de,he,ie,ve)}emplace(o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et,lt,pt,Ct,yt,wt,Zt,Yt,me,be,de,he,ie,ve,le){const $t=32*o,ke=16*o;return this.int16[$t+0]=c,this.int16[$t+1]=p,this.int16[$t+2]=g,this.int16[$t+3]=b,this.int16[$t+4]=x,this.int16[$t+5]=E,this.int16[$t+6]=L,this.int16[$t+7]=A,this.uint16[$t+8]=R,this.uint16[$t+9]=O,this.uint16[$t+10]=U,this.uint16[$t+11]=j,this.uint16[$t+12]=Z,this.uint16[$t+13]=et,this.uint16[$t+14]=lt,this.uint16[$t+15]=pt,this.uint16[$t+16]=Ct,this.uint16[$t+17]=yt,this.uint16[$t+18]=wt,this.uint16[$t+19]=Zt,this.uint16[$t+20]=Yt,this.uint16[$t+21]=me,this.uint16[$t+22]=be,this.uint32[ke+12]=de,this.float32[ke+13]=he,this.float32[ke+14]=ie,this.uint16[$t+30]=ve,this.uint16[$t+31]=le,o}}El.prototype.bytesPerElement=64,_e("StructArrayLayout8i15ui1ul2f2ui64",El);class Th extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.float32[1*o+0]=c,o}}Th.prototype.bytesPerElement=4,_e("StructArrayLayout1f4",Th);class Lh extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=3*o;return this.uint16[6*o+0]=c,this.float32[b+1]=p,this.float32[b+2]=g,o}}Lh.prototype.bytesPerElement=12,_e("StructArrayLayout1ui2f12",Lh);class Il extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c,p){const g=this.length;return this.resize(g+1),this.emplace(g,o,c,p)}emplace(o,c,p,g){const b=4*o;return this.uint32[2*o+0]=c,this.uint16[b+2]=p,this.uint16[b+3]=g,o}}Il.prototype.bytesPerElement=8,_e("StructArrayLayout1ul2ui8",Il);class yp extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,c){const p=this.length;return this.resize(p+1),this.emplace(p,o,c)}emplace(o,c,p){const g=2*o;return this.uint16[g+0]=c,this.uint16[g+1]=p,o}}yp.prototype.bytesPerElement=4,_e("StructArrayLayout2ui4",yp);class _p extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const c=this.length;return this.resize(c+1),this.emplace(c,o)}emplace(o,c){return this.uint16[1*o+0]=c,o}}_p.prototype.bytesPerElement=2,_e("StructArrayLayout1ui2",_p);class Ph extends xr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,c,p,g){const b=this.length;return this.resize(b+1),this.emplace(b,o,c,p,g)}emplace(o,c,p,g,b){const x=4*o;return this.float32[x+0]=c,this.float32[x+1]=p,this.float32[x+2]=g,this.float32[x+3]=b,o}}Ph.prototype.bytesPerElement=16,_e("StructArrayLayout4f16",Ph);class Im extends lc{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 C(this.anchorPointX,this.anchorPointY)}}Im.prototype.size=20;class _ extends Eh{get(o){return new Im(this,o)}}_e("CollisionBoxArray",_);class s extends lc{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]}}s.prototype.size=48;class f extends cu{get(o){return new s(this,o)}}_e("PlacedSymbolArray",f);class d extends lc{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]}}d.prototype.size=64;class m extends El{get(o){return new d(this,o)}}_e("SymbolInstanceArray",m);class v extends Th{getoffsetX(o){return this.float32[1*o+0]}}_e("GlyphOffsetArray",v);class I extends fa{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}_e("SymbolLineVertexArray",I);class T extends lc{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]}}T.prototype.size=12;class M extends Lh{get(o){return new T(this,o)}}_e("TextAnchorOffsetArray",M);class k extends lc{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]}}k.prototype.size=8;class z extends Il{get(o){return new k(this,o)}}_e("FeatureIndexArray",z);class F extends uc{}class W extends uc{}class st extends uc{}class ot extends pp{}class ct extends dp{}class tt extends cc{}class _t extends Sh{}class kt extends mp{}class ht extends gp{}class St extends pa{}class Rt extends hc{}class Ft extends fc{}class Gt extends Ch{}class Jt extends yp{}const Kt=Or([{name:"a_pos",components:2,type:"Int16"}],4),{members:ne}=Kt;class se{constructor(o=[]){this.segments=o}prepareSegment(o,c,p,g){let b=this.segments[this.segments.length-1];return o>se.MAX_VERTEX_ARRAY_LENGTH&&Qt(`Max vertices per segment is ${se.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>se.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==g)&&(b={vertexOffset:c.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},g!==void 0&&(b.sortKey=g),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const c in o.vaos)o.vaos[c].destroy()}static simpleSegment(o,c,p,g){return new se([{vertexOffset:o,primitiveOffset:c,vertexLength:p,primitiveLength:g,vaos:{},sortKey:0}])}}function Qe(a,o){return 256*(a=at(Math.floor(a),0,255))+at(Math.floor(o),0,255)}se.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,_e("SegmentVector",se);const ae=Or([{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 Ne={exports:{}},$e={exports:{}};$e.exports=function(a,o){var c,p,g,b,x,E,L,A;for(p=a.length-(c=3&a.length),g=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(L=0,c){case 3:L^=(255&a.charCodeAt(A+2))<<16;case 2:L^=(255&a.charCodeAt(A+1))<<8;case 1:g^=L=(65535&(L=(L=(65535&(L^=255&a.charCodeAt(A)))*x+(((L>>>16)*x&65535)<<16)&4294967295)<<15|L>>>17))*E+(((L>>>16)*E&65535)<<16)&4294967295}return g^=a.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var xn=$e.exports,Be={exports:{}};Be.exports=function(a,o){for(var c,p=a.length,g=o^p,b=0;p>=4;)c=1540483477*(65535&(c=255&a.charCodeAt(b)|(255&a.charCodeAt(++b))<<8|(255&a.charCodeAt(++b))<<16|(255&a.charCodeAt(++b))<<24))+((1540483477*(c>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:g^=(255&a.charCodeAt(b+2))<<16;case 2:g^=(255&a.charCodeAt(b+1))<<8;case 1:g=1540483477*(65535&(g^=255&a.charCodeAt(b)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var rn=xn,ln=Be.exports;Ne.exports=rn,Ne.exports.murmur3=rn,Ne.exports.murmur2=ln;var wr=y(Ne.exports);class Fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,c,p,g){this.ids.push(Ao(o)),this.positions.push(c,p,g)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const c=Ao(o);let p=0,g=this.ids.length-1;for(;p>1;this.ids[x]>=c?g=x:p=x+1}const b=[];for(;this.ids[p]===c;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,c){const p=new Float64Array(o.ids),g=new Uint32Array(o.positions);return ti(p,g,0,p.length-1),c&&c.push(p.buffer,g.buffer),{ids:p,positions:g}}static deserialize(o){const c=new Fn;return c.ids=o.ids,c.positions=o.positions,c.indexed=!0,c}}function Ao(a){const o=+a;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:wr(String(a))}function ti(a,o,c,p){for(;c>1];let b=c-1,x=p+1;for(;;){do b++;while(a[b]g);if(b>=x)break;pr(a,b,x),pr(o,3*b,3*x),pr(o,3*b+1,3*x+1),pr(o,3*b+2,3*x+2)}x-c`u_${g}`),this.type=p}setUniform(o,c,p){o.set(p.constantOr(this.value))}getBinding(o,c,p){return this.type==="color"?new Ua(o,c):new ko(o,c)}}class Yr{constructor(o,c){this.uniformNames=c.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=o.tlbr}setUniform(o,c,p,g){const b=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,c,p){return p.substr(0,9)==="u_pattern"?new Fs(o,c):new ko(o,c)}}class dr{constructor(o,c,p,g){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(o,c,p,g,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new rr(0),c,{},g,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,c,p,g){const b=this.expression.evaluate({zoom:0},p,g);this._setPaintValue(o,c,b)}_setPaintValue(o,c,p){if(this.type==="color"){const g=Ga(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=g,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=c.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,c,p,g,b){const x=this.expression.evaluate(new rr(this.zoom),c,{},g,[],b),E=this.expression.evaluate(new rr(this.zoom+1),c,{},g,[],b),L=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(L,o,x,E)}updatePaintArray(o,c,p,g){const b=this.expression.evaluate({zoom:this.zoom},p,g),x=this.expression.evaluate({zoom:this.zoom+1},p,g);this._setPaintValue(o,c,b,x)}_setPaintValue(o,c,p,g){if(this.type==="color"){const b=Ga(p),x=Ga(g);for(let E=o;E`#define HAS_UNIFORM_${g}`))}return o}getBinderAttributes(){const o=[];for(const c in this.binders){const p=this.binders[c];if(p instanceof dr||p instanceof ir)for(let g=0;g!0){this.programConfigurations={};for(const g of o)this.programConfigurations[g.id]=new Kr(g,c,p);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(o,c,p,g,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,c,g,b,x);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,c,p,g){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,c,b,g)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const c in this.programConfigurations)this.programConfigurations[c].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function Jo(a,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"]}[a]||[a.replace(`${o}-`,"").replace(/-/g,"_")]}function Jr(a,o,c){const p={color:{source:cc,composite:Ph},number:{source:Th,composite:cc}},g=function(b){return{"line-pattern":{source:_t,composite:_t},"fill-pattern":{source:_t,composite:_t},"fill-extrusion-pattern":{source:_t,composite:_t}}[b]}(a);return g&&g[c]||p[o][c]}_e("ConstantBinder",Bs),_e("CrossFadedConstantBinder",Yr),_e("SourceExpressionBinder",dr),_e("CrossFadedCompositeBinder",Ko),_e("CompositeExpressionBinder",ir),_e("ProgramConfiguration",Kr,{omit:["_buffers"]}),_e("ProgramConfigurationSet",mr);const Pr=8192,vp=Math.pow(2,14)-1,Cm=-vp-1;function Cl(a){const o=Pr/a.extent,c=a.loadGeometry();for(let p=0;px.x+1||Lx.y+1)&&Qt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return c}function Tl(a,o){return{type:a.type,id:a.id,properties:a.properties,geometry:o?Cl(a):[]}}function Mh(a,o,c,p,g){a.emplaceBack(2*o+(p+1)/2,2*c+(g+1)/2)}class qa{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new W,this.indexArray=new Gt,this.segments=new se,this.programConfigurations=new mr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){const g=this.layers[0],b=[];let x=null,E=!1;g.type==="circle"&&(x=g.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:L,id:A,index:R,sourceLayerIndex:O}of o){const U=this.layers[0]._featureFilter.needGeometry,j=Tl(L,U);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),j,p))continue;const Z=E?x.evaluate(j,{},p):void 0,et={id:A,properties:L.properties,type:L.type,sourceLayerIndex:O,index:R,geometry:U?j.geometry:Cl(L),patterns:{},sortKey:Z};b.push(et)}E&&b.sort((L,A)=>L.sortKey-A.sortKey);for(const L of b){const{geometry:A,index:R,sourceLayerIndex:O}=L,U=o[R].feature;this.addFeature(L,A,R,p),c.featureIndex.insert(U,A,R,O,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,ne),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,c,p,g){for(const b of c)for(const x of b){const E=x.x,L=x.y;if(E<0||E>=Pr||L<0||L>=Pr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),R=A.vertexLength;Mh(this.layoutVertexArray,E,L,-1,-1),Mh(this.layoutVertexArray,E,L,1,-1),Mh(this.layoutVertexArray,E,L,1,1),Mh(this.layoutVertexArray,E,L,-1,1),this.indexArray.emplaceBack(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},g)}}function bp(a,o){for(let c=0;c1){if(Ah(a,o))return!0;for(let p=0;p1?c:c.sub(o)._mult(g)._add(o))}function $v(a,o){let c,p,g,b=!1;for(let x=0;xo.y!=g.y>o.y&&o.x<(g.x-p.x)*(o.y-p.y)/(g.y-p.y)+p.x&&(b=!b)}return b}function kh(a,o){let c=!1;for(let p=0,g=a.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(c=!c)}return c}function JI(a,o,c){const p=c[0],g=c[2];if(a.xg.x&&o.x>g.x||a.yg.y&&o.y>g.y)return!1;const b=Tt(a,o,c[0]);return b!==Tt(a,o,c[1])||b!==Tt(a,o,c[2])||b!==Tt(a,o,c[3])}function Ep(a,o,c){const p=o.paint.get(a).value;return p.kind==="constant"?p.value:c.programConfigurations.get(o.id).getMaxValue(a)}function Lm(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function Pm(a,o,c,p,g){if(!o[0]&&!o[1])return a;const b=C.convert(o)._mult(g);c==="viewport"&&b._rotate(-p);const x=[];for(let E=0;Er1(lt,et))}(A,L),j=O?R*E:R;for(const Z of g)for(const et of Z){const lt=O?et:r1(et,L);let pt=j;const Ct=Mm([],[et.x,et.y,0,1],L);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pt*=Ct[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pt*=x.cameraToCenterDistance/Ct[3]),Tm(U,lt,pt))return!0}return!1}}function r1(a,o){const c=Mm([],[a.x,a.y,0,1],o);return new C(c[0]/c[3],c[1]/c[3])}class i1 extends qa{}let o1;_e("HeatmapBucket",i1,{omit:["layers"]});var eC={get paint(){return o1=o1||new ho({"heatmap-radius":new De(Mt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new De(Mt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Te(Mt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new cp(Mt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Te(Mt.paint_heatmap["heatmap-opacity"])})}};function qy(a,{width:o,height:c},p,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==o*c*p)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${o*c*p}`)}else g=new Uint8Array(o*c*p);return a.width=o,a.height=c,a.data=g,a}function s1(a,{width:o,height:c},p){if(o===a.width&&c===a.height)return;const g=qy({},{width:o,height:c},p);jy(a,g,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,o),height:Math.min(a.height,c)},p),a.width=o,a.height=c,a.data=g.data}function jy(a,o,c,p,g,b){if(g.width===0||g.height===0)return o;if(g.width>a.width||g.height>a.height||c.x>a.width-g.width||c.y>a.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>o.width||g.height>o.height||p.x>o.width-g.width||p.y>o.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const x=a.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let L=0;L{o[a.evaluationKey]=L;const A=a.expression.evaluate(o);g.data[x+E+0]=Math.floor(255*A.r/A.a),g.data[x+E+1]=Math.floor(255*A.g/A.a),g.data[x+E+2]=Math.floor(255*A.b/A.a),g.data[x+E+3]=Math.floor(255*A.a)};if(a.clips)for(let x=0,E=0;x80*c){p=b=a[0],g=x=a[1];for(var Z=c;Zb&&(b=E),L>x&&(x=L);A=(A=Math.max(b-p,x-g))!==0?32767/A:0}return Tp(U,j,c,p,g,A,0),j}function u1(a,o,c,p,g){var b,x;if(g===Xy(a,o,c,p)>0)for(b=o;b=o;b-=p)x=f1(b,a[b],a[b+1],x);return x&&km(x,x.next)&&(Pp(x),x=x.next),x}function dc(a,o){if(!a)return a;o||(o=a);var c,p=a;do if(c=!1,p.steiner||!km(p,p.next)&&zr(p.prev,p,p.next)!==0)p=p.next;else{if(Pp(p),(p=o=p.prev)===p.next)break;c=!0}while(c||p!==o);return o}function Tp(a,o,c,p,g,b,x){if(a){!x&&b&&function(R,O,U,j){var Z=R;do Z.z===0&&(Z.z=Hy(Z.x,Z.y,O,U,j)),Z.prevZ=Z.prev,Z.nextZ=Z.next,Z=Z.next;while(Z!==R);Z.prevZ.nextZ=null,Z.prevZ=null,function(et){var lt,pt,Ct,yt,wt,Zt,Yt,me,be=1;do{for(pt=et,et=null,wt=null,Zt=0;pt;){for(Zt++,Ct=pt,Yt=0,lt=0;lt0||me>0&&Ct;)Yt!==0&&(me===0||!Ct||pt.z<=Ct.z)?(yt=pt,pt=pt.nextZ,Yt--):(yt=Ct,Ct=Ct.nextZ,me--),wt?wt.nextZ=yt:et=yt,yt.prevZ=wt,wt=yt;pt=Ct}wt.nextZ=null,be*=2}while(Zt>1)}(Z)}(a,p,g,b);for(var E,L,A=a;a.prev!==a.next;)if(E=a.prev,L=a.next,b?lC(a,p,g,b):aC(a))o.push(E.i/c|0),o.push(a.i/c|0),o.push(L.i/c|0),Pp(a),a=L.next,A=L.next;else if((a=L)===A){x?x===1?Tp(a=uC(dc(a),o,c),o,c,p,g,b,2):x===2&&cC(a,o,c,p,g,b):Tp(dc(a),o,c,p,g,b,1);break}}}function aC(a){var o=a.prev,c=a,p=a.next;if(zr(o,c,p)>=0)return!1;for(var g=o.x,b=c.x,x=p.x,E=o.y,L=c.y,A=p.y,R=gb?g>x?g:x:b>x?b:x,j=E>L?E>A?E:A:L>A?L:A,Z=p.next;Z!==o;){if(Z.x>=R&&Z.x<=U&&Z.y>=O&&Z.y<=j&&Rh(g,E,b,L,x,A,Z.x,Z.y)&&zr(Z.prev,Z,Z.next)>=0)return!1;Z=Z.next}return!0}function lC(a,o,c,p){var g=a.prev,b=a,x=a.next;if(zr(g,b,x)>=0)return!1;for(var E=g.x,L=b.x,A=x.x,R=g.y,O=b.y,U=x.y,j=EL?E>A?E:A:L>A?L:A,lt=R>O?R>U?R:U:O>U?O:U,pt=Hy(j,Z,o,c,p),Ct=Hy(et,lt,o,c,p),yt=a.prevZ,wt=a.nextZ;yt&&yt.z>=pt&&wt&&wt.z<=Ct;){if(yt.x>=j&&yt.x<=et&&yt.y>=Z&&yt.y<=lt&&yt!==g&&yt!==x&&Rh(E,R,L,O,A,U,yt.x,yt.y)&&zr(yt.prev,yt,yt.next)>=0||(yt=yt.prevZ,wt.x>=j&&wt.x<=et&&wt.y>=Z&&wt.y<=lt&&wt!==g&&wt!==x&&Rh(E,R,L,O,A,U,wt.x,wt.y)&&zr(wt.prev,wt,wt.next)>=0))return!1;wt=wt.nextZ}for(;yt&&yt.z>=pt;){if(yt.x>=j&&yt.x<=et&&yt.y>=Z&&yt.y<=lt&&yt!==g&&yt!==x&&Rh(E,R,L,O,A,U,yt.x,yt.y)&&zr(yt.prev,yt,yt.next)>=0)return!1;yt=yt.prevZ}for(;wt&&wt.z<=Ct;){if(wt.x>=j&&wt.x<=et&&wt.y>=Z&&wt.y<=lt&&wt!==g&&wt!==x&&Rh(E,R,L,O,A,U,wt.x,wt.y)&&zr(wt.prev,wt,wt.next)>=0)return!1;wt=wt.nextZ}return!0}function uC(a,o,c){var p=a;do{var g=p.prev,b=p.next.next;!km(g,b)&&c1(g,p,p.next,b)&&Lp(g,b)&&Lp(b,g)&&(o.push(g.i/c|0),o.push(p.i/c|0),o.push(b.i/c|0),Pp(p),Pp(p.next),p=a=b),p=p.next}while(p!==a);return dc(p)}function cC(a,o,c,p,g,b){var x=a;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&mC(x,E)){var L=h1(x,E);return x=dc(x,x.next),L=dc(L,L.next),Tp(x,o,c,p,g,b,0),void Tp(L,o,c,p,g,b,0)}E=E.next}x=x.next}while(x!==a)}function hC(a,o){return a.x-o.x}function fC(a,o){var c=function(g,b){var x,E=b,L=g.x,A=g.y,R=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var O=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(O<=L&&O>R&&(R=O,x=E.x=E.x&&E.x>=Z&&L!==E.x&&Rh(Ax.x||E.x===x.x&&pC(x,E)))&&(x=E,lt=U)),E=E.next;while(E!==j);return x}(a,o);if(!c)return o;var p=h1(c,a);return dc(p,p.next),dc(c,c.next)}function pC(a,o){return zr(a.prev,a,o.prev)<0&&zr(o.next,a,a.next)<0}function Hy(a,o,c,p,g){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-c)*g|0)|a<<8))|a<<4))|a<<2))|a<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*g|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function dC(a){var o=a,c=a;do(o.x=(a-x)*(b-E)&&(a-x)*(p-E)>=(c-x)*(o-E)&&(c-x)*(b-E)>=(g-x)*(p-E)}function mC(a,o){return a.next.i!==o.i&&a.prev.i!==o.i&&!function(c,p){var g=c;do{if(g.i!==c.i&&g.next.i!==c.i&&g.i!==p.i&&g.next.i!==p.i&&c1(g,g.next,c,p))return!0;g=g.next}while(g!==c);return!1}(a,o)&&(Lp(a,o)&&Lp(o,a)&&function(c,p){var g=c,b=!1,x=(c.x+p.x)/2,E=(c.y+p.y)/2;do g.y>E!=g.next.y>E&&g.next.y!==g.y&&x<(g.next.x-g.x)*(E-g.y)/(g.next.y-g.y)+g.x&&(b=!b),g=g.next;while(g!==c);return b}(a,o)&&(zr(a.prev,a,o.prev)||zr(a,o.prev,o))||km(a,o)&&zr(a.prev,a,a.next)>0&&zr(o.prev,o,o.next)>0)}function zr(a,o,c){return(o.y-a.y)*(c.x-o.x)-(o.x-a.x)*(c.y-o.y)}function km(a,o){return a.x===o.x&&a.y===o.y}function c1(a,o,c,p){var g=Rm(zr(a,o,c)),b=Rm(zr(a,o,p)),x=Rm(zr(c,p,a)),E=Rm(zr(c,p,o));return g!==b&&x!==E||!(g!==0||!Dm(a,c,o))||!(b!==0||!Dm(a,p,o))||!(x!==0||!Dm(c,a,p))||!(E!==0||!Dm(c,o,p))}function Dm(a,o,c){return o.x<=Math.max(a.x,c.x)&&o.x>=Math.min(a.x,c.x)&&o.y<=Math.max(a.y,c.y)&&o.y>=Math.min(a.y,c.y)}function Rm(a){return a>0?1:a<0?-1:0}function Lp(a,o){return zr(a.prev,a,a.next)<0?zr(a,o,a.next)>=0&&zr(a,a.prev,o)>=0:zr(a,o,a.prev)<0||zr(a,a.next,o)<0}function h1(a,o){var c=new Zy(a.i,a.x,a.y),p=new Zy(o.i,o.x,o.y),g=a.next,b=o.prev;return a.next=o,o.prev=a,c.next=g,g.prev=c,p.next=c,c.prev=p,b.next=p,p.prev=b,p}function f1(a,o,c,p){var g=new Zy(a,o,c);return p?(g.next=p.next,g.prev=p,p.next.prev=g,p.next=g):(g.prev=g,g.next=g),g}function Pp(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function Zy(a,o,c){this.i=a,this.x=o,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Xy(a,o,c,p){for(var g=0,b=o,x=c-p;b0&&c.holes.push(p+=a[g-1].length)}return c};var p1=y(Wy.exports);function gC(a,o,c,p,g){d1(a,o,c||0,p||a.length-1,g||yC)}function d1(a,o,c,p,g){for(;p>c;){if(p-c>600){var b=p-c+1,x=o-c+1,E=Math.log(b),L=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*L*(b-L)/b)*(x-b/2<0?-1:1);d1(a,o,Math.max(c,Math.floor(o-x*L/b+A)),Math.min(p,Math.floor(o+(b-x)*L/b+A)),g)}var R=a[o],O=c,U=p;for(Mp(a,c,o),g(a[p],R)>0&&Mp(a,c,p);O0;)U--}g(a[c],R)===0?Mp(a,c,U):Mp(a,++U,p),U<=o&&(c=U+1),o<=U&&(p=U-1)}}function Mp(a,o,c){var p=a[o];a[o]=a[c],a[c]=p}function yC(a,o){return ao?1:0}function Yy(a,o){const c=a.length;if(c<=1)return[a];const p=[];let g,b;for(let x=0;x1)for(let x=0;xc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new st,this.indexArray=new Gt,this.indexArray2=new Jt,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new se,this.segments2=new se,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=Ky("fill",this.layers,c);const g=this.layers[0].layout.get("fill-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:R}of o){const O=this.layers[0]._featureFilter.needGeometry,U=Tl(E,O);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),U,p))continue;const j=b?g.evaluate(U,{},p,c.availableImages):void 0,Z={id:L,properties:E.properties,type:E.type,sourceLayerIndex:R,index:A,geometry:O?U.geometry:Cl(E),patterns:{},sortKey:j};x.push(Z)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:R}=E;if(this.hasPattern){const O=Jy("fill",this.layers,E,this.zoom,c);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,R,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,sC),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,c,p,g,b){for(const x of Yy(c,500)){let E=0;for(const j of x)E+=j.length;const L=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=L.vertexLength,R=[],O=[];for(const j of x){if(j.length===0)continue;j!==x[0]&&O.push(R.length/2);const Z=this.segments2.prepareSegment(j.length,this.layoutVertexArray,this.indexArray2),et=Z.vertexLength;this.layoutVertexArray.emplaceBack(j[0].x,j[0].y),this.indexArray2.emplaceBack(et+j.length-1,et),R.push(j[0].x),R.push(j[0].y);for(let lt=1;lt>3}if(g--,p===1||p===2)b+=a.readSVarint(),x+=a.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new EC(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},Nh.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var o=a.readVarint()+a.pos,c=1,p=0,g=0,b=0,x=1/0,E=-1/0,L=1/0,A=-1/0;a.pos>3}if(p--,c===1||c===2)(g+=a.readSVarint())E&&(E=g),(b+=a.readSVarint())A&&(A=b);else if(c!==7)throw new Error("unknown command "+c)}return[x,L,E,A]},Nh.prototype.toGeoJSON=function(a,o,c){var p,g,b=this.extent*Math.pow(2,c),x=this.extent*a,E=this.extent*o,L=this.loadGeometry(),A=Nh.types[this.type];function R(j){for(var Z=0;Z>3;g=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return g}(c))}v1.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var o=this._pbf.readVarint()+this._pbf.pos;return new TC(this._pbf,o,this.extent,this._keys,this._values)};var PC=_1;function MC(a,o,c){if(a===3){var p=new PC(c,c.readVarint()+c.pos);p.length&&(o[p.name]=p)}}hu.VectorTile=function(a,o){this.layers=a.readFields(MC,{},o)},hu.VectorTileFeature=y1,hu.VectorTileLayer=_1;const AC=hu.VectorTileFeature.types,$y=Math.pow(2,13);function Ap(a,o,c,p,g,b,x,E){a.emplaceBack(o,c,2*Math.floor(p*$y)+x,g*$y*2,b*$y*2,Math.round(E))}class t_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(c=>c.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new ot,this.centroidVertexArray=new F,this.indexArray=new Gt,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new se,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.features=[],this.hasPattern=Ky("fill-extrusion",this.layers,c);for(const{feature:g,id:b,index:x,sourceLayerIndex:E}of o){const L=this.layers[0]._featureFilter.needGeometry,A=Tl(g,L);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),A,p))continue;const R={id:b,sourceLayerIndex:E,index:x,geometry:L?A.geometry:Cl(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(Jy("fill-extrusion",this.layers,R,this.zoom,c)):this.addFeature(R,R.geometry,x,p,{}),c.featureIndex.insert(g,R.geometry,x,E,this.index,!0)}}addFeatures(o,c,p){for(const g of this.features){const{geometry:b}=g;this.addFeature(g,b,g.index,c,p)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,SC),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,wC.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,c,p,g,b){const x={x:0,y:0,vertexCount:0};for(const E of Yy(c,500)){let L=0;for(const Z of E)L+=Z.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Z of E){if(Z.length===0||DC(Z))continue;let et=0;for(let lt=0;lt=1){const Ct=Z[lt-1];if(!kC(pt,Ct)){A.vertexLength+4>se.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const yt=pt.sub(Ct)._perp()._unit(),wt=Ct.dist(pt);et+wt>32768&&(et=0),Ap(this.layoutVertexArray,pt.x,pt.y,yt.x,yt.y,0,0,et),Ap(this.layoutVertexArray,pt.x,pt.y,yt.x,yt.y,0,1,et),x.x+=2*pt.x,x.y+=2*pt.y,x.vertexCount+=2,et+=wt,Ap(this.layoutVertexArray,Ct.x,Ct.y,yt.x,yt.y,0,0,et),Ap(this.layoutVertexArray,Ct.x,Ct.y,yt.x,yt.y,0,1,et),x.x+=2*Ct.x,x.y+=2*Ct.y,x.vertexCount+=2;const Zt=A.vertexLength;this.indexArray.emplaceBack(Zt,Zt+2,Zt+1),this.indexArray.emplaceBack(Zt+1,Zt+2,Zt+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+L>se.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(L,this.layoutVertexArray,this.indexArray)),AC[o.type]!=="Polygon")continue;const R=[],O=[],U=A.vertexLength;for(const Z of E)if(Z.length!==0){Z!==E[0]&&O.push(R.length/2);for(let et=0;etPr)||a.y===o.y&&(a.y<0||a.y>Pr)}function DC(a){return a.every(o=>o.x<0)||a.every(o=>o.x>Pr)||a.every(o=>o.y<0)||a.every(o=>o.y>Pr)}let b1;_e("FillExtrusionBucket",t_,{omit:["layers","features"]});var RC={get paint(){return b1=b1||new ho({"fill-extrusion-opacity":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new De(Mt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wh(Mt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new De(Mt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new De(Mt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Te(Mt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class NC extends ps{constructor(o){super(o,RC)}createBucket(o){return new t_(o)}queryRadius(){return Lm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,c,p,g,b,x,E,L){const A=Pm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),R=this.paint.get("fill-extrusion-height").evaluate(c,p),O=this.paint.get("fill-extrusion-base").evaluate(c,p),U=function(Z,et,lt,pt){const Ct=[];for(const yt of Z){const wt=[yt.x,yt.y,0,1];Mm(wt,wt,et),Ct.push(new C(wt[0]/wt[3],wt[1]/wt[3]))}return Ct}(A,L),j=function(Z,et,lt,pt){const Ct=[],yt=[],wt=pt[8]*et,Zt=pt[9]*et,Yt=pt[10]*et,me=pt[11]*et,be=pt[8]*lt,de=pt[9]*lt,he=pt[10]*lt,ie=pt[11]*lt;for(const ve of Z){const le=[],$t=[];for(const ke of ve){const Ee=ke.x,hn=ke.y,Qn=pt[0]*Ee+pt[4]*hn+pt[12],or=pt[1]*Ee+pt[5]*hn+pt[13],ri=pt[2]*Ee+pt[6]*hn+pt[14],Qo=pt[3]*Ee+pt[7]*hn+pt[15],po=ri+Yt,Qr=Qo+me,Ci=Qn+be,Di=or+de,mo=ri+he,go=Qo+ie,ii=new C((Qn+wt)/Qr,(or+Zt)/Qr);ii.z=po/Qr,le.push(ii);const oi=new C(Ci/go,Di/go);oi.z=mo/go,$t.push(oi)}Ct.push(le),yt.push($t)}return[Ct,yt]}(g,O,R,L);return function(Z,et,lt){let pt=1/0;xp(lt,et)&&(pt=x1(lt,et[0]));for(let Ct=0;Ctc.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(c=>{this.gradients[c.id]={}}),this.layoutVertexArray=new ct,this.layoutVertexArray2=new tt,this.indexArray=new Gt,this.programConfigurations=new mr(o.layers,o.zoom),this.segments=new se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id)}populate(o,c,p){this.hasPattern=Ky("line",this.layers,c);const g=this.layers[0].layout.get("line-sort-key"),b=!g.isConstant(),x=[];for(const{feature:E,id:L,index:A,sourceLayerIndex:R}of o){const O=this.layers[0]._featureFilter.needGeometry,U=Tl(E,O);if(!this.layers[0]._featureFilter.filter(new rr(this.zoom),U,p))continue;const j=b?g.evaluate(U,{},p):void 0,Z={id:L,properties:E.properties,type:E.type,sourceLayerIndex:R,index:A,geometry:O?U.geometry:Cl(E),patterns:{},sortKey:j};x.push(Z)}b&&x.sort((E,L)=>E.sortKey-L.sortKey);for(const E of x){const{geometry:L,index:A,sourceLayerIndex:R}=E;if(this.hasPattern){const O=Jy("line",this.layers,E,this.zoom,c);this.patternFeatures.push(O)}else this.addFeature(E,L,A,p,{});c.featureIndex.insert(o[A].feature,L,A,R,this.index)}}update(o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,c,this.stateDependentLayers,p)}addFeatures(o,c,p){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,BC)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,zC),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,c,p,g,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),L=x.get("line-cap"),A=x.get("line-miter-limit"),R=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of c)this.addLine(O,o,E,L,A,R);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,g)}addLine(o,c,p,g,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pt=0;pt=2&&o[L-1].equals(o[L-2]);)L--;let A=0;for(;A0;if(me&&pt>A){const ie=U.dist(j);if(ie>2*R){const ve=U.sub(U.sub(j)._mult(R/ie)._round());this.updateDistance(j,ve),this.addCurrentVertex(ve,et,0,0,O),j=ve}}const de=j&&Z;let he=de?p:E?"butt":g;if(de&&he==="round"&&(Ztb&&(he="bevel"),he==="bevel"&&(Zt>2&&(he="flipbevel"),Zt100)Ct=lt.mult(-1);else{const ie=Zt*et.add(lt).mag()/et.sub(lt).mag();Ct._perp()._mult(ie*(be?-1:1))}this.addCurrentVertex(U,Ct,0,0,O),this.addCurrentVertex(U,Ct.mult(-1),0,0,O)}else if(he==="bevel"||he==="fakeround"){const ie=-Math.sqrt(Zt*Zt-1),ve=be?ie:0,le=be?0:ie;if(j&&this.addCurrentVertex(U,et,ve,le,O),he==="fakeround"){const $t=Math.round(180*Yt/Math.PI/20);for(let ke=1;ke<$t;ke++){let Ee=ke/$t;if(Ee!==.5){const Qn=Ee-.5;Ee+=Ee*Qn*(Ee-1)*((1.0904+yt*(yt*(3.55645-1.43519*yt)-3.2452))*Qn*Qn+(.848013+yt*(.215638*yt-1.06021)))}const hn=lt.sub(et)._mult(Ee)._add(et)._unit()._mult(be?-1:1);this.addHalfVertex(U,hn.x,hn.y,!1,be,0,O)}}Z&&this.addCurrentVertex(U,lt,-ve,-le,O)}else if(he==="butt")this.addCurrentVertex(U,Ct,0,0,O);else if(he==="square"){const ie=j?1:-1;this.addCurrentVertex(U,Ct,ie,ie,O)}else he==="round"&&(j&&(this.addCurrentVertex(U,et,0,0,O),this.addCurrentVertex(U,et,1,1,O,!0)),Z&&(this.addCurrentVertex(U,lt,-1,-1,O,!0),this.addCurrentVertex(U,lt,0,0,O)));if(me&&pt2*R){const ve=U.add(Z.sub(U)._mult(R/ie)._round());this.updateDistance(U,ve),this.addCurrentVertex(ve,lt,0,0,O),U=ve}}}}addCurrentVertex(o,c,p,g,b,x=!1){const E=c.y*g-c.x,L=-c.y-c.x*g;this.addHalfVertex(o,c.x+c.y*p,c.y-c.x*p,x,!1,p,b),this.addHalfVertex(o,E,L,x,!0,-g,b),this.distance>w1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,c,p,g,b,x))}addHalfVertex({x:o,y:c},p,g,b,x,E,L){const A=.5*(this.lineClips?this.scaledDistance*(w1-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(c<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*g)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const R=L.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),L.primitiveLength++),x?this.e2=R:this.e1=R}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,c){this.distance+=o.dist(c),this.updateScaledDistance()}}let S1,E1;_e("LineBucket",e_,{omit:["layers","patternFeatures"]});var I1={get paint(){return E1=E1||new ho({"line-opacity":new De(Mt.paint_line["line-opacity"]),"line-color":new De(Mt.paint_line["line-color"]),"line-translate":new Te(Mt.paint_line["line-translate"]),"line-translate-anchor":new Te(Mt.paint_line["line-translate-anchor"]),"line-width":new De(Mt.paint_line["line-width"]),"line-gap-width":new De(Mt.paint_line["line-gap-width"]),"line-offset":new De(Mt.paint_line["line-offset"]),"line-blur":new De(Mt.paint_line["line-blur"]),"line-dasharray":new ac(Mt.paint_line["line-dasharray"]),"line-pattern":new wh(Mt.paint_line["line-pattern"]),"line-gradient":new cp(Mt.paint_line["line-gradient"])})},get layout(){return S1=S1||new ho({"line-cap":new Te(Mt.layout_line["line-cap"]),"line-join":new De(Mt.layout_line["line-join"]),"line-miter-limit":new Te(Mt.layout_line["line-miter-limit"]),"line-round-limit":new Te(Mt.layout_line["line-round-limit"]),"line-sort-key":new De(Mt.layout_line["line-sort-key"])})}};class GC extends De{possiblyEvaluate(o,c){return c=new rr(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(o,c)}evaluate(o,c,p,g){return c=ft({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(o,c,p,g)}}let Nm;class qC extends ps{constructor(o){super(o,I1),this.gradientVersion=0,Nm||(Nm=new GC(I1.paint.properties["line-width"].specification),Nm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof $u,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,c){super.recalculate(o,c),this.paint._values["line-floorwidth"]=Nm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new e_(o)}queryRadius(o){const c=o,p=C1(Ep("line-width",this,c),Ep("line-gap-width",this,c)),g=Ep("line-offset",this,c);return p/2+Math.abs(g)+Lm(this.paint.get("line-translate"))}queryIntersectsFeature(o,c,p,g,b,x,E){const L=Pm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*C1(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),R=this.paint.get("line-offset").evaluate(c,p);return R&&(g=function(O,U){const j=[];for(let Z=0;Z=3){for(let lt=0;lt0?o+2*a:a}const jC=Or([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),WC=Or([{name:"a_projected_pos",components:3,type:"Float32"}],4);Or([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const HC=Or([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Or([{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 T1=Or([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ZC=Or([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function XC(a,o,c){return a.sections.forEach(p=>{p.text=function(g,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?g=g.toLocaleUpperCase():E==="lowercase"&&(g=g.toLocaleLowerCase()),Va.applyArabicShaping&&(g=Va.applyArabicShaping(g)),g}(p.text,o,c)}),a}Or([{name:"triangle",components:3,type:"Uint16"}]),Or([{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"}]),Or([{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"}]),Or([{type:"Float32",name:"offsetX"}]),Or([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Or([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Dp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ni=24,L1=Un,P1=function(a,o,c,p,g){var b,x,E=8*g-p-1,L=(1<>1,R=-7,O=c?g-1:0,U=c?-1:1,j=a[o+O];for(O+=U,b=j&(1<<-R)-1,j>>=-R,R+=E;R>0;b=256*b+a[o+O],O+=U,R-=8);for(x=b&(1<<-R)-1,b>>=-R,R+=p;R>0;x=256*x+a[o+O],O+=U,R-=8);if(b===0)b=1-A;else{if(b===L)return x?NaN:1/0*(j?-1:1);x+=Math.pow(2,p),b-=A}return(j?-1:1)*x*Math.pow(2,b-p)},M1=function(a,o,c,p,g,b){var x,E,L,A=8*b-g-1,R=(1<>1,U=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,j=p?0:b-1,Z=p?1:-1,et=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,x=R):(x=Math.floor(Math.log(o)/Math.LN2),o*(L=Math.pow(2,-x))<1&&(x--,L*=2),(o+=x+O>=1?U/L:U*Math.pow(2,1-O))*L>=2&&(x++,L/=2),x+O>=R?(E=0,x=R):x+O>=1?(E=(o*L-1)*Math.pow(2,g),x+=O):(E=o*Math.pow(2,O-1)*Math.pow(2,g),x=0));g>=8;a[c+j]=255&E,j+=Z,E/=256,g-=8);for(x=x<0;a[c+j]=255&x,j+=Z,x/=256,A-=8);a[c+j-Z]|=128*et};function Un(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}Un.Varint=0,Un.Fixed64=1,Un.Bytes=2,Un.Fixed32=5;var n_=4294967296,A1=1/n_,k1=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Ll(a){return a.type===Un.Bytes?a.readVarint()+a.pos:a.pos+1}function Oh(a,o,c){return c?4294967296*o+(a>>>0):4294967296*(o>>>0)+(a>>>0)}function D1(a,o,c){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));c.realloc(p);for(var g=c.pos-1;g>=a;g--)c.buf[g+p]=c.buf[g]}function YC(a,o){for(var c=0;c>>8,a[c+2]=o>>>16,a[c+3]=o>>>24}function R1(a,o){return(a[o]|a[o+1]<<8|a[o+2]<<16)+(a[o+3]<<24)}Un.prototype={destroy:function(){this.buf=null},readFields:function(a,o,c){for(c=c||this.length;this.pos>3,b=this.pos;this.type=7&p,a(g,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(a,o){return this.readFields(a,o,this.readVarint()+this.pos)},readFixed32:function(){var a=Om(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=R1(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=Om(this.buf,this.pos)+Om(this.buf,this.pos+4)*n_;return this.pos+=8,a},readSFixed64:function(){var a=Om(this.buf,this.pos)+R1(this.buf,this.pos+4)*n_;return this.pos+=8,a},readFloat:function(){var a=P1(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=P1(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(a){var o,c,p=this.buf;return o=127&(c=p[this.pos++]),c<128?o:(o|=(127&(c=p[this.pos++]))<<7,c<128?o:(o|=(127&(c=p[this.pos++]))<<14,c<128?o:(o|=(127&(c=p[this.pos++]))<<21,c<128?o:function(g,b,x){var E,L,A=x.buf;if(E=(112&(L=A[x.pos++]))>>4,L<128||(E|=(127&(L=A[x.pos++]))<<3,L<128)||(E|=(127&(L=A[x.pos++]))<<10,L<128)||(E|=(127&(L=A[x.pos++]))<<17,L<128)||(E|=(127&(L=A[x.pos++]))<<24,L<128)||(E|=(1&(L=A[x.pos++]))<<31,L<128))return Oh(g,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(c=p[this.pos]))<<28,a,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?(a+1)/-2:a/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var a=this.readVarint()+this.pos,o=this.pos;return this.pos=a,a-o>=12&&k1?function(c,p,g){return k1.decode(c.subarray(p,g))}(this.buf,o,a):function(c,p,g){for(var b="",x=p;x239?4:R>223?3:R>191?2:1;if(x+U>g)break;U===1?R<128&&(O=R):U===2?(192&(E=c[x+1]))==128&&(O=(31&R)<<6|63&E)<=127&&(O=null):U===3?(L=c[x+2],(192&(E=c[x+1]))==128&&(192&L)==128&&((O=(15&R)<<12|(63&E)<<6|63&L)<=2047||O>=55296&&O<=57343)&&(O=null)):U===4&&(L=c[x+2],A=c[x+3],(192&(E=c[x+1]))==128&&(192&L)==128&&(192&A)==128&&((O=(15&R)<<18|(63&E)<<12|(63&L)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,U=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=U}return b}(this.buf,o,a)},readBytes:function(){var a=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,a);return this.pos=a,o},readPackedVarint:function(a,o){if(this.type!==Un.Bytes)return a.push(this.readVarint(o));var c=Ll(this);for(a=a||[];this.pos127;);else if(o===Un.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Un.Fixed32)this.pos+=4;else{if(o!==Un.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(a,o){this.writeVarint(a<<3|o)},realloc:function(a){for(var o=this.length||16;o268435455||a<0?function(o,c){var p,g;if(o>=0?(p=o%4294967296|0,g=o/4294967296|0):(g=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,g=g+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");c.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,c),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(g,c)}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?2*-a-1:2*a)},writeBoolean:function(a){this.writeVarint(!!a)},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var o=this.pos;this.pos=function(p,g,b){for(var x,E,L=0;L55295&&x<57344){if(!E){x>56319||L+1===g.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,a,this.pos);var c=this.pos-o;c>=128&&D1(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeFloat:function(a){this.realloc(4),M1(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),M1(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(a){var o=a.length;this.writeVarint(o),this.realloc(o);for(var c=0;c=128&&D1(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p},writeMessage:function(a,o,c){this.writeTag(a,Un.Bytes),this.writeRawMessage(o,c)},writePackedVarint:function(a,o){o.length&&this.writeMessage(a,YC,o)},writePackedSVarint:function(a,o){o.length&&this.writeMessage(a,KC,o)},writePackedBoolean:function(a,o){o.length&&this.writeMessage(a,$C,o)},writePackedFloat:function(a,o){o.length&&this.writeMessage(a,JC,o)},writePackedDouble:function(a,o){o.length&&this.writeMessage(a,QC,o)},writePackedFixed32:function(a,o){o.length&&this.writeMessage(a,tT,o)},writePackedSFixed32:function(a,o){o.length&&this.writeMessage(a,eT,o)},writePackedFixed64:function(a,o){o.length&&this.writeMessage(a,nT,o)},writePackedSFixed64:function(a,o){o.length&&this.writeMessage(a,rT,o)},writeBytesField:function(a,o){this.writeTag(a,Un.Bytes),this.writeBytes(o)},writeFixed32Field:function(a,o){this.writeTag(a,Un.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(a,o){this.writeTag(a,Un.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(a,o){this.writeTag(a,Un.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(a,o){this.writeTag(a,Un.Fixed64),this.writeSFixed64(o)},writeVarintField:function(a,o){this.writeTag(a,Un.Varint),this.writeVarint(o)},writeSVarintField:function(a,o){this.writeTag(a,Un.Varint),this.writeSVarint(o)},writeStringField:function(a,o){this.writeTag(a,Un.Bytes),this.writeString(o)},writeFloatField:function(a,o){this.writeTag(a,Un.Fixed32),this.writeFloat(o)},writeDoubleField:function(a,o){this.writeTag(a,Un.Fixed64),this.writeDouble(o)},writeBooleanField:function(a,o){this.writeVarintField(a,!!o)}};var r_=y(L1);const i_=3;function iT(a,o,c){a===1&&c.readMessage(oT,o)}function oT(a,o,c){if(a===3){const{id:p,bitmap:g,width:b,height:x,left:E,top:L,advance:A}=c.readMessage(sT,{});o.push({id:p,bitmap:new Cp({width:b+2*i_,height:x+2*i_},g),metrics:{width:b,height:x,left:E,top:L,advance:A}})}}function sT(a,o,c){a===1?o.id=c.readVarint():a===2?o.bitmap=c.readBytes():a===3?o.width=c.readVarint():a===4?o.height=c.readVarint():a===5?o.left=c.readSVarint():a===6?o.top=c.readSVarint():a===7&&(o.advance=c.readVarint())}const N1=i_;function O1(a){let o=0,c=0;for(const x of a)o+=x.w*x.h,c=Math.max(c,x.w);a.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),c),h:1/0}];let g=0,b=0;for(const x of a)for(let E=p.length-1;E>=0;E--){const L=p[E];if(!(x.w>L.w||x.h>L.h)){if(x.x=L.x,x.y=L.y,b=Math.max(b,x.y+x.h),g=Math.max(g,x.x+x.w),x.w===L.w&&x.h===L.h){const A=p.pop();E=0&&p>=o&&Fm[this.text.charCodeAt(p)];p--)c--;this.text=this.text.substring(o,c),this.sectionIndex=this.sectionIndex.slice(o,c)}substring(o,c){const p=new Fh;return p.text=this.text.substring(o,c),p.sectionIndex=this.sectionIndex.slice(o,c),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,c)=>Math.max(o,this.sections[c].scale),0)}addTextSection(o,c){this.text+=o.text,this.sections.push(Np.forText(o.scale,o.fontStack||c));const p=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function zm(a,o,c,p,g,b,x,E,L,A,R,O,U,j,Z,et){const lt=Fh.fromFeature(a,g);let pt;O===h.ah.vertical&<.verticalizePunctuation();const{processBidirectionalText:Ct,processStyledBidirectionalText:yt}=Va;if(Ct&<.sections.length===1){pt=[];const Yt=Ct(lt.toString(),s_(lt,A,b,o,p,j,Z));for(const me of Yt){const be=new Fh;be.text=me,be.sections=lt.sections;for(let de=0;de0&&Ml>Ro&&(Ro=Ml)}else{const gs=be[gn.fontStack],Oo=gs&&gs[Ri];if(Oo&&Oo.rect)da=Oo.rect,Vs=Oo.metrics;else{const Ml=me[gn.fontStack],Vp=Ml&&Ml[Ri];if(!Vp)continue;Vs=Vp.metrics}ai=(oi-gn.scale)*ni}Us?(Yt.verticalizable=!0,Ji.push({glyph:Ri,imageName:ma,x:Qn,y:or+ai,vertical:Us,scale:gn.scale,fontStack:gn.fontStack,sectionIndex:Qi,metrics:Vs,rect:da}),Qn+=Pl*gn.scale+ke):(Ji.push({glyph:Ri,imageName:ma,x:Qn,y:or+ai,vertical:Us,scale:gn.scale,fontStack:gn.fontStack,sectionIndex:Qi,metrics:Vs,rect:da}),Qn+=Vs.advance*gn.scale+ke)}Ji.length!==0&&(ri=Math.max(Qn-ke,ri),uT(Ji,0,Ji.length-1,po,Ro)),Qn=0;const No=ie*oi+Ro;yo.lineOffset=Math.max(Ro,Ki),or+=No,Qo=Math.max(No,Qo),++Qr}var Ci;const Di=or-Rp,{horizontalAlign:mo,verticalAlign:go}=a_(ve);(function(ii,oi,Ki,yo,Ji,Ro,No,si,gn){const Qi=(oi-Ki)*Ji;let Ri=0;Ri=Ro!==No?-si*yo-Rp:(-yo*gn+.5)*No;for(const ai of ii)for(const Vs of ai.positionedGlyphs)Vs.x+=Qi,Vs.y+=Ri})(Yt.positionedLines,po,mo,go,ri,Qo,ie,Di,he.length),Yt.top+=-go*Di,Yt.bottom=Yt.top+Di,Yt.left+=-mo*ri,Yt.right=Yt.left+ri}(Zt,o,c,p,pt,x,E,L,O,A,U,et),!function(Yt){for(const me of Yt)if(me.positionedGlyphs.length!==0)return!1;return!0}(wt)&&Zt}const Fm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},aT={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 F1(a,o,c,p,g,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ni/b+g:0}{const x=c[o.fontStack],E=x&&x[a];return E?E.metrics.advance*o.scale+g:0}}function B1(a,o,c,p){const g=Math.pow(a-o,2);return p?a=0;let R=0;for(let U=0;Ux.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=Gy([]),this.placementViewportMatrix=Gy([]);const c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=q1(this.zoom,c["text-size"]),this.iconSizeData=q1(this.zoom,c["icon-size"]);const p=this.layers[0].layout,g=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=l_(p,"text-overlap","text-allow-overlap")!=="never"||l_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>h.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new c_(new mr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new c_(new mr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new I,this.symbolInstances=new m,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,c,p,g,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),R=L.value.kind!=="constant"||!!L.value.value||Object.keys(L.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!R)return;const U=c.iconDependencies,j=c.glyphDependencies,Z=c.availableImages,et=new rr(this.zoom);for(const{feature:lt,id:pt,index:Ct,sourceLayerIndex:yt}of o){const wt=g._featureFilter.needGeometry,Zt=Tl(lt,wt);if(!g._featureFilter.filter(et,Zt,p))continue;let Yt,me;if(wt||(Zt.geometry=Cl(lt)),A){const de=g.getValueAndResolveTokens("text-field",Zt,p,Z),he=Lo.factory(de),ie=this.hasRTLText=this.hasRTLText||pT(he);(!ie||Va.getRTLTextPluginStatus()==="unavailable"||ie&&Va.isParsed())&&(Yt=XC(he,g,Zt))}if(R){const de=g.getValueAndResolveTokens("icon-image",Zt,p,Z);me=de instanceof Yo?de:Yo.fromString(de)}if(!Yt&&!me)continue;const be=this.sortFeaturesByKey?O.evaluate(Zt,{},p):void 0;if(this.features.push({id:pt,text:Yt,icon:me,index:Ct,sourceLayerIndex:yt,geometry:Zt.geometry,properties:lt.properties,type:hT[lt.type],sortKey:be}),me&&(U[me.name]=!0),Yt){const de=x.evaluate(Zt,{},p).join(","),he=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.ah.vertical)>=0;for(const ie of Yt.sections)if(ie.image)U[ie.image.name]=!0;else{const ve=uu(Yt.toString()),le=ie.fontStack||de,$t=j[le]=j[le]||{};this.calculateGlyphDependencies(ie.text,$t,he,this.allowVerticalPlacement,ve)}}}b.get("symbol-placement")==="line"&&(this.features=function(lt){const pt={},Ct={},yt=[];let wt=0;function Zt(de){yt.push(lt[de]),wt++}function Yt(de,he,ie){const ve=Ct[de];return delete Ct[de],Ct[he]=ve,yt[ve].geometry[0].pop(),yt[ve].geometry[0]=yt[ve].geometry[0].concat(ie[0]),ve}function me(de,he,ie){const ve=pt[he];return delete pt[he],pt[de]=ve,yt[ve].geometry[0].shift(),yt[ve].geometry[0]=ie[0].concat(yt[ve].geometry[0]),ve}function be(de,he,ie){const ve=ie?he[0][he[0].length-1]:he[0][0];return`${de}:${ve.x}:${ve.y}`}for(let de=0;dede.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((lt,pt)=>lt.sortKey-pt.sortKey)}update(o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,c,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,c,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,c){const p=this.lineVertexArray.length;if(o.segment!==void 0){let g=o.dist(c[o.segment+1]),b=o.dist(c[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:c[E].x,y:c[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=c[E-1].dist(c[E]));for(let E=0;E0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(o,c){const p=o.placedSymbolArray.get(c),g=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;bg[E]-g[L]||b[L]-b[E]),x}addToSortKeyRanges(o,c){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===c?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const c of this.symbolInstanceIndexes){const p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((g,b,x)=>{g>=0&&x.indexOf(g)===b&&this.addIndicesForPlacedSymbol(this.text,g)}),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 j1,W1;_e("SymbolBucket",Bh,{omit:["layers","collisionBoxArray","features","compareText"]}),Bh.MAX_GLYPHS=65535,Bh.addDynamicAttributes=u_;var f_={get paint(){return W1=W1||new ho({"icon-opacity":new De(Mt.paint_symbol["icon-opacity"]),"icon-color":new De(Mt.paint_symbol["icon-color"]),"icon-halo-color":new De(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new De(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new De(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new Te(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Te(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new De(Mt.paint_symbol["text-opacity"]),"text-color":new De(Mt.paint_symbol["text-color"],{runtimeType:Lr,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new De(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new De(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new De(Mt.paint_symbol["text-halo-blur"]),"text-translate":new Te(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new Te(Mt.paint_symbol["text-translate-anchor"])})},get layout(){return j1=j1||new ho({"symbol-placement":new Te(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new Te(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Te(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new De(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Te(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Te(Mt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Te(Mt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Te(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Te(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Te(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new De(Mt.layout_symbol["icon-size"]),"icon-text-fit":new Te(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Te(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new De(Mt.layout_symbol["icon-image"]),"icon-rotate":new De(Mt.layout_symbol["icon-rotate"]),"icon-padding":new De(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new Te(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new De(Mt.layout_symbol["icon-offset"]),"icon-anchor":new De(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Te(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Te(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Te(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new De(Mt.layout_symbol["text-field"]),"text-font":new De(Mt.layout_symbol["text-font"]),"text-size":new De(Mt.layout_symbol["text-size"]),"text-max-width":new De(Mt.layout_symbol["text-max-width"]),"text-line-height":new Te(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new De(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new De(Mt.layout_symbol["text-justify"]),"text-radial-offset":new De(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Te(Mt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new De(Mt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new De(Mt.layout_symbol["text-anchor"]),"text-max-angle":new Te(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new Te(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new De(Mt.layout_symbol["text-rotate"]),"text-padding":new Te(Mt.layout_symbol["text-padding"]),"text-keep-upright":new Te(Mt.layout_symbol["text-keep-upright"]),"text-transform":new De(Mt.layout_symbol["text-transform"]),"text-offset":new De(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new Te(Mt.layout_symbol["text-allow-overlap"]),"text-overlap":new Te(Mt.layout_symbol["text-overlap"]),"text-ignore-placement":new Te(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new Te(Mt.layout_symbol["text-optional"])})}};class H1{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:Hr,this.defaultValue=o}evaluate(o){if(o.formattedSection){const c=this.defaultValue.property.overrides;if(c&&c.hasOverride(o.formattedSection))return c.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}_e("FormatSectionOverride",H1,{omit:["defaultValue"]});class Vm extends ps{constructor(o){super(o,f_)}recalculate(o,c){if(super.recalculate(o,c),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const g=[];for(const b of p)g.indexOf(b)<0&&g.push(b);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,c,p,g){const b=this.layout.get(o).evaluate(c,{},p,g),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||Wn(x.value)||!b?b:function(E,L){return L.replace(/{([^{}]+)}/g,(A,R)=>E&&R in E?String(E[R]):"")}(c.properties,b)}createBucket(o){return new Bh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of f_.paint.overridableProperties){if(!Vm.hasPaintOverride(this.layout,o))continue;const c=this.paint.get(o),p=new H1(c),g=new Jn(p,c.property.specification);let b=null;b=c.value.kind==="constant"||c.value.kind==="source"?new lh("source",g):new $f("composite",g,c.value.zoomStops),this.paint._values[o]=new fs(c.property,b,c.parameters)}}_handleOverridablePaintPropertyUpdate(o,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&Vm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,c){const p=o.get("text-field"),g=f_.paint.properties[c];let b=!1;const x=E=>{for(const L of E)if(g.overrides&&g.overrides.hasOverride(L))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Lo)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Na&&Xr(A.value)===Rr?x(A.value.sections):A instanceof sh?x(A.sections):A.eachChild(E))},L=p.value;L._styleExpression&&E(L._styleExpression.expression)}return b}}let Z1;var dT={get paint(){return Z1=Z1||new ho({"background-color":new Te(Mt.paint_background["background-color"]),"background-pattern":new ac(Mt.paint_background["background-pattern"]),"background-opacity":new Te(Mt.paint_background["background-opacity"])})}};class mT extends ps{constructor(o){super(o,dT)}}let X1;var gT={get paint(){return X1=X1||new ho({"raster-opacity":new Te(Mt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Te(Mt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Te(Mt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Te(Mt.paint_raster["raster-brightness-max"]),"raster-saturation":new Te(Mt.paint_raster["raster-saturation"]),"raster-contrast":new Te(Mt.paint_raster["raster-contrast"]),"raster-resampling":new Te(Mt.paint_raster["raster-resampling"]),"raster-fade-duration":new Te(Mt.paint_raster["raster-fade-duration"])})}};class yT extends ps{constructor(o){super(o,gT)}}class _T extends ps{constructor(o){super(o,{}),this.onAdd=c=>{this.implementation.onAdd&&this.implementation.onAdd(c,c.painter.context.gl)},this.onRemove=c=>{this.implementation.onRemove&&this.implementation.onRemove(c,c.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class vT{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 p_=63710088e-1;class du{constructor(o,c){if(isNaN(o)||isNaN(c))throw new Error(`Invalid LngLat object: (${o}, ${c})`);if(this.lng=+o,this.lat=+c,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new du(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const c=Math.PI/180,p=this.lat*c,g=o.lat*c,b=Math.sin(p)*Math.sin(g)+Math.cos(p)*Math.cos(g)*Math.cos((o.lng-this.lng)*c);return p_*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof du)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new du(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new du(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 Y1=2*Math.PI*p_;function K1(a){return Y1*Math.cos(a*Math.PI/180)}function J1(a){return(180+a)/360}function Q1(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function $1(a,o){return a/K1(o)}function d_(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}class Um{constructor(o,c,p=0){this.x=+o,this.y=+c,this.z=+p}static fromLngLat(o,c=0){const p=du.convert(o);return new Um(J1(p.lng),Q1(p.lat),$1(c,p.lat))}toLngLat(){return new du(360*this.x-180,d_(this.y))}toAltitude(){return this.z*K1(d_(this.y))}meterInMercatorCoordinateUnits(){return 1/Y1*(o=d_(this.y),1/Math.cos(o*Math.PI/180));var o}}function tb(a,o,c){var p=2*Math.PI*6378137/256/Math.pow(2,c);return[a*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class m_{constructor(o,c,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||c<0||c>=Math.pow(2,o))throw new Error(`x=${c}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=c,this.y=p,this.key=zp(0,o,o,c,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,c,p){const g=(x=this.y,E=this.z,L=tb(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=tb(256*(b+1),256*(x+1),E),L[0]+","+L[1]+","+A[0]+","+A[1]);var b,x,E,L,A;const R=function(O,U,j){let Z,et="";for(let lt=O;lt>0;lt--)Z=1<1?"@2x":"").replace(/{quadkey}/g,R).replace(/{bbox-epsg-3857}/g,g)}isChildOf(o){const c=this.z-o.z;return c>0&&o.x===this.x>>c&&o.y===this.y>>c}getTilePoint(o){const c=Math.pow(2,this.z);return new C((o.x*c-this.x)*Pr,(o.y*c-this.y)*Pr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class eb{constructor(o,c){this.wrap=o,this.canonical=c,this.key=zp(o,c.z,c.z,c.x,c.y)}}class ms{constructor(o,c,p,g,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=c,this.canonical=new m_(p,+g,+b),this.key=zp(c,o,p,g,b)}clone(){return new ms(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const c=this.canonical.z-o;return o>this.canonical.z?new ms(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ms(o,this.wrap,o,this.canonical.x>>c,this.canonical.y>>c)}calculateScaledKey(o,c){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?zp(this.wrap*+c,o,this.canonical.z,this.canonical.x,this.canonical.y):zp(this.wrap*+c,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const c=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>c&&o.canonical.y===this.canonical.y>>c}children(o){if(this.overscaledZ>=o)return[new ms(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const c=this.canonical.z+1,p=2*this.canonical.x,g=2*this.canonical.y;return[new ms(c,this.wrap,c,p,g),new ms(c,this.wrap,c,p+1,g),new ms(c,this.wrap,c,p,g+1),new ms(c,this.wrap,c,p+1,g+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||c<-1||c>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(c+1)*this.stride+(o+1)}unpack(o,c,p){return o*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new ds({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,c,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let g=c*this.dim,b=c*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(c){case-1:g=b-1;break;case 1:b=g+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const L=-c*this.dim,A=-p*this.dim;for(let R=x;R=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class ib{constructor(o,c,p,g,b){this.type="Feature",this._vectorTileFeature=o,o._z=c,o._x=p,o._y=g,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&(o[c]=this[c]);return o}}class ob{constructor(o,c){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new ic(Pr,16,0),this.grid3D=new ic(Pr,16,0),this.featureIndexArray=new z,this.promoteId=c}insert(o,c,p,g,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,g,b);const L=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&L.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new hu.VectorTile(new r_(this.rawTileData)).layers,this.sourceLayerCoder=new rb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,c,p,g){this.loadVTLayers();const b=o.params||{},x=Pr/o.tileSize/o.scale,E=fh(b.filter),L=o.queryGeometry,A=o.queryPadding*x,R=ab(L),O=this.grid.query(R.minX-A,R.minY-A,R.maxX+A,R.maxY+A),U=ab(o.cameraQueryGeometry),j=this.grid3D.query(U.minX-A,U.minY-A,U.maxX+A,U.maxY+A,(lt,pt,Ct,yt)=>function(wt,Zt,Yt,me,be){for(const he of wt)if(Zt<=he.x&&Yt<=he.y&&me>=he.x&&be>=he.y)return!0;const de=[new C(Zt,Yt),new C(Zt,be),new C(me,be),new C(me,Yt)];if(wt.length>2){for(const he of de)if(kh(wt,he))return!0}for(let he=0;he(yt||(yt=Cl(wt)),Zt.queryIntersectsFeature(L,wt,Yt,yt,this.z,o.transform,x,o.pixelPosMatrix)))}return Z}loadMatchingFeature(o,c,p,g,b,x,E,L,A,R,O){const U=this.bucketLayerIDs[c];if(x&&!function(lt,pt){for(let Ct=0;Ct=0)return!0;return!1}(x,U))return;const j=this.sourceLayerCoder.decode(p),Z=this.vtLayers[j].feature(g);if(b.needGeometry){const lt=Tl(Z,!0);if(!b.filter(new rr(this.tileID.overscaledZ),lt,this.tileID.canonical))return}else if(!b.filter(new rr(this.tileID.overscaledZ),Z))return;const et=this.getId(Z,j);for(let lt=0;lt{const E=o instanceof sc?o.get(x):null;return E&&E.evaluate?E.evaluate(c,p,g):E})}function ab(a){let o=1/0,c=1/0,p=-1/0,g=-1/0;for(const b of a)o=Math.min(o,b.x),c=Math.min(c,b.y),p=Math.max(p,b.x),g=Math.max(g,b.y);return{minX:o,minY:c,maxX:p,maxY:g}}function bT(a,o){return o-a}function lb(a,o,c,p,g){const b=[];for(let x=0;x=p&&O.x>=p||(R.x>=p?R=new C(p,R.y+(p-R.x)/(O.x-R.x)*(O.y-R.y))._round():O.x>=p&&(O=new C(p,R.y+(p-R.x)/(O.x-R.x)*(O.y-R.y))._round()),R.y>=g&&O.y>=g||(R.y>=g?R=new C(R.x+(g-R.y)/(O.y-R.y)*(O.x-R.x),g)._round():O.y>=g&&(O=new C(R.x+(g-R.y)/(O.y-R.y)*(O.x-R.x),g)._round()),L&&R.equals(L[L.length-1])||(L=[R],b.push(L)),L.push(O)))))}}return b}_e("FeatureIndex",ob,{omit:["rawTileData","sourceLayerCoder"]});class mu extends C{constructor(o,c,p,g){super(o,c),this.angle=p,g!==void 0&&(this.segment=g)}clone(){return new mu(this.x,this.y,this.angle,this.segment)}}function ub(a,o,c,p,g){if(o.segment===void 0||c===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-c/2;){if(x--,x<0)return!1;E-=a[x].dist(b),b=a[x]}E+=a[x].dist(a[x+1]),x++;const L=[];let A=0;for(;Ep;)A-=L.shift().angleDelta;if(A>g)return!1;x++,E+=R.dist(O)}return!0}function cb(a){let o=0;for(let c=0;cA){const Z=(A-L)/j,et=Xi.number(O.x,U.x,Z),lt=Xi.number(O.y,U.y,Z),pt=new mu(et,lt,U.angleTo(O),R);return pt._round(),!x||ub(a,pt,E,x,o)?pt:void 0}L+=j}}function wT(a,o,c,p,g,b,x,E,L){const A=hb(p,b,x),R=fb(p,g),O=R*x,U=a[0].x===0||a[0].x===L||a[0].y===0||a[0].y===L;return o-O=0&&wt=0&&Zt=0&&U+A<=R){const Yt=new mu(wt,Zt,Ct,Z);Yt._round(),p&&!ub(a,Yt,b,p,g)||j.push(Yt)}}O+=pt}return E||j.length||x||(j=pb(a,O/2,c,p,g,b,x,!0,L)),j}_e("Anchor",mu);const Vh=Do;function db(a,o,c,p){const g=[],b=a.image,x=b.pixelRatio,E=b.paddedRect.w-2*Vh,L=b.paddedRect.h-2*Vh,A=a.right-a.left,R=a.bottom-a.top,O=b.stretchX||[[0,E]],U=b.stretchY||[[0,L]],j=(ie,ve)=>ie+ve[1]-ve[0],Z=O.reduce(j,0),et=U.reduce(j,0),lt=E-Z,pt=L-et;let Ct=0,yt=Z,wt=0,Zt=et,Yt=0,me=lt,be=0,de=pt;if(b.content&&p){const ie=b.content;Ct=Gm(O,0,ie[0]),wt=Gm(U,0,ie[1]),yt=Gm(O,ie[0],ie[2]),Zt=Gm(U,ie[1],ie[3]),Yt=ie[0]-Ct,be=ie[1]-wt,me=ie[2]-ie[0]-yt,de=ie[3]-ie[1]-Zt}const he=(ie,ve,le,$t)=>{const ke=qm(ie.stretch-Ct,yt,A,a.left),Ee=jm(ie.fixed-Yt,me,ie.stretch,Z),hn=qm(ve.stretch-wt,Zt,R,a.top),Qn=jm(ve.fixed-be,de,ve.stretch,et),or=qm(le.stretch-Ct,yt,A,a.left),ri=jm(le.fixed-Yt,me,le.stretch,Z),Qo=qm($t.stretch-wt,Zt,R,a.top),po=jm($t.fixed-be,de,$t.stretch,et),Qr=new C(ke,hn),Ci=new C(or,hn),Di=new C(or,Qo),mo=new C(ke,Qo),go=new C(Ee/x,Qn/x),ii=new C(ri/x,po/x),oi=o*Math.PI/180;if(oi){const Ji=Math.sin(oi),Ro=Math.cos(oi),No=[Ro,-Ji,Ji,Ro];Qr._matMult(No),Ci._matMult(No),mo._matMult(No),Di._matMult(No)}const Ki=ie.stretch+ie.fixed,yo=ve.stretch+ve.fixed;return{tl:Qr,tr:Ci,bl:mo,br:Di,tex:{x:b.paddedRect.x+Vh+Ki,y:b.paddedRect.y+Vh+yo,w:le.stretch+le.fixed-Ki,h:$t.stretch+$t.fixed-yo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:go,pixelOffsetBR:ii,minFontScaleX:me/x/A,minFontScaleY:de/x/R,isSDF:c}};if(p&&(b.stretchX||b.stretchY)){const ie=mb(O,lt,Z),ve=mb(U,pt,et);for(let le=0;le0&&(Z=Math.max(10,Z),this.circleDiameter=Z)}else{let O=x.top*E-L[0],U=x.bottom*E+L[2],j=x.left*E-L[3],Z=x.right*E+L[1];const et=x.collisionPadding;if(et&&(j-=et[0]*E,O-=et[1]*E,Z+=et[2]*E,U+=et[3]*E),R){const lt=new C(j,O),pt=new C(Z,O),Ct=new C(j,U),yt=new C(Z,U),wt=R*Math.PI/180;lt._rotate(wt),pt._rotate(wt),Ct._rotate(wt),yt._rotate(wt),j=Math.min(lt.x,pt.x,Ct.x,yt.x),Z=Math.max(lt.x,pt.x,Ct.x,yt.x),O=Math.min(lt.y,pt.y,Ct.y,yt.y),U=Math.max(lt.y,pt.y,Ct.y,yt.y)}o.emplaceBack(c.x,c.y,j,O,Z,U,p,g,b)}this.boxEndIndex=o.length}}class ST{constructor(o=[],c=ET){if(this.data=o,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],c=this.data.pop();return this.length--,this.length>0&&(this.data[0]=c,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:c,compare:p}=this,g=c[o];for(;o>0;){const b=o-1>>1,x=c[b];if(p(g,x)>=0)break;c[o]=x,o=b}c[o]=g}_down(o){const{data:c,compare:p}=this,g=this.length>>1,b=c[o];for(;o=0)break;c[o]=E,o=x}c[o]=b}}function ET(a,o){return ao?1:0}function IT(a,o=1,c=!1){let p=1/0,g=1/0,b=-1/0,x=-1/0;const E=a[0];for(let j=0;jb)&&(b=Z.x),(!j||Z.y>x)&&(x=Z.y)}const L=Math.min(b-p,x-g);let A=L/2;const R=new ST([],CT);if(L===0)return new C(p,g);for(let j=p;jO.d||!O.d)&&(O=j,c&&console.log("found best %d after %d probes",Math.round(1e4*j.d)/1e4,U)),j.max-O.d<=o||(A=j.h/2,R.push(new Uh(j.p.x-A,j.p.y-A,A,a)),R.push(new Uh(j.p.x+A,j.p.y-A,A,a)),R.push(new Uh(j.p.x-A,j.p.y+A,A,a)),R.push(new Uh(j.p.x+A,j.p.y+A,A,a)),U+=4)}return c&&(console.log(`num probes: ${U}`),console.log(`best distance: ${O.d}`)),O.p}function CT(a,o){return o.max-a.max}function Uh(a,o,c,p){this.p=new C(a,o),this.h=c,this.d=function(g,b){let x=!1,E=1/0;for(let L=0;Lg.y!=Z.y>g.y&&g.x<(Z.x-j.x)*(g.y-j.y)/(Z.y-j.y)+j.x&&(x=!x),E=Math.min(E,Qv(g,j,Z))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var ki;h.ap=void 0,(ki=h.ap||(h.ap={}))[ki.center=1]="center",ki[ki.left=2]="left",ki[ki.right=3]="right",ki[ki.top=4]="top",ki[ki.bottom=5]="bottom",ki[ki["top-left"]=6]="top-left",ki[ki["top-right"]=7]="top-right",ki[ki["bottom-left"]=8]="bottom-left",ki[ki["bottom-right"]=9]="bottom-right";const gu=7,g_=Number.POSITIVE_INFINITY;function gb(a,o){return o[1]!==g_?function(c,p,g){let b=0,x=0;switch(p=Math.abs(p),g=Math.abs(g),c){case"top-right":case"top-left":case"top":x=g-gu;break;case"bottom-right":case"bottom-left":case"bottom":x=-g+gu}switch(c){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(a,o[0],o[1]):function(c,p){let g=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(c){case"top-right":case"top-left":b=x-gu;break;case"bottom-right":case"bottom-left":b=-x+gu;break;case"bottom":b=-p+gu;break;case"top":b=p-gu}switch(c){case"top-right":case"bottom-right":g=-x;break;case"top-left":case"bottom-left":g=x;break;case"left":g=p;break;case"right":g=-p}return[g,b]}(a,o[0])}function yb(a,o,c){var p;const g=a.layout,b=(p=g.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},c);if(b){const E=b.values,L=[];for(let A=0;AU*ni);R.startsWith("top")?O[1]-=gu:R.startsWith("bottom")&&(O[1]+=gu),L[A+1]=O}return new Xo(L)}const x=g.get("text-variable-anchor");if(x){let E;E=a._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(o,{},c)*ni,g_]:g.get("text-offset").evaluate(o,{},c).map(A=>A*ni);const L=[];for(const A of x)L.push(A,gb(A,E));return new Xo(L)}return null}function y_(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function TT(a,o,c,p,g,b,x,E,L,A,R){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const U=a.layers[0].layout,j=U.get("icon-offset").evaluate(o,{},R),Z=vb(c.horizontal),et=x/24,lt=a.tilePixelRatio*et,pt=a.tilePixelRatio*O/24,Ct=a.tilePixelRatio*E,yt=a.tilePixelRatio*U.get("symbol-spacing"),wt=U.get("text-padding")*a.tilePixelRatio,Zt=function($t,ke,Ee,hn=1){const Qn=$t.get("icon-padding").evaluate(ke,{},Ee),or=Qn&&Qn.values;return[or[0]*hn,or[1]*hn,or[2]*hn,or[3]*hn]}(U,o,R,a.tilePixelRatio),Yt=U.get("text-max-angle")/180*Math.PI,me=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",be=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",de=U.get("symbol-placement"),he=yt/2,ie=U.get("icon-text-fit");let ve;p&&ie!=="none"&&(a.allowVerticalPlacement&&c.vertical&&(ve=G1(p,c.vertical,ie,U.get("icon-text-fit-padding"),j,et)),Z&&(p=G1(p,Z,ie,U.get("icon-text-fit-padding"),j,et)));const le=($t,ke)=>{ke.x<0||ke.x>=Pr||ke.y<0||ke.y>=Pr||function(Ee,hn,Qn,or,ri,Qo,po,Qr,Ci,Di,mo,go,ii,oi,Ki,yo,Ji,Ro,No,si,gn,Qi,Ri,ai,Vs){const da=Ee.addToLineVertexArray(hn,Qn);let ma,Pl,Us,gs,Oo=0,Ml=0,Vp=0,Sb=0,I_=-1,C_=-1;const Al={};let Eb=wr("");if(Ee.allowVerticalPlacement&&or.vertical){const $i=Qr.layout.get("text-rotate").evaluate(gn,{},ai)+90;Us=new Wm(Ci,hn,Di,mo,go,or.vertical,ii,oi,Ki,$i),po&&(gs=new Wm(Ci,hn,Di,mo,go,po,Ji,Ro,Ki,$i))}if(ri){const $i=Qr.layout.get("icon-rotate").evaluate(gn,{}),ys=Qr.layout.get("icon-text-fit")!=="none",mc=db(ri,$i,Ri,ys),ya=po?db(po,$i,Ri,ys):void 0;Pl=new Wm(Ci,hn,Di,mo,go,ri,Ji,Ro,!1,$i),Oo=4*mc.length;const gc=Ee.iconSizeData;let Wa=null;gc.kind==="source"?(Wa=[ja*Qr.layout.get("icon-size").evaluate(gn,{})],Wa[0]>pu&&Qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${Op}. Reduce your "icon-size".`)):gc.kind==="composite"&&(Wa=[ja*Qi.compositeIconSizes[0].evaluate(gn,{},ai),ja*Qi.compositeIconSizes[1].evaluate(gn,{},ai)],(Wa[0]>pu||Wa[1]>pu)&&Qt(`${Ee.layerIds[0]}: Value for "icon-size" is >= ${Op}. Reduce your "icon-size".`)),Ee.addSymbols(Ee.icon,mc,Wa,si,No,gn,h.ah.none,hn,da.lineStartIndex,da.lineLength,-1,ai),I_=Ee.icon.placedSymbolArray.length-1,ya&&(Ml=4*ya.length,Ee.addSymbols(Ee.icon,ya,Wa,si,No,gn,h.ah.vertical,hn,da.lineStartIndex,da.lineLength,-1,ai),C_=Ee.icon.placedSymbolArray.length-1)}const Ib=Object.keys(or.horizontal);for(const $i of Ib){const ys=or.horizontal[$i];if(!ma){Eb=wr(ys.text);const ya=Qr.layout.get("text-rotate").evaluate(gn,{},ai);ma=new Wm(Ci,hn,Di,mo,go,ys,ii,oi,Ki,ya)}const mc=ys.positionedLines.length===1;if(Vp+=_b(Ee,hn,ys,Qo,Qr,Ki,gn,yo,da,or.vertical?h.ah.horizontal:h.ah.horizontalOnly,mc?Ib:[$i],Al,I_,Qi,ai),mc)break}or.vertical&&(Sb+=_b(Ee,hn,or.vertical,Qo,Qr,Ki,gn,yo,da,h.ah.vertical,["vertical"],Al,C_,Qi,ai));const MT=ma?ma.boxStartIndex:Ee.collisionBoxArray.length,AT=ma?ma.boxEndIndex:Ee.collisionBoxArray.length,kT=Us?Us.boxStartIndex:Ee.collisionBoxArray.length,DT=Us?Us.boxEndIndex:Ee.collisionBoxArray.length,RT=Pl?Pl.boxStartIndex:Ee.collisionBoxArray.length,NT=Pl?Pl.boxEndIndex:Ee.collisionBoxArray.length,OT=gs?gs.boxStartIndex:Ee.collisionBoxArray.length,zT=gs?gs.boxEndIndex:Ee.collisionBoxArray.length;let ga=-1;const Zm=($i,ys)=>$i&&$i.circleDiameter?Math.max($i.circleDiameter,ys):ys;ga=Zm(ma,ga),ga=Zm(Us,ga),ga=Zm(Pl,ga),ga=Zm(gs,ga);const Cb=ga>-1?1:0;Cb&&(ga*=Vs/ni),Ee.glyphOffsetArray.length>=Bh.MAX_GLYPHS&&Qt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),gn.sortKey!==void 0&&Ee.addToSortKeyRanges(Ee.symbolInstances.length,gn.sortKey);const FT=yb(Qr,gn,ai),[BT,VT]=function($i,ys){const mc=$i.length,ya=ys==null?void 0:ys.values;if((ya==null?void 0:ya.length)>0)for(let gc=0;gc=0?Al.right:-1,Al.center>=0?Al.center:-1,Al.left>=0?Al.left:-1,Al.vertical||-1,I_,C_,Eb,MT,AT,kT,DT,RT,NT,OT,zT,Di,Vp,Sb,Oo,Ml,Cb,0,ii,ga,BT,VT)}(a,ke,$t,c,p,g,ve,a.layers[0],a.collisionBoxArray,o.index,o.sourceLayerIndex,a.index,lt,[wt,wt,wt,wt],me,L,Ct,Zt,be,j,o,b,A,R,x)};if(de==="line")for(const $t of lb(o.geometry,0,0,Pr,Pr)){const ke=wT($t,yt,Yt,c.vertical||Z,p,24,pt,a.overscaling,Pr);for(const Ee of ke)Z&<(a,Z.text,he,Ee)||le($t,Ee)}else if(de==="line-center"){for(const $t of o.geometry)if($t.length>1){const ke=xT($t,Yt,c.vertical||Z,p,24,pt);ke&&le($t,ke)}}else if(o.type==="Polygon")for(const $t of Yy(o.geometry,0)){const ke=IT($t,16);le($t[0],new mu(ke.x,ke.y,0))}else if(o.type==="LineString")for(const $t of o.geometry)le($t,new mu($t[0].x,$t[0].y,0));else if(o.type==="Point")for(const $t of o.geometry)for(const ke of $t)le([ke],new mu(ke.x,ke.y,0))}function _b(a,o,c,p,g,b,x,E,L,A,R,O,U,j,Z){const et=function(Ct,yt,wt,Zt,Yt,me,be,de){const he=Zt.layout.get("text-rotate").evaluate(me,{})*Math.PI/180,ie=[];for(const ve of yt.positionedLines)for(const le of ve.positionedGlyphs){if(!le.rect)continue;const $t=le.rect||{};let ke=N1+1,Ee=!0,hn=1,Qn=0;const or=(Yt||de)&&le.vertical,ri=le.metrics.advance*le.scale/2;if(de&&yt.verticalizable&&(Qn=ve.lineOffset/2-(le.imageName?-(ni-le.metrics.width*le.scale)/2:(le.scale-1)*ni)),le.imageName){const si=be[le.imageName];Ee=si.sdf,hn=si.pixelRatio,ke=Do/hn}const Qo=Yt?[le.x+ri,le.y]:[0,0];let po=Yt?[0,0]:[le.x+ri+wt[0],le.y+wt[1]-Qn],Qr=[0,0];or&&(Qr=po,po=[0,0]);const Ci=le.metrics.isDoubleResolution?2:1,Di=(le.metrics.left-ke)*le.scale-ri+po[0],mo=(-le.metrics.top-ke)*le.scale+po[1],go=Di+$t.w/Ci*le.scale/hn,ii=mo+$t.h/Ci*le.scale/hn,oi=new C(Di,mo),Ki=new C(go,mo),yo=new C(Di,ii),Ji=new C(go,ii);if(or){const si=new C(-ri,ri-Rp),gn=-Math.PI/2,Qi=ni/2-ri,Ri=new C(5-Rp-Qi,-(le.imageName?Qi:0)),ai=new C(...Qr);oi._rotateAround(gn,si)._add(Ri)._add(ai),Ki._rotateAround(gn,si)._add(Ri)._add(ai),yo._rotateAround(gn,si)._add(Ri)._add(ai),Ji._rotateAround(gn,si)._add(Ri)._add(ai)}if(he){const si=Math.sin(he),gn=Math.cos(he),Qi=[gn,-si,si,gn];oi._matMult(Qi),Ki._matMult(Qi),yo._matMult(Qi),Ji._matMult(Qi)}const Ro=new C(0,0),No=new C(0,0);ie.push({tl:oi,tr:Ki,bl:yo,br:Ji,tex:$t,writingMode:yt.writingMode,glyphOffset:Qo,sectionIndex:le.sectionIndex,isSDF:Ee,pixelOffsetTL:Ro,pixelOffsetBR:No,minFontScaleX:0,minFontScaleY:0})}return ie}(0,c,E,g,b,x,p,a.allowVerticalPlacement),lt=a.textSizeData;let pt=null;lt.kind==="source"?(pt=[ja*g.layout.get("text-size").evaluate(x,{})],pt[0]>pu&&Qt(`${a.layerIds[0]}: Value for "text-size" is >= ${Op}. Reduce your "text-size".`)):lt.kind==="composite"&&(pt=[ja*j.compositeTextSizes[0].evaluate(x,{},Z),ja*j.compositeTextSizes[1].evaluate(x,{},Z)],(pt[0]>pu||pt[1]>pu)&&Qt(`${a.layerIds[0]}: Value for "text-size" is >= ${Op}. Reduce your "text-size".`)),a.addSymbols(a.text,et,pt,E,b,x,A,o,L.lineStartIndex,L.lineLength,U,Z);for(const Ct of R)O[Ct]=a.text.placedSymbolArray.length-1;return 4*et.length}function vb(a){for(const o in a)return a[o];return null}function LT(a,o,c,p){const g=a.compareText;if(o in g){const b=g[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const b=bb[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new __(E,x,b,o)}constructor(o,c=64,p=Float64Array,g){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=bb.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,L=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+L),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+L,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=c,new Uint32Array(this.data,4,1)[0]=o)}add(o,c){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=c,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return v_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,c,p,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,L=[0,b.length-1,0],A=[];for(;L.length;){const R=L.pop()||0,O=L.pop()||0,U=L.pop()||0;if(O-U<=E){for(let lt=U;lt<=O;lt++){const pt=x[2*lt],Ct=x[2*lt+1];pt>=o&&pt<=p&&Ct>=c&&Ct<=g&&A.push(b[lt])}continue}const j=U+O>>1,Z=x[2*j],et=x[2*j+1];Z>=o&&Z<=p&&et>=c&&et<=g&&A.push(b[j]),(R===0?o<=Z:c<=et)&&(L.push(U),L.push(j-1),L.push(1-R)),(R===0?p>=Z:g>=et)&&(L.push(j+1),L.push(O),L.push(1-R))}return A}within(o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:b,nodeSize:x}=this,E=[0,g.length-1,0],L=[],A=p*p;for(;E.length;){const R=E.pop()||0,O=E.pop()||0,U=E.pop()||0;if(O-U<=x){for(let lt=U;lt<=O;lt++)wb(b[2*lt],b[2*lt+1],o,c)<=A&&L.push(g[lt]);continue}const j=U+O>>1,Z=b[2*j],et=b[2*j+1];wb(Z,et,o,c)<=A&&L.push(g[j]),(R===0?o-p<=Z:c-p<=et)&&(E.push(U),E.push(j-1),E.push(1-R)),(R===0?o+p>=Z:c+p>=et)&&(E.push(j+1),E.push(O),E.push(1-R))}return L}}function v_(a,o,c,p,g,b){if(g-p<=c)return;const x=p+g>>1;xb(a,o,x,p,g,b),v_(a,o,c,p,x-1,1-b),v_(a,o,c,x+1,g,1-b)}function xb(a,o,c,p,g,b){for(;g>p;){if(g-p>600){const A=g-p+1,R=c-p+1,O=Math.log(A),U=.5*Math.exp(2*O/3),j=.5*Math.sqrt(O*U*(A-U)/A)*(R-A/2<0?-1:1);xb(a,o,c,Math.max(p,Math.floor(c-R*U/A+j)),Math.min(g,Math.floor(c+(A-R)*U/A+j)),b)}const x=o[2*c+b];let E=p,L=g;for(Fp(a,o,p,c),o[2*g+b]>x&&Fp(a,o,p,g);Ex;)L--}o[2*p+b]===x?Fp(a,o,p,L):(L++,Fp(a,o,L,g)),L<=c&&(p=L+1),c<=L&&(g=L-1)}}function Fp(a,o,c,p){b_(a,c,p),b_(o,2*c,2*p),b_(o,2*c+1,2*p+1)}function b_(a,o,c){const p=a[o];a[o]=a[c],a[c]=p}function wb(a,o,c,p){const g=a-c,b=o-p;return g*g+b*b}var x_;h.bd=void 0,(x_=h.bd||(h.bd={})).create="create",x_.load="load",x_.fullLoad="fullLoad";let Hm=null,Bp=[];const w_=1e3/60,S_="loadTime",E_="fullLoadTime",PT={mark(a){performance.mark(a)},frame(a){const o=a;Hm!=null&&Bp.push(o-Hm),Hm=o},clearMetrics(){Hm=null,Bp=[],performance.clearMeasures(S_),performance.clearMeasures(E_);for(const a in h.bd)performance.clearMarks(h.bd[a])},getPerformanceMetrics(){performance.measure(S_,h.bd.create,h.bd.load),performance.measure(E_,h.bd.create,h.bd.fullLoad);const a=performance.getEntriesByName(S_)[0].duration,o=performance.getEntriesByName(E_)[0].duration,c=Bp.length,p=1/(Bp.reduce((b,x)=>b+x,0)/c/1e3),g=Bp.filter(b=>b>w_).reduce((b,x)=>b+(x-w_)/w_,0);return{loadTime:a,fullLoadTime:o,fps:p,percentDroppedFrames:g/(c+g)*100,totalFrames:c}}};h.$=se,h.A=Dh,h.B=function(a){if(Wt==null){const o=a.navigator?a.navigator.userAgent:null;Wt=!!a.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Wt},h.C=class{constructor(a,o){this.target=a,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vT(()=>this.process()),this.subscription=function(c,p,g,b){return c.addEventListener(p,g,!1),{unsubscribe:()=>{c.removeEventListener(p,g,!1)}}}(this.target,"message",c=>this.receive(c)),this.globalScope=fe(self)?a:window}registerMessageHandler(a,o){this.messageHandlers[a]=o}sendAsync(a,o){return new Promise((c,p)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:c,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const E={id:g,type:"",origin:location.origin,targetMapId:a.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},a),{id:g,sourceMapId:this.mapId,origin:location.origin,data:au(a.data,b)});this.target.postMessage(x,{transfer:b})})}receive(a){const o=a.data,c=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[c];const p=this.abortControllers[c];return delete this.abortControllers[c],void(p&&p.abort())}if(fe(self)||o.mustQueue)return this.tasks[c]=o,this.taskQueue.push(c),void this.invoker.trigger();this.processTask(c,o)}}process(){if(this.taskQueue.length===0)return;const a=this.taskQueue.shift(),o=this.tasks[a];delete this.tasks[a],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(a,o)}processTask(a,o){return u(this,void 0,void 0,function*(){if(o.type===""){const g=this.resolveRejects[a];return delete this.resolveRejects[a],g?void(o.error?g.reject(lu(o.error)):g.resolve(lu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(a,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const c=lu(o.data),p=new AbortController;this.abortControllers[a]=p;try{const g=yield this.messageHandlers[o.type](o.sourceMapId,c,p);this.completeTask(a,null,g)}catch(g){this.completeTask(a,g)}})}completeTask(a,o,c){const p=[];delete this.abortControllers[a];const g={id:a,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?au(o):null,data:au(c,p)};this.target.postMessage(g,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},h.D=Te,h.E=mn,h.F=function(){var a=new Dh(16);return Dh!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},h.G=kn,h.H=function(a,o,c){var p,g,b,x,E,L,A,R,O,U,j,Z,et=c[0],lt=c[1],pt=c[2];return o===a?(a[12]=o[0]*et+o[4]*lt+o[8]*pt+o[12],a[13]=o[1]*et+o[5]*lt+o[9]*pt+o[13],a[14]=o[2]*et+o[6]*lt+o[10]*pt+o[14],a[15]=o[3]*et+o[7]*lt+o[11]*pt+o[15]):(g=o[1],b=o[2],x=o[3],E=o[4],L=o[5],A=o[6],R=o[7],O=o[8],U=o[9],j=o[10],Z=o[11],a[0]=p=o[0],a[1]=g,a[2]=b,a[3]=x,a[4]=E,a[5]=L,a[6]=A,a[7]=R,a[8]=O,a[9]=U,a[10]=j,a[11]=Z,a[12]=p*et+E*lt+O*pt+o[12],a[13]=g*et+L*lt+U*pt+o[13],a[14]=b*et+A*lt+j*pt+o[14],a[15]=x*et+R*lt+Z*pt+o[15]),a},h.I=o_,h.J=function(a,o,c){var p=c[0],g=c[1],b=c[2];return a[0]=o[0]*p,a[1]=o[1]*p,a[2]=o[2]*p,a[3]=o[3]*p,a[4]=o[4]*g,a[5]=o[5]*g,a[6]=o[6]*g,a[7]=o[7]*g,a[8]=o[8]*b,a[9]=o[9]*b,a[10]=o[10]*b,a[11]=o[11]*b,a[12]=o[12],a[13]=o[13],a[14]=o[14],a[15]=o[15],a},h.K=n1,h.L=function(a,o){const c={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(c=>{o.onloadstart=()=>{c(o)};for(const p of a){const g=window.document.createElement("source");er(p)||(o.crossOrigin="Anonymous"),g.src=p,o.appendChild(g)}})},h.a3=function(){return rt++},h.a4=_,h.a5=Bh,h.a6=fh,h.a7=Tl,h.a8=rr,h.a9=ib,h.aA=$,h.aB=function(a,o){if(!a)return[{command:"setStyle",args:[o]}];let c=[];try{if(!on(a.version,o.version))return[{command:"setStyle",args:[o]}];on(a.center,o.center)||c.push({command:"setCenter",args:[o.center]}),on(a.zoom,o.zoom)||c.push({command:"setZoom",args:[o.zoom]}),on(a.bearing,o.bearing)||c.push({command:"setBearing",args:[o.bearing]}),on(a.pitch,o.pitch)||c.push({command:"setPitch",args:[o.pitch]}),on(a.sprite,o.sprite)||c.push({command:"setSprite",args:[o.sprite]}),on(a.glyphs,o.glyphs)||c.push({command:"setGlyphs",args:[o.glyphs]}),on(a.transition,o.transition)||c.push({command:"setTransition",args:[o.transition]}),on(a.light,o.light)||c.push({command:"setLight",args:[o.light]}),on(a.terrain,o.terrain)||c.push({command:"setTerrain",args:[o.terrain]}),on(a.sky,o.sky)||c.push({command:"setSky",args:[o.sky]});const p={},g=[];(function(x,E,L,A){let R;for(R in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,R)&&(Object.prototype.hasOwnProperty.call(E,R)||ls(R,L,A));for(R in E)Object.prototype.hasOwnProperty.call(E,R)&&(Object.prototype.hasOwnProperty.call(x,R)?on(x[R],E[R])||(x[R].type==="geojson"&&E[R].type==="geojson"&&Ra(x,E,R)?Hn(L,{command:"setGeoJSONSourceData",args:[R,E[R].data]}):ks(R,E,L,A)):To(R,E,L))})(a.sources,o.sources,g,p);const b=[];a.layers&&a.layers.forEach(x=>{"source"in x&&p[x.source]?c.push({command:"removeLayer",args:[x.id]}):b.push(x)}),c=c.concat(g),function(x,E,L){E=E||[];const A=(x=x||[]).map(gl),R=E.map(gl),O=x.reduce(us,{}),U=E.reduce(us,{}),j=A.slice(),Z=Object.create(null);let et,lt,pt,Ct,yt;for(let wt=0,Zt=0;wt@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(c,p,g,b)=>{const x=g||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const c=parseInt(o["max-age"],10);isNaN(c)?delete o["max-age"]:o["max-age"]=c}return o},h.ab=function(a,o){const c=[];for(const p in a)p in o||c.push(p);return c},h.ac=at,h.ad=function(a,o,c){var p=Math.sin(c),g=Math.cos(c),b=o[0],x=o[1],E=o[2],L=o[3],A=o[4],R=o[5],O=o[6],U=o[7];return o!==a&&(a[8]=o[8],a[9]=o[9],a[10]=o[10],a[11]=o[11],a[12]=o[12],a[13]=o[13],a[14]=o[14],a[15]=o[15]),a[0]=b*g+A*p,a[1]=x*g+R*p,a[2]=E*g+O*p,a[3]=L*g+U*p,a[4]=A*g-b*p,a[5]=R*g-x*p,a[6]=O*g-E*p,a[7]=U*g-L*p,a},h.ae=function(a){var o=new Dh(16);return o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=a[3],o[4]=a[4],o[5]=a[5],o[6]=a[6],o[7]=a[7],o[8]=a[8],o[9]=a[9],o[10]=a[10],o[11]=a[11],o[12]=a[12],o[13]=a[13],o[14]=a[14],o[15]=a[15],o},h.af=Mm,h.ag=function(a,o){let c=0,p=0;if(a.kind==="constant")p=a.layoutSize;else if(a.kind!=="source"){const{interpolationType:g,minZoom:b,maxZoom:x}=a,E=g?at(Ai.interpolationFactor(g,o,b,x),0,1):0;a.kind==="camera"?p=Xi.number(a.minSize,a.maxSize,E):c=E}return{uSizeT:c,uSize:p}},h.ai=function(a,{uSize:o,uSizeT:c},{lowerSize:p,upperSize:g}){return a.kind==="source"?p/ja:a.kind==="composite"?Xi.number(p/ja,g/ja,c):o},h.aj=u_,h.ak=function(a,o,c,p){const g=o.y-a.y,b=o.x-a.x,x=p.y-c.y,E=p.x-c.x,L=x*b-E*g;if(L===0)return null;const A=(E*(a.y-c.y)-x*(a.x-c.x))/L;return new C(a.x+A*b,a.y+A*g)},h.al=lb,h.am=bp,h.an=Gy,h.ao=ni,h.aq=l_,h.ar=function(a,o){var c=o[0],p=o[1],g=o[2],b=o[3],x=o[4],E=o[5],L=o[6],A=o[7],R=o[8],O=o[9],U=o[10],j=o[11],Z=o[12],et=o[13],lt=o[14],pt=o[15],Ct=c*E-p*x,yt=c*L-g*x,wt=c*A-b*x,Zt=p*L-g*E,Yt=p*A-b*E,me=g*A-b*L,be=R*et-O*Z,de=R*lt-U*Z,he=R*pt-j*Z,ie=O*lt-U*et,ve=O*pt-j*et,le=U*pt-j*lt,$t=Ct*le-yt*ve+wt*ie+Zt*he-Yt*de+me*be;return $t?(a[0]=(E*le-L*ve+A*ie)*($t=1/$t),a[1]=(g*ve-p*le-b*ie)*$t,a[2]=(et*me-lt*Yt+pt*Zt)*$t,a[3]=(U*Yt-O*me-j*Zt)*$t,a[4]=(L*he-x*le-A*de)*$t,a[5]=(c*le-g*he+b*de)*$t,a[6]=(lt*wt-Z*me-pt*yt)*$t,a[7]=(R*me-U*wt+j*yt)*$t,a[8]=(x*ve-E*he+A*be)*$t,a[9]=(p*he-c*ve-b*be)*$t,a[10]=(Z*Yt-et*wt+pt*Ct)*$t,a[11]=(O*wt-R*Yt-j*Ct)*$t,a[12]=(E*de-x*ie-L*be)*$t,a[13]=(c*ie-p*de+g*be)*$t,a[14]=(et*yt-Z*Zt-lt*Ct)*$t,a[15]=(R*Zt-O*yt+U*Ct)*$t,a):null},h.as=y_,h.at=a_,h.au=__,h.av=function(){const a={},o=Mt.$version;for(const c in Mt.$root){const p=Mt.$root[c];if(p.required){let g=null;g=c==="version"?o:p.type==="array"?[]:{},g!=null&&(a[c]=g)}}return a},h.aw=gm,h.ax=Wr,h.ay=function(a){a=a.slice();const o=Object.create(null);for(let c=0;c$t*ni)}let de=x?"center":c.get("text-justify").evaluate(A,{},a.canonical);const he=c.get("symbol-placement"),ie=he==="point"?c.get("text-max-width").evaluate(A,{},a.canonical)*ni:0,ve=()=>{a.bucket.allowVerticalPlacement&&uu(wt)&&(Z.vertical=zm(et,a.glyphMap,a.glyphPositions,a.imagePositions,R,ie,b,me,"left",Yt,pt,h.ah.vertical,!0,he,U,O))};if(!x&&be){const le=new Set;if(de==="auto")for(let ke=0;keu(void 0,void 0,void 0,function*(){if(a.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(a)],{type:"image/png"});try{return createImageBitmap(o)}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),h.e=ft,h.f=a=>new Promise((o,c)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=ze})},p.onerror=()=>c(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const g=new Blob([new Uint8Array(a)],{type:"image/png"});p.src=a.byteLength?URL.createObjectURL(g):ze}),h.g=cn,h.h=(a,o)=>hr(ft(a,{type:"json"}),o),h.i=fe,h.j=ce,h.k=xt,h.l=(a,o)=>hr(ft(a,{type:"arrayBuffer"}),o),h.m=hr,h.n=function(a){return new r_(a).readFields(iT,[])},h.o=Cp,h.p=O1,h.q=ho,h.r=Fy,h.s=er,h.t=su,h.u=pe,h.v=Mt,h.w=Qt,h.x=Sl,h.y=function([a,o,c]){return o+=90,o*=Math.PI/180,c*=Math.PI/180,{x:a*Math.cos(o)*Math.sin(c),y:a*Math.sin(o)*Math.sin(c),z:a*Math.cos(c)}},h.z=Xi}),i("worker",["./shared"],function(h){class u{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,q){for(const it of V){this._layerConfigs[it.id]=it;const vt=this._layers[it.id]=h.az(it);vt._featureFilter=h.a6(vt.filter),this.keyCache[it.id]&&delete this.keyCache[it.id]}for(const it of q)delete this.keyCache[it],delete this._layerConfigs[it],delete this._layers[it];this.familiesBySource={};const X=h.bh(Object.values(this._layerConfigs),this.keyCache);for(const it of X){const vt=it.map(Ut=>this._layers[Ut.id]),Q=vt[0];if(Q.visibility==="none")continue;const bt=Q.source||"";let dt=this.familiesBySource[bt];dt||(dt=this.familiesBySource[bt]={});const It=Q.sourceLayer||"_geojsonTileLayer";let Ot=dt[It];Ot||(Ot=dt[It]=[]),Ot.push(vt)}}}class y{constructor(V){const q={},X=[];for(const bt in V){const dt=V[bt],It=q[bt]={};for(const Ot in dt){const Ut=dt[+Ot];if(!Ut||Ut.bitmap.width===0||Ut.bitmap.height===0)continue;const Ht={x:0,y:0,w:Ut.bitmap.width+2,h:Ut.bitmap.height+2};X.push(Ht),It[Ot]={rect:Ht,metrics:Ut.metrics}}}const{w:it,h:vt}=h.p(X),Q=new h.o({width:it||1,height:vt||1});for(const bt in V){const dt=V[bt];for(const It in dt){const Ot=dt[+It];if(!Ot||Ot.bitmap.width===0||Ot.bitmap.height===0)continue;const Ut=q[bt][It].rect;h.o.copy(Ot.bitmap,Q,{x:0,y:0},{x:Ut.x+1,y:Ut.y+1},Ot.bitmap)}}this.image=Q,this.positions=q}}h.bi("GlyphAtlas",y);class w{constructor(V){this.tileID=new h.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,q,X,it){return h._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new h.a4;const vt=new h.bj(Object.keys(V.layers).sort()),Q=new h.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const bt={},dt={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X},It=q.familiesBySource[this.source];for(const nn in It){const vr=V.layers[nn];if(!vr)continue;vr.version===1&&h.w(`Vector tile source "${this.source}" layer "${nn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const $r=vt.encode(nn),Zi=[];for(let lo=0;lo=gi.maxzoom||gi.visibility!=="none"&&(S(lo,this.zoom,X),(bt[gi.id]=gi.createBucket({index:Q.bucketLayerIDs.length,layers:lo,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$r,sourceID:this.source})).populate(Zi,dt,this.tileID.canonical),Q.bucketLayerIDs.push(lo.map(Ds=>Ds.id)))}}const Ot=h.aE(dt.glyphDependencies,nn=>Object.keys(nn).map(Number));this.inFlightDependencies.forEach(nn=>nn==null?void 0:nn.abort()),this.inFlightDependencies=[];let Ut=Promise.resolve({});if(Object.keys(Ot).length){const nn=new AbortController;this.inFlightDependencies.push(nn),Ut=it.sendAsync({type:"GG",data:{stacks:Ot,source:this.source,tileID:this.tileID,type:"glyphs"}},nn)}const Ht=Object.keys(dt.iconDependencies);let xe=Promise.resolve({});if(Ht.length){const nn=new AbortController;this.inFlightDependencies.push(nn),xe=it.sendAsync({type:"GI",data:{icons:Ht,source:this.source,tileID:this.tileID,type:"icons"}},nn)}const Le=Object.keys(dt.patternDependencies);let Ge=Promise.resolve({});if(Le.length){const nn=new AbortController;this.inFlightDependencies.push(nn),Ge=it.sendAsync({type:"GI",data:{icons:Le,source:this.source,tileID:this.tileID,type:"patterns"}},nn)}const[qe,vn,Vn]=yield Promise.all([Ut,xe,Ge]),nr=new y(qe),Zr=new h.bl(vn,Vn);for(const nn in bt){const vr=bt[nn];vr instanceof h.a5?(S(vr.layers,this.zoom,X),h.bm({bucket:vr,glyphMap:qe,glyphPositions:nr.positions,imageMap:vn,imagePositions:Zr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):vr.hasPattern&&(vr instanceof h.bn||vr instanceof h.bo||vr instanceof h.bp)&&(S(vr.layers,this.zoom,X),vr.addFeatures(dt,this.tileID.canonical,Zr.patternPositions))}return this.status="done",{buckets:Object.values(bt).filter(nn=>!nn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:nr.image,imageAtlas:Zr,glyphMap:this.returnDependencies?qe:null,iconMap:this.returnDependencies?vn:null,glyphPositions:this.returnDependencies?nr.positions:null}})}}function S(ut,V,q){const X=new h.a8(V);for(const it of ut)it.recalculate(X,q)}class C{constructor(V,q,X){this.actor=V,this.layerIndex=q,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,q){return h._(this,void 0,void 0,function*(){const X=yield h.l(V.request,q);try{return{vectorTile:new h.bq.VectorTile(new h.br(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(it){const vt=new Uint8Array(X.data);let Q=`Unable to parse the tile at ${V.request.url}, `;throw Q+=vt[0]===31&&vt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${it.messge}`,new Error(Q)}})}loadTile(V){return h._(this,void 0,void 0,function*(){const q=V.uid,X=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request),it=new w(V);this.loading[q]=it;const vt=new AbortController;it.abort=vt;try{const Q=yield this.loadVectorTile(V,vt);if(delete this.loading[q],!Q)return null;const bt=Q.rawData,dt={};Q.expires&&(dt.expires=Q.expires),Q.cacheControl&&(dt.cacheControl=Q.cacheControl);const It={};if(X){const Ut=X.finish();Ut&&(It.resourceTiming=JSON.parse(JSON.stringify(Ut)))}it.vectorTile=Q.vectorTile;const Ot=it.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[q]=it,this.fetching[q]={rawTileData:bt,cacheControl:dt,resourceTiming:It};try{const Ut=yield Ot;return h.e({rawTileData:bt.slice(0)},Ut,dt,It)}finally{delete this.fetching[q]}}catch(Q){throw delete this.loading[q],it.status="done",this.loaded[q]=it,Q}})}reloadTile(V){return h._(this,void 0,void 0,function*(){const q=V.uid;if(!this.loaded||!this.loaded[q])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const X=this.loaded[q];if(X.showCollisionBoxes=V.showCollisionBoxes,X.status==="parsing"){const it=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor);let vt;if(this.fetching[q]){const{rawTileData:Q,cacheControl:bt,resourceTiming:dt}=this.fetching[q];delete this.fetching[q],vt=h.e({rawTileData:Q.slice(0)},it,bt,dt)}else vt=it;return vt}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return h._(this,void 0,void 0,function*(){const q=this.loading,X=V.uid;q&&q[X]&&q[X].abort&&(q[X].abort.abort(),delete q[X])})}removeTile(V){return h._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class P{constructor(){this.loaded={}}loadTile(V){return h._(this,void 0,void 0,function*(){const{uid:q,encoding:X,rawImageData:it,redFactor:vt,greenFactor:Q,blueFactor:bt,baseShift:dt}=V,It=it.width+2,Ot=it.height+2,Ut=h.b(it)?new h.R({width:It,height:Ot},yield h.bt(it,-1,-1,It,Ot)):it,Ht=new h.bu(q,Ut,X,vt,Q,bt,dt);return this.loaded=this.loaded||{},this.loaded[q]=Ht,Ht})}removeTile(V){const q=this.loaded,X=V.uid;q&&q[X]&&delete q[X]}}function D(ut,V){if(ut.length!==0){N(ut[0],V);for(var q=1;q=Math.abs(bt)?q-dt+bt:bt-dt+q,q=dt}q+X>=0!=!!V&&ut.reverse()}var K=h.bv(function ut(V,q){var X,it=V&&V.type;if(it==="FeatureCollection")for(X=0;X>31}function re(ut,V){for(var q=ut.loadGeometry(),X=ut.type,it=0,vt=0,Q=q.length,bt=0;btut},ze=Math.fround||(We=new Float32Array(1),ut=>(We[0]=+ut,We[0]));var We;const Ue=3,Ce=5,en=6;class An{constructor(V){this.options=Object.assign(Object.create(Re),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:q,minZoom:X,maxZoom:it}=this.options;q&&console.time("total time");const vt=`prepare ${V.length} points`;q&&console.time(vt),this.points=V;const Q=[];for(let dt=0;dt=X;dt--){const It=+Date.now();bt=this.trees[dt]=this._createTree(this._cluster(bt,dt)),q&&console.log("z%d: %d clusters in %dms",dt,bt.numItems,+Date.now()-It)}return q&&console.timeEnd("total time"),this}getClusters(V,q){let X=((V[0]+180)%360+360)%360-180;const it=Math.max(-90,Math.min(90,V[1]));let vt=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)X=-180,vt=180;else if(X>vt){const Ut=this.getClusters([X,it,180,Q],q),Ht=this.getClusters([-180,it,vt,Q],q);return Ut.concat(Ht)}const bt=this.trees[this._limitZoom(q)],dt=bt.range(kn(X),Yn(Q),kn(vt),Yn(it)),It=bt.data,Ot=[];for(const Ut of dt){const Ht=this.stride*Ut;Ot.push(It[Ht+Ce]>1?dn(It,Ht,this.clusterProps):this.points[It[Ht+Ue]])}return Ot}getChildren(V){const q=this._getOriginId(V),X=this._getOriginZoom(V),it="No cluster with the specified id.",vt=this.trees[X];if(!vt)throw new Error(it);const Q=vt.data;if(q*this.stride>=Q.length)throw new Error(it);const bt=this.options.radius/(this.options.extent*Math.pow(2,X-1)),dt=vt.within(Q[q*this.stride],Q[q*this.stride+1],bt),It=[];for(const Ot of dt){const Ut=Ot*this.stride;Q[Ut+4]===V&&It.push(Q[Ut+Ce]>1?dn(Q,Ut,this.clusterProps):this.points[Q[Ut+Ue]])}if(It.length===0)throw new Error(it);return It}getLeaves(V,q,X){const it=[];return this._appendLeaves(it,V,q=q||10,X=X||0,0),it}getTile(V,q,X){const it=this.trees[this._limitZoom(V)],vt=Math.pow(2,V),{extent:Q,radius:bt}=this.options,dt=bt/Q,It=(X-dt)/vt,Ot=(X+1+dt)/vt,Ut={features:[]};return this._addTileFeatures(it.range((q-dt)/vt,It,(q+1+dt)/vt,Ot),it.data,q,X,vt,Ut),q===0&&this._addTileFeatures(it.range(1-dt/vt,It,1,Ot),it.data,vt,X,vt,Ut),q===vt-1&&this._addTileFeatures(it.range(0,It,dt/vt,Ot),it.data,-1,X,vt,Ut),Ut.features.length?Ut:null}getClusterExpansionZoom(V){let q=this._getOriginZoom(V)-1;for(;q<=this.options.maxZoom;){const X=this.getChildren(V);if(q++,X.length!==1)break;V=X[0].properties.cluster_id}return q}_appendLeaves(V,q,X,it,vt){const Q=this.getChildren(q);for(const bt of Q){const dt=bt.properties;if(dt&&dt.cluster?vt+dt.point_count<=it?vt+=dt.point_count:vt=this._appendLeaves(V,dt.cluster_id,X,it,vt):vt1;let Ot,Ut,Ht;if(It)Ot=cn(q,dt,this.clusterProps),Ut=q[dt],Ht=q[dt+1];else{const Ge=this.points[q[dt+Ue]];Ot=Ge.properties;const[qe,vn]=Ge.geometry.coordinates;Ut=kn(qe),Ht=Yn(vn)}const xe={type:1,geometry:[[Math.round(this.options.extent*(Ut*vt-X)),Math.round(this.options.extent*(Ht*vt-it))]],tags:Ot};let Le;Le=It||this.options.generateId?q[dt+Ue]:this.points[q[dt+Ue]].id,Le!==void 0&&(xe.id=Le),Q.features.push(xe)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,q){const{radius:X,extent:it,reduce:vt,minPoints:Q}=this.options,bt=X/(it*Math.pow(2,q)),dt=V.data,It=[],Ot=this.stride;for(let Ut=0;Utq&&(qe+=dt[Vn+Ce])}if(qe>Ge&&qe>=Q){let vn,Vn=Ht*Ge,nr=xe*Ge,Zr=-1;const nn=((Ut/Ot|0)<<5)+(q+1)+this.points.length;for(const vr of Le){const $r=vr*Ot;if(dt[$r+2]<=q)continue;dt[$r+2]=q;const Zi=dt[$r+Ce];Vn+=dt[$r]*Zi,nr+=dt[$r+1]*Zi,dt[$r+4]=nn,vt&&(vn||(vn=this._map(dt,Ut,!0),Zr=this.clusterProps.length,this.clusterProps.push(vn)),vt(vn,this._map(dt,$r)))}dt[Ut+4]=nn,It.push(Vn/qe,nr/qe,1/0,nn,-1,qe),vt&&It.push(Zr)}else{for(let vn=0;vn1)for(const vn of Le){const Vn=vn*Ot;if(!(dt[Vn+2]<=q)){dt[Vn+2]=q;for(let nr=0;nr>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,q,X){if(V[q+Ce]>1){const Q=this.clusterProps[V[q+en]];return X?Object.assign({},Q):Q}const it=this.points[V[q+Ue]].properties,vt=this.options.map(it);return X&&vt===it?Object.assign({},vt):vt}}function dn(ut,V,q){return{type:"Feature",id:ut[V+Ue],properties:cn(ut,V,q),geometry:{type:"Point",coordinates:[(X=ut[V],360*(X-.5)),Wr(ut[V+1])]}};var X}function cn(ut,V,q){const X=ut[V+Ce],it=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,vt=ut[V+en],Q=vt===-1?{}:Object.assign({},q[vt]);return Object.assign(Q,{cluster:!0,cluster_id:ut[V+Ue],point_count:X,point_count_abbreviated:it})}function kn(ut){return ut/360+.5}function Yn(ut){const V=Math.sin(ut*Math.PI/180),q=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return q<0?0:q>1?1:q}function Wr(ut){const V=(180-360*ut)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function hr(ut,V,q,X){for(var it,vt=X,Q=q-V>>1,bt=q-V,dt=ut[V],It=ut[V+1],Ot=ut[q],Ut=ut[q+1],Ht=V+3;Htvt)it=Ht,vt=xe;else if(xe===vt){var Le=Math.abs(Ht-Q);LeX&&(it-V>3&&hr(ut,V,it,X),ut[it+2]=vt,q-it>3&&hr(ut,it,q,X))}function er(ut,V,q,X,it,vt){var Q=it-q,bt=vt-X;if(Q!==0||bt!==0){var dt=((ut-q)*Q+(V-X)*bt)/(Q*Q+bt*bt);dt>1?(q=it,X=vt):dt>0&&(q+=Q*dt,X+=bt*dt)}return(Q=ut-q)*Q+(bt=V-X)*bt}function Kn(ut,V,q,X){var it={id:ut===void 0?null:ut,type:V,geometry:q,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(vt){var Q=vt.geometry,bt=vt.type;if(bt==="Point"||bt==="MultiPoint"||bt==="LineString")nt(vt,Q);else if(bt==="Polygon"||bt==="MultiLineString")for(var dt=0;dt0&&(Q+=X?(it*It-dt*vt)/2:Math.sqrt(Math.pow(dt-it,2)+Math.pow(It-vt,2))),it=dt,vt=It}var Ot=V.length-3;V[2]=1,hr(V,0,Ot,q),V[Ot+2]=1,V.size=Math.abs(Q),V.start=0,V.end=V.size}function Mt(ut,V,q,X){for(var it=0;it1?1:q}function on(ut,V,q,X,it,vt,Q,bt){if(X/=V,vt>=(q/=V)&&Q=X)return null;for(var dt=[],It=0;It=q&&Le=X)){var Ge=[];if(Ht==="Point"||Ht==="MultiPoint")Hn(Ut,Ge,q,X,it);else if(Ht==="LineString")To(Ut,Ge,q,X,it,!1,bt.lineMetrics);else if(Ht==="MultiLineString")ks(Ut,Ge,q,X,it,!1);else if(Ht==="Polygon")ks(Ut,Ge,q,X,it,!0);else if(Ht==="MultiPolygon")for(var qe=0;qe=q&&Q<=X&&(V.push(ut[vt]),V.push(ut[vt+1]),V.push(ut[vt+2]))}}function To(ut,V,q,X,it,vt,Q){for(var bt,dt,It=ls(ut),Ot=it===0?Ii:gl,Ut=ut.start,Ht=0;Htq&&(dt=Ot(It,xe,Le,qe,vn,q),Q&&(It.start=Ut+bt*dt)):Vn>X?nr=q&&(dt=Ot(It,xe,Le,qe,vn,q),Zr=!0),nr>X&&Vn<=X&&(dt=Ot(It,xe,Le,qe,vn,X),Zr=!0),!vt&&Zr&&(Q&&(It.end=Ut+bt*dt),V.push(It),It=ls(ut)),Q&&(Ut+=bt)}var nn=ut.length-3;xe=ut[nn],Le=ut[nn+1],Ge=ut[nn+2],(Vn=it===0?xe:Le)>=q&&Vn<=X&&Ra(It,xe,Le,Ge),nn=It.length-3,vt&&nn>=3&&(It[nn]!==It[0]||It[nn+1]!==It[1])&&Ra(It,It[0],It[1],It[2]),It.length&&V.push(It)}function ls(ut){var V=[];return V.size=ut.size,V.start=ut.start,V.end=ut.end,V}function ks(ut,V,q,X,it,vt){for(var Q=0;QQ.maxX&&(Q.maxX=Ot),Ut>Q.maxY&&(Q.maxY=Ut)}return Q}function Hr(ut,V,q,X){var it=V.geometry,vt=V.type,Q=[];if(vt==="Point"||vt==="MultiPoint")for(var bt=0;bt0&&V.size<(it?Q:X))q.numPoints+=V.length/3;else{for(var bt=[],dt=0;dtQ)&&(q.numSimplified++,bt.push(V[dt]),bt.push(V[dt+1])),q.numPoints++;it&&function(It,Ot){for(var Ut=0,Ht=0,xe=It.length,Le=xe-2;Ht0===Ot)for(Ht=0,xe=It.length;Ht24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var X=function(it,vt){var Q=[];if(it.type==="FeatureCollection")for(var bt=0;bt1&&console.time("creation"),Ht=this.tiles[Ut]=yl(ut,V,q,X,dt),this.tileCoords.push({z:V,x:q,y:X}),It)){It>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,q,X,Ht.numFeatures,Ht.numPoints,Ht.numSimplified),console.timeEnd("creation"));var xe="z"+V;this.stats[xe]=(this.stats[xe]||0)+1,this.total++}if(Ht.source=ut,it){if(V===dt.maxZoom||V===it)continue;var Le=1<1&&console.time("clipping");var Ge,qe,vn,Vn,nr,Zr,nn=.5*dt.buffer/dt.extent,vr=.5-nn,$r=.5+nn,Zi=1+nn;Ge=qe=vn=Vn=null,nr=on(ut,Ot,q-nn,q+$r,0,Ht.minX,Ht.maxX,dt),Zr=on(ut,Ot,q+vr,q+Zi,0,Ht.minX,Ht.maxX,dt),ut=null,nr&&(Ge=on(nr,Ot,X-nn,X+$r,1,Ht.minY,Ht.maxY,dt),qe=on(nr,Ot,X+vr,X+Zi,1,Ht.minY,Ht.maxY,dt),nr=null),Zr&&(vn=on(Zr,Ot,X-nn,X+$r,1,Ht.minY,Ht.maxY,dt),Vn=on(Zr,Ot,X+vr,X+Zi,1,Ht.minY,Ht.maxY,dt),Zr=null),It>1&&console.timeEnd("clipping"),bt.push(Ge||[],V+1,2*q,2*X),bt.push(qe||[],V+1,2*q,2*X+1),bt.push(vn||[],V+1,2*q+1,2*X),bt.push(Vn||[],V+1,2*q+1,2*X+1)}}},Je.prototype.getTile=function(ut,V,q){var X=this.options,it=X.extent,vt=X.debug;if(ut<0||ut>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",ut,V,q);for(var dt,It=ut,Ot=V,Ut=q;!dt&&It>0;)It--,Ot=Math.floor(Ot/2),Ut=Math.floor(Ut/2),dt=this.tiles[Ye(It,Ot,Ut)];return dt&&dt.source?(vt>1&&console.log("found parent tile z%d-%d-%d",It,Ot,Ut),vt>1&&console.time("drilling down"),this.splitTile(dt.source,It,Ot,Ut,ut,V,q),vt>1&&console.timeEnd("drilling down"),this.tiles[bt]?Ho(this.tiles[bt],it):null):null};class ha extends C{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,q){return h._(this,void 0,void 0,function*(){const X=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const it=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!it)return null;const vt=new class{constructor(bt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=h.W,this.length=bt.length,this._features=bt}feature(bt){return new class{constructor(dt){this._feature=dt,this.extent=h.W,this.type=dt.type,this.properties=dt.tags,"id"in dt&&!isNaN(dt.id)&&(this.id=parseInt(dt.id,10))}loadGeometry(){if(this._feature.type===1){const dt=[];for(const It of this._feature.geometry)dt.push([new h.P(It[0],It[1])]);return dt}{const dt=[];for(const It of this._feature.geometry){const Ot=[];for(const Ut of It)Ot.push(new h.P(Ut[0],Ut[1]));dt.push(Ot)}return dt}}toGeoJSON(dt,It,Ot){return Y.call(this,dt,It,Ot)}}(this._features[bt])}}(it.features);let Q=Wt(vt);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:vt,rawData:Q.buffer}})}loadData(V){return h._(this,void 0,void 0,function*(){var q;(q=this._pendingRequest)===null||q===void 0||q.abort();const X=!!(V&&V.request&&V.request.collectResourceTiming)&&new h.bs(V.request);this._pendingRequest=new AbortController;try{let it=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof it!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(K(it,!0),V.filter){const Q=h.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(dt=>`${dt.key}: ${dt.message}`).join(", "));it={type:"FeatureCollection",features:it.features.filter(dt=>Q.value.evaluate({zoom:0},dt))}}this._geoJSONIndex=V.cluster?new An(function({superclusterOptions:Q,clusterProperties:bt}){if(!bt||!Q)return Q;const dt={},It={},Ot={accumulated:null,zoom:0},Ut={properties:null},Ht=Object.keys(bt);for(const xe of Ht){const[Le,Ge]=bt[xe],qe=h.by(Ge),vn=h.by(typeof Le=="string"?[Le,["accumulated"],["get",xe]]:Le);dt[xe]=qe.value,It[xe]=vn.value}return Q.map=xe=>{Ut.properties=xe;const Le={};for(const Ge of Ht)Le[Ge]=dt[Ge].evaluate(Ot,Ut);return Le},Q.reduce=(xe,Le)=>{Ut.properties=Le;for(const Ge of Ht)Ot.accumulated=xe[Ge],xe[Ge]=It[Ge].evaluate(Ot,Ut)},Q}(V)).load(it.features):function(Q,bt){return new Je(Q,bt)}(it,V.geojsonVtOptions),this.loaded={};const vt={};if(X){const Q=X.finish();Q&&(vt.resourceTiming={},vt.resourceTiming[V.source]=JSON.parse(JSON.stringify(Q)))}return vt}catch(it){if(delete this._pendingRequest,h.bz(it))return{abandoned:!0};throw it}})}reloadTile(V){const q=this.loaded;return q&&q[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,q){return h._(this,void 0,void 0,function*(){const{promoteId:X}=V;if(V.request){const it=yield h.h(V.request,q);return this._dataUpdateable=Zo(it.data,X)?Ze(it.data,X):void 0,it.data}if(typeof V.data=="string")try{const it=JSON.parse(V.data);return this._dataUpdateable=Zo(it,X)?Ze(it,X):void 0,it}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(it,vt,Q){var bt,dt,It,Ot;if(vt.removeAll&&it.clear(),vt.remove)for(const Ut of vt.remove)it.delete(Ut);if(vt.add)for(const Ut of vt.add){const Ht=Lr(Ut,Q);Ht!=null&&it.set(Ht,Ut)}if(vt.update)for(const Ut of vt.update){let Ht=it.get(Ut.id);if(Ht==null)continue;const xe=!Ut.removeAllProperties&&(((bt=Ut.removeProperties)===null||bt===void 0?void 0:bt.length)>0||((dt=Ut.addOrUpdateProperties)===null||dt===void 0?void 0:dt.length)>0);if((Ut.newGeometry||Ut.removeAllProperties||xe)&&(Ht=Object.assign({},Ht),it.set(Ut.id,Ht),xe&&(Ht.properties=Object.assign({},Ht.properties))),Ut.newGeometry&&(Ht.geometry=Ut.newGeometry),Ut.removeAllProperties)Ht.properties={};else if(((It=Ut.removeProperties)===null||It===void 0?void 0:It.length)>0)for(const Le of Ut.removeProperties)Object.prototype.hasOwnProperty.call(Ht.properties,Le)&&delete Ht.properties[Le];if(((Ot=Ut.addOrUpdateProperties)===null||Ot===void 0?void 0:Ot.length)>0)for(const{key:Le,value:Ge}of Ut.addOrUpdateProperties)Ht.properties[Le]=Ge}}(this._dataUpdateable,V.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return h._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class Rr{constructor(V){this.self=V,this.actor=new h.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(q,X)=>{if(this.externalWorkerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.externalWorkerSourceTypes[q]=X},this.self.addProtocol=h.bf,this.self.removeProtocol=h.bg,this.self.registerRTLTextPlugin=q=>{if(h.bA.isParsed())throw new Error("RTL text plugin already registered.");h.bA.setMethods(q)},this.actor.registerMessageHandler("LDT",(q,X)=>this._getDEMWorkerSource(q,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",(q,X)=>h._(this,void 0,void 0,function*(){this._getDEMWorkerSource(q,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",(q,X)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",(q,X)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",(q,X)=>h._(this,void 0,void 0,function*(){return this._getWorkerSource(q,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",(q,X)=>this._getWorkerSource(q,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("LT",(q,X)=>this._getWorkerSource(q,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",(q,X)=>this._getWorkerSource(q,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",(q,X)=>this._getWorkerSource(q,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",(q,X)=>this._getWorkerSource(q,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",(q,X)=>h._(this,void 0,void 0,function*(){if(!this.workerSources[q]||!this.workerSources[q][X.type]||!this.workerSources[q][X.type][X.source])return;const it=this.workerSources[q][X.type][X.source];delete this.workerSources[q][X.type][X.source],it.removeSource!==void 0&&it.removeSource(X)})),this.actor.registerMessageHandler("RM",q=>h._(this,void 0,void 0,function*(){delete this.layerIndexes[q],delete this.availableImages[q],delete this.workerSources[q],delete this.demWorkerSources[q]})),this.actor.registerMessageHandler("SR",(q,X)=>h._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",(q,X)=>this._syncRTLPluginState(q,X)),this.actor.registerMessageHandler("IS",(q,X)=>h._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",(q,X)=>this._setImages(q,X)),this.actor.registerMessageHandler("UL",(q,X)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(q).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",(q,X)=>h._(this,void 0,void 0,function*(){this._getLayerIndex(q).replace(X)}))}_setImages(V,q){return h._(this,void 0,void 0,function*(){this.availableImages[V]=q;for(const X in this.workerSources[V]){const it=this.workerSources[V][X];for(const vt in it)it[vt].availableImages=q}})}_syncRTLPluginState(V,q){return h._(this,void 0,void 0,function*(){if(h.bA.isParsed())return h.bA.getState();if(q.pluginStatus!=="loading")return h.bA.setState(q),q;const X=q.pluginURL;if(this.self.importScripts(X),h.bA.isParsed()){const it={pluginStatus:"loaded",pluginURL:X};return h.bA.setState(it),it}throw h.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${X}`)})}_getAvailableImages(V){let q=this.availableImages[V];return q||(q=[]),q}_getLayerIndex(V){let q=this.layerIndexes[V];return q||(q=this.layerIndexes[V]=new u),q}_getWorkerSource(V,q,X){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][q]||(this.workerSources[V][q]={}),!this.workerSources[V][q][X]){const it={sendAsync:(vt,Q)=>(vt.targetMapId=V,this.actor.sendAsync(vt,Q))};switch(q){case"vector":this.workerSources[V][q][X]=new C(it,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][q][X]=new ha(it,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][q][X]=new this.externalWorkerSourceTypes[q](it,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][q][X]}_getDEMWorkerSource(V,q){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][q]||(this.demWorkerSources[V][q]=new P),this.demWorkerSources[V][q]}}return h.i(self)&&(self.worker=new Rr(self)),Rr}),i("index",["exports","./shared"],function(h,u){var y="4.1.3";let w,S;const C={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((s,f)=>{const d=requestAnimationFrame(s);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),f(u.c())})}),getImageData(_,s=0){return this.getImageCanvasContext(_).getImageData(-s,-s,_.width+2*s,_.height+2*s)},getImageCanvasContext(_){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=_.width,s.height=_.height,f.drawImage(_,0,0,_.width,_.height),f},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class P{static testProp(s){if(!P.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",P.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,d){const m=f.boundingClientRect;return new u.P((d.clientX-m.left)/f.x-s.clientLeft,(d.clientY-m.top)/f.y-s.clientTop)}static mousePos(s,f){const d=P.getScale(s);return P.getPoint(s,d,f)}static touchPos(s,f){const d=[],m=P.getScale(s);for(let v=0;v{s=[],f=0,d=0,m={}},_.addThrottleControl=M=>{const k=d++;return m[k]=M,k},_.removeThrottleControl=M=>{delete m[M],I()},_.getImage=(M,k,z=!0)=>new Promise((F,W)=>{D.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),u.e(M,{type:"image"}),s.push({abortController:k,requestParameters:M,supportImageRefresh:z,state:"queued",onError:st=>{W(st)},onSuccess:st=>{F(st)}}),I()});const v=M=>u._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:k,supportImageRefresh:z,onError:F,onSuccess:W,abortController:st}=M,ot=z===!1&&!u.i(self)&&!u.g(k.url)&&(!k.headers||Object.keys(k.headers).reduce((_t,kt)=>_t&&kt==="accept",!0));f++;const ct=ot?T(k,st):u.m(k,st);try{const _t=yield ct;delete M.abortController,M.state="completed",_t.data instanceof HTMLImageElement||u.b(_t.data)?W(_t):_t.data&&W({data:yield(tt=_t.data,typeof createImageBitmap=="function"?u.d(tt):u.f(tt)),cacheControl:_t.cacheControl,expires:_t.expires})}catch(_t){delete M.abortController,F(_t)}finally{f--,I()}var tt}),I=()=>{const M=(()=>{for(const k of Object.keys(m))if(m[k]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let k=f;k0;k++){const z=s.shift();z.abortController.signal.aborted?k--:v(z)}},T=(M,k)=>new Promise((z,F)=>{const W=new Image,st=M.url,ot=M.credentials;ot&&ot==="include"?W.crossOrigin="use-credentials":(ot&&ot==="same-origin"||!u.s(st))&&(W.crossOrigin="anonymous"),k.signal.addEventListener("abort",()=>{W.src="",F(u.c())}),W.fetchPriority="high",W.onload=()=>{W.onerror=W.onload=null,z({data:W})},W.onerror=()=>{W.onerror=W.onload=null,k.signal.aborted||F(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."))},W.src=st})}(G||(G={})),G.resetRequestQueue();class H{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,d){const m=function(v){const I=v.match(at);if(!I)throw new Error(`Unable to parse URL "${v}"`);return{protocol:I[1],authority:I[2],path:I[3]||"/",params:I[4]?I[4].split("&"):[]}}(s);return m.path+=`${f}${d}`,function(v){const I=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${I}`}(m)}setTransformRequest(s){this._transformRequestFn=s}}const at=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function gt(_){var s=new u.A(3);return s[0]=_[0],s[1]=_[1],s[2]=_[2],s}var ft,rt=function(_,s,f){return _[0]=s[0]-f[0],_[1]=s[1]-f[1],_[2]=s[2]-f[2],_};ft=new u.A(3),u.A!=Float32Array&&(ft[0]=0,ft[1]=0,ft[2]=0);var mt=function(_){var s=_[0],f=_[1];return s*s+f*f};function Et(_){const s=[];if(typeof _=="string")s.push({id:"default",url:_});else if(_&&_.length>0){const f=[];for(const{id:d,url:m}of _){const v=`${d}${m}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:d,url:m}))}}return s}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class ${constructor(s,f,d,m){this.context=s,this.format=d,this.texture=s.gl.createTexture(),this.update(f,m)}update(s,f,d){const{width:m,height:v}=s,I=!(this.size&&this.size[0]===m&&this.size[1]===v||d),{context:T}=this,{gl:M}=T;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),T.pixelStoreUnpackFlipY.set(!1),T.pixelStoreUnpack.set(1),T.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),I)this.size=[m,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,m,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:k,y:z}=d||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||u.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,k,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,k,z,m,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,d){const{context:m}=this,{gl:v}=m;v.bindTexture(v.TEXTURE_2D,this.texture),d!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,d||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.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:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function Pt(_){const{userImage:s}=_;return!!(s&&s.render&&s.render())&&(_.data.replace(new Uint8Array(s.data.buffer)),!0)}class Qt extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:d}of this.requestors)d(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const d=f.spriteData;f.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let d=!0;const m=f.data||f.spriteData;return this._validateStretch(f.stretchX,m&&m.width)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchX" value`))),d=!1),this._validateStretch(f.stretchY,m&&m.height)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "stretchY" value`))),d=!1),this._validateContent(f.content,f)||(this.fire(new u.j(new Error(`Image "${s}" has invalid "content" value`))),d=!1),d}_validateStretch(s,f){if(!s)return!0;let d=0;for(const m of s){if(m[0]{let m=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(m=!1);this.isLoaded()||m?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const d of s){let m=this.getImage(d);m||(this.fire(new u.k("styleimagemissing",{id:d})),m=this.getImage(d)),m?f[d]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:u.w(`Image "${d}" 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:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],d=this.getImage(s);if(!d)return null;if(f&&f.position.version===d.version)return f.position;if(f)f.position.version=d.version;else{const m={w:d.data.width+2,h:d.data.height+2,x:0,y:0},v=new u.I(m,d);this.patterns[s]={bin:m,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new $(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:d}=u.p(s),m=this.atlasImage;m.resize({width:f||1,height:d||1});for(const v in this.patterns){const{bin:I}=this.patterns[v],T=I.x+1,M=I.y+1,k=this.getImage(v).data,z=k.width,F=k.height;u.R.copy(k,m,{x:0,y:0},{x:T,y:M},{width:z,height:F}),u.R.copy(k,m,{x:0,y:F-1},{x:T,y:M-1},{width:z,height:1}),u.R.copy(k,m,{x:0,y:0},{x:T,y:M+F},{width:z,height:1}),u.R.copy(k,m,{x:z-1,y:0},{x:T-1,y:M},{width:1,height:F}),u.R.copy(k,m,{x:0,y:0},{x:T+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const d=this.getImage(f);d||u.w(`Image with ID: "${f}" was not found`),Pt(d)&&this.updateImage(f,d)}}}const Tt=1e20;function re(_,s,f,d,m,v,I,T,M){for(let k=s;k-1);M++,v[M]=T,I[M]=k,I[M+1]=Tt}for(let T=0,M=0;T65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[v])return{stack:s,id:f,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[v]){const T=Wt.loadGlyphRange(s,v,this.url,this.requestManager);d.requests[v]=T}const I=yield d.requests[v];for(const T in I)this._doesCharSupportLocalGlyph(+T)||(d.glyphs[+T]=I[+T]);return d.ranges[v]=!0,{stack:s,id:f,glyph:I[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](s)||u.u["Hangul Syllables"](s)||u.u.Hiragana(s)||u.u.Katakana(s))}_tinySDF(s,f,d){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(d))return;let v=s.tinySDF;if(!v){let T="400";/bold/i.test(f)?T="900":/medium/i.test(f)?T="500":/light/i.test(f)&&(T="200"),v=s.tinySDF=new Wt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:T})}const I=v.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:I.width||60,height:I.height||60},I.data),metrics:{width:I.glyphWidth/2||24,height:I.glyphHeight/2||24,left:I.glyphLeft/2+.5||0,top:I.glyphTop/2-27.5||-8,advance:I.glyphAdvance/2||24,isDoubleResolution:!0}}}}Wt.loadGlyphRange=function(_,s,f,d){return u._(this,void 0,void 0,function*(){const m=256*s,v=m+255,I=d.transformRequest(f.replace("{fontstack}",_).replace("{range}",`${m}-${v}`),"Glyphs"),T=yield u.l(I,new AbortController);if(!T||!T.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${v}`);const M={};for(const k of u.n(T.data))M[k.id]=k;return M})},Wt.TinySDF=class{constructor({fontSize:_=24,buffer:s=3,radius:f=8,cutoff:d=.25,fontFamily:m="sans-serif",fontWeight:v="normal",fontStyle:I="normal"}={}){this.buffer=s,this.cutoff=d,this.radius=f;const T=this.size=_+4*s,M=this._createCanvas(T),k=this.ctx=M.getContext("2d",{willReadFrequently:!0});k.font=`${I} ${v} ${_}px ${m}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(T*T),this.gridInner=new Float64Array(T*T),this.f=new Float64Array(T),this.z=new Float64Array(T+1),this.v=new Uint16Array(T)}_createCanvas(_){const s=document.createElement("canvas");return s.width=s.height=_,s}draw(_){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:d,actualBoundingBoxLeft:m,actualBoundingBoxRight:v}=this.ctx.measureText(_),I=Math.ceil(f),T=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-m))),M=Math.min(this.size-this.buffer,I+Math.ceil(d)),k=T+2*this.buffer,z=M+2*this.buffer,F=Math.max(k*z,0),W=new Uint8ClampedArray(F),st={data:W,width:k,height:z,glyphWidth:T,glyphHeight:M,glyphTop:I,glyphLeft:0,glyphAdvance:s};if(T===0||M===0)return st;const{ctx:ot,buffer:ct,gridInner:tt,gridOuter:_t}=this;ot.clearRect(ct,ct,T,M),ot.fillText(_,ct,ct+I);const kt=ot.getImageData(ct,ct,T,M);_t.fill(Tt,0,F),tt.fill(0,0,F);for(let ht=0;ht0?Gt*Gt:0,tt[Ft]=Gt<0?Gt*Gt:0}}re(_t,0,0,k,z,k,this.f,this.v,this.z),re(tt,ct,ct,T,M,k,this.f,this.v,this.z);for(let ht=0;ht1&&(M=s[++T]);const z=Math.abs(k-M.left),F=Math.abs(k-M.right),W=Math.min(z,F);let st;const ot=v/d*(m+1);if(M.isDash){const ct=m-Math.abs(ot);st=Math.sqrt(W*W+ct*ct)}else st=m-Math.sqrt(W*W+ot*ot);this.data[I+k]=Math.max(0,Math.min(255,st+128))}}}addRegularDash(s){for(let T=s.length-1;T>=0;--T){const M=s[T],k=s[T+1];M.zeroLength?s.splice(T,1):k&&k.isDash===M.isDash&&(k.left=M.left,s.splice(T,1))}const f=s[0],d=s[s.length-1];f.isDash===d.isDash&&(f.left=d.left-this.width,d.right=f.right+this.width);const m=this.width*this.nextRow;let v=0,I=s[v];for(let T=0;T1&&(I=s[++v]);const M=Math.abs(T-I.left),k=Math.abs(T-I.right),z=Math.min(M,k);this.data[m+T]=Math.max(0,Math.min(255,(I.isDash?z:-z)+128))}}addDash(s,f){const d=f?7:0,m=2*d+1;if(this.nextRow+m>this.height)return u.w("LineAtlas out of space"),null;let v=0;for(let T=0;T{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ce]}numActive(){return Object.keys(this.active).length}}const An=Math.floor(C.hardwareConcurrency/2);let dn,cn;function kn(){return dn||(dn=new en),dn}en.workerCount=u.B(globalThis)?Math.max(Math.min(An,3),1):1;class Yn{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const d=this.workerPool.acquire(f);for(let m=0;m{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const d of this.actors)d.registerMessageHandler(s,f)}}function Wr(){return cn||(cn=new Yn(kn(),u.G),cn.registerMessageHandler("GR",(_,s,f)=>u.m(s,f))),cn}function hr(_,s){const f=u.F();return u.H(f,f,[1,1,0]),u.J(f,f,[.5*_.width,.5*_.height,1]),u.K(f,f,_.calculatePosMatrix(s.toUnwrapped()))}function er(_,s,f,d,m,v){const I=function(F,W,st){if(F)for(const ot of F){const ct=W[ot];if(ct&&ct.source===st&&ct.type==="fill-extrusion")return!0}else for(const ot in W){const ct=W[ot];if(ct.source===st&&ct.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,_.id),T=v.maxPitchScaleFactor(),M=_.tilesIn(d,T,I);M.sort(Kn);const k=[];for(const F of M)k.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,_._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,v,T,hr(_.transform,F.tileID))});const z=function(F){const W={},st={};for(const ot of F){const ct=ot.queryResults,tt=ot.wrappedTileID,_t=st[tt]=st[tt]||{};for(const kt in ct){const ht=ct[kt],St=_t[kt]=_t[kt]||{},Rt=W[kt]=W[kt]||[];for(const Ft of ht)St[Ft.featureIndex]||(St[Ft.featureIndex]=!0,Rt.push(Ft))}}return W}(k);for(const F in z)z[F].forEach(W=>{const st=W.feature,ot=_.getFeatureState(st.layer["source-layer"],st.id);st.source=st.layer.source,st.layer["source-layer"]&&(st.sourceLayer=st.layer["source-layer"]),st.state=ot});return z}function Kn(_,s){const f=_.tileID,d=s.tileID;return f.overscaledZ-d.overscaledZ||f.canonical.y-d.canonical.y||f.wrap-d.wrap||f.canonical.x-d.canonical.x}function nt(_,s,f){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(s.transformRequest(_.url,"Source"),f)).data:yield C.frameAsync(f),!d)return null;const m=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(m.vectorLayerIds=d.vector_layers.map(v=>v.id)),m})}class xt{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof u.M?new u.M(s.lng,s.lat):u.M.convert(s),this}extend(s){const f=this._sw,d=this._ne;let m,v;if(s instanceof u.M)m=s,v=s;else{if(!(s instanceof xt))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(xt.convert(s)):this.extend(u.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(u.M.convert(s)):this;if(m=s._sw,v=s._ne,!m||!v)return this}return f||d?(f.lng=Math.min(m.lng,f.lng),f.lat=Math.min(m.lat,f.lat),d.lng=Math.max(v.lng,d.lng),d.lat=Math.max(v.lat,d.lat)):(this._sw=new u.M(m.lng,m.lat),this._ne=new u.M(v.lng,v.lat)),this}getCenter(){return new u.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 u.M(this.getWest(),this.getNorth())}getSouthEast(){return new u.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(s){const{lng:f,lat:d}=u.M.convert(s);let m=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&m}static convert(s){return s instanceof xt?s:s&&new xt(s)}static fromLngLat(s,f=0){const d=360*f/40075017,m=d/Math.cos(Math.PI/180*s.lat);return new xt(new u.M(s.lng-m,s.lat-d),new u.M(s.lng+m,s.lat+d))}}class ce{constructor(s,f,d){this.bounds=xt.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=d||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),d=Math.floor(u.N(this.bounds.getWest())*f),m=Math.floor(u.O(this.bounds.getNorth())*f),v=Math.ceil(u.N(this.bounds.getEast())*f),I=Math.ceil(u.O(this.bounds.getSouth())*f);return s.x>=d&&s.x=m&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};d.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,I)=>{s.reloadPromise={resolve:v,reject:I}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:m,data:d},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const d=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(d.resolve).catch(d.reject)}}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Mt extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},f),u.e(this,u.L(f,["url","scheme","tileSize"]))}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield nt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(u.e(this,s),s.bounds&&(this.tileBounds=new ce(s.bounds,this.minzoom,this.maxzoom)),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new u.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return u.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const d=yield G.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&s.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const m=this.map.painter.context,v=m.gl,I=d.data;s.texture=this.map.painter.getTileTexture(I.width),s.texture?s.texture.update(I,{useMipmap:!0}):(s.texture=new $(m,I,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(d){if(delete s.abortController,s.aborted)s.state="unloaded";else if(d)throw s.state="errored",d}})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class He extends Mt{constructor(s,f,d,m){super(s,f,d,m),this.type="raster-dem",this.maxzoom=22,this._options=u.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(s){return u._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield G.getImage(d,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const v=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const I=u.b(v)&&u.S()?v:yield this.readImageNow(v),T={type:this.type,uid:s.uid,source:this.id,rawImageData:I,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:T});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const f=s.width+2,d=s.height+2;try{return new u.R({width:f,height:d},yield u.V(s,-1,-1,f,d))}catch{}}return C.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,d=Math.pow(2,f.z),m=(f.x-1+d)%d,v=f.x===0?s.wrap-1:s.wrap,I=(f.x+1+d)%d,T=f.x+1===d?s.wrap+1:s.wrap,M={};return M[new u.Q(s.overscaledZ,v,f.z,m,f.y).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,I,f.y).key]={backfilled:!1},f.y>0&&(M[new u.Q(s.overscaledZ,v,f.z,m,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new u.Q(s.overscaledZ,T,f.z,I,f.y-1).key]={backfilled:!1}),f.y+10&&u.e(v,{resourceTiming:m}),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(d){if(this._pendingLoads--,this._removed)return void this.fire(new u.k("dataabort",{dataType:"source"}));this.fire(new u.j(d))}})}loaded(){return this._pendingLoads===0}loadTile(s){return u._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const d={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const m=yield this.actor.sendAsync({type:f,data:d},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,f==="RT")})}abortTile(s){return u._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return u._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.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 u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var on=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Hn extends u.E{constructor(s,f,d,m){super(),this.id=s,this.dispatcher=d,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=f}load(s){return u._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new u.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,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new u.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(u.Y.fromLngLat);this.tileID=function(m){let v=1/0,I=1/0,T=-1/0,M=-1/0;for(const W of m)v=Math.min(v,W.x),I=Math.min(I,W.y),T=Math.max(T,W.x),M=Math.max(M,W.y);const k=Math.max(T-v,M-I),z=Math.max(0,Math.floor(-Math.log(k)/Math.LN2)),F=Math.pow(2,z);return new u.a0(z,Math.floor((v+T)/2*F),Math.floor((I+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const d=f.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new u.Z,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,u.W,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,u.W),this._boundsArray.emplaceBack(d[2].x,d[2].y,u.W,u.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new u.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new $(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class To extends Hn{constructor(s,f,d,m){super(s,f,d,m),this.roundZoom=!0,this.type="video",this.options=f}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield u.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 u.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new u.j(new u.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=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,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 s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.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 $(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let d=!1;for(const m in this.tiles){const v=this.tiles[m];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,d=!0)}d&&this.fire(new u.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 ls extends Hn{constructor(s,f,d,m){super(s,f,d,m),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(I=>typeof I!="number"))||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new u.j(new u.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return u._(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 u.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(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,d=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,on.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new $(f,this.canvas,d.RGBA,{premultiply:!0});let m=!1;for(const v in this.tiles){const I=this.tiles[v];I.state!=="loaded"&&(I.state="loaded",I.texture=this.texture,m=!0)}m&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const ks={},Ra=_=>{switch(_){case"geojson":return Tr;case"image":return Hn;case"raster":return Mt;case"raster-dem":return He;case"vector":return mn;case"video":return To;case"canvas":return ls}return ks[_]},Ii="RTLPluginLoaded";class gl extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Wr()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return u._(this,arguments,void 0,function*(f,d=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=C.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!d)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return u._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.k(Ii))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let us=null;function te(){return us||(us=new gl),us}class Ho{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=u.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(s){const f=s+this.timeAdded;fv.getLayer(k)).filter(Boolean);if(M.length!==0){T.layers=M,T.stateDependentLayerIds&&(T.stateDependentLayers=T.stateDependentLayerIds.map(k=>M.filter(z=>z.id===k)[0]));for(const k of M)I[k.id]=T}}return I}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const v=this.buckets[m];if(v instanceof u.a5&&v.hasRTLText){this.hasRTLText=!0,te().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const v=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(m).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const d in this.buckets){const m=this.buckets[d];m.uploadPending()&&m.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new $(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new $(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,d,m,v,I,T,M,k,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:v,scale:I,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:T,queryPadding:this.queryPadding*k},s,f,d):{}}querySourceFeatures(s,f){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const m=d.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",I=m._geojsonTileLayer||m[v];if(!I)return;const T=u.a6(f&&f.filter),{z:M,x:k,y:z}=this.tileID.canonical,F={z:M,x:k,y:z};for(let W=0;Wd)m=!1;else if(f)if(this.expirationTime{this.remove(s,v)},d)),this.data[m].push(v),this.order.push(m),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const d=s.wrapped().key,m=f===void 0?0:this.data[d].indexOf(f),v=this.data[d][m];return this.data[d].splice(m,1),v.timeout&&clearTimeout(v.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(v.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const d in this.data)for(const m of this.data[d])s(m.value)||f.push(m);for(const d of f)this.remove(d.value.tileID,d)}}class yl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,d){const m=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},u.e(this.stateChanges[s][m],d),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==m&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const v in this.state[s][m])d[v]||(this.deletedStates[s][m][v]=null)}else for(const v in d)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][v]===null&&delete this.deletedStates[s][m][v]}removeFeatureState(s,f,d){if(this.deletedStates[s]===null)return;const m=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},d&&f!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][d]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(d in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][d]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,f){const d=String(f),m=u.e({},(this.state[s]||{})[d],(this.stateChanges[s]||{})[d]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const I in v)delete m[I]}return m}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const d={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const v={};for(const I in this.stateChanges[m])this.state[m][I]||(this.state[m][I]={}),u.e(this.state[m][I],this.stateChanges[m][I]),v[I]=this.state[m][I];d[m]=v}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const v={};if(this.deletedStates[m]===null)for(const I in this.state[m])v[I]={},this.state[m][I]={};else for(const I in this.deletedStates[m]){if(this.deletedStates[m][I]===null)this.state[m][I]={};else for(const T of Object.keys(this.deletedStates[m][I]))delete this.state[m][I][T];v[I]=this.state[m][I]}d[m]=d[m]||{},u.e(d[m],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const m in s)s[m].setFeatureState(d,f)}}class Hr extends u.E{constructor(s,f,d){super(),this.id=s,this.dispatcher=d,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,v,I,T)=>{const M=new(Ra(v.type))(m,v,I,T);if(M.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${M.id}`);return M})(s,f,d,this),this._tiles={},this._cache=new Hi(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new yl,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];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 s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,d)}catch(m){s.state="errored",m.status!==404?this._source.fire(new u.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new u.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const d=this._tiles[f];d.upload(s),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(oe).map(s=>s.key)}getRenderableIds(s){const f=[];for(const d in this._tiles)this._isIdRenderable(d,s)&&f.push(this._tiles[d]);return s?f.sort((d,m)=>{const v=d.tileID,I=m.tileID,T=new u.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new u.P(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-I.overscaledZ||M.y-T.y||M.x-T.x}).map(d=>d.tileID.key):f.map(d=>d.tileID).sort(oe).map(d=>d.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return u._(this,void 0,void 0,function*(){const d=this._tiles[s];d&&(d.state!=="loading"&&(d.state=f),yield this._loadTile(d,s,f))})}_tileLoaded(s,f,d){s.timeAdded=C.now(),d==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new u.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let m=0;m1||(Math.abs(I)>1&&(Math.abs(I+M)===1?I+=M:Math.abs(I-M)===1&&(I-=M)),v.dem&&m.dem&&(m.dem.backfillBorder(v.dem,I,T),m.neighboringTiles&&m.neighboringTiles[k]&&(m.neighboringTiles[k].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,d,m){for(const v in this._tiles){let I=this._tiles[v];if(m[v]||!I.hasData()||I.tileID.overscaledZ<=f||I.tileID.overscaledZ>d)continue;let T=I.tileID;for(;I&&I.tileID.overscaledZ>f+1;){const k=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[k.key],I&&I.hasData()&&(T=k)}let M=T;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){m[T.key]=T;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const d=this._loadedParentTiles[s.key];return d&&d.tileID.overscaledZ>=f?d:null}for(let d=s.overscaledZ-1;d>=f;d--){const m=s.scaledTo(d),v=this._getLoadedTile(m);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,d=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(f*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const d={};for(const m in this._tiles){const v=this._tiles[m];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),d[v.tileID.key]=v}this._tiles=d;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let d;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new u.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(d=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(d=d.filter(z=>this._source.hasTile(z)))):d=[];const m=s.coveringZoomLevel(this._source),v=Math.max(m-Hr.maxOverzooming,this._source.minzoom),I=Math.max(m+Hr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of d)if(F.canonical.z>this._source.minzoom){const W=F.scaledTo(F.canonical.z-1);z[W.key]=W;const st=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[st.key]=st}d=d.concat(Object.values(z))}const T=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,T&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(d,m);if(Je(this._source.type)){const z={},F={},W=Object.keys(M),st=C.now();for(const ot of W){const ct=M[ot],tt=this._tiles[ot];if(!tt||tt.fadeEndTime!==0&&tt.fadeEndTime<=st)continue;const _t=this.findLoadedParent(ct,v);_t&&(this._addTile(_t.tileID),z[_t.tileID.key]=_t.tileID),F[ot]=ct}this._retainLoadedChildren(F,m,I,M);for(const ot in z)M[ot]||(this._coveredTiles[ot]=!0,M[ot]=z[ot]);if(f){const ot={},ct={};for(const tt of d)this._tiles[tt.key].hasData()?ot[tt.key]=tt:ct[tt.key]=tt;for(const tt in ct){const _t=ct[tt].children(this._source.maxzoom);this._tiles[_t[0].key]&&this._tiles[_t[1].key]&&this._tiles[_t[2].key]&&this._tiles[_t[3].key]&&(ot[_t[0].key]=M[_t[0].key]=_t[0],ot[_t[1].key]=M[_t[1].key]=_t[1],ot[_t[2].key]=M[_t[2].key]=_t[2],ot[_t[3].key]=M[_t[3].key]=_t[3],delete ct[tt])}for(const tt in ct){const _t=this.findLoadedParent(ct[tt],this._source.minzoom);if(_t){ot[_t.tileID.key]=M[_t.tileID.key]=_t.tileID;for(const kt in ot)ot[kt].isChildOf(_t.tileID)&&delete ot[kt]}}for(const tt in this._tiles)ot[tt]||(this._coveredTiles[tt]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const k=u.ab(this._tiles,M);for(const z of k){const F=this._tiles[z];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const d={},m={},v=Math.max(f-Hr.maxOverzooming,this._source.minzoom),I=Math.max(f+Hr.maxUnderzooming,this._source.minzoom),T={};for(const M of s){const k=this._addTile(M);d[M.key]=M,k.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],W=this.getTile(F);if(W&&W.hasData()){d[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(d[F[0].key]&&d[F[1].key]&&d[F[2].key]&&d[F[3].key])continue}let z=k.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const W=M.scaledTo(F);if(m[W.key])break;if(m[W.key]=!0,k=this.getTile(W),!k&&z&&(k=this._addTile(W)),k){const st=k.hasData();if((z||st)&&(d[W.key]=W),z=k.wasRequested(),st)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let d,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){d=this._loadedParentTiles[m.key];break}f.push(m.key);const v=m.scaledTo(m.overscaledZ-1);if(d=this._getLoadedTile(v),d)break;m=v}for(const v of f)this._loadedParentTiles[v]=d}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const d=f;return f||(f=new Ho(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,d||this._source.fire(new u.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const d=f.getExpiryTimeout();d&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},d))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),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(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.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 s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,d){const m=[],v=this.transform;if(!v)return m;const I=d?v.getCameraQueryGeometry(s):s,T=s.map(ot=>v.pointCoordinate(ot,this.terrain)),M=I.map(ot=>v.pointCoordinate(ot,this.terrain)),k=this.getIds();let z=1/0,F=1/0,W=-1/0,st=-1/0;for(const ot of M)z=Math.min(z,ot.x),F=Math.min(F,ot.y),W=Math.max(W,ot.x),st=Math.max(st,ot.y);for(let ot=0;ot=0&&ht[1].y+kt>=0){const St=T.map(Ft=>tt.getTilePoint(Ft)),Rt=M.map(Ft=>tt.getTilePoint(Ft));m.push({tile:ct,tileID:tt,queryGeometry:St,cameraQueryGeometry:Rt,scale:_t})}}return m}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(d=>this._tiles[d].tileID);for(const d of f)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(Je(this._source.type)){const s=C.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,d){this._state.updateState(s=s||"_geojsonTileLayer",f,d)}removeFeatureState(s,f,d){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,d)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,d){const m=this._tiles[s];m&&m.setDependencies(f,d)}reloadTilesForDependencies(s,f){for(const d in this._tiles)this._tiles[d].hasDependency(s,f)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(s,f))}}function oe(_,s){const f=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*s.wrap)-+(s.wrap<0);return _.overscaledZ-s.overscaledZ||d-f||s.canonical.y-_.canonical.y||s.canonical.x-_.canonical.x}function Je(_){return _==="raster"||_==="image"||_==="video"}Hr.maxOverzooming=10,Hr.maxUnderzooming=3;class Ye{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let d=1;d0?(m-I)/T:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Lr(_,s){let f=!0;return _==="always"||_!=="never"&&s!=="never"||(f=!1),f}class Zo{constructor(s,f,d){const m=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/d),this.yCellCount=Math.ceil(f/d);for(let I=0;Ithis.width||m<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=d&&this.height<=m){if(v)return[{key:null,x1:s,y1:f,x2:d,y2:m}];for(let k=0;k0}hitTestCircle(s,f,d,m,v){const I=s-d,T=s+d,M=f-d,k=f+d;if(T<0||I>this.width||k<0||M>this.height)return!1;const z=[];return this._forEachCell(I,M,T,k,this._queryCellCircle,z,{hitTest:!0,overlapMode:m,circle:{x:s,y:f,radius:d},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,d,m,v,I,T,M){const{seenUids:k,hitTest:z,overlapMode:F}=T,W=this.boxCells[v];if(W!==null){const ot=this.bboxes;for(const ct of W)if(!k.box[ct]){k.box[ct]=!0;const tt=4*ct,_t=this.boxKeys[ct];if(s<=ot[tt+2]&&f<=ot[tt+3]&&d>=ot[tt+0]&&m>=ot[tt+1]&&(!M||M(_t))&&(!z||!Lr(F,_t.overlapMode))&&(I.push({key:_t,x1:ot[tt],y1:ot[tt+1],x2:ot[tt+2],y2:ot[tt+3]}),z))return!0}}const st=this.circleCells[v];if(st!==null){const ot=this.circles;for(const ct of st)if(!k.circle[ct]){k.circle[ct]=!0;const tt=3*ct,_t=this.circleKeys[ct];if(this._circleAndRectCollide(ot[tt],ot[tt+1],ot[tt+2],s,f,d,m)&&(!M||M(_t))&&(!z||!Lr(F,_t.overlapMode))){const kt=ot[tt],ht=ot[tt+1],St=ot[tt+2];if(I.push({key:_t,x1:kt-St,y1:ht-St,x2:kt+St,y2:ht+St}),z)return!0}}}return!1}_queryCellCircle(s,f,d,m,v,I,T,M){const{circle:k,seenUids:z,overlapMode:F}=T,W=this.boxCells[v];if(W!==null){const ot=this.bboxes;for(const ct of W)if(!z.box[ct]){z.box[ct]=!0;const tt=4*ct,_t=this.boxKeys[ct];if(this._circleAndRectCollide(k.x,k.y,k.radius,ot[tt+0],ot[tt+1],ot[tt+2],ot[tt+3])&&(!M||M(_t))&&!Lr(F,_t.overlapMode))return I.push(!0),!0}}const st=this.circleCells[v];if(st!==null){const ot=this.circles;for(const ct of st)if(!z.circle[ct]){z.circle[ct]=!0;const tt=3*ct,_t=this.circleKeys[ct];if(this._circlesCollide(ot[tt],ot[tt+1],ot[tt+2],k.x,k.y,k.radius)&&(!M||M(_t))&&!Lr(F,_t.overlapMode))return I.push(!0),!0}}}_forEachCell(s,f,d,m,v,I,T,M){const k=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(d),W=this._convertToYCellCoord(m);for(let st=k;st<=F;st++)for(let ot=z;ot<=W;ot++)if(v.call(this,s,f,d,m,this.xCellCount*ot+st,I,T,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,d,m,v,I){const T=m-s,M=v-f,k=d+I;return k*k>T*T+M*M}_circleAndRectCollide(s,f,d,m,v,I,T){const M=(I-m)/2,k=Math.abs(s-(m+M));if(k>M+d)return!1;const z=(T-v)/2,F=Math.abs(f-(v+z));if(F>z+d)return!1;if(k<=M||F<=z)return!0;const W=k-M,st=F-z;return W*W+st*st<=d*d}}function Ze(_,s,f,d,m){const v=u.F();return s?(u.J(v,v,[1/m,1/m,1]),f||u.ad(v,v,d.angle)):u.K(v,d.labelPlaneMatrix,_),v}function ha(_,s,f,d,m){if(s){const v=u.ae(_);return u.J(v,v,[m,m,1]),f||u.ad(v,v,-d.angle),v}return d.glCoordMatrix}function Rr(_,s,f){let d;f?(d=[_.x,_.y,f(_.x,_.y),1],u.af(d,d,s)):(d=[_.x,_.y,0,1],xe(d,d,s));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m}}function ut(_,s){return .5+_/s*.5}function V(_,s){const f=_[0]/_[3],d=_[1]/_[3];return f>=-s[0]&&f<=s[0]&&d>=-s[1]&&d<=s[1]}function q(_,s,f,d,m,v,I,T,M,k){const z=d?_.textSizeData:_.iconSizeData,F=u.ag(z,f.transform.zoom),W=[256/f.width*2+1,256/f.height*2+1],st=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;st.clear();const ot=_.lineVertexArray,ct=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,tt=f.transform.width/f.transform.height;let _t=!1;for(let kt=0;ktMath.abs(f.x-s.x)*d?{useVertical:!0}:(_===u.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function vt(_,s,f,d,m,v,I,T,M,k,z,F,W,st,ot,ct){const tt=s/24,_t=_.lineOffsetX*tt,kt=_.lineOffsetY*tt;let ht;if(_.numGlyphs>1){const St=_.glyphStartIndex+_.numGlyphs,Rt=_.lineStartIndex,Ft=_.lineStartIndex+_.lineLength,Gt=X(tt,T,_t,kt,f,z,F,_,M,v,W,ot,ct);if(!Gt)return{notEnoughRoom:!0};const Jt=Rr(Gt.first.point,I,ct).point,Kt=Rr(Gt.last.point,I,ct).point;if(d&&!f){const ne=it(_.writingMode,Jt,Kt,st);if(ne)return ne}ht=[Gt.first];for(let ne=_.glyphStartIndex+1;ne0?Jt.point:Q(F,Gt,Rt,1,m,ct),ne=it(_.writingMode,Rt,Kt,st);if(ne)return ne}const St=Ot(tt*T.getoffsetX(_.glyphStartIndex),_t,kt,f,z,F,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,M,v,W,ot,ct);if(!St)return{notEnoughRoom:!0};ht=[St]}for(const St of ht)u.aj(k,St.point,St.angle);return{}}function Q(_,s,f,d,m,v){const I=Rr(_.add(_.sub(s)._unit()),m,v).point,T=f.sub(I);return f.add(T._mult(d/T.mag()))}function bt(_,s){const{projectionCache:f,lineVertexArray:d,labelPlaneMatrix:m,tileAnchorPoint:v,distanceFromAnchor:I,getElevation:T,previousVertex:M,direction:k,absOffsetX:z}=s;if(f.projections[_])return f.projections[_];const F=new u.P(d.getx(_),d.gety(_)),W=Rr(F,m,T);if(W.signedDistanceFromCamera>0)return f.projections[_]=W.point,W.point;const st=_-k;return Q(I===0?v:new u.P(d.getx(st),d.gety(st)),F,M,z-I+1,m,T)}function dt(_,s,f){return _._unit()._perp()._mult(s*f)}function It(_,s,f,d,m,v,I,T){const{projectionCache:M,direction:k}=T;if(M.offsets[_])return M.offsets[_];const z=f.add(s);if(_+k=m)return M.offsets[_]=z,z;const F=bt(_+k,T),W=dt(F.sub(f),I,k),st=f.add(W),ot=F.add(W);return M.offsets[_]=u.ak(v,z,st,ot)||z,M.offsets[_]}function Ot(_,s,f,d,m,v,I,T,M,k,z,F,W,st){const ot=d?_-s:_+s;let ct=ot>0?1:-1,tt=0;d&&(ct*=-1,tt=Math.PI),ct<0&&(tt+=Math.PI);let _t,kt,ht=ct>0?T+I:T+I+1,St=m,Rt=m,Ft=0,Gt=0;const Jt=Math.abs(ot),Kt=[];let ne;for(;Ft+Gt<=Jt;){if(ht+=ct,ht=M)return null;Ft+=Gt,Rt=St,kt=_t;const ae={projectionCache:F,lineVertexArray:k,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:Ft,getElevation:st,previousVertex:Rt,direction:ct,absOffsetX:Jt};if(St=bt(ht,ae),f===0)Kt.push(Rt),ne=St.sub(Rt);else{let Ne;const $e=St.sub(Rt);Ne=$e.mag()===0?dt(bt(ht+ct,ae).sub(St),f,ct):dt($e,f,ct),kt||(kt=Rt.add(Ne)),_t=It(ht,Ne,St,T,M,kt,f,ae),Kt.push(kt),ne=_t.sub(kt)}Gt=ne.mag()}const se=ne._mult((Jt-Ft)/Gt)._add(kt||Rt),Qe=tt+Math.atan2(St.y-Rt.y,St.x-Rt.x);return Kt.push(se),{point:se,angle:W?Qe:0,path:Kt}}const Ut=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ht(_,s){for(let f=0;f<_;f++){const d=s.length;s.resize(d+4),s.float32.set(Ut,3*d)}}function xe(_,s,f){const d=s[0],m=s[1];return _[0]=f[0]*d+f[4]*m+f[12],_[1]=f[1]*d+f[5]*m+f[13],_[3]=f[3]*d+f[7]*m+f[15],_}const Le=100;class Ge{constructor(s,f=new Zo(s.width+200,s.height+200,25),d=new Zo(s.width+200,s.height+200,25)){this.transform=s,this.grid=f,this.ignoredGrid=d,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Le,this.screenBottomBoundary=s.height+Le,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,f,d,m,v,I){const T=this.projectAndGetPerspectiveRatio(m,s.anchorPointX,s.anchorPointY,I),M=d*T.perspectiveRatio,k=s.x1*M+T.point.x,z=s.y1*M+T.point.y,F=s.x2*M+T.point.x,W=s.y2*M+T.point.y;return!this.isInsideGrid(k,z,F,W)||f!=="always"&&this.grid.hitTest(k,z,F,W,f,v)||T.perspectiveRatio=1;rn--)$e.push(ae.path[rn]);for(let rn=1;rnRr(ln,M,ot));$e=rn.some(ln=>ln.signedDistanceFromCamera<=0)?[]:rn.map(ln=>ln.point)}let Be=[];if($e.length>0){const rn=$e[0].clone(),ln=$e[0].clone();for(let wr=1;wr<$e.length;wr++)rn.x=Math.min(rn.x,$e[wr].x),rn.y=Math.min(rn.y,$e[wr].y),ln.x=Math.max(ln.x,$e[wr].x),ln.y=Math.max(ln.y,$e[wr].y);Be=rn.x>=ne.x&&ln.x<=se.x&&rn.y>=ne.y&&ln.y<=se.y?[$e]:ln.xse.x||ln.yse.y?[]:u.al([$e],ne.x,ne.y,se.x,se.y)}for(const rn of Be){Qe.reset(rn,.25*Kt);let ln=0;ln=Qe.length<=.5*Kt?1:Math.ceil(Qe.paddedLength/xn)+1;for(let wr=0;wr=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(s,f,d,m){return d>=0&&s=0&&fd.collisionGroupID===f}}return this.collisionGroups[s]}}function $r(_,s,f,d,m){const{horizontalAlign:v,verticalAlign:I}=u.at(_);return new u.P(-(v-.5)*s+d[0]*m,-(I-.5)*f+d[1]*m)}function Zi(_,s,f,d,m,v){const{x1:I,x2:T,y1:M,y2:k,anchorPointX:z,anchorPointY:F}=_,W=new u.P(s,f);return d&&W._rotate(m?v:-v),{x1:I+W.x,y1:M+W.y,x2:T+W.x,y2:k+W.y,anchorPointX:z,anchorPointY:F}}class lo{constructor(s,f,d,m,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Ge(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new vr(m),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,d,m){const v=d.getBucket(f),I=d.latestFeatureIndex;if(!v||!I||f.id!==v.layerIds[0])return;const T=d.collisionBoxArray,M=v.layers[0].layout,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),z=d.tileSize/u.W,F=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),W=M.get("text-pitch-alignment")==="map",st=M.get("text-rotation-alignment")==="map",ot=qe(d,1,this.transform.zoom),ct=Ze(F,W,st,this.transform,ot);let tt=null;if(W){const kt=ha(F,W,st,this.transform,ot);tt=u.K([],this.transform.labelPlaneMatrix,kt)}this.retainedQueryData[v.bucketInstanceId]=new nn(v.bucketInstanceId,I,v.sourceLayerIndex,v.index,d.tileID);const _t={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:ct,labelToScreenMatrix:tt,scale:k,textPixelRatio:z,holdingForFade:d.holdingForFade(),collisionBoxArray:T,partiallyEvaluatedTextSize:u.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(m)for(const kt of v.sortKeyRanges){const{sortKey:ht,symbolInstanceStart:St,symbolInstanceEnd:Rt}=kt;s.push({sortKey:ht,symbolInstanceStart:St,symbolInstanceEnd:Rt,parameters:_t})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:_t})}attemptAnchorPlacement(s,f,d,m,v,I,T,M,k,z,F,W,st,ot,ct,tt){const _t=u.ap[s.textAnchor],kt=[s.textOffset0,s.textOffset1],ht=$r(_t,d,m,kt,v),St=this.collisionIndex.placeCollisionBox(Zi(f,ht.x,ht.y,I,T,this.transform.angle),F,M,k,z.predicate,tt);if((!ct||this.collisionIndex.placeCollisionBox(Zi(ct,ht.x,ht.y,I,T,this.transform.angle),F,M,k,z.predicate,tt).box.length!==0)&&St.box.length>0){let Rt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID]&&this.prevPlacement.placements[W.crossTileID].text&&(Rt=this.prevPlacement.variableOffsets[W.crossTileID].anchor),W.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[W.crossTileID]={textOffset:kt,width:d,height:m,anchor:_t,textBoxScale:v,prevAnchor:Rt},this.markUsedJustification(st,_t,W,ot),st.allowVerticalPlacement&&(this.markUsedOrientation(st,ot,W),this.placedOrientations[W.crossTileID]=ot),{shift:ht,placedGlyphBoxes:St}}}placeLayerBucketPart(s,f,d){const{bucket:m,layout:v,posMatrix:I,textLabelPlaneMatrix:T,labelToScreenMatrix:M,textPixelRatio:k,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:W,collisionGroup:st}=s.parameters,ot=v.get("text-optional"),ct=v.get("icon-optional"),tt=u.aq(v,"text-overlap","text-allow-overlap"),_t=tt==="always",kt=u.aq(v,"icon-overlap","icon-allow-overlap"),ht=kt==="always",St=v.get("text-rotation-alignment")==="map",Rt=v.get("text-pitch-alignment")==="map",Ft=v.get("icon-text-fit")!=="none",Gt=v.get("symbol-z-order")==="viewport-y",Jt=_t&&(ht||!m.hasIconData()||ct),Kt=ht&&(_t||!m.hasTextData()||ot);!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F);const ne=this.retainedQueryData[m.bucketInstanceId].tileID,se=this.terrain?(ae,Ne)=>this.terrain.getElevation(ne,ae,Ne):null,Qe=(ae,Ne)=>{var $e,xn;if(f[ae.crossTileID])return;if(z)return void(this.placements[ae.crossTileID]=new nr(!1,!1,!1));let Be=!1,rn=!1,ln=!0,wr=null,Fn={box:null,offscreen:null},Ao={box:null,offscreen:null},ti=null,pr=null,ei=null,ko=0,Fs=0,Ua=0;Ne.textFeatureIndex?ko=Ne.textFeatureIndex:ae.useRuntimeCollisionCircles&&(ko=ae.featureIndex),Ne.verticalTextFeatureIndex&&(Fs=Ne.verticalTextFeatureIndex);const pc=Ne.textBox;if(pc){const Yr=Kr=>{let mr=u.ah.horizontal;if(m.allowVerticalPlacement&&!Kr&&this.prevPlacement){const Jo=this.prevPlacement.placedOrientations[ae.crossTileID];Jo&&(this.placedOrientations[ae.crossTileID]=Jo,mr=Jo,this.markUsedOrientation(m,mr,ae))}return mr},dr=(Kr,mr)=>{if(m.allowVerticalPlacement&&ae.numVerticalGlyphVertices>0&&Ne.verticalTextBox){for(const Jo of m.writingModes)if(Jo===u.ah.vertical?(Fn=mr(),Ao=Fn):Fn=Kr(),Fn&&Fn.box&&Fn.box.length)break}else Fn=Kr()},ir=ae.textAnchorOffsetStartIndex,Ko=ae.textAnchorOffsetEndIndex;if(Ko===ir){const Kr=(mr,Jo)=>{const Jr=this.collisionIndex.placeCollisionBox(mr,tt,k,I,st.predicate,se);return Jr&&Jr.box&&Jr.box.length&&(this.markUsedOrientation(m,Jo,ae),this.placedOrientations[ae.crossTileID]=Jo),Jr};dr(()=>Kr(pc,u.ah.horizontal),()=>{const mr=Ne.verticalTextBox;return m.allowVerticalPlacement&&ae.numVerticalGlyphVertices>0&&mr?Kr(mr,u.ah.vertical):{box:null,offscreen:null}}),Yr(Fn&&Fn.box&&Fn.box.length)}else{let Kr=u.ap[(xn=($e=this.prevPlacement)===null||$e===void 0?void 0:$e.variableOffsets[ae.crossTileID])===null||xn===void 0?void 0:xn.anchor];const mr=(Jr,Pr,vp)=>{const Cm=Jr.x2-Jr.x1,Cl=Jr.y2-Jr.y1,Tl=ae.textBoxScale,Mh=Ft&&kt==="never"?Pr:null;let qa={box:[],offscreen:!1},bp=tt==="never"?1:2,Tm="never";Kr&&bp++;for(let xp=0;xpmr(pc,Ne.iconBox,u.ah.horizontal),()=>{const Jr=Ne.verticalTextBox;return m.allowVerticalPlacement&&!(Fn&&Fn.box&&Fn.box.length)&&ae.numVerticalGlyphVertices>0&&Jr?mr(Jr,Ne.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Fn&&(Be=Fn.box,ln=Fn.offscreen);const Jo=Yr(Fn&&Fn.box);if(!Be&&this.prevPlacement){const Jr=this.prevPlacement.variableOffsets[ae.crossTileID];Jr&&(this.variableOffsets[ae.crossTileID]=Jr,this.markUsedJustification(m,Jr.anchor,ae,Jo))}}}if(ti=Fn,Be=ti&&ti.box&&ti.box.length>0,ln=ti&&ti.offscreen,ae.useRuntimeCollisionCircles){const Yr=m.text.placedSymbolArray.get(ae.centerJustifiedTextSymbolIndex),dr=u.ai(m.textSizeData,W,Yr),ir=v.get("text-padding");pr=this.collisionIndex.placeCollisionCircles(tt,Yr,m.lineVertexArray,m.glyphOffsetArray,dr,I,T,M,d,Rt,st.predicate,ae.collisionCircleDiameter,ir,se),pr.circles.length&&pr.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),Be=_t||pr.circles.length>0&&!pr.collisionDetected,ln=ln&&pr.offscreen}if(Ne.iconFeatureIndex&&(Ua=Ne.iconFeatureIndex),Ne.iconBox){const Yr=dr=>{const ir=Ft&&wr?Zi(dr,wr.x,wr.y,St,Rt,this.transform.angle):dr;return this.collisionIndex.placeCollisionBox(ir,kt,k,I,st.predicate,se)};Ao&&Ao.box&&Ao.box.length&&Ne.verticalIconBox?(ei=Yr(Ne.verticalIconBox),rn=ei.box.length>0):(ei=Yr(Ne.iconBox),rn=ei.box.length>0),ln=ln&&ei.offscreen}const Ga=ot||ae.numHorizontalGlyphVertices===0&&ae.numVerticalGlyphVertices===0,Bs=ct||ae.numIconVertices===0;if(Ga||Bs?Bs?Ga||(rn=rn&&Be):Be=rn&&Be:rn=Be=rn&&Be,Be&&ti&&ti.box&&this.collisionIndex.insertCollisionBox(ti.box,tt,v.get("text-ignore-placement"),m.bucketInstanceId,Ao&&Ao.box&&Fs?Fs:ko,st.ID),rn&&ei&&this.collisionIndex.insertCollisionBox(ei.box,kt,v.get("icon-ignore-placement"),m.bucketInstanceId,Ua,st.ID),pr&&(Be&&this.collisionIndex.insertCollisionCircles(pr.circles,tt,v.get("text-ignore-placement"),m.bucketInstanceId,ko,st.ID),d)){const Yr=m.bucketInstanceId;let dr=this.collisionCircleArrays[Yr];dr===void 0&&(dr=this.collisionCircleArrays[Yr]=new Zr);for(let ir=0;ir=0;--Ne){const $e=ae[Ne];Qe(m.symbolInstances.get($e),m.collisionArrays[$e])}}else for(let ae=s.symbolInstanceStart;ae=0&&(s.text.placedSymbolArray.get(T).crossTileID=v>=0&&T!==v?0:d.crossTileID)}markUsedOrientation(s,f,d){const m=f===u.ah.horizontal||f===u.ah.horizontalOnly?f:0,v=f===u.ah.vertical?f:0,I=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const T of I)s.text.placedSymbolArray.get(T).placedOrientation=m;d.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let d=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const m=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},I=f?f.variableOffsets:{},T=f?f.placedOrientations:{};for(const M in this.placements){const k=this.placements[M],z=v[M];z?(this.opacities[M]=new Vn(z,m,k.text,k.icon),d=d||k.text!==z.text.placed||k.icon!==z.icon.placed):(this.opacities[M]=new Vn(null,m,k.text,k.icon,k.skipFade),d=d||k.text||k.icon)}for(const M in v){const k=v[M];if(!this.opacities[M]){const z=new Vn(k,m,!1,!1);z.isHidden()||(this.opacities[M]=z,d=d||k.text.placed||k.icon.placed)}}for(const M in I)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=I[M]);for(const M in T)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=T[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const d={};for(const m of f){const v=m.getBucket(s);v&&m.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,d,m.collisionBoxArray)}}updateBucketOpacities(s,f,d){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const m=s.layers[0],v=m.layout,I=new Vn(null,0,!1,!1,!0),T=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",W=v.get("icon-text-fit")!=="none",st=new Vn(null,0,T&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(T||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&d&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(d);const ot=(ct,tt,_t)=>{for(let kt=0;kt0,Ft=this.placedOrientations[tt.crossTileID],Gt=Ft===u.ah.vertical,Jt=Ft===u.ah.horizontal||Ft===u.ah.horizontalOnly;if(_t>0||kt>0){const Kt=uo(St.text);ot(s.text,_t,Gt?Wu:Kt),ot(s.text,kt,Jt?Wu:Kt);const ne=St.text.isHidden();[tt.rightJustifiedTextSymbolIndex,tt.centerJustifiedTextSymbolIndex,tt.leftJustifiedTextSymbolIndex].forEach(ae=>{ae>=0&&(s.text.placedSymbolArray.get(ae).hidden=ne||Gt?1:0)}),tt.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(tt.verticalPlacedTextSymbolIndex).hidden=ne||Jt?1:0);const se=this.variableOffsets[tt.crossTileID];se&&this.markUsedJustification(s,se.anchor,tt,Ft);const Qe=this.placedOrientations[tt.crossTileID];Qe&&(this.markUsedJustification(s,"left",tt,Qe),this.markUsedOrientation(s,Qe,tt))}if(Rt){const Kt=uo(St.icon),ne=!(W&&tt.verticalPlacedIconSymbolIndex&&Gt);tt.placedIconSymbolIndex>=0&&(ot(s.icon,tt.numIconVertices,ne?Kt:Wu),s.icon.placedSymbolArray.get(tt.placedIconSymbolIndex).hidden=St.icon.isHidden()),tt.verticalPlacedIconSymbolIndex>=0&&(ot(s.icon,tt.numVerticalIconVertices,ne?Wu:Kt),s.icon.placedSymbolArray.get(tt.verticalPlacedIconSymbolIndex).hidden=St.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Kt=s.collisionArrays[ct];if(Kt){let ne=new u.P(0,0);if(Kt.textBox||Kt.verticalTextBox){let Qe=!0;if(k){const ae=this.variableOffsets[ht];ae?(ne=$r(ae.anchor,ae.width,ae.height,ae.textOffset,ae.textBoxScale),z&&ne._rotate(F?this.transform.angle:-this.transform.angle)):Qe=!1}Kt.textBox&&gi(s.textCollisionBox.collisionVertexArray,St.text.placed,!Qe||Gt,ne.x,ne.y),Kt.verticalTextBox&&gi(s.textCollisionBox.collisionVertexArray,St.text.placed,!Qe||Jt,ne.x,ne.y)}const se=!!(!Jt&&Kt.verticalIconBox);Kt.iconBox&&gi(s.iconCollisionBox.collisionVertexArray,St.icon.placed,se,W?ne.x:0,W?ne.y:0),Kt.verticalIconBox&&gi(s.iconCollisionBox.collisionVertexArray,St.icon.placed,!se,W?ne.x:0,W?ne.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const ct=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ct.invProjMatrix,s.placementViewportMatrix=ct.viewportMatrix,s.collisionCircleArray=ct.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function gi(_,s,f,d,m){_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0),_.emplaceBack(s?1:0,f?1:0,d||0,m||0)}const Ds=Math.pow(2,25),qd=Math.pow(2,24),wy=Math.pow(2,17),On=Math.pow(2,16),Uf=Math.pow(2,9),Gf=Math.pow(2,8),Lo=Math.pow(2,1);function uo(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const s=_.placed?1:0,f=Math.floor(127*_.opacity);return f*Ds+s*qd+f*wy+s*On+f*Uf+s*Gf+f*Lo+s}const Wu=0;class Xo{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,d,m,v){const I=this._bucketParts;for(;this._currentTileIndexT.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&C.now()-m>2;for(;this._currentPlacementIndex>=0;){const I=f[s[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=T)&&(!I.maxzoom||I.maxzoom>T)){if(this._inProgressLayer||(this._inProgressLayer=new Xo(I)),this._inProgressLayer.continuePlacement(d[I.source],this.placement,this._showCollisionBoxes,I,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const Ql=512/u.W/2;class Wc{constructor(s,f,d){this.tileID=s,this.bucketInstanceId=d,this._symbolsByKey={};const m=new Map;for(let v=0;v({x:Math.floor(M.anchorX*Ql),y:Math.floor(M.anchorY*Ql)})),crossTileIDs:I.map(M=>M.crossTileID)};if(T.positions.length>128){const M=new u.au(T.positions.length,16,Uint16Array);for(const{x:k,y:z}of T.positions)M.add(k,z);M.finish(),delete T.positions,T.index=M}this._symbolsByKey[v]=T}}getScaledCoordinates(s,f){const{x:d,y:m,z:v}=this.tileID.canonical,{x:I,y:T,z:M}=f.canonical,k=Ql/Math.pow(2,M-v),z=(T*u.W+s.anchorY)*k,F=m*u.W*Ql;return{x:Math.floor((I*u.W+s.anchorX)*k-d*u.W*Ql),y:Math.floor(z-F)}}findMatches(s,f,d){const m=this.tileID.canonical.zs)}}class Xr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Hu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const d in this.indexes){const m=this.indexes[d],v={};for(const I in m){const T=m[I];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+f),v[T.tileID.key]=T}this.indexes[d]=v}this.lng=s}addBucket(s,f,d){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const T in I){const M=I[T];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,m)}else{const T=I[s.scaledTo(Number(v)).key];T&&T.findMatches(f.symbolInstances,s,m)}}for(let v=0;v{f[d]=!0});for(const d in this.layerIndexes)f[d]||delete this.layerIndexes[d]}}const fr=(_,s)=>u.t(_,s&&s.filter(f=>f.identifier!=="source.canvas")),Hc=u.av();class Po extends u.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const d in this.sourceCaches){const m=this.sourceCaches[d].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[d].reload()}},this.map=s,this.dispatcher=new Yn(kn(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(d,m)=>this.getGlyphs(d,m)),this.dispatcher.registerMessageHandler("GI",(d,m)=>this.getImages(d,m)),this.imageManager=new Qt,this.imageManager.setEventedParent(this),this.glyphManager=new Wt(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ue(256,512),this.crossTileSymbolIndex=new Na,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",u.ax()),te().on(Ii,this._rtlPluginLoaded),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.sourceCaches[d.sourceId];if(!m)return;const v=m.getSource();if(v&&v.vectorLayerIds)for(const I in this._layers){const T=this._layers[I];T.source===v.id&&this._validateLayer(T)}})}loadURL(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,u.h(m,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,d)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new u.j(v))})}loadJSON(s,f={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,C.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(Hc,{validate:!1})}_load(s,f,d){var m;const v=f.transformStyle?f.transformStyle(d,s):s;if(!f.validate||!fr(this,u.x(v))){this._loaded=!0,this.stylesheet=v;for(const I in v.sources)this.addSource(I,v.sources[I],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new We(this.stylesheet.light),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const s=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const d=u.az(f);d.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=d}}_loadSprite(s,f=!1,d=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,I,T,M){return u._(this,void 0,void 0,function*(){const k=Et(v),z=T>1?"@2x":"",F={},W={};for(const{id:st,url:ot}of k){const ct=I.transformRequest(I.normalizeSpriteURL(ot,z,".json"),"SpriteJSON");F[st]=u.h(ct,M);const tt=I.transformRequest(I.normalizeSpriteURL(ot,z,".png"),"SpriteImage");W[st]=G.getImage(tt,M)}return yield Promise.all([...Object.values(F),...Object.values(W)]),function(st,ot){return u._(this,void 0,void 0,function*(){const ct={};for(const tt in st){ct[tt]={};const _t=C.getImageCanvasContext((yield ot[tt]).data),kt=(yield st[tt]).data;for(const ht in kt){const{width:St,height:Rt,x:Ft,y:Gt,sdf:Jt,pixelRatio:Kt,stretchX:ne,stretchY:se,content:Qe}=kt[ht];ct[tt][ht]={data:null,pixelRatio:Kt,sdf:Jt,stretchX:ne,stretchY:se,content:Qe,spriteData:{width:St,height:Rt,x:Ft,y:Gt,context:_t}}}}return ct})}(F,W)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const I in v){this._spritesImagesIds[I]=[];const T=this._spritesImagesIds[I]?this._spritesImagesIds[I].filter(M=>!(M in v)):[];for(const M of T)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[I]){const k=I==="default"?M:`${I}:${M}`;this._spritesImagesIds[I].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,v[I][M],!1):this.imageManager.addImage(k,v[I][M]),f&&(this._changedImages[k]=!0)}}}).catch(v=>{this._spriteRequest=null,m=v,this.fire(new u.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(m)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const d=s.sourceLayer;if(!d)return;const m=f.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${m.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const d=[];for(const m of s)f[m]&&d.push(f[m]);return d}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const d of f){const m=this._layers[d];m.type!=="custom"&&(s[d]=m.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const m=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(m.length||v.length)&&this._updateWorkerLayers(m,v);for(const I in this._updatedSources){const T=this._updatedSources[I];if(T==="reload")this._reloadSource(I);else{if(T!=="clear")throw new Error(`Invalid action ${T}`);this._clearSource(I)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const d={};for(const m in this.sourceCaches){const v=this.sourceCaches[m];d[m]=v.used,v.used=!1}for(const m of this._order){const v=this._layers[m];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const m in d){const v=this.sourceCaches[m];!!d[m]!=!!v.used&&v.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var d;this._checkLoaded();const m=this.serialize();if(s=f.transformStyle?f.transformStyle(m,s):s,((d=f.validate)===null||d===void 0||d)&&fr(this,u.x(s)))return!1;(s=u.aA(s)).layers=u.ay(s.layers);const v=u.aB(m,s),I=this._getOperationsToPerform(v);if(I.unimplemented.length>0)throw new Error(`Unimplemented: ${I.unimplemented.join(", ")}.`);if(I.operations.length===0)return!1;for(const T of I.operations)T();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],d=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":f.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":f.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,m.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":f.push(()=>{});break;default:d.push(m.command)}return{operations:f,unimplemented:d}}addImage(s,f){if(this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new u.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,d={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" 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(u.x.source,`sources.${s}`,f,null,d))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Hr(s,f,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===s)return this.fire(new u.j(new Error(`Source "${s}" cannot be removed while layer "${d}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const d=this.sourceCaches[s].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,d={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new u.j(new Error(`Layer "${m}" already exists on this map.`)));let v;if(s.type==="custom"){if(fr(this,u.aC(s)))return;v=u.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=u.aA(s),s=u.e(s,{source:m})),this._validate(u.x.layer,`layers.${m}`,s,{arrayIndex:-1},d))return;v=u.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:m}})}const I=f?this._order.indexOf(f):this._order.length;if(f&&I===-1)this.fire(new u.j(new Error(`Cannot add layer "${m}" before non-existing layer "${f}".`)));else{if(this._order.splice(I,0,m),this._layerOrderChanged=!0,this._layers[m]=v,this._removedLayers[m]&&v.source&&v.type!=="custom"){const T=this._removedLayers[m];delete this._removedLayers[m],T.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new u.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const d=this._order.indexOf(s);this._order.splice(d,1);const m=f?this._order.indexOf(f):this._order.length;f&&m===-1?this.fire(new u.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const d=this._order.indexOf(s);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,d){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===f&&m.maxzoom===d||(f!=null&&(m.minzoom=f),d!=null&&(m.maxzoom=d),this._updateLayer(m)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,d={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!u.aD(m.filter,f))return f==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(u.x.filter,`layers.${m.id}.filter`,f,null,d)||(m.filter=u.aA(f),this._updateLayer(m)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return u.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getLayoutProperty(f),d)||(v.setLayoutProperty(f,d,m),this._updateLayer(v)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const d=this.getLayer(s);if(d)return d.getLayoutProperty(f);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,d,m={}){this._checkLoaded();const v=this.getLayer(s);v?u.aD(v.getPaintProperty(f),d)||(v.setPaintProperty(f,d,m)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new u.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const d=s.source,m=s.sourceLayer,v=this.sourceCaches[d];if(v===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const I=v.getSource().type;I==="geojson"&&m?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||m?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(m,s.id,f)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const d=s.source,m=this.sourceCaches[d];if(m===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const v=m.getSource().type,I=v==="vector"?s.sourceLayer:void 0;v!=="vector"||I?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(I,s.id,f):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,d=s.sourceLayer,m=this.sourceCaches[f];if(m!==void 0)return m.getSource().type!=="vector"||d?(s.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(d,s.id)):void this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=u.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,m=this.stylesheet;return u.aF({version:m.version,name:m.name,metadata:m.metadata,light:m.light,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:f,terrain:d},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const f=I=>this._layers[I].type==="fill-extrusion",d={},m=[];for(let I=this._order.length-1;I>=0;I--){const T=this._order[I];if(f(T)){d[T]=I;for(const M of s){const k=M[T];if(k)for(const z of k)m.push(z)}}}m.sort((I,T)=>T.intersectionZ-I.intersectionZ);const v=[];for(let I=this._order.length-1;I>=0;I--){const T=this._order[I];if(f(T))for(let M=m.length-1;M>=0;M--){const k=m[M].feature;if(d[k.layer.id]{const Jt=_t.featureSortOrder;if(Jt){const Kt=Jt.indexOf(Ft.featureIndex);return Jt.indexOf(Gt.featureIndex)-Kt}return Gt.featureIndex-Ft.featureIndex});for(const Ft of Rt)St.push(Ft)}}for(const _t in ot)ot[_t].forEach(kt=>{const ht=kt.feature,St=k[T[_t].source].getFeatureState(ht.layer["source-layer"],ht.id);ht.source=ht.layer.source,ht.layer["source-layer"]&&(ht.sourceLayer=ht.layer["source-layer"]),ht.state=St});return ot}(this._layers,I,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",f.filter,null,f);const d=this.sourceCaches[s];return d?function(m,v){const I=m.getRenderableIds().map(k=>m.getTileByID(k)),T=[],M={};for(let k=0;kW.getTileByID(st)).sort((st,ot)=>ot.tileID.overscaledZ-st.tileID.overscaledZ||(st.tileID.isLessThan(ot.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(z,M[z.source],s.center.lng);I=I||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(C.now(),s.zoom))&&(this.pauseablePlacement=new Yo(s,this.map.terrain,this._order,v,f,d,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(C.now()),T=!0),I&&this.pauseablePlacement.placement.setStale()),T||I)for(const k of this._order){const z=this._layers[k];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(C.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,f.icons),d})}getGlyphs(s,f){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(f.stacks),m=this.sourceCaches[f.source];return m&&m.setDependencies(f.tileID.key,f.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(u.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,d={},m){this._checkLoaded();const v=[{id:s,url:f}],I=[...Et(this.stylesheet.sprite),...v];this._validate(u.x.sprite,"sprite",I,null,d)||(this.stylesheet.sprite=I,this._loadSprite(v,!0,m))}removeSprite(s){this._checkLoaded();const f=Et(this.stylesheet.sprite);if(f.find(d=>d.id===s)){if(this._spritesImagesIds[s])for(const d of this._spritesImagesIds[s])this.imageManager.removeImage(d),this._changedImages[d]=!0;f.splice(f.findIndex(d=>d.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Et(this.stylesheet.sprite)}setSprite(s,f={},d){this._checkLoaded(),s&&this._validate(u.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,d):(this._unloadSprite(),d&&d(null)))}}var Zc=u.X([{name:"a_pos",type:"Int16",components:2}]),Rs="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 Zu={prelude:zn(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -576,13 +576,13 @@ uniform ${z} ${F} u_${W}; #else ${z} ${F} ${W} = u_${W}; #endif -`}),staticAttributes:d,staticUniforms:I}}class Xc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,d,m,v,I,T,M,k){this.context=s;let z=this.boundPaintVertexBuffers.length!==m.length;for(let F=0;!z&&F({u_depth:new u.aG(Ft,Gt.u_depth),u_terrain:new u.aG(Ft,Gt.u_terrain),u_terrain_dim:new u.aH(Ft,Gt.u_terrain_dim),u_terrain_matrix:new u.aI(Ft,Gt.u_terrain_matrix),u_terrain_unpack:new u.aJ(Ft,Gt.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Ft,Gt.u_terrain_exaggeration)}))(s,Rt),this.binderUniforms=d?d.getUniforms(s,Rt):[]}draw(s,f,d,m,v,I,T,M,k,z,F,W,st,ot,ct,tt,_t,kt){const ht=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(m),s.setColorMode(v),s.setCullFace(I),M){s.activeTexture.set(ht.TEXTURE2),ht.bindTexture(ht.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ht.TEXTURE3),ht.bindTexture(ht.TEXTURE_2D,M.texture);for(const Rt in this.terrainUniforms)this.terrainUniforms[Rt].set(M[Rt])}for(const Rt in this.fixedUniforms)this.fixedUniforms[Rt].set(T[Rt]);ct&&ct.setUniforms(s,this.binderUniforms,st,{zoom:ot});let St=0;switch(f){case ht.LINES:St=2;break;case ht.TRIANGLES:St=3;break;case ht.LINE_STRIP:St=1}for(const Rt of W.get()){const Ft=Rt.vaos||(Rt.vaos={});(Ft[k]||(Ft[k]=new Xc)).bind(s,this,z,ct?ct.getPaintVertexBuffers():[],F,Rt.vertexOffset,tt,_t,kt),ht.drawElements(f,Rt.primitiveLength*St,ht.UNSIGNED_SHORT,Rt.primitiveOffset*St*2)}}}function Yc(_,s,f){const d=1/qe(f,1,s.transform.tileZoom),m=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/m,I=v*(f.tileID.canonical.x+f.tileID.wrap*m),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[I>>16,T>>16],u_pixel_coord_lower:[65535&I,65535&T]}}const Zu=(_,s,f,d)=>{const m=s.style.light,v=m.properties.get("position"),I=[v.x,v.y,v.z],T=function(){var k=new u.A(9);return u.A!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0),k[0]=1,k[4]=1,k[8]=1,k}();m.properties.get("anchor")==="viewport"&&function(k,z){var F=Math.sin(z),W=Math.cos(z);k[0]=W,k[1]=F,k[2]=0,k[3]=-F,k[4]=W,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(T,-s.transform.angle),function(k,z,F){var W=z[0],st=z[1],ot=z[2];k[0]=W*F[0]+st*F[3]+ot*F[6],k[1]=W*F[1]+st*F[4]+ot*F[7],k[2]=W*F[2]+st*F[5]+ot*F[8]}(I,I,T);const M=m.properties.get("color");return{u_matrix:_,u_lightpos:I,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},Sy=(_,s,f,d,m,v,I)=>u.e(Zu(_,s,f,d),Yc(v,s,I),{u_height_factor:-Math.pow(2,m.overscaledZ)/I.tileSize/8}),jd=_=>({u_matrix:_}),Kc=(_,s,f,d)=>u.e(jd(_),Yc(f,s,d)),Ey=(_,s)=>({u_matrix:_,u_world:s}),Wd=(_,s,f,d,m)=>u.e(Kc(_,s,f,d),{u_world:m}),Iy=(_,s,f,d)=>{const m=_.transform;let v,I;if(d.paint.get("circle-pitch-alignment")==="map"){const T=qe(f,1,m.zoom);v=!0,I=[T,T]}else v=!1,I=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:I}},Hd=(_,s,f)=>{const d=qe(f,1,s.zoom),m=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*m),s.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:v}},Zd=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),Jc=_=>({u_matrix:_}),Xd=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:qe(s,1,f),u_intensity:d});function Yd(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const Qc=(_,s,f,d)=>{const m=_.transform;return{u_matrix:Xu(_,s,f,d),u_ratio:1/qe(s,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Kd=(_,s,f,d,m)=>u.e(Qc(_,s,f,m),{u_image:0,u_image_height:d}),yl=(_,s,f,d,m)=>{const v=_.transform,I=Mo(s,v);return{u_matrix:Xu(_,s,f,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/qe(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[I,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},$c=(_,s,f,d,m,v)=>{const I=_.lineAtlas,T=Mo(s,_.transform),M=f.layout.get("line-cap")==="round",k=I.getDash(d.from,M),z=I.getDash(d.to,M),F=k.width*m.fromScale,W=z.width*m.toScale;return u.e(Qc(_,s,f,v),{u_patternscale_a:[T/F,-k.height/2],u_patternscale_b:[T/W,-z.height/2],u_sdfgamma:I.width/(256*Math.min(F,W)*_.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:z.y,u_mix:m.t})};function Mo(_,s){return 1/qe(_,1,s.tileZoom)}function Xu(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const th=(_,s,f,d,m)=>{return{u_matrix:_,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(I=m.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Yu(m.paint.get("raster-hue-rotate"))};var v,I};function Yu(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const Ku=(_,s,f,d,m,v,I,T,M,k)=>{const z=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:I,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},Ju=(_,s,f,d,m,v,I,T,M,k,z)=>{const F=m.transform;return u.e(Ku(_,s,f,d,m,v,I,T,M,k),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+z})},Qu=(_,s,f,d,m,v,I,T,M,k)=>u.e(Ju(_,s,f,d,m,v,I,T,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),Cy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),Ty=(_,s,f,d,m,v)=>u.e(function(I,T,M,k){const z=M.imageManager.getPattern(I.from.toString()),F=M.imageManager.getPattern(I.to.toString()),{width:W,height:st}=M.imageManager.getPixelSize(),ot=Math.pow(2,k.tileID.overscaledZ),ct=k.tileSize*Math.pow(2,M.transform.tileZoom)/ot,tt=ct*(k.tileID.canonical.x+k.tileID.wrap*ot),_t=ct*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[W,st],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/qe(k,1,M.transform.tileZoom),u_pixel_coord_upper:[tt>>16,_t>>16],u_pixel_coord_lower:[65535&tt,65535&_t]}}(d,v,f,m),{u_matrix:_,u_opacity:s}),Jd={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Ly{constructor(s,f,d){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){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,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const _l={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class eh{constructor(s,f,d,m){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=m,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let d=0;d0){const ne=u.F(),se=Gt;u.aP(ne,Ft.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(ne,ne,Ft.placementViewportMatrix),z.push({circleArray:Kt,circleOffset:W,transform:se,invTransform:ne,coord:St}),F+=Kt.length/4,W=F}Jt&&k.draw(T,M.LINES,vn.disabled,Jn.disabled,_.colorModeForRenderPass(),Wn.disabled,Hd(Gt,_.transform,Rt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(St),f.id,Jt.layoutVertexBuffer,Jt.indexBuffer,Jt.segments,null,_.transform.zoom,null,null,Jt.collisionVertexBuffer)}if(!I||!z.length)return;const st=_.useProgram("collisionCircle"),ot=new u.aQ;ot.resize(4*F),ot._trim();let ct=0;for(const ht of z)for(let St=0;St=0&&(ot[tt.associatedIconIndex]={shiftedAnchor:Qe,angle:ae})}else Ht(tt.numGlyphs,W)}if(k){st.clear();const ct=_.icon.placedSymbolArray;for(let tt=0;tt_.style.map.terrain.getElevation(Jt,Jo,Jr):null,mr=f.layout.get("text-rotation-alignment")==="map";q(ne,Jt.posMatrix,_,m,ko,Fs,tt,k,mr,Kr)}const Ga=_.translatePosMatrix(Jt.posMatrix,Kt,v,I),Bs=_t||m&&Ft||fc?$f:ko,Yr=_.translatePosMatrix(Fs,Kt,v,I,!0),dr=ae&&f.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ir;ir=ae?ne.iconsInText?Qu(Ne.kind,Be,kt,tt,_,Ga,Bs,Yr,ln,ti):Ju(Ne.kind,Be,kt,tt,_,Ga,Bs,Yr,m,ln,!0):Ku(Ne.kind,Be,kt,tt,_,Ga,Bs,Yr,m,ln);const Ko={program:bn,buffers:se,uniformValues:ir,atlasTexture:wr,atlasTextureIcon:pr,atlasInterpolation:Fn,atlasInterpolationIcon:Ao,isSDF:ae,hasHalo:dr};if(ht&&ne.canOverlap){St=!0;const Kr=se.segments.get();for(const mr of Kr)Gt.push({segments:new u.$([mr]),sortKey:mr.sortKey,state:Ko,terrainData:rn})}else Gt.push({segments:se.segments,sortKey:0,state:Ko,terrainData:rn})}St&&Gt.sort((Jt,Kt)=>Jt.sortKey-Kt.sortKey);for(const Jt of Gt){const Kt=Jt.state;if(W.activeTexture.set(st.TEXTURE0),Kt.atlasTexture.bind(Kt.atlasInterpolation,st.CLAMP_TO_EDGE),Kt.atlasTextureIcon&&(W.activeTexture.set(st.TEXTURE1),Kt.atlasTextureIcon&&Kt.atlasTextureIcon.bind(Kt.atlasInterpolationIcon,st.CLAMP_TO_EDGE)),Kt.isSDF){const ne=Kt.uniformValues;Kt.hasHalo&&(ne.u_is_halo=1,sm(Kt.buffers,Jt.segments,f,_,Kt.program,Rt,z,F,ne,Jt.terrainData)),ne.u_is_halo=0}sm(Kt.buffers,Jt.segments,f,_,Kt.program,Rt,z,F,Kt.uniformValues,Jt.terrainData)}}function sm(_,s,f,d,m,v,I,T,M,k){const z=d.context;m.draw(z,z.gl.TRIANGLES,v,I,T,Wn.disabled,M,k,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function fh(_,s,f,d,m){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let I=v[f.to.toString()],T=v[f.from.toString()];if(!I&&T&&(I=T),!T&&I&&(T=I),!I||!T){const M=m.getPaintProperty(s);I=v[M],T=v[M]}I&&T&&_.setConstantPatternPositions(I,T)}function am(_,s,f,d,m,v,I){const T=_.context.gl,M="fill-pattern",k=f.paint.get(M),z=k&&k.constantOr(1),F=f.getCrossfadeParameters();let W,st,ot,ct,tt;I?(st=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=T.LINES):(st=z?"fillPattern":"fill",W=T.TRIANGLES);const _t=k.constantOr(null);for(const kt of d){const ht=s.getTile(kt);if(z&&!ht.patternsLoaded())continue;const St=ht.getBucket(f);if(!St)continue;const Rt=St.programConfigurations.get(f.id),Ft=_.useProgram(st,Rt),Gt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(kt);z&&(_.context.activeTexture.set(T.TEXTURE0),ht.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Rt.updatePaintBuffers(F)),fh(Rt,M,_t,ht,f);const Jt=Gt?kt:null,Kt=_.translatePosMatrix(Jt?Jt.posMatrix:kt.posMatrix,ht,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(I){ct=St.indexBuffer2,tt=St.segments2;const ne=[T.drawingBufferWidth,T.drawingBufferHeight];ot=st==="fillOutlinePattern"&&z?Wd(Kt,_,F,ht,ne):Ey(Kt,ne)}else ct=St.indexBuffer,tt=St.segments,ot=z?Kc(Kt,_,F,ht):jd(Kt);Ft.draw(_.context,W,m,_.stencilModeForClipping(kt),v,Wn.disabled,ot,Gt,f.id,St.layoutVertexBuffer,ct,tt,f.paint,_.transform.zoom,Rt)}}function ph(_,s,f,d,m,v,I){const T=_.context,M=T.gl,k="fill-extrusion-pattern",z=f.paint.get(k),F=z.constantOr(1),W=f.getCrossfadeParameters(),st=f.paint.get("fill-extrusion-opacity"),ot=z.constantOr(null);for(const ct of d){const tt=s.getTile(ct),_t=tt.getBucket(f);if(!_t)continue;const kt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ct),ht=_t.programConfigurations.get(f.id),St=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ht);F&&(_.context.activeTexture.set(M.TEXTURE0),tt.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ht.updatePaintBuffers(W)),fh(ht,k,ot,tt,f);const Rt=_.translatePosMatrix(ct.posMatrix,tt,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ft=f.paint.get("fill-extrusion-vertical-gradient"),Gt=F?Sy(Rt,_,Ft,st,ct,W,tt):Zu(Rt,_,Ft,st);St.draw(T,T.gl.TRIANGLES,m,v,I,Wn.backCCW,Gt,kt,f.id,_t.layoutVertexBuffer,_t.indexBuffer,_t.segments,f.paint,_.transform.zoom,ht,_.style.map.terrain&&_t.centroidVertexBuffer)}}function dh(_,s,f,d,m,v,I){const T=_.context,M=T.gl,k=f.fbo;if(!k)return;const z=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),z.draw(T,M.TRIANGLES,m,v,I,Wn.disabled,((W,st,ot,ct)=>{const tt=ot.paint.get("hillshade-shadow-color"),_t=ot.paint.get("hillshade-highlight-color"),kt=ot.paint.get("hillshade-accent-color");let ht=ot.paint.get("hillshade-illumination-direction")*(Math.PI/180);ot.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=W.transform.angle);const St=!W.options.moving;return{u_matrix:ct?ct.posMatrix:W.transform.calculatePosMatrix(st.tileID.toUnwrapped(),St),u_image:0,u_latrange:Yd(0,st.tileID),u_light:[ot.paint.get("hillshade-exaggeration"),ht],u_shadow:tt,u_highlight:_t,u_accent:kt}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function tp(_,s,f,d,m,v){const I=_.context,T=I.gl,M=s.dem;if(M&&M.data){const k=M.dim,z=M.stride,F=M.getPixels();if(I.activeTexture.set(T.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(z),s.demTexture){const st=s.demTexture;st.update(F,{premultiply:!1}),st.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new $(I,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);I.activeTexture.set(T.TEXTURE0);let W=s.fbo;if(!W){const st=new $(I,{width:k,height:k,data:null},T.RGBA);st.bind(T.LINEAR,T.CLAMP_TO_EDGE),W=s.fbo=I.createFramebuffer(k,k,!0,!1),W.colorAttachment.set(st.texture)}I.bindFramebuffer.set(W.framebuffer),I.viewport.set([0,0,k,k]),_.useProgram("hillshadePrepare").draw(I,T.TRIANGLES,d,m,v,Wn.disabled,((st,ot)=>{const ct=ot.stride,tt=u.F();return u.aN(tt,0,u.W,-u.W,0,0,1),u.H(tt,tt,[0,-u.W,0]),{u_matrix:tt,u_image:1,u_dimension:[ct,ct],u_zoom:st.overscaledZ,u_unpack:ot.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function lm(_,s,f,d,m,v){const I=d.paint.get("raster-fade-duration");if(!v&&I>0){const T=C.now(),M=(T-_.timeAdded)/I,k=s?(T-s.timeAdded)/I:-1,z=f.getSource(),F=m.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),st=W&&_.refreshedUponExpiration?1:u.ac(W?M:1-k,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-st}:{opacity:st,mix:0}}return{opacity:1,mix:0}}const um=new u.aO(1,0,0,1),mh=new u.aO(0,1,0,1),ep=new u.aO(0,0,1,1),zy=new u.aO(1,0,1,1),cm=new u.aO(0,1,1,1);function br(_,s,f,d){Yi(_,0,s+f/2,_.transform.width,f,d)}function za(_,s,f,d){Yi(_,s-f/2,0,f,_.transform.height,d)}function Yi(_,s,f,d,m,v){const I=_.context,T=I.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),I.clear({color:v}),T.disable(T.SCISSOR_TEST)}function np(_,s,f){const d=_.context,m=d.gl,v=f.posMatrix,I=_.useProgram("debug"),T=vn.disabled,M=Jn.disabled,k=_.colorModeForRenderPass(),z="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(m.TEXTURE0);const W=s.getTileByID(f.key).latestRawTileData,st=Math.floor((W&&W.byteLength||0)/1024),ot=s.getTile(f).tileSize,ct=512/Math.min(ot,512)*(f.overscaledZ/_.transform.zoom)*.5;let tt=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(tt+=` => ${f.overscaledZ}`),function(_t,kt){_t.initDebugOverlayCanvas();const ht=_t.debugOverlayCanvas,St=_t.context.gl,Rt=_t.debugOverlayCanvas.getContext("2d");Rt.clearRect(0,0,ht.width,ht.height),Rt.shadowColor="white",Rt.shadowBlur=2,Rt.lineWidth=1.5,Rt.strokeStyle="white",Rt.textBaseline="top",Rt.font="bold 36px Open Sans, sans-serif",Rt.fillText(kt,5,5),Rt.strokeText(kt,5,5),_t.debugOverlayTexture.update(ht),_t.debugOverlayTexture.bind(St.LINEAR,St.CLAMP_TO_EDGE)}(_,`${tt} ${st}kB`),I.draw(d,m.TRIANGLES,T,M,Rr.alphaBlended,Wn.disabled,Zd(v,u.aO.transparent,ct),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),I.draw(d,m.LINE_STRIP,T,M,k,Wn.disabled,Zd(v,u.aO.red),F,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function gh(_,s,f){const d=_.context,m=d.gl,v=_.colorModeForRenderPass(),I=new vn(m.LEQUAL,vn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const k of f){const z=_.renderToTexture.getTexture(k),F=s.getTerrainData(k.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,z.texture);const W={u_matrix:_.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,m.TRIANGLES,I,Jn.disabled,v,Wn.backCCW,W,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class hm{constructor(s,f){this.context=new Oy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Hr.maxUnderzooming+Hr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Na}resize(s,f,d){if(this.width=Math.floor(s*d),this.height=Math.floor(f*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,f=new u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,Zc.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,Zc.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const m=new u.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(u.W,0,u.W,0),m.emplaceBack(0,u.W,0,u.W),m.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(m,on.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Zc.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const I=new u.aW;I.emplaceBack(0),I.emplaceBack(1),I.emplaceBack(3),I.emplaceBack(2),I.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(I);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new Jn({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,vn.disabled,this.stencilClearMode,Rr.disabled,Wn.disabled,Jc(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const d=this.context,m=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Rr.disabled),d.setDepthMode(vn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of f){const T=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I);v.draw(d,m.TRIANGLES,vn.disabled,new Jn({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),Rr.disabled,Wn.disabled,Jc(I.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new Jn({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new Jn({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((I,T)=>T.overscaledZ-I.overscaledZ),m=d[d.length-1].overscaledZ,v=d[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const I={};for(let T=0;T=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=m[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,k,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayertt.source&&!tt.isHidden(z)?[k.sourceCaches[tt.source]]:[]),st=W.filter(tt=>tt.getSource().type==="vector"),ot=W.filter(tt=>tt.getSource().type!=="vector"),ct=tt=>{(!F||F.getSource().maxzoomct(tt)),F||ot.forEach(tt=>ct(tt)),F}(this.style,this.transform.zoom);M&&function(k,z,F){for(let W=0;W0),m&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,I){const T=v.context,M=T.gl,k=Rr.unblended,z=new vn(M.LEQUAL,vn.ReadWrite,[0,1]),F=I.getTerrainMesh(),W=I.sourceCache.getRenderableTiles(),st=v.useProgram("terrainDepth");T.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const ot of W){const ct=I.getTerrainData(ot.tileID),tt={u_matrix:v.transform.calculatePosMatrix(ot.tileID.toUnwrapped()),u_ele_delta:I.getMeshFrameDelta(v.transform.zoom)};st.draw(T,M.TRIANGLES,z,Jn.disabled,k,Wn.backCCW,tt,ct,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,I){const T=v.context,M=T.gl,k=Rr.unblended,z=new vn(M.LEQUAL,vn.ReadWrite,[0,1]),F=I.getTerrainMesh(),W=I.getCoordsTexture(),st=I.sourceCache.getRenderableTiles(),ot=v.useProgram("terrainCoords");T.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),I.coordsIndex=[];for(const ct of st){const tt=I.getTerrainData(ct.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,W.texture);const _t={u_matrix:v.transform.calculatePosMatrix(ct.tileID.toUnwrapped()),u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0,u_ele_delta:I.getMeshFrameDelta(v.transform.zoom)};ot.draw(T,M.TRIANGLES,z,Jn.disabled,k,Wn.backCCW,_t,tt,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),I.coordsIndex.push(ct.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,I,T,M,k){if(v.renderPass!=="translucent")return;const z=Jn.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,st,ot,ct,tt,_t,kt){const ht=st.transform,St=tt==="map",Rt=_t==="map";for(const Ft of W){const Gt=ct.getTile(Ft),Jt=Gt.getBucket(ot);if(!Jt||!Jt.text||!Jt.text.segments.get().length)continue;const Kt=u.ag(Jt.textSizeData,ht.zoom),ne=qe(Gt,1,st.transform.zoom),se=Ze(Ft.posMatrix,Rt,St,st.transform,ne),Qe=ot.layout.get("icon-text-fit")!=="none"&&Jt.hasIconData();if(Kt){const ae=Math.pow(2,ht.zoom-Gt.tileID.overscaledZ);uh(Jt,St,Rt,kt,ht,se,Ft.posMatrix,ae,Kt,Qe,st.style.map.terrain?(Ne,$e)=>st.style.map.terrain.getElevation(Ft,Ne,$e):null)}}}(M,v,T,I,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),k),T.paint.get("icon-opacity").constantOr(1)!==0&&hh(v,I,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),z,F),T.paint.get("text-opacity").constantOr(1)!==0&&hh(v,I,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),z,F),I.map.showCollisionBoxes&&(lh(v,I,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),lh(v,I,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,m,this.style.placement.variableOffsets);break;case"circle":(function(v,I,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("circle-opacity"),z=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),W=!T.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const st=v.context,ot=st.gl,ct=v.depthModeForSublayer(0,vn.ReadOnly),tt=Jn.disabled,_t=v.colorModeForRenderPass(),kt=[];for(let ht=0;htht.sortKey-St.sortKey);for(const ht of kt){const{programConfiguration:St,program:Rt,layoutVertexBuffer:Ft,indexBuffer:Gt,uniformValues:Jt,terrainData:Kt}=ht.state;Rt.draw(st,ot.TRIANGLES,ct,tt,_t,Wn.disabled,Jt,Kt,T.id,Ft,Gt,ht.segments,T.paint,v.transform.zoom,St)}})(s,f,d,m);break;case"heatmap":(function(v,I,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const k=v.context,z=k.gl,F=Jn.disabled,W=new Rr([z.ONE,z.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(st,ot,ct){const tt=st.gl;st.activeTexture.set(tt.TEXTURE1),st.viewport.set([0,0,ot.width/4,ot.height/4]);let _t=ct.heatmapFbo;if(_t)tt.bindTexture(tt.TEXTURE_2D,_t.colorAttachment.get()),st.bindFramebuffer.set(_t.framebuffer);else{const kt=tt.createTexture();tt.bindTexture(tt.TEXTURE_2D,kt),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_WRAP_S,tt.CLAMP_TO_EDGE),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_WRAP_T,tt.CLAMP_TO_EDGE),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_MIN_FILTER,tt.LINEAR),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_MAG_FILTER,tt.LINEAR),_t=ct.heatmapFbo=st.createFramebuffer(ot.width/4,ot.height/4,!1,!1),function(ht,St,Rt,Ft){var Gt,Jt;const Kt=ht.gl,ne=(Gt=ht.HALF_FLOAT)!==null&&Gt!==void 0?Gt:Kt.UNSIGNED_BYTE,se=(Jt=ht.RGBA16F)!==null&&Jt!==void 0?Jt:Kt.RGBA;Kt.texImage2D(Kt.TEXTURE_2D,0,se,St.width/4,St.height/4,0,Kt.RGBA,ne,null),Ft.colorAttachment.set(Rt)}(st,ot,kt,_t)}})(k,v,T),k.clear({color:u.aO.transparent});for(let st=0;st{const ht=u.F();u.aN(ht,0,ct.width,ct.height,0,0,1);const St=ct.context.gl;return{u_matrix:ht,u_world:[St.drawingBufferWidth,St.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:tt.paint.get("heatmap-opacity")}})(k,z),null,z.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,z.paint,k.transform.zoom)}(v,T))})(s,f,d,m);break;case"line":(function(v,I,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("line-opacity"),z=T.paint.get("line-width");if(k.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,vn.ReadOnly),W=v.colorModeForRenderPass(),st=T.paint.get("line-dasharray"),ot=T.paint.get("line-pattern"),ct=ot.constantOr(1),tt=T.paint.get("line-gradient"),_t=T.getCrossfadeParameters(),kt=ct?"linePattern":st?"lineSDF":tt?"lineGradient":"line",ht=v.context,St=ht.gl;let Rt=!0;for(const Ft of M){const Gt=I.getTile(Ft);if(ct&&!Gt.patternsLoaded())continue;const Jt=Gt.getBucket(T);if(!Jt)continue;const Kt=Jt.programConfigurations.get(T.id),ne=v.context.program.get(),se=v.useProgram(kt,Kt),Qe=Rt||se.program!==ne,ae=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ft),Ne=ot.constantOr(null);if(Ne&&Gt.imageAtlas){const Be=Gt.imageAtlas,rn=Be.patternPositions[Ne.to.toString()],ln=Be.patternPositions[Ne.from.toString()];rn&&ln&&Kt.setConstantPatternPositions(rn,ln)}const $e=ae?Ft:null,bn=ct?yl(v,Gt,T,_t,$e):st?$c(v,Gt,T,st,_t,$e):tt?Kd(v,Gt,T,Jt.lineClipsArray.length,$e):Qc(v,Gt,T,$e);if(ct)ht.activeTexture.set(St.TEXTURE0),Gt.imageAtlasTexture.bind(St.LINEAR,St.CLAMP_TO_EDGE),Kt.updatePaintBuffers(_t);else if(st&&(Qe||v.lineAtlas.dirty))ht.activeTexture.set(St.TEXTURE0),v.lineAtlas.bind(ht);else if(tt){const Be=Jt.gradients[T.id];let rn=Be.texture;if(T.gradientVersion!==Be.version){let ln=256;if(T.stepInterpolant){const wr=I.getSource().maxzoom,Fn=Ft.canonical.z===wr?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!f||!d}useProgram(s,f){this.cache=this.cache||{};const d=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Oa(this.context,Hu[s],f,Jd[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new $(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class Fa{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const m=Math.pow(2,d),v=[[-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(T=>{const M=1/(T=u.af([],T,s))[3]/f*m;return u.a$(T,T,[M,M,1/T[3],M])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(W,st){var ot=st[0],ct=st[1],tt=st[2],_t=ot*ot+ct*ct+tt*tt;return _t>0&&(_t=1/Math.sqrt(_t)),W[0]=st[0]*_t,W[1]=st[1]*_t,W[2]=st[2]*_t,W}([],function(W,st,ot){var ct=st[0],tt=st[1],_t=st[2],kt=ot[0],ht=ot[1],St=ot[2];return W[0]=tt*St-_t*ht,W[1]=_t*kt-ct*St,W[2]=ct*ht-tt*kt,W}([],rt([],v[T[0]],v[T[1]]),rt([],v[T[2]],v[T[1]]))),k=-((z=M)[0]*(F=v[T[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(k)});return new Fa(v,I)}}class Ba{constructor(s,f){this.min=s,this.max=f,this.center=function(d,m,v){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,v){return d[0]=m[0]+v[0],d[1]=m[1]+v[1],d[2]=m[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=gt(this.min),m=gt(this.max);for(let v=0;v=0&&I++;if(I===0)return 0;I!==f.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let T=0;Tthis.max[m]-this.min[m])return 0}return 1}}class ru{constructor(s=0,f=0,d=0,m=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=m}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),m=u.ac((this.top+f-this.bottom)/2,0,f);return new u.P(d,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new ru(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 yh{constructor(s,f,d,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ru,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new yh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,v){var I=m[0],T=m[1],M=m[2],k=m[3],z=Math.sin(v),F=Math.cos(v);d[0]=I*F+M*z,d[1]=T*F+k*z,d[2]=I*-z+M*F,d[3]=T*-z+k*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,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(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,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(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),m=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),I=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,m.x,v.x,I.x)),M=Math.floor(Math.max(d.x,m.x,v.x,I.x)),k=1;for(let z=T-k;z<=M+k;z++)z!==0&&f.push(new u.b2(z,s))}return f}coveringTiles(s){var f,d;let m=this.coveringZoomLevel(s);const v=m;if(s.minzoom!==void 0&&ms.maxzoom&&(m=s.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,m),k=[M*I.x,M*I.y,0],z=[M*T.x,M*T.y,0],F=Fa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=m);const st=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,ot=ht=>({aabb:new Ba([ht*M,0,0],[(ht+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ht,fullyVisible:!1}),ct=[],tt=[],_t=m,kt=s.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let ht=1;ht<=3;ht++)ct.push(ot(-ht)),ct.push(ot(ht));for(ct.push(ot(0));ct.length>0;){const ht=ct.pop(),St=ht.x,Rt=ht.y;let Ft=ht.fullyVisible;if(!Ft){const se=ht.aabb.intersects(F);if(se===0)continue;Ft=se===2}const Gt=s.terrain?k:z,Jt=ht.aabb.distanceX(Gt),Kt=ht.aabb.distanceY(Gt),ne=Math.max(Math.abs(Jt),Math.abs(Kt));if(ht.zoom===_t||ne>st+(1<<_t-ht.zoom)-2&&ht.zoom>=W){const se=_t-ht.zoom,Qe=k[0]-.5-(St<>1),Ne=ht.zoom+1;let $e=ht.aabb.quadrant(se);if(s.terrain){const bn=new u.Q(Ne,ht.wrap,Ne,Qe,ae),Be=s.terrain.getMinMaxElevation(bn),rn=(f=Be.minElevation)!==null&&f!==void 0?f:this.elevation,ln=(d=Be.maxElevation)!==null&&d!==void 0?d:this.elevation;$e=new Ba([$e.min[0],$e.min[1],rn],[$e.max[0],$e.max[1],ln])}ct.push({aabb:$e,zoom:Ne,x:Qe,y:ae,wrap:ht.wrap,fullyVisible:Ft})}}return tt.sort((ht,St)=>ht.distanceSq-St.distanceSq).map(ht=>ht.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=u.ac(s.lat,-85.051129,rp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const I=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/I/u.b3(1,m.lat),M=this.scaleZoom(T/this.tileSize);this._elevation=v,this._center=m,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),I=new u.Y(v.x-(d.x-m.x),v.y-(d.y-m.y));this.center=this.coordinateLocation(I),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const W=f.pointCoordinate(s);if(W!=null)return W}const d=[s.x,s.y,0,1],m=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(m,m,this.pixelMatrixInverse);const v=d[3],I=m[3],T=d[1]/v,M=m[1]/I,k=d[2]/v,z=m[2]/I,F=k===z?0:(0-k)/(z-k);return new u.Y(u.z.number(d[0]/v,m[0]/I,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(m,m,d),new u.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new xt().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new xt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,rp])}calculatePosMatrix(s,f=!1){const d=s.key,m=f?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const v=s.canonical,I=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*I,v.y*I,0]),u.J(M,M,[I/u.W,I/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),m[d]=new Float32Array(M),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ht=179.9999999999;m=[-ht,ht]}const v=this.tileSize*this.zoomScale(d.zoom);let I=0,T=v,M=0,k=v,z=0,F=0;const{x:W,y:st}=this.size;if(this.latRange){const ht=this.latRange;I=u.O(ht[1])*v,T=u.O(ht[0])*v,T-IT&&(_t=T-ht)}if(m){const ht=(M+k)/2;let St=ot;this._renderWorldCopies&&(St=u.b1(ot,ht-v/2,ht+v/2));const Rt=W/2;St-Rtk&&(tt=k-Rt)}if(tt!==void 0||_t!==void 0){const ht=new u.P(tt??ot,_t??ct);d.center=this.unproject.call({worldSize:v},ht).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let m=u.an(new Float64Array(16));u.J(m,m,[this.width/2,-this.height/2,1]),u.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=u.an(new Float64Array(16)),u.J(m,m,[1,-1,1]),u.H(m,m,[-1,-1,0]),u.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),I=Math.min(this.elevation,this.minElevationForCurrentTile),T=v-I*this._pixelPerMeter/Math.cos(this._pitch),M=I<0?T:v,k=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(u.ac(Math.PI-k-z,.01,Math.PI-.01)),W=this.getHorizon(),st=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),ot=Math.sin(st)*M/Math.sin(u.ac(Math.PI-k-st,.01,Math.PI-.01)),ct=Math.min(F,ot),tt=1.01*(Math.cos(Math.PI/2-this._pitch)*ct+M),_t=this.height/50;m=new Float64Array(16),u.b4(m,this._fov,this.width/this.height,_t,tt),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,u.J(m,m,[1,-1,1]),u.H(m,m,[0,0,-this.cameraToCenterDistance]),u.b5(m,m,this._pitch),u.ad(m,m,this.angle),u.H(m,m,[-f,-d,0]),this.mercatorMatrix=u.J([],m,[this.worldSize,this.worldSize,this.worldSize]),u.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,m),u.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=u.ar([],m),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,m);const kt=this.width%2/2,ht=this.height%2/2,St=Math.cos(this.angle),Rt=Math.sin(this.angle),Ft=f-Math.round(f)+St*kt+Rt*ht,Gt=d-Math.round(d)+St*ht+Rt*kt,Jt=new Float64Array(m);if(u.H(Jt,Jt,[Ft>.5?Ft-1:Ft,Gt>.5?Gt-1:Gt,0]),this.alignedProjMatrix=Jt,m=u.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,m=f.y,v=f.x,I=f.y;for(const T of s)d=Math.min(d,T.x),m=Math.min(m,T.y),v=Math.max(v,T.x),I=Math.max(I,T.y);return[new u.P(d,m),new u.P(v,m),new u.P(v,I),new u.P(d,I),new u.P(d,m)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),m=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(m,m,this.projMatrix),m[2]/m[3]}}function ip(_,s){let f,d=!1,m=null,v=null;const I=()=>{m=null,d&&(_.apply(v,f),m=setTimeout(I,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,m||I(),m)}class op{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(d=>isNaN(d))){const d=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:d,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=ip(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),I=Math.round(f.lng*v)/v,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),k=this._map.getPitch();let z="";if(z+=s?`/${I}/${T}/${d}`:`${d}/${T}/${I}`,(M||k)&&(z+="/"+Math.round(10*M)/10),k&&(z+=`/${Math.round(k)}`),this._hashName){const F=this._hashName;let W=!1;const st=window.location.hash.slice(1).split("&").map(ot=>{const ct=ot.split("=")[0];return ct===F?(W=!0,`${ct}=${z}`):ot}).filter(ot=>ot);return W||st.push(`${F}=${z}`),`#${st.join("&")}`}return`#${z}`}}const tc={linearity:.3,easing:u.b6(0,0,.3,1)},xl=u.e({deceleration:2500,maxSpeed:1400},tc),fm=u.e({deceleration:20,maxSpeed:1400},tc),pm=u.e({deceleration:1e3,maxSpeed:360},tc),dm=u.e({deceleration:1e3,maxSpeed:90},tc);class mm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:C.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=C.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(f.pan.mag()){const v=nc(f.pan.mag(),d,u.e({},xl,s||{}));m.offset=f.pan.mult(v.amount/f.pan.mag()),m.center=this._map.transform.center,ec(m,v)}if(f.zoom){const v=nc(f.zoom,d,fm);m.zoom=this._map.transform.zoom+v.amount,ec(m,v)}if(f.bearing){const v=nc(f.bearing,d,pm);m.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),ec(m,v)}if(f.pitch){const v=nc(f.pitch,d,dm);m.pitch=this._map.transform.pitch+v.amount,ec(m,v)}if(m.zoom||m.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),u.e(m,{noMoveStart:!0})}}function ec(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,k,z,F)=>M.add(k.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:I,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class sp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class cs{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new sp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new co(s.type,this._map,s))}mouseup(s){this._map.fire(new co(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new co(s.type,this._map,s))}dblclick(s){return this._firePreventable(new co(s.type,this._map,s))}mouseover(s){this._map.fire(new co(s.type,this._map,s))}mouseout(s){this._map.fire(new co(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Ns(s.type,this._map,s))}touchmove(s){this._map.fire(new Ns(s.type,this._map,s))}touchend(s){this._map.fire(new Ns(s.type,this._map,s))}touchcancel(s){this._map.fire(new Ns(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Os{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new co(s.type,this._map,s))}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(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new co(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(u.P.convert(s),this._map.terrain)}}class hs{constructor(s,f){this._map=s,this._tr=new iu(s),this._el=s.getCanvasContainer(),this._container=s.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(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function wl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class Fy{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const v=new u.P(0,0);for(const I of m)v._add(I);return v.div(m.length)}(f),this.touches=wl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const m=wl(d,f);for(const v in this.touches){const I=m[v];(!I||I.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class ap{constructor(s){this.singleTap=new Fy(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,d){this.singleTap.touchstart(s,f,d)}touchmove(s,f,d){this.singleTap.touchmove(s,f,d)}touchend(s,f,d){const m=this.singleTap.touchend(s,f,d);if(m){const v=s.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(m)<30;if(v&&I||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class By{constructor(s){this._tr=new iu(s),this._zoomIn=new ap({numTouches:1,numTaps:2}),this._zoomOut=new ap({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const m=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),I=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:I.zoom+1,around:I.unproject(m)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:I.zoom-1,around:I.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ou{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=f.length?f[0]:f;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},su=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new zs({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new ou({clickTolerance:s,move:(m,v)=>({bearingDelta:(v.x-m.x)*f}),moveStateManager:d,enable:_,assignEvents:_h})},au=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new zs({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new ou({clickTolerance:s,move:(m,v)=>({pitchDelta:(v.y-m.y)*f}),moveStateManager:d,enable:_,assignEvents:_h})};class gm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const m=wl(d,f),v=new u.P(0,0),I=new u.P(0,0);let T=0;for(const k in m){const z=m[k],F=this._touches[k];F&&(v._add(z),I._add(z.sub(F)),T++,m[k]=z)}if(this._touches=m,TMath.abs(_.x)}class vm extends pe{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,bh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,v=f.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const I=s.y>0==f.y>0;return bh(s)&&bh(f)&&I}}const Vy={panStep:100,bearingStep:15,pitchStep:10};class Va{constructor(s){this._tr=new iu(s);const f=Vy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,d=0,m=0,v=0,I=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),I=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:rr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+m*this._pitchStep,offset:[-v*this._panStep,-I*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function rr(_){return _*(2-_)}const ic=4.000244140625;class xh{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new iu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=C.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%ic==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const f=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>ic?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);const k=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(k*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,m=this._easing;let v,I=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((C.now()-this._lastWheelEventTime)/200,1),M=m(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):I=!0}else v=f,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,m=(C.now()-d.start)/d.duration,v=d.easing(m+.01)-d.easing(m),I=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-I*I);f=u.b6(I,T,.25,1)}return this._prevEase={start:C.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class up{constructor(s,f){this._clickZoom=s,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 bm{constructor(s){this._tr=new iu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xm{constructor(){this._tap=new ap({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,d){if(!this._swipePoint)if(this._tapTime){const m=f[0],v=s.timeStamp-this._tapTime<500,I=this._tapPoint.dist(m)<30;v&&I?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,f,d)}touchmove(s,f,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=f[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,d)}touchend(s,f,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(s,f,d);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wm{constructor(s,f,d){this._el=s,this._mousePan=f,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class fs{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class oc{constructor(s,f,d,m){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Te{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=f,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=d,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(P.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(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const De=_=>_.zoom||_.drag||_.pitch||_.rotate;class wh extends u.k{}function sc(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class cp{constructor(s,f){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const I=m.type==="renderFrame"?void 0:m,T={needsRenderFrame:!1},M={},k={},z=m.touches,F=z?this._getMapTouches(z):void 0,W=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),m);for(const{handlerName:ct,handler:tt,allowed:_t}of this._handlers){if(!tt.isEnabled())continue;let kt;this._blockedByActive(k,_t,ct)?tt.reset():tt[v||m.type]&&(kt=tt[v||m.type](m,W,F),this.mergeHandlerResult(T,M,kt,ct,I),kt&&kt.needsRenderFrame&&this._triggerRenderFrame()),(kt||tt.isActive())&&(k[ct]=tt)}const st={};for(const ct in this._previousActiveHandlers)k[ct]||(st[ct]=I);this._previousActiveHandlers=k,(Object.keys(st).length||sc(T))&&(this._changes.push([T,M,st]),this._triggerRenderFrame()),(Object.keys(k).length||sc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ot}=T;ot&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ot(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,v,I]of this._listeners)P.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new cs(f,s));const m=f.boxZoom=new hs(f,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const v=f.cooperativeGestures=new Te(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const I=new By(f),T=new bm(f);f.doubleClickZoom=new up(T,I),this._add("tapZoom",I),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new xm;this._add("tapDragZoom",M);const k=f.touchPitch=new vm(f);this._add("touchPitch",k),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=su(s),F=au(s);f.dragRotate=new fs(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const W=(({enable:kt,clickTolerance:ht})=>{const St=new zs({checkCorrectEvent:Rt=>P.mouseButton(Rt)===0&&!Rt.ctrlKey});return new ou({clickTolerance:ht,move:(Rt,Ft)=>({around:Ft,panDelta:Ft.sub(Rt)}),activateOnStart:!0,moveStateManager:St,enable:kt,assignEvents:_h})})(s),st=new gm(s,f);f.dragPan=new wm(d,W,st),this._add("mousePan",W),this._add("touchPan",st,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const ot=new lp,ct=new _m;f.touchZoomRotate=new oc(d,ct,ot,M),this._add("touchRotate",ot,["touchPan","touchZoom"]),this._add("touchZoom",ct,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const tt=f.scrollZoom=new xh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",tt,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const _t=f.keyboard=new Va(f);this._add("keyboard",_t),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Os(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!De(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const m in s)if(m!==d&&(!f||f.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const d of s)this._el.contains(d.target)&&f.push(d);return f}mergeHandlerResult(s,f,d,m,v){if(!d)return;u.e(s,d);const I={handlerName:m,originalEvent:d.originalEvent||v};d.zoomDelta!==void 0&&(f.zoom=I),d.panDelta!==void 0&&(f.drag=I),d.pitchDelta!==void 0&&(f.pitch=I),d.bearingDelta!==void 0&&(f.rotate=I)}_applyChanges(){const s={},f={},d={};for(const[m,v,I]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new u.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),u.e(f,v),u.e(d,I);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const m=this._map,v=m._getTransformForUpdate(),I=m.terrain;if(!(sc(s)||I&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:k,pitchDelta:z,around:F,pinchAround:W}=s;W!==void 0&&(F=W),m._stop(!0),F=F||m.transform.centerPoint;const st=v.pointLocation(T?F.sub(T):F);k&&(v.bearing+=k),z&&(v.pitch+=z),M&&(v.zoom+=M),I?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(T)):v.setLocationAtPoint(st,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(st,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(st,F),m._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const m=De(this._eventsInProgress),v=De(s),I={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(I[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const z in I)this._fireEvent(z,I[z]);v&&this._fireEvent("move",v.originalEvent);for(const z in s){const{originalEvent:F}=s[z];this._fireEvent(z,F)}const T={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:W}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||W,T[`${z}end`]=M)}for(const z in T)this._fireEvent(z,T[z]);const k=De(this._eventsInProgress);if(d&&(m||v)&&!k){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=W=>W!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new wh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ho extends u.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((C.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=u.z.number(v,tt,Gt)),this._rotating&&(m.bearing=u.z.number(I,k,Gt)),this._pitching&&(m.pitch=u.z.number(T,z,Gt)),this._padding&&(m.interpolatePadding(M,F,Gt),st=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Gt),St)m.setLocationAtPoint(St,Rt);else{const Jt=m.zoomScale(m.zoom-v),Kt=tt>v?Math.min(2,ht):Math.max(.5,ht),ne=Math.pow(Kt,1-Gt),se=m.unproject(_t.add(kt.mult(Gt*ne)).mult(Jt));m.setLocationAtPoint(m.renderWorldCopies?se.wrap():se,st)}this._applyUpdatedTransform(m),this._fireMoveEvents(f)},Gt=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Gt)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:d,zoom:m,pitch:v,bearing:I,elevation:T}=this.transformCameraUpdate(f);d&&(f.center=d),m!==void 0&&(f.zoom=m),v!==void 0&&(f.pitch=v),I!==void 0&&(f.bearing=I),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",s)),m&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&C.prefersReducedMotion){const bn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(bn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const m=this._getTransformForUpdate(),v=this.getZoom(),I=this.getBearing(),T=this.getPitch(),M=this.getPadding(),k="bearing"in s?this._normalizeBearing(s.bearing,I):I,z="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:m.padding,W=u.P.convert(s.offset);let st=m.centerPoint.add(W);const ot=m.pointLocation(st),{center:ct,zoom:tt}=m.getConstrained(u.M.convert(s.center||ot),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(ct);const _t=m.zoomScale(tt-v),kt=m.project(ot),ht=m.project(ct).sub(kt);let St=s.curve;const Rt=Math.max(m.width,m.height),Ft=Rt/_t,Gt=ht.mag();if("minZoom"in s){const bn=u.ac(Math.min(s.minZoom,v,tt),m.minZoom,m.maxZoom),Be=Rt/m.zoomScale(bn-v);St=Math.sqrt(Be/Gt*2)}const Jt=St*St;function Kt(bn){const Be=(Ft*Ft-Rt*Rt+(bn?-1:1)*Jt*Jt*Gt*Gt)/(2*(bn?Ft:Rt)*Jt*Gt);return Math.log(Math.sqrt(Be*Be+1)-Be)}function ne(bn){return(Math.exp(bn)-Math.exp(-bn))/2}function se(bn){return(Math.exp(bn)+Math.exp(-bn))/2}const Qe=Kt(!1);let ae=function(bn){return se(Qe)/se(Qe+St*bn)},Ne=function(bn){return Rt*((se(Qe)*(ne(Be=Qe+St*bn)/se(Be))-ne(Qe))/Jt)/Gt;var Be},$e=(Kt(!0)-Qe)/St;if(Math.abs(Gt)<1e-6||!isFinite($e)){if(Math.abs(Rt-Ft)<1e-6)return this.easeTo(s,f);const bn=Fts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=I!==k,this._pitching=z!==T,this._padding=!m.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(ct),this._ease(bn=>{const Be=bn*$e,rn=1/ae(Be);m.zoom=bn===1?tt:v+m.scaleZoom(rn),this._rotating&&(m.bearing=u.z.number(I,k,bn)),this._pitching&&(m.pitch=u.z.number(T,z,bn)),this._padding&&(m.interpolatePadding(M,F,bn),st=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(bn);const ln=bn===1?ct:m.unproject(kt.add(ht.mult(Ne(Be))).mult(rn));m.setLocationAtPoint(m.renderWorldCopies?ln.wrap():ln,st),this._applyUpdatedTransform(m),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,f)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,f,d){d.animate===!1||d.duration===0?(s(1),f()):(this._easeStart=C.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const hp={compact:!0,customAttribution:'MapLibre'};class ps{constructor(s=hp){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=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.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(){P.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const d=this._map._getUIString(`AttributionControl.${f}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const f=this._map.style.sourceCaches;for(const m in f){const v=f[m];if(v.used||v.usedForTerrain){const I=v.getSource();I.attribution&&s.indexOf(I.attribution)<0&&s.push(I.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,v)=>m.length-v.length),s=s.filter((m,v)=>{for(let I=v+1;I=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Sm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=P.create("div","maplibregl-ctrl");const f=P.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(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ac{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,d=f?this._queue.concat(f):this._queue;for(const m of d)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const d of f)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var xr=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class Nr extends u.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),u.aN(m.posMatrix,0,u.W,0,u.W,0,1),this._tiles[m.key]=new Ho(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(s){for(const f in this._tiles){const d=this._tiles[f];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),u.aN(v.posMatrix,0,u.W,0,u.W,0,1),f[d]=v}else if(m.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const I=m.canonical.z-s.canonical.z,T=m.canonical.x-(m.canonical.x>>I<>I<>I;u.aN(v.posMatrix,0,k,0,k,0,1),u.H(v.posMatrix,v.posMatrix,[-T*k,-M*k,0]),f[d]=v}else if(s.canonical.isChildOf(m.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const I=s.canonical.z-m.canonical.z,T=s.canonical.x-(s.canonical.x>>I<>I<>I;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*k,M*k,0]),u.J(v.posMatrix,v.posMatrix,[1/2**I,1/2**I,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(m--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class Em{constructor(s,f,d){this.painter=s,this.sourceCache=new Nr(f),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,d,m=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=m?v=s.canonical.z-m:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[I+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),m=new $(s,d,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,m=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),I=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,T-I-1,1,1,m.RGBA,m.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),k=f[1]+((15&f[2])<<8),z=this.coordsIndex[255-f[3]],F=z&&this.sourceCache.getTileByID(z);if(!F)return null;const W=this._coordsTextureSize,st=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.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 s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const fa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class fp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new lc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(f)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const m=s.sourceCaches[d].getVisibleCoordinates();for(const v of m){const I=this.terrain.sourceCache.getTerrainCoords(v);for(const T in I)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(I[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const m=s._layers[d],v=m.source;if(fa[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const I in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][I]=this._coordsDescendingInv[v][I].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][d.tileID.key];v&&v!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(fa[f]&&(this._prevType&&fa[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(fa[this._prevType]||fa[f]&&m){this._prevType=f;const v=this._stacks.length-1,I=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(gh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const k=this.pool.getObjectForId(T.rtt[v].id);if(k.stamp===T.rtt[v].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},mp={showCompass:!0,showZoom:!0,visualizePitch:!1};class gp{constructor(s,f,d=!1){this.mousedown=I=>{this.startMouse(u.e({},I,{ctrlKey:!0,preventDefault:()=>I.preventDefault()}),P.mousePos(this.element,I)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=I=>{this.moveMouse(I,P.mousePos(this.element,I))},this.mouseup=I=>{this.mouseRotate.dragEnd(I),this.mousePitch&&this.mousePitch.dragEnd(I),this.offTemp()},this.touchstart=I=>{I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,I.targetTouches)[0],this.startTouch(I,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=I=>{I.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,I.targetTouches)[0],this.moveTouch(I,this._lastPos))},this.touchend=I=>{I.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=su({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:I,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const k=new _e;return new ou({clickTolerance:T,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:k,enable:I,assignEvents:Sh})})({clickTolerance:m,enable:!0}),this.map=s,d&&(this.mousePitch=au({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:I,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new _e;return new ou({clickTolerance:T,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:k,enable:I,assignEvents:Sh})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let pa;function Eh(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const m=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),I=f.locationPoint(_).distSqr(s);f.locationPoint(m).distSqr(s)180;){const m=f.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=f.width&&m.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const cc={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 Ih(_,s,f){const d=_.classList;for(const m in cc)d.remove(`maplibregl-${f}-anchor-${m}`);d.add(`maplibregl-${f}-anchor-${s}`)}class hc extends u.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,m=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Eh(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.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 v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let I="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?I="rotateX(0deg)":this._pitchAlignment==="map"&&(I=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${cc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${I} ${v}`),C.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=d}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 u.k("dragstart"))),this.fire(new u.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 u.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=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${m}px`),f.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const v=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const I=P.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const _t of M){const kt=P.createNS("http://www.w3.org/2000/svg","ellipse");kt.setAttributeNS(null,"opacity","0.04"),kt.setAttributeNS(null,"cx","10.5"),kt.setAttributeNS(null,"cy","5.80029008"),kt.setAttributeNS(null,"rx",_t.rx),kt.setAttributeNS(null,"ry",_t.ry),T.appendChild(kt)}const k=P.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const z=P.createNS("http://www.w3.org/2000/svg","path");z.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"),k.appendChild(z);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const W=P.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(W);const st=P.createNS("http://www.w3.org/2000/svg","g");st.setAttributeNS(null,"transform","translate(6.0, 7.0)"),st.setAttributeNS(null,"fill","#FFFFFF");const ot=P.createNS("http://www.w3.org/2000/svg","g");ot.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ct=P.createNS("http://www.w3.org/2000/svg","circle");ct.setAttributeNS(null,"fill","#000000"),ct.setAttributeNS(null,"opacity","0.25"),ct.setAttributeNS(null,"cx","5.5"),ct.setAttributeNS(null,"cy","5.5"),ct.setAttributeNS(null,"r","5.4999962");const tt=P.createNS("http://www.w3.org/2000/svg","circle");tt.setAttributeNS(null,"fill","#FFFFFF"),tt.setAttributeNS(null,"cx","5.5"),tt.setAttributeNS(null,"cy","5.5"),tt.setAttributeNS(null,"r","5.4999962"),ot.appendChild(ct),ot.appendChild(tt),I.appendChild(T),I.appendChild(k),I.appendChild(F),I.appendChild(st),I.appendChild(ot),f.appendChild(I),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(f),this._offset=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Ih(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const m=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,d;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(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),I=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,I)-v<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/m.transform._pixelPerMeter,M=Math.sin(m.getPitch()*Math.PI/180)*T,k=m.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),z=m.transform.lngLatToCameraDepth(this._lngLat,I+M)-k>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=u.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Ch={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let uu=0,Sl=!1;const Th={maxWidth:100,unit:"metric"};function Lh(_,s,f){const d=f&&f.maxWidth||100,m=_._container.clientHeight/2,v=_.unproject([0,m]),I=_.unproject([d,m]),T=v.distanceTo(I);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?El(s,d,M/5280,_._getUIString("ScaleControl.Miles")):El(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?El(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?El(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):El(s,d,T,_._getUIString("ScaleControl.Meters"))}function El(_,s,f,d){const m=function(v){const I=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/I;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(T),I*T}(f);_.style.width=s*(m/f)+"px",_.innerHTML=`${m} ${d}`}const yp={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 Ph(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Ph(new u.P(0,0))}const Im=y;h.AJAXError=u.be,h.Evented=u.E,h.LngLat=u.M,h.MercatorCoordinate=u.Y,h.Point=u.P,h.addProtocol=u.bf,h.config=u.a,h.removeProtocol=u.bg,h.AttributionControl=ps,h.BoxZoomHandler=hs,h.CanvasSource=ls,h.CooperativeGesturesHandler=Te,h.DoubleClickZoomHandler=up,h.DragPanHandler=wm,h.DragRotateHandler=fs,h.EdgeInsets=ru,h.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_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 u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.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()}},h.GeoJSONSource=Tr,h.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,m=this._map.getBearing(),v=u.e({bearing:m},this.options.fitBoundsOptions),I=xt.fromLngLat(f,d);this._map.fitBounds(I,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Sl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.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=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new hc({element:this._dotElement}),this._circleElement=P.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new hc({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 u.k("trackuserlocationend")))})}},this.options=u.e({},Ch,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(pa!==void 0&&!s)return pa;if(window.navigator.permissions===void 0)return pa=!!window.navigator.geolocation,pa;try{pa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{pa=!!window.navigator.geolocation}return pa})}().then(s=>this._setupUI(s)),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(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,uu=0,Sl=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return u.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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":uu--,Sl=!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 u.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 u.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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),uu++,uu>1?(_={maximumAge:6e5,timeout:0},Sl=!0):(_=this.options.positionOptions,Sl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},h.Hash=op,h.ImageSource=Hn,h.KeyboardHandler=Va,h.LngLatBounds=xt,h.LogoControl=Sm,h.Map=class extends ho{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},uc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new yh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new ac,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},pp,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new H(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=ip(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new cp(this,_),this._hash=_.hash&&new op(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new ps(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Sm,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],m=f[1],v=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,v),this.painter.resize(d,m,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.drawingBufferHeight];const M=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,M),this.painter.resize(d,m,M)}this.transform.resize(d,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,m);const I=!this._moving;return I&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),I&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),v=_*m,I=s*m;return Math.min(v>f?f/v:1,I>d?d/I:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(xt.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const I=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];I.length?d||(d=!0,f.call(this,new co(_,this,v.originalEvent,{features:I}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:I=>{(this.getLayer(s)?this.queryRenderedFeatures(I.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new co(_,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,f.call(this,new co(_,this,I.originalEvent)))}}}}{const d=m=>{const v=this.getLayer(s)?this.queryRenderedFeatures(m.point,{layers:[s]}):[];v.length&&(m.features=v,f.call(this,m),delete m.features)};return{layer:s,listener:f,delegates:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Po(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Po(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.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 Em(this.painter,s,_),this.painter.renderToTexture=new fp(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!==_.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 u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const m=f[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:v,stretchY:I,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:k,data:z}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:k},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:I,content:T,sdf:m,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:k,data:z}=C.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:k},z),pixelRatio:d,stretchX:v,stretchY:I,content:T,sdf:m,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||u.b(s)?C.getImageData(s):s,{width:m,height:v,data:I}=d;if(m===void 0||v===void 0)return this.fire(new u.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(m!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(I,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return G.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const m=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(I=>{v[I]=P.create("div",`maplibregl-ctrl-${I} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new hm(f,this.transform),N.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=C.now();this.style.zoomHistory.update(m,v);const I=new u.a8(m,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=I.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(I)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.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,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;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),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,C.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return dp}getCameraTargetElevation(){return this.transform.elevation}},h.MapMouseEvent=co,h.MapTouchEvent=Ns,h.MapWheelEvent=sp,h.Marker=hc,h.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},mp,_),this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,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 gp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.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(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},h.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.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 u.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);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?Eh(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const d=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Ph(this.options.offset);if(!m){const T=this._container.offsetWidth,M=this._container.offsetHeight;let k;k=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-T/2&&k.push("right"),m=k.length===0?"bottom":k.join("-")}let I=d.add(v[m]);this.options.subpixelPositioning||(I=I.round()),P.setTransform(this._container,`${cc[m]} translate(${I.x}px,${I.y}px)`),Ih(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(yp),_)}addTo(_){return this._map&&this.remove(),this._map=_,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 u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),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(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.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 _=this._container.querySelector(_p);_&&_.focus()}},h.RasterDEMTileSource=He,h.RasterTileSource=Mt,h.ScaleControl=class{constructor(_){this._onMove=()=>{Lh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Lh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Th),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},h.ScrollZoomHandler=xh,h.Style=Po,h.TerrainControl=class{constructor(_){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=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.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(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},h.TwoFingersTouchPitchHandler=vm,h.TwoFingersTouchRotateHandler=lp,h.TwoFingersTouchZoomHandler=_m,h.TwoFingersTouchZoomRotateHandler=oc,h.VectorTileSource=mn,h.VideoSource=To,h.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Ra(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{ks[f]=d})(_,s)}),h.clearPrewarmedResources=function(){const _=dn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Ce),dn=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()"))},h.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},h.getRTLTextPluginStatus=function(){return te().getRTLTextPluginStatus()},h.getVersion=function(){return Im},h.getWorkerCount=function(){return en.workerCount},h.getWorkerUrl=function(){return u.a.WORKER_URL},h.importScriptInWorkers=function(_){return Wr().broadcast("IS",_)},h.prewarm=function(){kn().acquire(Ce)},h.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},h.setRTLTextPlugin=function(_,s){return te().setRTLTextPlugin(_,s)},h.setWorkerCount=function(_){en.workerCount=_},h.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var l=n;return l})})(hS);var _L=hS.exports;const vs=ev(_L);function Pb(e){let t;return n=>{if(n)for(let r in n){let o=t==null?void 0:t[r],l=n[r];o!==l&&e(r,l,o)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function vL(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function bL(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function Mb(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}var Sc=xL;function xL(e){var t,n,r;if(e){if(Array.isArray(e)){for(t=[],n=e.length,r=0;r{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function SL(e,t,n){let r,o,l,h,u,y,w,S,C,P,N,R,{$$slots:J={},$$scope:Y}=t,{id:K=Qg("layer")}=t,{source:B=void 0}=t,{sourceLayer:G=void 0}=t,{beforeId:H=void 0}=t,{beforeLayerType:at=void 0}=t,{type:gt}=t,{paint:ft=void 0}=t,{layout:rt=void 0}=t,{filter:mt=void 0}=t,{applyToClusters:Et=void 0}=t,{minzoom:$=void 0}=t,{maxzoom:Pt=void 0}=t,{manageHoverState:Qt=!1}=t,{hovered:Tt=null}=t,{interactive:re=!0}=t,{hoverCursor:fe=void 0}=t,{eventsIfTopMost:Wt=!1}=t;const Re=Bu(),{map:ze,source:We,self:Ve,minzoom:Ce,maxzoom:en,eventTopMost:An,layerInfo:dn}=gL();Ge(e,ze,nt=>n(31,C=nt)),Ge(e,We,nt=>n(32,P=nt)),Ge(e,Ve,nt=>n(0,S=nt)),Ge(e,Ce,nt=>n(34,R=nt)),Ge(e,en,nt=>n(33,N=nt)),ws(()=>{S&&C&&(dn.delete(S),C==null||C.removeLayer(S))});let un;function kn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn={event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt};Re(nt.type,mn)}function Yn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;fe&&(C.getCanvas().style.cursor=fe);let xt=nt.features??[];n(6,Tt=xt[0]??null);let ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id;Re("mouseenter",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function Wr(nt){var Mt,He,Tr;if(!re||!C)return;if(Wt&&An(nt)!==S){n(6,Tt=null),Qt&&un!==void 0&&(C==null||C.setFeatureState({source:u,sourceLayer:G,id:un},{hover:!1}),un=void 0);return}C.getCanvas().style.cursor=fe;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn=(Tr=xt[0])==null?void 0:Tr.id;mn!==un&&(Qt&&(un!==void 0&&(C==null||C.setFeatureState({source:u,id:un,sourceLayer:G},{hover:!1})),C==null||C.setFeatureState({source:u,id:mn,sourceLayer:G},{hover:!0})),un=mn,n(6,Tt=xt[0]??null)),Re("mousemove",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function hr(nt){if(!(!re||!S||!C)){if(fe&&(C.getCanvas().style.cursor=""),n(6,Tt=null),Qt&&un!==void 0){const xt={source:u,id:un,sourceLayer:G};C==null||C.setFeatureState(xt,{hover:!1}),un=void 0}Re("mouseleave",{map:C,layer:S,source:u})}}let er=!0;function Kn(nt){C&&(C.off("click",nt,kn),C.off("dblclick",nt,kn),C.off("contextmenu",nt,kn),C.off("mouseenter",nt,Yn),C.off("mousemove",nt,Wr),C.off("mouseleave",nt,hr))}return ws(()=>{C&&S&&Kn(S)}),e.$$set=nt=>{"id"in nt&&n(7,K=nt.id),"source"in nt&&n(8,B=nt.source),"sourceLayer"in nt&&n(9,G=nt.sourceLayer),"beforeId"in nt&&n(10,H=nt.beforeId),"beforeLayerType"in nt&&n(11,at=nt.beforeLayerType),"type"in nt&&n(12,gt=nt.type),"paint"in nt&&n(13,ft=nt.paint),"layout"in nt&&n(14,rt=nt.layout),"filter"in nt&&n(15,mt=nt.filter),"applyToClusters"in nt&&n(16,Et=nt.applyToClusters),"minzoom"in nt&&n(17,$=nt.minzoom),"maxzoom"in nt&&n(18,Pt=nt.maxzoom),"manageHoverState"in nt&&n(19,Qt=nt.manageHoverState),"hovered"in nt&&n(6,Tt=nt.hovered),"interactive"in nt&&n(20,re=nt.interactive),"hoverCursor"in nt&&n(21,fe=nt.hoverCursor),"eventsIfTopMost"in nt&&n(22,Wt=nt.eventsIfTopMost),"$$scope"in nt&&n(35,Y=nt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=bL(Et)),e.$$.dirty[0]&1073774592&&n(24,o=vL("all",r,mt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=$??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=Pt??N),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&C&&S!==K&&u){S&&(Kn(S),dn.delete(S));let nt=H;if(!H&&at){let xt=C.getStyle().layers,ce=typeof at=="function"?at:Mt=>Mt.type===at,mn=xt==null?void 0:xt.find(ce);mn&&(nt=mn.id)}Ur(Ve,S=K,S),C.addLayer(Sc({id:S,type:gt,source:u,"source-layer":G,filter:o,paint:ft,layout:rt,minzoom:l,maxzoom:h}),nt),n(23,er=!0),C.on("click",S,kn),C.on("dblclick",S,kn),C.on("contextmenu",S,kn),C.on("mouseenter",S,Yn),C.on("mousemove",S,Wr),C.on("mouseleave",S,hr)}e.$$.dirty[0]&1048577&&S&&dn.set(S,{interactive:re}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?Pb((nt,xt)=>C==null?void 0:C.setPaintProperty(S,nt,xt)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?Pb((nt,xt)=>C==null?void 0:C.setLayoutProperty(S,nt,xt)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(ft)),e.$$.dirty[0]&134234112&&(w==null||w(rt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(C==null||C.setLayerZoomRange(S,l,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(er?n(23,er=!1):C==null||C.setFilter(S,o))},[S,ze,We,Ve,Ce,en,Tt,K,B,G,H,at,gt,ft,rt,mt,Et,$,Pt,Qt,re,fe,Wt,er,o,h,l,w,y,u,r,C,P,N,R,Y,J]}let pS=class extends an{constructor(t){super(),sn(this,t,SL,wL,Xe,{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 EL(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,o,o[23],t?ui(n,o[23],l,null):hi(o[23]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function IL(e){let t,n,r;function o(h){e[16](h)}let l={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[EL]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new pS({props:l}),fi.push(()=>Lu(t,"hovered",o)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Tu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){qt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function CL(e,t,n){let{$$slots:r={},$$scope:o}=t,{id:l=Qg("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:J=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){K=$,n(0,K)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,N=$.minzoom),"maxzoom"in $&&n(10,R=$.maxzoom),"hoverCursor"in $&&n(11,J=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,K=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,o=$.$$scope)},[K,l,h,u,y,w,S,C,P,N,R,J,Y,B,G,r,H,at,gt,ft,rt,mt,Et,o]}let TL=class extends an{constructor(t){super(),sn(this,t,CL,IL,Xe,{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 LL(e,t,n){let r;const{map:o}=Mf();Ge(e,o,y=>n(4,r=y));let{position:l="top-left"}=t,{container:h=void 0}=t,u=null;return ws(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),e.$$set=y=>{"position"in y&&n(1,l=y.position),"container"in y&&n(2,h=y.container)},e.$$.update=()=>{if(e.$$.dirty&30&&r&&!u){let y;typeof h=="string"?y=document.querySelector(h)??void 0:y=h,n(3,u=new vs.FullscreenControl({container:y})),r.addControl(u,l)}},[o,l,h,u,r]}class PL extends an{constructor(t){super(),sn(this,t,LL,null,Xe,{position:1,container:2})}}function ML(e,t,n,r,o){let l=!1;e.getSource(t)&&(l=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),o())};if(l){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function AL(e,t,n){sS().then(()=>{let r=nS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function Db(e){let t=e[0],n,r,o=Rb(e);return{c(){o.c(),n=so()},m(l,h){o.m(l,h),zt(l,n,h),r=!0},p(l,h){h&1&&Xe(t,t=l[0])?(ar(),qt(o,1,1,Me),lr(),o=Rb(l),o.c(),Dt(o,1),o.m(n.parentNode,n)):o.p(l,h)},i(l){r||(Dt(o),r=!0)},o(l){qt(o),r=!1},d(l){l&&Nt(n),o.d(l)}}}function Rb(e){let t;const n=e[19].default,r=li(n,e,e[18],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&262144)&&ci(r,n,o,o[18],t?ui(n,o[18],l,null):hi(o[18]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function kL(e){let t,n,r=e[0]&&Db(e);return{c(){r&&r.c(),t=so()},m(o,l){r&&r.m(o,l),zt(o,t,l),n=!0},p(o,[l]){o[0]?r?(r.p(o,l),l&1&&Dt(r,1)):(r=Db(o),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function DL(e,t,n){let r,o,l,{$$slots:h={},$$scope:u}=t,{id:y=Qg("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:C=void 0}=t,{filter:P=void 0}=t,{lineMetrics:N=void 0}=t,{cluster:R=void 0}=t,{maxzoom:J=void 0}=t,{attribution:Y=void 0}=t,{buffer:K=void 0}=t,{tolerance:B=void 0}=t;const{map:G,cluster:H,self:at}=mL();Ge(e,G,rt=>n(17,o=rt)),Ge(e,H,rt=>n(20,l=rt)),Ge(e,at,rt=>n(0,r=rt));let gt,ft=!0;return ws(()=>{r&>&&o&&(AL(G,r,gt),Ur(at,r=null,r),n(15,gt=void 0))}),e.$$set=rt=>{"id"in rt&&n(4,y=rt.id),"data"in rt&&n(5,w=rt.data),"generateId"in rt&&n(6,S=rt.generateId),"promoteId"in rt&&n(7,C=rt.promoteId),"filter"in rt&&n(8,P=rt.filter),"lineMetrics"in rt&&n(9,N=rt.lineMetrics),"cluster"in rt&&n(10,R=rt.cluster),"maxzoom"in rt&&n(11,J=rt.maxzoom),"attribution"in rt&&n(12,Y=rt.attribution),"buffer"in rt&&n(13,K=rt.buffer),"tolerance"in rt&&n(14,B=rt.tolerance),"$$scope"in rt&&n(18,u=rt.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Ur(H,l=R,l),e.$$.dirty&196593&&o&&r!==y&&(Ur(at,r=y,r),ML(o,r,Sc({type:"geojson",data:w,filter:P,lineMetrics:N,generateId:S,promoteId:C,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties,maxzoom:J,attribution:Y,buffer:K,tolerance:B}),rt=>o&&rt===r,()=>{r&&(n(15,gt=o==null?void 0:o.getSource(r)),n(16,ft=!0))})),e.$$.dirty&131088&&(o==null||o.on("style.load",()=>{n(15,gt=o==null?void 0:o.getSource(y))})),e.$$.dirty&98336&>&&(ft?n(16,ft=!1):gt.setData(w)),e.$$.dirty&33792&&(gt==null||gt.setClusterOptions(Sc({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,G,H,at,y,w,S,C,P,N,R,J,Y,K,B,gt,ft,o,u,h]}let Af=class extends an{constructor(t){super(),sn(this,t,DL,kL,Xe,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function RL(e,t,n){let r;const{map:o}=Mf();Ge(e,o,P=>n(8,r=P));let{position:l="top-left"}=t,{positionOptions:h=void 0}=t,{fitBoundsOptions:u=void 0}=t,{trackUserLocation:y=!1}=t,{showAccuracyCircle:w=!0}=t,{showUserLocation:S=!0}=t,{control:C=null}=t;return ws(()=>{r!=null&&r.loaded()&&C&&r.removeControl(C)}),e.$$set=P=>{"position"in P&&n(2,l=P.position),"positionOptions"in P&&n(3,h=P.positionOptions),"fitBoundsOptions"in P&&n(4,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(5,y=P.trackUserLocation),"showAccuracyCircle"in P&&n(6,w=P.showAccuracyCircle),"showUserLocation"in P&&n(7,S=P.showUserLocation),"control"in P&&n(1,C=P.control)},e.$$.update=()=>{e.$$.dirty&510&&r&&!C&&(n(1,C=new vs.GeolocateControl({positionOptions:h,fitBoundsOptions:u,trackUserLocation:y,showAccuracyCircle:w,showUserLocation:S})),r.addControl(C,l))},[o,C,l,h,u,y,w,S,r]}class NL extends an{constructor(t){super(),sn(this,t,RL,null,Xe,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function OL(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,o,o[23],t?ui(n,o[23],l,null):hi(o[23]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function zL(e){let t,n,r;function o(h){e[16](h)}let l={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[OL]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new pS({props:l}),fi.push(()=>Lu(t,"hovered",o)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Tu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){qt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function FL(e,t,n){let{$$slots:r={},$$scope:o}=t,{id:l=Qg("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:J=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){K=$,n(0,K)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,N=$.minzoom),"maxzoom"in $&&n(10,R=$.maxzoom),"hoverCursor"in $&&n(11,J=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,K=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,o=$.$$scope)},[K,l,h,u,y,w,S,C,P,N,R,J,Y,B,G,r,H,at,gt,ft,rt,mt,Et,o]}let Ad=class extends an{constructor(t){super(),sn(this,t,FL,zL,Xe,{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 BL(e,t,n){let r;const o=Bu();let{layer:l=void 0}=t;const{map:h}=Mf();Ge(e,h,S=>n(2,r=S));function u(S){o(S.type,{...S,map:h})}const y=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return ws(()=>{if(r)if(l)for(const S of y)r.off(S,l,u);else for(const S of w)r.off(S,u)}),e.$$set=S=>{"layer"in S&&n(1,l=S.layer)},e.$$.update=()=>{if(e.$$.dirty&6&&r)if(l)for(const S of y)r.on(S,l,u);else for(const S of w)r.on(S,u)},[h,l,r]}class dS extends an{constructor(t){super(),sn(this,t,BL,null,Xe,{layer:1})}}function VL(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,r),l=Math.round(t.lat*o)/o,h=Math.round(t.lng*o)/o,u=`${n}/${l}/${h}`,y=e.getBearing(),w=e.getPitch();return(y||w)&&(u+=`/${Math.round(y*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function UL(e){return e.replace("#","").split("/").map(parseFloat)}var jh=nv;function nv(e,t){return e===t||e!==e&&t!==t?!0:typeof e!=typeof t||{}.toString.call(e)!={}.toString.call(t)||e!==Object(e)||!e?!1:Array.isArray(e)?Nb(e,t):{}.toString.call(e)=="[object Set]"?Nb(Array.from(e),Array.from(t)):{}.toString.call(e)=="[object Object]"?qL(e,t):GL(e,t)}function GL(e,t){return e.toString()===t.toString()}function Nb(e,t){var n=e.length;if(n!=t.length)return!1;for(var r=0;rn(6,r=S));let{position:l="top-left"}=t,{showCompass:h=!0}=t,{showZoom:u=!0}=t,{visualizePitch:y=!1}=t,w=null;return ws(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),e.$$set=S=>{"position"in S&&n(1,l=S.position),"showCompass"in S&&n(2,h=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,y=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&r&&!w&&(n(5,w=new vs.NavigationControl({showCompass:h,showZoom:u,visualizePitch:y})),r.addControl(w,l))},[o,l,h,u,y,w,r]}class WL extends an{constructor(t){super(),sn(this,t,jL,null,Xe,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function HL(e,t,n){let r;const{map:o}=Mf();Ge(e,o,w=>n(5,r=w));let{position:l="bottom-left"}=t,{maxWidth:h=void 0}=t,{unit:u="metric"}=t,y=null;return ws(()=>{r!=null&&r.loaded()&&y&&r.removeControl(y)}),e.$$set=w=>{"position"in w&&n(1,l=w.position),"maxWidth"in w&&n(2,h=w.maxWidth),"unit"in w&&n(3,u=w.unit)},e.$$.update=()=>{e.$$.dirty&62&&r&&!y&&(n(4,y=new vs.ScaleControl({maxWidth:h,unit:u})),r.addControl(y,l))},[o,l,h,u,y,r]}class ZL extends an{constructor(t){super(),sn(this,t,HL,null,Xe,{position:1,maxWidth:2,unit:3})}}const{window:XL}=WT,YL=e=>({map:e[0]&16,loadedImages:e[0]&32,allImagesLoaded:e[0]&64}),Ob=e=>({map:e[4],loadedImages:e[5],allImagesLoaded:e[6]});function zb(e){let t,n,r=e[3]&&Fb(e);const o=e[40].default,l=li(o,e,e[39],Ob);return{c(){r&&r.c(),t=ye(),l&&l.c()},m(h,u){r&&r.m(h,u),zt(h,t,u),l&&l.m(h,u),n=!0},p(h,u){h[3]?r?(r.p(h,u),u[0]&8&&Dt(r,1)):(r=Fb(h),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr()),l&&l.p&&(!n||u[0]&112|u[1]&256)&&ci(l,o,h,h[39],n?ui(o,h[39],u,YL):hi(h[39]),Ob)},i(h){n||(Dt(r),Dt(l,h),n=!0)},o(h){qt(r),qt(l,h),n=!1},d(h){h&&Nt(t),r&&r.d(h),l&&l.d(h)}}}function Fb(e){let t,n,r,o,l,h,u,y;return t=new WL({props:{position:e[7]}}),r=new NL({props:{position:e[7],fitBoundsOptions:{maxZoom:12}}}),l=new PL({props:{position:e[7]}}),u=new ZL({props:{position:e[7]}}),{c(){Ie(t.$$.fragment),n=ye(),Ie(r.$$.fragment),o=ye(),Ie(l.$$.fragment),h=ye(),Ie(u.$$.fragment)},m(w,S){we(t,w,S),zt(w,n,S),we(r,w,S),zt(w,o,S),we(l,w,S),zt(w,h,S),we(u,w,S),y=!0},p(w,S){const C={};S[0]&128&&(C.position=w[7]),t.$set(C);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const N={};S[0]&128&&(N.position=w[7]),l.$set(N);const R={};S[0]&128&&(R.position=w[7]),u.$set(R)},i(w){y||(Dt(t.$$.fragment,w),Dt(r.$$.fragment,w),Dt(l.$$.fragment,w),Dt(u.$$.fragment,w),y=!0)},o(w){qt(t.$$.fragment,w),qt(r.$$.fragment,w),qt(l.$$.fragment,w),qt(u.$$.fragment,w),y=!1},d(w){w&&(Nt(n),Nt(o),Nt(h)),Se(t,w),Se(r,w),Se(l,w),Se(u,w)}}}function KL(e){let t,n,r,o,l,h=e[4]&&e[0]&&zb(e);return{c(){t=jt("div"),h&&h.c(),Vt(t,"class",n=_g(e[2])+" svelte-p00lfq"),Vt(t,"data-testid","map-container"),tl(t,"expand-map",!e[2])},m(u,y){zt(u,t,y),h&&h.m(t,null),e[41](t),r=!0,o||(l=[hn(XL,"hashchange",e[11]),i0(e[10].call(null,t))],o=!0)},p(u,y){u[4]&&u[0]?h?(h.p(u,y),y[0]&17&&Dt(h,1)):(h=zb(u),h.c(),Dt(h,1),h.m(t,null)):h&&(ar(),qt(h,1,1,()=>{h=null}),lr()),(!r||y[0]&4&&n!==(n=_g(u[2])+" svelte-p00lfq"))&&Vt(t,"class",n),(!r||y[0]&4)&&tl(t,"expand-map",!u[2])},i(u){r||(Dt(h),r=!0)},o(u){qt(h),r=!1},d(u){u&&Nt(t),h&&h.d(),e[41](null),o=!1,oo(l)}}}function JL(e,t,n){let r,o,l,h,{$$slots:u={},$$scope:y}=t,{map:w=null}=t,{mapContainer:S=void 0}=t,{class:C=void 0}=t,{style:P}=t,{diffStyleUpdates:N=!1}=t,{center:R=void 0}=t,{zoom:J=void 0}=t,{pitch:Y=0}=t,{bearing:K=0}=t,{bounds:B=void 0}=t,{hash:G=!1}=t,{updateHash:H=nt=>{window.history.replaceState(window.history.state,"",nt)}}=t,{loaded:at=!1}=t,{minZoom:gt=0}=t,{maxZoom:ft=22}=t,{antialias:rt=void 0}=t,{zoomOnDoubleClick:mt=!0}=t,{locale:Et=void 0}=t,{interactive:$=!0}=t,{attributionControl:Pt=!0}=t,{cooperativeGestures:Qt=!1}=t,{preserveDrawingBuffer:Tt=!1}=t,{maxBounds:re=void 0}=t,{images:fe=[]}=t,{standardControls:Wt=!1}=t,{filterLayers:Re=void 0}=t,{transformRequest:ze=void 0}=t;const We=Bu(),{map:Ve,loadedImages:Ce}=dL();Ge(e,Ve,nt=>n(4,l=nt)),Ge(e,Ce,nt=>n(5,h=nt));let en=new Set;async function An(nt,xt=!1){if(l&&!(!l.loaded()&&!xt))if("url"in nt){en.add(nt.id);try{let ce=await l.loadImage(nt.url);l==null||l.addImage(nt.id,ce.data,nt.options),h.add(nt.id),Ce.set(h)}catch(ce){We("error",ce)}finally{en.delete(nt.id)}}else l.addImage(nt.id,nt.data,nt.options),h.add(nt.id),Ce.set(h)}let dn,un,kn,Yn;function Wr(nt){return er(),Ur(Ve,l=new vs.Map(Sc({container:nt,style:P,locale:Et,center:R,zoom:J,pitch:Y,bearing:K,minZoom:gt,maxZoom:ft,antialias:rt,interactive:$,preserveDrawingBuffer:Tt,maxBounds:re,bounds:B,attributionControl:Pt,transformRequest:ze,cooperativeGestures:Qt})),l),l.on("load",xt=>{xt.target.getContainer().setAttribute("data-testid","map"),xt.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,at=!0),We("load",l)}),l.on("error",xt=>We("error",{...xt,map:l})),l.on("movestart",xt=>We("movestart",{...xt,map:l})),l.on("moveend",xt=>{if(n(12,R=xt.target.getCenter()),n(13,J=xt.target.getZoom()),n(14,Y=xt.target.getPitch()),n(15,K=xt.target.getBearing()),n(16,B=xt.target.getBounds()),We("moveend",{...xt,map:l}),G){let ce=new URL(window.location.href.replace(/(#.+)?$/,VL(l)));H(ce)}}),l.on("click",xt=>We("click",{...xt,map:l})),l.on("dblclick",xt=>We("dblclick",{...xt,map:l})),l.on("contextmenu",xt=>We("contextmenu",{...xt,map:l})),l.on("zoomstart",xt=>We("zoomstart",{...xt,map:l})),l.on("zoom",xt=>{We("zoom",{...xt,map:l})}),l.on("zoomend",xt=>{We("zoomend",{...xt,map:l})}),l.on("style.load",()=>{if(l){const xt=l.getStyle();if(n(36,dn=xt.layers.map(ce=>ce.id)),n(37,un=Object.keys(xt.sources)),Yn)for(const[ce,mn]of Object.entries(Yn))l.addSource(ce,mn);if(kn)for(const ce of kn)l.addLayer(ce);for(const ce of fe)An(ce,!0)}}),l.on("styledata",xt=>{if(l&&Re){const ce=l.getStyle().layers;if(ce)for(let mn of ce)Re(mn)||l.setLayoutProperty(mn.id,"visibility","none")}We("styledata",{...xt,map:l})}),{destroy(){n(0,at=!1),l==null||l.remove(),Ur(Ve,l=null,l)}}}let hr=P;function er(){if(G){let nt=UL(window.location.hash);nt.length>=3&&(n(13,J=nt[0]),n(12,R=[nt[2],nt[1]])),nt.length==5&&(n(15,K=nt[3]),n(14,Y=nt[4]))}}function Kn(nt){fi[nt?"unshift":"push"](()=>{S=nt,n(1,S)})}return e.$$set=nt=>{"map"in nt&&n(17,w=nt.map),"mapContainer"in nt&&n(1,S=nt.mapContainer),"class"in nt&&n(2,C=nt.class),"style"in nt&&n(18,P=nt.style),"diffStyleUpdates"in nt&&n(19,N=nt.diffStyleUpdates),"center"in nt&&n(12,R=nt.center),"zoom"in nt&&n(13,J=nt.zoom),"pitch"in nt&&n(14,Y=nt.pitch),"bearing"in nt&&n(15,K=nt.bearing),"bounds"in nt&&n(16,B=nt.bounds),"hash"in nt&&n(20,G=nt.hash),"updateHash"in nt&&n(21,H=nt.updateHash),"loaded"in nt&&n(0,at=nt.loaded),"minZoom"in nt&&n(22,gt=nt.minZoom),"maxZoom"in nt&&n(23,ft=nt.maxZoom),"antialias"in nt&&n(24,rt=nt.antialias),"zoomOnDoubleClick"in nt&&n(25,mt=nt.zoomOnDoubleClick),"locale"in nt&&n(26,Et=nt.locale),"interactive"in nt&&n(27,$=nt.interactive),"attributionControl"in nt&&n(28,Pt=nt.attributionControl),"cooperativeGestures"in nt&&n(29,Qt=nt.cooperativeGestures),"preserveDrawingBuffer"in nt&&n(30,Tt=nt.preserveDrawingBuffer),"maxBounds"in nt&&n(31,re=nt.maxBounds),"images"in nt&&n(32,fe=nt.images),"standardControls"in nt&&n(3,Wt=nt.standardControls),"filterLayers"in nt&&n(33,Re=nt.filterLayers),"transformRequest"in nt&&n(34,ze=nt.transformRequest),"$$scope"in nt&&n(39,y=nt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&8&&n(7,r=typeof Wt=="boolean"?void 0:Wt),e.$$.dirty[0]&16&&n(17,w=l),e.$$.dirty[0]&786448|e.$$.dirty[1]&224&&l&&!jh(P,hr)){const nt=l.getStyle();if(dn&&(kn=nt.layers.filter(xt=>!dn.includes(xt.id))),un){const xt=Object.keys(nt.sources).filter(ce=>!un.includes(ce));Yn={};for(const ce of xt)Yn[ce]=nt.sources[ce]}n(38,hr=P),l.setStyle(P,{diff:N}),Ur(Ce,h=new Set,h),n(35,en=new Set)}if(e.$$.dirty[0]&49|e.$$.dirty[1]&18&&at&&l!=null&&l.loaded())for(let nt of fe)!h.has(nt.id)&&!en.has(nt.id)&&!l.hasImage(nt.id)&&An(nt);if(e.$$.dirty[0]&32|e.$$.dirty[1]&2&&n(6,o=fe.every(nt=>h.has(nt.id))),e.$$.dirty[0]&61456&&l){let nt={};R!=null&&!jh(R,l==null?void 0:l.getCenter())&&(nt.center=R),J!=null&&!jh(J,l==null?void 0:l.getZoom())&&(nt.zoom=J),K!=null&&!jh(K,l==null?void 0:l.getBearing())&&(nt.bearing=K),Y!=null&&!jh(Y,l==null?void 0:l.getPitch())&&(nt.pitch=Y),Object.keys(nt).length&&l.easeTo(nt)}e.$$.dirty[0]&65552&&B&&!jh(B,l==null?void 0:l.getBounds())&&(l==null||l.fitBounds(B)),e.$$.dirty[0]&33554448&&(mt?l==null||l.doubleClickZoom.enable():l==null||l.doubleClickZoom.disable())},[at,S,C,Wt,l,h,o,r,Ve,Ce,Wr,er,R,J,Y,K,B,w,P,N,G,H,gt,ft,rt,mt,Et,$,Pt,Qt,Tt,re,fe,Re,ze,en,dn,un,hr,y,u,Kn]}class QL extends an{constructor(t){super(),sn(this,t,JL,KL,Xe,{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 $L=e=>({marker:e&8}),Bb=e=>({marker:e[3]});function tP(e){let t,n,r,o,l,h,u;const y=e[19].default,w=li(y,e,e[18],Bb);return{c(){t=jt("div"),w&&w.c(),Vt(t,"tabindex",n=e[1]?0:void 0),Vt(t,"role",r=e[1]?"button":void 0),Gr(t,"z-index",e[2])},m(S,C){zt(S,t,C),w&&w.m(t,null),l=!0,h||(u=[i0(e[7].call(null,t)),i0(o=eP.call(null,t,e[0])),hn(t,"click",T_(e[20])),hn(t,"dblclick",T_(e[21])),hn(t,"contextmenu",T_(e[22])),hn(t,"mouseenter",e[23]),hn(t,"mouseleave",e[24]),hn(t,"mousemove",e[25]),hn(t,"keydown",e[8])],h=!0)},p(S,[C]){w&&w.p&&(!l||C&262152)&&ci(w,y,S,S[18],l?ui(y,S[18],C,$L):hi(S[18]),Bb),(!l||C&2&&n!==(n=S[1]?0:void 0))&&Vt(t,"tabindex",n),(!l||C&2&&r!==(r=S[1]?"button":void 0))&&Vt(t,"role",r),o&&Jg(o.update)&&C&1&&o.update.call(null,S[0]),C&4&&Gr(t,"z-index",S[2])},i(S){l||(Dt(w,S),l=!0)},o(S){qt(w,S),l=!1},d(S){S&&Nt(t),w&&w.d(S),h=!1,oo(u)}}}function eP(e,t){const n=e.className;function r(o){o?e.className=`${n} ${o}`:e.className=n}return r(t),{update:r}}function nP(e,t,n){let r,o,l,{$$slots:h={},$$scope:u}=t,{marker:y=void 0}=t,{lngLat:w}=t,{class:S=void 0}=t,{interactive:C=!0}=t,{asButton:P=!1}=t,{draggable:N=!1}=t,{feature:R=null}=t,{offset:J=void 0}=t,{zIndex:Y=void 0}=t,{rotation:K=0}=t,{opacity:B=1}=t;const G=Bu(),{map:H,layerEvent:at,self:gt}=yL();Ge(e,H,Wt=>n(27,l=Wt)),Ge(e,at,Wt=>n(26,r=Wt)),Ge(e,gt,Wt=>n(3,o=Wt));function ft(Wt){Ur(gt,o=new vs.Marker({element:Wt,rotation:K,draggable:N,offset:J,opacity:B.toString()}).setLngLat(w).addTo(l),o),n(11,y=o);const Re=()=>Et("dragstart"),ze=()=>{rt(),Et("drag")},We=()=>{rt(),Et("dragend")};return N&&(o.on("dragstart",Re),o.on("drag",ze),o.on("dragend",We)),{destroy(){N&&(o==null||o.off("dragstart",Re),o==null||o.off("drag",ze),o==null||o.off("dragend",We)),n(11,y=void 0),o==null||o.remove()}}}function rt(){let Wt=o==null?void 0:o.getLngLat();Wt&&(Array.isArray(w)?n(10,w=[Wt.lng,Wt.lat]):w&&"lon"in w?n(10,w={lon:Wt.lng,lat:Wt.lat}):n(10,w=Wt))}function mt(Wt){Wt.key===" "&&(Wt.preventDefault(),Wt.stopPropagation(),Et("click"))}function Et(Wt){if(!C)return;let Re=o==null?void 0:o.getLngLat();if(!Re)return;const ze=[Re.lng,Re.lat];let We={map:l,marker:o,lngLat:ze,features:[{type:"Feature",properties:(R==null?void 0:R.properties)??{},geometry:{type:"Point",coordinates:ze}}]};Ur(at,r={...We,layerType:"marker",type:Wt},r),G(Wt,We)}const $=()=>Et("click"),Pt=()=>Et("dblclick"),Qt=()=>Et("contextmenu"),Tt=Wt=>{Et("mouseenter")},re=()=>{Et("mouseleave")},fe=()=>Et("mousemove");return e.$$set=Wt=>{"marker"in Wt&&n(11,y=Wt.marker),"lngLat"in Wt&&n(10,w=Wt.lngLat),"class"in Wt&&n(0,S=Wt.class),"interactive"in Wt&&n(12,C=Wt.interactive),"asButton"in Wt&&n(1,P=Wt.asButton),"draggable"in Wt&&n(13,N=Wt.draggable),"feature"in Wt&&n(14,R=Wt.feature),"offset"in Wt&&n(15,J=Wt.offset),"zIndex"in Wt&&n(2,Y=Wt.zIndex),"rotation"in Wt&&n(16,K=Wt.rotation),"opacity"in Wt&&n(17,B=Wt.opacity),"$$scope"in Wt&&n(18,u=Wt.$$scope)},e.$$.update=()=>{e.$$.dirty&1032&&(o==null||o.setLngLat(w)),e.$$.dirty&32776&&(o==null||o.setOffset(J??[0,0])),e.$$.dirty&65544&&(o==null||o.setRotation(K)),e.$$.dirty&131080&&(o==null||o.setOpacity(B.toString()))},[S,P,Y,o,H,at,gt,ft,mt,Et,w,y,C,N,R,J,K,B,u,h,$,Pt,Qt,Tt,re,fe]}class Vb extends an{constructor(t){super(),sn(this,t,nP,tP,Xe,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}var kd=Uint8Array,mS=Uint16Array,rP=Int32Array,iP=new kd([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]),oP=new kd([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]),gS=function(e,t){for(var n=new mS(31),r=0;r<31;++r)n[r]=t+=1<>1|(jn&21845)<<1,Al=(Al&52428)>>2|(Al&13107)<<2,Al=(Al&61680)>>4|(Al&3855)<<4,lP[jn]=((Al&65280)>>8|(Al&255)<<8)>>1;var Al,jn,ty=new kd(288);for(jn=0;jn<144;++jn)ty[jn]=8;var jn;for(jn=144;jn<256;++jn)ty[jn]=9;var jn;for(jn=256;jn<280;++jn)ty[jn]=7;var jn;for(jn=280;jn<288;++jn)ty[jn]=8;var jn,uP=new kd(32);for(jn=0;jn<32;++jn)uP[jn]=5;var jn,cP=new kd(0),hP=typeof TextDecoder<"u"&&new TextDecoder,fP=0;try{hP.decode(cP,{stream:!0}),fP=1}catch{}const Qa={Footway:"black",Indoors:"grey",BridgeOrTunnel:"black",WithTraffic:"#4C3926",Crossing:"green",Severance:"red"},_S=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],vS=[1,4,7,10,13,15];function Ub(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function Gb(e){let t,n,r,o=e[1]+"",l,h;return{c(){t=jt("li"),n=jt("span"),r=ye(),l=wn(o),h=ye(),Vt(n,"class","svelte-kzgqtg"),Gr(n,"background",e[2])},m(u,y){zt(u,t,y),Xt(t,n),Xt(t,r),Xt(t,l),Xt(t,h)},p(u,y){y&1&&Gr(n,"background",u[2]),y&1&&o!==(o=u[1]+"")&&Ui(l,o)},d(u){u&&Nt(t)}}}function pP(e){let t,n=vo(e[0]),r=[];for(let o=0;o{"rows"in o&&n(0,r=o.rows)},[r]}class mP extends an{constructor(t){super(),sn(this,t,dP,pP,Xe,{rows:0})}}function qb(e){let t,n;return{c(){t=jt("div"),n=wn(e[0]),Vt(t,"class","svelte-1uuov7f")},m(r,o){zt(r,t,o),Xt(t,n)},p(r,o){o&1&&Ui(n,r[0])},d(r){r&&Nt(t)}}}function gP(e){let t,n=e[0]&&qb(e);return{c(){n&&n.c(),t=so()},m(r,o){n&&n.m(r,o),zt(r,t,o)},p(r,[o]){r[0]?n?n.p(r,o):(n=qb(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Me,o:Me,d(r){r&&Nt(t),n&&n.d(r)}}}function yP(e,t,n){let{loading:r}=t;return e.$$set=o=>{"loading"in o&&n(0,r=o.loading)},[r]}class _P extends an{constructor(t){super(),sn(this,t,yP,gP,Xe,{loading:0})}}const vP=e=>({dialog:e&1}),jb=e=>({dialog:e[0]});function bP(e){let t,n,r,o,l;const h=e[4].default,u=li(h,e,e[3],jb);return{c(){t=jt("dialog"),n=jt("article"),u&&u.c(),t.open=!0},m(y,w){zt(y,t,w),Xt(t,n),u&&u.m(n,null),e[6](t),r=!0,o||(l=[hn(window,"click",e[1]),hn(window,"keydown",e[2]),hn(t,"close",e[5])],o=!0)},p(y,[w]){u&&u.p&&(!r||w&9)&&ci(u,h,y,y[3],r?ui(h,y[3],w,vP):hi(y[3]),jb)},i(y){r||(Dt(u,y),r=!0)},o(y){qt(u,y),r=!1},d(y){y&&Nt(t),u&&u.d(y),e[6](null),o=!1,oo(l)}}}function xP(e,t,n){let{$$slots:r={},$$scope:o}=t,l;function h(S){l.open&&S.target==l&&l.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),l.close())}function y(S){Nn.call(this,e,S)}function w(S){fi[S?"unshift":"push"](()=>{l=S,n(0,l)})}return e.$$set=S=>{"$$scope"in S&&n(3,o=S.$$scope)},[l,h,u,o,r,y,w]}class wP extends an{constructor(t){super(),sn(this,t,xP,bP,Xe,{})}}function Wb(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function Hb(e){let t,n,r=e[1]+"",o,l,h,u=e[2]+"",y,w;return{c(){t=jt("tr"),n=jt("td"),o=wn(r),l=ye(),h=jt("td"),y=wn(u),w=ye()},m(S,C){zt(S,t,C),Xt(t,n),Xt(n,o),Xt(t,l),Xt(t,h),Xt(h,y),Xt(t,w)},p(S,C){C&1&&r!==(r=S[1]+"")&&Ui(o,r),C&1&&u!==(u=S[2]+"")&&Ui(y,u)},d(S){S&&Nt(t)}}}function SP(e){let t,n,r=vo(Object.entries(e[0])),o=[];for(let l=0;l{"properties"in o&&n(0,r=o.properties)},[r]}class IP extends an{constructor(t){super(),sn(this,t,EP,SP,Xe,{properties:0})}}function Zb(e,t,n){const r=e.slice();return r[3]=t[n],r}function Xb(e,t,n){const r=e.slice();return r[6]=t[n],r}function Yb(e){let t,n;return{c(){t=jt("span"),n=wn(`  - `),Gr(t,"background",e[6]),Gr(t,"width","100%"),Gr(t,"border","1px solid black")},m(r,o){zt(r,t,o),Xt(t,n)},p(r,o){o&1&&Gr(t,"background",r[6])},d(r){r&&Nt(t)}}}function CP(e){let t,n=e[3]+"",r;return{c(){t=jt("span"),r=wn(n)},m(o,l){zt(o,t,l),Xt(t,r)},p(o,l){l&2&&n!==(n=o[3]+"")&&Ui(r,n)},d(o){o&&Nt(t)}}}function TP(e){let t,n=e[3].toFixed(e[2])+"",r;return{c(){t=jt("span"),r=wn(n)},m(o,l){zt(o,t,l),Xt(t,r)},p(o,l){l&6&&n!==(n=o[3].toFixed(o[2])+"")&&Ui(r,n)},d(o){o&&Nt(t)}}}function Kb(e){let t;function n(l,h){return l[2]>0?TP:CP}let r=n(e),o=r(e);return{c(){o.c(),t=so()},m(l,h){o.m(l,h),zt(l,t,h)},p(l,h){r===(r=n(l))&&o?o.p(l,h):(o.d(1),o=r(l),o&&(o.c(),o.m(t.parentNode,t)))},d(l){l&&Nt(t),o.d(l)}}}function LP(e){let t,n,r,o=vo(e[0]),l=[];for(let y=0;y{"colorScale"in h&&n(0,r=h.colorScale),"limits"in h&&n(1,o=h.limits),"decimalPlaces"in h&&n(2,l=h.decimalPlaces)},[r,o,l]}class MP extends an{constructor(t){super(),sn(this,t,PP,LP,Xe,{colorScale:0,limits:1,decimalPlaces:2})}}function rl(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}var Jb=Object.prototype.toString,bS=function(t){var n=Jb.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Jb.call(t.callee)==="[object Function]"),r},k_,Qb;function AP(){if(Qb)return k_;Qb=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=bS,o=Object.prototype.propertyIsEnumerable,l=!o.call({toString:null},"toString"),h=o.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],y=function(P){var N=P.constructor;return N&&N.prototype===P},w={$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 P in window)try{if(!w["$"+P]&&t.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{y(window[P])}catch{return!0}}catch{return!0}return!1}(),C=function(P){if(typeof window>"u"||!S)return y(P);try{return y(P)}catch{return!1}};e=function(N){var R=N!==null&&typeof N=="object",J=n.call(N)==="[object Function]",Y=r(N),K=R&&n.call(N)==="[object String]",B=[];if(!R&&!J&&!Y)throw new TypeError("Object.keys called on a non-object");var G=h&&J;if(K&&N.length>0&&!t.call(N,0))for(var H=0;H0)for(var at=0;at"u"||!Ni?Mn:Ni(Uint8Array),bc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Mn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Mn:ArrayBuffer,"%ArrayIteratorPrototype%":Wh&&Ni?Ni([][Symbol.iterator]()):Mn,"%AsyncFromSyncIteratorPrototype%":Mn,"%AsyncFunction%":Jh,"%AsyncGenerator%":Jh,"%AsyncGeneratorFunction%":Jh,"%AsyncIteratorPrototype%":Jh,"%Atomics%":typeof Atomics>"u"?Mn:Atomics,"%BigInt%":typeof BigInt>"u"?Mn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Mn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Mn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Mn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$P,"%eval%":eval,"%EvalError%":tM,"%Float32Array%":typeof Float32Array>"u"?Mn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Mn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Mn:FinalizationRegistry,"%Function%":SS,"%GeneratorFunction%":Jh,"%Int8Array%":typeof Int8Array>"u"?Mn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Mn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Mn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Wh&&Ni?Ni(Ni([][Symbol.iterator]())):Mn,"%JSON%":typeof JSON=="object"?JSON:Mn,"%Map%":typeof Map>"u"?Mn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Wh||!Ni?Mn:Ni(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Mn:Promise,"%Proxy%":typeof Proxy>"u"?Mn:Proxy,"%RangeError%":eM,"%ReferenceError%":nM,"%Reflect%":typeof Reflect>"u"?Mn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Mn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Wh||!Ni?Mn:Ni(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Mn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Wh&&Ni?Ni(""[Symbol.iterator]()):Mn,"%Symbol%":Wh?Symbol:Mn,"%SyntaxError%":of,"%ThrowTypeError%":iM,"%TypedArray%":sM,"%TypeError%":nf,"%Uint8Array%":typeof Uint8Array>"u"?Mn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Mn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Mn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Mn:Uint32Array,"%URIError%":rM,"%WeakMap%":typeof WeakMap>"u"?Mn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Mn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Mn:WeakSet};if(Ni)try{null.error}catch(e){var aM=Ni(Ni(e));bc["%Error.prototype%"]=aM}var lM=function e(t){var n;if(t==="%AsyncFunction%")n=R_("async function () {}");else if(t==="%GeneratorFunction%")n=R_("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=R_("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&Ni&&(n=Ni(o.prototype))}return bc[t]=n,n},rx={__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"]},Dd=ov,bg=wS,uM=Dd.call(Function.call,Array.prototype.concat),cM=Dd.call(Function.apply,Array.prototype.splice),ix=Dd.call(Function.call,String.prototype.replace),xg=Dd.call(Function.call,String.prototype.slice),hM=Dd.call(Function.call,RegExp.prototype.exec),fM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pM=/\\(\\)?/g,dM=function(t){var n=xg(t,0,1),r=xg(t,-1);if(n==="%"&&r!=="%")throw new of("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new of("invalid intrinsic syntax, expected opening `%`");var o=[];return ix(t,fM,function(l,h,u,y){o[o.length]=u?ix(y,pM,"$1"):h||l}),o},mM=function(t,n){var r=t,o;if(bg(rx,r)&&(o=rx[r],r="%"+o[0]+"%"),bg(bc,r)){var l=bc[r];if(l===Jh&&(l=lM(r)),typeof l>"u"&&!n)throw new nf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:r,value:l}}throw new of("intrinsic "+t+" does not exist!")},hl=function(t,n){if(typeof t!="string"||t.length===0)throw new nf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new nf('"allowMissing" argument must be a boolean');if(hM(/^%?[^%]*%?$/,t)===null)throw new of("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=dM(t),o=r.length>0?r[0]:"",l=mM("%"+o+"%",n),h=l.name,u=l.value,y=!1,w=l.alias;w&&(o=w[0],cM(r,uM([0,1],w)));for(var S=1,C=!0;S=r.length){var J=vc(u,P);C=!!J,C&&"get"in J&&!("originalValue"in J.get)?u=J.get:u=u[P]}else C=bg(u,P),u=u[P];C&&!y&&(bc[h]=u)}}return u},O_,ox;function sv(){if(ox)return O_;ox=1;var e=hl,t=e("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return O_=t,O_}var gM=hl,ug=gM("%Object.getOwnPropertyDescriptor%",!0);if(ug)try{ug([],"length")}catch{ug=null}var av=ug,sx=sv(),yM=xS,Hh=Vu,ax=av,lv=function(t,n,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Hh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Hh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hh("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,y=!!ax&&ax(t,n);if(sx)sx(t,n,{configurable:h===null&&y?y.configurable:!h,enumerable:o===null&&y?y.enumerable:!o,value:r,writable:l===null&&y?y.writable:!l});else if(u||!o&&!l&&!h)t[n]=r;else throw new yM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},l0=sv(),ES=function(){return!!l0};ES.hasArrayLengthDefineBug=function(){if(!l0)return null;try{return l0([],"length",{value:1}).length!==1}catch{return!0}};var uv=ES,_M=rv,vM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",bM=Object.prototype.toString,xM=Array.prototype.concat,lx=lv,wM=function(e){return typeof e=="function"&&bM.call(e)==="[object Function]"},IS=uv(),SM=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!wM(r)||!r())return}IS?lx(e,t,n,!0):lx(e,t,n)},CS=function(e,t){var n=arguments.length>2?arguments[2]:{},r=_M(t);vM&&(r=xM.call(r,Object.getOwnPropertySymbols(t)));for(var o=0;o4294967295||CM(n)!==n)throw new hx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],o=!0,l=!0;if("length"in t&&cx){var h=cx(t,"length");h&&!h.configurable&&(o=!1),h&&!h.writable&&(l=!1)}return(o||l||!r)&&(IM?ux(t,"length",n,!0,!0):ux(t,"length",n)),t};(function(e){var t=ov,n=hl,r=TM,o=Vu,l=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||t.call(h,l),y=sv(),w=n("%Math.max%");e.exports=function(P){if(typeof P!="function")throw new o("a function is required");var N=u(t,h,arguments);return r(N,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(t,l,arguments)};y?y(e.exports,"apply",{value:S}):e.exports.apply=S})(TS);var kf=TS.exports,LS=hl,PS=kf,LM=PS(LS("String.prototype.indexOf")),aa=function(t,n){var r=LS(t,!!n);return typeof r=="function"&&LM(t,".prototype.")>-1?PS(r):r},PM=rv,MS=ey(),AS=aa,fx=Object,MM=AS("Array.prototype.push"),px=AS("Object.prototype.propertyIsEnumerable"),AM=MS?Object.getOwnPropertySymbols:null,kS=function(t,n){if(t==null)throw new TypeError("target must be an object");var r=fx(t);if(arguments.length===1)return r;for(var o=1;o2&&!!arguments[2];return(!r||HM)&&(WM?dx(t,"name",n,!0,!0):dx(t,"name",n)),t},YM=XM,KM=Vu,JM=Object,OS=YM(function(){if(this==null||this!==JM(this))throw new KM("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),QM=OS,$M=Fc.supportsDescriptors,tA=Object.getOwnPropertyDescriptor,zS=function(){if($M&&/a/mig.flags==="gim"){var t=tA(RegExp.prototype,"flags");if(t&&typeof t.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 t.get}}return QM},eA=Fc.supportsDescriptors,nA=zS,rA=Object.getOwnPropertyDescriptor,iA=Object.defineProperty,oA=TypeError,mx=Object.getPrototypeOf,sA=/a/,aA=function(){if(!eA||!mx)throw new oA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=nA(),n=mx(sA),r=rA(n,"flags");return(!r||r.get!==t)&&iA(n,"flags",{configurable:!0,enumerable:!1,get:t}),t},lA=Fc,uA=kf,cA=OS,FS=zS,hA=aA,BS=uA(FS());lA(BS,{getPolyfill:FS,implementation:cA,shim:hA});var fA=BS,cg={exports:{}},pA=ey,Bc=function(){return pA()&&!!Symbol.toStringTag},dA=Bc(),mA=aa,u0=mA("Object.prototype.toString"),ny=function(t){return dA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:u0(t)==="[object Arguments]"},VS=function(t){return ny(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&u0(t)!=="[object Array]"&&u0(t.callee)==="[object Function]"},gA=function(){return ny(arguments)}();ny.isLegacyArguments=VS;var US=gA?ny:VS;const yA={},_A=Object.freeze(Object.defineProperty({__proto__:null,default:yA},Symbol.toStringTag,{value:"Module"})),vA=$g(_A);var cv=typeof Map=="function"&&Map.prototype,F_=Object.getOwnPropertyDescriptor&&cv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,wg=cv&&F_&&typeof F_.get=="function"?F_.get:null,gx=cv&&Map.prototype.forEach,hv=typeof Set=="function"&&Set.prototype,B_=Object.getOwnPropertyDescriptor&&hv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Sg=hv&&B_&&typeof B_.get=="function"?B_.get:null,yx=hv&&Set.prototype.forEach,bA=typeof WeakMap=="function"&&WeakMap.prototype,od=bA?WeakMap.prototype.has:null,xA=typeof WeakSet=="function"&&WeakSet.prototype,sd=xA?WeakSet.prototype.has:null,wA=typeof WeakRef=="function"&&WeakRef.prototype,_x=wA?WeakRef.prototype.deref:null,SA=Boolean.prototype.valueOf,EA=Object.prototype.toString,IA=Function.prototype.toString,CA=String.prototype.match,fv=String.prototype.slice,wu=String.prototype.replace,TA=String.prototype.toUpperCase,vx=String.prototype.toLowerCase,GS=RegExp.prototype.test,bx=Array.prototype.concat,$a=Array.prototype.join,LA=Array.prototype.slice,xx=Math.floor,c0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,V_=Object.getOwnPropertySymbols,h0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,sf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",wo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===sf||"symbol")?Symbol.toStringTag:null,qS=Object.prototype.propertyIsEnumerable,wx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function Sx(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||GS.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var r=e<0?-xx(-e):xx(e);if(r!==e){var o=String(r),l=fv.call(t,o.length+1);return wu.call(o,n,"$&_")+"."+wu.call(wu.call(l,/([0-9]{3})/g,"$&_"),/_$/,"")}}return wu.call(t,n,"$&_")}var f0=vA,Ex=f0.custom,Ix=WS(Ex)?Ex:null,PA=function e(t,n,r,o){var l=n||{};if(vu(l,"quoteStyle")&&l.quoteStyle!=="single"&&l.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(vu(l,"maxStringLength")&&(typeof l.maxStringLength=="number"?l.maxStringLength<0&&l.maxStringLength!==1/0:l.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=vu(l,"customInspect")?l.customInspect:!0;if(typeof h!="boolean"&&h!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(vu(l,"indent")&&l.indent!==null&&l.indent!==" "&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(vu(l,"numericSeparator")&&typeof l.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=l.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return ZS(t,l);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var y=String(t);return u?Sx(t,y):y}if(typeof t=="bigint"){var w=String(t)+"n";return u?Sx(t,w):w}var S=typeof l.depth>"u"?5:l.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof t=="object")return p0(t)?"[Array]":"[Object]";var C=ZA(l,r);if(typeof o>"u")o=[];else if(HS(o,t)>=0)return"[Circular]";function P(Qt,Tt,re){if(Tt&&(o=LA.call(o),o.push(Tt)),re){var fe={depth:l.depth};return vu(l,"quoteStyle")&&(fe.quoteStyle=l.quoteStyle),e(Qt,fe,r+1,o)}return e(Qt,l,r+1,o)}if(typeof t=="function"&&!Cx(t)){var N=FA(t),R=Ym(t,P);return"[Function"+(N?": "+N:" (anonymous)")+"]"+(R.length>0?" { "+$a.call(R,", ")+" }":"")}if(WS(t)){var J=sf?wu.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):h0.call(t);return typeof t=="object"&&!sf?Up(J):J}if(jA(t)){for(var Y="<"+vx.call(String(t.nodeName)),K=t.attributes||[],B=0;B",Y}if(p0(t)){if(t.length===0)return"[]";var G=Ym(t,P);return C&&!HA(G)?"["+d0(G,C)+"]":"[ "+$a.call(G,", ")+" ]"}if(kA(t)){var H=Ym(t,P);return!("cause"in Error.prototype)&&"cause"in t&&!qS.call(t,"cause")?"{ ["+String(t)+"] "+$a.call(bx.call("[cause]: "+P(t.cause),H),", ")+" }":H.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$a.call(H,", ")+" }"}if(typeof t=="object"&&h){if(Ix&&typeof t[Ix]=="function"&&f0)return f0(t,{depth:S-r});if(h!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(BA(t)){var at=[];return gx&&gx.call(t,function(Qt,Tt){at.push(P(Tt,t,!0)+" => "+P(Qt,t))}),Tx("Map",wg.call(t),at,C)}if(GA(t)){var gt=[];return yx&&yx.call(t,function(Qt){gt.push(P(Qt,t))}),Tx("Set",Sg.call(t),gt,C)}if(VA(t))return U_("WeakMap");if(qA(t))return U_("WeakSet");if(UA(t))return U_("WeakRef");if(RA(t))return Up(P(Number(t)));if(OA(t))return Up(P(c0.call(t)));if(NA(t))return Up(SA.call(t));if(DA(t))return Up(P(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Md)return"{ [object globalThis] }";if(!AA(t)&&!Cx(t)){var ft=Ym(t,P),rt=wx?wx(t)===Object.prototype:t instanceof Object||t.constructor===Object,mt=t instanceof Object?"":"null prototype",Et=!rt&&wo&&Object(t)===t&&wo in t?fv.call(Uu(t),8,-1):mt?"Object":"",$=rt||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",Pt=$+(Et||mt?"["+$a.call(bx.call([],Et||[],mt||[]),": ")+"] ":"");return ft.length===0?Pt+"{}":C?Pt+"{"+d0(ft,C)+"}":Pt+"{ "+$a.call(ft,", ")+" }"}return String(t)};function jS(e,t,n){var r=(n.quoteStyle||t)==="double"?'"':"'";return r+e+r}function MA(e){return wu.call(String(e),/"/g,""")}function p0(e){return Uu(e)==="[object Array]"&&(!wo||!(typeof e=="object"&&wo in e))}function AA(e){return Uu(e)==="[object Date]"&&(!wo||!(typeof e=="object"&&wo in e))}function Cx(e){return Uu(e)==="[object RegExp]"&&(!wo||!(typeof e=="object"&&wo in e))}function kA(e){return Uu(e)==="[object Error]"&&(!wo||!(typeof e=="object"&&wo in e))}function DA(e){return Uu(e)==="[object String]"&&(!wo||!(typeof e=="object"&&wo in e))}function RA(e){return Uu(e)==="[object Number]"&&(!wo||!(typeof e=="object"&&wo in e))}function NA(e){return Uu(e)==="[object Boolean]"&&(!wo||!(typeof e=="object"&&wo in e))}function WS(e){if(sf)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!h0)return!1;try{return h0.call(e),!0}catch{}return!1}function OA(e){if(!e||typeof e!="object"||!c0)return!1;try{return c0.call(e),!0}catch{}return!1}var zA=Object.prototype.hasOwnProperty||function(e){return e in this};function vu(e,t){return zA.call(e,t)}function Uu(e){return EA.call(e)}function FA(e){if(e.name)return e.name;var t=CA.call(IA.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function HS(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return ZS(fv.call(e,0,t.maxStringLength),t)+r}var o=wu.call(wu.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,WA);return jS(o,"single",t)}function WA(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+TA.call(t.toString(16))}function Up(e){return"Object("+e+")"}function U_(e){return e+" { ? }"}function Tx(e,t,n,r){var o=r?d0(n,r):$a.call(n,", ");return e+" ("+t+") {"+o+"}"}function HA(e){for(var t=0;t=0)return!1;return!0}function ZA(e,t){var n;if(e.indent===" ")n=" ";else if(typeof e.indent=="number"&&e.indent>0)n=$a.call(Array(e.indent+1)," ");else return null;return{base:n,prev:$a.call(Array(t+1),n)}}function d0(e,t){if(e.length===0)return"";var n=` +`}),staticAttributes:d,staticUniforms:I}}class Xc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,d,m,v,I,T,M,k){this.context=s;let z=this.boundPaintVertexBuffers.length!==m.length;for(let F=0;!z&&F({u_depth:new u.aG(Ft,Gt.u_depth),u_terrain:new u.aG(Ft,Gt.u_terrain),u_terrain_dim:new u.aH(Ft,Gt.u_terrain_dim),u_terrain_matrix:new u.aI(Ft,Gt.u_terrain_matrix),u_terrain_unpack:new u.aJ(Ft,Gt.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Ft,Gt.u_terrain_exaggeration)}))(s,Rt),this.binderUniforms=d?d.getUniforms(s,Rt):[]}draw(s,f,d,m,v,I,T,M,k,z,F,W,st,ot,ct,tt,_t,kt){const ht=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(d),s.setStencilMode(m),s.setColorMode(v),s.setCullFace(I),M){s.activeTexture.set(ht.TEXTURE2),ht.bindTexture(ht.TEXTURE_2D,M.depthTexture),s.activeTexture.set(ht.TEXTURE3),ht.bindTexture(ht.TEXTURE_2D,M.texture);for(const Rt in this.terrainUniforms)this.terrainUniforms[Rt].set(M[Rt])}for(const Rt in this.fixedUniforms)this.fixedUniforms[Rt].set(T[Rt]);ct&&ct.setUniforms(s,this.binderUniforms,st,{zoom:ot});let St=0;switch(f){case ht.LINES:St=2;break;case ht.TRIANGLES:St=3;break;case ht.LINE_STRIP:St=1}for(const Rt of W.get()){const Ft=Rt.vaos||(Rt.vaos={});(Ft[k]||(Ft[k]=new Xc)).bind(s,this,z,ct?ct.getPaintVertexBuffers():[],F,Rt.vertexOffset,tt,_t,kt),ht.drawElements(f,Rt.primitiveLength*St,ht.UNSIGNED_SHORT,Rt.primitiveOffset*St*2)}}}function Yc(_,s,f){const d=1/qe(f,1,s.transform.tileZoom),m=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/m,I=v*(f.tileID.canonical.x+f.tileID.wrap*m),T=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[I>>16,T>>16],u_pixel_coord_lower:[65535&I,65535&T]}}const Xu=(_,s,f,d)=>{const m=s.style.light,v=m.properties.get("position"),I=[v.x,v.y,v.z],T=function(){var k=new u.A(9);return u.A!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0),k[0]=1,k[4]=1,k[8]=1,k}();m.properties.get("anchor")==="viewport"&&function(k,z){var F=Math.sin(z),W=Math.cos(z);k[0]=W,k[1]=F,k[2]=0,k[3]=-F,k[4]=W,k[5]=0,k[6]=0,k[7]=0,k[8]=1}(T,-s.transform.angle),function(k,z,F){var W=z[0],st=z[1],ot=z[2];k[0]=W*F[0]+st*F[3]+ot*F[6],k[1]=W*F[1]+st*F[4]+ot*F[7],k[2]=W*F[2]+st*F[5]+ot*F[8]}(I,I,T);const M=m.properties.get("color");return{u_matrix:_,u_lightpos:I,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:d}},Sy=(_,s,f,d,m,v,I)=>u.e(Xu(_,s,f,d),Yc(v,s,I),{u_height_factor:-Math.pow(2,m.overscaledZ)/I.tileSize/8}),jd=_=>({u_matrix:_}),Kc=(_,s,f,d)=>u.e(jd(_),Yc(f,s,d)),Ey=(_,s)=>({u_matrix:_,u_world:s}),Wd=(_,s,f,d,m)=>u.e(Kc(_,s,f,d),{u_world:m}),Iy=(_,s,f,d)=>{const m=_.transform;let v,I;if(d.paint.get("circle-pitch-alignment")==="map"){const T=qe(f,1,m.zoom);v=!0,I=[T,T]}else v=!1,I=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(s.posMatrix,f,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:I}},Hd=(_,s,f)=>{const d=qe(f,1,s.zoom),m=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[s.pixelsToGLUnits[0]/(d*m),s.pixelsToGLUnits[1]/(d*m)],u_overscale_factor:v}},Zd=(_,s,f=1)=>({u_matrix:_,u_color:s,u_overlay:0,u_overlay_scale:f}),Jc=_=>({u_matrix:_}),Xd=(_,s,f,d)=>({u_matrix:_,u_extrude_scale:qe(s,1,f),u_intensity:d});function Yd(_,s){const f=Math.pow(2,s.canonical.z),d=s.canonical.y;return[new u.Y(0,d/f).toLngLat().lat,new u.Y(0,(d+1)/f).toLngLat().lat]}const Qc=(_,s,f,d)=>{const m=_.transform;return{u_matrix:Yu(_,s,f,d),u_ratio:1/qe(s,1,m.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Kd=(_,s,f,d,m)=>u.e(Qc(_,s,f,m),{u_image:0,u_image_height:d}),_l=(_,s,f,d,m)=>{const v=_.transform,I=Mo(s,v);return{u_matrix:Yu(_,s,f,m),u_texsize:s.imageAtlasTexture.size,u_ratio:1/qe(s,1,v.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[I,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},$c=(_,s,f,d,m,v)=>{const I=_.lineAtlas,T=Mo(s,_.transform),M=f.layout.get("line-cap")==="round",k=I.getDash(d.from,M),z=I.getDash(d.to,M),F=k.width*m.fromScale,W=z.width*m.toScale;return u.e(Qc(_,s,f,v),{u_patternscale_a:[T/F,-k.height/2],u_patternscale_b:[T/W,-z.height/2],u_sdfgamma:I.width/(256*Math.min(F,W)*_.pixelRatio)/2,u_image:0,u_tex_y_a:k.y,u_tex_y_b:z.y,u_mix:m.t})};function Mo(_,s){return 1/qe(_,1,s.tileZoom)}function Yu(_,s,f,d){return _.translatePosMatrix(d?d.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const th=(_,s,f,d,m)=>{return{u_matrix:_,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(I=m.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(v=m.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:Ku(m.paint.get("raster-hue-rotate"))};var v,I};function Ku(_){_*=Math.PI/180;const s=Math.sin(_),f=Math.cos(_);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const Ju=(_,s,f,d,m,v,I,T,M,k)=>{const z=m.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:I,u_coord_matrix:T,u_is_text:+M,u_pitch_with_map:+d,u_texsize:k,u_texture:0}},Qu=(_,s,f,d,m,v,I,T,M,k,z)=>{const F=m.transform;return u.e(Ju(_,s,f,d,m,v,I,T,M,k),{u_gamma_scale:d?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+z})},$u=(_,s,f,d,m,v,I,T,M,k)=>u.e(Qu(_,s,f,d,m,v,I,T,!0,M,!0),{u_texsize_icon:k,u_texture_icon:1}),Cy=(_,s,f)=>({u_matrix:_,u_opacity:s,u_color:f}),Ty=(_,s,f,d,m,v)=>u.e(function(I,T,M,k){const z=M.imageManager.getPattern(I.from.toString()),F=M.imageManager.getPattern(I.to.toString()),{width:W,height:st}=M.imageManager.getPixelSize(),ot=Math.pow(2,k.tileID.overscaledZ),ct=k.tileSize*Math.pow(2,M.transform.tileZoom)/ot,tt=ct*(k.tileID.canonical.x+k.tileID.wrap*ot),_t=ct*k.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[W,st],u_mix:T.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/qe(k,1,M.transform.tileZoom),u_pixel_coord_upper:[tt>>16,_t>>16],u_pixel_coord_lower:[65535&tt,65535&_t]}}(d,v,f,m),{u_matrix:_,u_opacity:s}),Jd={fillExtrusion:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_opacity:new u.aH(_,s.u_opacity)}),fillExtrusionPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_lightpos:new u.aK(_,s.u_lightpos),u_lightintensity:new u.aH(_,s.u_lightintensity),u_lightcolor:new u.aK(_,s.u_lightcolor),u_vertical_gradient:new u.aH(_,s.u_vertical_gradient),u_height_factor:new u.aH(_,s.u_height_factor),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade),u_opacity:new u.aH(_,s.u_opacity)}),fill:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),fillPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),fillOutline:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world)}),fillOutlinePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_texsize:new u.aL(_,s.u_texsize),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),circle:(_,s)=>({u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,s.u_scale_with_map),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_matrix:new u.aI(_,s.u_matrix)}),collisionBox:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,s.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,s.u_extrude_scale),u_overscale_factor:new u.aH(_,s.u_overscale_factor)}),collisionCircle:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_inv_matrix:new u.aI(_,s.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_viewport_size:new u.aL(_,s.u_viewport_size)}),debug:(_,s)=>({u_color:new u.aM(_,s.u_color),u_matrix:new u.aI(_,s.u_matrix),u_overlay:new u.aG(_,s.u_overlay),u_overlay_scale:new u.aH(_,s.u_overlay_scale)}),clippingMask:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix)}),heatmap:(_,s)=>({u_extrude_scale:new u.aH(_,s.u_extrude_scale),u_intensity:new u.aH(_,s.u_intensity),u_matrix:new u.aI(_,s.u_matrix)}),heatmapTexture:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_world:new u.aL(_,s.u_world),u_image:new u.aG(_,s.u_image),u_color_ramp:new u.aG(_,s.u_color_ramp),u_opacity:new u.aH(_,s.u_opacity)}),hillshade:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_latrange:new u.aL(_,s.u_latrange),u_light:new u.aL(_,s.u_light),u_shadow:new u.aM(_,s.u_shadow),u_highlight:new u.aM(_,s.u_highlight),u_accent:new u.aM(_,s.u_accent)}),hillshadePrepare:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_image:new u.aG(_,s.u_image),u_dimension:new u.aL(_,s.u_dimension),u_zoom:new u.aH(_,s.u_zoom),u_unpack:new u.aJ(_,s.u_unpack)}),line:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels)}),lineGradient:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_image:new u.aG(_,s.u_image),u_image_height:new u.aH(_,s.u_image_height)}),linePattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texsize:new u.aL(_,s.u_texsize),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_image:new u.aG(_,s.u_image),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_scale:new u.aK(_,s.u_scale),u_fade:new u.aH(_,s.u_fade)}),lineSDF:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ratio:new u.aH(_,s.u_ratio),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,s.u_units_to_pixels),u_patternscale_a:new u.aL(_,s.u_patternscale_a),u_patternscale_b:new u.aL(_,s.u_patternscale_b),u_sdfgamma:new u.aH(_,s.u_sdfgamma),u_image:new u.aG(_,s.u_image),u_tex_y_a:new u.aH(_,s.u_tex_y_a),u_tex_y_b:new u.aH(_,s.u_tex_y_b),u_mix:new u.aH(_,s.u_mix)}),raster:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_tl_parent:new u.aL(_,s.u_tl_parent),u_scale_parent:new u.aH(_,s.u_scale_parent),u_buffer_scale:new u.aH(_,s.u_buffer_scale),u_fade_t:new u.aH(_,s.u_fade_t),u_opacity:new u.aH(_,s.u_opacity),u_image0:new u.aG(_,s.u_image0),u_image1:new u.aG(_,s.u_image1),u_brightness_low:new u.aH(_,s.u_brightness_low),u_brightness_high:new u.aH(_,s.u_brightness_high),u_saturation_factor:new u.aH(_,s.u_saturation_factor),u_contrast_factor:new u.aH(_,s.u_contrast_factor),u_spin_weights:new u.aK(_,s.u_spin_weights)}),symbolIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture)}),symbolSDF:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texture:new u.aG(_,s.u_texture),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),symbolTextAndIcon:(_,s)=>({u_is_size_zoom_constant:new u.aG(_,s.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,s.u_is_size_feature_constant),u_size_t:new u.aH(_,s.u_size_t),u_size:new u.aH(_,s.u_size),u_camera_to_center_distance:new u.aH(_,s.u_camera_to_center_distance),u_pitch:new u.aH(_,s.u_pitch),u_rotate_symbol:new u.aG(_,s.u_rotate_symbol),u_aspect_ratio:new u.aH(_,s.u_aspect_ratio),u_fade_change:new u.aH(_,s.u_fade_change),u_matrix:new u.aI(_,s.u_matrix),u_label_plane_matrix:new u.aI(_,s.u_label_plane_matrix),u_coord_matrix:new u.aI(_,s.u_coord_matrix),u_is_text:new u.aG(_,s.u_is_text),u_pitch_with_map:new u.aG(_,s.u_pitch_with_map),u_texsize:new u.aL(_,s.u_texsize),u_texsize_icon:new u.aL(_,s.u_texsize_icon),u_texture:new u.aG(_,s.u_texture),u_texture_icon:new u.aG(_,s.u_texture_icon),u_gamma_scale:new u.aH(_,s.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,s.u_device_pixel_ratio),u_is_halo:new u.aG(_,s.u_is_halo)}),background:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_color:new u.aM(_,s.u_color)}),backgroundPattern:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_opacity:new u.aH(_,s.u_opacity),u_image:new u.aG(_,s.u_image),u_pattern_tl_a:new u.aL(_,s.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,s.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,s.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,s.u_pattern_br_b),u_texsize:new u.aL(_,s.u_texsize),u_mix:new u.aH(_,s.u_mix),u_pattern_size_a:new u.aL(_,s.u_pattern_size_a),u_pattern_size_b:new u.aL(_,s.u_pattern_size_b),u_scale_a:new u.aH(_,s.u_scale_a),u_scale_b:new u.aH(_,s.u_scale_b),u_pixel_coord_upper:new u.aL(_,s.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,s.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,s.u_tile_units_to_pixels)}),terrain:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainDepth:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_ele_delta:new u.aH(_,s.u_ele_delta)}),terrainCoords:(_,s)=>({u_matrix:new u.aI(_,s.u_matrix),u_texture:new u.aG(_,s.u_texture),u_terrain_coords_id:new u.aH(_,s.u_terrain_coords_id),u_ele_delta:new u.aH(_,s.u_ele_delta)})};class Ly{constructor(s,f,d){this.context=s;const m=s.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){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,s.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 eh{constructor(s,f,d,m){this.length=f.length,this.attributes=d,this.itemSize=f.bytesPerElement,this.dynamicDraw=m,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let d=0;d0){const ne=u.F(),se=Gt;u.aP(ne,Ft.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(ne,ne,Ft.placementViewportMatrix),z.push({circleArray:Kt,circleOffset:W,transform:se,invTransform:ne,coord:St}),F+=Kt.length/4,W=F}Jt&&k.draw(T,M.LINES,bn.disabled,Jn.disabled,_.colorModeForRenderPass(),Wn.disabled,Hd(Gt,_.transform,Rt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(St),f.id,Jt.layoutVertexBuffer,Jt.indexBuffer,Jt.segments,null,_.transform.zoom,null,null,Jt.collisionVertexBuffer)}if(!I||!z.length)return;const st=_.useProgram("collisionCircle"),ot=new u.aQ;ot.resize(4*F),ot._trim();let ct=0;for(const ht of z)for(let St=0;St=0&&(ot[tt.associatedIconIndex]={shiftedAnchor:Qe,angle:ae})}else Ht(tt.numGlyphs,W)}if(k){st.clear();const ct=_.icon.placedSymbolArray;for(let tt=0;tt_.style.map.terrain.getElevation(Jt,Jo,Jr):null,mr=f.layout.get("text-rotation-alignment")==="map";q(ne,Jt.posMatrix,_,m,ko,Fs,tt,k,mr,Kr)}const Ga=_.translatePosMatrix(Jt.posMatrix,Kt,v,I),Bs=_t||m&&Ft||pc?$f:ko,Yr=_.translatePosMatrix(Fs,Kt,v,I,!0),dr=ae&&f.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ir;ir=ae?ne.iconsInText?$u(Ne.kind,Be,kt,tt,_,Ga,Bs,Yr,ln,ti):Qu(Ne.kind,Be,kt,tt,_,Ga,Bs,Yr,m,ln,!0):Ju(Ne.kind,Be,kt,tt,_,Ga,Bs,Yr,m,ln);const Ko={program:xn,buffers:se,uniformValues:ir,atlasTexture:wr,atlasTextureIcon:pr,atlasInterpolation:Fn,atlasInterpolationIcon:Ao,isSDF:ae,hasHalo:dr};if(ht&&ne.canOverlap){St=!0;const Kr=se.segments.get();for(const mr of Kr)Gt.push({segments:new u.$([mr]),sortKey:mr.sortKey,state:Ko,terrainData:rn})}else Gt.push({segments:se.segments,sortKey:0,state:Ko,terrainData:rn})}St&&Gt.sort((Jt,Kt)=>Jt.sortKey-Kt.sortKey);for(const Jt of Gt){const Kt=Jt.state;if(W.activeTexture.set(st.TEXTURE0),Kt.atlasTexture.bind(Kt.atlasInterpolation,st.CLAMP_TO_EDGE),Kt.atlasTextureIcon&&(W.activeTexture.set(st.TEXTURE1),Kt.atlasTextureIcon&&Kt.atlasTextureIcon.bind(Kt.atlasInterpolationIcon,st.CLAMP_TO_EDGE)),Kt.isSDF){const ne=Kt.uniformValues;Kt.hasHalo&&(ne.u_is_halo=1,sm(Kt.buffers,Jt.segments,f,_,Kt.program,Rt,z,F,ne,Jt.terrainData)),ne.u_is_halo=0}sm(Kt.buffers,Jt.segments,f,_,Kt.program,Rt,z,F,Kt.uniformValues,Jt.terrainData)}}function sm(_,s,f,d,m,v,I,T,M,k){const z=d.context;m.draw(z,z.gl.TRIANGLES,v,I,T,Wn.disabled,M,k,f.id,_.layoutVertexBuffer,_.indexBuffer,s,f.paint,d.transform.zoom,_.programConfigurations.get(f.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function fh(_,s,f,d,m){if(!f||!d||!d.imageAtlas)return;const v=d.imageAtlas.patternPositions;let I=v[f.to.toString()],T=v[f.from.toString()];if(!I&&T&&(I=T),!T&&I&&(T=I),!I||!T){const M=m.getPaintProperty(s);I=v[M],T=v[M]}I&&T&&_.setConstantPatternPositions(I,T)}function am(_,s,f,d,m,v,I){const T=_.context.gl,M="fill-pattern",k=f.paint.get(M),z=k&&k.constantOr(1),F=f.getCrossfadeParameters();let W,st,ot,ct,tt;I?(st=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",W=T.LINES):(st=z?"fillPattern":"fill",W=T.TRIANGLES);const _t=k.constantOr(null);for(const kt of d){const ht=s.getTile(kt);if(z&&!ht.patternsLoaded())continue;const St=ht.getBucket(f);if(!St)continue;const Rt=St.programConfigurations.get(f.id),Ft=_.useProgram(st,Rt),Gt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(kt);z&&(_.context.activeTexture.set(T.TEXTURE0),ht.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Rt.updatePaintBuffers(F)),fh(Rt,M,_t,ht,f);const Jt=Gt?kt:null,Kt=_.translatePosMatrix(Jt?Jt.posMatrix:kt.posMatrix,ht,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(I){ct=St.indexBuffer2,tt=St.segments2;const ne=[T.drawingBufferWidth,T.drawingBufferHeight];ot=st==="fillOutlinePattern"&&z?Wd(Kt,_,F,ht,ne):Ey(Kt,ne)}else ct=St.indexBuffer,tt=St.segments,ot=z?Kc(Kt,_,F,ht):jd(Kt);Ft.draw(_.context,W,m,_.stencilModeForClipping(kt),v,Wn.disabled,ot,Gt,f.id,St.layoutVertexBuffer,ct,tt,f.paint,_.transform.zoom,Rt)}}function ph(_,s,f,d,m,v,I){const T=_.context,M=T.gl,k="fill-extrusion-pattern",z=f.paint.get(k),F=z.constantOr(1),W=f.getCrossfadeParameters(),st=f.paint.get("fill-extrusion-opacity"),ot=z.constantOr(null);for(const ct of d){const tt=s.getTile(ct),_t=tt.getBucket(f);if(!_t)continue;const kt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ct),ht=_t.programConfigurations.get(f.id),St=_.useProgram(F?"fillExtrusionPattern":"fillExtrusion",ht);F&&(_.context.activeTexture.set(M.TEXTURE0),tt.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ht.updatePaintBuffers(W)),fh(ht,k,ot,tt,f);const Rt=_.translatePosMatrix(ct.posMatrix,tt,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),Ft=f.paint.get("fill-extrusion-vertical-gradient"),Gt=F?Sy(Rt,_,Ft,st,ct,W,tt):Xu(Rt,_,Ft,st);St.draw(T,T.gl.TRIANGLES,m,v,I,Wn.backCCW,Gt,kt,f.id,_t.layoutVertexBuffer,_t.indexBuffer,_t.segments,f.paint,_.transform.zoom,ht,_.style.map.terrain&&_t.centroidVertexBuffer)}}function dh(_,s,f,d,m,v,I){const T=_.context,M=T.gl,k=f.fbo;if(!k)return;const z=_.useProgram("hillshade"),F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(s);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,k.colorAttachment.get()),z.draw(T,M.TRIANGLES,m,v,I,Wn.disabled,((W,st,ot,ct)=>{const tt=ot.paint.get("hillshade-shadow-color"),_t=ot.paint.get("hillshade-highlight-color"),kt=ot.paint.get("hillshade-accent-color");let ht=ot.paint.get("hillshade-illumination-direction")*(Math.PI/180);ot.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=W.transform.angle);const St=!W.options.moving;return{u_matrix:ct?ct.posMatrix:W.transform.calculatePosMatrix(st.tileID.toUnwrapped(),St),u_image:0,u_latrange:Yd(0,st.tileID),u_light:[ot.paint.get("hillshade-exaggeration"),ht],u_shadow:tt,u_highlight:_t,u_accent:kt}})(_,f,d,F?s:null),F,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function tp(_,s,f,d,m,v){const I=_.context,T=I.gl,M=s.dem;if(M&&M.data){const k=M.dim,z=M.stride,F=M.getPixels();if(I.activeTexture.set(T.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||_.getTileTexture(z),s.demTexture){const st=s.demTexture;st.update(F,{premultiply:!1}),st.bind(T.NEAREST,T.CLAMP_TO_EDGE)}else s.demTexture=new $(I,F,T.RGBA,{premultiply:!1}),s.demTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE);I.activeTexture.set(T.TEXTURE0);let W=s.fbo;if(!W){const st=new $(I,{width:k,height:k,data:null},T.RGBA);st.bind(T.LINEAR,T.CLAMP_TO_EDGE),W=s.fbo=I.createFramebuffer(k,k,!0,!1),W.colorAttachment.set(st.texture)}I.bindFramebuffer.set(W.framebuffer),I.viewport.set([0,0,k,k]),_.useProgram("hillshadePrepare").draw(I,T.TRIANGLES,d,m,v,Wn.disabled,((st,ot)=>{const ct=ot.stride,tt=u.F();return u.aN(tt,0,u.W,-u.W,0,0,1),u.H(tt,tt,[0,-u.W,0]),{u_matrix:tt,u_image:1,u_dimension:[ct,ct],u_zoom:st.overscaledZ,u_unpack:ot.getUnpackVector()}})(s.tileID,M),null,f.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function lm(_,s,f,d,m,v){const I=d.paint.get("raster-fade-duration");if(!v&&I>0){const T=C.now(),M=(T-_.timeAdded)/I,k=s?(T-s.timeAdded)/I:-1,z=f.getSource(),F=m.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),W=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(_.tileID.overscaledZ-F),st=W&&_.refreshedUponExpiration?1:u.ac(W?M:1-k,0,1);return _.refreshedUponExpiration&&M>=1&&(_.refreshedUponExpiration=!1),s?{opacity:1,mix:1-st}:{opacity:st,mix:0}}return{opacity:1,mix:0}}const um=new u.aO(1,0,0,1),mh=new u.aO(0,1,0,1),ep=new u.aO(0,0,1,1),zy=new u.aO(1,0,1,1),cm=new u.aO(0,1,1,1);function br(_,s,f,d){Yi(_,0,s+f/2,_.transform.width,f,d)}function za(_,s,f,d){Yi(_,s-f/2,0,f,_.transform.height,d)}function Yi(_,s,f,d,m,v){const I=_.context,T=I.gl;T.enable(T.SCISSOR_TEST),T.scissor(s*_.pixelRatio,f*_.pixelRatio,d*_.pixelRatio,m*_.pixelRatio),I.clear({color:v}),T.disable(T.SCISSOR_TEST)}function np(_,s,f){const d=_.context,m=d.gl,v=f.posMatrix,I=_.useProgram("debug"),T=bn.disabled,M=Jn.disabled,k=_.colorModeForRenderPass(),z="$debug",F=_.style.map.terrain&&_.style.map.terrain.getTerrainData(f);d.activeTexture.set(m.TEXTURE0);const W=s.getTileByID(f.key).latestRawTileData,st=Math.floor((W&&W.byteLength||0)/1024),ot=s.getTile(f).tileSize,ct=512/Math.min(ot,512)*(f.overscaledZ/_.transform.zoom)*.5;let tt=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(tt+=` => ${f.overscaledZ}`),function(_t,kt){_t.initDebugOverlayCanvas();const ht=_t.debugOverlayCanvas,St=_t.context.gl,Rt=_t.debugOverlayCanvas.getContext("2d");Rt.clearRect(0,0,ht.width,ht.height),Rt.shadowColor="white",Rt.shadowBlur=2,Rt.lineWidth=1.5,Rt.strokeStyle="white",Rt.textBaseline="top",Rt.font="bold 36px Open Sans, sans-serif",Rt.fillText(kt,5,5),Rt.strokeText(kt,5,5),_t.debugOverlayTexture.update(ht),_t.debugOverlayTexture.bind(St.LINEAR,St.CLAMP_TO_EDGE)}(_,`${tt} ${st}kB`),I.draw(d,m.TRIANGLES,T,M,Nr.alphaBlended,Wn.disabled,Zd(v,u.aO.transparent,ct),null,z,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),I.draw(d,m.LINE_STRIP,T,M,k,Wn.disabled,Zd(v,u.aO.red),F,z,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function gh(_,s,f){const d=_.context,m=d.gl,v=_.colorModeForRenderPass(),I=new bn(m.LEQUAL,bn.ReadWrite,_.depthRangeFor3D),T=_.useProgram("terrain"),M=s.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const k of f){const z=_.renderToTexture.getTexture(k),F=s.getTerrainData(k.tileID);d.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,z.texture);const W={u_matrix:_.transform.calculatePosMatrix(k.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(_.transform.zoom)};T.draw(d,m.TRIANGLES,I,Jn.disabled,v,Wn.backCCW,W,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class hm{constructor(s,f){this.context=new Oy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Hr.maxUnderzooming+Hr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Na}resize(s,f,d){if(this.width=Math.floor(s*d),this.height=Math.floor(f*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const s=this.context,f=new u.aV;f.emplaceBack(0,0),f.emplaceBack(u.W,0),f.emplaceBack(0,u.W),f.emplaceBack(u.W,u.W),this.tileExtentBuffer=s.createVertexBuffer(f,Zc.members),this.tileExtentSegments=u.$.simpleSegment(0,0,4,2);const d=new u.aV;d.emplaceBack(0,0),d.emplaceBack(u.W,0),d.emplaceBack(0,u.W),d.emplaceBack(u.W,u.W),this.debugBuffer=s.createVertexBuffer(d,Zc.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const m=new u.Z;m.emplaceBack(0,0,0,0),m.emplaceBack(u.W,0,u.W,0),m.emplaceBack(0,u.W,0,u.W),m.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=s.createVertexBuffer(m,on.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const v=new u.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,Zc.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const I=new u.aW;I.emplaceBack(0),I.emplaceBack(1),I.emplaceBack(3),I.emplaceBack(2),I.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(I);const T=new u.aX;T.emplaceBack(0,1,2),T.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(T);const M=this.context.gl;this.stencilClearMode=new Jn({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=u.F();u.aN(d,0,this.width,this.height,0,0,1),u.J(d,d,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,bn.disabled,this.stencilClearMode,Nr.disabled,Wn.disabled,Jc(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const d=this.context,m=d.gl;this.nextStencilID+f.length>256&&this.clearStencil(),d.setColorMode(Nr.disabled),d.setDepthMode(bn.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of f){const T=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I);v.draw(d,m.TRIANGLES,bn.disabled,new Jn({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),Nr.disabled,Wn.disabled,Jc(I.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new Jn({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new Jn({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,d=s.sort((I,T)=>T.overscaledZ-I.overscaledZ),m=d[d.length-1].overscaledZ,v=d[0].overscaledZ-m+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const I={};for(let T=0;T=0;this.currentLayer--){const M=this.style._layers[d[this.currentLayer]],k=m[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,k,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayertt.source&&!tt.isHidden(z)?[k.sourceCaches[tt.source]]:[]),st=W.filter(tt=>tt.getSource().type==="vector"),ot=W.filter(tt=>tt.getSource().type!=="vector"),ct=tt=>{(!F||F.getSource().maxzoomct(tt)),F||ot.forEach(tt=>ct(tt)),F}(this.style,this.transform.zoom);M&&function(k,z,F){for(let W=0;W0),m&&(u.a_(f,d),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,I){const T=v.context,M=T.gl,k=Nr.unblended,z=new bn(M.LEQUAL,bn.ReadWrite,[0,1]),F=I.getTerrainMesh(),W=I.sourceCache.getRenderableTiles(),st=v.useProgram("terrainDepth");T.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1});for(const ot of W){const ct=I.getTerrainData(ot.tileID),tt={u_matrix:v.transform.calculatePosMatrix(ot.tileID.toUnwrapped()),u_ele_delta:I.getMeshFrameDelta(v.transform.zoom)};st.draw(T,M.TRIANGLES,z,Jn.disabled,k,Wn.backCCW,tt,ct,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,I){const T=v.context,M=T.gl,k=Nr.unblended,z=new bn(M.LEQUAL,bn.ReadWrite,[0,1]),F=I.getTerrainMesh(),W=I.getCoordsTexture(),st=I.sourceCache.getRenderableTiles(),ot=v.useProgram("terrainCoords");T.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),T.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),T.clear({color:u.aO.transparent,depth:1}),I.coordsIndex=[];for(const ct of st){const tt=I.getTerrainData(ct.tileID);T.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,W.texture);const _t={u_matrix:v.transform.calculatePosMatrix(ct.tileID.toUnwrapped()),u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0,u_ele_delta:I.getMeshFrameDelta(v.transform.zoom)};ot.draw(T,M.TRIANGLES,z,Jn.disabled,k,Wn.backCCW,_t,tt,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),I.coordsIndex.push(ct.tileID.key)}T.bindFramebuffer.set(null),T.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,d,m){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(m||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(v,I,T,M,k){if(v.renderPass!=="translucent")return;const z=Jn.disabled,F=v.colorModeForRenderPass();(T._unevaluatedLayout.hasValue("text-variable-anchor")||T._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,st,ot,ct,tt,_t,kt){const ht=st.transform,St=tt==="map",Rt=_t==="map";for(const Ft of W){const Gt=ct.getTile(Ft),Jt=Gt.getBucket(ot);if(!Jt||!Jt.text||!Jt.text.segments.get().length)continue;const Kt=u.ag(Jt.textSizeData,ht.zoom),ne=qe(Gt,1,st.transform.zoom),se=Ze(Ft.posMatrix,Rt,St,st.transform,ne),Qe=ot.layout.get("icon-text-fit")!=="none"&&Jt.hasIconData();if(Kt){const ae=Math.pow(2,ht.zoom-Gt.tileID.overscaledZ);uh(Jt,St,Rt,kt,ht,se,Ft.posMatrix,ae,Kt,Qe,st.style.map.terrain?(Ne,$e)=>st.style.map.terrain.getElevation(Ft,Ne,$e):null)}}}(M,v,T,I,T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),k),T.paint.get("icon-opacity").constantOr(1)!==0&&hh(v,I,T,M,!1,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),T.layout.get("icon-rotation-alignment"),T.layout.get("icon-pitch-alignment"),T.layout.get("icon-keep-upright"),z,F),T.paint.get("text-opacity").constantOr(1)!==0&&hh(v,I,T,M,!0,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),T.layout.get("text-rotation-alignment"),T.layout.get("text-pitch-alignment"),T.layout.get("text-keep-upright"),z,F),I.map.showCollisionBoxes&&(lh(v,I,T,M,T.paint.get("text-translate"),T.paint.get("text-translate-anchor"),!0),lh(v,I,T,M,T.paint.get("icon-translate"),T.paint.get("icon-translate-anchor"),!1))})(s,f,d,m,this.style.placement.variableOffsets);break;case"circle":(function(v,I,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("circle-opacity"),z=T.paint.get("circle-stroke-width"),F=T.paint.get("circle-stroke-opacity"),W=!T.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const st=v.context,ot=st.gl,ct=v.depthModeForSublayer(0,bn.ReadOnly),tt=Jn.disabled,_t=v.colorModeForRenderPass(),kt=[];for(let ht=0;htht.sortKey-St.sortKey);for(const ht of kt){const{programConfiguration:St,program:Rt,layoutVertexBuffer:Ft,indexBuffer:Gt,uniformValues:Jt,terrainData:Kt}=ht.state;Rt.draw(st,ot.TRIANGLES,ct,tt,_t,Wn.disabled,Jt,Kt,T.id,Ft,Gt,ht.segments,T.paint,v.transform.zoom,St)}})(s,f,d,m);break;case"heatmap":(function(v,I,T,M){if(T.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const k=v.context,z=k.gl,F=Jn.disabled,W=new Nr([z.ONE,z.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(st,ot,ct){const tt=st.gl;st.activeTexture.set(tt.TEXTURE1),st.viewport.set([0,0,ot.width/4,ot.height/4]);let _t=ct.heatmapFbo;if(_t)tt.bindTexture(tt.TEXTURE_2D,_t.colorAttachment.get()),st.bindFramebuffer.set(_t.framebuffer);else{const kt=tt.createTexture();tt.bindTexture(tt.TEXTURE_2D,kt),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_WRAP_S,tt.CLAMP_TO_EDGE),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_WRAP_T,tt.CLAMP_TO_EDGE),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_MIN_FILTER,tt.LINEAR),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_MAG_FILTER,tt.LINEAR),_t=ct.heatmapFbo=st.createFramebuffer(ot.width/4,ot.height/4,!1,!1),function(ht,St,Rt,Ft){var Gt,Jt;const Kt=ht.gl,ne=(Gt=ht.HALF_FLOAT)!==null&&Gt!==void 0?Gt:Kt.UNSIGNED_BYTE,se=(Jt=ht.RGBA16F)!==null&&Jt!==void 0?Jt:Kt.RGBA;Kt.texImage2D(Kt.TEXTURE_2D,0,se,St.width/4,St.height/4,0,Kt.RGBA,ne,null),Ft.colorAttachment.set(Rt)}(st,ot,kt,_t)}})(k,v,T),k.clear({color:u.aO.transparent});for(let st=0;st{const ht=u.F();u.aN(ht,0,ct.width,ct.height,0,0,1);const St=ct.context.gl;return{u_matrix:ht,u_world:[St.drawingBufferWidth,St.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:tt.paint.get("heatmap-opacity")}})(k,z),null,z.id,k.viewportBuffer,k.quadTriangleIndexBuffer,k.viewportSegments,z.paint,k.transform.zoom)}(v,T))})(s,f,d,m);break;case"line":(function(v,I,T,M){if(v.renderPass!=="translucent")return;const k=T.paint.get("line-opacity"),z=T.paint.get("line-width");if(k.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,bn.ReadOnly),W=v.colorModeForRenderPass(),st=T.paint.get("line-dasharray"),ot=T.paint.get("line-pattern"),ct=ot.constantOr(1),tt=T.paint.get("line-gradient"),_t=T.getCrossfadeParameters(),kt=ct?"linePattern":st?"lineSDF":tt?"lineGradient":"line",ht=v.context,St=ht.gl;let Rt=!0;for(const Ft of M){const Gt=I.getTile(Ft);if(ct&&!Gt.patternsLoaded())continue;const Jt=Gt.getBucket(T);if(!Jt)continue;const Kt=Jt.programConfigurations.get(T.id),ne=v.context.program.get(),se=v.useProgram(kt,Kt),Qe=Rt||se.program!==ne,ae=v.style.map.terrain&&v.style.map.terrain.getTerrainData(Ft),Ne=ot.constantOr(null);if(Ne&&Gt.imageAtlas){const Be=Gt.imageAtlas,rn=Be.patternPositions[Ne.to.toString()],ln=Be.patternPositions[Ne.from.toString()];rn&&ln&&Kt.setConstantPatternPositions(rn,ln)}const $e=ae?Ft:null,xn=ct?_l(v,Gt,T,_t,$e):st?$c(v,Gt,T,st,_t,$e):tt?Kd(v,Gt,T,Jt.lineClipsArray.length,$e):Qc(v,Gt,T,$e);if(ct)ht.activeTexture.set(St.TEXTURE0),Gt.imageAtlasTexture.bind(St.LINEAR,St.CLAMP_TO_EDGE),Kt.updatePaintBuffers(_t);else if(st&&(Qe||v.lineAtlas.dirty))ht.activeTexture.set(St.TEXTURE0),v.lineAtlas.bind(ht);else if(tt){const Be=Jt.gradients[T.id];let rn=Be.texture;if(T.gradientVersion!==Be.version){let ln=256;if(T.stepInterpolant){const wr=I.getSource().maxzoom,Fn=Ft.canonical.z===wr?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),d=this.imageManager.getPattern(s.to.toString());return!f||!d}useProgram(s,f){this.cache=this.cache||{};const d=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Oa(this.context,Zu[s],f,Jd[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new $(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class Fa{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,d){const m=Math.pow(2,d),v=[[-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(T=>{const M=1/(T=u.af([],T,s))[3]/f*m;return u.a$(T,T,[M,M,1/T[3],M])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{const M=function(W,st){var ot=st[0],ct=st[1],tt=st[2],_t=ot*ot+ct*ct+tt*tt;return _t>0&&(_t=1/Math.sqrt(_t)),W[0]=st[0]*_t,W[1]=st[1]*_t,W[2]=st[2]*_t,W}([],function(W,st,ot){var ct=st[0],tt=st[1],_t=st[2],kt=ot[0],ht=ot[1],St=ot[2];return W[0]=tt*St-_t*ht,W[1]=_t*kt-ct*St,W[2]=ct*ht-tt*kt,W}([],rt([],v[T[0]],v[T[1]]),rt([],v[T[2]],v[T[1]]))),k=-((z=M)[0]*(F=v[T[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(k)});return new Fa(v,I)}}class Ba{constructor(s,f){this.min=s,this.max=f,this.center=function(d,m,v){return d[0]=.5*m[0],d[1]=.5*m[1],d[2]=.5*m[2],d}([],function(d,m,v){return d[0]=m[0]+v[0],d[1]=m[1]+v[1],d[2]=m[2]+v[2],d}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],d=gt(this.min),m=gt(this.max);for(let v=0;v=0&&I++;if(I===0)return 0;I!==f.length&&(d=!1)}if(d)return 2;for(let m=0;m<3;m++){let v=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let T=0;Tthis.max[m]-this.min[m])return 0}return 1}}class iu{constructor(s=0,f=0,d=0,m=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(d)||d<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=d,this.right=m}interpolate(s,f,d){return f.top!=null&&s.top!=null&&(this.top=u.z.number(s.top,f.top,d)),f.bottom!=null&&s.bottom!=null&&(this.bottom=u.z.number(s.bottom,f.bottom,d)),f.left!=null&&s.left!=null&&(this.left=u.z.number(s.left,f.left,d)),f.right!=null&&s.right!=null&&(this.right=u.z.number(s.right,f.right,d)),this}getCenter(s,f){const d=u.ac((this.left+s-this.right)/2,0,s),m=u.ac((this.top+f-this.bottom)/2,0,f);return new u.P(d,m)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new iu(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 yh{constructor(s,f,d,m,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new u.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new iu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new yh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-u.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var d=new u.A(4);return u.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,m,v){var I=m[0],T=m[1],M=m[2],k=m[3],z=Math.sin(v),F=Math.cos(v);d[0]=I*F+M*z,d[1]=T*F+k*z,d[2]=I*-z+M*F,d[3]=T*-z+k*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=u.ac(s,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(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,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(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,d){this._unmodified=!1,this._edgeInsets.interpolate(s,f,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new u.b2(0,s)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),m=this.pointCoordinate(new u.P(this.width,0)),v=this.pointCoordinate(new u.P(this.width,this.height)),I=this.pointCoordinate(new u.P(0,this.height)),T=Math.floor(Math.min(d.x,m.x,v.x,I.x)),M=Math.floor(Math.max(d.x,m.x,v.x,I.x)),k=1;for(let z=T-k;z<=M+k;z++)z!==0&&f.push(new u.b2(z,s))}return f}coveringTiles(s){var f,d;let m=this.coveringZoomLevel(s);const v=m;if(s.minzoom!==void 0&&ms.maxzoom&&(m=s.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),T=u.Y.fromLngLat(this.center),M=Math.pow(2,m),k=[M*I.x,M*I.y,0],z=[M*T.x,M*T.y,0],F=Fa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,m);let W=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(W=m);const st=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,ot=ht=>({aabb:new Ba([ht*M,0,0],[(ht+1)*M,M,0]),zoom:0,x:0,y:0,wrap:ht,fullyVisible:!1}),ct=[],tt=[],_t=m,kt=s.reparseOverscaled?v:m;if(this._renderWorldCopies)for(let ht=1;ht<=3;ht++)ct.push(ot(-ht)),ct.push(ot(ht));for(ct.push(ot(0));ct.length>0;){const ht=ct.pop(),St=ht.x,Rt=ht.y;let Ft=ht.fullyVisible;if(!Ft){const se=ht.aabb.intersects(F);if(se===0)continue;Ft=se===2}const Gt=s.terrain?k:z,Jt=ht.aabb.distanceX(Gt),Kt=ht.aabb.distanceY(Gt),ne=Math.max(Math.abs(Jt),Math.abs(Kt));if(ht.zoom===_t||ne>st+(1<<_t-ht.zoom)-2&&ht.zoom>=W){const se=_t-ht.zoom,Qe=k[0]-.5-(St<>1),Ne=ht.zoom+1;let $e=ht.aabb.quadrant(se);if(s.terrain){const xn=new u.Q(Ne,ht.wrap,Ne,Qe,ae),Be=s.terrain.getMinMaxElevation(xn),rn=(f=Be.minElevation)!==null&&f!==void 0?f:this.elevation,ln=(d=Be.maxElevation)!==null&&d!==void 0?d:this.elevation;$e=new Ba([$e.min[0],$e.min[1],rn],[$e.max[0],$e.max[1],ln])}ct.push({aabb:$e,zoom:Ne,x:Qe,y:ae,wrap:ht.wrap,fullyVisible:Ft})}}return tt.sort((ht,St)=>ht.distanceSq-St.distanceSq).map(ht=>ht.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=u.ac(s.lat,-85.051129,rp);return new u.P(u.N(s.lng)*this.worldSize,u.O(f)*this.worldSize)}unproject(s){return new u.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,d=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-v))return;const I=d+f-v,T=Math.cos(this._pitch)*this.cameraToCenterDistance/I/u.b3(1,m.lat),M=this.scaleZoom(T/this.tileSize);this._elevation=v,this._center=m,this.zoom=M}setLocationAtPoint(s,f){const d=this.pointCoordinate(f),m=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),I=new u.Y(v.x-(d.x-m.x),v.y-(d.y-m.y));this.center=this.coordinateLocation(I),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return u.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const W=f.pointCoordinate(s);if(W!=null)return W}const d=[s.x,s.y,0,1],m=[s.x,s.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(m,m,this.pixelMatrixInverse);const v=d[3],I=m[3],T=d[1]/v,M=m[1]/I,k=d[2]/v,z=m[2]/I,F=k===z?0:(0-k)/(z-k);return new u.Y(u.z.number(d[0]/v,m[0]/I,F)/this.worldSize,u.z.number(T,M,F)/this.worldSize)}coordinatePoint(s,f=0,d=this.pixelMatrix){const m=[s.x*this.worldSize,s.y*this.worldSize,f,1];return u.af(m,m,d),new u.P(m[0]/m[3],m[1]/m[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new xt().extend(this.pointLocation(new u.P(0,s))).extend(this.pointLocation(new u.P(this.width,s))).extend(this.pointLocation(new u.P(this.width,this.height))).extend(this.pointLocation(new u.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new xt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,rp])}calculatePosMatrix(s,f=!1){const d=s.key,m=f?this._alignedPosMatrixCache:this._posMatrixCache;if(m[d])return m[d];const v=s.canonical,I=this.worldSize/this.zoomScale(v.z),T=v.x+Math.pow(2,v.z)*s.wrap,M=u.an(new Float64Array(16));return u.H(M,M,[T*I,v.y*I,0]),u.J(M,M,[I/u.W,I/u.W,1]),u.K(M,f?this.alignedProjMatrix:this.projMatrix,M),m[d]=new Float32Array(M),m[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=u.ac(+f,this.minZoom,this.maxZoom);const d={center:new u.M(s.lng,s.lat),zoom:f};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const ht=179.9999999999;m=[-ht,ht]}const v=this.tileSize*this.zoomScale(d.zoom);let I=0,T=v,M=0,k=v,z=0,F=0;const{x:W,y:st}=this.size;if(this.latRange){const ht=this.latRange;I=u.O(ht[1])*v,T=u.O(ht[0])*v,T-IT&&(_t=T-ht)}if(m){const ht=(M+k)/2;let St=ot;this._renderWorldCopies&&(St=u.b1(ot,ht-v/2,ht+v/2));const Rt=W/2;St-Rtk&&(tt=k-Rt)}if(tt!==void 0||_t!==void 0){const ht=new u.P(tt??ot,_t??ct);d.center=this.unproject.call({worldSize:v},ht).wrap()}return d}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:d}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=d,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b3(1,this.center.lat)*this.worldSize;let m=u.an(new Float64Array(16));u.J(m,m,[this.width/2,-this.height/2,1]),u.H(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=u.an(new Float64Array(16)),u.J(m,m,[1,-1,1]),u.H(m,m,[-1,-1,0]),u.J(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),I=Math.min(this.elevation,this.minElevationForCurrentTile),T=v-I*this._pixelPerMeter/Math.cos(this._pitch),M=I<0?T:v,k=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(u.ac(Math.PI-k-z,.01,Math.PI-.01)),W=this.getHorizon(),st=2*Math.atan(W/this.cameraToCenterDistance)*(.5+s.y/(2*W)),ot=Math.sin(st)*M/Math.sin(u.ac(Math.PI-k-st,.01,Math.PI-.01)),ct=Math.min(F,ot),tt=1.01*(Math.cos(Math.PI/2-this._pitch)*ct+M),_t=this.height/50;m=new Float64Array(16),u.b4(m,this._fov,this.width/this.height,_t,tt),m[8]=2*-s.x/this.width,m[9]=2*s.y/this.height,u.J(m,m,[1,-1,1]),u.H(m,m,[0,0,-this.cameraToCenterDistance]),u.b5(m,m,this._pitch),u.ad(m,m,this.angle),u.H(m,m,[-f,-d,0]),this.mercatorMatrix=u.J([],m,[this.worldSize,this.worldSize,this.worldSize]),u.J(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,m),u.H(m,m,[0,0,-this.elevation]),this.projMatrix=m,this.invProjMatrix=u.ar([],m),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,m);const kt=this.width%2/2,ht=this.height%2/2,St=Math.cos(this.angle),Rt=Math.sin(this.angle),Ft=f-Math.round(f)+St*kt+Rt*ht,Gt=d-Math.round(d)+St*ht+Rt*kt,Jt=new Float64Array(m);if(u.H(Jt,Jt,[Ft>.5?Ft-1:Ft,Gt>.5?Gt-1:Gt,0]),this.alignedProjMatrix=Jt,m=u.ar(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new u.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return u.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let d=f.x,m=f.y,v=f.x,I=f.y;for(const T of s)d=Math.min(d,T.x),m=Math.min(m,T.y),v=Math.max(v,T.x),I=Math.max(I,T.y);return[new u.P(d,m),new u.P(v,m),new u.P(v,I),new u.P(d,I),new u.P(d,m)]}}lngLatToCameraDepth(s,f){const d=this.locationCoordinate(s),m=[d.x*this.worldSize,d.y*this.worldSize,f,1];return u.af(m,m,this.projMatrix),m[2]/m[3]}}function ip(_,s){let f,d=!1,m=null,v=null;const I=()=>{m=null,d&&(_.apply(v,f),m=setTimeout(I,s),d=!1)};return(...T)=>(d=!0,v=this,f=T,m||I(),m)}class op{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let d;return f.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(d=m)}),(d&&d[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(d=>isNaN(d))){const d=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:d,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=ip(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,m=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,m),I=Math.round(f.lng*v)/v,T=Math.round(f.lat*v)/v,M=this._map.getBearing(),k=this._map.getPitch();let z="";if(z+=s?`/${I}/${T}/${d}`:`${d}/${T}/${I}`,(M||k)&&(z+="/"+Math.round(10*M)/10),k&&(z+=`/${Math.round(k)}`),this._hashName){const F=this._hashName;let W=!1;const st=window.location.hash.slice(1).split("&").map(ot=>{const ct=ot.split("=")[0];return ct===F?(W=!0,`${ct}=${z}`):ot}).filter(ot=>ot);return W||st.push(`${F}=${z}`),`#${st.join("&")}`}return`#${z}`}}const ec={linearity:.3,easing:u.b6(0,0,.3,1)},wl=u.e({deceleration:2500,maxSpeed:1400},ec),fm=u.e({deceleration:20,maxSpeed:1400},ec),pm=u.e({deceleration:1e3,maxSpeed:360},ec),dm=u.e({deceleration:1e3,maxSpeed:90},ec);class mm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:C.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=C.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(f.pan.mag()){const v=rc(f.pan.mag(),d,u.e({},wl,s||{}));m.offset=f.pan.mult(v.amount/f.pan.mag()),m.center=this._map.transform.center,nc(m,v)}if(f.zoom){const v=rc(f.zoom,d,fm);m.zoom=this._map.transform.zoom+v.amount,nc(m,v)}if(f.bearing){const v=rc(f.bearing,d,pm);m.bearing=this._map.transform.bearing+u.ac(v.amount,-179,179),nc(m,v)}if(f.pitch){const v=rc(f.pitch,d,dm);m.pitch=this._map.transform.pitch+v.amount,nc(m,v)}if(m.zoom||m.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;m.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),u.e(m,{noMoveStart:!0})}}function nc(_,s){(!_.duration||_.durationf.unproject(M)),T=v.reduce((M,k,z,F)=>M.add(k.div(F.length)),new u.P(0,0));super(s,{points:v,point:T,lngLats:I,lngLat:f.unproject(T),originalEvent:d}),this._defaultPrevented=!1}}class sp extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,d){super(s,{originalEvent:d}),this._defaultPrevented=!1}}class cs{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new sp(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new co(s.type,this._map,s))}mouseup(s){this._map.fire(new co(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new co(s.type,this._map,s))}dblclick(s){return this._firePreventable(new co(s.type,this._map,s))}mouseover(s){this._map.fire(new co(s.type,this._map,s))}mouseout(s){this._map.fire(new co(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Ns(s.type,this._map,s))}touchmove(s){this._map.fire(new Ns(s.type,this._map,s))}touchend(s){this._map.fire(new Ns(s.type,this._map,s))}touchcancel(s){this._map.fire(new Ns(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Os{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new co(s.type,this._map,s))}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(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new co(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ou{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(u.P.convert(s),this._map.terrain)}}class hs{constructor(s,f){this._map=s,this._tr=new ou(s),this._el=s.getCanvasContainer(),this._container=s.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(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(P.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const d=f;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)v.fitScreenCoordinates(d,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(P.remove(this._box),this._box=null),P.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new u.k(s,{originalEvent:f}))}}function Sl(_,s){if(_.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${s.length}`);const f={};for(let d=0;d<_.length;d++)f[_[d].identifier]=s[d];return f}class Fy{constructor(s){this.reset(),this.numTouches=s.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(s,f,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),d.length===this.numTouches&&(this.centroid=function(m){const v=new u.P(0,0);for(const I of m)v._add(I);return v.div(m.length)}(f),this.touches=Sl(d,f)))}touchmove(s,f,d){if(this.aborted||!this.centroid)return;const m=Sl(d,f);for(const v in this.touches){const I=m[v];(!I||I.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,d){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class ap{constructor(s){this.singleTap=new Fy(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,d){this.singleTap.touchstart(s,f,d)}touchmove(s,f,d){this.singleTap.touchmove(s,f,d)}touchend(s,f,d){const m=this.singleTap.touchend(s,f,d);if(m){const v=s.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(m)<30;if(v&&I||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class By{constructor(s){this._tr=new ou(s),this._zoomIn=new ap({numTouches:1,numTaps:2}),this._zoomOut=new ap({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,d){this._zoomIn.touchstart(s,f,d),this._zoomOut.touchstart(s,f,d)}touchmove(s,f,d){this._zoomIn.touchmove(s,f,d),this._zoomOut.touchmove(s,f,d)}touchend(s,f,d){const m=this._zoomIn.touchend(s,f,d),v=this._zoomOut.touchend(s,f,d),I=this._tr;return m?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:I.zoom+1,around:I.unproject(m)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:I.zoom-1,around:I.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class su{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const m=f.length?f[0]:f;return!this._moved&&m.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(s){s.preventDefault()}},au=({enable:_,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const d=new zs({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new su({clickTolerance:s,move:(m,v)=>({bearingDelta:(v.x-m.x)*f}),moveStateManager:d,enable:_,assignEvents:_h})},lu=({enable:_,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const d=new zs({checkCorrectEvent:m=>P.mouseButton(m)===0&&m.ctrlKey||P.mouseButton(m)===2});return new su({clickTolerance:s,move:(m,v)=>({pitchDelta:(v.y-m.y)*f}),moveStateManager:d,enable:_,assignEvents:_h})};class gm{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,d){return this._calculateTransform(s,f,d)}touchmove(s,f,d){if(this._active&&!(d.length0&&(this._active=!0);const m=Sl(d,f),v=new u.P(0,0),I=new u.P(0,0);let T=0;for(const k in m){const z=m[k],F=this._touches[k];F&&(v._add(z),I._add(z.sub(F)),T++,m[k]=z)}if(this._touches=m,TMath.abs(_.x)}class vm extends pe{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,d){super.touchstart(s,f,d),this._currentTouchCount=d.length}_start(s){this._lastPoints=s,bh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,v,d.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(m.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,d){if(this._valid!==void 0)return this._valid;const m=s.mag()>=2,v=f.mag()>=2;if(!m&&!v)return;if(!m||!v)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const I=s.y>0==f.y>0;return bh(s)&&bh(f)&&I}}const Vy={panStep:100,bearingStep:15,pitchStep:10};class Va{constructor(s){this._tr=new ou(s);const f=Vy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,d=0,m=0,v=0,I=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?d=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?d=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?m=1:(s.preventDefault(),I=-1);break;case 40:s.shiftKey?m=-1:(s.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(d=0,m=0),{cameraAnimation:T=>{const M=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:rr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+d*this._bearingStep,pitch:M.pitch+m*this._pitchStep,offset:[-v*this._panStep,-I*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function rr(_){return _*(2-_)}const oc=4.000244140625;class xh{constructor(s,f){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=s,this._tr=new ou(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const d=C.now(),m=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,f!==0&&f%oc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(m*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const f=P.mousePos(this._map.getCanvas(),s),d=this._tr;this._around=f.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(f)):u.M.convert(d.center),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>oc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);const k=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(k*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,d=this._startZoom,m=this._easing;let v,I=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((C.now()-this._lastWheelEventTime)/200,1),M=m(T);v=u.z.number(d,f,M),T<1?this._frameId||(this._frameId=!0):I=!0}else v=f,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=u.b7;if(this._prevEase){const d=this._prevEase,m=(C.now()-d.start)/d.duration,v=d.easing(m+.01)-d.easing(m),I=.27/Math.sqrt(v*v+1e-4)*.01,T=Math.sqrt(.0729-I*I);f=u.b6(I,T,.25,1)}return this._prevEase={start:C.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class up{constructor(s,f){this._clickZoom=s,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 bm{constructor(s){this._tr=new ou(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xm{constructor(){this._tap=new ap({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,d){if(!this._swipePoint)if(this._tapTime){const m=f[0],v=s.timeStamp-this._tapTime<500,I=this._tapPoint.dist(m)<30;v&&I?d.length>0&&(this._swipePoint=m,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(s,f,d)}touchmove(s,f,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const m=f[0],v=m.y-this._swipePoint.y;return this._swipePoint=m,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,d)}touchend(s,f,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const m=this._tap.touchend(s,f,d);m&&(this._tapTime=s.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wm{constructor(s,f,d){this._el=s,this._mousePan=f,this._touchPan=d}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class fs{constructor(s,f,d){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class sc{constructor(s,f,d,m){this._el=s,this._touchZoom=f,this._touchRotate=d,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Te{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=P.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=f,this._container.appendChild(m);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=d,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(P.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(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const De=_=>_.zoom||_.drag||_.pitch||_.rotate;class wh extends u.k{}function ac(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class cp{constructor(s,f){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,v)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const I=m.type==="renderFrame"?void 0:m,T={needsRenderFrame:!1},M={},k={},z=m.touches,F=z?this._getMapTouches(z):void 0,W=F?P.touchPos(this._map.getCanvas(),F):P.mousePos(this._map.getCanvas(),m);for(const{handlerName:ct,handler:tt,allowed:_t}of this._handlers){if(!tt.isEnabled())continue;let kt;this._blockedByActive(k,_t,ct)?tt.reset():tt[v||m.type]&&(kt=tt[v||m.type](m,W,F),this.mergeHandlerResult(T,M,kt,ct,I),kt&&kt.needsRenderFrame&&this._triggerRenderFrame()),(kt||tt.isActive())&&(k[ct]=tt)}const st={};for(const ct in this._previousActiveHandlers)k[ct]||(st[ct]=I);this._previousActiveHandlers=k,(Object.keys(st).length||ac(T))&&(this._changes.push([T,M,st]),this._triggerRenderFrame()),(Object.keys(k).length||ac(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ot}=T;ot&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ot(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,v,I]of this._listeners)P.addEventListener(m,v,m===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[s,f,d]of this._listeners)P.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(s){const f=this._map,d=f.getCanvasContainer();this._add("mapEvent",new cs(f,s));const m=f.boxZoom=new hs(f,s);this._add("boxZoom",m),s.interactive&&s.boxZoom&&m.enable();const v=f.cooperativeGestures=new Te(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const I=new By(f),T=new bm(f);f.doubleClickZoom=new up(T,I),this._add("tapZoom",I),this._add("clickZoom",T),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new xm;this._add("tapDragZoom",M);const k=f.touchPitch=new vm(f);this._add("touchPitch",k),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=au(s),F=lu(s);f.dragRotate=new fs(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const W=(({enable:kt,clickTolerance:ht})=>{const St=new zs({checkCorrectEvent:Rt=>P.mouseButton(Rt)===0&&!Rt.ctrlKey});return new su({clickTolerance:ht,move:(Rt,Ft)=>({around:Ft,panDelta:Ft.sub(Rt)}),activateOnStart:!0,moveStateManager:St,enable:kt,assignEvents:_h})})(s),st=new gm(s,f);f.dragPan=new wm(d,W,st),this._add("mousePan",W),this._add("touchPan",st,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const ot=new lp,ct=new _m;f.touchZoomRotate=new sc(d,ct,ot,M),this._add("touchRotate",ot,["touchPan","touchZoom"]),this._add("touchZoom",ct,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const tt=f.scrollZoom=new xh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",tt,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const _t=f.keyboard=new Va(f);this._add("keyboard",_t),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Os(f))}_add(s,f,d){this._handlers.push({handlerName:s,handler:f,allowed:d}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!De(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,d){for(const m in s)if(m!==d&&(!f||f.indexOf(m)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const d of s)this._el.contains(d.target)&&f.push(d);return f}mergeHandlerResult(s,f,d,m,v){if(!d)return;u.e(s,d);const I={handlerName:m,originalEvent:d.originalEvent||v};d.zoomDelta!==void 0&&(f.zoom=I),d.panDelta!==void 0&&(f.drag=I),d.pitchDelta!==void 0&&(f.pitch=I),d.bearingDelta!==void 0&&(f.rotate=I)}_applyChanges(){const s={},f={},d={};for(const[m,v,I]of this._changes)m.panDelta&&(s.panDelta=(s.panDelta||new u.P(0,0))._add(m.panDelta)),m.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(s.around=m.around),m.pinchAround!==void 0&&(s.pinchAround=m.pinchAround),m.noInertia&&(s.noInertia=m.noInertia),u.e(f,v),u.e(d,I);this._updateMapTransform(s,f,d),this._changes=[]}_updateMapTransform(s,f,d){const m=this._map,v=m._getTransformForUpdate(),I=m.terrain;if(!(ac(s)||I&&this._terrainMovement))return this._fireEvents(f,d,!0);let{panDelta:T,zoomDelta:M,bearingDelta:k,pitchDelta:z,around:F,pinchAround:W}=s;W!==void 0&&(F=W),m._stop(!0),F=F||m.transform.centerPoint;const st=v.pointLocation(T?F.sub(T):F);k&&(v.bearing+=k),z&&(v.pitch+=z),M&&(v.zoom+=M),I?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(T)):v.setLocationAtPoint(st,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(st,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(m.terrain)})):v.setLocationAtPoint(st,F),m._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,d,!0)}_fireEvents(s,f,d){const m=De(this._eventsInProgress),v=De(s),I={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(I[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!m&&v&&this._fireEvent("movestart",v.originalEvent);for(const z in I)this._fireEvent(z,I[z]);v&&this._fireEvent("move",v.originalEvent);for(const z in s){const{originalEvent:F}=s[z];this._fireEvent(z,F)}const T={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:W}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||W,T[`${z}end`]=M)}for(const z in T)this._fireEvent(z,T[z]);const k=De(this._eventsInProgress);if(d&&(m||v)&&!k){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=W=>W!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new wh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ho extends u.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const d=Math.min((C.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,d){return s=u.P.convert(s).mult(-1),this.panTo(this.transform.center,u.e({offset:s},f),d)}panTo(s,f,d){return this.easeTo(u.e({center:s},f),d)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,d){return this.easeTo(u.e({zoom:s},f),d)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,d){return this.easeTo(u.e({bearing:s},f),d)}resetNorth(s,f){return this.rotateTo(0,u.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=u.z.number(v,tt,Gt)),this._rotating&&(m.bearing=u.z.number(I,k,Gt)),this._pitching&&(m.pitch=u.z.number(T,z,Gt)),this._padding&&(m.interpolatePadding(M,F,Gt),st=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(Gt),St)m.setLocationAtPoint(St,Rt);else{const Jt=m.zoomScale(m.zoom-v),Kt=tt>v?Math.min(2,ht):Math.max(.5,ht),ne=Math.pow(Kt,1-Gt),se=m.unproject(_t.add(kt.mult(Gt*ne)).mult(Jt));m.setLocationAtPoint(m.renderWorldCopies?se.wrap():se,st)}this._applyUpdatedTransform(m),this._fireMoveEvents(f)},Gt=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Gt)},s),this}_prepareEase(s,f,d={}){this._moving=!0,f||d.moving||this.fire(new u.k("movestart",s)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",s)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",s)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(d-(f-(d*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:d,zoom:m,pitch:v,bearing:I,elevation:T}=this.transformCameraUpdate(f);d&&(f.center=d),m!==void 0&&(f.zoom=m),v!==void 0&&(f.pitch=v),I!==void 0&&(f.bearing=I),T!==void 0&&(f.elevation=T),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new u.k("move",s)),this._zooming&&this.fire(new u.k("zoom",s)),this._rotating&&this.fire(new u.k("rotate",s)),this._pitching&&this.fire(new u.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const d=this._zooming,m=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",s)),m&&this.fire(new u.k("rotateend",s)),v&&this.fire(new u.k("pitchend",s)),this.fire(new u.k("moveend",s))}flyTo(s,f){var d;if(!s.essential&&C.prefersReducedMotion){const xn=u.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(xn,f)}this.stop(),s=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b7},s);const m=this._getTransformForUpdate(),v=this.getZoom(),I=this.getBearing(),T=this.getPitch(),M=this.getPadding(),k="bearing"in s?this._normalizeBearing(s.bearing,I):I,z="pitch"in s?+s.pitch:T,F="padding"in s?s.padding:m.padding,W=u.P.convert(s.offset);let st=m.centerPoint.add(W);const ot=m.pointLocation(st),{center:ct,zoom:tt}=m.getConstrained(u.M.convert(s.center||ot),(d=s.zoom)!==null&&d!==void 0?d:v);this._normalizeCenter(ct);const _t=m.zoomScale(tt-v),kt=m.project(ot),ht=m.project(ct).sub(kt);let St=s.curve;const Rt=Math.max(m.width,m.height),Ft=Rt/_t,Gt=ht.mag();if("minZoom"in s){const xn=u.ac(Math.min(s.minZoom,v,tt),m.minZoom,m.maxZoom),Be=Rt/m.zoomScale(xn-v);St=Math.sqrt(Be/Gt*2)}const Jt=St*St;function Kt(xn){const Be=(Ft*Ft-Rt*Rt+(xn?-1:1)*Jt*Jt*Gt*Gt)/(2*(xn?Ft:Rt)*Jt*Gt);return Math.log(Math.sqrt(Be*Be+1)-Be)}function ne(xn){return(Math.exp(xn)-Math.exp(-xn))/2}function se(xn){return(Math.exp(xn)+Math.exp(-xn))/2}const Qe=Kt(!1);let ae=function(xn){return se(Qe)/se(Qe+St*xn)},Ne=function(xn){return Rt*((se(Qe)*(ne(Be=Qe+St*xn)/se(Be))-ne(Qe))/Jt)/Gt;var Be},$e=(Kt(!0)-Qe)/St;if(Math.abs(Gt)<1e-6||!isFinite($e)){if(Math.abs(Rt-Ft)<1e-6)return this.easeTo(s,f);const xn=Fts.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=I!==k,this._pitching=z!==T,this._padding=!m.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(ct),this._ease(xn=>{const Be=xn*$e,rn=1/ae(Be);m.zoom=xn===1?tt:v+m.scaleZoom(rn),this._rotating&&(m.bearing=u.z.number(I,k,xn)),this._pitching&&(m.pitch=u.z.number(T,z,xn)),this._padding&&(m.interpolatePadding(M,F,xn),st=m.centerPoint.add(W)),this.terrain&&!s.freezeElevation&&this._updateElevation(xn);const ln=xn===1?ct:m.unproject(kt.add(ht.mult(Ne(Be))).mult(rn));m.setLocationAtPoint(m.renderWorldCopies?ln.wrap():ln,st),this._applyUpdatedTransform(m),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,f)}if(!s){const d=this.handlers;d&&d.stop(!1)}return this}_ease(s,f,d){d.animate===!1||d.duration===0?(s(1),f()):(this._easeStart=C.now(),this._easeOptions=d,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=u.b1(s,-180,180);const d=Math.abs(s-f);return Math.abs(s-360-f)180?-360:d<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const hp={compact:!0,customAttribution:'MapLibre'};class ps{constructor(s=hp){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=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=P.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=P.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=P.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(){P.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const d=this._map._getUIString(`AttributionControl.${f}`);s.title=d,s.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const f=this._map.style.sourceCaches;for(const m in f){const v=f[m];if(v.used||v.usedForTerrain){const I=v.getSource();I.attribution&&s.indexOf(I.attribution)<0&&s.push(I.attribution)}}s=s.filter(m=>String(m).trim()),s.sort((m,v)=>m.length-v.length),s=s.filter((m,v)=>{for(let I=v+1;I=0)return!1;return!0});const d=s.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,s.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Sm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const d=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=P.create("div","maplibregl-ctrl");const f=P.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(){P.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class lc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,d=f?this._queue.concat(f):this._queue;for(const m of d)if(m.id===s)return void(m.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const d of f)if(!d.cancelled&&(d.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var xr=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class Or extends u.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const d={};for(const m of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))d[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),u.aN(m.posMatrix,0,u.W,0,u.W,0,1),this._tiles[m.key]=new Ho(m,this.tileSize));for(const m in this._tiles)d[m]||delete this._tiles[m]}freeRtt(s){for(const f in this._tiles){const d=this._tiles[f];(!s||d.tileID.equals(s)||d.tileID.isChildOf(s)||s.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(m.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),u.aN(v.posMatrix,0,u.W,0,u.W,0,1),f[d]=v}else if(m.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const I=m.canonical.z-s.canonical.z,T=m.canonical.x-(m.canonical.x>>I<>I<>I;u.aN(v.posMatrix,0,k,0,k,0,1),u.H(v.posMatrix,v.posMatrix,[-T*k,-M*k,0]),f[d]=v}else if(s.canonical.isChildOf(m.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const I=s.canonical.z-m.canonical.z,T=s.canonical.x-(s.canonical.x>>I<>I<>I;u.aN(v.posMatrix,0,u.W,0,u.W,0,1),u.H(v.posMatrix,v.posMatrix,[T*k,M*k,0]),u.J(v.posMatrix,v.posMatrix,[1/2**I,1/2**I,0]),f[d]=v}}return f}getSourceTile(s,f){const d=this.sourceCache._source;let m=s.overscaledZ-this.deltaZoom;if(m>d.maxzoom&&(m=d.maxzoom),m=d.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(m--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class Em{constructor(s,f,d){this.painter=s,this.sourceCache=new Or(f),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,d,m=u.W){var v;if(!(f>=0&&f=0&&ds.canonical.z&&(s.canonical.z>=m?v=s.canonical.z-m:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[I+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),m=new $(s,d,s.gl.RGBA,{premultiply:!1});return m.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),d=this.painter.context,m=d.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),I=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(v,T-I-1,1,1,m.RGBA,m.UNSIGNED_BYTE,f),d.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),k=f[1]+((15&f[2])<<8),z=this.coordsIndex[255-f[3]],F=z&&this.sourceCache.getTileByID(z);if(!F)return null;const W=this._coordsTextureSize,st=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.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 s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const fa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class fp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new uc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(d=>!s._layers[d].isHidden(f)),this._coordsDescendingInv={};for(const d in s.sourceCaches){this._coordsDescendingInv[d]={};const m=s.sourceCaches[d].getVisibleCoordinates();for(const v of m){const I=this.terrain.sourceCache.getTerrainCoords(v);for(const T in I)this._coordsDescendingInv[d][T]||(this._coordsDescendingInv[d][T]=[]),this._coordsDescendingInv[d][T].push(I[T])}}this._coordsDescendingInvStr={};for(const d of s._order){const m=s._layers[d],v=m.source;if(fa[m.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const I in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][I]=this._coordsDescendingInv[v][I].map(T=>T.key).sort().join()}}for(const d of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[m][d.tileID.key];v&&v!==d.rttCoords[m]&&(d.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,d=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(fa[f]&&(this._prevType&&fa[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!m))return!0;if(fa[this._prevType]||fa[f]&&m){this._prevType=f;const v=this._stacks.length-1,I=this._stacks[v]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(gh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[v]){const k=this.pool.getObjectForId(T.rtt[v].id);if(k.stamp===T.rtt[v].stamp){this.pool.useObject(k);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[v]={id:M.id,stamp:M.stamp},d.context.bindFramebuffer.set(M.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let k=0;k{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},mp={showCompass:!0,showZoom:!0,visualizePitch:!1};class gp{constructor(s,f,d=!1){this.mousedown=I=>{this.startMouse(u.e({},I,{ctrlKey:!0,preventDefault:()=>I.preventDefault()}),P.mousePos(this.element,I)),P.addEventListener(window,"mousemove",this.mousemove),P.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=I=>{this.moveMouse(I,P.mousePos(this.element,I))},this.mouseup=I=>{this.mouseRotate.dragEnd(I),this.mousePitch&&this.mousePitch.dragEnd(I),this.offTemp()},this.touchstart=I=>{I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=P.touchPos(this.element,I.targetTouches)[0],this.startTouch(I,this._startPos),P.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.addEventListener(window,"touchend",this.touchend))},this.touchmove=I=>{I.targetTouches.length!==1?this.reset():(this._lastPos=P.touchPos(this.element,I.targetTouches)[0],this.moveTouch(I,this._lastPos))},this.touchend=I=>{I.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const m=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=au({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:I,clickTolerance:T,bearingDegreesPerPixelMoved:M=.8})=>{const k=new _e;return new su({clickTolerance:T,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:k,enable:I,assignEvents:Sh})})({clickTolerance:m,enable:!0}),this.map=s,d&&(this.mousePitch=lu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:I,clickTolerance:T,pitchDegreesPerPixelMoved:M=-.5})=>{const k=new _e;return new su({clickTolerance:T,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:k,enable:I,assignEvents:Sh})})({clickTolerance:v,enable:!0})),P.addEventListener(f,"mousedown",this.mousedown),P.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),P.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),P.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),P.disableDrag()}moveMouse(s,f){const d=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}moveTouch(s,f){const d=this.map,{bearingDelta:m}=this.touchRotate.dragMove(s,f)||{};if(m&&d.setBearing(d.getBearing()+m),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&d.setPitch(d.getPitch()+v)}}off(){const s=this.element;P.removeEventListener(s,"mousedown",this.mousedown),P.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend),P.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){P.enableDrag(),P.removeEventListener(window,"mousemove",this.mousemove),P.removeEventListener(window,"mouseup",this.mouseup),P.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),P.removeEventListener(window,"touchend",this.touchend)}}let pa;function Eh(_,s,f){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),s){const m=new u.M(_.lng-360,_.lat),v=new u.M(_.lng+360,_.lat),I=f.locationPoint(_).distSqr(s);f.locationPoint(m).distSqr(s)180;){const m=f.locationPoint(_);if(m.x>=0&&m.y>=0&&m.x<=f.width&&m.y<=f.height)break;_.lng>f.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&f.locationPoint(_).y>f.height/2-f.getHorizon()?_:d}const hc={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 Ih(_,s,f){const d=_.classList;for(const m in hc)d.remove(`maplibregl-${f}-anchor-${m}`);d.add(`maplibregl-${f}-anchor-${s}`)}class fc extends u.E{constructor(s){if(super(),this._onKeyPress=f=>{const d=f.code,m=f.charCode||f.keyCode;d!=="Space"&&d!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=f=>{const d=f.originalEvent.target,m=this._element;this._popup&&(d===m||m.contains(d))&&this.togglePopup()},this._update=f=>{var d;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Eh(this._lngLat,this._flatPos,this._map.transform):(d=this._lngLat)===null||d===void 0?void 0:d.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 v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let I="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?I="rotateX(0deg)":this._pitchAlignment==="map"&&(I=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),P.setTransform(this._element,`${hc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${I} ${v}`),C.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=d}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 u.k("dragstart"))),this.fire(new u.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 u.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=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=u.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=P.create("div"),this._element.setAttribute("aria-label","Map marker");const f=P.createNS("http://www.w3.org/2000/svg","svg"),d=41,m=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${d}px`),f.setAttributeNS(null,"width",`${m}px`),f.setAttributeNS(null,"viewBox",`0 0 ${m} ${d}`);const v=P.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const I=P.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill-rule","nonzero");const T=P.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const _t of M){const kt=P.createNS("http://www.w3.org/2000/svg","ellipse");kt.setAttributeNS(null,"opacity","0.04"),kt.setAttributeNS(null,"cx","10.5"),kt.setAttributeNS(null,"cy","5.80029008"),kt.setAttributeNS(null,"rx",_t.rx),kt.setAttributeNS(null,"ry",_t.ry),T.appendChild(kt)}const k=P.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);const z=P.createNS("http://www.w3.org/2000/svg","path");z.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"),k.appendChild(z);const F=P.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const W=P.createNS("http://www.w3.org/2000/svg","path");W.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(W);const st=P.createNS("http://www.w3.org/2000/svg","g");st.setAttributeNS(null,"transform","translate(6.0, 7.0)"),st.setAttributeNS(null,"fill","#FFFFFF");const ot=P.createNS("http://www.w3.org/2000/svg","g");ot.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ct=P.createNS("http://www.w3.org/2000/svg","circle");ct.setAttributeNS(null,"fill","#000000"),ct.setAttributeNS(null,"opacity","0.25"),ct.setAttributeNS(null,"cx","5.5"),ct.setAttributeNS(null,"cy","5.5"),ct.setAttributeNS(null,"r","5.4999962");const tt=P.createNS("http://www.w3.org/2000/svg","circle");tt.setAttributeNS(null,"fill","#FFFFFF"),tt.setAttributeNS(null,"cx","5.5"),tt.setAttributeNS(null,"cy","5.5"),tt.setAttributeNS(null,"r","5.4999962"),ot.appendChild(ct),ot.appendChild(tt),I.appendChild(T),I.appendChild(k),I.appendChild(F),I.appendChild(st),I.appendChild(ot),f.appendChild(I),f.setAttributeNS(null,"height",d*this._scale+"px"),f.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(f),this._offset=u.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Ih(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),P.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=u.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const m=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,d;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(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,v=m.terrain.depthAtPoint(this._pos),I=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,I)-v<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/m.transform._pixelPerMeter,M=Math.sin(m.getPitch()*Math.PI/180)*T,k=m.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),z=m.transform.lngLatToCameraDepth(this._lngLat,I+M)-k>.006;!((d=this._popup)===null||d===void 0)&&d.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=u.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Ch={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let cu=0,El=!1;const Th={maxWidth:100,unit:"metric"};function Lh(_,s,f){const d=f&&f.maxWidth||100,m=_._container.clientHeight/2,v=_.unproject([0,m]),I=_.unproject([d,m]),T=v.distanceTo(I);if(f&&f.unit==="imperial"){const M=3.2808*T;M>5280?Il(s,d,M/5280,_._getUIString("ScaleControl.Miles")):Il(s,d,M,_._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Il(s,d,T/1852,_._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Il(s,d,T/1e3,_._getUIString("ScaleControl.Kilometers")):Il(s,d,T,_._getUIString("ScaleControl.Meters"))}function Il(_,s,f,d){const m=function(v){const I=Math.pow(10,`${Math.floor(v)}`.length-1);let T=v/I;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:function(M){const k=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*k)/k}(T),I*T}(f);_.style.width=s*(m/f)+"px",_.innerHTML=`${m} ${d}`}const yp={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 Ph(_){if(_){if(typeof _=="number"){const s=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(s,s),"top-right":new u.P(-s,s),bottom:new u.P(0,-_),"bottom-left":new u.P(s,-s),"bottom-right":new u.P(-s,-s),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const s=u.P.convert(_);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:u.P.convert(_.center||[0,0]),top:u.P.convert(_.top||[0,0]),"top-left":u.P.convert(_["top-left"]||[0,0]),"top-right":u.P.convert(_["top-right"]||[0,0]),bottom:u.P.convert(_.bottom||[0,0]),"bottom-left":u.P.convert(_["bottom-left"]||[0,0]),"bottom-right":u.P.convert(_["bottom-right"]||[0,0]),left:u.P.convert(_.left||[0,0]),right:u.P.convert(_.right||[0,0])}}return Ph(new u.P(0,0))}const Im=y;h.AJAXError=u.be,h.Evented=u.E,h.LngLat=u.M,h.MercatorCoordinate=u.Y,h.Point=u.P,h.addProtocol=u.bf,h.config=u.a,h.removeProtocol=u.bg,h.AttributionControl=ps,h.BoxZoomHandler=hs,h.CanvasSource=ls,h.CooperativeGesturesHandler=Te,h.DoubleClickZoomHandler=up,h.DragPanHandler=wm,h.DragRotateHandler=fs,h.EdgeInsets=iu,h.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:u.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(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){P.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=P.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);P.create("span","maplibregl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.title=_}_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 u.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.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()}},h.GeoJSONSource=Tr,h.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new u.M(s.coords.longitude,s.coords.latitude),d=s.coords.accuracy,m=this._map.getBearing(),v=u.e({bearing:m},this.options.fitBoundsOptions),I=xt.fromLngLat(f,d);this._map.fitBounds(I,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new u.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&El)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=P.create("button","maplibregl-ctrl-geolocate",this._container),P.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){u.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=P.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new fc({element:this._dotElement}),this._circleElement=P.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 u.k("trackuserlocationend")))})}},this.options=u.e({},Ch,_)}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return u._(this,arguments,void 0,function*(s=!1){if(pa!==void 0&&!s)return pa;if(window.navigator.permissions===void 0)return pa=!!window.navigator.geolocation,pa;try{pa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{pa=!!window.navigator.geolocation}return pa})}().then(s=>this._setupUI(s)),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(),P.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,cu=0,El=!1}_isOutOfMapMaxBounds(_){const s=this._map.getMaxBounds(),f=_.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const _=this._map.getBounds(),s=_.getSouthEast(),f=_.getNorthEast(),d=s.distanceTo(f),m=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return u.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 u.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":cu--,El=!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 u.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 u.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 _;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),cu++,cu>1?(_={maximumAge:6e5,timeout:0},El=!0):(_=this.options.positionOptions,El=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,_)}}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)}},h.Hash=op,h.ImageSource=Hn,h.KeyboardHandler=Va,h.LngLatBounds=xt,h.LogoControl=Sm,h.Map=class extends ho{constructor(_){if(u.bc.mark(u.bd.create),(_=u.e({},cc,_)).minZoom!=null&&_.maxZoom!=null&&_.minZoom>_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new yh(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=_.interactive,this._maxTileCacheSize=_.maxTileCacheSize,this._maxTileCacheZoomLevels=_.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._crossSourceCollisions=_.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=_.collectResourceTiming,this._renderTaskQueue=new lc,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},pp,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=G.addThrottleControl(()=>this.isMoving()),this._requestManager=new H(_.transformRequest),typeof _.container=="string"){if(this._container=document.getElementById(_.container),!this._container)throw new Error(`Container '${_.container}' not found.`)}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(_.maxBounds&&this.setMaxBounds(_.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=ip(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{s?f(d):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new cp(this,_),this._hash=_.hash&&new op(typeof _.hash=="string"&&_.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch}),_.bounds&&(this.resize(),this.fitBounds(_.bounds,u.e({},_.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=_.localIdeographFontFamily,this._validateStyle=_.validateStyle,_.style&&this.setStyle(_.style,{localIdeographFontFamily:_.localIdeographFontFamily}),_.attributionControl&&this.addControl(new ps(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new Sm,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new u.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new u.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new u.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(_,s){if(s===void 0&&(s=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new u.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[s];return s.indexOf("bottom")!==-1?d.insertBefore(f,d.firstChild):d.appendChild(f),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new u.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(_);return s>-1&&this._controls.splice(s,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,s,f,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,s,f,d)}resize(_){var s;const f=this._containerDimensions(),d=f[0],m=f[1],v=this._getClampedPixelRatio(d,m);if(this._resizeCanvas(d,m,v),this.painter.resize(d,m,v),this.painter.overLimit()){const T=this.painter.context.gl;this._maxCanvasSize=[T.drawingBufferWidth,T.drawingBufferHeight];const M=this._getClampedPixelRatio(d,m);this._resizeCanvas(d,m,M),this.painter.resize(d,m,M)}this.transform.resize(d,m),(s=this._requestedCameraState)===null||s===void 0||s.resize(d,m);const I=!this._moving;return I&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),I&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,s){const{0:f,1:d}=this._maxCanvasSize,m=this.getPixelRatio(),v=_*m,I=s*m;return Math.min(v>f?f/v:1,I>d?d/I:1)*m}getPixelRatio(){var _;return(_=this._overridePixelRatio)!==null&&_!==void 0?_:devicePixelRatio}setPixelRatio(_){this._overridePixelRatio=_,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(_){return this.transform.setMaxBounds(xt.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_&&this.setZoom(_),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_&&this.setZoom(_),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_&&this.setPitch(_),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_&&this.setPitch(_),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this._update()}project(_){return this.transform.locationPoint(u.M.convert(_),this.style&&this.terrain)}unproject(_){return this.transform.pointLocation(u.P.convert(_),this.terrain)}isMoving(){var _;return this._moving||((_=this.handlers)===null||_===void 0?void 0:_.isMoving())}isZooming(){var _;return this._zooming||((_=this.handlers)===null||_===void 0?void 0:_.isZooming())}isRotating(){var _;return this._rotating||((_=this.handlers)===null||_===void 0?void 0:_.isRotating())}_createDelegatedListener(_,s,f){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const I=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];I.length?d||(d=!0,f.call(this,new co(_,this,v.originalEvent,{features:I}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:s,listener:f,delegates:{mousemove:I=>{(this.getLayer(s)?this.queryRenderedFeatures(I.point,{layers:[s]}):[]).length?d=!0:d&&(d=!1,f.call(this,new co(_,this,I.originalEvent)))},mouseout:I=>{d&&(d=!1,f.call(this,new co(_,this,I.originalEvent)))}}}}{const d=m=>{const v=this.getLayer(s)?this.queryRenderedFeatures(m.point,{layers:[s]}):[];v.length&&(m.features=v,f.call(this,m),delete m.features)};return{layer:s,listener:f,delegates:{[_]:d}}}}on(_,s,f){if(f===void 0)return super.on(_,s);const d=this._createDelegatedListener(_,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const m in d.delegates)this.on(m,d.delegates[m]);return this}once(_,s,f){if(f===void 0)return super.once(_,s);const d=this._createDelegatedListener(_,s,f);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(_,s,f){return f===void 0?super.off(_,s):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const m=this._delegatedListeners[_];for(let v=0;vthis._updateStyle(_,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new Po(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,s,f):this.style.loadJSON(_,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Po(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,s){if(typeof _=="string"){const f=this._requestManager.transformRequest(_,"Style");u.h(f,new AbortController).then(d=>{this._updateDiff(d.data,s)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,s)}_updateDiff(_,s){try{this.style.setState(_,s)&&this._update(!0)}catch(f){u.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(_,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(_,s){return this._lazyInitEmptyStyle(),this.style.addSource(_,s),this._update(!0)}isSourceLoaded(_){const s=this.style&&this.style.sourceCaches[_];if(s!==void 0)return s.loaded();this.fire(new u.j(new Error(`There is no source with ID '${_}'`)))}setTerrain(_){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),_){const s=this.style.sourceCaches[_.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const d=this.style._layers[f];d.type==="hillshade"&&d.source===_.source&&u.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 Em(this.painter,s,_),this.painter.renderToTexture=new fp(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!==_.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 u.k("terrain",{terrain:_})),this}getTerrain(){var _,s;return(s=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const s in _){const f=_[s]._tiles;for(const d in f){const m=f[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,s,f={}){const{pixelRatio:d=1,sdf:m=!1,stretchX:v,stretchY:I,content:T}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||u.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new u.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:k,data:z}=s,F=s;return this.style.addImage(_,{data:new u.R({width:M,height:k},new Uint8Array(z)),pixelRatio:d,stretchX:v,stretchY:I,content:T,sdf:m,version:0,userImage:F}),F.onAdd&&F.onAdd(this,_),this}}{const{width:M,height:k,data:z}=C.getImageData(s);this.style.addImage(_,{data:new u.R({width:M,height:k},z),pixelRatio:d,stretchX:v,stretchY:I,content:T,sdf:m,version:0})}}updateImage(_,s){const f=this.style.getImage(_);if(!f)return this.fire(new u.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=s instanceof HTMLImageElement||u.b(s)?C.getImageData(s):s,{width:m,height:v,data:I}=d;if(m===void 0||v===void 0)return this.fire(new u.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(m!==f.data.width||v!==f.data.height)return this.fire(new u.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(s instanceof HTMLImageElement||u.b(s));return f.data.replace(I,T),this.style.updateImage(_,f),this}getImage(_){return this.style.getImage(_)}hasImage(_){return _?!!this.style.getImage(_):(this.fire(new u.j(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(_)}loadImage(_){return G.getImage(this._requestManager.transformRequest(_,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,s){return this._lazyInitEmptyStyle(),this.style.addLayer(_,s),this._update(!0)}moveLayer(_,s){return this.style.moveLayer(_,s),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,s,f){return this.style.setLayerZoomRange(_,s,f),this._update(!0)}setFilter(_,s,f={}){return this.style.setFilter(_,s,f),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,s,f,d={}){return this.style.setPaintProperty(_,s,f,d),this._update(!0)}getPaintProperty(_,s){return this.style.getPaintProperty(_,s)}setLayoutProperty(_,s,f,d={}){return this.style.setLayoutProperty(_,s,f,d),this._update(!0)}getLayoutProperty(_,s){return this.style.getLayoutProperty(_,s)}setGlyphs(_,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,s,f,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,s,f=>{f||this._update(!0)}),this}setLight(_,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,s){return this.style.setFeatureState(_,s),this._update()}removeFeatureState(_,s){return this.style.removeFeatureState(_,s),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,s=0;return this._container&&(_=this._container.clientWidth||400,s=this._container.clientHeight||300),[_,s]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const s=this._canvasContainer=P.create("div","maplibregl-canvas-container",_);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=P.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),d=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],d);const m=this._controlContainer=P.create("div","maplibregl-control-container",_),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(I=>{v[I]=P.create("div",`maplibregl-ctrl-${I} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,s,f){this._canvas.width=Math.floor(f*_),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{s={requestedAttributes:_},d&&(s.statusMessage=d.statusMessage,s.type=d.type)},{once:!0});const f=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!f){const d="Failed to initialize WebGL";throw s?(s.message=d,new Error(JSON.stringify(s))):new Error(d)}this.painter=new hm(f,this.transform),D.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(_){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_render(_){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,v=C.now();this.style.zoomHistory.update(m,v);const I=new u.a8(m,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),T=I.crossFadingFactor();T===1&&T===this._crossFadingFactor||(f=!0,this._crossFadingFactor=T),this.style.update(I)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.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,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bc.mark(u.bd.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bc.mark(u.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var _;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),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),P.remove(this._canvasContainer),P.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bc.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,C.frameAsync(this._frameRequest).then(_=>{u.bc.frame(_),this._frameRequest=null,this._render(_)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get version(){return dp}getCameraTargetElevation(){return this.transform.elevation}},h.MapMouseEvent=co,h.MapTouchEvent=Ns,h.MapWheelEvent=sp,h.Marker=fc,h.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),d=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const d=this._map._getUIString(`NavigationControl.${f}`);s.title=d,s.setAttribute("aria-label",d)},this.options=u.e({},mp,_),this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),P.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=P.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(_){return this._map=_,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 gp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){P.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(_,s){const f=P.create("button",_,this._container);return f.type="button",f.addEventListener("click",s),f}},h.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&P.remove(this._content),this._container&&(P.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 u.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=P.create("div","maplibregl-popup",this._map.getContainer()),this._tip=P.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);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?Eh(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const d=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const v=Ph(this.options.offset);if(!m){const T=this._container.offsetWidth,M=this._container.offsetHeight;let k;k=d.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],d.xthis._map.transform.width-T/2&&k.push("right"),m=k.length===0?"bottom":k.join("-")}let I=d.add(v[m]);this.options.subpixelPositioning||(I=I.round()),P.setTransform(this._container,`${hc[m]} translate(${I.x}px,${I.y}px)`),Ih(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(yp),_)}addTo(_){return this._map&&this.remove(),this._map=_,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 u.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(_){return this._lngLat=u.M.convert(_),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(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const s=document.createDocumentFragment(),f=document.createElement("body");let d;for(f.innerHTML=_;d=f.firstChild,d;)s.appendChild(d);return this.setDOMContent(s)}getMaxWidth(){var _;return(_=this._container)===null||_===void 0?void 0:_.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=P.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(_),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(_){this._container&&this._container.classList.add(_)}removeClassName(_){this._container&&this._container.classList.remove(_)}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){if(this._container)return this._container.classList.toggle(_)}setSubpixelPositioning(_){this.options.subpixelPositioning=_}_createCloseButton(){this.options.closeButton&&(this._closeButton=P.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 _=this._container.querySelector(_p);_&&_.focus()}},h.RasterDEMTileSource=He,h.RasterTileSource=Mt,h.ScaleControl=class{constructor(_){this._onMove=()=>{Lh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Lh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Th),_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){P.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},h.ScrollZoomHandler=xh,h.Style=Po,h.TerrainControl=class{constructor(_){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=_}onAdd(_){return this._map=_,this._container=P.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=P.create("button","maplibregl-ctrl-terrain",this._container),P.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(){P.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},h.TwoFingersTouchPitchHandler=vm,h.TwoFingersTouchRotateHandler=lp,h.TwoFingersTouchZoomHandler=_m,h.TwoFingersTouchZoomRotateHandler=sc,h.VectorTileSource=mn,h.VideoSource=To,h.addSourceType=(_,s)=>u._(void 0,void 0,void 0,function*(){if(Ra(_))throw new Error(`A source type called "${_}" already exists.`);((f,d)=>{ks[f]=d})(_,s)}),h.clearPrewarmedResources=function(){const _=dn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Ce),dn=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()"))},h.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},h.getRTLTextPluginStatus=function(){return te().getRTLTextPluginStatus()},h.getVersion=function(){return Im},h.getWorkerCount=function(){return en.workerCount},h.getWorkerUrl=function(){return u.a.WORKER_URL},h.importScriptInWorkers=function(_){return Wr().broadcast("IS",_)},h.prewarm=function(){kn().acquire(Ce)},h.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},h.setRTLTextPlugin=function(_,s){return te().setRTLTextPlugin(_,s)},h.setWorkerCount=function(_){en.workerCount=_},h.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var l=n;return l})})(hS);var vL=hS.exports;const vs=nv(vL);function Mb(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],l=n[r];i!==l&&e(r,l,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function bL(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function xL(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function Ab(e,t){return["case",["boolean",["feature-state","hover"],!1],t,e]}var Sc=wL;function wL(e){var t,n,r;if(e){if(Array.isArray(e)){for(t=[],n=e.length,r=0;r{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function EL(e,t,n){let r,i,l,h,u,y,w,S,C,P,D,N,{$$slots:K={},$$scope:Y}=t,{id:J=Qg("layer")}=t,{source:B=void 0}=t,{sourceLayer:G=void 0}=t,{beforeId:H=void 0}=t,{beforeLayerType:at=void 0}=t,{type:gt}=t,{paint:ft=void 0}=t,{layout:rt=void 0}=t,{filter:mt=void 0}=t,{applyToClusters:Et=void 0}=t,{minzoom:$=void 0}=t,{maxzoom:Pt=void 0}=t,{manageHoverState:Qt=!1}=t,{hovered:Tt=null}=t,{interactive:re=!0}=t,{hoverCursor:fe=void 0}=t,{eventsIfTopMost:Wt=!1}=t;const Re=Vu(),{map:ze,source:We,self:Ue,minzoom:Ce,maxzoom:en,eventTopMost:An,layerInfo:dn}=yL();Ve(e,ze,nt=>n(31,C=nt)),Ve(e,We,nt=>n(32,P=nt)),Ve(e,Ue,nt=>n(0,S=nt)),Ve(e,Ce,nt=>n(34,N=nt)),Ve(e,en,nt=>n(33,D=nt)),ws(()=>{S&&C&&(dn.delete(S),C==null||C.removeLayer(S))});let cn;function kn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn={event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt};Re(nt.type,mn)}function Yn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;fe&&(C.getCanvas().style.cursor=fe);let xt=nt.features??[];n(6,Tt=xt[0]??null);let ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id;Re("mouseenter",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function Wr(nt){var Mt,He,Tr;if(!re||!C)return;if(Wt&&An(nt)!==S){n(6,Tt=null),Qt&&cn!==void 0&&(C==null||C.setFeatureState({source:u,sourceLayer:G,id:cn},{hover:!1}),cn=void 0);return}C.getCanvas().style.cursor=fe;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn=(Tr=xt[0])==null?void 0:Tr.id;mn!==cn&&(Qt&&(cn!==void 0&&(C==null||C.setFeatureState({source:u,id:cn,sourceLayer:G},{hover:!1})),C==null||C.setFeatureState({source:u,id:mn,sourceLayer:G},{hover:!0})),cn=mn,n(6,Tt=xt[0]??null)),Re("mousemove",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function hr(nt){if(!(!re||!S||!C)){if(fe&&(C.getCanvas().style.cursor=""),n(6,Tt=null),Qt&&cn!==void 0){const xt={source:u,id:cn,sourceLayer:G};C==null||C.setFeatureState(xt,{hover:!1}),cn=void 0}Re("mouseleave",{map:C,layer:S,source:u})}}let er=!0;function Kn(nt){C&&(C.off("click",nt,kn),C.off("dblclick",nt,kn),C.off("contextmenu",nt,kn),C.off("mouseenter",nt,Yn),C.off("mousemove",nt,Wr),C.off("mouseleave",nt,hr))}return ws(()=>{C&&S&&Kn(S)}),e.$$set=nt=>{"id"in nt&&n(7,J=nt.id),"source"in nt&&n(8,B=nt.source),"sourceLayer"in nt&&n(9,G=nt.sourceLayer),"beforeId"in nt&&n(10,H=nt.beforeId),"beforeLayerType"in nt&&n(11,at=nt.beforeLayerType),"type"in nt&&n(12,gt=nt.type),"paint"in nt&&n(13,ft=nt.paint),"layout"in nt&&n(14,rt=nt.layout),"filter"in nt&&n(15,mt=nt.filter),"applyToClusters"in nt&&n(16,Et=nt.applyToClusters),"minzoom"in nt&&n(17,$=nt.minzoom),"maxzoom"in nt&&n(18,Pt=nt.maxzoom),"manageHoverState"in nt&&n(19,Qt=nt.manageHoverState),"hovered"in nt&&n(6,Tt=nt.hovered),"interactive"in nt&&n(20,re=nt.interactive),"hoverCursor"in nt&&n(21,fe=nt.hoverCursor),"eventsIfTopMost"in nt&&n(22,Wt=nt.eventsIfTopMost),"$$scope"in nt&&n(35,Y=nt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=xL(Et)),e.$$.dirty[0]&1073774592&&n(24,i=bL("all",r,mt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=$??N),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=Pt??D),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&C&&S!==J&&u){S&&(Kn(S),dn.delete(S));let nt=H;if(!H&&at){let xt=C.getStyle().layers,ce=typeof at=="function"?at:Mt=>Mt.type===at,mn=xt==null?void 0:xt.find(ce);mn&&(nt=mn.id)}Ar(Ue,S=J,S),C.addLayer(Sc({id:S,type:gt,source:u,"source-layer":G,filter:i,paint:ft,layout:rt,minzoom:l,maxzoom:h}),nt),n(23,er=!0),C.on("click",S,kn),C.on("dblclick",S,kn),C.on("contextmenu",S,kn),C.on("mouseenter",S,Yn),C.on("mousemove",S,Wr),C.on("mouseleave",S,hr)}e.$$.dirty[0]&1048577&&S&&dn.set(S,{interactive:re}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?Mb((nt,xt)=>C==null?void 0:C.setPaintProperty(S,nt,xt)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?Mb((nt,xt)=>C==null?void 0:C.setLayoutProperty(S,nt,xt)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(ft)),e.$$.dirty[0]&134234112&&(w==null||w(rt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(C==null||C.setLayerZoomRange(S,l,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(er?n(23,er=!1):C==null||C.setFilter(S,i))},[S,ze,We,Ue,Ce,en,Tt,J,B,G,H,at,gt,ft,rt,mt,Et,$,Pt,Qt,re,fe,Wt,er,i,h,l,w,y,u,r,C,P,D,N,Y,K]}let pS=class extends an{constructor(t){super(),sn(this,t,EL,SL,Xe,{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 IL(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,i,i[23],t?ui(n,i[23],l,null):hi(i[23]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function CL(e){let t,n,r;function i(h){e[16](h)}let l={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[IL]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new pS({props:l}),fi.push(()=>Pu(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Lu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){jt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function TL(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:l=Qg("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:K=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:J=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){J=$,n(0,J)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,D=$.minzoom),"maxzoom"in $&&n(10,N=$.maxzoom),"hoverCursor"in $&&n(11,K=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,J=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,i=$.$$scope)},[J,l,h,u,y,w,S,C,P,D,N,K,Y,B,G,r,H,at,gt,ft,rt,mt,Et,i]}let LL=class extends an{constructor(t){super(),sn(this,t,TL,CL,Xe,{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 PL(e,t,n){let r;const{map:i}=Mf();Ve(e,i,y=>n(4,r=y));let{position:l="top-left"}=t,{container:h=void 0}=t,u=null;return ws(()=>{r!=null&&r.loaded()&&u&&r.removeControl(u)}),e.$$set=y=>{"position"in y&&n(1,l=y.position),"container"in y&&n(2,h=y.container)},e.$$.update=()=>{if(e.$$.dirty&30&&r&&!u){let y;typeof h=="string"?y=document.querySelector(h)??void 0:y=h,n(3,u=new vs.FullscreenControl({container:y})),r.addControl(u,l)}},[i,l,h,u,r]}class ML extends an{constructor(t){super(),sn(this,t,PL,null,Xe,{position:1,container:2})}}function AL(e,t,n,r,i){let l=!1;e.getSource(t)&&(l=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(l){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function kL(e,t,n){sS().then(()=>{let r=K0(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function Rb(e){let t=e[0],n,r,i=Nb(e);return{c(){i.c(),n=so()},m(l,h){i.m(l,h),zt(l,n,h),r=!0},p(l,h){h&1&&Xe(t,t=l[0])?(ar(),jt(i,1,1,Ae),lr(),i=Nb(l),i.c(),Dt(i,1),i.m(n.parentNode,n)):i.p(l,h)},i(l){r||(Dt(i),r=!0)},o(l){jt(i),r=!1},d(l){l&&Nt(n),i.d(l)}}}function Nb(e){let t;const n=e[19].default,r=li(n,e,e[18],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&262144)&&ci(r,n,i,i[18],t?ui(n,i[18],l,null):hi(i[18]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function DL(e){let t,n,r=e[0]&&Rb(e);return{c(){r&&r.c(),t=so()},m(i,l){r&&r.m(i,l),zt(i,t,l),n=!0},p(i,[l]){i[0]?r?(r.p(i,l),l&1&&Dt(r,1)):(r=Rb(i),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function RL(e,t,n){let r,i,l,{$$slots:h={},$$scope:u}=t,{id:y=Qg("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:C=void 0}=t,{filter:P=void 0}=t,{lineMetrics:D=void 0}=t,{cluster:N=void 0}=t,{maxzoom:K=void 0}=t,{attribution:Y=void 0}=t,{buffer:J=void 0}=t,{tolerance:B=void 0}=t;const{map:G,cluster:H,self:at}=gL();Ve(e,G,rt=>n(17,i=rt)),Ve(e,H,rt=>n(20,l=rt)),Ve(e,at,rt=>n(0,r=rt));let gt,ft=!0;return ws(()=>{r&>&&i&&(kL(G,r,gt),Ar(at,r=null,r),n(15,gt=void 0))}),e.$$set=rt=>{"id"in rt&&n(4,y=rt.id),"data"in rt&&n(5,w=rt.data),"generateId"in rt&&n(6,S=rt.generateId),"promoteId"in rt&&n(7,C=rt.promoteId),"filter"in rt&&n(8,P=rt.filter),"lineMetrics"in rt&&n(9,D=rt.lineMetrics),"cluster"in rt&&n(10,N=rt.cluster),"maxzoom"in rt&&n(11,K=rt.maxzoom),"attribution"in rt&&n(12,Y=rt.attribution),"buffer"in rt&&n(13,J=rt.buffer),"tolerance"in rt&&n(14,B=rt.tolerance),"$$scope"in rt&&n(18,u=rt.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Ar(H,l=N,l),e.$$.dirty&196593&&i&&r!==y&&(Ar(at,r=y,r),AL(i,r,Sc({type:"geojson",data:w,filter:P,lineMetrics:D,generateId:S,promoteId:C,cluster:!!N,clusterMinPoints:N==null?void 0:N.minPoints,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius,clusterProperties:N==null?void 0:N.properties,maxzoom:K,attribution:Y,buffer:J,tolerance:B}),rt=>i&&rt===r,()=>{r&&(n(15,gt=i==null?void 0:i.getSource(r)),n(16,ft=!0))})),e.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,gt=i==null?void 0:i.getSource(y))})),e.$$.dirty&98336&>&&(ft?n(16,ft=!1):gt.setData(w)),e.$$.dirty&33792&&(gt==null||gt.setClusterOptions(Sc({cluster:!!N,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius})))},[r,G,H,at,y,w,S,C,P,D,N,K,Y,J,B,gt,ft,i,u,h]}let Af=class extends an{constructor(t){super(),sn(this,t,RL,DL,Xe,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function NL(e,t,n){let r;const{map:i}=Mf();Ve(e,i,P=>n(8,r=P));let{position:l="top-left"}=t,{positionOptions:h=void 0}=t,{fitBoundsOptions:u=void 0}=t,{trackUserLocation:y=!1}=t,{showAccuracyCircle:w=!0}=t,{showUserLocation:S=!0}=t,{control:C=null}=t;return ws(()=>{r!=null&&r.loaded()&&C&&r.removeControl(C)}),e.$$set=P=>{"position"in P&&n(2,l=P.position),"positionOptions"in P&&n(3,h=P.positionOptions),"fitBoundsOptions"in P&&n(4,u=P.fitBoundsOptions),"trackUserLocation"in P&&n(5,y=P.trackUserLocation),"showAccuracyCircle"in P&&n(6,w=P.showAccuracyCircle),"showUserLocation"in P&&n(7,S=P.showUserLocation),"control"in P&&n(1,C=P.control)},e.$$.update=()=>{e.$$.dirty&510&&r&&!C&&(n(1,C=new vs.GeolocateControl({positionOptions:h,fitBoundsOptions:u,trackUserLocation:y,showAccuracyCircle:w,showUserLocation:S})),r.addControl(C,l))},[i,C,l,h,u,y,w,S,r]}class OL extends an{constructor(t){super(),sn(this,t,NL,null,Xe,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function zL(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,i,i[23],t?ui(n,i[23],l,null):hi(i[23]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function FL(e){let t,n,r;function i(h){e[16](h)}let l={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[zL]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new pS({props:l}),fi.push(()=>Pu(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Lu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){jt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function BL(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:l=Qg("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:K=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:J=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){J=$,n(0,J)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,D=$.minzoom),"maxzoom"in $&&n(10,N=$.maxzoom),"hoverCursor"in $&&n(11,K=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,J=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,i=$.$$scope)},[J,l,h,u,y,w,S,C,P,D,N,K,Y,B,G,r,H,at,gt,ft,rt,mt,Et,i]}let Ad=class extends an{constructor(t){super(),sn(this,t,BL,FL,Xe,{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 VL(e,t,n){let r;const i=Vu();let{layer:l=void 0}=t;const{map:h}=Mf();Ve(e,h,S=>n(2,r=S));function u(S){i(S.type,{...S,map:h})}const y=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return ws(()=>{if(r)if(l)for(const S of y)r.off(S,l,u);else for(const S of w)r.off(S,u)}),e.$$set=S=>{"layer"in S&&n(1,l=S.layer)},e.$$.update=()=>{if(e.$$.dirty&6&&r)if(l)for(const S of y)r.on(S,l,u);else for(const S of w)r.on(S,u)},[h,l,r]}class dS extends an{constructor(t){super(),sn(this,t,VL,null,Xe,{layer:1})}}function UL(e){let t=e.getCenter(),n=Math.round(e.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),l=Math.round(t.lat*i)/i,h=Math.round(t.lng*i)/i,u=`${n}/${l}/${h}`,y=e.getBearing(),w=e.getPitch();return(y||w)&&(u+=`/${Math.round(y*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function GL(e){return e.replace("#","").split("/").map(parseFloat)}var jh=rv;function rv(e,t){return e===t||e!==e&&t!==t?!0:typeof e!=typeof t||{}.toString.call(e)!={}.toString.call(t)||e!==Object(e)||!e?!1:Array.isArray(e)?Ob(e,t):{}.toString.call(e)=="[object Set]"?Ob(Array.from(e),Array.from(t)):{}.toString.call(e)=="[object Object]"?jL(e,t):qL(e,t)}function qL(e,t){return e.toString()===t.toString()}function Ob(e,t){var n=e.length;if(n!=t.length)return!1;for(var r=0;rn(6,r=S));let{position:l="top-left"}=t,{showCompass:h=!0}=t,{showZoom:u=!0}=t,{visualizePitch:y=!1}=t,w=null;return ws(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),e.$$set=S=>{"position"in S&&n(1,l=S.position),"showCompass"in S&&n(2,h=S.showCompass),"showZoom"in S&&n(3,u=S.showZoom),"visualizePitch"in S&&n(4,y=S.visualizePitch)},e.$$.update=()=>{e.$$.dirty&126&&r&&!w&&(n(5,w=new vs.NavigationControl({showCompass:h,showZoom:u,visualizePitch:y})),r.addControl(w,l))},[i,l,h,u,y,w,r]}class HL extends an{constructor(t){super(),sn(this,t,WL,null,Xe,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function ZL(e,t,n){let r;const{map:i}=Mf();Ve(e,i,w=>n(5,r=w));let{position:l="bottom-left"}=t,{maxWidth:h=void 0}=t,{unit:u="metric"}=t,y=null;return ws(()=>{r!=null&&r.loaded()&&y&&r.removeControl(y)}),e.$$set=w=>{"position"in w&&n(1,l=w.position),"maxWidth"in w&&n(2,h=w.maxWidth),"unit"in w&&n(3,u=w.unit)},e.$$.update=()=>{e.$$.dirty&62&&r&&!y&&(n(4,y=new vs.ScaleControl({maxWidth:h,unit:u})),r.addControl(y,l))},[i,l,h,u,y,r]}class XL extends an{constructor(t){super(),sn(this,t,ZL,null,Xe,{position:1,maxWidth:2,unit:3})}}const{window:YL}=HT,KL=e=>({map:e[0]&16,loadedImages:e[0]&32,allImagesLoaded:e[0]&64}),zb=e=>({map:e[4],loadedImages:e[5],allImagesLoaded:e[6]});function Fb(e){let t,n,r=e[3]&&Bb(e);const i=e[40].default,l=li(i,e,e[39],zb);return{c(){r&&r.c(),t=ye(),l&&l.c()},m(h,u){r&&r.m(h,u),zt(h,t,u),l&&l.m(h,u),n=!0},p(h,u){h[3]?r?(r.p(h,u),u[0]&8&&Dt(r,1)):(r=Bb(h),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr()),l&&l.p&&(!n||u[0]&112|u[1]&256)&&ci(l,i,h,h[39],n?ui(i,h[39],u,KL):hi(h[39]),zb)},i(h){n||(Dt(r),Dt(l,h),n=!0)},o(h){jt(r),jt(l,h),n=!1},d(h){h&&Nt(t),r&&r.d(h),l&&l.d(h)}}}function Bb(e){let t,n,r,i,l,h,u,y;return t=new HL({props:{position:e[7]}}),r=new OL({props:{position:e[7],fitBoundsOptions:{maxZoom:12}}}),l=new ML({props:{position:e[7]}}),u=new XL({props:{position:e[7]}}),{c(){Ie(t.$$.fragment),n=ye(),Ie(r.$$.fragment),i=ye(),Ie(l.$$.fragment),h=ye(),Ie(u.$$.fragment)},m(w,S){we(t,w,S),zt(w,n,S),we(r,w,S),zt(w,i,S),we(l,w,S),zt(w,h,S),we(u,w,S),y=!0},p(w,S){const C={};S[0]&128&&(C.position=w[7]),t.$set(C);const P={};S[0]&128&&(P.position=w[7]),r.$set(P);const D={};S[0]&128&&(D.position=w[7]),l.$set(D);const N={};S[0]&128&&(N.position=w[7]),u.$set(N)},i(w){y||(Dt(t.$$.fragment,w),Dt(r.$$.fragment,w),Dt(l.$$.fragment,w),Dt(u.$$.fragment,w),y=!0)},o(w){jt(t.$$.fragment,w),jt(r.$$.fragment,w),jt(l.$$.fragment,w),jt(u.$$.fragment,w),y=!1},d(w){w&&(Nt(n),Nt(i),Nt(h)),Se(t,w),Se(r,w),Se(l,w),Se(u,w)}}}function JL(e){let t,n,r,i,l,h=e[4]&&e[0]&&Fb(e);return{c(){t=qt("div"),h&&h.c(),Vt(t,"class",n=_g(e[2])+" svelte-p00lfq"),Vt(t,"data-testid","map-container"),tl(t,"expand-map",!e[2])},m(u,y){zt(u,t,y),h&&h.m(t,null),e[41](t),r=!0,i||(l=[un(YL,"hashchange",e[11]),i0(e[10].call(null,t))],i=!0)},p(u,y){u[4]&&u[0]?h?(h.p(u,y),y[0]&17&&Dt(h,1)):(h=Fb(u),h.c(),Dt(h,1),h.m(t,null)):h&&(ar(),jt(h,1,1,()=>{h=null}),lr()),(!r||y[0]&4&&n!==(n=_g(u[2])+" svelte-p00lfq"))&&Vt(t,"class",n),(!r||y[0]&4)&&tl(t,"expand-map",!u[2])},i(u){r||(Dt(h),r=!0)},o(u){jt(h),r=!1},d(u){u&&Nt(t),h&&h.d(),e[41](null),i=!1,oo(l)}}}function QL(e,t,n){let r,i,l,h,{$$slots:u={},$$scope:y}=t,{map:w=null}=t,{mapContainer:S=void 0}=t,{class:C=void 0}=t,{style:P}=t,{diffStyleUpdates:D=!1}=t,{center:N=void 0}=t,{zoom:K=void 0}=t,{pitch:Y=0}=t,{bearing:J=0}=t,{bounds:B=void 0}=t,{hash:G=!1}=t,{updateHash:H=nt=>{window.history.replaceState(window.history.state,"",nt)}}=t,{loaded:at=!1}=t,{minZoom:gt=0}=t,{maxZoom:ft=22}=t,{antialias:rt=void 0}=t,{zoomOnDoubleClick:mt=!0}=t,{locale:Et=void 0}=t,{interactive:$=!0}=t,{attributionControl:Pt=!0}=t,{cooperativeGestures:Qt=!1}=t,{preserveDrawingBuffer:Tt=!1}=t,{maxBounds:re=void 0}=t,{images:fe=[]}=t,{standardControls:Wt=!1}=t,{filterLayers:Re=void 0}=t,{transformRequest:ze=void 0}=t;const We=Vu(),{map:Ue,loadedImages:Ce}=mL();Ve(e,Ue,nt=>n(4,l=nt)),Ve(e,Ce,nt=>n(5,h=nt));let en=new Set;async function An(nt,xt=!1){if(l&&!(!l.loaded()&&!xt))if("url"in nt){en.add(nt.id);try{let ce=await l.loadImage(nt.url);l==null||l.addImage(nt.id,ce.data,nt.options),h.add(nt.id),Ce.set(h)}catch(ce){We("error",ce)}finally{en.delete(nt.id)}}else l.addImage(nt.id,nt.data,nt.options),h.add(nt.id),Ce.set(h)}let dn,cn,kn,Yn;function Wr(nt){return er(),Ar(Ue,l=new vs.Map(Sc({container:nt,style:P,locale:Et,center:N,zoom:K,pitch:Y,bearing:J,minZoom:gt,maxZoom:ft,antialias:rt,interactive:$,preserveDrawingBuffer:Tt,maxBounds:re,bounds:B,attributionControl:Pt,transformRequest:ze,cooperativeGestures:Qt})),l),l.on("load",xt=>{xt.target.getContainer().setAttribute("data-testid","map"),xt.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,at=!0),We("load",l)}),l.on("error",xt=>We("error",{...xt,map:l})),l.on("movestart",xt=>We("movestart",{...xt,map:l})),l.on("moveend",xt=>{if(n(12,N=xt.target.getCenter()),n(13,K=xt.target.getZoom()),n(14,Y=xt.target.getPitch()),n(15,J=xt.target.getBearing()),n(16,B=xt.target.getBounds()),We("moveend",{...xt,map:l}),G){let ce=new URL(window.location.href.replace(/(#.+)?$/,UL(l)));H(ce)}}),l.on("click",xt=>We("click",{...xt,map:l})),l.on("dblclick",xt=>We("dblclick",{...xt,map:l})),l.on("contextmenu",xt=>We("contextmenu",{...xt,map:l})),l.on("zoomstart",xt=>We("zoomstart",{...xt,map:l})),l.on("zoom",xt=>{We("zoom",{...xt,map:l})}),l.on("zoomend",xt=>{We("zoomend",{...xt,map:l})}),l.on("style.load",()=>{if(l){const xt=l.getStyle();if(n(36,dn=xt.layers.map(ce=>ce.id)),n(37,cn=Object.keys(xt.sources)),Yn)for(const[ce,mn]of Object.entries(Yn))l.addSource(ce,mn);if(kn)for(const ce of kn)l.addLayer(ce);for(const ce of fe)An(ce,!0)}}),l.on("styledata",xt=>{if(l&&Re){const ce=l.getStyle().layers;if(ce)for(let mn of ce)Re(mn)||l.setLayoutProperty(mn.id,"visibility","none")}We("styledata",{...xt,map:l})}),{destroy(){n(0,at=!1),l==null||l.remove(),Ar(Ue,l=null,l)}}}let hr=P;function er(){if(G){let nt=GL(window.location.hash);nt.length>=3&&(n(13,K=nt[0]),n(12,N=[nt[2],nt[1]])),nt.length==5&&(n(15,J=nt[3]),n(14,Y=nt[4]))}}function Kn(nt){fi[nt?"unshift":"push"](()=>{S=nt,n(1,S)})}return e.$$set=nt=>{"map"in nt&&n(17,w=nt.map),"mapContainer"in nt&&n(1,S=nt.mapContainer),"class"in nt&&n(2,C=nt.class),"style"in nt&&n(18,P=nt.style),"diffStyleUpdates"in nt&&n(19,D=nt.diffStyleUpdates),"center"in nt&&n(12,N=nt.center),"zoom"in nt&&n(13,K=nt.zoom),"pitch"in nt&&n(14,Y=nt.pitch),"bearing"in nt&&n(15,J=nt.bearing),"bounds"in nt&&n(16,B=nt.bounds),"hash"in nt&&n(20,G=nt.hash),"updateHash"in nt&&n(21,H=nt.updateHash),"loaded"in nt&&n(0,at=nt.loaded),"minZoom"in nt&&n(22,gt=nt.minZoom),"maxZoom"in nt&&n(23,ft=nt.maxZoom),"antialias"in nt&&n(24,rt=nt.antialias),"zoomOnDoubleClick"in nt&&n(25,mt=nt.zoomOnDoubleClick),"locale"in nt&&n(26,Et=nt.locale),"interactive"in nt&&n(27,$=nt.interactive),"attributionControl"in nt&&n(28,Pt=nt.attributionControl),"cooperativeGestures"in nt&&n(29,Qt=nt.cooperativeGestures),"preserveDrawingBuffer"in nt&&n(30,Tt=nt.preserveDrawingBuffer),"maxBounds"in nt&&n(31,re=nt.maxBounds),"images"in nt&&n(32,fe=nt.images),"standardControls"in nt&&n(3,Wt=nt.standardControls),"filterLayers"in nt&&n(33,Re=nt.filterLayers),"transformRequest"in nt&&n(34,ze=nt.transformRequest),"$$scope"in nt&&n(39,y=nt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&8&&n(7,r=typeof Wt=="boolean"?void 0:Wt),e.$$.dirty[0]&16&&n(17,w=l),e.$$.dirty[0]&786448|e.$$.dirty[1]&224&&l&&!jh(P,hr)){const nt=l.getStyle();if(dn&&(kn=nt.layers.filter(xt=>!dn.includes(xt.id))),cn){const xt=Object.keys(nt.sources).filter(ce=>!cn.includes(ce));Yn={};for(const ce of xt)Yn[ce]=nt.sources[ce]}n(38,hr=P),l.setStyle(P,{diff:D}),Ar(Ce,h=new Set,h),n(35,en=new Set)}if(e.$$.dirty[0]&49|e.$$.dirty[1]&18&&at&&l!=null&&l.loaded())for(let nt of fe)!h.has(nt.id)&&!en.has(nt.id)&&!l.hasImage(nt.id)&&An(nt);if(e.$$.dirty[0]&32|e.$$.dirty[1]&2&&n(6,i=fe.every(nt=>h.has(nt.id))),e.$$.dirty[0]&61456&&l){let nt={};N!=null&&!jh(N,l==null?void 0:l.getCenter())&&(nt.center=N),K!=null&&!jh(K,l==null?void 0:l.getZoom())&&(nt.zoom=K),J!=null&&!jh(J,l==null?void 0:l.getBearing())&&(nt.bearing=J),Y!=null&&!jh(Y,l==null?void 0:l.getPitch())&&(nt.pitch=Y),Object.keys(nt).length&&l.easeTo(nt)}e.$$.dirty[0]&65552&&B&&!jh(B,l==null?void 0:l.getBounds())&&(l==null||l.fitBounds(B)),e.$$.dirty[0]&33554448&&(mt?l==null||l.doubleClickZoom.enable():l==null||l.doubleClickZoom.disable())},[at,S,C,Wt,l,h,i,r,Ue,Ce,Wr,er,N,K,Y,J,B,w,P,D,G,H,gt,ft,rt,mt,Et,$,Pt,Qt,Tt,re,fe,Re,ze,en,dn,cn,hr,y,u,Kn]}class $L extends an{constructor(t){super(),sn(this,t,QL,JL,Xe,{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 tP=e=>({marker:e&8}),Vb=e=>({marker:e[3]});function eP(e){let t,n,r,i,l,h,u;const y=e[19].default,w=li(y,e,e[18],Vb);return{c(){t=qt("div"),w&&w.c(),Vt(t,"tabindex",n=e[1]?0:void 0),Vt(t,"role",r=e[1]?"button":void 0),Gr(t,"z-index",e[2])},m(S,C){zt(S,t,C),w&&w.m(t,null),l=!0,h||(u=[i0(e[7].call(null,t)),i0(i=nP.call(null,t,e[0])),un(t,"click",T_(e[20])),un(t,"dblclick",T_(e[21])),un(t,"contextmenu",T_(e[22])),un(t,"mouseenter",e[23]),un(t,"mouseleave",e[24]),un(t,"mousemove",e[25]),un(t,"keydown",e[8])],h=!0)},p(S,[C]){w&&w.p&&(!l||C&262152)&&ci(w,y,S,S[18],l?ui(y,S[18],C,tP):hi(S[18]),Vb),(!l||C&2&&n!==(n=S[1]?0:void 0))&&Vt(t,"tabindex",n),(!l||C&2&&r!==(r=S[1]?"button":void 0))&&Vt(t,"role",r),i&&Jg(i.update)&&C&1&&i.update.call(null,S[0]),C&4&&Gr(t,"z-index",S[2])},i(S){l||(Dt(w,S),l=!0)},o(S){jt(w,S),l=!1},d(S){S&&Nt(t),w&&w.d(S),h=!1,oo(u)}}}function nP(e,t){const n=e.className;function r(i){i?e.className=`${n} ${i}`:e.className=n}return r(t),{update:r}}function rP(e,t,n){let r,i,l,{$$slots:h={},$$scope:u}=t,{marker:y=void 0}=t,{lngLat:w}=t,{class:S=void 0}=t,{interactive:C=!0}=t,{asButton:P=!1}=t,{draggable:D=!1}=t,{feature:N=null}=t,{offset:K=void 0}=t,{zIndex:Y=void 0}=t,{rotation:J=0}=t,{opacity:B=1}=t;const G=Vu(),{map:H,layerEvent:at,self:gt}=_L();Ve(e,H,Wt=>n(27,l=Wt)),Ve(e,at,Wt=>n(26,r=Wt)),Ve(e,gt,Wt=>n(3,i=Wt));function ft(Wt){Ar(gt,i=new vs.Marker({element:Wt,rotation:J,draggable:D,offset:K,opacity:B.toString()}).setLngLat(w).addTo(l),i),n(11,y=i);const Re=()=>Et("dragstart"),ze=()=>{rt(),Et("drag")},We=()=>{rt(),Et("dragend")};return D&&(i.on("dragstart",Re),i.on("drag",ze),i.on("dragend",We)),{destroy(){D&&(i==null||i.off("dragstart",Re),i==null||i.off("drag",ze),i==null||i.off("dragend",We)),n(11,y=void 0),i==null||i.remove()}}}function rt(){let Wt=i==null?void 0:i.getLngLat();Wt&&(Array.isArray(w)?n(10,w=[Wt.lng,Wt.lat]):w&&"lon"in w?n(10,w={lon:Wt.lng,lat:Wt.lat}):n(10,w=Wt))}function mt(Wt){Wt.key===" "&&(Wt.preventDefault(),Wt.stopPropagation(),Et("click"))}function Et(Wt){if(!C)return;let Re=i==null?void 0:i.getLngLat();if(!Re)return;const ze=[Re.lng,Re.lat];let We={map:l,marker:i,lngLat:ze,features:[{type:"Feature",properties:(N==null?void 0:N.properties)??{},geometry:{type:"Point",coordinates:ze}}]};Ar(at,r={...We,layerType:"marker",type:Wt},r),G(Wt,We)}const $=()=>Et("click"),Pt=()=>Et("dblclick"),Qt=()=>Et("contextmenu"),Tt=Wt=>{Et("mouseenter")},re=()=>{Et("mouseleave")},fe=()=>Et("mousemove");return e.$$set=Wt=>{"marker"in Wt&&n(11,y=Wt.marker),"lngLat"in Wt&&n(10,w=Wt.lngLat),"class"in Wt&&n(0,S=Wt.class),"interactive"in Wt&&n(12,C=Wt.interactive),"asButton"in Wt&&n(1,P=Wt.asButton),"draggable"in Wt&&n(13,D=Wt.draggable),"feature"in Wt&&n(14,N=Wt.feature),"offset"in Wt&&n(15,K=Wt.offset),"zIndex"in Wt&&n(2,Y=Wt.zIndex),"rotation"in Wt&&n(16,J=Wt.rotation),"opacity"in Wt&&n(17,B=Wt.opacity),"$$scope"in Wt&&n(18,u=Wt.$$scope)},e.$$.update=()=>{e.$$.dirty&1032&&(i==null||i.setLngLat(w)),e.$$.dirty&32776&&(i==null||i.setOffset(K??[0,0])),e.$$.dirty&65544&&(i==null||i.setRotation(J)),e.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,P,Y,i,H,at,gt,ft,mt,Et,w,y,C,D,N,K,J,B,u,h,$,Pt,Qt,Tt,re,fe]}class Ub extends an{constructor(t){super(),sn(this,t,rP,eP,Xe,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}var kd=Uint8Array,mS=Uint16Array,iP=Int32Array,oP=new kd([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]),sP=new kd([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]),gS=function(e,t){for(var n=new mS(31),r=0;r<31;++r)n[r]=t+=1<>1|(jn&21845)<<1,kl=(kl&52428)>>2|(kl&13107)<<2,kl=(kl&61680)>>4|(kl&3855)<<4,uP[jn]=((kl&65280)>>8|(kl&255)<<8)>>1;var kl,jn,ty=new kd(288);for(jn=0;jn<144;++jn)ty[jn]=8;var jn;for(jn=144;jn<256;++jn)ty[jn]=9;var jn;for(jn=256;jn<280;++jn)ty[jn]=7;var jn;for(jn=280;jn<288;++jn)ty[jn]=8;var jn,cP=new kd(32);for(jn=0;jn<32;++jn)cP[jn]=5;var jn,hP=new kd(0),fP=typeof TextDecoder<"u"&&new TextDecoder,pP=0;try{fP.decode(hP,{stream:!0}),pP=1}catch{}const Qa={Footway:"black",Indoors:"grey",BridgeOrTunnel:"black",WithTraffic:"#4C3926",Crossing:"green",Severance:"red"},_S=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],vS=[1,4,7,10,13,15];function Gb(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function qb(e){let t,n,r,i=e[1]+"",l,h;return{c(){t=qt("li"),n=qt("span"),r=ye(),l=yn(i),h=ye(),Vt(n,"class","svelte-kzgqtg"),Gr(n,"background",e[2])},m(u,y){zt(u,t,y),Xt(t,n),Xt(t,r),Xt(t,l),Xt(t,h)},p(u,y){y&1&&Gr(n,"background",u[2]),y&1&&i!==(i=u[1]+"")&&Ui(l,i)},d(u){u&&Nt(t)}}}function dP(e){let t,n=vo(e[0]),r=[];for(let i=0;i{"rows"in i&&n(0,r=i.rows)},[r]}class gP extends an{constructor(t){super(),sn(this,t,mP,dP,Xe,{rows:0})}}function jb(e){let t,n;return{c(){t=qt("div"),n=yn(e[0]),Vt(t,"class","svelte-1uuov7f")},m(r,i){zt(r,t,i),Xt(t,n)},p(r,i){i&1&&Ui(n,r[0])},d(r){r&&Nt(t)}}}function yP(e){let t,n=e[0]&&jb(e);return{c(){n&&n.c(),t=so()},m(r,i){n&&n.m(r,i),zt(r,t,i)},p(r,[i]){r[0]?n?n.p(r,i):(n=jb(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:Ae,o:Ae,d(r){r&&Nt(t),n&&n.d(r)}}}function _P(e,t,n){let{loading:r}=t;return e.$$set=i=>{"loading"in i&&n(0,r=i.loading)},[r]}class vP extends an{constructor(t){super(),sn(this,t,_P,yP,Xe,{loading:0})}}const bP=e=>({dialog:e&1}),Wb=e=>({dialog:e[0]});function xP(e){let t,n,r,i,l;const h=e[4].default,u=li(h,e,e[3],Wb);return{c(){t=qt("dialog"),n=qt("article"),u&&u.c(),t.open=!0},m(y,w){zt(y,t,w),Xt(t,n),u&&u.m(n,null),e[6](t),r=!0,i||(l=[un(window,"click",e[1]),un(window,"keydown",e[2]),un(t,"close",e[5])],i=!0)},p(y,[w]){u&&u.p&&(!r||w&9)&&ci(u,h,y,y[3],r?ui(h,y[3],w,bP):hi(y[3]),Wb)},i(y){r||(Dt(u,y),r=!0)},o(y){jt(u,y),r=!1},d(y){y&&Nt(t),u&&u.d(y),e[6](null),i=!1,oo(l)}}}function wP(e,t,n){let{$$slots:r={},$$scope:i}=t,l;function h(S){l.open&&S.target==l&&l.close()}function u(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),l.close())}function y(S){Nn.call(this,e,S)}function w(S){fi[S?"unshift":"push"](()=>{l=S,n(0,l)})}return e.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[l,h,u,i,r,y,w]}class SP extends an{constructor(t){super(),sn(this,t,wP,xP,Xe,{})}}function Hb(e,t,n){const r=e.slice();return r[1]=t[n][0],r[2]=t[n][1],r}function Zb(e){let t,n,r=e[1]+"",i,l,h,u=e[2]+"",y,w;return{c(){t=qt("tr"),n=qt("td"),i=yn(r),l=ye(),h=qt("td"),y=yn(u),w=ye()},m(S,C){zt(S,t,C),Xt(t,n),Xt(n,i),Xt(t,l),Xt(t,h),Xt(h,y),Xt(t,w)},p(S,C){C&1&&r!==(r=S[1]+"")&&Ui(i,r),C&1&&u!==(u=S[2]+"")&&Ui(y,u)},d(S){S&&Nt(t)}}}function EP(e){let t,n,r=vo(Object.entries(e[0])),i=[];for(let l=0;l{"properties"in i&&n(0,r=i.properties)},[r]}class CP extends an{constructor(t){super(),sn(this,t,IP,EP,Xe,{properties:0})}}function Xb(e,t,n){const r=e.slice();return r[3]=t[n],r}function Yb(e,t,n){const r=e.slice();return r[6]=t[n],r}function Kb(e){let t,n;return{c(){t=qt("span"),n=yn(`  + `),Gr(t,"background",e[6]),Gr(t,"width","100%"),Gr(t,"border","1px solid black")},m(r,i){zt(r,t,i),Xt(t,n)},p(r,i){i&1&&Gr(t,"background",r[6])},d(r){r&&Nt(t)}}}function TP(e){let t,n=e[3]+"",r;return{c(){t=qt("span"),r=yn(n)},m(i,l){zt(i,t,l),Xt(t,r)},p(i,l){l&2&&n!==(n=i[3]+"")&&Ui(r,n)},d(i){i&&Nt(t)}}}function LP(e){let t,n=e[3].toFixed(e[2])+"",r;return{c(){t=qt("span"),r=yn(n)},m(i,l){zt(i,t,l),Xt(t,r)},p(i,l){l&6&&n!==(n=i[3].toFixed(i[2])+"")&&Ui(r,n)},d(i){i&&Nt(t)}}}function Jb(e){let t;function n(l,h){return l[2]>0?LP:TP}let r=n(e),i=r(e);return{c(){i.c(),t=so()},m(l,h){i.m(l,h),zt(l,t,h)},p(l,h){r===(r=n(l))&&i?i.p(l,h):(i.d(1),i=r(l),i&&(i.c(),i.m(t.parentNode,t)))},d(l){l&&Nt(t),i.d(l)}}}function PP(e){let t,n,r,i=vo(e[0]),l=[];for(let y=0;y{"colorScale"in h&&n(0,r=h.colorScale),"limits"in h&&n(1,i=h.limits),"decimalPlaces"in h&&n(2,l=h.decimalPlaces)},[r,i,l]}class AP extends an{constructor(t){super(),sn(this,t,MP,PP,Xe,{colorScale:0,limits:1,decimalPlaces:2})}}function rl(e){if(e==null||e==null)throw new Error("Oops, notNull given something null");return e}var Qb=Object.prototype.toString,bS=function(t){var n=Qb.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Qb.call(t.callee)==="[object Function]"),r},k_,$b;function kP(){if($b)return k_;$b=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=bS,i=Object.prototype.propertyIsEnumerable,l=!i.call({toString:null},"toString"),h=i.call(function(){},"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],y=function(P){var D=P.constructor;return D&&D.prototype===P},w={$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 P in window)try{if(!w["$"+P]&&t.call(window,P)&&window[P]!==null&&typeof window[P]=="object")try{y(window[P])}catch{return!0}}catch{return!0}return!1}(),C=function(P){if(typeof window>"u"||!S)return y(P);try{return y(P)}catch{return!1}};e=function(D){var N=D!==null&&typeof D=="object",K=n.call(D)==="[object Function]",Y=r(D),J=N&&n.call(D)==="[object String]",B=[];if(!N&&!K&&!Y)throw new TypeError("Object.keys called on a non-object");var G=h&&K;if(J&&D.length>0&&!t.call(D,0))for(var H=0;H0)for(var at=0;at"u"||!Ni?Mn:Ni(Uint8Array),bc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Mn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Mn:ArrayBuffer,"%ArrayIteratorPrototype%":Wh&&Ni?Ni([][Symbol.iterator]()):Mn,"%AsyncFromSyncIteratorPrototype%":Mn,"%AsyncFunction%":Jh,"%AsyncGenerator%":Jh,"%AsyncGeneratorFunction%":Jh,"%AsyncIteratorPrototype%":Jh,"%Atomics%":typeof Atomics>"u"?Mn:Atomics,"%BigInt%":typeof BigInt>"u"?Mn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Mn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Mn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Mn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":tM,"%eval%":eval,"%EvalError%":eM,"%Float32Array%":typeof Float32Array>"u"?Mn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Mn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Mn:FinalizationRegistry,"%Function%":SS,"%GeneratorFunction%":Jh,"%Int8Array%":typeof Int8Array>"u"?Mn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Mn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Mn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Wh&&Ni?Ni(Ni([][Symbol.iterator]())):Mn,"%JSON%":typeof JSON=="object"?JSON:Mn,"%Map%":typeof Map>"u"?Mn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Wh||!Ni?Mn:Ni(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Mn:Promise,"%Proxy%":typeof Proxy>"u"?Mn:Proxy,"%RangeError%":nM,"%ReferenceError%":rM,"%Reflect%":typeof Reflect>"u"?Mn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Mn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Wh||!Ni?Mn:Ni(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Mn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Wh&&Ni?Ni(""[Symbol.iterator]()):Mn,"%Symbol%":Wh?Symbol:Mn,"%SyntaxError%":of,"%ThrowTypeError%":oM,"%TypedArray%":aM,"%TypeError%":nf,"%Uint8Array%":typeof Uint8Array>"u"?Mn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Mn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Mn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Mn:Uint32Array,"%URIError%":iM,"%WeakMap%":typeof WeakMap>"u"?Mn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Mn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Mn:WeakSet};if(Ni)try{null.error}catch(e){var lM=Ni(Ni(e));bc["%Error.prototype%"]=lM}var uM=function e(t){var n;if(t==="%AsyncFunction%")n=R_("async function () {}");else if(t==="%GeneratorFunction%")n=R_("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=R_("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Ni&&(n=Ni(i.prototype))}return bc[t]=n,n},ix={__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"]},Dd=sv,bg=wS,cM=Dd.call(Function.call,Array.prototype.concat),hM=Dd.call(Function.apply,Array.prototype.splice),ox=Dd.call(Function.call,String.prototype.replace),xg=Dd.call(Function.call,String.prototype.slice),fM=Dd.call(Function.call,RegExp.prototype.exec),pM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,dM=/\\(\\)?/g,mM=function(t){var n=xg(t,0,1),r=xg(t,-1);if(n==="%"&&r!=="%")throw new of("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new of("invalid intrinsic syntax, expected opening `%`");var i=[];return ox(t,pM,function(l,h,u,y){i[i.length]=u?ox(y,dM,"$1"):h||l}),i},gM=function(t,n){var r=t,i;if(bg(ix,r)&&(i=ix[r],r="%"+i[0]+"%"),bg(bc,r)){var l=bc[r];if(l===Jh&&(l=uM(r)),typeof l>"u"&&!n)throw new nf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:l}}throw new of("intrinsic "+t+" does not exist!")},fl=function(t,n){if(typeof t!="string"||t.length===0)throw new nf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new nf('"allowMissing" argument must be a boolean');if(fM(/^%?[^%]*%?$/,t)===null)throw new of("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=mM(t),i=r.length>0?r[0]:"",l=gM("%"+i+"%",n),h=l.name,u=l.value,y=!1,w=l.alias;w&&(i=w[0],hM(r,cM([0,1],w)));for(var S=1,C=!0;S=r.length){var K=vc(u,P);C=!!K,C&&"get"in K&&!("originalValue"in K.get)?u=K.get:u=u[P]}else C=bg(u,P),u=u[P];C&&!y&&(bc[h]=u)}}return u},O_,sx;function av(){if(sx)return O_;sx=1;var e=fl,t=e("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return O_=t,O_}var yM=fl,ug=yM("%Object.getOwnPropertyDescriptor%",!0);if(ug)try{ug([],"length")}catch{ug=null}var lv=ug,ax=av(),_M=xS,Hh=Uu,lx=lv,uv=function(t,n,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Hh("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Hh("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hh("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hh("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hh("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hh("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,y=!!lx&&lx(t,n);if(ax)ax(t,n,{configurable:h===null&&y?y.configurable:!h,enumerable:i===null&&y?y.enumerable:!i,value:r,writable:l===null&&y?y.writable:!l});else if(u||!i&&!l&&!h)t[n]=r;else throw new _M("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},l0=av(),ES=function(){return!!l0};ES.hasArrayLengthDefineBug=function(){if(!l0)return null;try{return l0([],"length",{value:1}).length!==1}catch{return!0}};var cv=ES,vM=iv,bM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",xM=Object.prototype.toString,wM=Array.prototype.concat,ux=uv,SM=function(e){return typeof e=="function"&&xM.call(e)==="[object Function]"},IS=cv(),EM=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!SM(r)||!r())return}IS?ux(e,t,n,!0):ux(e,t,n)},CS=function(e,t){var n=arguments.length>2?arguments[2]:{},r=vM(t);bM&&(r=wM.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i4294967295||TM(n)!==n)throw new fx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,l=!0;if("length"in t&&hx){var h=hx(t,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(l=!1)}return(i||l||!r)&&(CM?cx(t,"length",n,!0,!0):cx(t,"length",n)),t};(function(e){var t=sv,n=fl,r=LM,i=Uu,l=n("%Function.prototype.apply%"),h=n("%Function.prototype.call%"),u=n("%Reflect.apply%",!0)||t.call(h,l),y=av(),w=n("%Math.max%");e.exports=function(P){if(typeof P!="function")throw new i("a function is required");var D=u(t,h,arguments);return r(D,1+w(0,P.length-(arguments.length-1)),!0)};var S=function(){return u(t,l,arguments)};y?y(e.exports,"apply",{value:S}):e.exports.apply=S})(TS);var kf=TS.exports,LS=fl,PS=kf,PM=PS(LS("String.prototype.indexOf")),aa=function(t,n){var r=LS(t,!!n);return typeof r=="function"&&PM(t,".prototype.")>-1?PS(r):r},MM=iv,MS=ey(),AS=aa,px=Object,AM=AS("Array.prototype.push"),dx=AS("Object.prototype.propertyIsEnumerable"),kM=MS?Object.getOwnPropertySymbols:null,kS=function(t,n){if(t==null)throw new TypeError("target must be an object");var r=px(t);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||ZM)&&(HM?mx(t,"name",n,!0,!0):mx(t,"name",n)),t},KM=YM,JM=Uu,QM=Object,OS=KM(function(){if(this==null||this!==QM(this))throw new JM("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0),$M=OS,tA=Fc.supportsDescriptors,eA=Object.getOwnPropertyDescriptor,zS=function(){if(tA&&/a/mig.flags==="gim"){var t=eA(RegExp.prototype,"flags");if(t&&typeof t.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 t.get}}return $M},nA=Fc.supportsDescriptors,rA=zS,iA=Object.getOwnPropertyDescriptor,oA=Object.defineProperty,sA=TypeError,gx=Object.getPrototypeOf,aA=/a/,lA=function(){if(!nA||!gx)throw new sA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=rA(),n=gx(aA),r=iA(n,"flags");return(!r||r.get!==t)&&oA(n,"flags",{configurable:!0,enumerable:!1,get:t}),t},uA=Fc,cA=kf,hA=OS,FS=zS,fA=lA,BS=cA(FS());uA(BS,{getPolyfill:FS,implementation:hA,shim:fA});var pA=BS,cg={exports:{}},dA=ey,Bc=function(){return dA()&&!!Symbol.toStringTag},mA=Bc(),gA=aa,u0=gA("Object.prototype.toString"),ny=function(t){return mA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:u0(t)==="[object Arguments]"},VS=function(t){return ny(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&u0(t)!=="[object Array]"&&u0(t.callee)==="[object Function]"},yA=function(){return ny(arguments)}();ny.isLegacyArguments=VS;var US=yA?ny:VS;const _A={},vA=Object.freeze(Object.defineProperty({__proto__:null,default:_A},Symbol.toStringTag,{value:"Module"})),bA=$g(vA);var hv=typeof Map=="function"&&Map.prototype,F_=Object.getOwnPropertyDescriptor&&hv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,wg=hv&&F_&&typeof F_.get=="function"?F_.get:null,yx=hv&&Map.prototype.forEach,fv=typeof Set=="function"&&Set.prototype,B_=Object.getOwnPropertyDescriptor&&fv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Sg=fv&&B_&&typeof B_.get=="function"?B_.get:null,_x=fv&&Set.prototype.forEach,xA=typeof WeakMap=="function"&&WeakMap.prototype,od=xA?WeakMap.prototype.has:null,wA=typeof WeakSet=="function"&&WeakSet.prototype,sd=wA?WeakSet.prototype.has:null,SA=typeof WeakRef=="function"&&WeakRef.prototype,vx=SA?WeakRef.prototype.deref:null,EA=Boolean.prototype.valueOf,IA=Object.prototype.toString,CA=Function.prototype.toString,TA=String.prototype.match,pv=String.prototype.slice,Su=String.prototype.replace,LA=String.prototype.toUpperCase,bx=String.prototype.toLowerCase,GS=RegExp.prototype.test,xx=Array.prototype.concat,$a=Array.prototype.join,PA=Array.prototype.slice,wx=Math.floor,c0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,V_=Object.getOwnPropertySymbols,h0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,sf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",wo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===sf||"symbol")?Symbol.toStringTag:null,qS=Object.prototype.propertyIsEnumerable,Sx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function Ex(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||GS.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var r=e<0?-wx(-e):wx(e);if(r!==e){var i=String(r),l=pv.call(t,i.length+1);return Su.call(i,n,"$&_")+"."+Su.call(Su.call(l,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Su.call(t,n,"$&_")}var f0=bA,Ix=f0.custom,Cx=WS(Ix)?Ix:null,MA=function e(t,n,r,i){var l=n||{};if(bu(l,"quoteStyle")&&l.quoteStyle!=="single"&&l.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(bu(l,"maxStringLength")&&(typeof l.maxStringLength=="number"?l.maxStringLength<0&&l.maxStringLength!==1/0:l.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var h=bu(l,"customInspect")?l.customInspect:!0;if(typeof h!="boolean"&&h!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(bu(l,"indent")&&l.indent!==null&&l.indent!==" "&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(bu(l,"numericSeparator")&&typeof l.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=l.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return ZS(t,l);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var y=String(t);return u?Ex(t,y):y}if(typeof t=="bigint"){var w=String(t)+"n";return u?Ex(t,w):w}var S=typeof l.depth>"u"?5:l.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof t=="object")return p0(t)?"[Array]":"[Object]";var C=XA(l,r);if(typeof i>"u")i=[];else if(HS(i,t)>=0)return"[Circular]";function P(Qt,Tt,re){if(Tt&&(i=PA.call(i),i.push(Tt)),re){var fe={depth:l.depth};return bu(l,"quoteStyle")&&(fe.quoteStyle=l.quoteStyle),e(Qt,fe,r+1,i)}return e(Qt,l,r+1,i)}if(typeof t=="function"&&!Tx(t)){var D=BA(t),N=Ym(t,P);return"[Function"+(D?": "+D:" (anonymous)")+"]"+(N.length>0?" { "+$a.call(N,", ")+" }":"")}if(WS(t)){var K=sf?Su.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):h0.call(t);return typeof t=="object"&&!sf?Up(K):K}if(WA(t)){for(var Y="<"+bx.call(String(t.nodeName)),J=t.attributes||[],B=0;B",Y}if(p0(t)){if(t.length===0)return"[]";var G=Ym(t,P);return C&&!ZA(G)?"["+d0(G,C)+"]":"[ "+$a.call(G,", ")+" ]"}if(DA(t)){var H=Ym(t,P);return!("cause"in Error.prototype)&&"cause"in t&&!qS.call(t,"cause")?"{ ["+String(t)+"] "+$a.call(xx.call("[cause]: "+P(t.cause),H),", ")+" }":H.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+$a.call(H,", ")+" }"}if(typeof t=="object"&&h){if(Cx&&typeof t[Cx]=="function"&&f0)return f0(t,{depth:S-r});if(h!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(VA(t)){var at=[];return yx&&yx.call(t,function(Qt,Tt){at.push(P(Tt,t,!0)+" => "+P(Qt,t))}),Lx("Map",wg.call(t),at,C)}if(qA(t)){var gt=[];return _x&&_x.call(t,function(Qt){gt.push(P(Qt,t))}),Lx("Set",Sg.call(t),gt,C)}if(UA(t))return U_("WeakMap");if(jA(t))return U_("WeakSet");if(GA(t))return U_("WeakRef");if(NA(t))return Up(P(Number(t)));if(zA(t))return Up(P(c0.call(t)));if(OA(t))return Up(EA.call(t));if(RA(t))return Up(P(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===Md)return"{ [object globalThis] }";if(!kA(t)&&!Tx(t)){var ft=Ym(t,P),rt=Sx?Sx(t)===Object.prototype:t instanceof Object||t.constructor===Object,mt=t instanceof Object?"":"null prototype",Et=!rt&&wo&&Object(t)===t&&wo in t?pv.call(Gu(t),8,-1):mt?"Object":"",$=rt||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",Pt=$+(Et||mt?"["+$a.call(xx.call([],Et||[],mt||[]),": ")+"] ":"");return ft.length===0?Pt+"{}":C?Pt+"{"+d0(ft,C)+"}":Pt+"{ "+$a.call(ft,", ")+" }"}return String(t)};function jS(e,t,n){var r=(n.quoteStyle||t)==="double"?'"':"'";return r+e+r}function AA(e){return Su.call(String(e),/"/g,""")}function p0(e){return Gu(e)==="[object Array]"&&(!wo||!(typeof e=="object"&&wo in e))}function kA(e){return Gu(e)==="[object Date]"&&(!wo||!(typeof e=="object"&&wo in e))}function Tx(e){return Gu(e)==="[object RegExp]"&&(!wo||!(typeof e=="object"&&wo in e))}function DA(e){return Gu(e)==="[object Error]"&&(!wo||!(typeof e=="object"&&wo in e))}function RA(e){return Gu(e)==="[object String]"&&(!wo||!(typeof e=="object"&&wo in e))}function NA(e){return Gu(e)==="[object Number]"&&(!wo||!(typeof e=="object"&&wo in e))}function OA(e){return Gu(e)==="[object Boolean]"&&(!wo||!(typeof e=="object"&&wo in e))}function WS(e){if(sf)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!h0)return!1;try{return h0.call(e),!0}catch{}return!1}function zA(e){if(!e||typeof e!="object"||!c0)return!1;try{return c0.call(e),!0}catch{}return!1}var FA=Object.prototype.hasOwnProperty||function(e){return e in this};function bu(e,t){return FA.call(e,t)}function Gu(e){return IA.call(e)}function BA(e){if(e.name)return e.name;var t=TA.call(CA.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function HS(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;nt.maxStringLength){var n=e.length-t.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return ZS(pv.call(e,0,t.maxStringLength),t)+r}var i=Su.call(Su.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,HA);return jS(i,"single",t)}function HA(e){var t=e.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return n?"\\"+n:"\\x"+(t<16?"0":"")+LA.call(t.toString(16))}function Up(e){return"Object("+e+")"}function U_(e){return e+" { ? }"}function Lx(e,t,n,r){var i=r?d0(n,r):$a.call(n,", ");return e+" ("+t+") {"+i+"}"}function ZA(e){for(var t=0;t=0)return!1;return!0}function XA(e,t){var n;if(e.indent===" ")n=" ";else if(typeof e.indent=="number"&&e.indent>0)n=$a.call(Array(e.indent+1)," ");else return null;return{base:n,prev:$a.call(Array(t+1),n)}}function d0(e,t){if(e.length===0)return"";var n=` `+t.prev+t.base;return n+$a.call(e,","+n)+` -`+t.prev}function Ym(e,t){var n=p0(e),r=[];if(n){r.length=e.length;for(var o=0;o=r)return n+1;var o=Nx(t,n);if(o<55296||o>56319)return n+1;var l=Nx(t,n+1);return l<56320||l>57343?n+1:n+2},q_=function(t){var n=0;return{next:function(){var o=n>=t.length,l;return o||(l=t[n],n+=1),{done:o,value:l}}}},Ox=function(t,n){if(yk(t)||Ax(t))return q_(t);if(_k(t)){var r=0;return{next:function(){var l=wk(t,r),h=xk(t,r,l);return r=l,{done:l>t.length,value:h}}}}if(n&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!vk&&!bk)cg.exports=function(t){if(t!=null)return Ox(t,!0)};else{var Sk=$S,Ek=eE,zx=_a("Map.prototype.forEach",!0),Fx=_a("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Bx=_a("Map.prototype.iterator",!0),Vx=_a("Set.prototype.iterator",!0);var Ux=_a("Map.prototype.@@iterator",!0)||_a("Map.prototype._es6-shim iterator_",!0),Gx=_a("Set.prototype.@@iterator",!0)||_a("Set.prototype._es6-shim iterator_",!0),Ik=function(t){if(Sk(t)){if(Bx)return kx(Bx(t));if(Ux)return Ux(t);if(zx){var n=[];return zx(t,function(o,l){Rx(n,[l,o])}),q_(n)}}if(Ek(t)){if(Vx)return kx(Vx(t));if(Gx)return Gx(t);if(Fx){var r=[];return Fx(t,function(o){Rx(r,o)}),q_(r)}}};cg.exports=function(t){return Ik(t)||Ox(t)}}}var Ck=cg.exports,qx=function(e){return e!==e},nE=function(t,n){return t===0&&n===0?1/t===1/n:!!(t===n||qx(t)&&qx(n))},Tk=nE,rE=function(){return typeof Object.is=="function"?Object.is:Tk},Lk=rE,Pk=Fc,Mk=function(){var t=Lk();return Pk(Object,{is:t},{is:function(){return Object.is!==t}}),t},Ak=Fc,kk=kf,Dk=nE,iE=rE,Rk=Mk,oE=kk(iE(),Object);Ak(oE,{getPolyfill:iE,implementation:Dk,shim:Rk});var Nk=oE,Ok=kf,sE=aa,zk=hl,m0=zk("%ArrayBuffer%",!0),hg=sE("ArrayBuffer.prototype.byteLength",!0),Fk=sE("Object.prototype.toString"),jx=!!m0&&!hg&&new m0(0).slice,Wx=!!jx&&Ok(jx),aE=hg||Wx?function(t){if(!t||typeof t!="object")return!1;try{return hg?hg(t):Wx(t,0),!0}catch{return!1}}:m0?function(t){return Fk(t)==="[object ArrayBuffer]"}:function(t){return!1},Bk=Date.prototype.getDay,Vk=function(t){try{return Bk.call(t),!0}catch{return!1}},Uk=Object.prototype.toString,Gk="[object Date]",qk=Bc(),jk=function(t){return typeof t!="object"||t===null?!1:qk?Vk(t):Uk.call(t)===Gk},g0=aa,lE=Bc(),uE,cE,y0,_0;if(lE){uE=g0("Object.prototype.hasOwnProperty"),cE=g0("RegExp.prototype.exec"),y0={};var j_=function(){throw y0};_0={toString:j_,valueOf:j_},typeof Symbol.toPrimitive=="symbol"&&(_0[Symbol.toPrimitive]=j_)}var Wk=g0("Object.prototype.toString"),Hk=Object.getOwnPropertyDescriptor,Zk="[object RegExp]",Xk=lE?function(t){if(!t||typeof t!="object")return!1;var n=Hk(t,"lastIndex"),r=n&&uE(n,"value");if(!r)return!1;try{cE(t,_0)}catch(o){return o===y0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Wk(t)===Zk},Yk=aa,Hx=Yk("SharedArrayBuffer.prototype.byteLength",!0),Kk=Hx?function(t){if(!t||typeof t!="object")return!1;try{return Hx(t),!0}catch{return!1}}:function(t){return!1},Jk=Number.prototype.toString,Qk=function(t){try{return Jk.call(t),!0}catch{return!1}},$k=Object.prototype.toString,t3="[object Number]",e3=Bc(),n3=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:e3?Qk(t):$k.call(t)===t3},hE=aa,r3=hE("Boolean.prototype.toString"),i3=hE("Object.prototype.toString"),o3=function(t){try{return r3(t),!0}catch{return!1}},s3="[object Boolean]",a3=Bc(),l3=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:a3&&Symbol.toStringTag in t?o3(t):i3(t)===s3},v0={exports:{}},u3=Object.prototype.toString,c3=iv();if(c3){var h3=Symbol.prototype.toString,f3=/^Symbol\(.*\)$/,p3=function(t){return typeof t.valueOf()!="symbol"?!1:f3.test(h3.call(t))};v0.exports=function(t){if(typeof t=="symbol")return!0;if(u3.call(t)!=="[object Symbol]")return!1;try{return p3(t)}catch{return!1}}}else v0.exports=function(t){return!1};var d3=v0.exports,b0={exports:{}},Zx=typeof BigInt<"u"&&BigInt,m3=function(){return typeof Zx=="function"&&typeof BigInt=="function"&&typeof Zx(42)=="bigint"&&typeof BigInt(42)=="bigint"},g3=m3();if(g3){var y3=BigInt.prototype.valueOf,_3=function(t){try{return y3.call(t),!0}catch{}return!1};b0.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:_3(t)}}else b0.exports=function(t){return!1};var v3=b0.exports,b3=JS,x3=n3,w3=l3,S3=d3,E3=v3,I3=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(b3(t))return"String";if(x3(t))return"Number";if(w3(t))return"Boolean";if(S3(t))return"Symbol";if(E3(t))return"BigInt"},Cg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Xx=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Tg;Cg||(Tg=function(t){return!1});var x0=Cg?Cg.prototype.has:null,W_=Xx?Xx.prototype.has:null;!Tg&&!x0&&(Tg=function(t){return!1});var C3=Tg||function(t){if(!t||typeof t!="object")return!1;try{if(x0.call(t,x0),W_)try{W_.call(t,W_)}catch{return!0}return t instanceof Cg}catch{}return!1},w0={exports:{}},T3=hl,fE=aa,L3=T3("%WeakSet%",!0),H_=fE("WeakSet.prototype.has",!0);if(H_){var Z_=fE("WeakMap.prototype.has",!0);w0.exports=function(t){if(!t||typeof t!="object")return!1;try{if(H_(t,H_),Z_)try{Z_(t,Z_)}catch{return!0}return t instanceof L3}catch{}return!1}}else w0.exports=function(t){return!1};var P3=w0.exports,M3=$S,A3=eE,k3=C3,D3=P3,R3=function(t){if(t&&typeof t=="object"){if(M3(t))return"Map";if(A3(t))return"Set";if(k3(t))return"WeakMap";if(D3(t))return"WeakSet"}return!1},pE=Function.prototype.toString,$h=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,S0,fg;if(typeof $h=="function"&&typeof Object.defineProperty=="function")try{S0=Object.defineProperty({},"length",{get:function(){throw fg}}),fg={},$h(function(){throw 42},null,S0)}catch(e){e!==fg&&($h=null)}else $h=null;var N3=/^\s*class\b/,E0=function(t){try{var n=pE.call(t);return N3.test(n)}catch{return!1}},X_=function(t){try{return E0(t)?!1:(pE.call(t),!0)}catch{return!1}},pg=Object.prototype.toString,O3="[object Object]",z3="[object Function]",F3="[object GeneratorFunction]",B3="[object HTMLAllCollection]",V3="[object HTML document.all class]",U3="[object HTMLCollection]",G3=typeof Symbol=="function"&&!!Symbol.toStringTag,q3=!(0 in[,]),I0=function(){return!1};if(typeof document=="object"){var j3=document.all;pg.call(j3)===pg.call(document.all)&&(I0=function(t){if((q3||!t)&&(typeof t>"u"||typeof t=="object"))try{var n=pg.call(t);return(n===B3||n===V3||n===U3||n===O3)&&t("")==null}catch{}return!1})}var W3=$h?function(t){if(I0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{$h(t,null,S0)}catch(n){if(n!==fg)return!1}return!E0(t)&&X_(t)}:function(t){if(I0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(G3)return X_(t);if(E0(t))return!1;var n=pg.call(t);return n!==z3&&n!==F3&&!/^\[object HTML/.test(n)?!1:X_(t)},H3=W3,Z3=Object.prototype.toString,dE=Object.prototype.hasOwnProperty,X3=function(t,n,r){for(var o=0,l=t.length;o=3&&(o=r),Z3.call(t)==="[object Array]"?X3(t,n,o):typeof t=="string"?Y3(t,n,o):K3(t,n,o)},Q3=J3,$3=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Y_=$3,tD=typeof globalThis>"u"?Md:globalThis,eD=function(){for(var t=[],n=0;n"u"?Md:globalThis,C0=nD(),_v=yv("String.prototype.slice"),K_=Object.getPrototypeOf,iD=yv("Array.prototype.indexOf",!0)||function(t,n){for(var r=0;r-1?n:n!=="Object"?!1:sD(t)}return dg?oD(t):null},lD=aa,Jx=lD("ArrayBuffer.prototype.byteLength",!0),uD=aE,cD=function(t){return uD(t)?Jx?Jx(t):t.byteLength:NaN},gE=GM,fl=aa,Qx=fA,hD=hl,af=Ck,fD=YS,$x=Nk,tw=US,ew=KS,nw=aE,rw=jk,iw=Xk,ow=Kk,sw=rv,aw=I3,lw=R3,uw=aD,cw=cD,hw=fl("SharedArrayBuffer.prototype.byteLength",!0),fw=fl("Date.prototype.getTime"),J_=Object.getPrototypeOf,pw=fl("Object.prototype.toString"),Mg=hD("%Set%",!0),T0=fl("Map.prototype.has",!0),Ag=fl("Map.prototype.get",!0),dw=fl("Map.prototype.size",!0),kg=fl("Set.prototype.add",!0),yE=fl("Set.prototype.delete",!0),Dg=fl("Set.prototype.has",!0),mg=fl("Set.prototype.size",!0);function mw(e,t,n,r){for(var o=af(e),l;(l=o.next())&&!l.done;)if(xa(t,l.value,n,r))return yE(e,l.value),!0;return!1}function _E(e){if(typeof e>"u")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}function pD(e,t,n,r,o,l){var h=_E(n);if(h!=null)return h;var u=Ag(t,h),y=gE({},o,{strict:!1});return typeof u>"u"&&!T0(t,h)||!xa(r,u,y,l)?!1:!T0(e,h)&&xa(r,u,y,l)}function dD(e,t,n){var r=_E(n);return r??(Dg(t,r)&&!Dg(e,r))}function gw(e,t,n,r,o,l){for(var h=af(e),u,y;(u=h.next())&&!u.done;)if(y=u.value,xa(n,y,o,l)&&xa(r,Ag(t,y),o,l))return yE(e,y),!0;return!1}function xa(e,t,n,r){var o=n||{};if(o.strict?$x(e,t):e===t)return!0;var l=aw(e),h=aw(t);if(l!==h)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return o.strict?$x(e,t):e==t;var u=r.has(e),y=r.has(t),w;if(u&&y){if(r.get(e)===r.get(t))return!0}else w={};return u||r.set(e,w),y||r.set(t,w),yD(e,t,o,r)}function yw(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function mD(e,t,n,r){if(mg(e)!==mg(t))return!1;for(var o=af(e),l=af(t),h,u,y;(h=o.next())&&!h.done;)if(h.value&&typeof h.value=="object")y||(y=new Mg),kg(y,h.value);else if(!Dg(t,h.value)){if(n.strict||!dD(e,t,h.value))return!1;y||(y=new Mg),kg(y,h.value)}if(y){for(;(u=l.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!mw(y,u.value,n.strict,r))return!1}else if(!n.strict&&!Dg(e,u.value)&&!mw(y,u.value,n.strict,r))return!1;return mg(y)===0}return!0}function gD(e,t,n,r){if(dw(e)!==dw(t))return!1;for(var o=af(e),l=af(t),h,u,y,w,S,C;(h=o.next())&&!h.done;)if(w=h.value[0],S=h.value[1],w&&typeof w=="object")y||(y=new Mg),kg(y,w);else if(C=Ag(t,w),typeof C>"u"&&!T0(t,w)||!xa(S,C,n,r)){if(n.strict||!pD(e,t,w,S,n,r))return!1;y||(y=new Mg),kg(y,w)}if(y){for(;(u=l.next())&&!u.done;)if(w=u.value[0],C=u.value[1],w&&typeof w=="object"){if(!gw(y,e,w,C,n,r))return!1}else if(!n.strict&&(!e.has(w)||!xa(Ag(e,w),C,n,r))&&!gw(y,e,w,C,gE({},n,{strict:!1}),r))return!1;return mg(y)===0}return!0}function yD(e,t,n,r){var o,l;if(typeof e!=typeof t||e==null||t==null||pw(e)!==pw(t)||tw(e)!==tw(t))return!1;var h=ew(e),u=ew(t);if(h!==u)return!1;var y=e instanceof Error,w=t instanceof Error;if(y!==w||(y||w)&&(e.name!==t.name||e.message!==t.message))return!1;var S=iw(e),C=iw(t);if(S!==C||(S||C)&&(e.source!==t.source||Qx(e)!==Qx(t)))return!1;var P=rw(e),N=rw(t);if(P!==N||(P||N)&&fw(e)!==fw(t)||n.strict&&J_&&J_(e)!==J_(t))return!1;var R=uw(e),J=uw(t);if(R!==J)return!1;if(R||J){if(e.length!==t.length)return!1;for(o=0;o=0;o--)if(gt[o]!=ft[o])return!1;for(o=gt.length-1;o>=0;o--)if(l=gt[o],!xa(e[l],t[l],n,r))return!1;var rt=lw(e),mt=lw(t);return rt!==mt?!1:rt==="Set"||mt==="Set"?mD(e,t,n,r):rt==="Map"?gD(e,t,n,r):!0}var _D=function(t,n,r){return xa(t,n,r,fD())};const vD=ev(_D);var bD=Object.defineProperty,Xn=(e,t)=>bD(e,"name",{value:t,configurable:!0}),xD=class{constructor(t){this.direction=!1,this.compareProperties=!0;var n,r,o;this.precision=10**-((n=t==null?void 0:t.precision)!=null?n:17),this.direction=(r=t==null?void 0:t.direction)!=null?r:!1,this.compareProperties=(o=t==null?void 0:t.compareProperties)!=null?o:!0}compare(t,n){if(t.type!==n.type||!Qp(t,n))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,n.coordinates);case"LineString":return this.compareLine(t.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(t,n);case"GeometryCollection":return this.compareGeometryCollection(t,n);case"Feature":return this.compareFeature(t,n);case"FeatureCollection":return this.compareFeatureCollection(t,n);default:if(t.type.startsWith("Multi")){const r=L0(t),o=L0(n);return r.every(l=>o.some(h=>this.compare(l,h)))}}return!1}compareCoord(t,n){return t.length===n.length&&t.every((r,o)=>Math.abs(r-n[o])=0&&(r=[].concat(t.slice(o,t.length),t.slice(1,o+1))),r}comparePath(t,n){return t.every((r,o)=>this.compareCoord(r,n[o]))}comparePolygon(t,n){if(this.compareLine(t.coordinates[0],n.coordinates[0],1,!0)){const r=t.coordinates.slice(1,t.coordinates.length),o=n.coordinates.slice(1,n.coordinates.length);return r.every(l=>o.some(h=>this.compareLine(l,h,1,!0)))}return!1}compareGeometryCollection(t,n){return Qp(t.geometries,n.geometries)&&this.compareBBox(t,n)&&t.geometries.every((r,o)=>this.compare(r,n.geometries[o]))}compareFeature(t,n){return t.id===n.id&&(this.compareProperties?vD(t.properties,n.properties):!0)&&this.compareBBox(t,n)&&this.compare(t.geometry,n.geometry)}compareFeatureCollection(t,n){return Qp(t.features,n.features)&&this.compareBBox(t,n)&&t.features.every((r,o)=>this.compare(r,n.features[o]))}compareBBox(t,n){return!t.bbox&&!n.bbox||(t.bbox&&n.bbox?this.compareCoord(t.bbox,n.bbox):!1)}};Xn(xD,"GeojsonEquality");function Qp(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}Xn(Qp,"sameLength");function L0(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}Xn(L0,"explode");var _s=63710088e-1,vE={centimeters:_s*100,centimetres:_s*100,degrees:360/(2*Math.PI),feet:_s*3.28084,inches:_s*39.37,kilometers:_s/1e3,kilometres:_s/1e3,meters:_s,metres:_s,miles:_s/1609.344,millimeters:_s*1e3,millimetres:_s*1e3,nauticalmiles:_s/1852,radians:1,yards:_s*1.0936},_w={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 il(e,t,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}Xn(il,"feature");function wD(e,t,n={}){switch(e){case"Point":return Rl(t).geometry;case"LineString":return Ol(t).geometry;case"Polygon":return vv(t).geometry;case"MultiPoint":return xE(t).geometry;case"MultiLineString":return bE(t).geometry;case"MultiPolygon":return wE(t).geometry;default:throw new Error(e+" is invalid")}}Xn(wD,"geometry");function Rl(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Rg(e[0])||!Rg(e[1]))throw new Error("coordinates must contain numbers");return il({type:"Point",coordinates:e},t,n)}Xn(Rl,"point");function SD(e,t,n={}){return ry(e.map(r=>Rl(r,t)),n)}Xn(SD,"points");function vv(e,t,n={}){for(const o of e){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let l=0;lvv(r,t)),n)}Xn(ED,"polygons");function Ol(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return il({type:"LineString",coordinates:e},t,n)}Xn(Ol,"lineString");function ID(e,t,n={}){return ry(e.map(r=>Ol(r,t)),n)}Xn(ID,"lineStrings");function ry(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}Xn(ry,"featureCollection");function bE(e,t,n={}){return il({type:"MultiLineString",coordinates:e},t,n)}Xn(bE,"multiLineString");function xE(e,t,n={}){return il({type:"MultiPoint",coordinates:e},t,n)}Xn(xE,"multiPoint");function wE(e,t,n={}){return il({type:"MultiPolygon",coordinates:e},t,n)}Xn(wE,"multiPolygon");function CD(e,t,n={}){return il({type:"GeometryCollection",geometries:e},t,n)}Xn(CD,"geometryCollection");function TD(e,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,t||0);return Math.round(e*n)/n}Xn(TD,"round");function SE(e,t="kilometers"){const n=vE[t];if(!n)throw new Error(t+" units is invalid");return e*n}Xn(SE,"radiansToLength");function bv(e,t="kilometers"){const n=vE[t];if(!n)throw new Error(t+" units is invalid");return e/n}Xn(bv,"lengthToRadians");function LD(e,t){return EE(bv(e,t))}Xn(LD,"lengthToDegrees");function PD(e){let t=e%360;return t<0&&(t+=360),t}Xn(PD,"bearingToAzimuth");function EE(e){return e%(2*Math.PI)*180/Math.PI}Xn(EE,"radiansToDegrees");function MD(e){return e%360*Math.PI/180}Xn(MD,"degreesToRadians");function AD(e,t="kilometers",n="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return SE(bv(e,t),n)}Xn(AD,"convertLength");function kD(e,t="meters",n="kilometers"){if(!(e>=0))throw new Error("area must be a positive number");const r=_w[t];if(!r)throw new Error("invalid original units");const o=_w[n];if(!o)throw new Error("invalid final units");return e/r*o}Xn(kD,"convertArea");function Rg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}Xn(Rg,"isNumber");function xv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}Xn(xv,"isObject");function DD(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(t=>{if(!Rg(t))throw new Error("bbox must only contain numbers")})}Xn(DD,"validateBBox");function RD(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}Xn(RD,"validateId");var ND=Object.defineProperty,ao=(e,t)=>ND(e,"name",{value:t,configurable:!0});function Rf(e,t,n){if(e!==null)for(var r,o,l,h,u,y,w,S=0,C=0,P,N=e.type,R=N==="FeatureCollection",J=N==="Feature",Y=R?e.features.length:1,K=0;Ky||R>w||J>S){u=C,y=r,w=R,S=J,l=0;return}var Y=Ol([u,C],n.properties);if(t(Y,r,o,J,l)===!1)return!1;l++,u=C})===!1)return!1}}})}ao(TE,"segmentEach");function GD(e,t,n){var r=n,o=!1;return TE(e,function(l,h,u,y,w){o===!1&&n===void 0?r=l:r=t(r,l,h,u,y,w),o=!0}),r}ao(GD,"segmentReduce");function LE(e,t){if(!e)throw new Error("geojson is required");iy(e,function(n,r,o){if(n.geometry!==null){var l=n.geometry.type,h=n.geometry.coordinates;switch(l){case"LineString":if(t(n,r,o,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uHD(e,"name",{value:t,configurable:!0});function Sv(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const n=[1/0,1/0,-1/0,-1/0];return Rf(e,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]t in e?KD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vw=(e,t,n)=>(JD(e,typeof t!="symbol"?t+"":t,n),n);function hd(){}function PE(e){return e()}function bw(){return Object.create(null)}function oy(e){e.forEach(PE)}function ME(e){return typeof e=="function"}function QD(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function $D(e){return Object.keys(e).length===0}function t4(e,t){e.appendChild(t)}function e4(e,t,n){e.insertBefore(t,n||null)}function AE(e){e.parentNode&&e.parentNode.removeChild(e)}function xw(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function gu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function n4(e){return Array.from(e.childNodes)}function Qm(e,t,n){e.classList.toggle(t,!!n)}let Ev;function ad(e){Ev=e}const Qh=[],ww=[];let rf=[];const Sw=[],r4=Promise.resolve();let P0=!1;function i4(){P0||(P0=!0,r4.then(kE))}function M0(e){rf.push(e)}const Q_=new Set;let Zh=0;function kE(){if(Zh!==0)return;const e=Ev;do{try{for(;Zhe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),rf=t}const a4=new Set;function l4(e,t){e&&e.i&&(a4.delete(e),e.i(t))}function u4(e,t,n){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),M0(()=>{const l=e.$$.on_mount.map(PE).filter(ME);e.$$.on_destroy?e.$$.on_destroy.push(...l):oy(l),e.$$.on_mount=[]}),o.forEach(M0)}function c4(e,t){const n=e.$$;n.fragment!==null&&(s4(n.after_update),oy(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function h4(e,t){e.$$.dirty[0]===-1&&(Qh.push(e),i4(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const R=N.length?N[0]:P;return w.ctx&&o(w.ctx[C],w.ctx[C]=R)&&(!w.skip_bound&&w.bound[C]&&w.bound[C](R),S&&h4(e,C)),P}):[],w.update(),S=!0,oy(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const C=n4(t.target);w.fragment&&w.fragment.l(C),C.forEach(AE)}else w.fragment&&w.fragment.c();t.intro&&l4(e.$$.fragment),u4(e,t.target,t.anchor),kE()}ad(y)}class p4{constructor(){vw(this,"$$"),vw(this,"$$set")}$destroy(){c4(this,1),this.$destroy=hd}$on(t,n){if(!ME(n))return hd;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(t){this.$$set&&!$D(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const d4="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(d4);function m4(e){let t,n,r;return{c(){t=xw("svg"),n=xw("path"),gu(n,"stroke-width","4"),gu(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"),gu(n,"class","svelte-gzo3ar"),gu(t,"width",r=e[0]==="list"?20:void 0),gu(t,"viewBox","0 0 70 85"),gu(t,"fill","none"),gu(t,"class","svelte-gzo3ar"),Qm(t,"in-map",e[0]!=="list"),Qm(t,"list-icon",e[0]==="list")},m(o,l){e4(o,t,l),t4(t,n)},p(o,[l]){l&1&&r!==(r=o[0]==="list"?20:void 0)&&gu(t,"width",r),l&1&&Qm(t,"in-map",o[0]!=="list"),l&1&&Qm(t,"list-icon",o[0]==="list")},i:hd,o:hd,d(o){o&&AE(t)}}}function g4(e,t,n){let{displayIn:r}=t;return e.$$set=o=>{"displayIn"in o&&n(0,r=o.displayIn)},[r]}class y4 extends p4{constructor(t){super(),f4(this,t,g4,m4,QD,{displayIn:0})}}const _4=[{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"}],v4={decimalLatitude:40.123,decimalLongitude:-74.123},b4=[{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}],x4=[{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 w4(){const e=[];return _4.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...v4})}),[...e,...b4,...x4]}const S4=w4();S4.map(e=>e.verbatimCoordinates);/** +`+t.prev}function Ym(e,t){var n=p0(e),r=[];if(n){r.length=e.length;for(var i=0;i=r)return n+1;var i=Ox(t,n);if(i<55296||i>56319)return n+1;var l=Ox(t,n+1);return l<56320||l>57343?n+1:n+2},q_=function(t){var n=0;return{next:function(){var i=n>=t.length,l;return i||(l=t[n],n+=1),{done:i,value:l}}}},zx=function(t,n){if(_k(t)||kx(t))return q_(t);if(vk(t)){var r=0;return{next:function(){var l=Sk(t,r),h=wk(t,r,l);return r=l,{done:l>t.length,value:h}}}}if(n&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()};if(!bk&&!xk)cg.exports=function(t){if(t!=null)return zx(t,!0)};else{var Ek=$S,Ik=eE,Fx=_a("Map.prototype.forEach",!0),Bx=_a("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Vx=_a("Map.prototype.iterator",!0),Ux=_a("Set.prototype.iterator",!0);var Gx=_a("Map.prototype.@@iterator",!0)||_a("Map.prototype._es6-shim iterator_",!0),qx=_a("Set.prototype.@@iterator",!0)||_a("Set.prototype._es6-shim iterator_",!0),Ck=function(t){if(Ek(t)){if(Vx)return Dx(Vx(t));if(Gx)return Gx(t);if(Fx){var n=[];return Fx(t,function(i,l){Nx(n,[l,i])}),q_(n)}}if(Ik(t)){if(Ux)return Dx(Ux(t));if(qx)return qx(t);if(Bx){var r=[];return Bx(t,function(i){Nx(r,i)}),q_(r)}}};cg.exports=function(t){return Ck(t)||zx(t)}}}var Tk=cg.exports,jx=function(e){return e!==e},nE=function(t,n){return t===0&&n===0?1/t===1/n:!!(t===n||jx(t)&&jx(n))},Lk=nE,rE=function(){return typeof Object.is=="function"?Object.is:Lk},Pk=rE,Mk=Fc,Ak=function(){var t=Pk();return Mk(Object,{is:t},{is:function(){return Object.is!==t}}),t},kk=Fc,Dk=kf,Rk=nE,iE=rE,Nk=Ak,oE=Dk(iE(),Object);kk(oE,{getPolyfill:iE,implementation:Rk,shim:Nk});var Ok=oE,zk=kf,sE=aa,Fk=fl,m0=Fk("%ArrayBuffer%",!0),hg=sE("ArrayBuffer.prototype.byteLength",!0),Bk=sE("Object.prototype.toString"),Wx=!!m0&&!hg&&new m0(0).slice,Hx=!!Wx&&zk(Wx),aE=hg||Hx?function(t){if(!t||typeof t!="object")return!1;try{return hg?hg(t):Hx(t,0),!0}catch{return!1}}:m0?function(t){return Bk(t)==="[object ArrayBuffer]"}:function(t){return!1},Vk=Date.prototype.getDay,Uk=function(t){try{return Vk.call(t),!0}catch{return!1}},Gk=Object.prototype.toString,qk="[object Date]",jk=Bc(),Wk=function(t){return typeof t!="object"||t===null?!1:jk?Uk(t):Gk.call(t)===qk},g0=aa,lE=Bc(),uE,cE,y0,_0;if(lE){uE=g0("Object.prototype.hasOwnProperty"),cE=g0("RegExp.prototype.exec"),y0={};var j_=function(){throw y0};_0={toString:j_,valueOf:j_},typeof Symbol.toPrimitive=="symbol"&&(_0[Symbol.toPrimitive]=j_)}var Hk=g0("Object.prototype.toString"),Zk=Object.getOwnPropertyDescriptor,Xk="[object RegExp]",Yk=lE?function(t){if(!t||typeof t!="object")return!1;var n=Zk(t,"lastIndex"),r=n&&uE(n,"value");if(!r)return!1;try{cE(t,_0)}catch(i){return i===y0}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Hk(t)===Xk},Kk=aa,Zx=Kk("SharedArrayBuffer.prototype.byteLength",!0),Jk=Zx?function(t){if(!t||typeof t!="object")return!1;try{return Zx(t),!0}catch{return!1}}:function(t){return!1},Qk=Number.prototype.toString,$k=function(t){try{return Qk.call(t),!0}catch{return!1}},t3=Object.prototype.toString,e3="[object Number]",n3=Bc(),r3=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:n3?$k(t):t3.call(t)===e3},hE=aa,i3=hE("Boolean.prototype.toString"),o3=hE("Object.prototype.toString"),s3=function(t){try{return i3(t),!0}catch{return!1}},a3="[object Boolean]",l3=Bc(),u3=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:l3&&Symbol.toStringTag in t?s3(t):o3(t)===a3},v0={exports:{}},c3=Object.prototype.toString,h3=ov();if(h3){var f3=Symbol.prototype.toString,p3=/^Symbol\(.*\)$/,d3=function(t){return typeof t.valueOf()!="symbol"?!1:p3.test(f3.call(t))};v0.exports=function(t){if(typeof t=="symbol")return!0;if(c3.call(t)!=="[object Symbol]")return!1;try{return d3(t)}catch{return!1}}}else v0.exports=function(t){return!1};var m3=v0.exports,b0={exports:{}},Xx=typeof BigInt<"u"&&BigInt,g3=function(){return typeof Xx=="function"&&typeof BigInt=="function"&&typeof Xx(42)=="bigint"&&typeof BigInt(42)=="bigint"},y3=g3();if(y3){var _3=BigInt.prototype.valueOf,v3=function(t){try{return _3.call(t),!0}catch{}return!1};b0.exports=function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:v3(t)}}else b0.exports=function(t){return!1};var b3=b0.exports,x3=JS,w3=r3,S3=u3,E3=m3,I3=b3,C3=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(x3(t))return"String";if(w3(t))return"Number";if(S3(t))return"Boolean";if(E3(t))return"Symbol";if(I3(t))return"BigInt"},Cg=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Yx=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Tg;Cg||(Tg=function(t){return!1});var x0=Cg?Cg.prototype.has:null,W_=Yx?Yx.prototype.has:null;!Tg&&!x0&&(Tg=function(t){return!1});var T3=Tg||function(t){if(!t||typeof t!="object")return!1;try{if(x0.call(t,x0),W_)try{W_.call(t,W_)}catch{return!0}return t instanceof Cg}catch{}return!1},w0={exports:{}},L3=fl,fE=aa,P3=L3("%WeakSet%",!0),H_=fE("WeakSet.prototype.has",!0);if(H_){var Z_=fE("WeakMap.prototype.has",!0);w0.exports=function(t){if(!t||typeof t!="object")return!1;try{if(H_(t,H_),Z_)try{Z_(t,Z_)}catch{return!0}return t instanceof P3}catch{}return!1}}else w0.exports=function(t){return!1};var M3=w0.exports,A3=$S,k3=eE,D3=T3,R3=M3,N3=function(t){if(t&&typeof t=="object"){if(A3(t))return"Map";if(k3(t))return"Set";if(D3(t))return"WeakMap";if(R3(t))return"WeakSet"}return!1},pE=Function.prototype.toString,$h=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,S0,fg;if(typeof $h=="function"&&typeof Object.defineProperty=="function")try{S0=Object.defineProperty({},"length",{get:function(){throw fg}}),fg={},$h(function(){throw 42},null,S0)}catch(e){e!==fg&&($h=null)}else $h=null;var O3=/^\s*class\b/,E0=function(t){try{var n=pE.call(t);return O3.test(n)}catch{return!1}},X_=function(t){try{return E0(t)?!1:(pE.call(t),!0)}catch{return!1}},pg=Object.prototype.toString,z3="[object Object]",F3="[object Function]",B3="[object GeneratorFunction]",V3="[object HTMLAllCollection]",U3="[object HTML document.all class]",G3="[object HTMLCollection]",q3=typeof Symbol=="function"&&!!Symbol.toStringTag,j3=!(0 in[,]),I0=function(){return!1};if(typeof document=="object"){var W3=document.all;pg.call(W3)===pg.call(document.all)&&(I0=function(t){if((j3||!t)&&(typeof t>"u"||typeof t=="object"))try{var n=pg.call(t);return(n===V3||n===U3||n===G3||n===z3)&&t("")==null}catch{}return!1})}var H3=$h?function(t){if(I0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{$h(t,null,S0)}catch(n){if(n!==fg)return!1}return!E0(t)&&X_(t)}:function(t){if(I0(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(q3)return X_(t);if(E0(t))return!1;var n=pg.call(t);return n!==F3&&n!==B3&&!/^\[object HTML/.test(n)?!1:X_(t)},Z3=H3,X3=Object.prototype.toString,dE=Object.prototype.hasOwnProperty,Y3=function(t,n,r){for(var i=0,l=t.length;i=3&&(i=r),X3.call(t)==="[object Array]"?Y3(t,n,i):typeof t=="string"?K3(t,n,i):J3(t,n,i)},$3=Q3,tD=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Y_=tD,eD=typeof globalThis>"u"?Md:globalThis,nD=function(){for(var t=[],n=0;n"u"?Md:globalThis,C0=rD(),vv=_v("String.prototype.slice"),K_=Object.getPrototypeOf,oD=_v("Array.prototype.indexOf",!0)||function(t,n){for(var r=0;r-1?n:n!=="Object"?!1:aD(t)}return dg?sD(t):null},uD=aa,Qx=uD("ArrayBuffer.prototype.byteLength",!0),cD=aE,hD=function(t){return cD(t)?Qx?Qx(t):t.byteLength:NaN},gE=qM,pl=aa,$x=pA,fD=fl,af=Tk,pD=YS,tw=Ok,ew=US,nw=KS,rw=aE,iw=Wk,ow=Yk,sw=Jk,aw=iv,lw=C3,uw=N3,cw=lD,hw=hD,fw=pl("SharedArrayBuffer.prototype.byteLength",!0),pw=pl("Date.prototype.getTime"),J_=Object.getPrototypeOf,dw=pl("Object.prototype.toString"),Mg=fD("%Set%",!0),T0=pl("Map.prototype.has",!0),Ag=pl("Map.prototype.get",!0),mw=pl("Map.prototype.size",!0),kg=pl("Set.prototype.add",!0),yE=pl("Set.prototype.delete",!0),Dg=pl("Set.prototype.has",!0),mg=pl("Set.prototype.size",!0);function gw(e,t,n,r){for(var i=af(e),l;(l=i.next())&&!l.done;)if(xa(t,l.value,n,r))return yE(e,l.value),!0;return!1}function _E(e){if(typeof e>"u")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}function dD(e,t,n,r,i,l){var h=_E(n);if(h!=null)return h;var u=Ag(t,h),y=gE({},i,{strict:!1});return typeof u>"u"&&!T0(t,h)||!xa(r,u,y,l)?!1:!T0(e,h)&&xa(r,u,y,l)}function mD(e,t,n){var r=_E(n);return r??(Dg(t,r)&&!Dg(e,r))}function yw(e,t,n,r,i,l){for(var h=af(e),u,y;(u=h.next())&&!u.done;)if(y=u.value,xa(n,y,i,l)&&xa(r,Ag(t,y),i,l))return yE(e,y),!0;return!1}function xa(e,t,n,r){var i=n||{};if(i.strict?tw(e,t):e===t)return!0;var l=lw(e),h=lw(t);if(l!==h)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return i.strict?tw(e,t):e==t;var u=r.has(e),y=r.has(t),w;if(u&&y){if(r.get(e)===r.get(t))return!0}else w={};return u||r.set(e,w),y||r.set(t,w),_D(e,t,i,r)}function _w(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function gD(e,t,n,r){if(mg(e)!==mg(t))return!1;for(var i=af(e),l=af(t),h,u,y;(h=i.next())&&!h.done;)if(h.value&&typeof h.value=="object")y||(y=new Mg),kg(y,h.value);else if(!Dg(t,h.value)){if(n.strict||!mD(e,t,h.value))return!1;y||(y=new Mg),kg(y,h.value)}if(y){for(;(u=l.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!gw(y,u.value,n.strict,r))return!1}else if(!n.strict&&!Dg(e,u.value)&&!gw(y,u.value,n.strict,r))return!1;return mg(y)===0}return!0}function yD(e,t,n,r){if(mw(e)!==mw(t))return!1;for(var i=af(e),l=af(t),h,u,y,w,S,C;(h=i.next())&&!h.done;)if(w=h.value[0],S=h.value[1],w&&typeof w=="object")y||(y=new Mg),kg(y,w);else if(C=Ag(t,w),typeof C>"u"&&!T0(t,w)||!xa(S,C,n,r)){if(n.strict||!dD(e,t,w,S,n,r))return!1;y||(y=new Mg),kg(y,w)}if(y){for(;(u=l.next())&&!u.done;)if(w=u.value[0],C=u.value[1],w&&typeof w=="object"){if(!yw(y,e,w,C,n,r))return!1}else if(!n.strict&&(!e.has(w)||!xa(Ag(e,w),C,n,r))&&!yw(y,e,w,C,gE({},n,{strict:!1}),r))return!1;return mg(y)===0}return!0}function _D(e,t,n,r){var i,l;if(typeof e!=typeof t||e==null||t==null||dw(e)!==dw(t)||ew(e)!==ew(t))return!1;var h=nw(e),u=nw(t);if(h!==u)return!1;var y=e instanceof Error,w=t instanceof Error;if(y!==w||(y||w)&&(e.name!==t.name||e.message!==t.message))return!1;var S=ow(e),C=ow(t);if(S!==C||(S||C)&&(e.source!==t.source||$x(e)!==$x(t)))return!1;var P=iw(e),D=iw(t);if(P!==D||(P||D)&&pw(e)!==pw(t)||n.strict&&J_&&J_(e)!==J_(t))return!1;var N=cw(e),K=cw(t);if(N!==K)return!1;if(N||K){if(e.length!==t.length)return!1;for(i=0;i=0;i--)if(gt[i]!=ft[i])return!1;for(i=gt.length-1;i>=0;i--)if(l=gt[i],!xa(e[l],t[l],n,r))return!1;var rt=uw(e),mt=uw(t);return rt!==mt?!1:rt==="Set"||mt==="Set"?gD(e,t,n,r):rt==="Map"?yD(e,t,n,r):!0}var vD=function(t,n,r){return xa(t,n,r,pD())};const bD=nv(vD);var xD=Object.defineProperty,Xn=(e,t)=>xD(e,"name",{value:t,configurable:!0}),wD=class{constructor(t){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=t==null?void 0:t.precision)!=null?n:17),this.direction=(r=t==null?void 0:t.direction)!=null?r:!1,this.compareProperties=(i=t==null?void 0:t.compareProperties)!=null?i:!0}compare(t,n){if(t.type!==n.type||!Qp(t,n))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,n.coordinates);case"LineString":return this.compareLine(t.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(t,n);case"GeometryCollection":return this.compareGeometryCollection(t,n);case"Feature":return this.compareFeature(t,n);case"FeatureCollection":return this.compareFeatureCollection(t,n);default:if(t.type.startsWith("Multi")){const r=L0(t),i=L0(n);return r.every(l=>i.some(h=>this.compare(l,h)))}}return!1}compareCoord(t,n){return t.length===n.length&&t.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(t.slice(i,t.length),t.slice(1,i+1))),r}comparePath(t,n){return t.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(t,n){if(this.compareLine(t.coordinates[0],n.coordinates[0],1,!0)){const r=t.coordinates.slice(1,t.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(l=>i.some(h=>this.compareLine(l,h,1,!0)))}return!1}compareGeometryCollection(t,n){return Qp(t.geometries,n.geometries)&&this.compareBBox(t,n)&&t.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(t,n){return t.id===n.id&&(this.compareProperties?bD(t.properties,n.properties):!0)&&this.compareBBox(t,n)&&this.compare(t.geometry,n.geometry)}compareFeatureCollection(t,n){return Qp(t.features,n.features)&&this.compareBBox(t,n)&&t.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(t,n){return!t.bbox&&!n.bbox||(t.bbox&&n.bbox?this.compareCoord(t.bbox,n.bbox):!1)}};Xn(wD,"GeojsonEquality");function Qp(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}Xn(Qp,"sameLength");function L0(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}Xn(L0,"explode");var _s=63710088e-1,vE={centimeters:_s*100,centimetres:_s*100,degrees:360/(2*Math.PI),feet:_s*3.28084,inches:_s*39.37,kilometers:_s/1e3,kilometres:_s/1e3,meters:_s,metres:_s,miles:_s/1609.344,millimeters:_s*1e3,millimetres:_s*1e3,nauticalmiles:_s/1852,radians:1,yards:_s*1.0936},vw={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 il(e,t,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}Xn(il,"feature");function SD(e,t,n={}){switch(e){case"Point":return Nl(t).geometry;case"LineString":return Fl(t).geometry;case"Polygon":return bv(t).geometry;case"MultiPoint":return xE(t).geometry;case"MultiLineString":return bE(t).geometry;case"MultiPolygon":return wE(t).geometry;default:throw new Error(e+" is invalid")}}Xn(SD,"geometry");function Nl(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Rg(e[0])||!Rg(e[1]))throw new Error("coordinates must contain numbers");return il({type:"Point",coordinates:e},t,n)}Xn(Nl,"point");function ED(e,t,n={}){return ry(e.map(r=>Nl(r,t)),n)}Xn(ED,"points");function bv(e,t,n={}){for(const i of e){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 l=0;lbv(r,t)),n)}Xn(ID,"polygons");function Fl(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return il({type:"LineString",coordinates:e},t,n)}Xn(Fl,"lineString");function CD(e,t,n={}){return ry(e.map(r=>Fl(r,t)),n)}Xn(CD,"lineStrings");function ry(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}Xn(ry,"featureCollection");function bE(e,t,n={}){return il({type:"MultiLineString",coordinates:e},t,n)}Xn(bE,"multiLineString");function xE(e,t,n={}){return il({type:"MultiPoint",coordinates:e},t,n)}Xn(xE,"multiPoint");function wE(e,t,n={}){return il({type:"MultiPolygon",coordinates:e},t,n)}Xn(wE,"multiPolygon");function TD(e,t,n={}){return il({type:"GeometryCollection",geometries:e},t,n)}Xn(TD,"geometryCollection");function LD(e,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,t||0);return Math.round(e*n)/n}Xn(LD,"round");function SE(e,t="kilometers"){const n=vE[t];if(!n)throw new Error(t+" units is invalid");return e*n}Xn(SE,"radiansToLength");function xv(e,t="kilometers"){const n=vE[t];if(!n)throw new Error(t+" units is invalid");return e/n}Xn(xv,"lengthToRadians");function PD(e,t){return EE(xv(e,t))}Xn(PD,"lengthToDegrees");function MD(e){let t=e%360;return t<0&&(t+=360),t}Xn(MD,"bearingToAzimuth");function EE(e){return e%(2*Math.PI)*180/Math.PI}Xn(EE,"radiansToDegrees");function AD(e){return e%360*Math.PI/180}Xn(AD,"degreesToRadians");function kD(e,t="kilometers",n="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return SE(xv(e,t),n)}Xn(kD,"convertLength");function DD(e,t="meters",n="kilometers"){if(!(e>=0))throw new Error("area must be a positive number");const r=vw[t];if(!r)throw new Error("invalid original units");const i=vw[n];if(!i)throw new Error("invalid final units");return e/r*i}Xn(DD,"convertArea");function Rg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}Xn(Rg,"isNumber");function wv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}Xn(wv,"isObject");function RD(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(t=>{if(!Rg(t))throw new Error("bbox must only contain numbers")})}Xn(RD,"validateBBox");function ND(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}Xn(ND,"validateId");var OD=Object.defineProperty,ao=(e,t)=>OD(e,"name",{value:t,configurable:!0});function Rf(e,t,n){if(e!==null)for(var r,i,l,h,u,y,w,S=0,C=0,P,D=e.type,N=D==="FeatureCollection",K=D==="Feature",Y=N?e.features.length:1,J=0;Jy||N>w||K>S){u=C,y=r,w=N,S=K,l=0;return}var Y=Fl([u,C],n.properties);if(t(Y,r,i,K,l)===!1)return!1;l++,u=C})===!1)return!1}}})}ao(TE,"segmentEach");function qD(e,t,n){var r=n,i=!1;return TE(e,function(l,h,u,y,w){i===!1&&n===void 0?r=l:r=t(r,l,h,u,y,w),i=!0}),r}ao(qD,"segmentReduce");function LE(e,t){if(!e)throw new Error("geojson is required");iy(e,function(n,r,i){if(n.geometry!==null){var l=n.geometry.type,h=n.geometry.coordinates;switch(l){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uZD(e,"name",{value:t,configurable:!0});function Ev(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const n=[1/0,1/0,-1/0,-1/0];return Rf(e,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]t in e?JD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bw=(e,t,n)=>(QD(e,typeof t!="symbol"?t+"":t,n),n);function hd(){}function PE(e){return e()}function xw(){return Object.create(null)}function oy(e){e.forEach(PE)}function ME(e){return typeof e=="function"}function $D(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function t4(e){return Object.keys(e).length===0}function e4(e,t){e.appendChild(t)}function n4(e,t,n){e.insertBefore(t,n||null)}function AE(e){e.parentNode&&e.parentNode.removeChild(e)}function ww(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function yu(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function r4(e){return Array.from(e.childNodes)}function Qm(e,t,n){e.classList.toggle(t,!!n)}let Iv;function ad(e){Iv=e}const Qh=[],Sw=[];let rf=[];const Ew=[],i4=Promise.resolve();let P0=!1;function o4(){P0||(P0=!0,i4.then(kE))}function M0(e){rf.push(e)}const Q_=new Set;let Zh=0;function kE(){if(Zh!==0)return;const e=Iv;do{try{for(;Zhe.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),rf=t}const l4=new Set;function u4(e,t){e&&e.i&&(l4.delete(e),e.i(t))}function c4(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),M0(()=>{const l=e.$$.on_mount.map(PE).filter(ME);e.$$.on_destroy?e.$$.on_destroy.push(...l):oy(l),e.$$.on_mount=[]}),i.forEach(M0)}function h4(e,t){const n=e.$$;n.fragment!==null&&(a4(n.after_update),oy(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function f4(e,t){e.$$.dirty[0]===-1&&(Qh.push(e),o4(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const N=D.length?D[0]:P;return w.ctx&&i(w.ctx[C],w.ctx[C]=N)&&(!w.skip_bound&&w.bound[C]&&w.bound[C](N),S&&f4(e,C)),P}):[],w.update(),S=!0,oy(w.before_update),w.fragment=r?r(w.ctx):!1,t.target){if(t.hydrate){const C=r4(t.target);w.fragment&&w.fragment.l(C),C.forEach(AE)}else w.fragment&&w.fragment.c();t.intro&&u4(e.$$.fragment),c4(e,t.target,t.anchor),kE()}ad(y)}class d4{constructor(){bw(this,"$$"),bw(this,"$$set")}$destroy(){h4(this,1),this.$destroy=hd}$on(t,n){if(!ME(n))return hd;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!t4(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const m4="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(m4);function g4(e){let t,n,r;return{c(){t=ww("svg"),n=ww("path"),yu(n,"stroke-width","4"),yu(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"),yu(n,"class","svelte-gzo3ar"),yu(t,"width",r=e[0]==="list"?20:void 0),yu(t,"viewBox","0 0 70 85"),yu(t,"fill","none"),yu(t,"class","svelte-gzo3ar"),Qm(t,"in-map",e[0]!=="list"),Qm(t,"list-icon",e[0]==="list")},m(i,l){n4(i,t,l),e4(t,n)},p(i,[l]){l&1&&r!==(r=i[0]==="list"?20:void 0)&&yu(t,"width",r),l&1&&Qm(t,"in-map",i[0]!=="list"),l&1&&Qm(t,"list-icon",i[0]==="list")},i:hd,o:hd,d(i){i&&AE(t)}}}function y4(e,t,n){let{displayIn:r}=t;return e.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class _4 extends d4{constructor(t){super(),p4(this,t,y4,g4,$D,{displayIn:0})}}const v4=[{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"}],b4={decimalLatitude:40.123,decimalLongitude:-74.123},x4=[{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}],w4=[{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 S4(){const e=[];return v4.forEach(t=>{t.decimalLatitude?e.push(t):e.push({...t,...b4})}),[...e,...x4,...w4]}const E4=S4();E4.map(e=>e.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -602,11 +602,11 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. -***************************************************************************** */function E4(e,t){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},r,o,l,h;return h={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function u(w){return function(S){return y([w,S])}}function y(w){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(l=w[0]&2?o.return:w[0]?o.throw||((l=o.return)&&l.call(o),0):o.next)&&!(l=l.call(o,w[1])).done)return l;switch(o=0,l&&(w=[w[0]&2,l.value]),w[0]){case 0:case 1:l=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,o=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!l||w[1]>l[0]&&w[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var u=t.right;if(t.right=u.left,u.left=t,t=u,t.right===null)break}o.right=t,o=t,t=t.right}else break}return o.right=t.left,l.left=t.right,t.left=r.right,t.right=r.left,t}function $_(e,t,n,r){var o=new Pu(e,t);if(n===null)return o.left=o.right=null,o;n=bu(e,n,r);var l=r(e,n.key);return l<0?(o.left=n.left,o.right=n,n.left=null):l>=0&&(o.right=n.right,o.left=n,n.right=null),o}function Ew(e,t,n){var r=null,o=null;if(t){t=bu(e,t,n);var l=n(t.key,e);l===0?(r=t.left,o=t.right):l<0?(o=t.right,t.right=null,r=t):(r=t.left,t.left=null,o=t)}return{left:r,right:o}}function C4(e,t,n){return t===null?e:(e===null||(t=bu(e.key,t,n),t.left=e),t)}function A0(e,t,n,r,o){if(e){r(""+t+(n?"└── ":"├── ")+o(e)+` -`);var l=t+(n?" ":"│ ");e.left&&A0(e.left,l,!1,r,o),e.right&&A0(e.right,l,!0,r,o)}}var Iv=function(){function e(t){t===void 0&&(t=I4),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=$_(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var r=new Pu(t,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var o=this._comparator,l=bu(t,this._root,o),h=o(t,l.key);return h===0?this._root=l:(h<0?(r.left=l.left,r.right=l,l.left=null):h>0&&(r.right=l.right,r.left=l,l.right=null),this._size++,this._root=r),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,r){var o;if(n===null)return null;n=bu(t,n,r);var l=r(t,n.key);return l===0?(n.left===null?o=n.right:(o=bu(t,n.left,r),o.right=n.right),this._size--,o):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=bu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,r=this._comparator;n;){var o=r(t,n.key);if(o===0)return n;o<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=bu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,r=this._comparator;n;){var o=r(t,n.key);if(o===0)return!0;o<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var r=this._root,o=[],l=!1;!l;)r!==null?(o.push(r),r=r.left):o.length!==0?(r=o.pop(),t.call(n,r),r=r.right):l=!0;return this},e.prototype.range=function(t,n,r,o){for(var l=[],h=this._comparator,u=this._root,y;l.length!==0||u;)if(u)l.push(u),u=u.left;else{if(u=l.pop(),y=h(u.key,n),y>0)break;if(h(u.key,t)>=0&&r.call(o,u))return this;u=u.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var r=n.key;return t.push(r)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var r=n.data;return t.push(r)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,r=!1,o=0,l=[];!r;)if(n)l.push(n),n=n.left;else if(l.length>0){if(n=l.pop(),o===t)return n;o++,n=n.right}else r=!0;return null},e.prototype.next=function(t){var n=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var o=this._comparator;n;){var l=o(t.key,n.key);if(l===0)break;l<0?(r=n,n=n.left):n=n.right}return r},e.prototype.prev=function(t){var n=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}for(var o=this._comparator;n;){var l=o(t.key,n.key);if(l===0)break;l<0?n=n.left:(r=n,n=n.right)}return r},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return L4(this._root)},e.prototype.load=function(t,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var o=t.length,l=this._comparator;if(r&&R0(t,n,0,o-1,l),this._root===null)this._root=k0(t,n,0,o),this._size=o;else{var h=P4(this.toList(),T4(t,n),l);o=this._size+o,this._root=D0({head:h},0,o)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(r){return String(r.key)});var n=[];return A0(this._root,"",!0,function(r){return n.push(r)},t),n.join("")},e.prototype.update=function(t,n,r){var o=this._comparator,l=Ew(t,this._root,o),h=l.left,u=l.right;o(t,n)<0?u=$_(n,r,u,o):h=$_(n,r,h,o),this._root=C4(h,u,o)},e.prototype.split=function(t){return Ew(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,r;return E4(this,function(o){switch(o.label){case 0:t=this._root,n=[],r=!1,o.label=1;case 1:return r?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return o.sent(),t=t.right,[3,5];case 4:r=!0,o.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function k0(e,t,n,r){var o=r-n;if(o>0){var l=n+Math.floor(o/2),h=e[l],u=t[l],y=new Pu(h,u);return y.left=k0(e,t,n,l),y.right=k0(e,t,l+1,r),y}return null}function T4(e,t){for(var n=new Pu(null,null),r=n,o=0;o0?(t=l=l.next=n.pop(),t=t.right):r=!0;return l.next=null,o.next}function D0(e,t,n){var r=n-t;if(r>0){var o=t+Math.floor(r/2),l=D0(e,t,o),h=e.head;return h.left=l,e.head=e.head.next,h.right=D0(e,o+1,n),h}return null}function P4(e,t,n){for(var r=new Pu(null,null),o=r,l=e,h=t;l!==null&&h!==null;)n(l.key,h.key)<0?(o.next=l,l=l.next):(o.next=h,h=h.next),o=o.next;return l!==null?o.next=l:h!==null&&(o.next=h),r.next}function R0(e,t,n,r,o){if(!(n>=r)){for(var l=e[n+r>>1],h=n-1,u=r+1;;){do h++;while(o(e[h],l)<0);do u--;while(o(e[u],l)>0);if(h>=u)break;var y=e[h];e[h]=e[u],e[u]=y,y=t[h],t[h]=t[u],t[u]=y}R0(e,t,n,u,o),R0(e,t,u+1,r,o)}}function la(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Iw(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){la(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Vo(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,r=0,o=n.length;r=0&&C>=0?wP?-1:0:y<0&&C<0?wP?1:0:Cy?1:0}}}]),e}(),N4=0,Og=function(){Vo(e,null,[{key:"compare",value:function(t,n){var r=t.leftSE.point.x,o=n.leftSE.point.x,l=t.rightSE.point.x,h=n.rightSE.point.x;if(hu&&y>w)return-1;var C=t.comparePoint(n.leftSE.point);if(C<0)return 1;if(C>0)return-1;var P=n.comparePoint(t.rightSE.point);return P!==0?P:-1}if(r>o){if(uy&&u>S)return 1;var N=n.comparePoint(t.leftSE.point);if(N!==0)return N;var R=t.comparePoint(n.rightSE.point);return R<0?1:R>0?-1:1}if(uy)return 1;if(lh){var Y=t.comparePoint(n.rightSE.point);if(Y<0)return 1;if(Y>0)return-1}if(l!==h){var K=w-u,B=l-r,G=S-y,H=h-o;if(K>B&&GH)return-1}return l>h?1:lS?1:t.idn.id?1:0}}]);function e(t,n,r,o){la(this,e),this.id=++N4,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=r,this.windings=o}return Vo(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,r=this.rightSE.point,o=this.vector();if(n.x===r.x)return t.x===n.x?0:t.x0&&u.swapEvents(),Ka.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(o.checkForConsuming(),l.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var l=n;n=r,r=l}if(n.prev===r){var h=n;n=r,r=h}for(var u=0,y=r.rings.length;u0)o=n,l=t,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var y=new Ka(o,!0),w=new Ka(l,!1);return new e(y,w,[r],[h])}}]),e}(),Mw=function(){function e(t,n,r){if(la(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=fd.round(t[0][0],t[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var l=o,h=1,u=t.length;hthis.bbox.ur.x&&(this.bbox.ur.x=y.x),y.y>this.bbox.ur.y&&(this.bbox.ur.y=y.y),l=y)}(o.x!==l.x||o.y!==l.y)&&this.segments.push(Og.fromRing(l,o,this))}return Vo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.interiorRings.push(l)}this.multiPoly=n}return Vo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.polys.push(l)}this.isSubject=n}return Vo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.polys.length;n0&&(t=o)}for(var l=t.segment.prevInResult(),h=l?l.prevInResult():null;;){if(!l)return null;if(!h)return l.ringOut;if(h.ringOut!==l.ringOut)return h.ringOut.enclosingRing()!==l.ringOut?l.ringOut:l.ringOut.enclosingRing();l=h.prevInResult(),h=l?l.prevInResult():null}}}]),e}(),kw=function(){function e(t){la(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Vo(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Og.compare;la(this,e),this.queue=t,this.tree=new Iv(n),this.segments=[]}return Vo(e,[{key:"process",value:function(t){var n=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),r;var o=t.isLeft?this.tree.insert(n):this.tree.find(n);if(!o)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var l=o,h=o,u=void 0,y=void 0;u===void 0;)l=this.tree.prev(l),l===null?u=null:l.key.consumedBy===void 0&&(u=l.key);for(;y===void 0;)h=this.tree.next(h),h===null?y=null:h.key.consumedBy===void 0&&(y=h.key);if(t.isLeft){var w=null;if(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var C=this._splitSafely(u,S),P=0,N=C.length;P0?(this.tree.remove(n),r.push(t)):(this.segments.push(n),n.prev=u)}else{if(u&&y){var rt=u.getIntersection(y);if(rt!==null){if(!u.isAnEndpoint(rt))for(var mt=this._splitSafely(u,rt),Et=0,$=mt.length;Et<$;Et++)r.push(mt[Et]);if(!y.isAnEndpoint(rt))for(var Pt=this._splitSafely(y,rt),Qt=0,Tt=Pt.length;QtDw)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 B4(R),at=R.size,gt=R.pop();gt;){var ft=gt.key;if(R.size===at){var rt=ft.segment;throw new Error("Unable to pop() ".concat(ft.isLeft?"left":"right"," SweepEvent ")+"[".concat(ft.point.x,", ").concat(ft.point.y,"] from segment #").concat(rt.id," ")+"[".concat(rt.leftSE.point.x,", ").concat(rt.leftSE.point.y,"] -> ")+"[".concat(rt.rightSE.point.x,", ").concat(rt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(R.size>Dw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(H.segments.length>V4)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var mt=H.process(ft),Et=0,$=mt.length;Et<$;Et++){var Pt=mt[Et];Pt.consumedBy===void 0&&R.insert(Pt)}at=R.size,gt=R.pop()}fd.reset();var Qt=z4.factory(H.segments),Tt=new F4(Qt);return Tt.getGeom()}}]),e}(),ba=new U4,G4=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Lt.prototype.clone=function(){};Lt.prototype.copy=function(){return new Lt(this)};Lt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Lt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return Math.sqrt(t*t+n*n+r*r)};Lt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Lt.prototype.hashCode=function(){var e=17;return e=37*e+Lt.hashCode(this.x),e=37*e+Lt.hashCode(this.y),e};Lt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Lt.prototype.interfaces_=function(){return[ss,ay,as]};Lt.prototype.getClass=function(){return Lt};Lt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=je.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Vc.DimensionalComparator.get=function(){return zl};Vc.serialVersionUID.get=function(){return 6683108902428367e3};Vc.NULL_ORDINATE.get=function(){return je.NaN};Vc.X.get=function(){return 0};Vc.Y.get=function(){return 1};Vc.Z.get=function(){return 2};Object.defineProperties(Lt,Vc);var zl=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new tr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};zl.prototype.compare=function(e,t){var n=e,r=t,o=zl.compare(n.x,r.x);if(o!==0)return o;var l=zl.compare(n.y,r.y);if(l!==0)return l;if(this._dimensionsToTest<=2)return 0;var h=zl.compare(n.z,r.z);return h};zl.prototype.interfaces_=function(){return[lf]};zl.prototype.getClass=function(){return zl};zl.compare=function(e,t){return et?1:je.isNaN(e)?je.isNaN(t)?0:-1:je.isNaN(t)?1:0};var uf=function(){};uf.prototype.create=function(){};uf.prototype.interfaces_=function(){return[]};uf.prototype.getClass=function(){return uf};var At=function(){},Rd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};At.prototype.interfaces_=function(){return[]};At.prototype.getClass=function(){return At};At.toLocationSymbol=function(e){switch(e){case At.EXTERIOR:return"e";case At.BOUNDARY:return"b";case At.INTERIOR:return"i";case At.NONE:return"-"}throw new tr("Unknown location value: "+e)};Rd.INTERIOR.get=function(){return 0};Rd.BOUNDARY.get=function(){return 1};Rd.EXTERIOR.get=function(){return 2};Rd.NONE.get=function(){return-1};Object.defineProperties(At,Rd);var Fe=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Uo=function(){},UE={LOG_10:{configurable:!0}};Uo.prototype.interfaces_=function(){return[]};Uo.prototype.getClass=function(){return Uo};Uo.log10=function(e){var t=Math.log(e);return je.isInfinite(t)||je.isNaN(t)?t:t/Uo.LOG_10};Uo.min=function(e,t,n,r){var o=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],o=arguments[1],l=arguments[2];return rl?l:r}};Uo.wrap=function(e,t){return e<0?t- -e%t:e%t};Uo.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],r=e;return t>r&&(r=t),n>r&&(r=n),r}else if(arguments.length===4){var o=arguments[0],l=arguments[1],h=arguments[2],u=arguments[3],y=o;return l>y&&(y=l),h>y&&(y=h),u>y&&(y=u),y}};Uo.average=function(e,t){return(e+t)/2};UE.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Uo,UE);var ua=function(e){this.str=e};ua.prototype.append=function(e){this.str+=e};ua.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};ua.prototype.toString=function(e){return this.str};var Ks=function(e){this.value=e};Ks.prototype.intValue=function(){return this.value};Ks.prototype.compareTo=function(e){return this.valuee?1:0};Ks.isNaN=function(e){return Number.isNaN(e)};var pd=function(){};pd.isWhitespace=function(e){return e<=32&&e>=0||e===127};pd.toUpperCase=function(e){return e.toUpperCase()};var Bt=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];e.call(this,e.parse(r))}}else if(arguments.length===2){var o=arguments[0],l=arguments[1];this.init(o,l)}},Ms={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}};Bt.prototype.le=function(e){return(this._hi9?(S=!0,C="9"):C="0"+w,h.append(C),n=n.subtract(Bt.valueOf(w)).multiply(Bt.TEN),S&&n.selfAdd(Bt.TEN);var P=!0,N=Bt.magnitude(n._hi);if(N<0&&Math.abs(N)>=u-y&&(P=!1),!P)break}return t[0]=r,h.toString()};Bt.prototype.sqr=function(){return this.multiply(this)};Bt.prototype.doubleValue=function(){return this._hi+this._lo};Bt.prototype.subtract=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};Bt.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};Bt.prototype.isZero=function(){return this._hi===0&&this._lo===0};Bt.prototype.selfSubtract=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};Bt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Bt.prototype.min=function(e){return this.le(e)?this:e};Bt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Bt){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],o=null,l=null,h=null,u=null,y=null,w=null,S=null,C=null;return y=this._hi/n,w=Bt.SPLIT*y,o=w-y,C=Bt.SPLIT*n,o=w-o,l=y-o,h=C-n,S=y*n,h=C-h,u=n-h,C=o*h-S+o*u+l*h+l*u,w=(this._hi-S-C+this._lo-y*r)/n,C=y+w,this._hi=C,this._lo=y-C+w,this}};Bt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Bt.prototype.divide=function(){if(arguments[0]instanceof Bt){var e=arguments[0],t=null,n=null,r=null,o=null,l=null,h=null,u=null,y=null;l=this._hi/e._hi,h=Bt.SPLIT*l,t=h-l,y=Bt.SPLIT*e._hi,t=h-t,n=l-t,r=y-e._hi,u=l*e._hi,r=y-r,o=e._hi-r,y=t*r-u+t*o+n*r+n*o,h=(this._hi-u-y+this._lo-l*e._lo)/e._hi,y=l+h;var w=y,S=l-y+h;return new Bt(w,S)}else if(typeof arguments[0]=="number"){var C=arguments[0];return je.isNaN(C)?Bt.createNaN():Bt.copy(this).selfDivide(C,0)}};Bt.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};Bt.prototype.pow=function(e){if(e===0)return Bt.valueOf(1);var t=new Bt(this),n=Bt.valueOf(1),r=Math.abs(e);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(t),r/=2,r>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};Bt.prototype.ceil=function(){if(this.isNaN())return Bt.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new Bt(e,t)};Bt.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};Bt.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};Bt.prototype.setValue=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};Bt.prototype.max=function(e){return this.ge(e)?this:e};Bt.prototype.sqrt=function(){if(this.isZero())return Bt.valueOf(0);if(this.isNegative())return Bt.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=Bt.valueOf(t),r=this.subtract(n.sqr()),o=r._hi*(e*.5);return n.add(o)};Bt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Bt){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,r=null,o=null,l=null,h=null,u=null;return o=this._hi+t,h=o-this._hi,l=o-h,l=t-h+(this._hi-l),u=l+this._lo,n=o+u,r=u+(o-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var y=arguments[0],w=arguments[1],S=null,C=null,P=null,N=null,R=null,J=null,Y=null,K=null;R=this._hi+y,P=this._lo+w,Y=R-this._hi,K=P-this._lo,J=R-Y,N=P-K,J=y-Y+(this._hi-J),N=w-K+(this._lo-N),Y=J+P,S=R+Y,C=Y+(R-S),Y=N+C;var B=S+Y,G=Y+(S-B);return this._hi=B,this._lo=G,this}};Bt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Bt){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],o=null,l=null,h=null,u=null,y=null,w=null;y=Bt.SPLIT*this._hi,o=y-this._hi,w=Bt.SPLIT*n,o=y-o,l=this._hi-o,h=w-n,y=this._hi*n,h=w-h,u=n-h,w=o*h-y+o*u+l*h+l*u+(this._hi*r+this._lo*n);var S=y+w;o=y-S;var C=w+o;return this._hi=S,this._lo=C,this}};Bt.prototype.selfSqr=function(){return this.selfMultiply(this)};Bt.prototype.floor=function(){if(this.isNaN())return Bt.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new Bt(e,t)};Bt.prototype.negate=function(){return this.isNaN()?this:new Bt(-this._hi,-this._lo)};Bt.prototype.clone=function(){};Bt.prototype.multiply=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return e.isNaN()?Bt.createNaN():Bt.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return je.isNaN(t)?Bt.createNaN():Bt.copy(this).selfMultiply(t,0)}};Bt.prototype.isNaN=function(){return je.isNaN(this._hi)};Bt.prototype.intValue=function(){return Math.trunc(this._hi)};Bt.prototype.toString=function(){var e=Bt.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};Bt.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),r=t[0]+1,o=n;if(n.charAt(0)===".")o="0"+n;else if(r<0)o="0."+Bt.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var l=r-n.length,h=Bt.stringOfChar("0",l);o=n+h+".0"}return this.isNegative()?"-"+o:o};Bt.prototype.reciprocal=function(){var e=null,t=null,n=null,r=null,o=null,l=null,h=null,u=null;o=1/this._hi,l=Bt.SPLIT*o,e=l-o,u=Bt.SPLIT*this._hi,e=l-e,t=o-e,n=u-this._hi,h=o*this._hi,n=u-n,r=this._hi-n,u=e*n-h+e*r+t*n+t*r,l=(1-h-u-o*this._lo)/this._hi;var y=o+l,w=o-y+l;return new Bt(y,w)};Bt.prototype.toSciNotation=function(){if(this.isZero())return Bt.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),r=Bt.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var o="";n.length>1&&(o=n.substring(1));var l=n.charAt(0)+"."+o;return this.isNegative()?"-"+l+r:l+r};Bt.prototype.abs=function(){return this.isNaN()?Bt.NaN:this.isNegative()?this.negate():new Bt(this)};Bt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Bt.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};Bt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Bt.prototype.trunc=function(){return this.isNaN()?Bt.NaN:this.isPositive()?this.floor():this.ceil()};Bt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Bt.prototype.interfaces_=function(){return[as,ss,ay]};Bt.prototype.getClass=function(){return Bt};Bt.sqr=function(e){return Bt.valueOf(e).selfMultiply(e)};Bt.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return Bt.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new Bt(t)}};Bt.sqrt=function(e){return Bt.valueOf(e).sqrt()};Bt.parse=function(e){for(var t=0,n=e.length;pd.isWhitespace(e.charAt(t));)t++;var r=!1;if(t=n);){var w=e.charAt(t);if(t++,pd.isDigit(w)){var S=w-"0";l.selfMultiply(Bt.TEN),l.selfAdd(S),h++;continue}if(w==="."){u=h;continue}if(w==="e"||w==="E"){var C=e.substring(t);try{y=Ks.parseInt(C)}catch(Y){throw Y instanceof Error?new Error("Invalid exponent "+C+" in string "+e):Y}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+t+" in string "+e)}var P=l,N=h-u-y;if(N===0)P=l;else if(N>0){var R=Bt.TEN.pow(N);P=l.divide(R)}else if(N<0){var J=Bt.TEN.pow(-N);P=l.multiply(J)}return r?P.negate():P};Bt.createNaN=function(){return new Bt(je.NaN,je.NaN)};Bt.copy=function(e){return new Bt(e)};Bt.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),r=Math.trunc(Math.floor(n)),o=Math.pow(10,r);return o*10<=t&&(r+=1),r};Bt.stringOfChar=function(e,t){for(var n=new ua,r=0;r0){if(l<=0)return eo.signum(h);r=o+l}else if(o<0){if(l>=0)return eo.signum(h);r=-o-l}else return eo.signum(h);var u=eo.DP_SAFE_EPSILON*r;return h>=u||-h>=u?eo.signum(h):2};eo.signum=function(e){return e>0?1:e<0?-1:0};GE.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(eo,GE);var Sn=function(){},Nd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Nd.X.get=function(){return 0};Nd.Y.get=function(){return 1};Nd.Z.get=function(){return 2};Nd.M.get=function(){return 3};Sn.prototype.setOrdinate=function(e,t,n){};Sn.prototype.size=function(){};Sn.prototype.getOrdinate=function(e,t){};Sn.prototype.getCoordinate=function(){};Sn.prototype.getCoordinateCopy=function(e){};Sn.prototype.getDimension=function(){};Sn.prototype.getX=function(e){};Sn.prototype.clone=function(){};Sn.prototype.expandEnvelope=function(e){};Sn.prototype.copy=function(){};Sn.prototype.getY=function(e){};Sn.prototype.toCoordinateArray=function(){};Sn.prototype.interfaces_=function(){return[ay]};Sn.prototype.getClass=function(){return Sn};Object.defineProperties(Sn,Nd);var qE=function(){},Nf=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(qE),xi=function(){};xi.arraycopy=function(e,t,n,r,o){for(var l=0,h=t;he._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,r=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Pe.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pe){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._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))}};Pe.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};Pe.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Pe.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Pe.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Pe.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Pe.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Pe.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Pe.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pe){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Lt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Pe.prototype.centre=function(){return this.isNull()?null:new Lt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Pe.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Lt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Pe){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var o=arguments[0],l=arguments[1],h=arguments[2],u=arguments[3];oe._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};Pe.prototype.hashCode=function(){var e=17;return e=37*e+Lt.hashCode(this._minx),e=37*e+Lt.hashCode(this._maxx),e=37*e+Lt.hashCode(this._miny),e=37*e+Lt.hashCode(this._maxy),e};Pe.prototype.interfaces_=function(){return[ss,as]};Pe.prototype.getClass=function(){return Pe};Pe.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var r=arguments[0],o=arguments[1],l=arguments[2],h=arguments[3],u=Math.min(l.x,h.x),y=Math.max(l.x,h.x),w=Math.min(r.x,o.x),S=Math.max(r.x,o.x);return!(w>y||Sy)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};ur.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};ur.prototype.setPrecisionModel=function(e){this._precisionModel=e};ur.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;no?l=r:l=o;else{var h=Math.abs(e.x-t.x),u=Math.abs(e.y-t.y);r>o?l=h:l=u,l===0&&!e.equals(t)&&(l=Math.max(h,u))}return tn.isTrue(!(l===0&&!e.equals(t)),"Bad distance calculation"),l};ur.nonRobustComputeEdgeDistance=function(e,t,n){var r=e.x-t.x,o=e.y-t.y,l=Math.sqrt(r*r+o*o);return tn.isTrue(!(l===0&&!e.equals(t)),"Invalid distance calculation"),l};Uc.DONT_INTERSECT.get=function(){return 0};Uc.DO_INTERSECT.get=function(){return 1};Uc.COLLINEAR.get=function(){return 2};Uc.NO_INTERSECTION.get=function(){return 0};Uc.POINT_INTERSECTION.get=function(){return 1};Uc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(ur,Uc);var Gu=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var r=new Pe(this._inputLines[0][0],this._inputLines[0][1]),o=new Pe(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&o.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],o=arguments[2];if(this._isProper=!1,Pe.intersects(r,o,n)&&ge.orientationIndex(r,o,n)===0&&ge.orientationIndex(o,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(o))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,r,o,l,h){h.x=this.smallestInAbsValue(n.x,r.x,o.x,l.x),h.y=this.smallestInAbsValue(n.y,r.y,o.y,l.y),n.x-=h.x,n.y-=h.y,r.x-=h.x,r.y-=h.y,o.x-=h.x,o.y-=h.y,l.x-=h.x,l.y-=h.y},t.prototype.safeHCoordinateIntersection=function(n,r,o,l){var h=null;try{h=bs.intersection(n,r,o,l)}catch(u){if(u instanceof Nf)h=t.nearestEndpoint(n,r,o,l);else throw u}finally{}return h},t.prototype.intersection=function(n,r,o,l){var h=this.intersectionWithNormalization(n,r,o,l);return this.isInSegmentEnvelopes(h)||(h=new Lt(t.nearestEndpoint(n,r,o,l))),this._precisionModel!==null&&this._precisionModel.makePrecise(h),h},t.prototype.smallestInAbsValue=function(n,r,o,l){var h=n,u=Math.abs(h);return Math.abs(r)1e-4&&xi.out.println("Distance = "+h.distance(u))},t.prototype.intersectionWithNormalization=function(n,r,o,l){var h=new Lt(n),u=new Lt(r),y=new Lt(o),w=new Lt(l),S=new Lt;this.normalizeToEnvCentre(h,u,y,w,S);var C=this.safeHCoordinateIntersection(h,u,y,w);return C.x+=S.x,C.y+=S.y,C},t.prototype.computeCollinearIntersection=function(n,r,o,l){var h=Pe.intersects(n,r,o),u=Pe.intersects(n,r,l),y=Pe.intersects(o,l,n),w=Pe.intersects(o,l,r);return h&&u?(this._intPt[0]=o,this._intPt[1]=l,e.COLLINEAR_INTERSECTION):y&&w?(this._intPt[0]=n,this._intPt[1]=r,e.COLLINEAR_INTERSECTION):h&&y?(this._intPt[0]=o,this._intPt[1]=n,o.equals(n)&&!u&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):h&&w?(this._intPt[0]=o,this._intPt[1]=r,o.equals(r)&&!u&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&y?(this._intPt[0]=l,this._intPt[1]=n,l.equals(n)&&!h&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=l,this._intPt[1]=r,l.equals(r)&&!h&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,r,o,l,h){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,C=o.xl.x?o.x:l.x,R=o.y>l.y?o.y:l.y,J=u>C?u:C,Y=wP?y:P,B=S0&&u>0||h<0&&u<0)return e.NO_INTERSECTION;var y=ge.orientationIndex(o,l,n),w=ge.orientationIndex(o,l,r);if(y>0&&w>0||y<0&&w<0)return e.NO_INTERSECTION;var S=h===0&&u===0&&y===0&&w===0;return S?this.computeCollinearIntersection(n,r,o,l):(h===0||u===0||y===0||w===0?(this._isProper=!1,n.equals2D(o)||n.equals2D(l)?this._intPt[0]=n:r.equals2D(o)||r.equals2D(l)?this._intPt[0]=r:h===0?this._intPt[0]=new Lt(o):u===0?this._intPt[0]=new Lt(l):y===0?this._intPt[0]=new Lt(n):w===0&&(this._intPt[0]=new Lt(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,o,l)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,r,o,l){var h=n,u=ge.distancePointLine(n,o,l),y=ge.distancePointLine(r,o,l);return y0?n>0?-o:o:n>0?o:-o;if(t===0||n===0)return r>0?e>0?o:-o:e>0?-o:o;if(t>0?r>0?t<=r||(o=-o,l=e,e=n,n=l,l=t,t=r,r=l):t<=-r?(o=-o,n=-n,r=-r):(l=e,e=-n,n=l,l=t,t=-r,r=l):r>0?-t<=r?(o=-o,e=-e,t=-t):(l=-e,e=n,n=l,l=-t,t=r,r=l):t>=r?(e=-e,t=-t,n=-n,r=-r):(o=-o,l=-e,e=-n,n=l,l=-t,t=-r,r=l),e>0)if(n>0){if(!(e<=n))return o}else return o;else{if(n>0)return-o;if(e>=n)o=-o,e=-e,n=-n;else return-o}for(;;){if(h=Math.floor(n/e),n=n-h*e,r=r-h*t,r<0)return-o;if(r>t)return o;if(e>n+n){if(tr+r)return-o;n=e-n,r=t-r,o=-o}if(r===0)return n===0?0:-o;if(n===0||(h=Math.floor(e/n),e=e-h*n,t=t-h*r,t<0))return o;if(t>r)return-o;if(n>e+e){if(rt+t)return o;e=n-e,t=r-t,o=-o}if(t===0)return e===0?0:o;if(e===0)return-o}};var Xs=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};Xs.prototype.countSegment=function(e,t){if(e.xr&&(n=t.x,r=e.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var o=e.x-this._p.x,l=e.y-this._p.y,h=t.x-this._p.x,u=t.y-this._p.y,y=Ic.signOfDet2x2(o,l,h,u);if(y===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};Xs.prototype.isPointInPolygon=function(){return this.getLocation()!==At.EXTERIOR};Xs.prototype.getLocation=function(){return this._isPointOnSegment?At.BOUNDARY:this._crossingCount%2===1?At.INTERIOR:At.EXTERIOR};Xs.prototype.isOnSegment=function(){return this._isPointOnSegment};Xs.prototype.interfaces_=function(){return[]};Xs.prototype.getClass=function(){return Xs};Xs.locatePointInRing=function(){if(arguments[0]instanceof Lt&&Fe(arguments[1],Sn)){for(var e=arguments[0],t=arguments[1],n=new Xs(e),r=new Lt,o=new Lt,l=1;l1||y<0||y>1)&&(o=!0)}}return o?Uo.min(ge.distancePointLine(e,n,r),ge.distancePointLine(t,n,r),ge.distancePointLine(n,e,t),ge.distancePointLine(r,e,t)):0};ge.isPointInRing=function(e,t){return ge.locatePointInRing(e,t)!==At.EXTERIOR};ge.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,r=new Lt;e.getCoordinate(0,r);for(var o=r.x,l=r.y,h=1;hn.y&&(n=l,r=o)}var h=r;do h=h-1,h<0&&(h=t);while(e[h].equals2D(n)&&h!==r);var u=r;do u=(u+1)%t;while(e[u].equals2D(n)&&u!==r);var y=e[h],w=e[u];if(y.equals2D(n)||w.equals2D(n)||y.equals2D(w))return!1;var S=ge.computeOrientation(y,n,w),C=!1;return S===0?C=y.x>w.x:C=S>0,C};ge.locatePointInRing=function(e,t){return Xs.locatePointInRing(e,t)};ge.distancePointLinePerpendicular=function(e,t,n){var r=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),o=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/r;return Math.abs(o)*Math.sqrt(r)};ge.computeOrientation=function(e,t,n){return ge.orientationIndex(e,t,n)};ge.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new tr("Line array must contain at least one vertex");for(var n=e.distance(t[0]),r=0;r=1)return l.distance(u);var S=((h.y-l.y)*(u.x-h.x)-(h.x-l.x)*(u.y-h.y))/y;return Math.abs(S)*Math.sqrt(y)}};ge.isOnLine=function(e,t){for(var n=new Gu,r=1;r0};hf.prototype.interfaces_=function(){return[rs]};hf.prototype.getClass=function(){return hf};var ff=function(){};ff.prototype.isInBoundary=function(e){return e>1};ff.prototype.interfaces_=function(){return[rs]};ff.prototype.getClass=function(){return ff};var pf=function(){};pf.prototype.isInBoundary=function(e){return e===1};pf.prototype.interfaces_=function(){return[rs]};pf.prototype.getClass=function(){return pf};var Fr=function(){};Fr.prototype.add=function(){};Fr.prototype.addAll=function(){};Fr.prototype.isEmpty=function(){};Fr.prototype.iterator=function(){};Fr.prototype.size=function(){};Fr.prototype.toArray=function(){};Fr.prototype.remove=function(){};function Tv(e){this.message=e||""}Tv.prototype=new Error;Tv.prototype.name="IndexOutOfBoundsException";var Of=function(){};Of.prototype.hasNext=function(){};Of.prototype.next=function(){};Of.prototype.remove=function(){};var xs=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Fr);function zf(e){this.message=e||""}zf.prototype=new Error;zf.prototype.name="NoSuchElementException";var ue=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Fr&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Fr]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var r=this,o=n.iterator();o.hasNext();)r.add(o.next());return!0},t.prototype.set=function(n,r){var o=this.array_[n];return this.array_[n]=r,o},t.prototype.iterator=function(){return new J4(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Tv;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,r=[],o=0,l=this.array_.length;o=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}e.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],C=arguments[1];return this.add(S,C),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var P=arguments[0],N=arguments[1],R=arguments[2];if(R)for(var J=0;J=0;Y--)r.add(P[Y],N);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Lt){var K=arguments[0],B=arguments[1],G=arguments[2];if(!G){var H=this.size();if(H>0){if(K>0){var at=this.get(K-1);if(at.equals2D(B))return null}if(KEt&&($=-1);for(var Pt=mt;Pt!==Et;Pt+=$)r.add(ft[Pt],rt);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Lt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(ue),pn=function(){},uy={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};uy.ForwardComparator.get=function(){return dd};uy.BidirectionalComparator.get=function(){return df};uy.coordArrayType.get=function(){return new Array(0).fill(null)};pn.prototype.interfaces_=function(){return[]};pn.prototype.getClass=function(){return pn};pn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};pn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};pn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};pn.extract=function(e,t,n){t=Uo.clamp(t,0,e.length),n=Uo.clamp(n,-1,e.length);var r=n-t+1;n<0&&(r=0),t>=e.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var o=pn.compare(n,r),l=pn.isEqualReversed(n,r);return l?0:o};df.prototype.OLDcompare=function(e,t){var n=e,r=t;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var o=pn.increasingDirection(n),l=pn.increasingDirection(r),h=o>0?0:n.length-1,u=l>0?0:n.length-1,y=0;y0)t=t.right;else return t.value}return null};Li.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:Ja,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,o;do if(r=n,o=e.compareTo(n.key),o<0)n=n.left;else if(o>0)n=n.right;else{var l=n.value;return n.value=t,l}while(n!==null);var h={key:e,left:null,right:null,value:t,parent:r,color:Ja,getValue:function(){return this.value},getKey:function(){return this.key}};return o<0?r.left=h:r.right=h,this.fixAfterInsertion(h),this.size_++,null};Li.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=yu;e!=null&&e!==this.root_&&e.parent.color===yu;)if(Gn(e)===t0(Gn(Gn(e)))){var n=zw(Gn(Gn(e)));Ow(n)===yu?(Ha(Gn(e),Ja),Ha(n,Ja),Ha(Gn(Gn(e)),yu),e=Gn(Gn(e))):(e===zw(Gn(e))&&(e=Gn(e),t.rotateLeft(e)),Ha(Gn(e),Ja),Ha(Gn(Gn(e)),yu),t.rotateRight(Gn(Gn(e))))}else{var r=t0(Gn(Gn(e)));Ow(r)===yu?(Ha(Gn(e),Ja),Ha(r,Ja),Ha(Gn(Gn(e)),yu),e=Gn(Gn(e))):(e===t0(Gn(e))&&(e=Gn(e),t.rotateRight(e)),Ha(Gn(e),Ja),Ha(Gn(Gn(e)),yu),t.rotateLeft(Gn(Gn(e))))}this.root_.color=Ja};Li.prototype.values=function(){var e=new ue,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Li.successor(t))!==null;)e.add(t.value);return e};Li.prototype.entrySet=function(){var e=new Lv,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Li.successor(t))!==null;)e.add(t);return e};Li.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Li.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Li.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Li.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Li.prototype.size=function(){return this.size_};var md=function(){};md.prototype.interfaces_=function(){return[]};md.prototype.getClass=function(){return md};function WE(){}WE.prototype=new cy;function Js(){this.array_=[],arguments[0]instanceof Fr&&this.addAll(arguments[0])}Js.prototype=new WE;Js.prototype.contains=function(e){for(var t=this,n=0,r=this.array_.length;n=0;){var h=o.substring(0,l);r.add(h),o=o.substring(l+n),l=o.indexOf(t)}o.length>0&&r.add(o);for(var u=new Array(r.size()).fill(null),y=0;y0)for(var l=o;l0&&r.append(" ");for(var l=0;l0&&r.append(","),r.append(es.toString(e.getOrdinate(o,l)))}return r.append(")"),r.toString()}};Ir.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Ir.createClosedRing(e,t,4);var r=t.getOrdinate(0,Sn.X)===t.getOrdinate(n-1,Sn.X)&&t.getOrdinate(0,Sn.Y)===t.getOrdinate(n-1,Sn.Y);return r?t:Ir.createClosedRing(e,t,n+1)};Ir.createClosedRing=function(e,t,n){var r=e.create(n,t.getDimension()),o=t.size();Ir.copy(t,0,r,0,o);for(var l=o;l0&&Ir.reverse(r._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?In.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return ge.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var r=this._points.copy();Ir.reverse(r);var o=this.getFactory().createLineString(r);return o},t.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var o=arguments[0],l=o,h=0,u=0;h= 2)");this._points=r},t.prototype.isCoordinate=function(r){for(var o=this,l=0;l=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(yr),wa=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Oe.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],o=arguments[1];return this.isEquivalentClass(r)?e.prototype.equalsExact.call(this,r,o):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var r=this,o=this._geometries.length,l=new Array(o).fill(null),h=0;h0?t.createPoint(n[0]):t.createPoint():e};_d.prototype.interfaces_=function(){return[is.GeometryEditorOperation]};_d.prototype.getClass=function(){return _d};var vd=function(){};vd.prototype.edit=function(e,t){return e instanceof Ia?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof yr?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof So?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};vd.prototype.interfaces_=function(){return[is.GeometryEditorOperation]};vd.prototype.getClass=function(){return vd};var Sr=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new ua(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Sr(n):new Sr(n,r)}};Ca.prototype.interfaces_=function(){return[uf,as]};Ca.prototype.getClass=function(){return Ca};Ca.instance=function(){return Ca.instanceObject};Mv.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Mv.instanceObject.get=function(){return new Ca};Object.defineProperties(Ca,Mv);var ZE=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,r){return this.map_.set(n,r),r},t.prototype.values=function(){for(var n=new ue,r=this.map_.values(),o=r.next();!o.done;)n.add(o.value),o=r.next();return n},t.prototype.entrySet=function(){var n=new Lv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},t.prototype.size=function(){return this.map_.size()},t}(qc),Tn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof $s){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},Av={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Tn.prototype.equals=function(e){if(!(e instanceof Tn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Tn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),r=t.getMaximumSignificantDigits();return new Ks(n).compareTo(new Ks(r))};Tn.prototype.getScale=function(){return this._scale};Tn.prototype.isFloating=function(){return this._modelType===Tn.FLOATING||this._modelType===Tn.FLOATING_SINGLE};Tn.prototype.getType=function(){return this._modelType};Tn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Tn.FLOATING?e="Floating":this._modelType===Tn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Tn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Tn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(je.isNaN(e))return e;if(this._modelType===Tn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Tn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Lt){var n=arguments[0];if(this._modelType===Tn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Tn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Tn.FLOATING?e=16:this._modelType===Tn.FLOATING_SINGLE?e=6:this._modelType===Tn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Tn.prototype.setScale=function(e){this._scale=Math.abs(e)};Tn.prototype.interfaces_=function(){return[as,ss]};Tn.prototype.getClass=function(){return Tn};Tn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};Av.serialVersionUID.get=function(){return 7777263578777804e3};Av.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Tn,Av);var $s=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},kv={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};$s.prototype.readResolve=function(){return $s.nameToTypeMap.get(this._name)};$s.prototype.toString=function(){return this._name};$s.prototype.interfaces_=function(){return[as]};$s.prototype.getClass=function(){return $s};kv.serialVersionUID.get=function(){return-552860263173159e4};kv.nameToTypeMap.get=function(){return new ZE};Object.defineProperties($s,kv);Tn.Type=$s;Tn.FIXED=new $s("FIXED");Tn.FLOATING=new $s("FLOATING");Tn.FLOATING_SINGLE=new $s("FLOATING SINGLE");var fn=function e(){this._precisionModel=new Tn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Fe(arguments[0],uf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Tn&&(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]))},XE={serialVersionUID:{configurable:!0}};fn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Lt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Lt(e.getMinX(),e.getMinY()),new Lt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Lt(e.getMinX(),e.getMinY()),new Lt(e.getMinX(),e.getMaxY()),new Lt(e.getMaxX(),e.getMaxY()),new Lt(e.getMaxX(),e.getMinY()),new Lt(e.getMinX(),e.getMinY())]),null)};fn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new yr(this.getCoordinateSequenceFactory().create(e),this);if(Fe(e,Sn))return new yr(e,this)}else return new yr(this.getCoordinateSequenceFactory().create([]),this)};fn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Mu(null,this);if(arguments.length===1){var e=arguments[0];return new Mu(e,this)}};fn.prototype.buildGeometry=function(e){for(var t=null,n=!1,r=!1,o=e.iterator();o.hasNext();){var l=o.next(),h=l.getClass();t===null&&(t=h),h!==t&&(n=!0),l.isGeometryCollectionOrDerived()&&(r=!0)}if(t===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(fn.toGeometryArray(e));var u=e.iterator().next(),y=e.size()>1;if(y){if(u instanceof jr)return this.createMultiPolygon(fn.toPolygonArray(e));if(u instanceof yr)return this.createMultiLineString(fn.toLineStringArray(e));if(u instanceof So)return this.createMultiPoint(fn.toPointArray(e));tn.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};fn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};fn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Lt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(Fe(arguments[0],Sn)){var t=arguments[0];return new So(t,this)}}};fn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};fn.prototype.createPolygon=function(){if(arguments.length===0)return new jr(null,null,this);if(arguments.length===1){if(Fe(arguments[0],Sn)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ia){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],o=arguments[1];return new jr(r,o,this)}};fn.prototype.getSRID=function(){return this._SRID};fn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Gi(null,this);if(arguments.length===1){var e=arguments[0];return new Gi(e,this)}};fn.prototype.createGeometry=function(e){var t=new is(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};fn.prototype.getPrecisionModel=function(){return this._precisionModel};fn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(Fe(arguments[0],Sn)){var t=arguments[0];return new Ia(t,this)}}};fn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new wa(null,this);if(arguments.length===1){var e=arguments[0];return new wa(e,this)}};fn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new mf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new mf(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Fe(arguments[0],Sn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var o=new Array(r.size()).fill(null),l=0;l=this.size())throw new Error;return this.array_[e]};ca.prototype.push=function(e){return this.array_.push(e),e};ca.prototype.pop=function(e){if(this.array_.length===0)throw new my;return this.array_.pop()};ca.prototype.peek=function(){if(this.array_.length===0)throw new my;return this.array_[this.array_.length-1]};ca.prototype.empty=function(){return this.array_.length===0};ca.prototype.isEmpty=function(){return this.empty()};ca.prototype.search=function(e){return this.array_.indexOf(e)};ca.prototype.size=function(){return this.array_.length};ca.prototype.toArray=function(){for(var e=this,t=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===ge.CLOCKWISE)&&(o=!0),o&&(this._minIndex=this._minIndex-1)};ta.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),r=n.getCoordinates();if(t<0||t+1>=r.length||r[t].y===r[t+1].y)return-1;var o=ee.LEFT;return r[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=r,t._minCoord=n[r])};ta.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};ta.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var r=n.next();r.isForward()&&t.checkForRightmostCoordinate(r)}tn.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 o=this.getRightmostSide(this._minDe,this._minIndex);o===ee.LEFT&&(this._orientedDe=this._minDe.getSym())};ta.prototype.interfaces_=function(){return[]};ta.prototype.getClass=function(){return ta};var al=function(e){function t(n,r){e.call(this,t.msgWithCoord(n,r)),this.pt=r?new Lt(r):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},t}(ol),gy=function(){this.array_=[]};gy.prototype.addLast=function(e){this.array_.push(e)};gy.prototype.removeFirst=function(){return this.array_.shift()};gy.prototype.isEmpty=function(){return this.array_.length===0};var qi=function(){this._finder=null,this._dirEdgeList=new ue,this._nodes=new ue,this._rightMostCoord=null,this._env=null,this._finder=new ta};qi.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};qi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};qi.prototype.computeNodeDepth=function(e){for(var t=this,n=null,r=e.getEdges().iterator();r.hasNext();){var o=r.next();if(o.isVisited()||o.getSym().isVisited()){n=o;break}}if(n===null)throw new al("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var l=e.getEdges().iterator();l.hasNext();){var h=l.next();h.setVisited(!0),t.copySymDepths(h)}};qi.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(ee.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};qi.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};qi.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(ee.RIGHT)>=1&&t.getDepth(ee.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};qi.prototype.computeDepths=function(e){var t=this,n=new Lv,r=new gy,o=e.getNode();for(r.addLast(o),n.add(o),e.setVisited(!0);!r.isEmpty();){var l=r.removeFirst();n.add(l),t.computeNodeDepth(l);for(var h=l.getEdges().iterator();h.hasNext();){var u=h.next(),y=u.getSym();if(!y.isVisited()){var w=y.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};qi.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};qi.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Pe,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),r=n.getEdge().getCoordinates(),o=0;othis.location.length){var n=new Array(3).fill(null);n[ee.ON]=this.location[ee.ON],n[ee.LEFT]=At.NONE,n[ee.RIGHT]=At.NONE,this.location=n}for(var r=0;r1&&e.append(At.toLocationSymbol(this.location[ee.LEFT])),e.append(At.toLocationSymbol(this.location[ee.ON])),this.location.length>1&&e.append(At.toLocationSymbol(this.location[ee.RIGHT])),e.toString()};qn.prototype.setLocations=function(e,t,n){this.location[ee.ON]=e,this.location[ee.LEFT]=t,this.location[ee.RIGHT]=n};qn.prototype.get=function(e){return e1};qn.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=r),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};kr.prototype.addPoints=function(e,t,n){var r=this,o=e.getCoordinates();if(t){var l=1;n&&(l=0);for(var h=l;h=0;y--)r._pts.add(o[y])}};kr.prototype.isHole=function(){return this._isHole};kr.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};kr.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!ge.isPointInRing(e,t.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var o=r.next();if(o.containsPoint(e))return!1}return!0};kr.prototype.addHole=function(e){this._holes.add(e)};kr.prototype.isShell=function(){return this._shell===null};kr.prototype.getLabel=function(){return this._label};kr.prototype.getEdges=function(){return this._edges};kr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};kr.prototype.getShell=function(){return this._shell};kr.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=t.getLocation(n,ee.RIGHT);if(r===At.NONE)return null;if(this._label.getLocation(n)===At.NONE)return this._label.setLocation(n,r),null}};kr.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};kr.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(e)};Go.prototype.isInResult=function(){return this._isInResult};Go.prototype.isVisited=function(){return this._isVisited};Go.prototype.interfaces_=function(){return[]};Go.prototype.getClass=function(){return Go};var yy=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Dn(0,At.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,r){var o=At.NONE;if(o=this._label.getLocation(r),!n.isNull(r)){var l=n.getLocation(r);o!==At.BOUNDARY&&(o=l)}return o},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Dn(n,r):this._label.setLocation(n,r)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Dn)for(var o=arguments[0],l=0;l<2;l++){var h=n.computeMergedLocation(o,l),u=n._label.getLocation(l);u===At.NONE&&n._label.setLocation(l,h)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=At.NONE;this._label!==null&&(r=this._label.getLocation(n));var o=null;switch(r){case At.BOUNDARY:o=At.INTERIOR;break;case At.INTERIOR:o=At.BOUNDARY;break;default:o=At.BOUNDARY;break}this._label.setLocation(n,o)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Go),ea=function(){this.nodeMap=new Li,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};ea.prototype.find=function(e){return this.nodeMap.get(e)};ea.prototype.addNode=function(){if(arguments[0]instanceof Lt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof yy){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ea.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};ea.prototype.iterator=function(){return this.nodeMap.values().iterator()};ea.prototype.values=function(){return this.nodeMap.values()};ea.prototype.getBoundaryNodes=function(e){for(var t=new ue,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(e)===At.BOUNDARY&&t.add(r)}return t};ea.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};var Rn=function(){},Fd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.isNorthern=function(e){return e===Rn.NE||e===Rn.NW};Rn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Rn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var r=et?e:t;return r===0&&o===3?3:r};Rn.isInHalfPlane=function(e,t){return t===Rn.SE?e===Rn.SE||e===Rn.SW:e===t||e===t+1};Rn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new tr("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Rn.NE:Rn.SE:t>=0?Rn.NW:Rn.SW}else if(arguments[0]instanceof Lt&&arguments[1]instanceof Lt){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new tr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Rn.NE:Rn.SE:r.y>=n.y?Rn.NW:Rn.SW}};Fd.NE.get=function(){return 0};Fd.NW.get=function(){return 1};Fd.SW.get=function(){return 2};Fd.SE.get=function(){return 3};Object.defineProperties(Rn,Fd);var Pi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],o=null;this._edge=t,this.init(n,r),this._label=o}else if(arguments.length===4){var l=arguments[0],h=arguments[1],u=arguments[2],y=arguments[3];this._edge=l,this.init(h,u),this._label=y}};Pi.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){h.linkDirectedEdgesForMinimalEdgeRings();var u=h.buildMinimalRings(),y=r.findShell(u);y!==null?(r.placePolygonHoles(y,u),t.add(y)):n.addAll(u)}else o.add(h)}return o};Eo.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Eo.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new ue,r=e.iterator();r.hasNext();){var o=r.next();if(o.isInResult()&&o.getLabel().isArea()&&o.getEdgeRing()===null){var l=new lR(o,t._geometryFactory);n.add(l),l.setInResult()}}return n};Eo.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(e)}};Eo.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Eo.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),r=n.getEnvelopeInternal(),o=n.getCoordinateN(0),l=null,h=null,u=t.iterator();u.hasNext();){var y=u.next(),w=y.getLinearRing(),S=w.getEnvelopeInternal();l!==null&&(h=l.getLinearRing().getEnvelopeInternal());var C=!1;S.contains(r)&&ge.isPointInRing(o,w.getCoordinates())&&(C=!0),C&&(l===null||h.contains(S))&&(l=y)}return l};Eo.prototype.findShell=function(e){for(var t=0,n=null,r=e.iterator();r.hasNext();){var o=r.next();o.isHole()||(n=o,t++)}return tn.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Eo.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];cr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(t),o=new ue,l=this.buildMinimalEdgeRings(r,this._shellList,o);this.sortShellsAndHoles(l,this._shellList,o),this.placeFreeHoles(this._shellList,o)}};Eo.prototype.interfaces_=function(){return[]};Eo.prototype.getClass=function(){return Eo};var yf=function(){};yf.prototype.getBounds=function(){};yf.prototype.interfaces_=function(){return[]};yf.prototype.getClass=function(){return yf};var Is=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Is.prototype.getItem=function(){return this._item};Is.prototype.getBounds=function(){return this._bounds};Is.prototype.interfaces_=function(){return[yf,as]};Is.prototype.getClass=function(){return Is};var ll=function(){this._size=null,this._items=null,this._size=0,this._items=new ue,this._items.add(null)};ll.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};ll.prototype.size=function(){return this._size};ll.prototype.reorder=function(e){for(var t=this,n=null,r=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(r)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,r)};ll.prototype.clear=function(){this._size=0,this._items.clear()};ll.prototype.isEmpty=function(){return this._size===0};ll.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};ll.prototype.interfaces_=function(){return[]};ll.prototype.getClass=function(){return ll};var Gl=function(){};Gl.prototype.visitItem=function(e){};Gl.prototype.interfaces_=function(){return[]};Gl.prototype.getClass=function(){return Gl};var Cc=function(){};Cc.prototype.insert=function(e,t){};Cc.prototype.remove=function(e,t){};Cc.prototype.query=function(){};Cc.prototype.interfaces_=function(){return[]};Cc.prototype.getClass=function(){return Cc};var qr=function(){if(this._childBoundables=new ue,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},KE={serialVersionUID:{configurable:!0}};qr.prototype.getLevel=function(){return this._level};qr.prototype.size=function(){return this._childBoundables.size()};qr.prototype.getChildBoundables=function(){return this._childBoundables};qr.prototype.addChildBoundable=function(e){tn.isTrue(this._bounds===null),this._childBoundables.add(e)};qr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};qr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};qr.prototype.interfaces_=function(){return[yf,as]};qr.prototype.getClass=function(){return qr};KE.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(qr,KE);var Cs=function(){};Cs.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Cs.min=function(e){return Cs.sort(e),e.get(0)};Cs.sort=function(e,t){var n=e.toArray();t?Iu.sort(n,t):Iu.sort(n);for(var r=e.iterator(),o=0,l=n.length;oMr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(r)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new tr("neither boundable is composite")};Mr.prototype.isLeaves=function(){return!(Mr.isComposite(this._boundable1)||Mr.isComposite(this._boundable2))};Mr.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Mr.prototype.expand=function(e,t,n,r){for(var o=this,l=e.getChildBoundables(),h=l.iterator();h.hasNext();){var u=h.next(),y=new Mr(u,t,o._itemDistance);y.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},_y={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};pi.prototype.getNodeCapacity=function(){return this._nodeCapacity};pi.prototype.lastNode=function(e){return e.get(e.size()-1)};pi.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,r=t.getChildBoundables().iterator();r.hasNext();){var o=r.next();o instanceof qr?n+=e.size(o):o instanceof Is&&(n+=1)}return n}};pi.prototype.removeItem=function(e,t){for(var n=null,r=e.getChildBoundables().iterator();r.hasNext();){var o=r.next();o instanceof Is&&o.getItem()===t&&(n=o)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};pi.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new ue:t}else if(arguments.length===1){for(var n=arguments[0],r=new ue,o=n.getChildBoundables().iterator();o.hasNext();){var l=o.next();if(l instanceof qr){var h=e.itemsTree(l);h!==null&&r.add(h)}else l instanceof Is?r.add(l.getItem()):tn.shouldNeverReachHere()}return r.size()<=0?null:r}};pi.prototype.insert=function(e,t){tn.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Is(e,t))};pi.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new ue;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var r=arguments[0],o=arguments[1],l=arguments[2];if(tn.isTrue(r>-2),o.getLevel()===r)return l.add(o),null;for(var h=o.getChildBoundables().iterator();h.hasNext();){var u=h.next();u instanceof qr?e.boundablesAtLevel(r,u,l):(tn.isTrue(u instanceof Is),r===-1&&l.add(u))}return null}};pi.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new ue;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}else if(arguments.length===2){var r=arguments[0],o=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,o)}else if(arguments.length===3){if(Fe(arguments[2],Gl)&&arguments[0]instanceof Object&&arguments[1]instanceof qr)for(var l=arguments[0],h=arguments[1],u=arguments[2],y=h.getChildBoundables(),w=0;wn&&(n=l)}}return n+1}};pi.prototype.createParentBoundables=function(e,t){var n=this;tn.isTrue(!e.isEmpty());var r=new ue;r.add(this.createNode(t));var o=new ue(e);Cs.sort(o,this.getComparator());for(var l=o.iterator();l.hasNext();){var h=l.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(t)),n.lastNode(r).addChildBoundable(h)}return r};pi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};pi.prototype.interfaces_=function(){return[as]};pi.prototype.getClass=function(){return pi};pi.compareDoubles=function(e,t){return e>t?1:e0);for(var h=new ue,u=0;u0;){var R=N.poll(),J=R.getDistance();if(J>=C)break;R.isLeaves()?(C=J,P=R):R.expandToQueue(N,C)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var Y=arguments[0],K=arguments[1],B=arguments[2],G=new Is(Y,K),H=new Mr(this.getRoot(),G,B);return this.nearestNeighbour(H)[0]}},t.prototype.interfaces_=function(){return[Cc,as]},t.prototype.getClass=function(){return t},t.centreX=function(r){return t.avg(r.getMinX(),r.getMaxX())},t.avg=function(r,o){return(r+o)/2},t.centreY=function(r){return t.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return Fw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[lf]},compare:function(r,o){return e.compareDoubles(t.centreX(r.getBounds()),t.centreX(o.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[lf]},compare:function(r,o){return e.compareDoubles(t.centreY(r.getBounds()),t.centreY(o.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(r,o){return r.intersects(o)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(pi),Fw=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var o=r.next();n===null?n=new Pe(o.getBounds()):n.expandToInclude(o.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(qr),to=function(){};to.prototype.interfaces_=function(){return[]};to.prototype.getClass=function(){return to};to.relativeSign=function(e,t){return et?1:0};to.compare=function(e,t,n){if(t.equals2D(n))return 0;var r=to.relativeSign(t.x,n.x),o=to.relativeSign(t.y,n.y);switch(e){case 0:return to.compareValue(r,o);case 1:return to.compareValue(o,r);case 2:return to.compareValue(o,-r);case 3:return to.compareValue(-r,o);case 4:return to.compareValue(-r,-o);case 5:return to.compareValue(-o,-r);case 6:return to.compareValue(-o,r);case 7:return to.compareValue(r,-o)}return tn.shouldNeverReachHere("invalid octant value"),0};to.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var ql=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._segString=e,this.coord=new Lt(t),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!t.equals2D(e.getCoordinate(n))};ql.prototype.getCoordinate=function(){return this.coord};ql.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};ql.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:to.compare(this._segmentOctant,this.coord,t.coord)};ql.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};ql.prototype.isInterior=function(){return this._isInterior};ql.prototype.interfaces_=function(){return[ss]};ql.prototype.getClass=function(){return ql};var ji=function(){this._nodeMap=new Li,this._edge=null;var e=arguments[0];this._edge=e};ji.prototype.getSplitCoordinates=function(){var e=this,t=new Od;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var o=n.next();e.addEdgeCoordinates(r,o,t),r=o}return t.toCoordinateArray()};ji.prototype.addCollapsedNodes=function(){var e=this,t=new ue;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var r=n.next().intValue();e.add(e._edge.getCoordinate(r),r)}};ji.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};ji.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=r?0:1:n>=r?7:6:t>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Lt&&arguments[1]instanceof Lt){var o=arguments[0],l=arguments[1],h=l.x-o.x,u=l.y-o.y;if(h===0&&u===0)throw new tr("Cannot compute the octant for two identical points "+o);return Tc.octant(h,u)}};var Ta=function(){};Ta.prototype.getCoordinates=function(){};Ta.prototype.size=function(){};Ta.prototype.getCoordinate=function(e){};Ta.prototype.isClosed=function(){};Ta.prototype.setData=function(e){};Ta.prototype.getData=function(){};Ta.prototype.interfaces_=function(){return[]};Ta.prototype.getClass=function(){return Ta};var bd=function(){};bd.prototype.addIntersection=function(e,t){};bd.prototype.interfaces_=function(){return[Ta]};bd.prototype.getClass=function(){return bd};var Cr=function(){this._nodeList=new ji(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Cr.prototype.getCoordinates=function(){return this._pts};Cr.prototype.size=function(){return this._pts.length};Cr.prototype.getCoordinate=function(e){return this._pts[e]};Cr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Cr.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Cr.prototype.setData=function(e){this._data=e};Cr.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Tc.octant(e,t)};Cr.prototype.getData=function(){return this._data};Cr.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],o=arguments[3],l=new Lt(n.getIntersection(o));this.addIntersection(l,r)}};Cr.prototype.toString=function(){return Ss.toLineString(new Sr(this._pts))};Cr.prototype.getNodeList=function(){return this._nodeList};Cr.prototype.addIntersectionNode=function(e,t){var n=t,r=n+1;if(r=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Lt){var r=arguments[0];return ge.orientationIndex(this.p0,this.p1,r)}};Ae.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Ae.prototype.isVertical=function(){return this.p0.x===this.p1.x};Ae.prototype.equals=function(e){if(!(e instanceof Ae))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Ae.prototype.intersection=function(e){var t=new Gu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Ae.prototype.project=function(){if(arguments[0]instanceof Lt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Lt(e);var t=this.projectionFactor(e),n=new Lt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Ae){var r=arguments[0],o=this.projectionFactor(r.p0),l=this.projectionFactor(r.p1);if(o>=1&&l>=1||o<=0&&l<=0)return null;var h=this.project(r.p0);o<0&&(h=this.p0),o>1&&(h=this.p1);var u=this.project(r.p1);return l<0&&(u=this.p0),l>1&&(u=this.p1),new Ae(h,u)}};Ae.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Ae.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Ae.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Ae.prototype.distancePerpendicular=function(e){return ge.distancePointLinePerpendicular(e,this.p0,this.p1)};Ae.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Ae.prototype.midPoint=function(){return Ae.midPoint(this.p0,this.p1)};Ae.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=t*t+n*n;if(r<=0)return je.NaN;var o=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/r;return o};Ae.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),r=je.MAX_VALUE,o=null,l=this.closestPoint(e.p0);r=l.distance(e.p0),n[0]=l,n[1]=e.p0;var h=this.closestPoint(e.p1);o=h.distance(e.p1),o0&&t<1)return this.project(e);var n=this.p0.distance(e),r=this.p1.distance(e);return n1||je.isNaN(t))&&(t=1),t};Ae.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Ae.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Ae.prototype.distance=function(){if(arguments[0]instanceof Ae){var e=arguments[0];return ge.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Lt){var t=arguments[0];return ge.distancePointLine(t,this.p0,this.p1)}};Ae.prototype.pointAlong=function(e){var t=new Lt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};Ae.prototype.hashCode=function(){var e=je.doubleToLongBits(this.p0.x);e^=je.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=je.doubleToLongBits(this.p1.x);n^=je.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return t^r};Ae.prototype.interfaces_=function(){return[ss,as]};Ae.prototype.getClass=function(){return Ae};Ae.midPoint=function(e,t){return new Lt((e.x+t.x)/2,(e.y+t.y)/2)};QE.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Ae,QE);var xd=function(){this.tempEnv1=new Pe,this.tempEnv2=new Pe,this._overlapSeg1=new Ae,this._overlapSeg2=new Ae};xd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};xd.prototype.interfaces_=function(){return[]};xd.prototype.getClass=function(){return xd};var Io=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=r};Io.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Io.prototype.computeSelect=function(e,t,n,r){var o=this._pts[t],l=this._pts[n];if(r.tempEnv1.init(o,l),n-t===1)return r.select(this,t),null;if(!e.intersects(r.tempEnv1))return null;var h=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var r=Rn.quadrant(e[n],e[n+1]),o=t+1;oh.getId()&&(h.computeOverlaps(w,o),r._nOverlaps++),r._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return Bw},Object.defineProperties(t,n),t}(wd),Bw=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],o=arguments[2],l=arguments[3],h=n.getContext(),u=o.getContext();this._si.processIntersections(h,r,u,l)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(xd),Cn=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var o=arguments[0],l=arguments[1],h=arguments[2],u=arguments[3];this.setQuadrantSegments(o),this.setEndCapStyle(l),this.setJoinStyle(h),this.setMitreLimit(u)}}},dl={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}};Cn.prototype.getEndCapStyle=function(){return this._endCapStyle};Cn.prototype.isSingleSided=function(){return this._isSingleSided};Cn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Cn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Cn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Cn.JOIN_ROUND&&(this._quadrantSegments=Cn.DEFAULT_QUADRANT_SEGMENTS)};Cn.prototype.getJoinStyle=function(){return this._joinStyle};Cn.prototype.setJoinStyle=function(e){this._joinStyle=e};Cn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Cn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Cn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Cn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Cn.prototype.getMitreLimit=function(){return this._mitreLimit};Cn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Cn.prototype.setSingleSided=function(e){this._isSingleSided=e};Cn.prototype.interfaces_=function(){return[]};Cn.prototype.getClass=function(){return Cn};Cn.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};dl.CAP_ROUND.get=function(){return 1};dl.CAP_FLAT.get=function(){return 2};dl.CAP_SQUARE.get=function(){return 3};dl.JOIN_ROUND.get=function(){return 1};dl.JOIN_MITRE.get=function(){return 2};dl.JOIN_BEVEL.get=function(){return 3};dl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};dl.DEFAULT_MITRE_LIMIT.get=function(){return 5};dl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Cn,dl);var _r=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ge.COUNTERCLOCKWISE,this._inputLine=e||null},Bd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};_r.prototype.isDeletable=function(e,t,n,r){var o=this._inputLine[e],l=this._inputLine[t],h=this._inputLine[n];return!this.isConcave(o,l,h)||!this.isShallow(o,l,h,r)?!1:this.isShallowSampled(o,l,e,n,r)};_r.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),r=this.findNextNonDeletedIndex(n),o=!1;r=0;o--)n.addPt(e[o])};qo.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=yn.PI_TIMES_2;for(;e<=-Math.PI;)e+=yn.PI_TIMES_2;return e};yn.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=n.x-t.x,o=n.y-t.y;return Math.atan2(o,r)}};yn.isAcute=function(e,t,n){var r=e.x-t.x,o=e.y-t.y,l=n.x-t.x,h=n.y-t.y,u=r*l+o*h;return u>0};yn.isObtuse=function(e,t,n){var r=e.x-t.x,o=e.y-t.y,l=n.x-t.x,h=n.y-t.y,u=r*l+o*h;return u<0};yn.interiorAngle=function(e,t,n){var r=yn.angle(t,e),o=yn.angle(t,n);return Math.abs(o-r)};yn.normalizePositive=function(e){if(e<0){for(;e<0;)e+=yn.PI_TIMES_2;e>=yn.PI_TIMES_2&&(e=0)}else{for(;e>=yn.PI_TIMES_2;)e-=yn.PI_TIMES_2;e<0&&(e=0)}return e};yn.angleBetween=function(e,t,n){var r=yn.angle(t,e),o=yn.angle(t,n);return yn.diff(r,o)};yn.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};yn.toRadians=function(e){return e*Math.PI/180};yn.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?yn.COUNTERCLOCKWISE:n<0?yn.CLOCKWISE:yn.NONE};yn.angleBetweenOriented=function(e,t,n){var r=yn.angle(t,e),o=yn.angle(t,n),l=o-r;return l<=-Math.PI?l+yn.PI_TIMES_2:l>Math.PI?l-yn.PI_TIMES_2:l};jc.PI_TIMES_2.get=function(){return 2*Math.PI};jc.PI_OVER_2.get=function(){return Math.PI/2};jc.PI_OVER_4.get=function(){return Math.PI/4};jc.COUNTERCLOCKWISE.get=function(){return ge.COUNTERCLOCKWISE};jc.CLOCKWISE.get=function(){return ge.CLOCKWISE};jc.NONE.get=function(){return ge.COLLINEAR};Object.defineProperties(yn,jc);var Zn=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Ae,this._seg1=new Ae,this._offset0=new Ae,this._offset1=new Ae,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Gu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Cn.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Vd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Zn.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ge.computeOrientation(this._s0,this._s1,this._s2),r=n===ge.CLOCKWISE&&this._side===ee.LEFT||n===ge.COUNTERCLOCKWISE&&this._side===ee.RIGHT;n===0?this.addCollinear(t):r?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};Zn.prototype.addLineEndCap=function(e,t){var n=new Ae(e,t),r=new Ae;this.computeOffsetSegment(n,ee.LEFT,this._distance,r);var o=new Ae;this.computeOffsetSegment(n,ee.RIGHT,this._distance,o);var l=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,l);switch(this._bufParams.getEndCapStyle()){case Cn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(t,u+Math.PI/2,u-Math.PI/2,ge.CLOCKWISE,this._distance),this._segList.addPt(o.p1);break;case Cn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(o.p1);break;case Cn.CAP_SQUARE:var y=new Lt;y.x=Math.abs(this._distance)*Math.cos(u),y.y=Math.abs(this._distance)*Math.sin(u);var w=new Lt(r.p1.x+y.x,r.p1.y+y.y),S=new Lt(o.p1.x+y.x,o.p1.y+y.y);this._segList.addPt(w),this._segList.addPt(S);break}};Zn.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};Zn.prototype.addMitreJoin=function(e,t,n,r){var o=!0,l=null;try{l=bs.intersection(t.p0,t.p1,n.p0,n.p1);var h=r<=0?1:l.distance(e)/Math.abs(r);h>this._bufParams.getMitreLimit()&&(o=!1)}catch(u){if(u instanceof Nf)l=new Lt(0,0),o=!1;else throw u}finally{}o?this._segList.addPt(l):this.addLimitedMitreJoin(t,n,r,this._bufParams.getMitreLimit())};Zn.prototype.addFilletCorner=function(e,t,n,r,o){var l=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,l),y=n.x-e.x,w=n.y-e.y,S=Math.atan2(w,y);r===ge.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,u,S,r,o),this._segList.addPt(n)};Zn.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Lt((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 Lt((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)}};Zn.prototype.createCircle=function(e){var t=new Lt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Zn.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};Zn.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new qo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*Zn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Zn.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Cn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Cn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ge.CLOCKWISE,this._distance))};Zn.prototype.closeRing=function(){this._segList.closeRing()};Zn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Zn.prototype.interfaces_=function(){return[]};Zn.prototype.getClass=function(){return Zn};Vd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Vd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Vd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Vd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Zn,Vd);var no=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};no.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,r=Math.abs(t),o=this.getSegGen(r);e.length<=1?this.computePointCurve(e[0],o):this.computeOffsetCurve(e,n,o);var l=o.getCoordinates();return n&&pn.reverse(l),l};no.prototype.computeSingleSidedBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var o=_r.simplify(e,-r),l=o.length-1;n.initSideSegments(o[l],o[l-1],ee.LEFT),n.addFirstSegment();for(var h=l-2;h>=0;h--)n.addNextSegment(o[h],!0)}else{n.addSegments(e,!1);var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ee.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};no.prototype.computeRingBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);t===ee.RIGHT&&(r=-r);var o=_r.simplify(e,r),l=o.length-1;n.initSideSegments(o[l-1],o[0],t);for(var h=1;h<=l;h++){var u=h!==1;n.addNextSegment(o[h],u)}n.closeRing()};no.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),r=_r.simplify(e,n),o=r.length-1;t.initSideSegments(r[0],r[1],ee.LEFT);for(var l=2;l<=o;l++)t.addNextSegment(r[l],!0);t.addLastSegment(),t.addLineEndCap(r[o-1],r[o]);var h=_r.simplify(e,-n),u=h.length-1;t.initSideSegments(h[u],h[u-1],ee.LEFT);for(var y=u-2;y>=0;y--)t.addNextSegment(h[y],!0);t.addLastSegment(),t.addLineEndCap(h[1],h[0]),t.closeRing()};no.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Cn.CAP_ROUND:t.createCircle(e);break;case Cn.CAP_SQUARE:t.createSquare(e);break}};no.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),r=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],r);else if(this._bufParams.isSingleSided()){var o=t<0;this.computeSingleSidedBufferCurve(e,o,r)}else this.computeLineBufferCurve(e,r);var l=r.getCoordinates();return l};no.prototype.getBufferParameters=function(){return this._bufParams};no.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};no.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return no.copyCoordinates(e);var r=this.getSegGen(n);return this.computeRingBufferCurve(e,t,r),r.getCoordinates()};no.prototype.computeOffsetCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){var o=_r.simplify(e,-r),l=o.length-1;n.initSideSegments(o[l],o[l-1],ee.LEFT),n.addFirstSegment();for(var h=l-2;h>=0;h--)n.addNextSegment(o[h],!0)}else{var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ee.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};no.prototype.getSegGen=function(e){return new Zn(this._precisionModel,this._bufParams,e)};no.prototype.interfaces_=function(){return[]};no.prototype.getClass=function(){return no};no.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;nl.getMaxY()||e.findStabbedSegments(t,o.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Fe(arguments[2],xs)&&arguments[0]instanceof Lt&&arguments[1]instanceof B0)for(var h=arguments[0],u=arguments[1],y=arguments[2],w=u.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var C=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Ce._seg.p1.y)&&ge.computeOrientation(e._seg.p0,e._seg.p1,h)!==ge.RIGHT){var P=u.getDepth(ee.LEFT);e._seg.p0.equals(w[S])||(P=u.getDepth(ee.RIGHT));var N=new ku(e._seg,P);y.add(N)}}else if(Fe(arguments[2],xs)&&arguments[0]instanceof Lt&&Fe(arguments[1],xs))for(var R=arguments[0],J=arguments[1],Y=arguments[2],K=J.iterator();K.hasNext();){var B=K.next();B.isForward()&&e.findStabbedSegments(R,B,Y)}}};Lc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Cs.min(t);return n._leftDepth};Lc.prototype.interfaces_=function(){return[]};Lc.prototype.getClass=function(){return Lc};tI.DepthSegment.get=function(){return ku};Object.defineProperties(Lc,tI);var ku=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Ae(e),this._leftDepth=t};ku.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};ku.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};ku.prototype.toString=function(){return this._upwardSeg.toString()};ku.prototype.interfaces_=function(){return[ss]};ku.prototype.getClass=function(){return ku};var Ln=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Ln.prototype.area=function(){return Ln.area(this.p0,this.p1,this.p2)};Ln.prototype.signedArea=function(){return Ln.signedArea(this.p0,this.p1,this.p2)};Ln.prototype.interpolateZ=function(e){if(e===null)throw new tr("Supplied point is null.");return Ln.interpolateZ(e,this.p0,this.p1,this.p2)};Ln.prototype.longestSideLength=function(){return Ln.longestSideLength(this.p0,this.p1,this.p2)};Ln.prototype.isAcute=function(){return Ln.isAcute(this.p0,this.p1,this.p2)};Ln.prototype.circumcentre=function(){return Ln.circumcentre(this.p0,this.p1,this.p2)};Ln.prototype.area3D=function(){return Ln.area3D(this.p0,this.p1,this.p2)};Ln.prototype.centroid=function(){return Ln.centroid(this.p0,this.p1,this.p2)};Ln.prototype.inCentre=function(){return Ln.inCentre(this.p0,this.p1,this.p2)};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Ln.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Ln.det=function(e,t,n,r){return e*r-t*n};Ln.interpolateZ=function(e,t,n,r){var o=t.x,l=t.y,h=n.x-o,u=r.x-o,y=n.y-l,w=r.y-l,S=h*w-u*y,C=e.x-o,P=e.y-l,N=(w*C-u*P)/S,R=(-y*C+h*P)/S,J=t.z+N*(n.z-t.z)+R*(r.z-t.z);return J};Ln.longestSideLength=function(e,t,n){var r=e.distance(t),o=t.distance(n),l=n.distance(e),h=r;return o>h&&(h=o),l>h&&(h=l),h};Ln.isAcute=function(e,t,n){return!(!yn.isAcute(e,t,n)||!yn.isAcute(t,n,e)||!yn.isAcute(n,e,t))};Ln.circumcentre=function(e,t,n){var r=n.x,o=n.y,l=e.x-r,h=e.y-o,u=t.x-r,y=t.y-o,w=2*Ln.det(l,h,u,y),S=Ln.det(h,l*l+h*h,y,u*u+y*y),C=Ln.det(l,l*l+h*h,u,u*u+y*y),P=r-S/w,N=o+C/w;return new Lt(P,N)};Ln.perpendicularBisector=function(e,t){var n=t.x-e.x,r=t.y-e.y,o=new bs(e.x+n/2,e.y+r/2,1),l=new bs(e.x-r+n/2,e.y+n+r/2,1);return new bs(o,l)};Ln.angleBisector=function(e,t,n){var r=t.distance(e),o=t.distance(n),l=r/(r+o),h=n.x-e.x,u=n.y-e.y,y=new Lt(e.x+l*h,e.y+l*u);return y};Ln.area3D=function(e,t,n){var r=t.x-e.x,o=t.y-e.y,l=t.z-e.z,h=n.x-e.x,u=n.y-e.y,y=n.z-e.z,w=o*y-l*u,S=l*h-r*y,C=r*u-o*h,P=w*w+S*S+C*C,N=Math.sqrt(P)/2;return N};Ln.centroid=function(e,t,n){var r=(e.x+t.x+n.x)/3,o=(e.y+t.y+n.y)/3;return new Lt(r,o)};Ln.inCentre=function(e,t,n){var r=t.distance(n),o=e.distance(n),l=e.distance(t),h=r+o+l,u=(r*e.x+o*t.x+l*n.x)/h,y=(r*e.y+o*t.y+l*n.y)/h;return new Lt(u,y)};var os=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ue;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};os.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,At.EXTERIOR,At.INTERIOR)};os.prototype.addPolygon=function(e){var t=this,n=this._distance,r=ee.LEFT;this._distance<0&&(n=-this._distance,r=ee.RIGHT);var o=e.getExteriorRing(),l=pn.removeRepeatedPoints(o.getCoordinates());if(this._distance<0&&this.isErodedCompletely(o,this._distance)||this._distance<=0&&l.length<3)return null;this.addPolygonRing(l,n,r,At.EXTERIOR,At.INTERIOR);for(var h=0;h0&&t.isErodedCompletely(u,-t._distance)||t.addPolygonRing(y,n,ee.opposite(r),At.INTERIOR,At.EXTERIOR)}};os.prototype.isTriangleErodedCompletely=function(e,t){var n=new Ln(e[0],e[1],e[2]),r=n.inCentre(),o=ge.distancePointLine(r,n.p0,n.p1);return o=Ia.MINIMUM_VALID_SIZE&&ge.isCCW(e)&&(l=o,h=r,n=ee.opposite(n));var u=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(u,l,h)};os.prototype.add=function(e){if(e.isEmpty())return null;e instanceof jr?this.addPolygon(e):e instanceof yr?this.addLineString(e):e instanceof So?this.addPoint(e):e instanceof mf?this.addCollection(e):e instanceof Mu?this.addCollection(e):e instanceof wa?this.addCollection(e):e instanceof Gi&&this.addCollection(e)};os.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var r=e.getEnvelopeInternal(),o=Math.min(r.getHeight(),r.getWidth());return t<0&&2*Math.abs(t)>o};os.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new zf;var e=this._parent.getGeometryN(this._index++);return e instanceof Gi?(this._subcollectionIterator=new Sa(e),this._subcollectionIterator.next()):e};Sa.prototype.remove=function(){throw new Error(this.getClass().getName())};Sa.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)};Sa.prototype.interfaces_=function(){return[Of]};Sa.prototype.getClass=function(){return Sa};Sa.isAtomic=function(e){return!(e instanceof Gi)};var Bo=function(){this._geom=null;var e=arguments[0];this._geom=e};Bo.prototype.locate=function(e){return Bo.locate(e,this._geom)};Bo.prototype.interfaces_=function(){return[vf]};Bo.prototype.getClass=function(){return Bo};Bo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?ge.isPointInRing(e,t.getCoordinates()):!1};Bo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Bo.isPointInRing(e,n))return!1;for(var r=0;r0&&l[l.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!l||w[1]>l[0]&&w[1]t?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){var u=t.right;if(t.right=u.left,u.left=t,t=u,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,l.left=t.right,t.left=r.right,t.right=r.left,t}function $_(e,t,n,r){var i=new Mu(e,t);if(n===null)return i.left=i.right=null,i;n=xu(e,n,r);var l=r(e,n.key);return l<0?(i.left=n.left,i.right=n,n.left=null):l>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Iw(e,t,n){var r=null,i=null;if(t){t=xu(e,t,n);var l=n(t.key,e);l===0?(r=t.left,i=t.right):l<0?(i=t.right,t.right=null,r=t):(r=t.left,t.left=null,i=t)}return{left:r,right:i}}function T4(e,t,n){return t===null?e:(e===null||(t=xu(e.key,t,n),t.left=e),t)}function A0(e,t,n,r,i){if(e){r(""+t+(n?"└── ":"├── ")+i(e)+` +`);var l=t+(n?" ":"│ ");e.left&&A0(e.left,l,!1,r,i),e.right&&A0(e.right,l,!0,r,i)}}var Cv=function(){function e(t){t===void 0&&(t=C4),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,n){return this._size++,this._root=$_(t,n,this._root,this._comparator)},e.prototype.add=function(t,n){var r=new Mu(t,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,l=xu(t,this._root,i),h=i(t,l.key);return h===0?this._root=l:(h<0?(r.left=l.left,r.right=l,l.left=null):h>0&&(r.right=l.right,r.left=l,l.right=null),this._size++,this._root=r),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,n,r){var i;if(n===null)return null;n=xu(t,n,r);var l=r(t,n.key);return l===0?(n.left===null?i=n.right:(i=xu(t,n.left,r),i.right=n.right),this._size--,i):n},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=xu(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var n=this._root,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},e.prototype.find=function(t){return this._root&&(this._root=xu(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var n=this._root,r=this._comparator;n;){var i=r(t,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},e.prototype.forEach=function(t,n){for(var r=this._root,i=[],l=!1;!l;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),t.call(n,r),r=r.right):l=!0;return this},e.prototype.range=function(t,n,r,i){for(var l=[],h=this._comparator,u=this._root,y;l.length!==0||u;)if(u)l.push(u),u=u.left;else{if(u=l.pop(),y=h(u.key,n),y>0)break;if(h(u.key,t)>=0&&r.call(i,u))return this;u=u.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(n){var r=n.key;return t.push(r)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(n){var r=n.data;return t.push(r)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var n=this._root,r=!1,i=0,l=[];!r;)if(n)l.push(n),n=n.left;else if(l.length>0){if(n=l.pop(),i===t)return n;i++,n=n.right}else r=!0;return null},e.prototype.next=function(t){var n=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var l=i(t.key,n.key);if(l===0)break;l<0?(r=n,n=n.left):n=n.right}return r},e.prototype.prev=function(t){var n=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var l=i(t.key,n.key);if(l===0)break;l<0?n=n.left:(r=n,n=n.right)}return r},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return P4(this._root)},e.prototype.load=function(t,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=t.length,l=this._comparator;if(r&&R0(t,n,0,i-1,l),this._root===null)this._root=k0(t,n,0,i),this._size=i;else{var h=M4(this.toList(),L4(t,n),l);i=this._size+i,this._root=D0({head:h},0,i)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(r){return String(r.key)});var n=[];return A0(this._root,"",!0,function(r){return n.push(r)},t),n.join("")},e.prototype.update=function(t,n,r){var i=this._comparator,l=Iw(t,this._root,i),h=l.left,u=l.right;i(t,n)<0?u=$_(n,r,u,i):h=$_(n,r,h,i),this._root=T4(h,u,i)},e.prototype.split=function(t){return Iw(t,this._root,this._comparator)},e.prototype[Symbol.iterator]=function(){var t,n,r;return I4(this,function(i){switch(i.label){case 0:t=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},e}();function k0(e,t,n,r){var i=r-n;if(i>0){var l=n+Math.floor(i/2),h=e[l],u=t[l],y=new Mu(h,u);return y.left=k0(e,t,n,l),y.right=k0(e,t,l+1,r),y}return null}function L4(e,t){for(var n=new Mu(null,null),r=n,i=0;i0?(t=l=l.next=n.pop(),t=t.right):r=!0;return l.next=null,i.next}function D0(e,t,n){var r=n-t;if(r>0){var i=t+Math.floor(r/2),l=D0(e,t,i),h=e.head;return h.left=l,e.head=e.head.next,h.right=D0(e,i+1,n),h}return null}function M4(e,t,n){for(var r=new Mu(null,null),i=r,l=e,h=t;l!==null&&h!==null;)n(l.key,h.key)<0?(i.next=l,l=l.next):(i.next=h,h=h.next),i=i.next;return l!==null?i.next=l:h!==null&&(i.next=h),r.next}function R0(e,t,n,r,i){if(!(n>=r)){for(var l=e[n+r>>1],h=n-1,u=r+1;;){do h++;while(i(e[h],l)<0);do u--;while(i(e[u],l)>0);if(h>=u)break;var y=e[h];e[h]=e[u],e[u]=y,y=t[h],t[h]=t[u],t[u]=y}R0(e,t,n,u,i),R0(e,t,u+1,r,i)}}function la(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cw(e,t){for(var n=0;nn.x?1:t.yn.y?1:0}}]);function e(t,n){la(this,e),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}return Vo(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var n=t.point.events,r=0,i=n.length;r=0&&C>=0?wP?-1:0:y<0&&C<0?wP?1:0:Cy?1:0}}}]),e}(),O4=0,Og=function(){Vo(e,null,[{key:"compare",value:function(t,n){var r=t.leftSE.point.x,i=n.leftSE.point.x,l=t.rightSE.point.x,h=n.rightSE.point.x;if(hu&&y>w)return-1;var C=t.comparePoint(n.leftSE.point);if(C<0)return 1;if(C>0)return-1;var P=n.comparePoint(t.rightSE.point);return P!==0?P:-1}if(r>i){if(uy&&u>S)return 1;var D=n.comparePoint(t.leftSE.point);if(D!==0)return D;var N=t.comparePoint(n.rightSE.point);return N<0?1:N>0?-1:1}if(uy)return 1;if(lh){var Y=t.comparePoint(n.rightSE.point);if(Y<0)return 1;if(Y>0)return-1}if(l!==h){var J=w-u,B=l-r,G=S-y,H=h-i;if(J>B&&GH)return-1}return l>h?1:lS?1:t.idn.id?1:0}}]);function e(t,n,r,i){la(this,e),this.id=++O4,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=r,this.windings=i}return Vo(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return t.x===n.x?0:t.x0&&u.swapEvents(),Ka.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),l.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var l=n;n=r,r=l}if(n.prev===r){var h=n;n=r,r=h}for(var u=0,y=r.rings.length;u0)i=n,l=t,h=-1;else throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));var y=new Ka(i,!0),w=new Ka(l,!1);return new e(y,w,[r],[h])}}]),e}(),Aw=function(){function e(t,n,r){if(la(this,e),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=fd.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var l=i,h=1,u=t.length;hthis.bbox.ur.x&&(this.bbox.ur.x=y.x),y.y>this.bbox.ur.y&&(this.bbox.ur.y=y.y),l=y)}(i.x!==l.x||i.y!==l.y)&&this.segments.push(Og.fromRing(l,i,this))}return Vo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.interiorRings.push(l)}this.multiPoly=n}return Vo(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=l.bbox.ur.x),l.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=l.bbox.ur.y),this.polys.push(l)}this.isSubject=n}return Vo(e,[{key:"getSweepEvents",value:function(){for(var t=[],n=0,r=this.polys.length;n0&&(t=i)}for(var l=t.segment.prevInResult(),h=l?l.prevInResult():null;;){if(!l)return null;if(!h)return l.ringOut;if(h.ringOut!==l.ringOut)return h.ringOut.enclosingRing()!==l.ringOut?l.ringOut:l.ringOut.enclosingRing();l=h.prevInResult(),h=l?l.prevInResult():null}}}]),e}(),Dw=function(){function e(t){la(this,e),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return Vo(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Og.compare;la(this,e),this.queue=t,this.tree=new Cv(n),this.segments=[]}return Vo(e,[{key:"process",value:function(t){var n=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),r;var i=t.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 l=i,h=i,u=void 0,y=void 0;u===void 0;)l=this.tree.prev(l),l===null?u=null:l.key.consumedBy===void 0&&(u=l.key);for(;y===void 0;)h=this.tree.next(h),h===null?y=null:h.key.consumedBy===void 0&&(y=h.key);if(t.isLeft){var w=null;if(u){var S=u.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!u.isAnEndpoint(S)))for(var C=this._splitSafely(u,S),P=0,D=C.length;P0?(this.tree.remove(n),r.push(t)):(this.segments.push(n),n.prev=u)}else{if(u&&y){var rt=u.getIntersection(y);if(rt!==null){if(!u.isAnEndpoint(rt))for(var mt=this._splitSafely(u,rt),Et=0,$=mt.length;Et<$;Et++)r.push(mt[Et]);if(!y.isAnEndpoint(rt))for(var Pt=this._splitSafely(y,rt),Qt=0,Tt=Pt.length;QtRw)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 V4(N),at=N.size,gt=N.pop();gt;){var ft=gt.key;if(N.size===at){var rt=ft.segment;throw new Error("Unable to pop() ".concat(ft.isLeft?"left":"right"," SweepEvent ")+"[".concat(ft.point.x,", ").concat(ft.point.y,"] from segment #").concat(rt.id," ")+"[".concat(rt.leftSE.point.x,", ").concat(rt.leftSE.point.y,"] -> ")+"[".concat(rt.rightSE.point.x,", ").concat(rt.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(N.size>Rw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(H.segments.length>U4)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var mt=H.process(ft),Et=0,$=mt.length;Et<$;Et++){var Pt=mt[Et];Pt.consumedBy===void 0&&N.insert(Pt)}at=N.size,gt=N.pop()}fd.reset();var Qt=F4.factory(H.segments),Tt=new B4(Qt);return Tt.getGeom()}}]),e}(),ba=new G4,q4=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]t.x?1:this.yt.y?1:0};Lt.prototype.clone=function(){};Lt.prototype.copy=function(){return new Lt(this)};Lt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Lt.prototype.distance3D=function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return Math.sqrt(t*t+n*n+r*r)};Lt.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)};Lt.prototype.hashCode=function(){var e=17;return e=37*e+Lt.hashCode(this.x),e=37*e+Lt.hashCode(this.y),e};Lt.prototype.setCoordinate=function(e){this.x=e.x,this.y=e.y,this.z=e.z};Lt.prototype.interfaces_=function(){return[ss,ay,as]};Lt.prototype.getClass=function(){return Lt};Lt.hashCode=function(){if(arguments.length===1){var e=arguments[0],t=je.doubleToLongBits(e);return Math.trunc((t^t)>>>32)}};Vc.DimensionalComparator.get=function(){return Bl};Vc.serialVersionUID.get=function(){return 6683108902428367e3};Vc.NULL_ORDINATE.get=function(){return je.NaN};Vc.X.get=function(){return 0};Vc.Y.get=function(){return 1};Vc.Z.get=function(){return 2};Object.defineProperties(Lt,Vc);var Bl=function(e){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new tr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}};Bl.prototype.compare=function(e,t){var n=e,r=t,i=Bl.compare(n.x,r.x);if(i!==0)return i;var l=Bl.compare(n.y,r.y);if(l!==0)return l;if(this._dimensionsToTest<=2)return 0;var h=Bl.compare(n.z,r.z);return h};Bl.prototype.interfaces_=function(){return[lf]};Bl.prototype.getClass=function(){return Bl};Bl.compare=function(e,t){return et?1:je.isNaN(e)?je.isNaN(t)?0:-1:je.isNaN(t)?1:0};var uf=function(){};uf.prototype.create=function(){};uf.prototype.interfaces_=function(){return[]};uf.prototype.getClass=function(){return uf};var At=function(){},Rd={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};At.prototype.interfaces_=function(){return[]};At.prototype.getClass=function(){return At};At.toLocationSymbol=function(e){switch(e){case At.EXTERIOR:return"e";case At.BOUNDARY:return"b";case At.INTERIOR:return"i";case At.NONE:return"-"}throw new tr("Unknown location value: "+e)};Rd.INTERIOR.get=function(){return 0};Rd.BOUNDARY.get=function(){return 1};Rd.EXTERIOR.get=function(){return 2};Rd.NONE.get=function(){return-1};Object.defineProperties(At,Rd);var Fe=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Uo=function(){},UE={LOG_10:{configurable:!0}};Uo.prototype.interfaces_=function(){return[]};Uo.prototype.getClass=function(){return Uo};Uo.log10=function(e){var t=Math.log(e);return je.isInfinite(t)||je.isNaN(t)?t:t/Uo.LOG_10};Uo.min=function(e,t,n,r){var i=e;return tn?n:e}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],l=arguments[2];return rl?l:r}};Uo.wrap=function(e,t){return e<0?t- -e%t:e%t};Uo.max=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],r=e;return t>r&&(r=t),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],l=arguments[1],h=arguments[2],u=arguments[3],y=i;return l>y&&(y=l),h>y&&(y=h),u>y&&(y=u),y}};Uo.average=function(e,t){return(e+t)/2};UE.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Uo,UE);var ua=function(e){this.str=e};ua.prototype.append=function(e){this.str+=e};ua.prototype.setCharAt=function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)};ua.prototype.toString=function(e){return this.str};var Ks=function(e){this.value=e};Ks.prototype.intValue=function(){return this.value};Ks.prototype.compareTo=function(e){return this.valuee?1:0};Ks.isNaN=function(e){return Number.isNaN(e)};var pd=function(){};pd.isWhitespace=function(e){return e<=32&&e>=0||e===127};pd.toUpperCase=function(e){return e.toUpperCase()};var Bt=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];e.call(this,e.parse(r))}}else if(arguments.length===2){var i=arguments[0],l=arguments[1];this.init(i,l)}},Ms={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}};Bt.prototype.le=function(e){return(this._hi9?(S=!0,C="9"):C="0"+w,h.append(C),n=n.subtract(Bt.valueOf(w)).multiply(Bt.TEN),S&&n.selfAdd(Bt.TEN);var P=!0,D=Bt.magnitude(n._hi);if(D<0&&Math.abs(D)>=u-y&&(P=!1),!P)break}return t[0]=r,h.toString()};Bt.prototype.sqr=function(){return this.multiply(this)};Bt.prototype.doubleValue=function(){return this._hi+this._lo};Bt.prototype.subtract=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return this.add(e.negate())}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}};Bt.prototype.equals=function(){if(arguments.length===1){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}};Bt.prototype.isZero=function(){return this._hi===0&&this._lo===0};Bt.prototype.selfSubtract=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}};Bt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Bt.prototype.min=function(e){return this.le(e)?this:e};Bt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Bt){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,l=null,h=null,u=null,y=null,w=null,S=null,C=null;return y=this._hi/n,w=Bt.SPLIT*y,i=w-y,C=Bt.SPLIT*n,i=w-i,l=y-i,h=C-n,S=y*n,h=C-h,u=n-h,C=i*h-S+i*u+l*h+l*u,w=(this._hi-S-C+this._lo-y*r)/n,C=y+w,this._hi=C,this._lo=y-C+w,this}};Bt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Bt.prototype.divide=function(){if(arguments[0]instanceof Bt){var e=arguments[0],t=null,n=null,r=null,i=null,l=null,h=null,u=null,y=null;l=this._hi/e._hi,h=Bt.SPLIT*l,t=h-l,y=Bt.SPLIT*e._hi,t=h-t,n=l-t,r=y-e._hi,u=l*e._hi,r=y-r,i=e._hi-r,y=t*r-u+t*i+n*r+n*i,h=(this._hi-u-y+this._lo-l*e._lo)/e._hi,y=l+h;var w=y,S=l-y+h;return new Bt(w,S)}else if(typeof arguments[0]=="number"){var C=arguments[0];return je.isNaN(C)?Bt.createNaN():Bt.copy(this).selfDivide(C,0)}};Bt.prototype.ge=function(e){return(this._hi>e._hi||this._hi===e._hi)&&this._lo>=e._lo};Bt.prototype.pow=function(e){if(e===0)return Bt.valueOf(1);var t=new Bt(this),n=Bt.valueOf(1),r=Math.abs(e);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(t),r/=2,r>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n};Bt.prototype.ceil=function(){if(this.isNaN())return Bt.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new Bt(e,t)};Bt.prototype.compareTo=function(e){var t=e;return this._hit._hi?1:this._lot._lo?1:0};Bt.prototype.rint=function(){if(this.isNaN())return this;var e=this.add(.5);return e.floor()};Bt.prototype.setValue=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return this.init(e),this}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}};Bt.prototype.max=function(e){return this.ge(e)?this:e};Bt.prototype.sqrt=function(){if(this.isZero())return Bt.valueOf(0);if(this.isNegative())return Bt.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=Bt.valueOf(t),r=this.subtract(n.sqr()),i=r._hi*(e*.5);return n.add(i)};Bt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Bt){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0],n=null,r=null,i=null,l=null,h=null,u=null;return i=this._hi+t,h=i-this._hi,l=i-h,l=t-h+(this._hi-l),u=l+this._lo,n=i+u,r=u+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var y=arguments[0],w=arguments[1],S=null,C=null,P=null,D=null,N=null,K=null,Y=null,J=null;N=this._hi+y,P=this._lo+w,Y=N-this._hi,J=P-this._lo,K=N-Y,D=P-J,K=y-Y+(this._hi-K),D=w-J+(this._lo-D),Y=K+P,S=N+Y,C=Y+(N-S),Y=D+C;var B=S+Y,G=Y+(S-B);return this._hi=B,this._lo=G,this}};Bt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Bt){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}else if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,l=null,h=null,u=null,y=null,w=null;y=Bt.SPLIT*this._hi,i=y-this._hi,w=Bt.SPLIT*n,i=y-i,l=this._hi-i,h=w-n,y=this._hi*n,h=w-h,u=n-h,w=i*h-y+i*u+l*h+l*u+(this._hi*r+this._lo*n);var S=y+w;i=y-S;var C=w+i;return this._hi=S,this._lo=C,this}};Bt.prototype.selfSqr=function(){return this.selfMultiply(this)};Bt.prototype.floor=function(){if(this.isNaN())return Bt.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new Bt(e,t)};Bt.prototype.negate=function(){return this.isNaN()?this:new Bt(-this._hi,-this._lo)};Bt.prototype.clone=function(){};Bt.prototype.multiply=function(){if(arguments[0]instanceof Bt){var e=arguments[0];return e.isNaN()?Bt.createNaN():Bt.copy(this).selfMultiply(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return je.isNaN(t)?Bt.createNaN():Bt.copy(this).selfMultiply(t,0)}};Bt.prototype.isNaN=function(){return je.isNaN(this._hi)};Bt.prototype.intValue=function(){return Math.trunc(this._hi)};Bt.prototype.toString=function(){var e=Bt.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()};Bt.prototype.toStandardNotation=function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),r=t[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+Bt.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var l=r-n.length,h=Bt.stringOfChar("0",l);i=n+h+".0"}return this.isNegative()?"-"+i:i};Bt.prototype.reciprocal=function(){var e=null,t=null,n=null,r=null,i=null,l=null,h=null,u=null;i=1/this._hi,l=Bt.SPLIT*i,e=l-i,u=Bt.SPLIT*this._hi,e=l-e,t=i-e,n=u-this._hi,h=i*this._hi,n=u-n,r=this._hi-n,u=e*n-h+e*r+t*n+t*r,l=(1-h-u-i*this._lo)/this._hi;var y=i+l,w=i-y+l;return new Bt(y,w)};Bt.prototype.toSciNotation=function(){if(this.isZero())return Bt.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),r=Bt.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var l=n.charAt(0)+"."+i;return this.isNegative()?"-"+l+r:l+r};Bt.prototype.abs=function(){return this.isNaN()?Bt.NaN:this.isNegative()?this.negate():new Bt(this)};Bt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Bt.prototype.lt=function(e){return(this._hie._hi||this._hi===e._hi)&&this._lo>e._lo};Bt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Bt.prototype.trunc=function(){return this.isNaN()?Bt.NaN:this.isPositive()?this.floor():this.ceil()};Bt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Bt.prototype.interfaces_=function(){return[as,ss,ay]};Bt.prototype.getClass=function(){return Bt};Bt.sqr=function(e){return Bt.valueOf(e).selfMultiply(e)};Bt.valueOf=function(){if(typeof arguments[0]=="string"){var e=arguments[0];return Bt.parse(e)}else if(typeof arguments[0]=="number"){var t=arguments[0];return new Bt(t)}};Bt.sqrt=function(e){return Bt.valueOf(e).sqrt()};Bt.parse=function(e){for(var t=0,n=e.length;pd.isWhitespace(e.charAt(t));)t++;var r=!1;if(t=n);){var w=e.charAt(t);if(t++,pd.isDigit(w)){var S=w-"0";l.selfMultiply(Bt.TEN),l.selfAdd(S),h++;continue}if(w==="."){u=h;continue}if(w==="e"||w==="E"){var C=e.substring(t);try{y=Ks.parseInt(C)}catch(Y){throw Y instanceof Error?new Error("Invalid exponent "+C+" in string "+e):Y}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+t+" in string "+e)}var P=l,D=h-u-y;if(D===0)P=l;else if(D>0){var N=Bt.TEN.pow(D);P=l.divide(N)}else if(D<0){var K=Bt.TEN.pow(-D);P=l.multiply(K)}return r?P.negate():P};Bt.createNaN=function(){return new Bt(je.NaN,je.NaN)};Bt.copy=function(e){return new Bt(e)};Bt.magnitude=function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=t&&(r+=1),r};Bt.stringOfChar=function(e,t){for(var n=new ua,r=0;r0){if(l<=0)return eo.signum(h);r=i+l}else if(i<0){if(l>=0)return eo.signum(h);r=-i-l}else return eo.signum(h);var u=eo.DP_SAFE_EPSILON*r;return h>=u||-h>=u?eo.signum(h):2};eo.signum=function(e){return e>0?1:e<0?-1:0};GE.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(eo,GE);var Sn=function(){},Nd={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Nd.X.get=function(){return 0};Nd.Y.get=function(){return 1};Nd.Z.get=function(){return 2};Nd.M.get=function(){return 3};Sn.prototype.setOrdinate=function(e,t,n){};Sn.prototype.size=function(){};Sn.prototype.getOrdinate=function(e,t){};Sn.prototype.getCoordinate=function(){};Sn.prototype.getCoordinateCopy=function(e){};Sn.prototype.getDimension=function(){};Sn.prototype.getX=function(e){};Sn.prototype.clone=function(){};Sn.prototype.expandEnvelope=function(e){};Sn.prototype.copy=function(){};Sn.prototype.getY=function(e){};Sn.prototype.toCoordinateArray=function(){};Sn.prototype.interfaces_=function(){return[ay]};Sn.prototype.getClass=function(){return Sn};Object.defineProperties(Sn,Nd);var qE=function(){},Nf=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(qE),xi=function(){};xi.arraycopy=function(e,t,n,r,i){for(var l=0,h=t;he._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny,r=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Pe.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pe){var e=arguments[0];return this.isNull()||e.isNull()?!1:!(e._minx>this._maxx||e._maxxthis._maxy||e._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._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))}};Pe.prototype.minExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return et._minx?1:this._minyt._miny?1:this._maxxt._maxx?1:this._maxyt._maxy?1:0};Pe.prototype.translate=function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)};Pe.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Pe.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Pe.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Pe.prototype.maxExtent=function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t};Pe.prototype.expandBy=function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Pe.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pe){var e=arguments[0];return this.covers(e)}else if(arguments[0]instanceof Lt){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Pe.prototype.centre=function(){return this.isNull()?null:new Lt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Pe.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Lt){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof Pe){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],l=arguments[1],h=arguments[2],u=arguments[3];ie._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxye._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)};Pe.prototype.hashCode=function(){var e=17;return e=37*e+Lt.hashCode(this._minx),e=37*e+Lt.hashCode(this._maxx),e=37*e+Lt.hashCode(this._miny),e=37*e+Lt.hashCode(this._maxy),e};Pe.prototype.interfaces_=function(){return[ss,as]};Pe.prototype.getClass=function(){return Pe};Pe.intersects=function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.xt.x?e.x:t.x)&&n.y>=(e.yt.y?e.y:t.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],l=arguments[2],h=arguments[3],u=Math.min(l.x,h.x),y=Math.max(l.x,h.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>y||Sy)||Sn?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}};ur.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};ur.prototype.setPrecisionModel=function(e){this._precisionModel=e};ur.prototype.isInteriorIntersection=function(){var e=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var t=arguments[0],n=0;ni?l=r:l=i;else{var h=Math.abs(e.x-t.x),u=Math.abs(e.y-t.y);r>i?l=h:l=u,l===0&&!e.equals(t)&&(l=Math.max(h,u))}return tn.isTrue(!(l===0&&!e.equals(t)),"Bad distance calculation"),l};ur.nonRobustComputeEdgeDistance=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,l=Math.sqrt(r*r+i*i);return tn.isTrue(!(l===0&&!e.equals(t)),"Invalid distance calculation"),l};Uc.DONT_INTERSECT.get=function(){return 0};Uc.DO_INTERSECT.get=function(){return 1};Uc.COLLINEAR.get=function(){return 2};Uc.NO_INTERSECTION.get=function(){return 0};Uc.POINT_INTERSECTION.get=function(){return 1};Uc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(ur,Uc);var qu=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var r=new Pe(this._inputLines[0][0],this._inputLines[0][1]),i=new Pe(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Pe.intersects(r,i,n)&&ge.orientationIndex(r,i,n)===0&&ge.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,r,i,l,h){h.x=this.smallestInAbsValue(n.x,r.x,i.x,l.x),h.y=this.smallestInAbsValue(n.y,r.y,i.y,l.y),n.x-=h.x,n.y-=h.y,r.x-=h.x,r.y-=h.y,i.x-=h.x,i.y-=h.y,l.x-=h.x,l.y-=h.y},t.prototype.safeHCoordinateIntersection=function(n,r,i,l){var h=null;try{h=bs.intersection(n,r,i,l)}catch(u){if(u instanceof Nf)h=t.nearestEndpoint(n,r,i,l);else throw u}finally{}return h},t.prototype.intersection=function(n,r,i,l){var h=this.intersectionWithNormalization(n,r,i,l);return this.isInSegmentEnvelopes(h)||(h=new Lt(t.nearestEndpoint(n,r,i,l))),this._precisionModel!==null&&this._precisionModel.makePrecise(h),h},t.prototype.smallestInAbsValue=function(n,r,i,l){var h=n,u=Math.abs(h);return Math.abs(r)1e-4&&xi.out.println("Distance = "+h.distance(u))},t.prototype.intersectionWithNormalization=function(n,r,i,l){var h=new Lt(n),u=new Lt(r),y=new Lt(i),w=new Lt(l),S=new Lt;this.normalizeToEnvCentre(h,u,y,w,S);var C=this.safeHCoordinateIntersection(h,u,y,w);return C.x+=S.x,C.y+=S.y,C},t.prototype.computeCollinearIntersection=function(n,r,i,l){var h=Pe.intersects(n,r,i),u=Pe.intersects(n,r,l),y=Pe.intersects(i,l,n),w=Pe.intersects(i,l,r);return h&&u?(this._intPt[0]=i,this._intPt[1]=l,e.COLLINEAR_INTERSECTION):y&&w?(this._intPt[0]=n,this._intPt[1]=r,e.COLLINEAR_INTERSECTION):h&&y?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!u&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):h&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!u&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&y?(this._intPt[0]=l,this._intPt[1]=n,l.equals(n)&&!h&&!w?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=l,this._intPt[1]=r,l.equals(r)&&!h&&!y?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,r,i,l,h){var u=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,C=i.xl.x?i.x:l.x,N=i.y>l.y?i.y:l.y,K=u>C?u:C,Y=wP?y:P,B=S0&&u>0||h<0&&u<0)return e.NO_INTERSECTION;var y=ge.orientationIndex(i,l,n),w=ge.orientationIndex(i,l,r);if(y>0&&w>0||y<0&&w<0)return e.NO_INTERSECTION;var S=h===0&&u===0&&y===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,l):(h===0||u===0||y===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(l)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(l)?this._intPt[0]=r:h===0?this._intPt[0]=new Lt(i):u===0?this._intPt[0]=new Lt(l):y===0?this._intPt[0]=new Lt(n):w===0&&(this._intPt[0]=new Lt(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,l)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,r,i,l){var h=n,u=ge.distancePointLine(n,i,l),y=ge.distancePointLine(r,i,l);return y0?n>0?-i:i:n>0?i:-i;if(t===0||n===0)return r>0?e>0?i:-i:e>0?-i:i;if(t>0?r>0?t<=r||(i=-i,l=e,e=n,n=l,l=t,t=r,r=l):t<=-r?(i=-i,n=-n,r=-r):(l=e,e=-n,n=l,l=t,t=-r,r=l):r>0?-t<=r?(i=-i,e=-e,t=-t):(l=-e,e=n,n=l,l=-t,t=r,r=l):t>=r?(e=-e,t=-t,n=-n,r=-r):(i=-i,l=-e,e=-n,n=l,l=-t,t=-r,r=l),e>0)if(n>0){if(!(e<=n))return i}else return i;else{if(n>0)return-i;if(e>=n)i=-i,e=-e,n=-n;else return-i}for(;;){if(h=Math.floor(n/e),n=n-h*e,r=r-h*t,r<0)return-i;if(r>t)return i;if(e>n+n){if(tr+r)return-i;n=e-n,r=t-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(h=Math.floor(e/n),e=e-h*n,t=t-h*r,t<0))return i;if(t>r)return-i;if(n>e+e){if(rt+t)return i;e=n-e,t=r-t,i=-i}if(t===0)return e===0?0:i;if(e===0)return-i}};var Xs=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e};Xs.prototype.countSegment=function(e,t){if(e.xr&&(n=t.x,r=e.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var i=e.x-this._p.x,l=e.y-this._p.y,h=t.x-this._p.x,u=t.y-this._p.y,y=Ic.signOfDet2x2(i,l,h,u);if(y===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};Xs.prototype.isPointInPolygon=function(){return this.getLocation()!==At.EXTERIOR};Xs.prototype.getLocation=function(){return this._isPointOnSegment?At.BOUNDARY:this._crossingCount%2===1?At.INTERIOR:At.EXTERIOR};Xs.prototype.isOnSegment=function(){return this._isPointOnSegment};Xs.prototype.interfaces_=function(){return[]};Xs.prototype.getClass=function(){return Xs};Xs.locatePointInRing=function(){if(arguments[0]instanceof Lt&&Fe(arguments[1],Sn)){for(var e=arguments[0],t=arguments[1],n=new Xs(e),r=new Lt,i=new Lt,l=1;l1||y<0||y>1)&&(i=!0)}}return i?Uo.min(ge.distancePointLine(e,n,r),ge.distancePointLine(t,n,r),ge.distancePointLine(n,e,t),ge.distancePointLine(r,e,t)):0};ge.isPointInRing=function(e,t){return ge.locatePointInRing(e,t)!==At.EXTERIOR};ge.computeLength=function(e){var t=e.size();if(t<=1)return 0;var n=0,r=new Lt;e.getCoordinate(0,r);for(var i=r.x,l=r.y,h=1;hn.y&&(n=l,r=i)}var h=r;do h=h-1,h<0&&(h=t);while(e[h].equals2D(n)&&h!==r);var u=r;do u=(u+1)%t;while(e[u].equals2D(n)&&u!==r);var y=e[h],w=e[u];if(y.equals2D(n)||w.equals2D(n)||y.equals2D(w))return!1;var S=ge.computeOrientation(y,n,w),C=!1;return S===0?C=y.x>w.x:C=S>0,C};ge.locatePointInRing=function(e,t){return Xs.locatePointInRing(e,t)};ge.distancePointLinePerpendicular=function(e,t,n){var r=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),i=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/r;return Math.abs(i)*Math.sqrt(r)};ge.computeOrientation=function(e,t,n){return ge.orientationIndex(e,t,n)};ge.distancePointLine=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(t.length===0)throw new tr("Line array must contain at least one vertex");for(var n=e.distance(t[0]),r=0;r=1)return l.distance(u);var S=((h.y-l.y)*(u.x-h.x)-(h.x-l.x)*(u.y-h.y))/y;return Math.abs(S)*Math.sqrt(y)}};ge.isOnLine=function(e,t){for(var n=new qu,r=1;r0};hf.prototype.interfaces_=function(){return[rs]};hf.prototype.getClass=function(){return hf};var ff=function(){};ff.prototype.isInBoundary=function(e){return e>1};ff.prototype.interfaces_=function(){return[rs]};ff.prototype.getClass=function(){return ff};var pf=function(){};pf.prototype.isInBoundary=function(e){return e===1};pf.prototype.interfaces_=function(){return[rs]};pf.prototype.getClass=function(){return pf};var Br=function(){};Br.prototype.add=function(){};Br.prototype.addAll=function(){};Br.prototype.isEmpty=function(){};Br.prototype.iterator=function(){};Br.prototype.size=function(){};Br.prototype.toArray=function(){};Br.prototype.remove=function(){};function Lv(e){this.message=e||""}Lv.prototype=new Error;Lv.prototype.name="IndexOutOfBoundsException";var Of=function(){};Of.prototype.hasNext=function(){};Of.prototype.next=function(){};Of.prototype.remove=function(){};var xs=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Br);function zf(e){this.message=e||""}zf.prototype=new Error;zf.prototype.name="NoSuchElementException";var ue=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Br&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Br]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},t.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},t.prototype.iterator=function(){return new Q4(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Lv;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,r=[],i=0,l=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}e.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],C=arguments[1];return this.add(S,C),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var P=arguments[0],D=arguments[1],N=arguments[2];if(N)for(var K=0;K=0;Y--)r.add(P[Y],D);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Lt){var J=arguments[0],B=arguments[1],G=arguments[2];if(!G){var H=this.size();if(H>0){if(J>0){var at=this.get(J-1);if(at.equals2D(B))return null}if(JEt&&($=-1);for(var Pt=mt;Pt!==Et;Pt+=$)r.add(ft[Pt],rt);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new Lt(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(ue),pn=function(){},uy={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};uy.ForwardComparator.get=function(){return dd};uy.BidirectionalComparator.get=function(){return df};uy.coordArrayType.get=function(){return new Array(0).fill(null)};pn.prototype.interfaces_=function(){return[]};pn.prototype.getClass=function(){return pn};pn.isRing=function(e){return!(e.length<4||!e[0].equals2D(e[e.length-1]))};pn.ptNotInList=function(e,t){for(var n=0;n=e?t:[]};pn.indexOf=function(e,t){for(var n=0;n0)&&(t=e[n]);return t};pn.extract=function(e,t,n){t=Uo.clamp(t,0,e.length),n=Uo.clamp(n,-1,e.length);var r=n-t+1;n<0&&(r=0),t>=e.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=pn.compare(n,r),l=pn.isEqualReversed(n,r);return l?0:i};df.prototype.OLDcompare=function(e,t){var n=e,r=t;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=pn.increasingDirection(n),l=pn.increasingDirection(r),h=i>0?0:n.length-1,u=l>0?0:n.length-1,y=0;y0)t=t.right;else return t.value}return null};Li.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:Ja,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=e.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var l=n.value;return n.value=t,l}while(n!==null);var h={key:e,left:null,right:null,value:t,parent:r,color:Ja,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=h:r.right=h,this.fixAfterInsertion(h),this.size_++,null};Li.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=_u;e!=null&&e!==this.root_&&e.parent.color===_u;)if(Gn(e)===t0(Gn(Gn(e)))){var n=Fw(Gn(Gn(e)));zw(n)===_u?(Ha(Gn(e),Ja),Ha(n,Ja),Ha(Gn(Gn(e)),_u),e=Gn(Gn(e))):(e===Fw(Gn(e))&&(e=Gn(e),t.rotateLeft(e)),Ha(Gn(e),Ja),Ha(Gn(Gn(e)),_u),t.rotateRight(Gn(Gn(e))))}else{var r=t0(Gn(Gn(e)));zw(r)===_u?(Ha(Gn(e),Ja),Ha(r,Ja),Ha(Gn(Gn(e)),_u),e=Gn(Gn(e))):(e===t0(Gn(e))&&(e=Gn(e),t.rotateRight(e)),Ha(Gn(e),Ja),Ha(Gn(Gn(e)),_u),t.rotateLeft(Gn(Gn(e))))}this.root_.color=Ja};Li.prototype.values=function(){var e=new ue,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Li.successor(t))!==null;)e.add(t.value);return e};Li.prototype.entrySet=function(){var e=new Pv,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Li.successor(t))!==null;)e.add(t);return e};Li.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Li.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Li.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Li.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Li.prototype.size=function(){return this.size_};var md=function(){};md.prototype.interfaces_=function(){return[]};md.prototype.getClass=function(){return md};function WE(){}WE.prototype=new cy;function Js(){this.array_=[],arguments[0]instanceof Br&&this.addAll(arguments[0])}Js.prototype=new WE;Js.prototype.contains=function(e){for(var t=this,n=0,r=this.array_.length;n=0;){var h=i.substring(0,l);r.add(h),i=i.substring(l+n),l=i.indexOf(t)}i.length>0&&r.add(i);for(var u=new Array(r.size()).fill(null),y=0;y0)for(var l=i;l0&&r.append(" ");for(var l=0;l0&&r.append(","),r.append(es.toString(e.getOrdinate(i,l)))}return r.append(")"),r.toString()}};Ir.ensureValidRing=function(e,t){var n=t.size();if(n===0)return t;if(n<=3)return Ir.createClosedRing(e,t,4);var r=t.getOrdinate(0,Sn.X)===t.getOrdinate(n-1,Sn.X)&&t.getOrdinate(0,Sn.Y)===t.getOrdinate(n-1,Sn.Y);return r?t:Ir.createClosedRing(e,t,n+1)};Ir.createClosedRing=function(e,t,n){var r=e.create(n,t.getDimension()),i=t.size();Ir.copy(t,0,r,0,i);for(var l=i;l0&&Ir.reverse(r._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?In.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return ge.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var r=this._points.copy();Ir.reverse(r);var i=this.getFactory().createLineString(r);return i},t.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],l=i,h=0,u=0;h= 2)");this._points=r},t.prototype.isCoordinate=function(r){for(var i=this,l=0;l=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(yr),wa=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Oe.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?e.prototype.equalsExact.call(this,r,i):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var r=this,i=this._geometries.length,l=new Array(i).fill(null),h=0;h0?t.createPoint(n[0]):t.createPoint():e};_d.prototype.interfaces_=function(){return[is.GeometryEditorOperation]};_d.prototype.getClass=function(){return _d};var vd=function(){};vd.prototype.edit=function(e,t){return e instanceof Ia?t.createLinearRing(this.edit(e.getCoordinateSequence(),e)):e instanceof yr?t.createLineString(this.edit(e.getCoordinateSequence(),e)):e instanceof So?t.createPoint(this.edit(e.getCoordinateSequence(),e)):e};vd.prototype.interfaces_=function(){return[is.GeometryEditorOperation]};vd.prototype.getClass=function(){return vd};var Sr=function(){var e=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n0){var t=new ua(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Sr(n):new Sr(n,r)}};Ca.prototype.interfaces_=function(){return[uf,as]};Ca.prototype.getClass=function(){return Ca};Ca.instance=function(){return Ca.instanceObject};Av.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};Av.instanceObject.get=function(){return new Ca};Object.defineProperties(Ca,Av);var ZE=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,r){return this.map_.set(n,r),r},t.prototype.values=function(){for(var n=new ue,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},t.prototype.entrySet=function(){var n=new Pv;return this.map_.entries().forEach(function(r){return n.add(r)}),n},t.prototype.size=function(){return this.map_.size()},t}(qc),Tn=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof $s){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},kv={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Tn.prototype.equals=function(e){if(!(e instanceof Tn))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale};Tn.prototype.compareTo=function(e){var t=e,n=this.getMaximumSignificantDigits(),r=t.getMaximumSignificantDigits();return new Ks(n).compareTo(new Ks(r))};Tn.prototype.getScale=function(){return this._scale};Tn.prototype.isFloating=function(){return this._modelType===Tn.FLOATING||this._modelType===Tn.FLOATING_SINGLE};Tn.prototype.getType=function(){return this._modelType};Tn.prototype.toString=function(){var e="UNKNOWN";return this._modelType===Tn.FLOATING?e="Floating":this._modelType===Tn.FLOATING_SINGLE?e="Floating-Single":this._modelType===Tn.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e};Tn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var e=arguments[0];if(je.isNaN(e))return e;if(this._modelType===Tn.FLOATING_SINGLE){var t=e;return t}return this._modelType===Tn.FIXED?Math.round(e*this._scale)/this._scale:e}else if(arguments[0]instanceof Lt){var n=arguments[0];if(this._modelType===Tn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Tn.prototype.getMaximumSignificantDigits=function(){var e=16;return this._modelType===Tn.FLOATING?e=16:this._modelType===Tn.FLOATING_SINGLE?e=6:this._modelType===Tn.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e};Tn.prototype.setScale=function(e){this._scale=Math.abs(e)};Tn.prototype.interfaces_=function(){return[as,ss]};Tn.prototype.getClass=function(){return Tn};Tn.mostPrecise=function(e,t){return e.compareTo(t)>=0?e:t};kv.serialVersionUID.get=function(){return 7777263578777804e3};kv.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Tn,kv);var $s=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},Dv={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};$s.prototype.readResolve=function(){return $s.nameToTypeMap.get(this._name)};$s.prototype.toString=function(){return this._name};$s.prototype.interfaces_=function(){return[as]};$s.prototype.getClass=function(){return $s};Dv.serialVersionUID.get=function(){return-552860263173159e4};Dv.nameToTypeMap.get=function(){return new ZE};Object.defineProperties($s,Dv);Tn.Type=$s;Tn.FIXED=new $s("FIXED");Tn.FLOATING=new $s("FLOATING");Tn.FLOATING_SINGLE=new $s("FLOATING SINGLE");var fn=function e(){this._precisionModel=new Tn,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Fe(arguments[0],uf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Tn&&(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]))},XE={serialVersionUID:{configurable:!0}};fn.prototype.toGeometry=function(e){return e.isNull()?this.createPoint(null):e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new Lt(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new Lt(e.getMinX(),e.getMinY()),new Lt(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new Lt(e.getMinX(),e.getMinY()),new Lt(e.getMinX(),e.getMaxY()),new Lt(e.getMaxX(),e.getMaxY()),new Lt(e.getMaxX(),e.getMinY()),new Lt(e.getMinX(),e.getMinY())]),null)};fn.prototype.createLineString=function(e){if(e){if(e instanceof Array)return new yr(this.getCoordinateSequenceFactory().create(e),this);if(Fe(e,Sn))return new yr(e,this)}else return new yr(this.getCoordinateSequenceFactory().create([]),this)};fn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Au(null,this);if(arguments.length===1){var e=arguments[0];return new Au(e,this)}};fn.prototype.buildGeometry=function(e){for(var t=null,n=!1,r=!1,i=e.iterator();i.hasNext();){var l=i.next(),h=l.getClass();t===null&&(t=h),h!==t&&(n=!0),l.isGeometryCollectionOrDerived()&&(r=!0)}if(t===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(fn.toGeometryArray(e));var u=e.iterator().next(),y=e.size()>1;if(y){if(u instanceof jr)return this.createMultiPolygon(fn.toPolygonArray(e));if(u instanceof yr)return this.createMultiLineString(fn.toLineStringArray(e));if(u instanceof So)return this.createMultiPoint(fn.toPointArray(e));tn.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};fn.prototype.createMultiPointFromCoords=function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)};fn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Lt){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}else if(Fe(arguments[0],Sn)){var t=arguments[0];return new So(t,this)}}};fn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};fn.prototype.createPolygon=function(){if(arguments.length===0)return new jr(null,null,this);if(arguments.length===1){if(Fe(arguments[0],Sn)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Ia){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new jr(r,i,this)}};fn.prototype.getSRID=function(){return this._SRID};fn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Gi(null,this);if(arguments.length===1){var e=arguments[0];return new Gi(e,this)}};fn.prototype.createGeometry=function(e){var t=new is(this);return t.edit(e,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};fn.prototype.getPrecisionModel=function(){return this._precisionModel};fn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}else if(Fe(arguments[0],Sn)){var t=arguments[0];return new Ia(t,this)}}};fn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new wa(null,this);if(arguments.length===1){var e=arguments[0];return new wa(e,this)}};fn.prototype.createMultiPoint=function(){var e=this;if(arguments.length===0)return new mf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new mf(t,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Fe(arguments[0],Sn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),l=0;l=this.size())throw new Error;return this.array_[e]};ca.prototype.push=function(e){return this.array_.push(e),e};ca.prototype.pop=function(e){if(this.array_.length===0)throw new my;return this.array_.pop()};ca.prototype.peek=function(){if(this.array_.length===0)throw new my;return this.array_[this.array_.length-1]};ca.prototype.empty=function(){return this.array_.length===0};ca.prototype.isEmpty=function(){return this.empty()};ca.prototype.search=function(e){return this.array_.indexOf(e)};ca.prototype.size=function(){return this.array_.length};ca.prototype.toArray=function(){for(var e=this,t=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===ge.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ta.prototype.getRightmostSideOfSegment=function(e,t){var n=e.getEdge(),r=n.getCoordinates();if(t<0||t+1>=r.length||r[t].y===r[t+1].y)return-1;var i=ee.LEFT;return r[t].yt._minCoord.x)&&(t._minDe=e,t._minIndex=r,t._minCoord=n[r])};ta.prototype.findRightmostEdgeAtNode=function(){var e=this._minDe.getNode(),t=e.getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};ta.prototype.findEdge=function(e){for(var t=this,n=e.iterator();n.hasNext();){var r=n.next();r.isForward()&&t.checkForRightmostCoordinate(r)}tn.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===ee.LEFT&&(this._orientedDe=this._minDe.getSym())};ta.prototype.interfaces_=function(){return[]};ta.prototype.getClass=function(){return ta};var al=function(e){function t(n,r){e.call(this,t.msgWithCoord(n,r)),this.pt=r?new Lt(r):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},t}(ol),gy=function(){this.array_=[]};gy.prototype.addLast=function(e){this.array_.push(e)};gy.prototype.removeFirst=function(){return this.array_.shift()};gy.prototype.isEmpty=function(){return this.array_.length===0};var qi=function(){this._finder=null,this._dirEdgeList=new ue,this._nodes=new ue,this._rightMostCoord=null,this._env=null,this._finder=new ta};qi.prototype.clearVisitedEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.setVisited(!1)}};qi.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};qi.prototype.computeNodeDepth=function(e){for(var t=this,n=null,r=e.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new al("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(n);for(var l=e.getEdges().iterator();l.hasNext();){var h=l.next();h.setVisited(!0),t.copySymDepths(h)}};qi.prototype.computeDepth=function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.setEdgeDepths(ee.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)};qi.prototype.create=function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};qi.prototype.findResultEdges=function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(ee.RIGHT)>=1&&t.getDepth(ee.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}};qi.prototype.computeDepths=function(e){var t=this,n=new Pv,r=new gy,i=e.getNode();for(r.addLast(i),n.add(i),e.setVisited(!0);!r.isEmpty();){var l=r.removeFirst();n.add(l),t.computeNodeDepth(l);for(var h=l.getEdges().iterator();h.hasNext();){var u=h.next(),y=u.getSym();if(!y.isVisited()){var w=y.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};qi.prototype.compareTo=function(e){var t=e;return this._rightMostCoord.xt._rightMostCoord.x?1:0};qi.prototype.getEnvelope=function(){if(this._env===null){for(var e=new Pe,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ee.ON]=this.location[ee.ON],n[ee.LEFT]=At.NONE,n[ee.RIGHT]=At.NONE,this.location=n}for(var r=0;r1&&e.append(At.toLocationSymbol(this.location[ee.LEFT])),e.append(At.toLocationSymbol(this.location[ee.ON])),this.location.length>1&&e.append(At.toLocationSymbol(this.location[ee.RIGHT])),e.toString()};qn.prototype.setLocations=function(e,t,n){this.location[ee.ON]=e,this.location[ee.LEFT]=t,this.location[ee.RIGHT]=n};qn.prototype.get=function(e){return e1};qn.prototype.isAnyNull=function(){for(var e=this,t=0;te._maxNodeDegree&&(e._maxNodeDegree=r),t=e.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2};Dr.prototype.addPoints=function(e,t,n){var r=this,i=e.getCoordinates();if(t){var l=1;n&&(l=0);for(var h=l;h=0;y--)r._pts.add(i[y])}};Dr.prototype.isHole=function(){return this._isHole};Dr.prototype.setInResult=function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)};Dr.prototype.containsPoint=function(e){var t=this.getLinearRing(),n=t.getEnvelopeInternal();if(!n.contains(e)||!ge.isPointInRing(e,t.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(e))return!1}return!0};Dr.prototype.addHole=function(e){this._holes.add(e)};Dr.prototype.isShell=function(){return this._shell===null};Dr.prototype.getLabel=function(){return this._label};Dr.prototype.getEdges=function(){return this._edges};Dr.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Dr.prototype.getShell=function(){return this._shell};Dr.prototype.mergeLabel=function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=t.getLocation(n,ee.RIGHT);if(r===At.NONE)return null;if(this._label.getLocation(n)===At.NONE)return this._label.setLocation(n,r),null}};Dr.prototype.setShell=function(e){this._shell=e,e!==null&&e.addHole(this)};Dr.prototype.toPolygon=function(e){for(var t=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(e)};Go.prototype.isInResult=function(){return this._isInResult};Go.prototype.isVisited=function(){return this._isVisited};Go.prototype.interfaces_=function(){return[]};Go.prototype.getClass=function(){return Go};var yy=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Dn(0,At.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,r){var i=At.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var l=n.getLocation(r);i!==At.BOUNDARY&&(i=l)}return i},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Dn(n,r):this._label.setLocation(n,r)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Dn)for(var i=arguments[0],l=0;l<2;l++){var h=n.computeMergedLocation(i,l),u=n._label.getLocation(l);u===At.NONE&&n._label.setLocation(l,h)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=At.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case At.BOUNDARY:i=At.INTERIOR;break;case At.INTERIOR:i=At.BOUNDARY;break;default:i=At.BOUNDARY;break}this._label.setLocation(n,i)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Go),ea=function(){this.nodeMap=new Li,this.nodeFact=null;var e=arguments[0];this.nodeFact=e};ea.prototype.find=function(e){return this.nodeMap.get(e)};ea.prototype.addNode=function(){if(arguments[0]instanceof Lt){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}else if(arguments[0]instanceof yy){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ea.prototype.print=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};ea.prototype.iterator=function(){return this.nodeMap.values().iterator()};ea.prototype.values=function(){return this.nodeMap.values()};ea.prototype.getBoundaryNodes=function(e){for(var t=new ue,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(e)===At.BOUNDARY&&t.add(r)}return t};ea.prototype.add=function(e){var t=e.getCoordinate(),n=this.addNode(t);n.add(e)};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};var Rn=function(){},Fd={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};Rn.isNorthern=function(e){return e===Rn.NE||e===Rn.NW};Rn.isOpposite=function(e,t){if(e===t)return!1;var n=(e-t+4)%4;return n===2};Rn.commonHalfPlane=function(e,t){if(e===t)return e;var n=(e-t+4)%4;if(n===2)return-1;var r=et?e:t;return r===0&&i===3?3:r};Rn.isInHalfPlane=function(e,t){return t===Rn.SE?e===Rn.SE||e===Rn.SW:e===t||e===t+1};Rn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new tr("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?Rn.NE:Rn.SE:t>=0?Rn.NW:Rn.SW}else if(arguments[0]instanceof Lt&&arguments[1]instanceof Lt){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new tr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Rn.NE:Rn.SE:r.y>=n.y?Rn.NW:Rn.SW}};Fd.NE.get=function(){return 0};Fd.NW.get=function(){return 1};Fd.SW.get=function(){return 2};Fd.SE.get=function(){return 3};Object.defineProperties(Rn,Fd);var Pi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=t,this.init(n,r),this._label=i}else if(arguments.length===4){var l=arguments[0],h=arguments[1],u=arguments[2],y=arguments[3];this._edge=l,this.init(h,u),this._label=y}};Pi.prototype.compareDirection=function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant2){h.linkDirectedEdgesForMinimalEdgeRings();var u=h.buildMinimalRings(),y=r.findShell(u);y!==null?(r.placePolygonHoles(y,u),t.add(y)):n.addAll(u)}else i.add(h)}return i};Eo.prototype.containsPoint=function(e){for(var t=this._shellList.iterator();t.hasNext();){var n=t.next();if(n.containsPoint(e))return!0}return!1};Eo.prototype.buildMaximalEdgeRings=function(e){for(var t=this,n=new ue,r=e.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var l=new uR(i,t._geometryFactory);n.add(l),l.setInResult()}}return n};Eo.prototype.placePolygonHoles=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(e)}};Eo.prototype.getPolygons=function(){var e=this.computePolygons(this._shellList);return e};Eo.prototype.findEdgeRingContaining=function(e,t){for(var n=e.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),l=null,h=null,u=t.iterator();u.hasNext();){var y=u.next(),w=y.getLinearRing(),S=w.getEnvelopeInternal();l!==null&&(h=l.getLinearRing().getEnvelopeInternal());var C=!1;S.contains(r)&&ge.isPointInRing(i,w.getCoordinates())&&(C=!0),C&&(l===null||h.contains(S))&&(l=y)}return l};Eo.prototype.findShell=function(e){for(var t=0,n=null,r=e.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,t++)}return tn.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n};Eo.prototype.add=function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];cr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(t),i=new ue,l=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(l,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Eo.prototype.interfaces_=function(){return[]};Eo.prototype.getClass=function(){return Eo};var yf=function(){};yf.prototype.getBounds=function(){};yf.prototype.interfaces_=function(){return[]};yf.prototype.getClass=function(){return yf};var Is=function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t};Is.prototype.getItem=function(){return this._item};Is.prototype.getBounds=function(){return this._bounds};Is.prototype.interfaces_=function(){return[yf,as]};Is.prototype.getClass=function(){return Is};var ll=function(){this._size=null,this._items=null,this._size=0,this._items=new ue,this._items.add(null)};ll.prototype.poll=function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e};ll.prototype.size=function(){return this._size};ll.prototype.reorder=function(e){for(var t=this,n=null,r=this._items.get(e);e*2<=this._size&&(n=e*2,n!==t._size&&t._items.get(n+1).compareTo(t._items.get(n))<0&&n++,t._items.get(n).compareTo(r)<0);e=n)t._items.set(e,t._items.get(n));this._items.set(e,r)};ll.prototype.clear=function(){this._size=0,this._items.clear()};ll.prototype.isEmpty=function(){return this._size===0};ll.prototype.add=function(e){var t=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)t._items.set(n,t._items.get(Math.trunc(n/2)));this._items.set(n,e)};ll.prototype.interfaces_=function(){return[]};ll.prototype.getClass=function(){return ll};var jl=function(){};jl.prototype.visitItem=function(e){};jl.prototype.interfaces_=function(){return[]};jl.prototype.getClass=function(){return jl};var Cc=function(){};Cc.prototype.insert=function(e,t){};Cc.prototype.remove=function(e,t){};Cc.prototype.query=function(){};Cc.prototype.interfaces_=function(){return[]};Cc.prototype.getClass=function(){return Cc};var qr=function(){if(this._childBoundables=new ue,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var e=arguments[0];this._level=e}},KE={serialVersionUID:{configurable:!0}};qr.prototype.getLevel=function(){return this._level};qr.prototype.size=function(){return this._childBoundables.size()};qr.prototype.getChildBoundables=function(){return this._childBoundables};qr.prototype.addChildBoundable=function(e){tn.isTrue(this._bounds===null),this._childBoundables.add(e)};qr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};qr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};qr.prototype.interfaces_=function(){return[yf,as]};qr.prototype.getClass=function(){return qr};KE.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(qr,KE);var Cs=function(){};Cs.reverseOrder=function(){return{compare:function(e,t){return t.compareTo(e)}}};Cs.min=function(e){return Cs.sort(e),e.get(0)};Cs.sort=function(e,t){var n=e.toArray();t?Cu.sort(n,t):Cu.sort(n);for(var r=e.iterator(),i=0,l=n.length;iMr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,e,t),null):(this.expand(this._boundable2,this._boundable1,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,e,t),null;if(r)return this.expand(this._boundable2,this._boundable1,e,t),null;throw new tr("neither boundable is composite")};Mr.prototype.isLeaves=function(){return!(Mr.isComposite(this._boundable1)||Mr.isComposite(this._boundable2))};Mr.prototype.compareTo=function(e){var t=e;return this._distancet._distance?1:0};Mr.prototype.expand=function(e,t,n,r){for(var i=this,l=e.getChildBoundables(),h=l.iterator();h.hasNext();){var u=h.next(),y=new Mr(u,t,i._itemDistance);y.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},_y={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};pi.prototype.getNodeCapacity=function(){return this._nodeCapacity};pi.prototype.lastNode=function(e){return e.get(e.size()-1)};pi.prototype.size=function(){var e=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],n=0,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof qr?n+=e.size(i):i instanceof Is&&(n+=1)}return n}};pi.prototype.removeItem=function(e,t){for(var n=null,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Is&&i.getItem()===t&&(n=i)}return n!==null?(e.getChildBoundables().remove(n),!0):!1};pi.prototype.itemsTree=function(){var e=this;if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new ue:t}else if(arguments.length===1){for(var n=arguments[0],r=new ue,i=n.getChildBoundables().iterator();i.hasNext();){var l=i.next();if(l instanceof qr){var h=e.itemsTree(l);h!==null&&r.add(h)}else l instanceof Is?r.add(l.getItem()):tn.shouldNeverReachHere()}return r.size()<=0?null:r}};pi.prototype.insert=function(e,t){tn.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Is(e,t))};pi.prototype.boundablesAtLevel=function(){var e=this;if(arguments.length===1){var t=arguments[0],n=new ue;return this.boundablesAtLevel(t,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],l=arguments[2];if(tn.isTrue(r>-2),i.getLevel()===r)return l.add(i),null;for(var h=i.getChildBoundables().iterator();h.hasNext();){var u=h.next();u instanceof qr?e.boundablesAtLevel(r,u,l):(tn.isTrue(u instanceof Is),r===-1&&l.add(u))}return null}};pi.prototype.query=function(){var e=this;if(arguments.length===1){var t=arguments[0];this.build();var n=new ue;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,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(Fe(arguments[2],jl)&&arguments[0]instanceof Object&&arguments[1]instanceof qr)for(var l=arguments[0],h=arguments[1],u=arguments[2],y=h.getChildBoundables(),w=0;wn&&(n=l)}}return n+1}};pi.prototype.createParentBoundables=function(e,t){var n=this;tn.isTrue(!e.isEmpty());var r=new ue;r.add(this.createNode(t));var i=new ue(e);Cs.sort(i,this.getComparator());for(var l=i.iterator();l.hasNext();){var h=l.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(t)),n.lastNode(r).addChildBoundable(h)}return r};pi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};pi.prototype.interfaces_=function(){return[as]};pi.prototype.getClass=function(){return pi};pi.compareDoubles=function(e,t){return e>t?1:e0);for(var h=new ue,u=0;u0;){var N=D.poll(),K=N.getDistance();if(K>=C)break;N.isLeaves()?(C=K,P=N):N.expandToQueue(D,C)}return[P.getBoundable(0).getItem(),P.getBoundable(1).getItem()]}}else if(arguments.length===3){var Y=arguments[0],J=arguments[1],B=arguments[2],G=new Is(Y,J),H=new Mr(this.getRoot(),G,B);return this.nearestNeighbour(H)[0]}},t.prototype.interfaces_=function(){return[Cc,as]},t.prototype.getClass=function(){return t},t.centreX=function(r){return t.avg(r.getMinX(),r.getMaxX())},t.avg=function(r,i){return(r+i)/2},t.centreY=function(r){return t.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return Bw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[lf]},compare:function(r,i){return e.compareDoubles(t.centreX(r.getBounds()),t.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[lf]},compare:function(r,i){return e.compareDoubles(t.centreY(r.getBounds()),t.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(pi),Bw=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Pe(i.getBounds()):n.expandToInclude(i.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(qr),to=function(){};to.prototype.interfaces_=function(){return[]};to.prototype.getClass=function(){return to};to.relativeSign=function(e,t){return et?1:0};to.compare=function(e,t,n){if(t.equals2D(n))return 0;var r=to.relativeSign(t.x,n.x),i=to.relativeSign(t.y,n.y);switch(e){case 0:return to.compareValue(r,i);case 1:return to.compareValue(i,r);case 2:return to.compareValue(i,-r);case 3:return to.compareValue(-r,i);case 4:return to.compareValue(-r,-i);case 5:return to.compareValue(-i,-r);case 6:return to.compareValue(-i,r);case 7:return to.compareValue(r,-i)}return tn.shouldNeverReachHere("invalid octant value"),0};to.compareValue=function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0};var Wl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._segString=e,this.coord=new Lt(t),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!t.equals2D(e.getCoordinate(n))};Wl.prototype.getCoordinate=function(){return this.coord};Wl.prototype.print=function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)};Wl.prototype.compareTo=function(e){var t=e;return this.segmentIndext.segmentIndex?1:this.coord.equals2D(t.coord)?0:to.compare(this._segmentOctant,this.coord,t.coord)};Wl.prototype.isEndPoint=function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e};Wl.prototype.isInterior=function(){return this._isInterior};Wl.prototype.interfaces_=function(){return[ss]};Wl.prototype.getClass=function(){return Wl};var ji=function(){this._nodeMap=new Li,this._edge=null;var e=arguments[0];this._edge=e};ji.prototype.getSplitCoordinates=function(){var e=this,t=new Od;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();e.addEdgeCoordinates(r,i,t),r=i}return t.toCoordinateArray()};ji.prototype.addCollapsedNodes=function(){var e=this,t=new ue;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var r=n.next().intValue();e.add(e._edge.getCoordinate(r),r)}};ji.prototype.print=function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();){var n=t.next();n.print(e)}};ji.prototype.findCollapsesFromExistingVertices=function(e){for(var t=this,n=0;n=0?t>=0?n>=r?0:1:n>=r?7:6:t>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Lt&&arguments[1]instanceof Lt){var i=arguments[0],l=arguments[1],h=l.x-i.x,u=l.y-i.y;if(h===0&&u===0)throw new tr("Cannot compute the octant for two identical points "+i);return Tc.octant(h,u)}};var Ta=function(){};Ta.prototype.getCoordinates=function(){};Ta.prototype.size=function(){};Ta.prototype.getCoordinate=function(e){};Ta.prototype.isClosed=function(){};Ta.prototype.setData=function(e){};Ta.prototype.getData=function(){};Ta.prototype.interfaces_=function(){return[]};Ta.prototype.getClass=function(){return Ta};var bd=function(){};bd.prototype.addIntersection=function(e,t){};bd.prototype.interfaces_=function(){return[Ta]};bd.prototype.getClass=function(){return bd};var Cr=function(){this._nodeList=new ji(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};Cr.prototype.getCoordinates=function(){return this._pts};Cr.prototype.size=function(){return this._pts.length};Cr.prototype.getCoordinate=function(e){return this._pts[e]};Cr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Cr.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))};Cr.prototype.setData=function(e){this._data=e};Cr.prototype.safeOctant=function(e,t){return e.equals2D(t)?0:Tc.octant(e,t)};Cr.prototype.getData=function(){return this._data};Cr.prototype.addIntersection=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],l=new Lt(n.getIntersection(i));this.addIntersection(l,r)}};Cr.prototype.toString=function(){return Ss.toLineString(new Sr(this._pts))};Cr.prototype.getNodeList=function(){return this._nodeList};Cr.prototype.addIntersectionNode=function(e,t){var n=t,r=n+1;if(r=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}else if(arguments[0]instanceof Lt){var r=arguments[0];return ge.orientationIndex(this.p0,this.p1,r)}};Me.prototype.toGeometry=function(e){return e.createLineString([this.p0,this.p1])};Me.prototype.isVertical=function(){return this.p0.x===this.p1.x};Me.prototype.equals=function(e){if(!(e instanceof Me))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)};Me.prototype.intersection=function(e){var t=new qu;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null};Me.prototype.project=function(){if(arguments[0]instanceof Lt){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new Lt(e);var t=this.projectionFactor(e),n=new Lt;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Me){var r=arguments[0],i=this.projectionFactor(r.p0),l=this.projectionFactor(r.p1);if(i>=1&&l>=1||i<=0&&l<=0)return null;var h=this.project(r.p0);i<0&&(h=this.p0),i>1&&(h=this.p1);var u=this.project(r.p1);return l<0&&(u=this.p0),l>1&&(u=this.p1),new Me(h,u)}};Me.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Me.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Me.prototype.getCoordinate=function(e){return e===0?this.p0:this.p1};Me.prototype.distancePerpendicular=function(e){return ge.distancePointLinePerpendicular(e,this.p0,this.p1)};Me.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Me.prototype.midPoint=function(){return Me.midPoint(this.p0,this.p1)};Me.prototype.projectionFactor=function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=t*t+n*n;if(r<=0)return je.NaN;var i=((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/r;return i};Me.prototype.closestPoints=function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),r=je.MAX_VALUE,i=null,l=this.closestPoint(e.p0);r=l.distance(e.p0),n[0]=l,n[1]=e.p0;var h=this.closestPoint(e.p1);i=h.distance(e.p1),i0&&t<1)return this.project(e);var n=this.p0.distance(e),r=this.p1.distance(e);return n1||je.isNaN(t))&&(t=1),t};Me.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Me.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Me.prototype.distance=function(){if(arguments[0]instanceof Me){var e=arguments[0];return ge.distanceLineLine(this.p0,this.p1,e.p0,e.p1)}else if(arguments[0]instanceof Lt){var t=arguments[0];return ge.distancePointLine(t,this.p0,this.p1)}};Me.prototype.pointAlong=function(e){var t=new Lt;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t};Me.prototype.hashCode=function(){var e=je.doubleToLongBits(this.p0.x);e^=je.doubleToLongBits(this.p0.y)*31;var t=Math.trunc(e)^Math.trunc(e>>32),n=je.doubleToLongBits(this.p1.x);n^=je.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return t^r};Me.prototype.interfaces_=function(){return[ss,as]};Me.prototype.getClass=function(){return Me};Me.midPoint=function(e,t){return new Lt((e.x+t.x)/2,(e.y+t.y)/2)};QE.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Me,QE);var xd=function(){this.tempEnv1=new Pe,this.tempEnv2=new Pe,this._overlapSeg1=new Me,this._overlapSeg2=new Me};xd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};xd.prototype.interfaces_=function(){return[]};xd.prototype.getClass=function(){return xd};var Io=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],r=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=r};Io.prototype.getLineSegment=function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]};Io.prototype.computeSelect=function(e,t,n,r){var i=this._pts[t],l=this._pts[n];if(r.tempEnv1.init(i,l),n-t===1)return r.select(this,t),null;if(!e.intersects(r.tempEnv1))return null;var h=Math.trunc((t+n)/2);t=e.length-1)return e.length-1;for(var r=Rn.quadrant(e[n],e[n+1]),i=t+1;ih.getId()&&(h.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return Vw},Object.defineProperties(t,n),t}(wd),Vw=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],l=arguments[3],h=n.getContext(),u=i.getContext();this._si.processIntersections(h,r,u,l)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(xd),Cn=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],l=arguments[1],h=arguments[2],u=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(l),this.setJoinStyle(h),this.setMitreLimit(u)}}},ml={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}};Cn.prototype.getEndCapStyle=function(){return this._endCapStyle};Cn.prototype.isSingleSided=function(){return this._isSingleSided};Cn.prototype.setQuadrantSegments=function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=Cn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Cn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==Cn.JOIN_ROUND&&(this._quadrantSegments=Cn.DEFAULT_QUADRANT_SEGMENTS)};Cn.prototype.getJoinStyle=function(){return this._joinStyle};Cn.prototype.setJoinStyle=function(e){this._joinStyle=e};Cn.prototype.setSimplifyFactor=function(e){this._simplifyFactor=e<0?0:e};Cn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Cn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Cn.prototype.setEndCapStyle=function(e){this._endCapStyle=e};Cn.prototype.getMitreLimit=function(){return this._mitreLimit};Cn.prototype.setMitreLimit=function(e){this._mitreLimit=e};Cn.prototype.setSingleSided=function(e){this._isSingleSided=e};Cn.prototype.interfaces_=function(){return[]};Cn.prototype.getClass=function(){return Cn};Cn.bufferDistanceError=function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)};ml.CAP_ROUND.get=function(){return 1};ml.CAP_FLAT.get=function(){return 2};ml.CAP_SQUARE.get=function(){return 3};ml.JOIN_ROUND.get=function(){return 1};ml.JOIN_MITRE.get=function(){return 2};ml.JOIN_BEVEL.get=function(){return 3};ml.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};ml.DEFAULT_MITRE_LIMIT.get=function(){return 5};ml.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Cn,ml);var _r=function(e){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ge.COUNTERCLOCKWISE,this._inputLine=e||null},Bd={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};_r.prototype.isDeletable=function(e,t,n,r){var i=this._inputLine[e],l=this._inputLine[t],h=this._inputLine[n];return!this.isConcave(i,l,h)||!this.isShallow(i,l,h,r)?!1:this.isShallowSampled(i,l,e,n,r)};_r.prototype.deleteShallowConcavities=function(){for(var e=this,t=1,n=this.findNextNonDeletedIndex(t),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(e[i])};qo.prototype.isRedundant=function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1),n=e.distance(t);return nMath.PI;)e-=_n.PI_TIMES_2;for(;e<=-Math.PI;)e+=_n.PI_TIMES_2;return e};_n.angle=function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=n.x-t.x,i=n.y-t.y;return Math.atan2(i,r)}};_n.isAcute=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,l=n.x-t.x,h=n.y-t.y,u=r*l+i*h;return u>0};_n.isObtuse=function(e,t,n){var r=e.x-t.x,i=e.y-t.y,l=n.x-t.x,h=n.y-t.y,u=r*l+i*h;return u<0};_n.interiorAngle=function(e,t,n){var r=_n.angle(t,e),i=_n.angle(t,n);return Math.abs(i-r)};_n.normalizePositive=function(e){if(e<0){for(;e<0;)e+=_n.PI_TIMES_2;e>=_n.PI_TIMES_2&&(e=0)}else{for(;e>=_n.PI_TIMES_2;)e-=_n.PI_TIMES_2;e<0&&(e=0)}return e};_n.angleBetween=function(e,t,n){var r=_n.angle(t,e),i=_n.angle(t,n);return _n.diff(r,i)};_n.diff=function(e,t){var n=null;return eMath.PI&&(n=2*Math.PI-n),n};_n.toRadians=function(e){return e*Math.PI/180};_n.getTurn=function(e,t){var n=Math.sin(t-e);return n>0?_n.COUNTERCLOCKWISE:n<0?_n.CLOCKWISE:_n.NONE};_n.angleBetweenOriented=function(e,t,n){var r=_n.angle(t,e),i=_n.angle(t,n),l=i-r;return l<=-Math.PI?l+_n.PI_TIMES_2:l>Math.PI?l-_n.PI_TIMES_2:l};jc.PI_TIMES_2.get=function(){return 2*Math.PI};jc.PI_OVER_2.get=function(){return Math.PI/2};jc.PI_OVER_4.get=function(){return Math.PI/4};jc.COUNTERCLOCKWISE.get=function(){return ge.COUNTERCLOCKWISE};jc.CLOCKWISE.get=function(){return ge.CLOCKWISE};jc.NONE.get=function(){return ge.COLLINEAR};Object.defineProperties(_n,jc);var Zn=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Me,this._seg1=new Me,this._offset0=new Me,this._offset1=new Me,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new qu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Cn.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Vd={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Zn.prototype.addNextSegment=function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ge.computeOrientation(this._s0,this._s1,this._s2),r=n===ge.CLOCKWISE&&this._side===ee.LEFT||n===ge.COUNTERCLOCKWISE&&this._side===ee.RIGHT;n===0?this.addCollinear(t):r?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)};Zn.prototype.addLineEndCap=function(e,t){var n=new Me(e,t),r=new Me;this.computeOffsetSegment(n,ee.LEFT,this._distance,r);var i=new Me;this.computeOffsetSegment(n,ee.RIGHT,this._distance,i);var l=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,l);switch(this._bufParams.getEndCapStyle()){case Cn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(t,u+Math.PI/2,u-Math.PI/2,ge.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Cn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Cn.CAP_SQUARE:var y=new Lt;y.x=Math.abs(this._distance)*Math.cos(u),y.y=Math.abs(this._distance)*Math.sin(u);var w=new Lt(r.p1.x+y.x,r.p1.y+y.y),S=new Lt(i.p1.x+y.x,i.p1.y+y.y);this._segList.addPt(w),this._segList.addPt(S);break}};Zn.prototype.getCoordinates=function(){var e=this._segList.getCoordinates();return e};Zn.prototype.addMitreJoin=function(e,t,n,r){var i=!0,l=null;try{l=bs.intersection(t.p0,t.p1,n.p0,n.p1);var h=r<=0?1:l.distance(e)/Math.abs(r);h>this._bufParams.getMitreLimit()&&(i=!1)}catch(u){if(u instanceof Nf)l=new Lt(0,0),i=!1;else throw u}finally{}i?this._segList.addPt(l):this.addLimitedMitreJoin(t,n,r,this._bufParams.getMitreLimit())};Zn.prototype.addFilletCorner=function(e,t,n,r,i){var l=t.x-e.x,h=t.y-e.y,u=Math.atan2(h,l),y=n.x-e.x,w=n.y-e.y,S=Math.atan2(w,y);r===ge.CLOCKWISE?u<=S&&(u+=2*Math.PI):u>=S&&(u-=2*Math.PI),this._segList.addPt(t),this.addFilletArc(e,u,S,r,i),this._segList.addPt(n)};Zn.prototype.addOutsideTurn=function(e,t){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Lt((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 Lt((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)}};Zn.prototype.createCircle=function(e){var t=new Lt(e.x+this._distance,e.y);this._segList.addPt(t),this.addFilletArc(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};Zn.prototype.addBevelJoin=function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)};Zn.prototype.init=function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new qo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*Zn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};Zn.prototype.addCollinear=function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var t=this._li.getIntersectionNum();t>=2&&(this._bufParams.getJoinStyle()===Cn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Cn.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ge.CLOCKWISE,this._distance))};Zn.prototype.closeRing=function(){this._segList.closeRing()};Zn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};Zn.prototype.interfaces_=function(){return[]};Zn.prototype.getClass=function(){return Zn};Vd.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Vd.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Vd.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Vd.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(Zn,Vd);var no=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t};no.prototype.getOffsetCurve=function(e,t){if(this._distance=t,t===0)return null;var n=t<0,r=Math.abs(t),i=this.getSegGen(r);e.length<=1?this.computePointCurve(e[0],i):this.computeOffsetCurve(e,n,i);var l=i.getCoordinates();return n&&pn.reverse(l),l};no.prototype.computeSingleSidedBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var i=_r.simplify(e,-r),l=i.length-1;n.initSideSegments(i[l],i[l-1],ee.LEFT),n.addFirstSegment();for(var h=l-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{n.addSegments(e,!1);var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ee.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};no.prototype.computeRingBufferCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);t===ee.RIGHT&&(r=-r);var i=_r.simplify(e,r),l=i.length-1;n.initSideSegments(i[l-1],i[0],t);for(var h=1;h<=l;h++){var u=h!==1;n.addNextSegment(i[h],u)}n.closeRing()};no.prototype.computeLineBufferCurve=function(e,t){var n=this.simplifyTolerance(this._distance),r=_r.simplify(e,n),i=r.length-1;t.initSideSegments(r[0],r[1],ee.LEFT);for(var l=2;l<=i;l++)t.addNextSegment(r[l],!0);t.addLastSegment(),t.addLineEndCap(r[i-1],r[i]);var h=_r.simplify(e,-n),u=h.length-1;t.initSideSegments(h[u],h[u-1],ee.LEFT);for(var y=u-2;y>=0;y--)t.addNextSegment(h[y],!0);t.addLastSegment(),t.addLineEndCap(h[1],h[0]),t.closeRing()};no.prototype.computePointCurve=function(e,t){switch(this._bufParams.getEndCapStyle()){case Cn.CAP_ROUND:t.createCircle(e);break;case Cn.CAP_SQUARE:t.createSquare(e);break}};no.prototype.getLineCurve=function(e,t){if(this._distance=t,t<0&&!this._bufParams.isSingleSided()||t===0)return null;var n=Math.abs(t),r=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],r);else if(this._bufParams.isSingleSided()){var i=t<0;this.computeSingleSidedBufferCurve(e,i,r)}else this.computeLineBufferCurve(e,r);var l=r.getCoordinates();return l};no.prototype.getBufferParameters=function(){return this._bufParams};no.prototype.simplifyTolerance=function(e){return e*this._bufParams.getSimplifyFactor()};no.prototype.getRingCurve=function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return no.copyCoordinates(e);var r=this.getSegGen(n);return this.computeRingBufferCurve(e,t,r),r.getCoordinates()};no.prototype.computeOffsetCurve=function(e,t,n){var r=this.simplifyTolerance(this._distance);if(t){var i=_r.simplify(e,-r),l=i.length-1;n.initSideSegments(i[l],i[l-1],ee.LEFT),n.addFirstSegment();for(var h=l-2;h>=0;h--)n.addNextSegment(i[h],!0)}else{var u=_r.simplify(e,r),y=u.length-1;n.initSideSegments(u[0],u[1],ee.LEFT),n.addFirstSegment();for(var w=2;w<=y;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};no.prototype.getSegGen=function(e){return new Zn(this._precisionModel,this._bufParams,e)};no.prototype.interfaces_=function(){return[]};no.prototype.getClass=function(){return no};no.copyCoordinates=function(e){for(var t=new Array(e.length).fill(null),n=0;nl.getMaxY()||e.findStabbedSegments(t,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Fe(arguments[2],xs)&&arguments[0]instanceof Lt&&arguments[1]instanceof B0)for(var h=arguments[0],u=arguments[1],y=arguments[2],w=u.getEdge().getCoordinates(),S=0;Se._seg.p1.y&&e._seg.reverse();var C=Math.max(e._seg.p0.x,e._seg.p1.x);if(!(Ce._seg.p1.y)&&ge.computeOrientation(e._seg.p0,e._seg.p1,h)!==ge.RIGHT){var P=u.getDepth(ee.LEFT);e._seg.p0.equals(w[S])||(P=u.getDepth(ee.RIGHT));var D=new Du(e._seg,P);y.add(D)}}else if(Fe(arguments[2],xs)&&arguments[0]instanceof Lt&&Fe(arguments[1],xs))for(var N=arguments[0],K=arguments[1],Y=arguments[2],J=K.iterator();J.hasNext();){var B=J.next();B.isForward()&&e.findStabbedSegments(N,B,Y)}}};Lc.prototype.getDepth=function(e){var t=this.findStabbedSegments(e);if(t.size()===0)return 0;var n=Cs.min(t);return n._leftDepth};Lc.prototype.interfaces_=function(){return[]};Lc.prototype.getClass=function(){return Lc};tI.DepthSegment.get=function(){return Du};Object.defineProperties(Lc,tI);var Du=function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new Me(e),this._leftDepth=t};Du.prototype.compareTo=function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(t._upwardSeg)};Du.prototype.compareX=function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)};Du.prototype.toString=function(){return this._upwardSeg.toString()};Du.prototype.interfaces_=function(){return[ss]};Du.prototype.getClass=function(){return Du};var Ln=function(e,t,n){this.p0=e||null,this.p1=t||null,this.p2=n||null};Ln.prototype.area=function(){return Ln.area(this.p0,this.p1,this.p2)};Ln.prototype.signedArea=function(){return Ln.signedArea(this.p0,this.p1,this.p2)};Ln.prototype.interpolateZ=function(e){if(e===null)throw new tr("Supplied point is null.");return Ln.interpolateZ(e,this.p0,this.p1,this.p2)};Ln.prototype.longestSideLength=function(){return Ln.longestSideLength(this.p0,this.p1,this.p2)};Ln.prototype.isAcute=function(){return Ln.isAcute(this.p0,this.p1,this.p2)};Ln.prototype.circumcentre=function(){return Ln.circumcentre(this.p0,this.p1,this.p2)};Ln.prototype.area3D=function(){return Ln.area3D(this.p0,this.p1,this.p2)};Ln.prototype.centroid=function(){return Ln.centroid(this.p0,this.p1,this.p2)};Ln.prototype.inCentre=function(){return Ln.inCentre(this.p0,this.p1,this.p2)};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.area=function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)};Ln.signedArea=function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2};Ln.det=function(e,t,n,r){return e*r-t*n};Ln.interpolateZ=function(e,t,n,r){var i=t.x,l=t.y,h=n.x-i,u=r.x-i,y=n.y-l,w=r.y-l,S=h*w-u*y,C=e.x-i,P=e.y-l,D=(w*C-u*P)/S,N=(-y*C+h*P)/S,K=t.z+D*(n.z-t.z)+N*(r.z-t.z);return K};Ln.longestSideLength=function(e,t,n){var r=e.distance(t),i=t.distance(n),l=n.distance(e),h=r;return i>h&&(h=i),l>h&&(h=l),h};Ln.isAcute=function(e,t,n){return!(!_n.isAcute(e,t,n)||!_n.isAcute(t,n,e)||!_n.isAcute(n,e,t))};Ln.circumcentre=function(e,t,n){var r=n.x,i=n.y,l=e.x-r,h=e.y-i,u=t.x-r,y=t.y-i,w=2*Ln.det(l,h,u,y),S=Ln.det(h,l*l+h*h,y,u*u+y*y),C=Ln.det(l,l*l+h*h,u,u*u+y*y),P=r-S/w,D=i+C/w;return new Lt(P,D)};Ln.perpendicularBisector=function(e,t){var n=t.x-e.x,r=t.y-e.y,i=new bs(e.x+n/2,e.y+r/2,1),l=new bs(e.x-r+n/2,e.y+n+r/2,1);return new bs(i,l)};Ln.angleBisector=function(e,t,n){var r=t.distance(e),i=t.distance(n),l=r/(r+i),h=n.x-e.x,u=n.y-e.y,y=new Lt(e.x+l*h,e.y+l*u);return y};Ln.area3D=function(e,t,n){var r=t.x-e.x,i=t.y-e.y,l=t.z-e.z,h=n.x-e.x,u=n.y-e.y,y=n.z-e.z,w=i*y-l*u,S=l*h-r*y,C=r*u-i*h,P=w*w+S*S+C*C,D=Math.sqrt(P)/2;return D};Ln.centroid=function(e,t,n){var r=(e.x+t.x+n.x)/3,i=(e.y+t.y+n.y)/3;return new Lt(r,i)};Ln.inCentre=function(e,t,n){var r=t.distance(n),i=e.distance(n),l=e.distance(t),h=r+i+l,u=(r*e.x+i*t.x+l*n.x)/h,y=(r*e.y+i*t.y+l*n.y)/h;return new Lt(u,y)};var os=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new ue;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n};os.prototype.addPoint=function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,At.EXTERIOR,At.INTERIOR)};os.prototype.addPolygon=function(e){var t=this,n=this._distance,r=ee.LEFT;this._distance<0&&(n=-this._distance,r=ee.RIGHT);var i=e.getExteriorRing(),l=pn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&l.length<3)return null;this.addPolygonRing(l,n,r,At.EXTERIOR,At.INTERIOR);for(var h=0;h0&&t.isErodedCompletely(u,-t._distance)||t.addPolygonRing(y,n,ee.opposite(r),At.INTERIOR,At.EXTERIOR)}};os.prototype.isTriangleErodedCompletely=function(e,t){var n=new Ln(e[0],e[1],e[2]),r=n.inCentre(),i=ge.distancePointLine(r,n.p0,n.p1);return i=Ia.MINIMUM_VALID_SIZE&&ge.isCCW(e)&&(l=i,h=r,n=ee.opposite(n));var u=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(u,l,h)};os.prototype.add=function(e){if(e.isEmpty())return null;e instanceof jr?this.addPolygon(e):e instanceof yr?this.addLineString(e):e instanceof So?this.addPoint(e):e instanceof mf?this.addCollection(e):e instanceof Au?this.addCollection(e):e instanceof wa?this.addCollection(e):e instanceof Gi&&this.addCollection(e)};os.prototype.isErodedCompletely=function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var r=e.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return t<0&&2*Math.abs(t)>i};os.prototype.addCollection=function(e){for(var t=this,n=0;n=this._max)throw new zf;var e=this._parent.getGeometryN(this._index++);return e instanceof Gi?(this._subcollectionIterator=new Sa(e),this._subcollectionIterator.next()):e};Sa.prototype.remove=function(){throw new Error(this.getClass().getName())};Sa.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)};Sa.prototype.interfaces_=function(){return[Of]};Sa.prototype.getClass=function(){return Sa};Sa.isAtomic=function(e){return!(e instanceof Gi)};var Bo=function(){this._geom=null;var e=arguments[0];this._geom=e};Bo.prototype.locate=function(e){return Bo.locate(e,this._geom)};Bo.prototype.interfaces_=function(){return[vf]};Bo.prototype.getClass=function(){return Bo};Bo.isPointInRing=function(e,t){return t.getEnvelopeInternal().intersects(e)?ge.isPointInRing(e,t.getCoordinates()):!1};Bo.containsPointInPolygon=function(e,t){if(t.isEmpty())return!1;var n=t.getExteriorRing();if(!Bo.isPointInRing(e,n))return!1;for(var r=0;r=0;l--){var h=n._edgeList.get(l),u=h.getSym();o===null&&(o=u),r!==null&&u.setNext(r),r=h}o.setNext(r)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],o=this.findIndex(r),l=r.getDepth(ee.LEFT),h=r.getDepth(ee.RIGHT),u=this.computeDepths(o+1,this._edgeList.size(),l),y=this.computeDepths(0,o,u);if(y!==h)throw new al("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],C=arguments[2],P=C,N=w;N=0;u--){var y=r._resultAreaEdgeList.get(u),w=y.getSym();switch(o===null&&y.getEdgeRing()===n&&(o=y),h){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;l=w,h=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(y.getEdgeRing()!==n)continue;l.setNextMin(y),h=r._SCANNING_FOR_INCOMING;break}}h===this._LINKING_TO_OUTGOING&&(tn.isTrue(o!==null,"found null for first outgoing dirEdge"),tn.isTrue(o.getEdgeRing()===n,"unable to link last incoming dirEdge"),l.setNextMin(o))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var o=r.next();o.isInResult()&&n++}return n}else if(arguments.length===1){for(var l=arguments[0],h=0,u=this.iterator();u.hasNext();){var y=u.next();y.getEdgeRing()===l&&h++}return h}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=At.NONE,r=this.iterator();r.hasNext();){var o=r.next(),l=o.getSym();if(!o.isLineEdge()){if(o.isInResult()){n=At.INTERIOR;break}if(l.isInResult()){n=At.EXTERIOR;break}}}if(n===At.NONE)return null;for(var h=n,u=this.iterator();u.hasNext();){var y=u.next(),w=y.getSym();y.isLineEdge()?y.getEdge().setCovered(h===At.INTERIOR):(y.isInResult()&&(h=At.EXTERIOR),w.isInResult()&&(h=At.INTERIOR))}},t.prototype.computeLabelling=function(n){var r=this;e.prototype.computeLabelling.call(this,n),this._label=new Dn(At.NONE);for(var o=this.iterator();o.hasNext();)for(var l=o.next(),h=l.getEdge(),u=h.getLabel(),y=0;y<2;y++){var w=u.getLocation(y);(w===At.INTERIOR||w===At.BOUNDARY)&&r._label.setLocation(y,At.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Mi),eI=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new yy(n,new cR)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(gf),jl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};jl.prototype.compareTo=function(e){var t=e,n=jl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};jl.prototype.interfaces_=function(){return[ss]};jl.prototype.getClass=function(){return jl};jl.orientation=function(e){return pn.increasingDirection(e)===1};jl.compareOriented=function(e,t,n,r){for(var o=t?1:-1,l=r?1:-1,h=t?e.length:-1,u=r?n.length:-1,y=t?0:e.length-1,w=r?0:n.length-1;;){var S=e[y].compareTo(n[w]);if(S!==0)return S;y+=o,w+=l;var C=y===h,P=w===u;if(C&&!P)return-1;if(!C&&P)return 1;if(C&&P)return 0}};var Ts=function(){this._edges=new ue,this._ocaMap=new Li};Ts.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var o=r.getCoordinates(),l=0;l0&&e.print(","),e.print(o[l].x+" "+o[l].y);e.println(")")}e.print(") ")};Ts.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};Ts.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(o);l||r--;var h=new Array(r).fill(null),u=0;h[u++]=new Lt(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)h[u++]=n.edge.pts[y];return l&&(h[u]=t.coord),new Vg(h,new Dn(this.edge._label))};La.prototype.add=function(e,t,n){var r=new na(e,t,n),o=this._nodeMap.get(r);return o!==null?o:(this._nodeMap.put(r,r),r)};La.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};La.prototype.interfaces_=function(){return[]};La.prototype.getClass=function(){return La};var Ru=function(){};Ru.prototype.getChainStartIndices=function(e){var t=this,n=0,r=new ue;r.add(new Ks(n));do{var o=t.findChainEnd(e,n);r.add(new Ks(o)),n=o}while(nn?t:n};ul.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(o=1),e._depth[t][r]=o}}};bi.prototype.getDelta=function(e){return this._depth[e][ee.RIGHT]-this._depth[e][ee.LEFT]};bi.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?At.EXTERIOR:At.INTERIOR};bi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};bi.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var o=t.getLocation(n,r);(o===At.EXTERIOR||o===At.INTERIOR)&&(e.isNull(n,r)?e._depth[n][r]=bi.depthAtLocation(o):e._depth[n][r]+=bi.depthAtLocation(o))}else if(arguments.length===3){var l=arguments[0],h=arguments[1],u=arguments[2];u===At.INTERIOR&&this._depth[l][h]++}};bi.prototype.interfaces_=function(){return[]};bi.prototype.getClass=function(){return bi};bi.depthAtLocation=function(e){return e===At.EXTERIOR?0:e===At.INTERIOR?1:bi.NULL_VALUE};nI.NULL_VALUE.get=function(){return-1};Object.defineProperties(bi,nI);var Vg=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new La(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new bi,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],o=arguments[1];this.pts=r,this._label=o}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new t(n,Dn.toLineLabel(this._label));return r},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var r=this;if(!(n instanceof t))return!1;var o=n;if(this.pts.length!==o.pts.length)return!1;for(var l=!0,h=!0,u=this.pts.length,y=0;y0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var o=0;o0&&n.print(","),n.print(r.pts[o].x+" "+r.pts[o].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var o=this.pts.length-1;o>=0;o--)n.print(r.pts[o]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ul(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Pe;for(var r=0;r0&&r.append(","),r.append(n.pts[o].x+" "+n.pts[o].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},t.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var o=0;or||this._maxyl;if(h)return!1;var u=this.intersectsToleranceSquare(e,t);return tn.isTrue(!(h&&u),"Found bad envelope test"),u};ro.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Lt(this._maxx,this._maxy),this._corner[1]=new Lt(this._minx,this._maxy),this._corner[2]=new Lt(this._minx,this._miny),this._corner[3]=new Lt(this._maxx,this._miny)};ro.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};ro.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};ro.prototype.getCoordinate=function(){return this._originalPt};ro.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};ro.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=ro.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Pe(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};ro.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};ro.prototype.intersectsToleranceSquare=function(e,t){var n=!1,r=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||e.equals(this._pt)||t.equals(this._pt))};ro.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),r=e.getCoordinate(t+1);return this.intersects(n,r)?(e.addIntersection(this.getCoordinate(),t),!0):!1};ro.prototype.interfaces_=function(){return[]};ro.prototype.getClass=function(){return ro};iI.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(ro,iI);var Sd=function(){this.tempEnv1=new Pe,this.selectedSegment=new Ae};Sd.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};Sd.prototype.interfaces_=function(){return[]};Sd.prototype.getClass=function(){return Sd};var bf=function(){this._index=null;var e=arguments[0];this._index=e},oI={HotPixelSnapAction:{configurable:!0}};bf.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],o=t.getSafeEnvelope(),l=new sI(t,n,r);return this._index.query(o,{interfaces_:function(){return[Gl]},visitItem:function(h){var u=h;u.select(o,l)}}),l.isNodeAdded()}};bf.prototype.interfaces_=function(){return[]};bf.prototype.getClass=function(){return bf};oI.HotPixelSnapAction.get=function(){return sI};Object.defineProperties(bf,oI);var sI=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],o=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=o}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],o=n.getContext();if(this._parentEdge!==null&&o===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(o,r)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Sd),Pc=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new ue};Pc.prototype.processIntersections=function(e,t,n,r){var o=this;if(e===n&&t===r)return null;var l=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];if(this._li.computeIntersection(l,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;t--){try{e.bufferReducedPrecision(t)}catch(l){if(l instanceof al)e._saveException=l;else throw l}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=vi.precisionScaleFactor(this._argGeom,this._distance,n),o=new Tn(r);this.bufferFixedPrecision(o)}};vi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Tn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};vi.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};vi.prototype.bufferOriginalPrecision=function(){try{var e=new Vi(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof ol)this._saveException=t;else throw t}finally{}};vi.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};vi.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};vi.prototype.interfaces_=function(){return[]};vi.prototype.getClass=function(){return vi};vi.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new vi(e),r=n.getResultGeometry(t);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Oe&&typeof arguments[1]=="number"){var o=arguments[0],l=arguments[1],h=arguments[2],u=new vi(o);u.setQuadrantSegments(h);var y=u.getResultGeometry(l);return y}else if(arguments[2]instanceof Cn&&arguments[0]instanceof Oe&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],C=arguments[2],P=new vi(w,C),N=P.getResultGeometry(S);return N}}else if(arguments.length===4){var R=arguments[0],J=arguments[1],Y=arguments[2],K=arguments[3],B=new vi(R);B.setQuadrantSegments(Y),B.setEndCapStyle(K);var G=B.getResultGeometry(J);return G}};vi.precisionScaleFactor=function(e,t,n){var r=e.getEnvelopeInternal(),o=Uo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),l=t>0?t:0,h=o+2*l,u=Math.trunc(Math.log(h)/Math.log(10)+1),y=n-u,w=Math.pow(10,y);return w};Ff.CAP_ROUND.get=function(){return Cn.CAP_ROUND};Ff.CAP_BUTT.get=function(){return Cn.CAP_FLAT};Ff.CAP_FLAT.get=function(){return Cn.CAP_FLAT};Ff.CAP_SQUARE.get=function(){return Cn.CAP_SQUARE};Ff.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(vi,Ff);var zi=function(){this._pt=[new Lt,new Lt],this._distance=je.NaN,this._isNull=!0};zi.prototype.getCoordinates=function(){return this._pt};zi.prototype.getCoordinate=function(e){return this._pt[e]};zi.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var r=t.distance(n);rthis._distance&&this.initialize(t,n,r)}};zi.prototype.interfaces_=function(){return[]};zi.prototype.getClass=function(){return zi};var va=function(){};va.prototype.interfaces_=function(){return[]};va.prototype.getClass=function(){return va};va.computeDistance=function(){if(arguments[2]instanceof zi&&arguments[0]instanceof yr&&arguments[1]instanceof Lt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=e.getCoordinates(),o=new Ae,l=0;l0||this._isIn?At.INTERIOR:At.EXTERIOR)};Ls.prototype.interfaces_=function(){return[]};Ls.prototype.getClass=function(){return Ls};var Fi=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],o=arguments[1],l=arguments[2];this._component=r,this._segIndex=o,this._pt=l}},aI={INSIDE_AREA:{configurable:!0}};Fi.prototype.isInsideArea=function(){return this._segIndex===Fi.INSIDE_AREA};Fi.prototype.getCoordinate=function(){return this._pt};Fi.prototype.getGeometryComponent=function(){return this._component};Fi.prototype.getSegmentIndex=function(){return this._segIndex};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};aI.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Fi,aI);var Bl=function(e){this._pts=e||null};Bl.prototype.filter=function(e){e instanceof So&&this._pts.add(e)};Bl.prototype.interfaces_=function(){return[Qs]};Bl.prototype.getClass=function(){return Bl};Bl.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof So?Cs.singletonList(e):Bl.getPoints(e,new ue)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof So?n.add(t):t instanceof Gi&&t.apply(new Bl(n)),n}};var Ac=function(){this._locations=null;var e=arguments[0];this._locations=e};Ac.prototype.filter=function(e){(e instanceof So||e instanceof yr||e instanceof jr)&&this._locations.add(new Fi(e,0,e.getCoordinate()))};Ac.prototype.interfaces_=function(){return[Qs]};Ac.prototype.getClass=function(){return Ac};Ac.getLocations=function(e){var t=new ue;return e.apply(new Ac(t)),t};var wi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ls,this._minDistanceLocation=null,this._minDistance=je.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],o=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=o}};wi.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],o=1-n,l=nl.getPolygons(this._geom[n]);if(l.size()>0){var h=Ac.getLocations(this._geom[o]);if(this.computeContainmentDistance(h,l,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[o]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Fe(arguments[0],xs)&&Fe(arguments[1],xs)){for(var u=arguments[0],y=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var o=t.getCoordinates(),l=n.getCoordinate(),h=0;hthis._minDistance)return null;for(var N=S.getCoordinates(),R=C.getCoordinates(),J=0;Jthis._distance&&this.initialize(t,n,r)}};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};var Ws=function(){};Ws.prototype.interfaces_=function(){return[]};Ws.prototype.getClass=function(){return Ws};Ws.computeDistance=function(){if(arguments[2]instanceof Ti&&arguments[0]instanceof yr&&arguments[1]instanceof Lt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=new Ae,o=e.getCoordinates(),l=0;l1||e<=0)throw new tr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ns.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ns.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ns.prototype.computeOrientedDistance=function(e,t,n){var r=new kc(t);if(e.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var o=new Zl(t,this._densifyFrac);e.apply(o),n.setMaximum(o.getMaxPointDistance())}};ns.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ns.prototype.interfaces_=function(){return[]};ns.prototype.getClass=function(){return ns};ns.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ns(e,t);return n.distance()}else if(arguments.length===3){var r=arguments[0],o=arguments[1],l=arguments[2],h=new ns(r,o);return h.setDensifyFraction(l),h.distance()}};Ov.MaxPointDistanceFilter.get=function(){return kc};Ov.MaxDensifiedByFractionDistanceFilter.get=function(){return Zl};Object.defineProperties(ns,Ov);var kc=function(){this._maxPtDist=new Ti,this._minPtDist=new Ti,this._euclideanDist=new Ws,this._geom=null;var e=arguments[0];this._geom=e};kc.prototype.filter=function(e){this._minPtDist.initialize(),Ws.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};kc.prototype.getMaxPointDistance=function(){return this._maxPtDist};kc.prototype.interfaces_=function(){return[Ea]};kc.prototype.getClass=function(){return kc};var Zl=function(){this._maxPtDist=new Ti,this._minPtDist=new Ti,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};Zl.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var r=e.getCoordinate(t-1),o=e.getCoordinate(t),l=(o.x-r.x)/this._numSubSegs,h=(o.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var o=r.getCoordinates();this._errorLocation=o[1],this._errorIndicator=e.getFactory().createLineString(o),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ss.toLineString(o[0],o[1])+")"}};bo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=bo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),bo.VERBOSE&&xi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};bo.prototype.checkNegativeValid=function(){if(!(this._input instanceof jr||this._input instanceof wa||this._input instanceof Gi))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};bo.prototype.getErrorIndicator=function(){return this._errorIndicator};bo.prototype.checkMinimumDistance=function(e,t,n){var r=new wi(e,t,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Si.prototype.report=function(e){if(!Si.VERBOSE)return null;xi.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Si.prototype.getErrorMessage=function(){return this._errorMsg};Si.prototype.interfaces_=function(){return[]};Si.prototype.getClass=function(){return Si};Si.isValidMsg=function(e,t,n){var r=new Si(e,t,n);return r.isValid()?null:r.getErrorMessage()};Si.isValid=function(e,t,n){var r=new Si(e,t,n);return!!r.isValid()};Fv.VERBOSE.get=function(){return!1};Fv.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Si,Fv);var ia=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};ia.prototype.getCoordinates=function(){return this._pts};ia.prototype.size=function(){return this._pts.length};ia.prototype.getCoordinate=function(e){return this._pts[e]};ia.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ia.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Tc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};ia.prototype.setData=function(e){this._data=e};ia.prototype.getData=function(){return this._data};ia.prototype.toString=function(){return Ss.toLineString(new Sr(this._pts))};ia.prototype.interfaces_=function(){return[Ta]};ia.prototype.getClass=function(){return ia};var di=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new ue,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};di.prototype.getInteriorIntersection=function(){return this._interiorIntersection};di.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};di.prototype.getIntersectionSegments=function(){return this._intSegments};di.prototype.count=function(){return this._intersectionCount};di.prototype.getIntersections=function(){return this._intersections};di.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};di.prototype.setKeepIntersections=function(e){this._keepIntersections=e};di.prototype.processIntersections=function(e,t,n,r){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===r)return null;if(this._isCheckEndSegmentsOnly){var o=this.isEndSegment(e,t)||this.isEndSegment(n,r);if(!o)return null}var l=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];this._li.computeIntersection(l,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=l,this._intSegments[1]=h,this._intSegments[2]=u,this._intSegments[3]=y,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};di.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};di.prototype.hasIntersection=function(){return this._interiorIntersection!==null};di.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};di.prototype.interfaces_=function(){return[Du]};di.prototype.getClass=function(){return di};di.createAllIntersectionsFinder=function(e){var t=new di(e);return t.setFindAllIntersections(!0),t};di.createAnyIntersectionFinder=function(e){return new di(e)};di.createIntersectionCounter=function(e){var t=new di(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Ps=function(){this._li=new Gu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Ps.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ps.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ps.prototype.isValid=function(){return this.execute(),this._isValid};Ps.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Ps.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new di(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new Rv;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ps.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new al(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ps.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ss.toLineString(e[0],e[1])+" and "+Ss.toLineString(e[2],e[3])};Ps.prototype.interfaces_=function(){return[]};Ps.prototype.getClass=function(){return Ps};Ps.computeIntersections=function(e){var t=new Ps(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var Ou=function e(){this._nv=null;var t=arguments[0];this._nv=new Ps(e.toSegmentStrings(t))};Ou.prototype.checkValid=function(){this._nv.checkValid()};Ou.prototype.interfaces_=function(){return[]};Ou.prototype.getClass=function(){return Ou};Ou.toSegmentStrings=function(e){for(var t=new ue,n=e.iterator();n.hasNext();){var r=n.next();t.add(new ia(r.getCoordinates(),r))}return t};Ou.checkValid=function(e){var t=new Ou(e);t.checkValid()};var Dc=function(e){this._mapOp=e};Dc.prototype.map=function(e){for(var t=this,n=new ue,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};var Ma=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ae,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof yr&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],o=arguments[1];this._srcPts=r,this._isClosed=e.isClosed(r),this._snapTolerance=o}};Ma.prototype.snapVertices=function(e,t){for(var n=this,r=this._isClosed?e.size()-1:e.size(),o=0;o=0&&e.add(h+1,new Lt(l),!1)}};Ma.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,r=je.MAX_VALUE,o=-1,l=0;lt&&(t=r)}return t}else if(arguments.length===2){var o=arguments[0],l=arguments[1];return Math.min(Er.computeOverlaySnapTolerance(o),Er.computeOverlaySnapTolerance(l))}};Er.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),r=n*Er.SNAP_PRECISION_FACTOR;return r};Er.snapToSelf=function(e,t,n){var r=new Er(e);return r.snapToSelf(t,n)};lI.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Er,lI);var uI=function(e){function t(n,r,o){e.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=o!==void 0?o:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,r){var o=new Ma(n,this._snapTolerance);return o.setAllowSnappingToSourceVertices(this._isSelfSnap),o.snapTo(r)},t.prototype.transformCoordinates=function(n,r){var o=n.toCoordinateArray(),l=this.snapLine(o,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(l)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(io),Oi=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Oi.prototype.getCommon=function(){return je.longBitsToDouble(this._commonBits)};Oi.prototype.add=function(e){var t=je.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Oi.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Oi.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Oi.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Oi.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Oi.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=je.longBitsToDouble(e),n=je.toBinaryString(e),r="0000000000000000000000000000000000000000000000000000000000000000"+n,o=r.substring(r.length-64),l=o.substring(0,1)+" "+o.substring(1,12)+"(exp) "+o.substring(12)+" [ "+t+" ]";return l}};Oi.prototype.interfaces_=function(){return[]};Oi.prototype.getClass=function(){return Oi};Oi.getBit=function(e,t){var n=1<>52};Oi.zeroLowerBits=function(e,t){var n=(1<=0;r--){if(Oi.getBit(e,r)!==Oi.getBit(t,r))return n;n++}return 52};var Xl=function(){this._commonCoord=null,this._ccFilter=new Nc},Bv={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Xl.prototype.addCommonBits=function(e){var t=new Yl(this._commonCoord);e.apply(t),e.geometryChanged()};Xl.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Lt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new Yl(t);return e.apply(n),e.geometryChanged(),e};Xl.prototype.getCommonCoordinate=function(){return this._commonCoord};Xl.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Xl.prototype.interfaces_=function(){return[]};Xl.prototype.getClass=function(){return Xl};Bv.CommonCoordinateFilter.get=function(){return Nc};Bv.Translater.get=function(){return Yl};Object.defineProperties(Xl,Bv);var Nc=function(){this._commonBitsX=new Oi,this._commonBitsY=new Oi};Nc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Nc.prototype.getCommonCoordinate=function(){return new Lt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Nc.prototype.interfaces_=function(){return[Ea]};Nc.prototype.getClass=function(){return Nc};var Yl=function(){this.trans=null;var e=arguments[0];this.trans=e};Yl.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,r=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,r)};Yl.prototype.isDone=function(){return!1};Yl.prototype.isGeometryChanged=function(){return!0};Yl.prototype.interfaces_=function(){return[Es]};Yl.prototype.getClass=function(){return Yl};var mi=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};mi.prototype.selfSnap=function(e){var t=new Er(e),n=t.snapTo(e,this._snapTolerance);return n};mi.prototype.removeCommonBits=function(e){this._cbr=new Xl,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};mi.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};mi.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=Ke.overlayOp(t[0],t[1],e);return this.prepareResult(n)};mi.prototype.checkValid=function(e){e.isValid()||xi.out.println("Snapped geometry is invalid")};mi.prototype.computeSnapTolerance=function(){this._snapTolerance=Er.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};mi.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Er.snap(t[0],t[1],this._snapTolerance);return n};mi.prototype.interfaces_=function(){return[]};mi.prototype.getClass=function(){return mi};mi.overlayOp=function(e,t,n){var r=new mi(e,t);return r.getResultGeometry(n)};mi.union=function(e,t){return mi.overlayOp(e,t,Ke.UNION)};mi.intersection=function(e,t){return mi.overlayOp(e,t,Ke.INTERSECTION)};mi.symDifference=function(e,t){return mi.overlayOp(e,t,Ke.SYMDIFFERENCE)};mi.difference=function(e,t){return mi.overlayOp(e,t,Ke.DIFFERENCE)};var Wi=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};Wi.prototype.getResultGeometry=function(e){var t=null,n=!1,r=null;try{t=Ke.overlayOp(this._geom[0],this._geom[1],e);var o=!0;o&&(n=!0)}catch(l){if(l instanceof ol)r=l;else throw l}finally{}if(!n)try{t=mi.overlayOp(this._geom[0],this._geom[1],e)}catch(l){throw l instanceof ol?r:l}finally{}return t};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};Wi.overlayOp=function(e,t,n){var r=new Wi(e,t);return r.getResultGeometry(n)};Wi.union=function(e,t){return Wi.overlayOp(e,t,Ke.UNION)};Wi.intersection=function(e,t){return Wi.overlayOp(e,t,Ke.INTERSECTION)};Wi.symDifference=function(e,t){return Wi.overlayOp(e,t,Ke.SYMDIFFERENCE)};Wi.difference=function(e,t){return Wi.overlayOp(e,t,Ke.DIFFERENCE)};var Ed=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};Ed.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};Ed.prototype.interfaces_=function(){return[]};Ed.prototype.getClass=function(){return Ed};var Co=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],o=arguments[1],l=arguments[2];this._eventType=e.INSERT,this._label=r,this._xValue=o,this._obj=l}},Vv={INSERT:{configurable:!0},DELETE:{configurable:!0}};Co.prototype.isDelete=function(){return this._eventType===Co.DELETE};Co.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};Co.prototype.getObject=function(){return this._obj};Co.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};Co.prototype.getInsertEvent=function(){return this._insertEvent};Co.prototype.isInsert=function(){return this._eventType===Co.INSERT};Co.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};Co.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Co.prototype.interfaces_=function(){return[ss]};Co.prototype.getClass=function(){return Co};Vv.INSERT.get=function(){return 1};Vv.DELETE.get=function(){return 2};Object.defineProperties(Co,Vv);var Ug=function(){};Ug.prototype.interfaces_=function(){return[]};Ug.prototype.getClass=function(){return Ug};var Ei=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};Ei.prototype.isTrivialIntersection=function(e,t,n,r){if(e===n&&this._li.getIntersectionNum()===1){if(Ei.isAdjacentSegments(t,r))return!0;if(e.isClosed()){var o=e.getNumPoints()-1;if(t===0&&r===o||r===0&&t===o)return!0}}return!1};Ei.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Ei.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Ei.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Ei.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next(),o=r.getCoordinate();if(e.isIntersection(o))return!0}return!1};Ei.prototype.hasProperIntersection=function(){return this._hasProper};Ei.prototype.hasIntersection=function(){return this._hasIntersection};Ei.prototype.isDone=function(){return this._isDone};Ei.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Ei.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Ei.prototype.addIntersections=function(e,t,n,r){if(e===n&&t===r)return null;this.numTests++;var o=e.getCoordinates()[t],l=e.getCoordinates()[t+1],h=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(o,l,h,u),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,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))))};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var hR=function(e){function t(){e.call(this),this.events=new ue,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Cs.sort(this.events);for(var r=0;rt||this._maxl?1:0};Id.prototype.interfaces_=function(){return[lf]};Id.prototype.getClass=function(){return Id};var fR=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],r=arguments[1],o=arguments[2];this._min=n,this._max=r,this._item=o}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,r,o){if(!this.intersects(n,r))return null;o.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Aa),pR=function(e){function t(){e.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 e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},t.prototype.query=function(n,r,o){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,o),this._node2!==null&&this._node2.query(n,r,o)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Aa),ka=function(){this._leaves=new ue,this._root=null,this._level=0};ka.prototype.buildTree=function(){var e=this;Cs.sort(this._leaves,new Aa.NodeComparator);for(var t=this._leaves,n=null,r=new ue;;){if(e.buildLevel(t,r),r.size()===1)return r.get(0);n=t,t=r,r=n}};ka.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new fR(e,t,n))};ka.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};ka.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ka.prototype.printNode=function(e){xi.out.println(Ss.toLineString(new Lt(e._min,this._level),new Lt(e._max,this._level)))};ka.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ka.prototype.buildLevel=function(e,t){this._level++,t.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])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),o=0,l=n.iterator();l.hasNext();){var h=l.next();r[o++]=h.getCoordinate().copy()}return r},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,r,o){if(this.isBoundaryNode(n,r))return null;o===At.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,o)},t.prototype.addPolygonRing=function(n,r,o){if(n.isEmpty())return null;var l=pn.removeRepeatedPoints(n.getCoordinates());if(l.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var h=r,u=o;ge.isCCW(l)&&(h=o,u=r);var y=new Vg(l,new Dn(this._argIndex,At.BOUNDARY,h,u));this._lineEdgeMap.put(n,y),this.insertEdge(y),this.insertPoint(this._argIndex,l[0],At.BOUNDARY)},t.prototype.insertPoint=function(n,r,o){var l=this._nodes.addNode(r),h=l.getLabel();h===null?l._label=new Dn(n,o):h.setLocation(n,o)},t.prototype.createEdgeSetIntersector=function(){return new hR},t.prototype.addSelfIntersectionNodes=function(n){for(var r=this,o=this._edges.iterator();o.hasNext();)for(var l=o.next(),h=l.getLabel().getLocation(n),u=l.eiList.iterator();u.hasNext();){var y=u.next();r.addSelfIntersectionNode(n,y.coord,h)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof wa&&(this._useBoundaryDeterminationRule=!1),n instanceof jr)this.addPolygon(n);else if(n instanceof yr)this.addLineString(n);else if(n instanceof So)this.addPoint(n);else if(n instanceof mf)this.addCollection(n);else if(n instanceof Mu)this.addCollection(n);else if(n instanceof wa)this.addCollection(n);else if(n instanceof Gi)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var r=this,o=0;o50?(this._areaPtLocator===null&&(this._areaPtLocator=new wf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,r){return n.isInBoundary(r)?At.BOUNDARY:At.INTERIOR},t}(cr),Ef=function(){if(this._li=new Gu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Wp(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=rs.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Wp(0,t,r),this._arg[1]=new Wp(1,n,r)}else if(arguments.length===3){var o=arguments[0],l=arguments[1],h=arguments[2];o.getPrecisionModel().compareTo(l.getPrecisionModel())>=0?this.setComputationPrecision(o.getPrecisionModel()):this.setComputationPrecision(l.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Wp(0,o,h),this._arg[1]=new Wp(1,l,h)}};Ef.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Ef.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};var Cu=function(){};Cu.prototype.interfaces_=function(){return[]};Cu.prototype.getClass=function(){return Cu};Cu.map=function(){if(arguments[0]instanceof Oe&&Fe(arguments[1],Cu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new ue,r=0;r=e.size()?null:e.get(t)};Ar.union=function(e){var t=new Ar(e);return t.union()};fI.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Ar,fI);var Gg=function(){};Gg.prototype.interfaces_=function(){return[]};Gg.prototype.getClass=function(){return Gg};Gg.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return Ke.createEmptyResult(Ke.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),Wi.overlayOp(e,t,Ke.UNION)};function qu(){return new qg}function qg(){this.reset()}qg.prototype={constructor:qg,reset:function(){this.s=this.t=0},add:function(e){Vw($m,e,this.t),Vw(this,$m.s,this.s),this.s?this.t+=$m.t:this.s=$m.t},valueOf:function(){return this.s}};var $m=new qg;function Vw(e,t,n){var r=e.s=t+n,o=r-t,l=r-o;e.t=t-l+(n-o)}var gr=1e-6,Bn=Math.PI,el=Bn/2,Uw=Bn/4,cl=Bn*2,_u=180/Bn,qs=Bn/180,Bi=Math.abs,dR=Math.atan,Cf=Math.atan2,Br=Math.cos,Vr=Math.sin,Bf=Math.sqrt;function pI(e){return e>1?0:e<-1?Bn:Math.acos(e)}function Oc(e){return e>1?el:e<-1?-el:Math.asin(e)}function $p(){}function jg(e,t){e&&qw.hasOwnProperty(e.type)&&qw[e.type](e,t)}var Gw={Feature:function(e,t){jg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,o=n.length;++rBn?e-cl:e<-Bn?e+cl:e,t]}q0.invert=q0;function gR(e,t,n){return(e%=cl)?t||n?dI(Hw(e),Zw(t,n)):Hw(e):t||n?Zw(t,n):q0}function Ww(e){return function(t,n){return t+=e,[t>Bn?t-cl:t<-Bn?t+cl:t,n]}}function Hw(e){var t=Ww(e);return t.invert=Ww(-e),t}function Zw(e,t){var n=Br(e),r=Vr(e),o=Br(t),l=Vr(t);function h(u,y){var w=Br(y),S=Br(u)*w,C=Vr(u)*w,P=Vr(y),N=P*n+S*r;return[Cf(C*o-N*l,S*n-P*r),Oc(N*o+C*l)]}return h.invert=function(u,y){var w=Br(y),S=Br(u)*w,C=Vr(u)*w,P=Vr(y),N=P*o-C*l;return[Cf(C*o+P*l,S*n+N*r),Oc(N*n-S*r)]},h}function yR(e,t,n,r,o,l){if(n){var h=Br(t),u=Vr(t),y=r*n;o==null?(o=t+r*cl,l=t-y/2):(o=Xw(h,o),l=Xw(h,l),(r>0?ol)&&(o+=r*cl));for(var w,S=o;r>0?S>l:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function _R(e,t,n,r,o,l){var h=e[0],u=e[1],y=t[0],w=t[1],S=0,C=1,P=y-h,N=w-u,R;if(R=n-h,!(!P&&R>0)){if(R/=P,P<0){if(R0){if(R>C)return;R>S&&(S=R)}if(R=o-h,!(!P&&R<0)){if(R/=P,P<0){if(R>C)return;R>S&&(S=R)}else if(P>0){if(R0)){if(R/=N,N<0){if(R0){if(R>C)return;R>S&&(S=R)}if(R=l-u,!(!N&&R<0)){if(R/=N,N<0){if(R>C)return;R>S&&(S=R)}else if(N>0){if(R0&&(e[0]=h+S*P,e[1]=u+S*N),C<1&&(t[0]=h+C*P,t[1]=u+C*N),!0}}}}}function gg(e,t){return Bi(e[0]-t[0])=0;--u)o.point((C=S[u])[0],C[1]);else r(P.x,P.p.x,-1,o);P=P.p}P=P.o,S=P.z,N=!N}while(!P.v);o.lineEnd()}}}function Yw(e){if(t=e.length){for(var t,n=0,r=e[0],o;++nt?1:e>=t?0:NaN}function vR(e){return e.length===1&&(e=bR(e)),{left:function(t,n,r,o){for(r==null&&(r=0),o==null&&(o=t.length);r>>1;e(t[l],n)<0?r=l+1:o=l}return r},right:function(t,n,r,o){for(r==null&&(r=0),o==null&&(o=t.length);r>>1;e(t[l],n)>0?o=l:r=l+1}return r}}}function bR(e){return function(t,n){return yI(e(t),n)}}vR(yI);function _I(e){for(var t=e.length,n,r=-1,o=0,l,h;++r=0;)for(h=e[t],n=h.length;--n>=0;)l[--o]=h[n];return l}var td=1e9,rg=-td;function xR(e,t,n,r){function o(w,S){return e<=w&&w<=n&&t<=S&&S<=r}function l(w,S,C,P){var N=0,R=0;if(w==null||(N=h(w,C))!==(R=h(S,C))||y(w,S)<0^C>0)do P.point(N===0||N===3?e:n,N>1?r:t);while((N=(N+C+4)%4)!==R);else P.point(S[0],S[1])}function h(w,S){return Bi(w[0]-e)0?0:3:Bi(w[0]-n)0?2:1:Bi(w[1]-t)0?1:0:S>0?3:2}function u(w,S){return y(w.x,S.x)}function y(w,S){var C=h(w,1),P=h(S,1);return C!==P?C-P:C===0?S[1]-w[1]:C===1?w[0]-S[0]:C===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,C=mI(),P,N,R,J,Y,K,B,G,H,at,gt,ft={point:rt,lineStart:Pt,lineEnd:Qt,polygonStart:Et,polygonEnd:$};function rt(re,fe){o(re,fe)&&S.point(re,fe)}function mt(){for(var re=0,fe=0,Wt=N.length;fer&&(An-Ce)*(r-en)>(dn-en)*(e-Ce)&&++re:dn<=r&&(An-Ce)*(r-en)<(dn-en)*(e-Ce)&&--re;return re}function Et(){S=C,P=[],N=[],gt=!0}function $(){var re=mt(),fe=gt&&re,Wt=(P=_I(P)).length;(fe||Wt)&&(w.polygonStart(),fe&&(w.lineStart(),l(null,null,1,w),w.lineEnd()),Wt&&gI(P,u,re,l,w),w.polygonEnd()),S=w,P=N=R=null}function Pt(){ft.point=Tt,N&&N.push(R=[]),at=!0,H=!1,B=G=NaN}function Qt(){P&&(Tt(J,Y),K&&H&&C.rejoin(),P.push(C.result())),ft.point=rt,H&&S.lineEnd()}function Tt(re,fe){var Wt=o(re,fe);if(N&&R.push([re,fe]),at)J=re,Y=fe,K=Wt,at=!1,Wt&&(S.lineStart(),S.point(re,fe));else if(Wt&&H)S.point(re,fe);else{var Re=[B=Math.max(rg,Math.min(td,B)),G=Math.max(rg,Math.min(td,G))],ze=[re=Math.max(rg,Math.min(td,re)),fe=Math.max(rg,Math.min(td,fe))];_R(Re,ze,e,t,n,r)?(H||(S.lineStart(),S.point(Re[0],Re[1])),S.point(ze[0],ze[1]),Wt||S.lineEnd(),gt=!1):Wt&&(S.lineStart(),S.point(re,fe),gt=!1)}B=re,G=fe,H=Wt}return ft}}var n0=qu();function wR(e,t){var n=t[0],r=t[1],o=[Vr(n),-Br(n),0],l=0,h=0;n0.reset();for(var u=0,y=e.length;u=0?1:-1,rt=ft*gt,mt=rt>Bn,Et=R*H;if(n0.add(Cf(Et*ft*Vr(rt),J*at+Et*Br(rt))),l+=mt?gt+ft*cl:gt,mt^P>=n^B>=n){var $=Wg(Tf(C),Tf(K));G0($);var Pt=Wg(o,$);G0(Pt);var Qt=(mt^gt>=0?-1:1)*Oc(Pt[2]);(r>Qt||r===Qt&&($[0]||$[1]))&&(h+=mt^gt>=0?1:-1)}}return(l<-gr||lCd&&(Cd=e),tZg&&(Zg=t)}qu();function vI(e,t,n,r){return function(o,l){var h=t(l),u=o.invert(r[0],r[1]),y=mI(),w=t(y),S=!1,C,P,N,R={point:J,lineStart:K,lineEnd:B,polygonStart:function(){R.point=G,R.lineStart=H,R.lineEnd=at,P=[],C=[]},polygonEnd:function(){R.point=J,R.lineStart=K,R.lineEnd=B,P=_I(P);var gt=wR(C,u);P.length?(S||(l.polygonStart(),S=!0),gI(P,IR,gt,n,l)):gt&&(S||(l.polygonStart(),S=!0),l.lineStart(),n(null,null,1,l),l.lineEnd()),S&&(l.polygonEnd(),S=!1),P=C=null},sphere:function(){l.polygonStart(),l.lineStart(),n(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function J(gt,ft){var rt=o(gt,ft);e(gt=rt[0],ft=rt[1])&&l.point(gt,ft)}function Y(gt,ft){var rt=o(gt,ft);h.point(rt[0],rt[1])}function K(){R.point=Y,h.lineStart()}function B(){R.point=J,h.lineEnd()}function G(gt,ft){N.push([gt,ft]);var rt=o(gt,ft);w.point(rt[0],rt[1])}function H(){w.lineStart(),N=[]}function at(){G(N[0][0],N[0][1]),w.lineEnd();var gt=w.clean(),ft=y.result(),rt,mt=ft.length,Et,$,Pt;if(N.pop(),C.push(N),N=null,!!mt){if(gt&1){if($=ft[0],(Et=$.length-1)>0){for(S||(l.polygonStart(),S=!0),l.lineStart(),rt=0;rt1&>&2&&ft.push(ft.pop().concat(ft.shift())),P.push(ft.filter(ER))}}return R}}function ER(e){return e.length>1}function IR(e,t){return((e=e.x)[0]<0?e[1]-el-gr:el-e[1])-((t=t.x)[0]<0?t[1]-el-gr:el-t[1])}const Qw=vI(function(){return!0},CR,LR,[-Bn,-el]);function CR(e){var t=NaN,n=NaN,r=NaN,o;return{lineStart:function(){e.lineStart(),o=1},point:function(l,h){var u=l>0?Bn:-Bn,y=Bi(l-t);Bi(y-Bn)0?el:-el),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),e.point(l,n),o=0):r!==u&&y>=Bn&&(Bi(t-r)gr?dR((Vr(t)*(l=Br(r))*Vr(n)-Vr(r)*(o=Br(t))*Vr(e))/(o*l*h)):(t+r)/2}function LR(e,t,n,r){var o;if(e==null)o=n*el,r.point(-Bn,o),r.point(0,o),r.point(Bn,o),r.point(Bn,0),r.point(Bn,-o),r.point(0,-o),r.point(-Bn,-o),r.point(-Bn,0),r.point(-Bn,o);else if(Bi(e[0]-t[0])>gr){var l=e[0]0,o=Bi(n)>gr;function l(S,C,P,N){yR(N,e,t,P,S,C)}function h(S,C){return Br(S)*Br(C)>n}function u(S){var C,P,N,R,J;return{lineStart:function(){R=N=!1,J=1},point:function(Y,K){var B=[Y,K],G,H=h(Y,K),at=r?H?0:w(Y,K):H?w(Y+(Y<0?Bn:-Bn),K):0;if(!C&&(R=N=H)&&S.lineStart(),H!==N&&(G=y(C,B),(!G||gg(C,G)||gg(B,G))&&(B[0]+=gr,B[1]+=gr,H=h(B[0],B[1]))),H!==N)J=0,H?(S.lineStart(),G=y(B,C),S.point(G[0],G[1])):(G=y(C,B),S.point(G[0],G[1]),S.lineEnd()),C=G;else if(o&&C&&r^H){var gt;!(at&P)&&(gt=y(B,C,!0))&&(J=0,r?(S.lineStart(),S.point(gt[0][0],gt[0][1]),S.point(gt[1][0],gt[1][1]),S.lineEnd()):(S.point(gt[1][0],gt[1][1]),S.lineEnd(),S.lineStart(),S.point(gt[0][0],gt[0][1])))}H&&(!C||!gg(C,B))&&S.point(B[0],B[1]),C=B,N=H,P=at},lineEnd:function(){N&&S.lineEnd(),C=null},clean:function(){return J|(R&&N)<<1}}}function y(S,C,P){var N=Tf(S),R=Tf(C),J=[1,0,0],Y=Wg(N,R),K=tg(Y,Y),B=Y[0],G=K-B*B;if(!G)return!P&&S;var H=n*K/G,at=-n*B/G,gt=Wg(J,Y),ft=eg(J,H),rt=eg(Y,at);e0(ft,rt);var mt=gt,Et=tg(ft,mt),$=tg(mt,mt),Pt=Et*Et-$*(tg(ft,ft)-1);if(!(Pt<0)){var Qt=Bf(Pt),Tt=eg(mt,(-Et-Qt)/$);if(e0(Tt,ft),Tt=U0(Tt),!P)return Tt;var re=S[0],fe=C[0],Wt=S[1],Re=C[1],ze;fe0^Tt[1]<(Bi(Tt[0]-re)Bn^(re<=Tt[0]&&Tt[0]<=fe)){var en=eg(mt,(-Et+Qt)/$);return e0(en,ft),[Tt,U0(en)]}}}function w(S,C){var P=r?e:Bn-e,N=0;return S<-P?N|=1:S>P&&(N|=2),C<-P?N|=4:C>P&&(N|=8),N}return vI(h,u,l,r?[0,-e]:[-Bn,e-Bn])}function bI(e){return function(t){var n=new j0;for(var r in e)n[r]=e[r];return n.stream=t,n}}function j0(){}j0.prototype={constructor:j0,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function xI(e,t,n){var r=t[1][0]-t[0][0],o=t[1][1]-t[0][1],l=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),l!=null&&e.clipExtent(null),mR(n,e.stream(Jw));var h=Jw.result(),u=Math.min(r/(h[1][0]-h[0][0]),o/(h[1][1]-h[0][1])),y=+t[0][0]+(r-u*(h[1][0]+h[0][0]))/2,w=+t[0][1]+(o-u*(h[1][1]+h[0][1]))/2;return l!=null&&e.clipExtent(l),e.scale(u*150).translate([y,w])}function MR(e,t,n){return xI(e,[[0,0],t],n)}var $w=16,AR=Br(30*qs);function t2(e,t){return+t?DR(e,t):kR(e)}function kR(e){return bI({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function DR(e,t){function n(r,o,l,h,u,y,w,S,C,P,N,R,J,Y){var K=w-r,B=S-o,G=K*K+B*B;if(G>4*t&&J--){var H=h+P,at=u+N,gt=y+R,ft=Bf(H*H+at*at+gt*gt),rt=Oc(gt/=ft),mt=Bi(Bi(gt)-1)t||Bi((K*Qt+B*Tt)/G-.5)>.3||h*P+u*N+y*R2?Tt[2]%360*qs:0,Pt()):[w*_u,S*_u,C*_u]},mt.precision=function(Tt){return arguments.length?(gt=t2($,at=Tt*Tt),Qt()):Bf(at)},mt.fitExtent=function(Tt,re){return xI(mt,Tt,re)},mt.fitSize=function(Tt,re){return MR(mt,Tt,re)};function Pt(){N=dI(P=gR(w,S,C),t);var Tt=t(u,y);return l=r-Tt[0]*n,h=o+Tt[1]*n,Qt()}function Qt(){return ft=rt=null,mt}return function(){return t=e.apply(this,arguments),mt.invert=t.invert&&Et,Pt()}}function wI(e){return function(t,n){var r=Br(t),o=Br(n),l=e(r*o);return[l*o*Vr(t),l*Vr(n)]}}function SI(e){return function(t,n){var r=Bf(t*t+n*n),o=e(r),l=Vr(o),h=Br(o);return[Cf(t*l,r*h),Oc(r&&n*l/r)]}}var zR=wI(function(e){return Bf(2/(1+e))});zR.invert=SI(function(e){return 2*Oc(e/2)});var EI=wI(function(e){return(e=pI(e))&&e/Vr(e)});EI.invert=SI(function(e){return e});function FR(){return NR(EI).scale(79.4188).clipAngle(180-.001)}function e2(e,t){return[e,t]}e2.invert=e2;function BR(e,t,n){n=n||{};var r=n.units||"kilometers",o=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof o!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(o<=0)throw new Error("steps must be greater than 0");var l=[];switch(e.type){case"GeometryCollection":return BE(e,function(h){var u=yg(h,t,r,o);u&&l.push(u)}),z0(l);case"FeatureCollection":return Nw(e,function(h){var u=yg(h,t,r,o);u&&Nw(u,function(y){y&&l.push(y)})}),z0(l)}return yg(e,t,r,o)}function yg(e,t,n,r){var o=e.properties||{},l=e.type==="Feature"?e.geometry:e;if(l.type==="GeometryCollection"){var h=[];return BE(e,function(J){var Y=yg(J,t,n,r);Y&&h.push(Y)}),z0(h)}var u=VR(l),y={type:l.type,coordinates:CI(l.coordinates,u)},w=new Dv,S=w.read(y),C=Z4(X4(t,n),"meters"),P=vi.bufferOp(S,C,r),N=new YE;if(P=N.write(P),!II(P.coordinates)){var R={type:P.type,coordinates:TI(P.coordinates,u)};return sy(R,o)}}function II(e){return Array.isArray(e[0])?II(e[0]):isNaN(e[0])}function CI(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return CI(n,t)})}function TI(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return TI(n,t)})}function VR(e){var t=K4(e).geometry.coordinates,n=[-t[0],-t[1]];return FR().rotate(n).scale(zo)}function UR(e,t){var n=zg(e),r=zg(t),o=e.properties||{},l=RE.difference(n.coordinates,r.coordinates);return l.length===0?null:l.length===1?OE(l[0],o):zE(l,o)}function n2(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function r2(e,t){const n=UR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const r=BR(e,0);if(r.geometry.type==="Polygon")for(const o of r.geometry.coordinates)n2(o);else for(const o of r.geometry.coordinates)for(const l of o)n2(l);t({type:"FeatureCollection",features:[r,n]})}let i2={type:"FeatureCollection",features:[]};function GR(e,t,n=!0,r=!0,o={},l={},h={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 u,y=[],w,S;function C(){(h!=null&&h.fill||h!=null&&h.line)&&e.addSource("full-geom",{type:"geojson",data:i2}),h!=null&&h.fill&&e.addLayer({...h==null?void 0:h.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),h!=null&&h.line&&e.addLayer({...h==null?void 0:h.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?C():e.once("load",()=>{C()});const P=R=>{u==null||u({type:"mapClick",coordinates:[R.lngLat.lng,R.lngLat.lat]})};function N(R=!1){if(!t)throw new Error;const J=document.createElement("div");return R&&J.classList.add("marker-interactive"),new y4({props:{displayIn:"maplibre"},target:J}),new t.Marker({element:J,offset:[1,-13]})}return{setEventHandler(R){R?(u=R,e.on("click",P)):(u=void 0,e.off("click",P))},flyTo(R,J){e.flyTo({center:R,zoom:J,...o})},fitBounds(R,J,Y){e.fitBounds([[R[0],R[1]],[R[2],R[3]]],{padding:J,maxZoom:Y,...l})},indicateReverse(R){e.getCanvasContainer().style.cursor=R?"crosshair":""},setReverseMarker(R){!t||!n||(S?R?S.setLngLat(R):(S.remove(),S=void 0):R&&(S=(typeof n=="object"?new t.Marker(n):N()).setLngLat(R).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(R,J){if(!n)return;function Y(K){var B;(B=e.getSource("full-geom"))==null||B.setData(K)}for(const K of y)K.remove();if(y.length=0,Y(i2),!!t){if(J){let K=!1;if(J.geometry.type==="GeometryCollection"){const B=J.geometry.geometries.filter(G=>G.type==="Polygon"||G.type==="MultiPolygon");if(B.length>0){let G=B.pop();for(const H of B)G=Y4(G,H);r2({...J,geometry:G},Y),K=!0}else{const G=J.geometry.geometries.filter(H=>H.type==="LineString"||H.type==="MultiLineString");G.length>0&&(Y({...J,geometry:{type:"GeometryCollection",geometries:G}}),K=!0)}}if(!K){if(J.geometry.type==="Polygon"||J.geometry.type==="MultiPolygon")r2(J,Y);else if(J.geometry.type==="LineString"||J.geometry.type==="MultiLineString"){Y(J);return}}n&&y.push((typeof n=="object"?new t.Marker(n):N()).setLngLat(J.center).addTo(e))}if(r)for(const K of R??[]){if(K===J)continue;const B=(typeof r=="object"?new t.Marker(r):N(!0)).setLngLat(K.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(K.place_type[0]==="reverse"?K.place_name:K.place_name.replace(/,.*/,""))).addTo(e),G=B.getElement();G.addEventListener("click",H=>{H.stopPropagation(),u==null||u({type:"markerClick",id:K.id})}),G.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:K.id}),B.togglePopup()}),G.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:K.id}),B.togglePopup()}),y.push(B)}}},setSelectedMarker(R){w&&w.getElement().classList.toggle("marker-selected",!1),w=R>-1?y[R]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const R=e.getCenter();return[e.getZoom(),R.lng,R.lat]}}}function qR(e){let t,n;return{c(){t=Fl("svg"),n=Fl("path"),Vt(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"),Vt(t,"viewBox","0 0 14 14"),Vt(t,"width","13"),Vt(t,"height","13"),Vt(t,"class","svelte-en2qvf")},m(r,o){zt(r,t,o),Xt(t,n)},p:Me,i:Me,o:Me,d(r){r&&Nt(t)}}}class LI extends an{constructor(t){super(),sn(this,t,null,qR,Xe,{})}}function jR(e){let t,n;return{c(){t=Fl("svg"),n=Fl("path"),Vt(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"),Vt(t,"viewBox","0 0 30 30"),Vt(t,"fill","none"),Vt(t,"xmlns","http://www.w3.org/2000/svg"),Vt(t,"class","svelte-d2loi5")},m(r,o){zt(r,t,o),Xt(t,n)},p:Me,i:Me,o:Me,d(r){r&&Nt(t)}}}class PI extends an{constructor(t){super(),sn(this,t,null,jR,Xe,{})}}function WR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"area.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"area.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function HR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"reverse.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"reverse.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function ZR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"poi.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"poi.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function XR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"postal_code.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"postal_code.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function YR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"street.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"street.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function KR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"road.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"road.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function JR(e){let t,n;return{c(){t=jt("img"),xo(t.src,n=e[3]+"housenumber.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,o){zt(r,t,o)},p(r,o){o&8&&!xo(t.src,n=r[3]+"housenumber.svg")&&Vt(t,"src",n),o&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function QR(e){let t,n,r,o;return{c(){t=jt("img"),xo(t.src,n=e[5])||Vt(t,"src",n),Vt(t,"alt",e[4]),Vt(t,"class","svelte-ltkwvy")},m(l,h){zt(l,t,h),r||(o=hn(t,"error",e[14]),r=!0)},p(l,h){h&32&&!xo(t.src,n=l[5])&&Vt(t,"src",n),h&16&&Vt(t,"alt",l[4])},d(l){l&&Nt(t),r=!1,o()}}}function o2(e){let t,n;return{c(){t=jt("span"),n=wn(e[6]),Vt(t,"class","secondary svelte-ltkwvy")},m(r,o){zt(r,t,o),Xt(t,n)},p(r,o){o&64&&Ui(n,r[6])},d(r){r&&Nt(t)}}}function $R(e){var ft,rt;let t,n,r,o,l,h,u,y,w=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,C,P=e[2]==="always"||e[2]&&!e[0].address&&((ft=e[0].properties)==null?void 0:ft.kind)!=="road"&&((rt=e[0].properties)==null?void 0:rt.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],N,R,J=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",Y,K,B;function G(mt,Et){var $,Pt;return Et&1&&(n=null),Et&1&&(r=null),Et&1&&(o=null),mt[5]?QR:mt[0].address?JR:(($=mt[0].properties)==null?void 0:$.kind)==="road"||((Pt=mt[0].properties)==null?void 0:Pt.kind)==="road_relation"?KR:(n==null&&(n=!!mt[0].id.startsWith("address.")),n?YR:(r==null&&(r=!!mt[0].id.startsWith("postal_code.")),r?XR:(o==null&&(o=!!mt[0].id.startsWith("poi.")),o?ZR:mt[7]?HR:WR)))}let H=G(e,-1),at=H(e),gt=P&&o2(e);return{c(){t=jt("li"),at.c(),l=ye(),h=jt("span"),u=jt("span"),y=jt("span"),S=wn(w),C=ye(),gt&>.c(),N=ye(),R=jt("span"),Y=wn(J),Vt(y,"class","primary svelte-ltkwvy"),Vt(u,"class","svelte-ltkwvy"),Vt(R,"class","line2 svelte-ltkwvy"),Vt(h,"class","texts svelte-ltkwvy"),Vt(t,"tabindex","0"),Vt(t,"data-selected",e[1]),Vt(t,"class","svelte-ltkwvy"),tl(t,"selected",e[1])},m(mt,Et){zt(mt,t,Et),at.m(t,null),Xt(t,l),Xt(t,h),Xt(h,u),Xt(u,y),Xt(y,S),Xt(u,C),gt&>.m(u,null),Xt(h,N),Xt(h,R),Xt(R,Y),K||(B=[hn(t,"mouseenter",e[12]),hn(t,"focus",e[13])],K=!0)},p(mt,[Et]){var $,Pt;H===(H=G(mt,Et))&&at?at.p(mt,Et):(at.d(1),at=H(mt),at&&(at.c(),at.m(t,l))),Et&1&&w!==(w=(mt[7]?mt[0].place_name:mt[0].place_name.replace(/,.*/,""))+"")&&Ui(S,w),Et&37&&(P=mt[2]==="always"||mt[2]&&!mt[0].address&&(($=mt[0].properties)==null?void 0:$.kind)!=="road"&&((Pt=mt[0].properties)==null?void 0:Pt.kind)!=="road_relation"&&!mt[0].id.startsWith("address.")&&!mt[0].id.startsWith("postal_code.")&&(!mt[0].id.startsWith("poi.")||!mt[5])&&!mt[7]),P?gt?gt.p(mt,Et):(gt=o2(mt),gt.c(),gt.m(u,null)):gt&&(gt.d(1),gt=null),Et&1&&J!==(J=(mt[7]?"":mt[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Ui(Y,J),Et&2&&Vt(t,"data-selected",mt[1]),Et&2&&tl(t,"selected",mt[1])},i:Me,o:Me,d(mt){mt&&Nt(t),at.d(),gt&>.d(),K=!1,oo(B)}}}function tN(e,t,n){var G;let r,o,{feature:l}=t,{selected:h=!1}=t,{showPlaceType:u}=t,{missingIconsCache:y}=t,{iconsBaseUrl:w}=t;const S=(G=l.properties)==null?void 0:G.categories;let C,P,N=0,R=l.place_type[0]==="reverse";function J(H){P&&y.add(P),n(10,N++,N)}function Y(H){Nn.call(this,e,H)}function K(H){Nn.call(this,e,H)}const B=H=>J(H.currentTarget);return e.$$set=H=>{"feature"in H&&n(0,l=H.feature),"selected"in H&&n(1,h=H.selected),"showPlaceType"in H&&n(2,u=H.showPlaceType),"missingIconsCache"in H&&n(9,y=H.missingIconsCache),"iconsBaseUrl"in H&&n(3,w=H.iconsBaseUrl)},e.$$.update=()=>{var H,at,gt,ft;if(e.$$.dirty&3640)do n(11,r--,r),n(4,C=S==null?void 0:S[r]),n(5,P=C?w+C.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||y.has(P)));e.$$.dirty&1&&n(6,o=l.id.startsWith("poi.")?(at=(H=l.properties)==null?void 0:H.categories)==null?void 0:at.join(", "):((ft=(gt=l.properties)==null?void 0:gt.place_type_name)==null?void 0:ft[0])??l.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[l,h,u,w,C,P,o,R,J,y,N,r,Y,K,B]}class eN extends an{constructor(t){super(),sn(this,t,tN,$R,Xe,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function nN(e){let t;return{c(){t=jt("div"),t.innerHTML='',Vt(t,"class","svelte-7cmwmc")},m(n,r){zt(n,t,r)},p:Me,i:Me,o:Me,d(n){n&&Nt(t)}}}class rN extends an{constructor(t){super(),sn(this,t,null,nN,Xe,{})}}function iN(e){let t,n;return{c(){t=Fl("svg"),n=Fl("path"),Vt(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"),Vt(t,"viewBox","0 0 60.006 21.412"),Vt(t,"width","14"),Vt(t,"height","20"),Vt(t,"class","svelte-en2qvf")},m(r,o){zt(r,t,o),Xt(t,n)},p:Me,i:Me,o:Me,d(r){r&&Nt(t)}}}class oN extends an{constructor(t){super(),sn(this,t,null,iN,Xe,{})}}function sN(e){let t,n,r;return{c(){t=Fl("svg"),n=Fl("circle"),r=Fl("path"),Vt(n,"cx","4.789"),Vt(n,"cy","4.787"),Vt(n,"r","3.85"),Gr(n,"stroke-width","1.875"),Gr(n,"fill","none"),Vt(r,"d","M12.063 12.063 7.635 7.635"),Gr(r,"stroke-width","1.875"),Gr(r,"stroke-linecap","round"),Vt(t,"xmlns","http://www.w3.org/2000/svg"),Vt(t,"width","13"),Vt(t,"height","13"),Vt(t,"viewBox","0 0 13 13"),Vt(t,"class","svelte-1bpbt60")},m(o,l){zt(o,t,l),Xt(t,n),Xt(t,r)},p:Me,i:Me,o:Me,d(o){o&&Nt(t)}}}class aN extends an{constructor(t){super(),sn(this,t,null,sN,Xe,{})}}function lN(e,t,n){const r=t[1],o=t[0],l=r-o;return e===r&&n?e:((e-o)%l+l)%l+o}function s2(e){const t=[...e];return t[2]r[0]||o.maxZoom!=null&&o.maxZoomDate.now()){if(!Hp.coords)break t;return Hp.coords}let l;try{return l=await new Promise((h,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(y=>{h([y.coords.longitude,y.coords.latitude].map(w=>w.toFixed(6)).join(","))},y=>{u(y)},o)}),l}catch{}finally{o.cachedLocationExpiry&&(Hp={time:Date.now(),coords:l})}if(n.signal.aborted)return}if(o.type==="server-geolocation")return"ip";if(r&&o.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const a2=/(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,l2=/(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,u2=/(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,c2=/(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 cN(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(h=>Number(h.trim()));let n=h2(t[0],e),r=h2(t[1],e);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const o=t[0]>=0?" N":" S",l=t[1]>=0?" E":" W";return`${n+o}, ${r+l}`}else throw new Error("no decimal coordinates to convert")}function h2(e,t){const n=Math.abs(e),r=Math.floor(n),o=(n-r)*60;if(t=="DM"){let u=hN(o,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let l=Math.floor(o),h=((o-l)*60).toFixed(1).padStart(4,"0");return l=l.toString().padStart(2,"0"),`${r}° ${l}' ${h}"`}function hN(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function Gv(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,r=null,o="",l="",h=[],u=!1;if(a2.test(e))if(h=a2.exec(e),u=ig(h),u){if(n=h[2],r=h[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");h[1]?(o=h[1],l=h[5]):h[4]&&(o=h[4],l=h[8])}else throw new Error("invalid decimal coordinate format");else if(l2.test(e))if(h=l2.exec(e),u=ig(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6].replace(",",".")/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[9])),h[11]&&(r+=h[11]/60),h[13]&&(r+=h[13].replace(",",".")/3600),parseInt(h[9])<0&&(r=-1*r),h[1]?(o=h[1],l=h[8]):h[7]&&(o=h[7],l=h[14]);else throw new Error("invalid DMS coordinates format");else if(u2.test(e))if(h=u2.exec(e),u=ig(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(o=h[1],l=h[9]):h[8]&&(o=h[8],l=h[16]);else throw new Error("invalid DMS coordinates format");else if(c2.test(e))if(h=c2.exec(e),u=ig(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(o=h[1],l=h[9]):h[8]&&(o=h[8],l=h[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((o||l)&&(!o||!l))throw new Error("invalid coordinates format");if(o&&o==l)throw new Error("invalid coordinates format");let y=/S|SOUTH/i;y.test(o)&&n>0&&(n=-1*n),y=/W|WEST/i,y.test(l)&&r>0&&(r=-1*r);const w=h[0].trim();let S,C;const P=/[,/;\u0020]/g,N=w.match(P);if(N==null){const Y=Math.floor(e.length/2);S=w.substring(0,Y).trim(),C=w.substring(Y).trim()}else{let Y;N.length%2==1?Y=Math.floor(N.length/2):Y=N.length/2-1;let K=0;if(Y==0)K=w.indexOf(N[0]),S=w.substring(0,K).trim(),C=w.substring(K+1).trim();else{let B=0,G=0;for(;B<=Y;)K=w.indexOf(N[B],G),G=K+1,B++;S=w.substring(0,K).trim(),C=w.substring(K+1).trim()}}const R=S.split(".");if(R.length==2&&R[1]==0&&R[1].length!=2)throw new Error("invalid coordinates format");const J=C.split(".");if(J.length==2&&J[1]==0&&J[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(C))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(t)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:C,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:fN,toCoordinateFormat:cN})}else throw new Error("coordinates pattern match failed")}function ig(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,o=t.length/2;for(let l=0;l{t.decimalLatitude?e.push(t):e.push({...t,...mN})}),[...e,...gN,...yN]}const vN=_N();Gv.formats=vN.map(e=>e.verbatimCoordinates);const bN=Gv;function p2(e,t,n){const r=e.slice();return r[81]=t[n],r[83]=n,r}function d2(e){let t,n;return t=new rN({}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function m2(e){let t,n,r,o,l;return n=new oN({}),{c(){t=jt("button"),Ie(n.$$.fragment),Vt(t,"type","button"),Vt(t,"title",e[9]),Vt(t,"class","svelte-zh3kmv"),tl(t,"active",e[0])},m(h,u){zt(h,t,u),we(n,t,null),r=!0,o||(l=hn(t,"click",e[67]),o=!0)},p(h,u){(!r||u[0]&512)&&Vt(t,"title",h[9]),(!r||u[0]&1)&&tl(t,"active",h[0])},i(h){r||(Dt(n.$$.fragment,h),r=!0)},o(h){qt(n.$$.fragment,h),r=!1},d(h){h&&Nt(t),Se(n),o=!1,l()}}}function xN(e){let t,n=[],r=new Map,o,l,h,u=vo(e[14]);const y=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{ft=null}),lr()),(!G||re[0]&2)&&tl(w,"displayable",Tt[1]!==""),Tt[5]===!0?rt?(rt.p(Tt,re),re[0]&32&&Dt(rt,1)):(rt=m2(Tt),rt.c(),Dt(rt,1),rt.m(r,R)):rt&&(ar(),qt(rt,1,1,()=>{rt=null}),lr()),Et&&Et.p&&(!G||re[1]&134217728)&&ci(Et,mt,Tt,Tt[58],G?ui(mt,Tt[58],re,null):hi(Tt[58]),null);let fe=Y;Y=Qt(Tt),Y===fe?~Y&&Pt[Y].p(Tt,re):(K&&(ar(),qt(Pt[fe],1,1,()=>{Pt[fe]=null}),lr()),~Y?(K=Pt[Y],K?K.p(Tt,re):(K=Pt[Y]=$[Y](Tt),K.c()),Dt(K,1),K.m(n,null)):K=null),(!G||re[0]&4&&B!==(B=_g(Tt[2])+" svelte-zh3kmv"))&&Vt(n,"class",B),(!G||re[0]&22)&&tl(n,"can-collapse",Tt[4]&&Tt[1]==="")},i(Tt){G||(Dt(gt),Dt(l.$$.fragment,Tt),Dt(C.$$.fragment,Tt),Dt(ft),Dt(rt),Dt(Et,Tt),Dt(K),G=!0)},o(Tt){qt(gt),qt(l.$$.fragment,Tt),qt(C.$$.fragment,Tt),qt(ft),qt(rt),qt(Et,Tt),qt(K),G=!1},d(Tt){Tt&&(Nt(t),Nt(n)),Se(l),e[61](null),Se(C),ft&&ft.d(),rt&&rt.d(),Et&&Et.d(Tt),~Y&&Pt[Y].d(),H=!1,oo(at)}}}function CN(e,t,n){let r,{$$slots:o={},$$scope:l}=t,{class:h=void 0}=t,{apiKey:u}=t,{bbox:y=void 0}=t,{clearButtonTitle:w="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:C=!1}=t,{country:P=void 0}=t,{debounceSearch:N=200}=t,{enableReverse:R=!1}=t,{errorMessage:J="Something went wrong…"}=t,{filter:Y=()=>!0}=t,{flyTo:K=!0}=t,{fuzzyMatch:B=!0}=t,{language:G=void 0}=t,{limit:H=void 0}=t,{mapController:at=void 0}=t,{minLength:gt=2}=t,{noResultsMessage:ft="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=t,{placeholder:rt="Search"}=t,{proximity:mt=[{type:"server-geolocation"}]}=t,{reverseActive:Et=R==="always"}=t,{reverseButtonTitle:$="toggle reverse geocoding"}=t,{searchValue:Pt=""}=t,{showFullGeometry:Qt=!0}=t,{showPlaceType:Tt="ifNeeded"}=t,{showResultsWhileTyping:re=!0}=t,{selectFirst:fe=!0}=t,{flyToSelected:Wt=!1}=t,{markerOnSelected:Re=!0}=t,{types:ze=void 0}=t,{excludeTypes:We=!1}=t,{zoom:Ve=16}=t,{maxZoom:Ce=18}=t,{apiUrl:en="https://api.maptiler.com/geocoding"}=t,{fetchParameters:An={}}=t,{iconsBaseUrl:dn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=t,{adjustUrlQuery:un=Q=>{}}=t;function kn(){Mt.focus()}function Yn(){Mt.blur()}function Wr(Q,bt=!0){n(1,Pt=Q),bt?(n(15,He=-1),ml()):(Hr(),setTimeout(()=>{Mt.focus(),Mt.select()}))}function hr(){n(14,nt=void 0),n(55,ce=void 0),n(15,He=-1)}function er(){n(54,xt=[]),n(55,ce=void 0)}let Kn=!1,nt,xt,ce,mn="",Mt,He=-1,Tr,on=[],Hn,To,ls,ks;const Ra=new Set,Ii=Bu();ws(()=>{at&&(at.setEventHandler(void 0),at.indicateReverse(!1),at.setSelectedMarker(-1),at.setMarkers(void 0,void 0))});function ml(Q){if(To&&(clearTimeout(To),To=void 0),He>-1&&nt)n(55,ce=nt[He]),n(1,Pt=ce.place_type[0]==="reverse"?ce.place_name:ce.place_name.replace(/,.*/,"")),n(18,Tr=void 0),n(54,xt=void 0),n(15,He=-1);else if(Pt){const bt=Q||!us(Pt);te(Pt,{exact:!0}).then(()=>{n(54,xt=nt),n(55,ce=void 0),bt&&Ho()}).catch(dt=>n(18,Tr=dt))}}function us(Q){try{return bN(Q,6)}catch{return!1}}async function te(Q,{byId:bt=!1,exact:dt=!1}={}){n(18,Tr=void 0),Hn==null||Hn.abort();const It=new AbortController;n(19,Hn=It);try{const Ot=us(Q),Ut=new URLSearchParams;if(G!==void 0&&Ut.set("language",Array.isArray(G)?G.join(","):G??""),ze&&Ut.set("types",ze.join(",")),We&&Ut.set("excludeTypes",String(We)),y&&Ut.set("bbox",y.map(Ue=>Ue.toFixed(6)).join(",")),P&&Ut.set("country",Array.isArray(P)?P.join(","):P),!bt&&!Ot){const Ue=await uN(at,mt,It);Ue&&Ut.set("proximity",Ue),(dt||!re)&&Ut.set("autocomplete","false"),Ut.set("fuzzyMatch",String(B))}H!==void 0&&(!Ot||(ze==null?void 0:ze.length)===1)&&Ut.set("limit",String(H)),Ut.set("key",u),un(Ut);const Ht=en+"/"+encodeURIComponent(Ot?Ot.decimalLongitude+","+Ot.decimalLatitude:Q)+".json?"+Ut.toString();if(Ht===mn){bt?(n(14,nt=void 0),n(55,ce=on[0])):n(14,nt=on);return}mn=Ht;const xe=await fetch(Ht,{signal:It.signal,...An});if(!xe.ok)throw new Error(await xe.text());const Le=await xe.json();Ii("response",{url:Ht,featureCollection:Le}),bt?(n(14,nt=void 0),n(55,ce=Le.features[0]),on=[ce]):(n(14,nt=Le.features.filter(Y)),Ot&&nt.unshift({type:"Feature",properties:{},id:"reverse_"+Ot.decimalLongitude+"_"+Ot.decimalLatitude,text:Ot.decimalLatitude+", "+Ot.decimalLongitude,place_name:Ot.decimalLatitude+", "+Ot.decimalLongitude,place_type:["reverse"],center:[Ot.decimalLongitude,Ot.decimalLatitude],bbox:[Ot.decimalLongitude,Ot.decimalLatitude,Ot.decimalLongitude,Ot.decimalLatitude],geometry:{type:"Point",coordinates:[Ot.decimalLongitude,Ot.decimalLatitude]}}),on=nt,Ot&&Mt.focus())}catch(Ot){if(Ot&&typeof Ot=="object"&&"name"in Ot&&Ot.name==="AbortError")return;throw Ot}finally{It===Hn&&n(19,Hn=void 0)}}function Ho(){var dt;if(!(xt!=null&&xt.length)||!K)return;const Q=[180,90,-180,-90],bt=!xt.some(It=>!It.matching_text);for(const It of xt)if(bt||!It.matching_text)for(const Ot of[0,1,2,3])Q[Ot]=Math[Ot<2?"min":"max"](Q[Ot],((dt=It.bbox)==null?void 0:dt[Ot])??It.center[Ot%2]);at&&xt.length>0&&(ce&&Q[0]===Q[2]&&Q[1]===Q[3]?at.flyTo(ce.center,Ve):at.fitBounds(s2(Q),50,Ce))}function Hi(Q){n(0,Et=R==="always"),n(14,nt=void 0),n(55,ce=void 0),n(15,He=-1),Wr(Q[1].toFixed(6)+", "+lN(Q[0],[-180,180],!0).toFixed(6),!1)}function gl(Q){if(!nt)return;let bt=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;bt&&(He===(fe?0:-1)&&bt===-1&&n(15,He=nt.length),n(15,He+=bt),He>=nt.length&&n(15,He=-1),He<0&&fe&&n(15,He=0),Q.preventDefault())}function Hr(Q=!0){if(n(18,Tr=void 0),re){if(To&&clearTimeout(To),Pt.length{te(bt).catch(dt=>n(18,Tr=dt))},Q?N:0)}else n(14,nt=void 0),n(18,Tr=void 0)}function oe(Q){n(55,ce=Q),n(1,Pt=Q.place_name),n(15,He=-1)}const Je=()=>Mt.focus();function Ye(Q){fi[Q?"unshift":"push"](()=>{Mt=Q,n(17,Mt)})}function Lr(){Pt=this.value,n(1,Pt),n(13,Kn),n(27,S)}const Zo=()=>n(13,Kn=!0),Ze=()=>n(13,Kn=!1),ha=()=>Hr(),Dr=()=>{n(1,Pt=""),Mt.focus()},ut=()=>n(0,Et=!Et),V=()=>n(18,Tr=void 0),q=Q=>n(15,He=Q),X=Q=>oe(Q),it=()=>{fe||n(15,He=-1)},vt=()=>{};return e.$$set=Q=>{"class"in Q&&n(2,h=Q.class),"apiKey"in Q&&n(25,u=Q.apiKey),"bbox"in Q&&n(26,y=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,C=Q.collapsed),"country"in Q&&n(28,P=Q.country),"debounceSearch"in Q&&n(29,N=Q.debounceSearch),"enableReverse"in Q&&n(5,R=Q.enableReverse),"errorMessage"in Q&&n(6,J=Q.errorMessage),"filter"in Q&&n(30,Y=Q.filter),"flyTo"in Q&&n(31,K=Q.flyTo),"fuzzyMatch"in Q&&n(32,B=Q.fuzzyMatch),"language"in Q&&n(33,G=Q.language),"limit"in Q&&n(34,H=Q.limit),"mapController"in Q&&n(35,at=Q.mapController),"minLength"in Q&&n(36,gt=Q.minLength),"noResultsMessage"in Q&&n(7,ft=Q.noResultsMessage),"placeholder"in Q&&n(8,rt=Q.placeholder),"proximity"in Q&&n(37,mt=Q.proximity),"reverseActive"in Q&&n(0,Et=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,$=Q.reverseButtonTitle),"searchValue"in Q&&n(1,Pt=Q.searchValue),"showFullGeometry"in Q&&n(38,Qt=Q.showFullGeometry),"showPlaceType"in Q&&n(10,Tt=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,re=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,fe=Q.selectFirst),"flyToSelected"in Q&&n(40,Wt=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Re=Q.markerOnSelected),"types"in Q&&n(42,ze=Q.types),"excludeTypes"in Q&&n(43,We=Q.excludeTypes),"zoom"in Q&&n(44,Ve=Q.zoom),"maxZoom"in Q&&n(45,Ce=Q.maxZoom),"apiUrl"in Q&&n(46,en=Q.apiUrl),"fetchParameters"in Q&&n(47,An=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,dn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,un=Q.adjustUrlQuery),"$$scope"in Q&&n(58,l=Q.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ls=Kn),S&&!Kn&&n(1,Pt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&Pt.lengthn(18,Tr=Q)),e.$$.dirty[1]&50356241&&(at&&ce&&ce.id!==ks&&K&&(!ce.bbox||ce.bbox[0]===ce.bbox[2]&&ce.bbox[1]===ce.bbox[3]?at.flyTo(ce.center,ce.id.startsWith("poi.")||ce.id.startsWith("address.")?Ce:Ve):at.fitBounds(s2(ce.bbox),50,Ce),n(14,nt=void 0),n(54,xt=void 0),n(15,He=-1)),n(56,ks=ce==null?void 0:ce.id)),e.$$.dirty[0]&18432&&fe&&nt!=null&&nt.length&&n(15,He=0),e.$$.dirty[0]&2050&&(fe||n(15,He=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&xt!==nt&&n(54,xt=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&at&&at.setEventHandler(Q=>{switch(Q.type){case"mapClick":Et&&Hi(Q.coordinates);break;case"markerClick":{const bt=nt==null?void 0:nt.find(dt=>dt.id===Q.id);bt&&oe(bt)}break;case"markerMouseEnter":xt&&n(15,He=ls?(nt==null?void 0:nt.findIndex(bt=>bt.id===Q.id))??-1:-1);break;case"markerMouseLeave":xt&&n(15,He=-1);break}}),e.$$.dirty[0]&49152&&n(57,r=nt==null?void 0:nt[He]),e.$$.dirty[1]&67133969&&at&&r&&K&&Wt&&at.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Ce:Ve),e.$$.dirty[1]&1040&&(Re||at==null||at.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&at&&Re&&!xt&&(at.setMarkers(r?[r]:void 0,void 0),at.setSelectedMarker(r?0:-1)),e.$$.dirty[1]&25165840&&at&&at.setMarkers(xt,ce),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&xt&&at&&at.setSelectedMarker(He),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&at){const Q=us(Pt);at.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&Ii("select",r),e.$$.dirty[1]&16777216&&Ii("pick",ce),e.$$.dirty[0]&81920&&Ii("optionsVisibilityChange",ls&&!!nt),e.$$.dirty[0]&16384&&Ii("featuresListed",nt),e.$$.dirty[1]&8388608&&Ii("featuresMarked",xt),e.$$.dirty[0]&1&&Ii("reverseToggle",Et),e.$$.dirty[0]&2&&Ii("queryChange",Pt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&at&&at.indicateReverse(Et)},[Et,Pt,h,w,C,R,J,ft,rt,$,Tt,fe,dn,Kn,nt,He,ls,Mt,Tr,Hn,Ra,ml,gl,Hr,oe,u,y,S,P,N,Y,K,B,G,H,at,gt,mt,Qt,re,Wt,Re,ze,We,Ve,Ce,en,An,un,kn,Yn,Wr,hr,er,xt,ce,ks,r,l,o,Je,Ye,Lr,Zo,Ze,ha,Dr,ut,V,q,X,it,vt]}class TN extends an{constructor(t){super(),sn(this,t,CN,IN,Xe,{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 y2(e){let t,n,r;return n=new TN({props:{mapController:e[1],apiKey:e[0]}}),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"class","svelte-ixhnie")},m(o,l){zt(o,t,l),we(n,t,null),r=!0},p(o,l){const h={};l&2&&(h.mapController=o[1]),l&1&&(h.apiKey=o[0]),n.$set(h)},i(o){r||(Dt(n.$$.fragment,o),r=!0)},o(o){qt(n.$$.fragment,o),r=!1},d(o){o&&Nt(t),Se(n)}}}function LN(e){let t,n,r=e[1]&&y2(e);return{c(){r&&r.c(),t=so()},m(o,l){r&&r.m(o,l),zt(o,t,l),n=!0},p(o,[l]){o[1]?r?(r.p(o,l),l&2&&Dt(r,1)):(r=y2(o),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function PN(e,t,n){let r,{apiKey:o}=t,{map:l}=t;return e.$$set=h=>{"apiKey"in h&&n(0,o=h.apiKey),"map"in h&&n(2,l=h.map)},e.$$.update=()=>{e.$$.dirty&4&&n(1,r=l?GR(l,vs):null)},[o,r,l]}class MN extends an{constructor(t){super(),sn(this,t,PN,LN,Xe,{apiKey:0,map:2})}}const AN=Symbol.for("svelte-maplibre");function kN(){return Q0(AN)}function DN(e){return"layerType"in e&&e.layerType==="deckgl"}const RN=e=>({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),_2=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function v2(e){let t,n,r=(e[4]||e[3]instanceof vs.Marker)&&b2(e);return{c(){t=jt("div"),r&&r.c()},m(o,l){zt(o,t,l),r&&r.m(t,null),e[32](t),n=!0},p(o,l){o[4]||o[3]instanceof vs.Marker?r?(r.p(o,l),l[0]&24&&Dt(r,1)):(r=b2(o),r.c(),Dt(r,1),r.m(t,null)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(),e[32](null)}}}function b2(e){let t;const n=e[30].default,r=li(n,e,e[29],_2);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l[0]&536870933)&&ci(r,n,o,o[29],t?ui(n,o[29],l,RN):hi(o[29]),_2)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function NN(e){let t,n,r=e[9].default&&v2(e);return{c(){r&&r.c(),t=so()},m(o,l){r&&r.m(o,l),zt(o,t,l),n=!0},p(o,l){o[9].default?r?(r.p(o,l),l[0]&512&&Dt(r,1)):(r=v2(o),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function ON(e,t,n){let r,o,l,h,u,y,{$$slots:w={},$$scope:S}=t;const C=jT(w);let{closeButton:P=void 0}=t,{closeOnClickOutside:N=!0}=t,{closeOnClickInside:R=!1}=t,{closeOnMove:J=!1}=t,{openOn:Y="click"}=t,{openIfTopMost:K=!0}=t,{focusAfterOpen:B=!0}=t,{anchor:G=void 0}=t,{offset:H=void 0}=t,{popupClass:at=void 0}=t,{maxWidth:gt=void 0}=t,{lngLat:ft=void 0}=t,{html:rt=void 0}=t,{open:mt=!1}=t;const Et=Bu(),{map:$,popupTarget:Pt,layerEvent:Qt,layer:Tt,eventTopMost:re}=kN();Ge(e,$,xt=>n(2,l=xt)),Ge(e,Pt,xt=>n(3,u=xt)),Ge(e,Qt,xt=>n(28,h=xt)),Ge(e,Tt,xt=>n(35,y=xt));const fe=["click","dblclick","contextmenu"];let Wt,Re=!1,ze;function We(){if(!Wt)return;let xt=Wt.getElement();!xt||xt===ze||(ze=xt,Y==="hover"&&(ze.style.pointerEvents="none"),ze.addEventListener("mouseenter",()=>{n(24,Re=!0)},{passive:!0}),ze.addEventListener("mouseleave",()=>{n(24,Re=!1)},{passive:!0}),ze.addEventListener("click",()=>{R&&n(0,mt=!1)},{passive:!0}))}K0(()=>{if(l)return l.on("click",hr),l.on("contextmenu",hr),typeof u=="string"&&(l.on("click",u,An),l.on("dblclick",u,An),l.on("contextmenu",u,An),l.on("mousemove",u,Wr),l.on("mouseleave",u,Yn),l.on("touchstart",u,un),l.on("touchend",u,kn)),()=>{l!=null&&l.loaded()&&(Wt==null||Wt.remove(),l.off("click",hr),l.off("contextmenu",hr),u instanceof vs.Marker?u.getPopup()===Wt&&u.setPopup(void 0):typeof u=="string"&&(l.off("click",u,An),l.off("dblclick",u,An),l.off("contextmenu",u,An),l.off("mousemove",u,Wr),l.off("mouseleave",u,Yn),l.off("touchstart",u,un),l.off("touchend",u,kn)))}});function Ve(xt){return K?!("marker"in xt)&&!DN(xt)&&re(xt)!==y:!1}let Ce=null,en="normal";function An(xt){xt.type===Y&&(Ve(xt)||("layerType"in xt?xt.layerType==="deckgl"?(n(10,ft=xt.coordinate),n(4,Ce=xt.object?[xt.object]:null)):(n(10,ft=xt.lngLat),n(4,Ce=xt.features??[])):(n(10,ft=xt.lngLat),n(4,Ce=xt.features??[])),setTimeout(()=>n(0,mt=!0))))}let dn=null;function un(xt){dn=xt.point}function kn(xt){if(!dn||Y!=="hover")return;let ce=dn.dist(xt.point);dn=null,ce<3&&(n(10,ft=xt.lngLat),n(4,Ce=xt.features??[]),Wt.isOpen()?n(25,en="justOpened"):(n(25,en="opening"),n(0,mt=!0)))}function Yn(xt){Y!=="hover"||dn||en!=="normal"||(n(0,mt=!1),n(4,Ce=null))}function Wr(xt){if(!(Y!=="hover"||dn||en!=="normal")){if(Ve(xt)){n(0,mt=!1),n(4,Ce=null);return}n(0,mt=!0),n(4,Ce=xt.features??[]),n(10,ft=xt.lngLat)}}function hr(xt){if(en==="justOpened"){n(25,en="normal");return}if(!N)return;let ce=[ze,u instanceof vs.Marker?u==null?void 0:u.getElement():null];mt&&Wt.isOpen()&&!ce.some(mn=>mn==null?void 0:mn.contains(xt.originalEvent.target))&&(xt.type==="contextmenu"&&Y==="contextmenu"||xt.type!=="contextmenu")&&n(0,mt=!1)}ws(()=>{l&&(Wt!=null&&Wt.isOpen())&&Wt.remove()});let er;const Kn=()=>n(0,mt=!1);function nt(xt){fi[xt?"unshift":"push"](()=>{er=xt,n(1,er)})}return e.$$set=xt=>{"closeButton"in xt&&n(11,P=xt.closeButton),"closeOnClickOutside"in xt&&n(12,N=xt.closeOnClickOutside),"closeOnClickInside"in xt&&n(13,R=xt.closeOnClickInside),"closeOnMove"in xt&&n(14,J=xt.closeOnMove),"openOn"in xt&&n(15,Y=xt.openOn),"openIfTopMost"in xt&&n(16,K=xt.openIfTopMost),"focusAfterOpen"in xt&&n(17,B=xt.focusAfterOpen),"anchor"in xt&&n(18,G=xt.anchor),"offset"in xt&&n(19,H=xt.offset),"popupClass"in xt&&n(20,at=xt.popupClass),"maxWidth"in xt&&n(21,gt=xt.maxWidth),"lngLat"in xt&&n(10,ft=xt.lngLat),"html"in xt&&n(22,rt=xt.html),"open"in xt&&n(0,mt=xt.open),"$$scope"in xt&&n(29,S=xt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,r=P??(!N&&!R)),e.$$.dirty[0]&146685952&&(Wt||(n(23,Wt=new vs.Popup({closeButton:r,closeOnClick:!1,closeOnMove:J,focusAfterOpen:B,maxWidth:gt,className:at,anchor:G,offset:H})),ze=Wt.getElement(),Wt.on("open",()=>{n(0,mt=!0),We(),Et("open",Wt)}),Wt.on("close",()=>{n(0,mt=!1),Et("close",Wt)}),Wt.on("hover",()=>{Et("hover",Wt)}))),e.$$.dirty[0]&8421384&&Wt&&u instanceof vs.Marker&&(Y==="click"?u.setPopup(Wt):u.getPopup()===Wt&&u.setPopup(void 0)),e.$$.dirty[0]&268468224&&fe.includes(Y)&&(h==null?void 0:h.type)===Y&&(An(h),Ur(Qt,h=null,h)),e.$$.dirty[0]&268468224&&n(26,o=Y==="hover"&&((h==null?void 0:h.type)==="mousemove"||(h==null?void 0:h.type)==="mouseenter")),e.$$.dirty[0]&352354304&&Y==="hover"&&Qt&&(o&&h&&(h.layerType==="deckgl"?(n(10,ft=h.coordinate),n(4,Ce=h.object?[h.object]:null)):(n(10,ft=h.lngLat),n(4,Ce=h.features??[]))),n(0,mt=(o||Re)??!1)),e.$$.dirty[0]&12582914&&(er?Wt.setDOMContent(er):rt&&Wt.setHTML(rt)),e.$$.dirty[0]&8389632&&ft&&Wt.setLngLat(ft),e.$$.dirty[0]&41943045&&l){let xt=Wt.isOpen();mt&&!xt?(Wt.addTo(l),en==="opening"&&n(25,en="justOpened")):!mt&&xt&&Wt.remove()}},[mt,er,l,u,Ce,$,Pt,Qt,Tt,C,ft,P,N,R,J,Y,K,B,G,H,at,gt,rt,Wt,Re,en,o,r,h,S,w,Kn,nt]}class zN extends an{constructor(t){super(),sn(this,t,ON,NN,Xe,{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])}}const FN=e=>({props:e&8}),x2=e=>({props:UN(e[3])});function BN(e){let t;const n=e[1].default,r=li(n,e,e[2],x2);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&12)&&ci(r,n,o,o[2],t?ui(n,o[2],l,FN):hi(o[2]),x2)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function VN(e){let t,n;return t=new zN({props:{openOn:e[0],$$slots:{default:[BN,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&1&&(l.openOn=r[0]),o&12&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function UN(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function GN(e,t,n){let{$$slots:r={},$$scope:o}=t,{openOn:l="hover"}=t;return e.$$set=h=>{"openOn"in h&&n(0,l=h.openOn),"$$scope"in h&&n(2,o=h.$$scope)},[l,r,o]}class MI extends an{constructor(t){super(),sn(this,t,GN,VN,Xe,{openOn:0})}}function Eu(e,t,n){let r=["match",e];for(let[o,l]of Object.entries(t))r.push(o),r.push(l);return r.push(n),r}function qN(e,t,n){let r=["step",e];for(let o=1;o=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function Wv(e,t){t===void 0&&(t="kilometers");var n=qv[t];if(!n)throw new Error(t+" units is invalid");return e*n}function vy(e,t){t===void 0&&(t="kilometers");var n=qv[t];if(!n)throw new Error(t+" units is invalid");return e/n}function JN(e,t){return Td(vy(e,t))}function QN(e){var t=e%360;return t<0&&(t+=360),t}function Td(e){var t=e%(2*Math.PI);return t*180/Math.PI}function Zs(e){var t=e%360;return t*Math.PI/180}function $N(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return Wv(vy(e,t),n)}function tO(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var r=W0[t];if(!r)throw new Error("invalid original units");var o=W0[n];if(!o)throw new Error("invalid final units");return e/r*o}function Xg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Hv(e){return!!e&&e.constructor===Object}function eO(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!Xg(t))throw new Error("bbox must only contain numbers")})}function nO(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const rO=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:W0,bearingToAzimuth:QN,convertArea:tO,convertLength:$N,degreesToRadians:Zs,earthRadius:_o,factors:qv,feature:sa,featureCollection:zc,geometry:WN,geometryCollection:YN,isNumber:Xg,isObject:Hv,lengthToDegrees:JN,lengthToRadians:vy,lineString:Hs,lineStrings:XN,multiLineString:AI,multiPoint:kI,multiPolygon:DI,point:$o,points:HN,polygon:jv,polygons:ZN,radiansToDegrees:Td,radiansToLength:Wv,round:KN,unitsFactors:jN,validateBBox:eO,validateId:nO},Symbol.toStringTag,{value:"Module"}));function Ld(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Pf(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function RI(e,t,n){if(n===void 0&&(n={}),n.final===!0)return iO(e,t);var r=Ld(e),o=Ld(t),l=Zs(r[0]),h=Zs(o[0]),u=Zs(r[1]),y=Zs(o[1]),w=Math.sin(h-l)*Math.cos(y),S=Math.cos(u)*Math.sin(y)-Math.sin(u)*Math.cos(y)*Math.cos(h-l);return Td(Math.atan2(w,S))}function iO(e,t){var n=RI(t,e);return n=(n+180)%360,n}function Zp(e,t,n){n===void 0&&(n={});var r=Ld(e),o=Ld(t),l=Zs(o[1]-r[1]),h=Zs(o[0]-r[0]),u=Zs(r[1]),y=Zs(o[1]),w=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(u)*Math.cos(y);return Wv(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function w2(e,t,n,r){r===void 0&&(r={});var o=Ld(e),l=Zs(o[0]),h=Zs(o[1]),u=Zs(n),y=vy(t,r.units),w=Math.asin(Math.sin(h)*Math.cos(y)+Math.cos(h)*Math.sin(y)*Math.cos(u)),S=l+Math.atan2(Math.sin(u)*Math.sin(y)*Math.cos(h),Math.cos(y)-Math.sin(h)*Math.sin(w)),C=Td(S),P=Td(w);return $o([C,P],r.properties)}function Ud(e,t,n){if(e!==null)for(var r,o,l,h,u,y,w,S=0,C=0,P,N=e.type,R=N==="FeatureCollection",J=N==="Feature",Y=R?e.features.length:1,K=0;Ky||R>w||J>S){u=C,y=r,w=R,S=J,l=0;return}var Y=Hs([u,C],n.properties);if(t(Y,r,o,J,l)===!1)return!1;l++,u=C})===!1)return!1}}})}function hO(e,t,n){var r=n,o=!1;return OI(e,function(l,h,u,y,w){o===!1&&n===void 0?r=l:r=t(r,l,h,u,y,w),o=!0}),r}function zI(e,t){if(!e)throw new Error("geojson is required");Vf(e,function(n,r,o){if(n.geometry!==null){var l=n.geometry.type,h=n.geometry.coordinates;switch(l){case"LineString":if(t(n,r,o,0,0)===!1)return!1;break;case"Polygon":for(var u=0;uo?n:o,w=r>l?r:l;return[h,u,y,w]}var Xv={exports:{}},FI={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Md,function(){function n(B,G,H,at,gt){(function ft(rt,mt,Et,$,Pt){for(;$>Et;){if($-Et>600){var Qt=$-Et+1,Tt=mt-Et+1,re=Math.log(Qt),fe=.5*Math.exp(2*re/3),Wt=.5*Math.sqrt(re*fe*(Qt-fe)/Qt)*(Tt-Qt/2<0?-1:1),Re=Math.max(Et,Math.floor(mt-Tt*fe/Qt+Wt)),ze=Math.min($,Math.floor(mt+(Qt-Tt)*fe/Qt+Wt));ft(rt,mt,Re,ze,Pt)}var We=rt[mt],Ve=Et,Ce=$;for(r(rt,Et,mt),Pt(rt[$],We)>0&&r(rt,Et,$);Ve0;)Ce--}Pt(rt[Et],We)===0?r(rt,Et,Ce):r(rt,++Ce,$),Ce<=mt&&(Et=Ce+1),mt<=Ce&&($=Ce-1)}})(B,G,H||0,at||B.length-1,gt||o)}function r(B,G,H){var at=B[G];B[G]=B[H],B[H]=at}function o(B,G){return BG?1:0}var l=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(B,G,H){if(!H)return G.indexOf(B);for(var at=0;at=B.minX&&G.maxY>=B.minY}function Y(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function K(B,G,H,at,gt){for(var ft=[G,H];ft.length;)if(!((H=ft.pop())-(G=ft.pop())<=at)){var rt=G+Math.ceil((H-G)/at/2)*at;n(B,rt,G,H,gt),ft.push(G,rt,rt,H)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(B){var G=this.data,H=[];if(!J(B,G))return H;for(var at=this.toBBox,gt=[];G;){for(var ft=0;ft=0&>[G].children.length>this._maxEntries;)this._split(gt,G),G--;this._adjustParentBBoxes(at,gt,G)},l.prototype._split=function(B,G){var H=B[G],at=H.children.length,gt=this._minEntries;this._chooseSplitAxis(H,gt,at);var ft=this._chooseSplitIndex(H,gt,at),rt=Y(H.children.splice(ft,H.children.length-ft));rt.height=H.height,rt.leaf=H.leaf,u(H,this.toBBox),u(rt,this.toBBox),G?B[G-1].children.push(rt):this._splitRoot(H,rt)},l.prototype._splitRoot=function(B,G){this.data=Y([B,G]),this.data.height=B.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(B,G,H){for(var at,gt,ft,rt,mt,Et,$,Pt=1/0,Qt=1/0,Tt=G;Tt<=H-G;Tt++){var re=y(B,0,Tt,this.toBBox),fe=y(B,Tt,H,this.toBBox),Wt=(gt=re,ft=fe,rt=void 0,mt=void 0,Et=void 0,$=void 0,rt=Math.max(gt.minX,ft.minX),mt=Math.max(gt.minY,ft.minY),Et=Math.min(gt.maxX,ft.maxX),$=Math.min(gt.maxY,ft.maxY),Math.max(0,Et-rt)*Math.max(0,$-mt)),Re=P(re)+P(fe);Wt=G;Pt--){var Qt=B.children[Pt];w(rt,B.leaf?gt(Qt):Qt),mt+=N(rt)}return mt},l.prototype._adjustParentBBoxes=function(B,G,H){for(var at=H;at>=0;at--)w(G[at],B)},l.prototype._condense=function(B){for(var G=B.length-1,H=void 0;G>=0;G--)B[G].children.length===0?G>0?(H=B[G-1].children).splice(H.indexOf(B[G]),1):this.clear():u(B[G],this.toBBox)},l})})(FI);var vO=FI.exports;const bO=$g(rO),xO=$g(mO),wO=$g(YD);var Za=vO,BI=bO,VI=xO,Xh=wO.default,SO=VI.featureEach;VI.coordEach;BI.polygon;var E2=BI.featureCollection;function UI(e){var t=new Za(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Xh(n),Za.prototype.insert.call(this,n)},t.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Xh(o),r.push(o)}):SO(n,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Xh(o),r.push(o)}),Za.prototype.load.call(this,r)},t.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Xh(n),Za.prototype.remove.call(this,n,r)},t.clear=function(){return Za.prototype.clear.call(this)},t.search=function(n){var r=Za.prototype.search.call(this,this.toBBox(n));return E2(r)},t.collides=function(n){return Za.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Za.prototype.all.call(this);return E2(n)},t.toJSON=function(){return Za.prototype.toJSON.call(this)},t.fromJSON=function(n){return Za.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=Xh(n);else if(n.type==="FeatureCollection")r=Xh(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},t}Xv.exports=UI;Xv.exports.default=UI;var EO=Xv.exports;const IO=ev(EO);function CO(e,t){var n={},r=[];if(e.type==="LineString"&&(e=sa(e)),t.type==="LineString"&&(t=sa(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var o=I2(e,t);return o&&r.push(o),zc(r)}var l=IO();return l.load(S2(t)),Yg(S2(e),function(h){Yg(l.search(h),function(u){var y=I2(h,u);if(y){var w=Pf(y).join(",");n[w]||(n[w]=!0,r.push(y))}})}),zc(r)}function I2(e,t){var n=Pf(e),r=Pf(t);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var o=n[0][0],l=n[0][1],h=n[1][0],u=n[1][1],y=r[0][0],w=r[0][1],S=r[1][0],C=r[1][1],P=(C-w)*(h-o)-(S-y)*(u-l),N=(S-y)*(l-w)-(C-w)*(o-y),R=(h-o)*(l-w)-(u-l)*(o-y);if(P===0)return null;var J=N/P,Y=R/P;if(J>=0&&J<=1&&Y>=0&&Y<=1){var K=o+J*(h-o),B=l+J*(u-l);return $o([K,B])}return null}function TO(e,t,n){n===void 0&&(n={});var r=$o([1/0,1/0],{dist:1/0}),o=0;return Vf(e,function(l){for(var h=Pf(l),u=0;u0&&(Y=J.features[0],Y.properties.dist=Zp(t,Y,n),Y.properties.location=o+Zp(y,Y,n)),y.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,r=this.dragFrom[1]-t.lngLat.lat;for(let o of this.points)o[0]-=n,o[1]-=r}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});yi(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(C2(this.points).forEach((r,o)=>{n.push([o+1,TO(r,this.cursor).properties.dist])}),n.sort((r,o)=>r[1]-o[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(t))});yi(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=r0(t.lngLat.toArray()),this.onClick(t),this.finish())});yi(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});yi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});yi(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});yi(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((o,l)=>{let h=r0(o);h.properties.hover=this.hover==l,h.properties.idx=l,t.features.push(h)}),t.features=t.features.concat(C2(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),qI.set(t);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,jI.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=r0(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(GI),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>AO&&this.previousStates.shift()}}function C2(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function DO(e){let t,n,r;return{c(){t=wn("Undo ("),n=wn(e[1]),r=wn(")")},m(o,l){zt(o,t,l),zt(o,n,l),zt(o,r,l)},p(o,l){l&2&&Ui(n,o[1])},d(o){o&&(Nt(t),Nt(n),Nt(r))}}}function RO(e){let t;return{c(){t=wn("Undo")},m(n,r){zt(n,t,r)},p:Me,d(n){n&&Nt(t)}}}function NO(e){let t,n,r,o,l,h,u,y,w,S,C;function P(J,Y){return J[1]==0?RO:DO}let N=P(e),R=N(e);return{c(){t=jt("div"),n=jt("button"),n.textContent="Finish",r=ye(),o=jt("button"),o.textContent="Cancel",l=ye(),h=jt("button"),R.c(),y=ye(),w=jt("ul"),w.innerHTML=`
  • Click +`)}return e.toString()};Mi.prototype.computeEdgeEndLabels=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();n.computeLabel(e)}};Mi.prototype.computeLabelling=function(e){var t=this;this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],r=this.iterator();r.hasNext();)for(var i=r.next(),l=i.getLabel(),h=0;h<2;h++)l.isLine(h)&&l.getLocation(h)===At.BOUNDARY&&(n[h]=!0);for(var u=this.iterator();u.hasNext();)for(var y=u.next(),w=y.getLabel(),S=0;S<2;S++)if(w.isAnyNull(S)){var C=At.NONE;if(n[S])C=At.EXTERIOR;else{var P=y.getCoordinate();C=t.getLocation(S,P,e)}w.setAllLocationsIfNull(S,C)}};Mi.prototype.getDegree=function(){return this._edgeMap.size()};Mi.prototype.insertEdgeEnd=function(e,t){this._edgeMap.put(e,t),this._edgeList=null};Mi.prototype.interfaces_=function(){return[]};Mi.prototype.getClass=function(){return Mi};var hR=function(e){function t(){e.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var r=null,i=null,l=this._SCANNING_FOR_INCOMING,h=0;h=0;l--){var h=n._edgeList.get(l),u=h.getSym();i===null&&(i=u),r!==null&&u.setNext(r),r=h}i.setNext(r)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),l=r.getDepth(ee.LEFT),h=r.getDepth(ee.RIGHT),u=this.computeDepths(i+1,this._edgeList.size(),l),y=this.computeDepths(0,i,u);if(y!==h)throw new al("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],C=arguments[2],P=C,D=w;D=0;u--){var y=r._resultAreaEdgeList.get(u),w=y.getSym();switch(i===null&&y.getEdgeRing()===n&&(i=y),h){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;l=w,h=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(y.getEdgeRing()!==n)continue;l.setNextMin(y),h=r._SCANNING_FOR_INCOMING;break}}h===this._LINKING_TO_OUTGOING&&(tn.isTrue(i!==null,"found null for first outgoing dirEdge"),tn.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),l.setNextMin(i))},t.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 l=arguments[0],h=0,u=this.iterator();u.hasNext();){var y=u.next();y.getEdgeRing()===l&&h++}return h}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=At.NONE,r=this.iterator();r.hasNext();){var i=r.next(),l=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=At.INTERIOR;break}if(l.isInResult()){n=At.EXTERIOR;break}}}if(n===At.NONE)return null;for(var h=n,u=this.iterator();u.hasNext();){var y=u.next(),w=y.getSym();y.isLineEdge()?y.getEdge().setCovered(h===At.INTERIOR):(y.isInResult()&&(h=At.EXTERIOR),w.isInResult()&&(h=At.INTERIOR))}},t.prototype.computeLabelling=function(n){var r=this;e.prototype.computeLabelling.call(this,n),this._label=new Dn(At.NONE);for(var i=this.iterator();i.hasNext();)for(var l=i.next(),h=l.getEdge(),u=h.getLabel(),y=0;y<2;y++){var w=u.getLocation(y);(w===At.INTERIOR||w===At.BOUNDARY)&&r._label.setLocation(y,At.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Mi),eI=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new yy(n,new hR)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(gf),Hl=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};Hl.prototype.compareTo=function(e){var t=e,n=Hl.compareOriented(this._pts,this._orientation,t._pts,t._orientation);return n};Hl.prototype.interfaces_=function(){return[ss]};Hl.prototype.getClass=function(){return Hl};Hl.orientation=function(e){return pn.increasingDirection(e)===1};Hl.compareOriented=function(e,t,n,r){for(var i=t?1:-1,l=r?1:-1,h=t?e.length:-1,u=r?n.length:-1,y=t?0:e.length-1,w=r?0:n.length-1;;){var S=e[y].compareTo(n[w]);if(S!==0)return S;y+=i,w+=l;var C=y===h,P=w===u;if(C&&!P)return-1;if(!C&&P)return 1;if(C&&P)return 0}};var Ts=function(){this._edges=new ue,this._ocaMap=new Li};Ts.prototype.print=function(e){var t=this;e.print("MULTILINESTRING ( ");for(var n=0;n0&&e.print(","),e.print("(");for(var i=r.getCoordinates(),l=0;l0&&e.print(","),e.print(i[l].x+" "+i[l].y);e.println(")")}e.print(") ")};Ts.prototype.addAll=function(e){for(var t=this,n=e.iterator();n.hasNext();)t.add(n.next())};Ts.prototype.findEdgeIndex=function(e){for(var t=this,n=0;n0||!t.coord.equals2D(i);l||r--;var h=new Array(r).fill(null),u=0;h[u++]=new Lt(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)h[u++]=n.edge.pts[y];return l&&(h[u]=t.coord),new Vg(h,new Dn(this.edge._label))};La.prototype.add=function(e,t,n){var r=new na(e,t,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};La.prototype.isIntersection=function(e){for(var t=this.iterator();t.hasNext();){var n=t.next();if(n.coord.equals(e))return!0}return!1};La.prototype.interfaces_=function(){return[]};La.prototype.getClass=function(){return La};var Nu=function(){};Nu.prototype.getChainStartIndices=function(e){var t=this,n=0,r=new ue;r.add(new Ks(n));do{var i=t.findChainEnd(e,n);r.add(new Ks(i)),n=i}while(nn?t:n};ul.prototype.getMinX=function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return tn&&(i=1),e._depth[t][r]=i}}};bi.prototype.getDelta=function(e){return this._depth[e][ee.RIGHT]-this._depth[e][ee.LEFT]};bi.prototype.getLocation=function(e,t){return this._depth[e][t]<=0?At.EXTERIOR:At.INTERIOR};bi.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};bi.prototype.add=function(){var e=this;if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=t.getLocation(n,r);(i===At.EXTERIOR||i===At.INTERIOR)&&(e.isNull(n,r)?e._depth[n][r]=bi.depthAtLocation(i):e._depth[n][r]+=bi.depthAtLocation(i))}else if(arguments.length===3){var l=arguments[0],h=arguments[1],u=arguments[2];u===At.INTERIOR&&this._depth[l][h]++}};bi.prototype.interfaces_=function(){return[]};bi.prototype.getClass=function(){return bi};bi.depthAtLocation=function(e){return e===At.EXTERIOR?0:e===At.INTERIOR?1:bi.NULL_VALUE};nI.NULL_VALUE.get=function(){return-1};Object.defineProperties(bi,nI);var Vg=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new La(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new bi,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new t(n,Dn.toLineLabel(this._label));return r},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var r=this;if(!(n instanceof t))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var l=!0,h=!0,u=this.pts.length,y=0;y0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.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)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ul(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Pe;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()},t.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxyl;if(h)return!1;var u=this.intersectsToleranceSquare(e,t);return tn.isTrue(!(h&&u),"Found bad envelope test"),u};ro.prototype.initCorners=function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new Lt(this._maxx,this._maxy),this._corner[1]=new Lt(this._minx,this._maxy),this._corner[2]=new Lt(this._minx,this._miny),this._corner[3]=new Lt(this._maxx,this._miny)};ro.prototype.intersects=function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};ro.prototype.scale=function(e){return Math.round(e*this._scaleFactor)};ro.prototype.getCoordinate=function(){return this._originalPt};ro.prototype.copyScaled=function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)};ro.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var e=ro.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Pe(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv};ro.prototype.intersectsPixelClosure=function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.hasIntersection()))};ro.prototype.intersectsToleranceSquare=function(e,t){var n=!1,r=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||e.equals(this._pt)||t.equals(this._pt))};ro.prototype.addSnappedNode=function(e,t){var n=e.getCoordinate(t),r=e.getCoordinate(t+1);return this.intersects(n,r)?(e.addIntersection(this.getCoordinate(),t),!0):!1};ro.prototype.interfaces_=function(){return[]};ro.prototype.getClass=function(){return ro};iI.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(ro,iI);var Sd=function(){this.tempEnv1=new Pe,this.selectedSegment=new Me};Sd.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}};Sd.prototype.interfaces_=function(){return[]};Sd.prototype.getClass=function(){return Sd};var bf=function(){this._index=null;var e=arguments[0];this._index=e},oI={HotPixelSnapAction:{configurable:!0}};bf.prototype.snap=function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}else if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=t.getSafeEnvelope(),l=new sI(t,n,r);return this._index.query(i,{interfaces_:function(){return[jl]},visitItem:function(h){var u=h;u.select(i,l)}}),l.isNodeAdded()}};bf.prototype.interfaces_=function(){return[]};bf.prototype.getClass=function(){return bf};oI.HotPixelSnapAction.get=function(){return sI};Object.defineProperties(bf,oI);var sI=function(e){function t(){e.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 e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],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 e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Sd),Pc=function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new ue};Pc.prototype.processIntersections=function(e,t,n,r){var i=this;if(e===n&&t===r)return null;var l=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];if(this._li.computeIntersection(l,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;t--){try{e.bufferReducedPrecision(t)}catch(l){if(l instanceof al)e._saveException=l;else throw l}finally{}if(e._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=vi.precisionScaleFactor(this._argGeom,this._distance,n),i=new Tn(r);this.bufferFixedPrecision(i)}};vi.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Tn.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()};vi.prototype.setQuadrantSegments=function(e){this._bufParams.setQuadrantSegments(e)};vi.prototype.bufferOriginalPrecision=function(){try{var e=new Vi(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(t instanceof ol)this._saveException=t;else throw t}finally{}};vi.prototype.getResultGeometry=function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry};vi.prototype.setEndCapStyle=function(e){this._bufParams.setEndCapStyle(e)};vi.prototype.interfaces_=function(){return[]};vi.prototype.getClass=function(){return vi};vi.bufferOp=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new vi(e),r=n.getResultGeometry(t);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Oe&&typeof arguments[1]=="number"){var i=arguments[0],l=arguments[1],h=arguments[2],u=new vi(i);u.setQuadrantSegments(h);var y=u.getResultGeometry(l);return y}else if(arguments[2]instanceof Cn&&arguments[0]instanceof Oe&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],C=arguments[2],P=new vi(w,C),D=P.getResultGeometry(S);return D}}else if(arguments.length===4){var N=arguments[0],K=arguments[1],Y=arguments[2],J=arguments[3],B=new vi(N);B.setQuadrantSegments(Y),B.setEndCapStyle(J);var G=B.getResultGeometry(K);return G}};vi.precisionScaleFactor=function(e,t,n){var r=e.getEnvelopeInternal(),i=Uo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),l=t>0?t:0,h=i+2*l,u=Math.trunc(Math.log(h)/Math.log(10)+1),y=n-u,w=Math.pow(10,y);return w};Ff.CAP_ROUND.get=function(){return Cn.CAP_ROUND};Ff.CAP_BUTT.get=function(){return Cn.CAP_FLAT};Ff.CAP_FLAT.get=function(){return Cn.CAP_FLAT};Ff.CAP_SQUARE.get=function(){return Cn.CAP_SQUARE};Ff.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(vi,Ff);var zi=function(){this._pt=[new Lt,new Lt],this._distance=je.NaN,this._isNull=!0};zi.prototype.getCoordinates=function(){return this._pt};zi.prototype.getCoordinate=function(e){return this._pt[e]};zi.prototype.setMinimum=function(){if(arguments.length===1){var e=arguments[0];this.setMinimum(e._pt[0],e._pt[1])}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(t,n),null;var r=t.distance(n);rthis._distance&&this.initialize(t,n,r)}};zi.prototype.interfaces_=function(){return[]};zi.prototype.getClass=function(){return zi};var va=function(){};va.prototype.interfaces_=function(){return[]};va.prototype.getClass=function(){return va};va.computeDistance=function(){if(arguments[2]instanceof zi&&arguments[0]instanceof yr&&arguments[1]instanceof Lt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=e.getCoordinates(),i=new Me,l=0;l0||this._isIn?At.INTERIOR:At.EXTERIOR)};Ls.prototype.interfaces_=function(){return[]};Ls.prototype.getClass=function(){return Ls};var Fi=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],l=arguments[2];this._component=r,this._segIndex=i,this._pt=l}},aI={INSIDE_AREA:{configurable:!0}};Fi.prototype.isInsideArea=function(){return this._segIndex===Fi.INSIDE_AREA};Fi.prototype.getCoordinate=function(){return this._pt};Fi.prototype.getGeometryComponent=function(){return this._component};Fi.prototype.getSegmentIndex=function(){return this._segIndex};Fi.prototype.interfaces_=function(){return[]};Fi.prototype.getClass=function(){return Fi};aI.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Fi,aI);var Ul=function(e){this._pts=e||null};Ul.prototype.filter=function(e){e instanceof So&&this._pts.add(e)};Ul.prototype.interfaces_=function(){return[Qs]};Ul.prototype.getClass=function(){return Ul};Ul.getPoints=function(){if(arguments.length===1){var e=arguments[0];return e instanceof So?Cs.singletonList(e):Ul.getPoints(e,new ue)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];return t instanceof So?n.add(t):t instanceof Gi&&t.apply(new Ul(n)),n}};var Ac=function(){this._locations=null;var e=arguments[0];this._locations=e};Ac.prototype.filter=function(e){(e instanceof So||e instanceof yr||e instanceof jr)&&this._locations.add(new Fi(e,0,e.getCoordinate()))};Ac.prototype.interfaces_=function(){return[Qs]};Ac.prototype.getClass=function(){return Ac};Ac.getLocations=function(e){var t=new ue;return e.apply(new Ac(t)),t};var wi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ls,this._minDistanceLocation=null,this._minDistance=je.MAX_VALUE,arguments.length===2){var e=arguments[0],t=arguments[1];this._geom=[e,t],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};wi.prototype.computeContainmentDistance=function(){var e=this;if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,l=nl.getPolygons(this._geom[n]);if(l.size()>0){var h=Ac.getLocations(this._geom[i]);if(this.computeContainmentDistance(h,l,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&&Fe(arguments[0],xs)&&Fe(arguments[1],xs)){for(var u=arguments[0],y=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=t.getCoordinates(),l=n.getCoordinate(),h=0;hthis._minDistance)return null;for(var D=S.getCoordinates(),N=C.getCoordinates(),K=0;Kthis._distance&&this.initialize(t,n,r)}};Ti.prototype.interfaces_=function(){return[]};Ti.prototype.getClass=function(){return Ti};var Ws=function(){};Ws.prototype.interfaces_=function(){return[]};Ws.prototype.getClass=function(){return Ws};Ws.computeDistance=function(){if(arguments[2]instanceof Ti&&arguments[0]instanceof yr&&arguments[1]instanceof Lt)for(var e=arguments[0],t=arguments[1],n=arguments[2],r=new Me,i=e.getCoordinates(),l=0;l1||e<=0)throw new tr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=e};ns.prototype.compute=function(e,t){this.computeOrientedDistance(e,t,this._ptDist),this.computeOrientedDistance(t,e,this._ptDist)};ns.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ns.prototype.computeOrientedDistance=function(e,t,n){var r=new kc(t);if(e.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new Yl(t,this._densifyFrac);e.apply(i),n.setMaximum(i.getMaxPointDistance())}};ns.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ns.prototype.interfaces_=function(){return[]};ns.prototype.getClass=function(){return ns};ns.distance=function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new ns(e,t);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],l=arguments[2],h=new ns(r,i);return h.setDensifyFraction(l),h.distance()}};zv.MaxPointDistanceFilter.get=function(){return kc};zv.MaxDensifiedByFractionDistanceFilter.get=function(){return Yl};Object.defineProperties(ns,zv);var kc=function(){this._maxPtDist=new Ti,this._minPtDist=new Ti,this._euclideanDist=new Ws,this._geom=null;var e=arguments[0];this._geom=e};kc.prototype.filter=function(e){this._minPtDist.initialize(),Ws.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};kc.prototype.getMaxPointDistance=function(){return this._maxPtDist};kc.prototype.interfaces_=function(){return[Ea]};kc.prototype.getClass=function(){return kc};var Yl=function(){this._maxPtDist=new Ti,this._minPtDist=new Ti,this._geom=null,this._numSubSegs=0;var e=arguments[0],t=arguments[1];this._geom=e,this._numSubSegs=Math.trunc(Math.round(1/t))};Yl.prototype.filter=function(e,t){var n=this;if(t===0)return null;for(var r=e.getCoordinate(t-1),i=e.getCoordinate(t),l=(i.x-r.x)/this._numSubSegs,h=(i.y-r.y)/this._numSubSegs,u=0;un){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=e.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ss.toLineString(i[0],i[1])+")"}};bo.prototype.isValid=function(){var e=Math.abs(this._bufDistance),t=bo.MAX_DISTANCE_DIFF_FRAC*e;return this._minValidDistance=e-t,this._maxValidDistance=e+t,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),bo.VERBOSE&&xi.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};bo.prototype.checkNegativeValid=function(){if(!(this._input instanceof jr||this._input instanceof wa||this._input instanceof Gi))return null;var e=this.getPolygonLines(this._input);if(this.checkMinimumDistance(e,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(e,this._result,this._maxValidDistance)};bo.prototype.getErrorIndicator=function(){return this._errorIndicator};bo.prototype.checkMinimumDistance=function(e,t,n){var r=new wi(e,t,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&e>t&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&e=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Si.prototype.report=function(e){if(!Si.VERBOSE)return null;xi.out.println("Check "+e+": "+(this._isValid?"passed":"FAILED"))};Si.prototype.getErrorMessage=function(){return this._errorMsg};Si.prototype.interfaces_=function(){return[]};Si.prototype.getClass=function(){return Si};Si.isValidMsg=function(e,t,n){var r=new Si(e,t,n);return r.isValid()?null:r.getErrorMessage()};Si.isValid=function(e,t,n){var r=new Si(e,t,n);return!!r.isValid()};Bv.VERBOSE.get=function(){return!1};Bv.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Si,Bv);var ia=function(){this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t};ia.prototype.getCoordinates=function(){return this._pts};ia.prototype.size=function(){return this._pts.length};ia.prototype.getCoordinate=function(e){return this._pts[e]};ia.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};ia.prototype.getSegmentOctant=function(e){return e===this._pts.length-1?-1:Tc.octant(this.getCoordinate(e),this.getCoordinate(e+1))};ia.prototype.setData=function(e){this._data=e};ia.prototype.getData=function(){return this._data};ia.prototype.toString=function(){return Ss.toLineString(new Sr(this._pts))};ia.prototype.interfaces_=function(){return[Ta]};ia.prototype.getClass=function(){return ia};var di=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new ue,this._intersectionCount=0,this._keepIntersections=!0;var e=arguments[0];this._li=e,this._interiorIntersection=null};di.prototype.getInteriorIntersection=function(){return this._interiorIntersection};di.prototype.setCheckEndSegmentsOnly=function(e){this._isCheckEndSegmentsOnly=e};di.prototype.getIntersectionSegments=function(){return this._intSegments};di.prototype.count=function(){return this._intersectionCount};di.prototype.getIntersections=function(){return this._intersections};di.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};di.prototype.setKeepIntersections=function(e){this._keepIntersections=e};di.prototype.processIntersections=function(e,t,n,r){if(!this._findAllIntersections&&this.hasIntersection()||e===n&&t===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(e,t)||this.isEndSegment(n,r);if(!i)return null}var l=e.getCoordinates()[t],h=e.getCoordinates()[t+1],u=n.getCoordinates()[r],y=n.getCoordinates()[r+1];this._li.computeIntersection(l,h,u,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=l,this._intSegments[1]=h,this._intSegments[2]=u,this._intSegments[3]=y,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};di.prototype.isEndSegment=function(e,t){return t===0||t>=e.size()-2};di.prototype.hasIntersection=function(){return this._interiorIntersection!==null};di.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};di.prototype.interfaces_=function(){return[Ru]};di.prototype.getClass=function(){return di};di.createAllIntersectionsFinder=function(e){var t=new di(e);return t.setFindAllIntersections(!0),t};di.createAnyIntersectionFinder=function(e){return new di(e)};di.createIntersectionCounter=function(e){var t=new di(e);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t};var Ps=function(){this._li=new qu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var e=arguments[0];this._segStrings=e};Ps.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Ps.prototype.getIntersections=function(){return this._segInt.getIntersections()};Ps.prototype.isValid=function(){return this.execute(),this._isValid};Ps.prototype.setFindAllIntersections=function(e){this._findAllIntersections=e};Ps.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new di(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var e=new Nv;if(e.setSegmentIntersector(this._segInt),e.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Ps.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new al(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Ps.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var e=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ss.toLineString(e[0],e[1])+" and "+Ss.toLineString(e[2],e[3])};Ps.prototype.interfaces_=function(){return[]};Ps.prototype.getClass=function(){return Ps};Ps.computeIntersections=function(e){var t=new Ps(e);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()};var zu=function e(){this._nv=null;var t=arguments[0];this._nv=new Ps(e.toSegmentStrings(t))};zu.prototype.checkValid=function(){this._nv.checkValid()};zu.prototype.interfaces_=function(){return[]};zu.prototype.getClass=function(){return zu};zu.toSegmentStrings=function(e){for(var t=new ue,n=e.iterator();n.hasNext();){var r=n.next();t.add(new ia(r.getCoordinates(),r))}return t};zu.checkValid=function(e){var t=new zu(e);t.checkValid()};var Dc=function(e){this._mapOp=e};Dc.prototype.map=function(e){for(var t=this,n=new ue,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};io.prototype.interfaces_=function(){return[]};io.prototype.getClass=function(){return io};var Ma=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Me,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof yr&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=e.isClosed(r),this._snapTolerance=i}};Ma.prototype.snapVertices=function(e,t){for(var n=this,r=this._isClosed?e.size()-1:e.size(),i=0;i=0&&e.add(h+1,new Lt(l),!1)}};Ma.prototype.findSegmentIndexToSnap=function(e,t){for(var n=this,r=je.MAX_VALUE,i=-1,l=0;lt&&(t=r)}return t}else if(arguments.length===2){var i=arguments[0],l=arguments[1];return Math.min(Er.computeOverlaySnapTolerance(i),Er.computeOverlaySnapTolerance(l))}};Er.computeSizeBasedSnapTolerance=function(e){var t=e.getEnvelopeInternal(),n=Math.min(t.getHeight(),t.getWidth()),r=n*Er.SNAP_PRECISION_FACTOR;return r};Er.snapToSelf=function(e,t,n){var r=new Er(e);return r.snapToSelf(t,n)};lI.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Er,lI);var uI=function(e){function t(n,r,i){e.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,r){var i=new Ma(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},t.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),l=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(l)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(io),Oi=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Oi.prototype.getCommon=function(){return je.longBitsToDouble(this._commonBits)};Oi.prototype.add=function(e){var t=je.doubleToLongBits(e);if(this._isFirst)return this._commonBits=t,this._commonSignExp=Oi.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Oi.signExpBits(t);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Oi.numCommonMostSigMantissaBits(this._commonBits,t),this._commonBits=Oi.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Oi.prototype.toString=function(){if(arguments.length===1){var e=arguments[0],t=je.longBitsToDouble(e),n=je.toBinaryString(e),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),l=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+t+" ]";return l}};Oi.prototype.interfaces_=function(){return[]};Oi.prototype.getClass=function(){return Oi};Oi.getBit=function(e,t){var n=1<>52};Oi.zeroLowerBits=function(e,t){var n=(1<=0;r--){if(Oi.getBit(e,r)!==Oi.getBit(t,r))return n;n++}return 52};var Kl=function(){this._commonCoord=null,this._ccFilter=new Nc},Vv={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Kl.prototype.addCommonBits=function(e){var t=new Jl(this._commonCoord);e.apply(t),e.geometryChanged()};Kl.prototype.removeCommonBits=function(e){if(this._commonCoord.x===0&&this._commonCoord.y===0)return e;var t=new Lt(this._commonCoord);t.x=-t.x,t.y=-t.y;var n=new Jl(t);return e.apply(n),e.geometryChanged(),e};Kl.prototype.getCommonCoordinate=function(){return this._commonCoord};Kl.prototype.add=function(e){e.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Kl.prototype.interfaces_=function(){return[]};Kl.prototype.getClass=function(){return Kl};Vv.CommonCoordinateFilter.get=function(){return Nc};Vv.Translater.get=function(){return Jl};Object.defineProperties(Kl,Vv);var Nc=function(){this._commonBitsX=new Oi,this._commonBitsY=new Oi};Nc.prototype.filter=function(e){this._commonBitsX.add(e.x),this._commonBitsY.add(e.y)};Nc.prototype.getCommonCoordinate=function(){return new Lt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Nc.prototype.interfaces_=function(){return[Ea]};Nc.prototype.getClass=function(){return Nc};var Jl=function(){this.trans=null;var e=arguments[0];this.trans=e};Jl.prototype.filter=function(e,t){var n=e.getOrdinate(t,0)+this.trans.x,r=e.getOrdinate(t,1)+this.trans.y;e.setOrdinate(t,0,n),e.setOrdinate(t,1,r)};Jl.prototype.isDone=function(){return!1};Jl.prototype.isGeometryChanged=function(){return!0};Jl.prototype.interfaces_=function(){return[Es]};Jl.prototype.getClass=function(){return Jl};var mi=function(e,t){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=e,this._geom[1]=t,this.computeSnapTolerance()};mi.prototype.selfSnap=function(e){var t=new Er(e),n=t.snapTo(e,this._snapTolerance);return n};mi.prototype.removeCommonBits=function(e){this._cbr=new Kl,this._cbr.add(e[0]),this._cbr.add(e[1]);var t=new Array(2).fill(null);return t[0]=this._cbr.removeCommonBits(e[0].copy()),t[1]=this._cbr.removeCommonBits(e[1].copy()),t};mi.prototype.prepareResult=function(e){return this._cbr.addCommonBits(e),e};mi.prototype.getResultGeometry=function(e){var t=this.snap(this._geom),n=Ke.overlayOp(t[0],t[1],e);return this.prepareResult(n)};mi.prototype.checkValid=function(e){e.isValid()||xi.out.println("Snapped geometry is invalid")};mi.prototype.computeSnapTolerance=function(){this._snapTolerance=Er.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};mi.prototype.snap=function(e){var t=this.removeCommonBits(e),n=Er.snap(t[0],t[1],this._snapTolerance);return n};mi.prototype.interfaces_=function(){return[]};mi.prototype.getClass=function(){return mi};mi.overlayOp=function(e,t,n){var r=new mi(e,t);return r.getResultGeometry(n)};mi.union=function(e,t){return mi.overlayOp(e,t,Ke.UNION)};mi.intersection=function(e,t){return mi.overlayOp(e,t,Ke.INTERSECTION)};mi.symDifference=function(e,t){return mi.overlayOp(e,t,Ke.SYMDIFFERENCE)};mi.difference=function(e,t){return mi.overlayOp(e,t,Ke.DIFFERENCE)};var Wi=function(e,t){this._geom=new Array(2).fill(null),this._geom[0]=e,this._geom[1]=t};Wi.prototype.getResultGeometry=function(e){var t=null,n=!1,r=null;try{t=Ke.overlayOp(this._geom[0],this._geom[1],e);var i=!0;i&&(n=!0)}catch(l){if(l instanceof ol)r=l;else throw l}finally{}if(!n)try{t=mi.overlayOp(this._geom[0],this._geom[1],e)}catch(l){throw l instanceof ol?r:l}finally{}return t};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};Wi.overlayOp=function(e,t,n){var r=new Wi(e,t);return r.getResultGeometry(n)};Wi.union=function(e,t){return Wi.overlayOp(e,t,Ke.UNION)};Wi.intersection=function(e,t){return Wi.overlayOp(e,t,Ke.INTERSECTION)};Wi.symDifference=function(e,t){return Wi.overlayOp(e,t,Ke.SYMDIFFERENCE)};Wi.difference=function(e,t){return Wi.overlayOp(e,t,Ke.DIFFERENCE)};var Ed=function(){this.mce=null,this.chainIndex=null;var e=arguments[0],t=arguments[1];this.mce=e,this.chainIndex=t};Ed.prototype.computeIntersections=function(e,t){this.mce.computeIntersectsForChain(this.chainIndex,e.mce,e.chainIndex,t)};Ed.prototype.interfaces_=function(){return[]};Ed.prototype.getClass=function(){return Ed};var Co=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],l=arguments[2];this._eventType=e.INSERT,this._label=r,this._xValue=i,this._obj=l}},Uv={INSERT:{configurable:!0},DELETE:{configurable:!0}};Co.prototype.isDelete=function(){return this._eventType===Co.DELETE};Co.prototype.setDeleteEventIndex=function(e){this._deleteEventIndex=e};Co.prototype.getObject=function(){return this._obj};Co.prototype.compareTo=function(e){var t=e;return this._xValuet._xValue?1:this._eventTypet._eventType?1:0};Co.prototype.getInsertEvent=function(){return this._insertEvent};Co.prototype.isInsert=function(){return this._eventType===Co.INSERT};Co.prototype.isSameLabel=function(e){return this._label===null?!1:this._label===e._label};Co.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};Co.prototype.interfaces_=function(){return[ss]};Co.prototype.getClass=function(){return Co};Uv.INSERT.get=function(){return 1};Uv.DELETE.get=function(){return 2};Object.defineProperties(Co,Uv);var Ug=function(){};Ug.prototype.interfaces_=function(){return[]};Ug.prototype.getClass=function(){return Ug};var Ei=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._li=e,this._includeProper=t,this._recordIsolated=n};Ei.prototype.isTrivialIntersection=function(e,t,n,r){if(e===n&&this._li.getIntersectionNum()===1){if(Ei.isAdjacentSegments(t,r))return!0;if(e.isClosed()){var i=e.getNumPoints()-1;if(t===0&&r===i||r===0&&t===i)return!0}}return!1};Ei.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Ei.prototype.setIsDoneIfProperInt=function(e){this._isDoneWhenProperInt=e};Ei.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Ei.prototype.isBoundaryPointInternal=function(e,t){for(var n=t.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(e.isIntersection(i))return!0}return!1};Ei.prototype.hasProperIntersection=function(){return this._hasProper};Ei.prototype.hasIntersection=function(){return this._hasIntersection};Ei.prototype.isDone=function(){return this._isDone};Ei.prototype.isBoundaryPoint=function(e,t){return t===null?!1:!!(this.isBoundaryPointInternal(e,t[0])||this.isBoundaryPointInternal(e,t[1]))};Ei.prototype.setBoundaryNodes=function(e,t){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=e,this._bdyNodes[1]=t};Ei.prototype.addIntersections=function(e,t,n,r){if(e===n&&t===r)return null;this.numTests++;var i=e.getCoordinates()[t],l=e.getCoordinates()[t+1],h=n.getCoordinates()[r],u=n.getCoordinates()[r+1];this._li.computeIntersection(i,l,h,u),this._li.hasIntersection()&&(this._recordIsolated&&(e.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(e,t,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(e.addIntersections(this._li,t,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))))};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.isAdjacentSegments=function(e,t){return Math.abs(e-t)===1};var fR=function(e){function t(){e.call(this),this.events=new ue,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Cs.sort(this.events);for(var r=0;rt||this._maxl?1:0};Id.prototype.interfaces_=function(){return[lf]};Id.prototype.getClass=function(){return Id};var pR=function(e){function t(){e.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 e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Aa),dR=function(e){function t(){e.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 e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},t.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)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Aa),ka=function(){this._leaves=new ue,this._root=null,this._level=0};ka.prototype.buildTree=function(){var e=this;Cs.sort(this._leaves,new Aa.NodeComparator);for(var t=this._leaves,n=null,r=new ue;;){if(e.buildLevel(t,r),r.size()===1)return r.get(0);n=t,t=r,r=n}};ka.prototype.insert=function(e,t,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new pR(e,t,n))};ka.prototype.query=function(e,t,n){this.init(),this._root.query(e,t,n)};ka.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ka.prototype.printNode=function(e){xi.out.println(Ss.toLineString(new Lt(e._min,this._level),new Lt(e._max,this._level)))};ka.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ka.prototype.buildLevel=function(e,t){this._level++,t.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])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,l=n.iterator();l.hasNext();){var h=l.next();r[i++]=h.getCoordinate().copy()}return r},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===At.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},t.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var l=pn.removeRepeatedPoints(n.getCoordinates());if(l.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=l[0],null;var h=r,u=i;ge.isCCW(l)&&(h=i,u=r);var y=new Vg(l,new Dn(this._argIndex,At.BOUNDARY,h,u));this._lineEdgeMap.put(n,y),this.insertEdge(y),this.insertPoint(this._argIndex,l[0],At.BOUNDARY)},t.prototype.insertPoint=function(n,r,i){var l=this._nodes.addNode(r),h=l.getLabel();h===null?l._label=new Dn(n,i):h.setLocation(n,i)},t.prototype.createEdgeSetIntersector=function(){return new fR},t.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var l=i.next(),h=l.getLabel().getLocation(n),u=l.eiList.iterator();u.hasNext();){var y=u.next();r.addSelfIntersectionNode(n,y.coord,h)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof wa&&(this._useBoundaryDeterminationRule=!1),n instanceof jr)this.addPolygon(n);else if(n instanceof yr)this.addLineString(n);else if(n instanceof So)this.addPoint(n);else if(n instanceof mf)this.addCollection(n);else if(n instanceof Au)this.addCollection(n);else if(n instanceof wa)this.addCollection(n);else if(n instanceof Gi)this.addCollection(n);else throw new Error(n.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new wf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,r){return n.isInBoundary(r)?At.BOUNDARY:At.INTERIOR},t}(cr),Ef=function(){if(this._li=new qu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var e=arguments[0];this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Wp(0,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],r=rs.OGC_SFS_BOUNDARY_RULE;t.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Wp(0,t,r),this._arg[1]=new Wp(1,n,r)}else if(arguments.length===3){var i=arguments[0],l=arguments[1],h=arguments[2];i.getPrecisionModel().compareTo(l.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(l.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Wp(0,i,h),this._arg[1]=new Wp(1,l,h)}};Ef.prototype.getArgGeometry=function(e){return this._arg[e].getGeometry()};Ef.prototype.setComputationPrecision=function(e){this._resultPrecisionModel=e,this._li.setPrecisionModel(this._resultPrecisionModel)};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};var Tu=function(){};Tu.prototype.interfaces_=function(){return[]};Tu.prototype.getClass=function(){return Tu};Tu.map=function(){if(arguments[0]instanceof Oe&&Fe(arguments[1],Tu.MapOp)){for(var e=arguments[0],t=arguments[1],n=new ue,r=0;r=e.size()?null:e.get(t)};kr.union=function(e){var t=new kr(e);return t.union()};fI.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(kr,fI);var Gg=function(){};Gg.prototype.interfaces_=function(){return[]};Gg.prototype.getClass=function(){return Gg};Gg.union=function(e,t){if(e.isEmpty()||t.isEmpty()){if(e.isEmpty()&&t.isEmpty())return Ke.createEmptyResult(Ke.UNION,e,t,e.getFactory());if(e.isEmpty())return t.copy();if(t.isEmpty())return e.copy()}return e.checkNotGeometryCollection(e),e.checkNotGeometryCollection(t),Wi.overlayOp(e,t,Ke.UNION)};function ju(){return new qg}function qg(){this.reset()}qg.prototype={constructor:qg,reset:function(){this.s=this.t=0},add:function(e){Uw($m,e,this.t),Uw(this,$m.s,this.s),this.s?this.t+=$m.t:this.s=$m.t},valueOf:function(){return this.s}};var $m=new qg;function Uw(e,t,n){var r=e.s=t+n,i=r-t,l=r-i;e.t=t-l+(n-i)}var gr=1e-6,Bn=Math.PI,el=Bn/2,Gw=Bn/4,cl=Bn*2,vu=180/Bn,qs=Bn/180,Bi=Math.abs,mR=Math.atan,Cf=Math.atan2,Vr=Math.cos,Ur=Math.sin,Bf=Math.sqrt;function pI(e){return e>1?0:e<-1?Bn:Math.acos(e)}function Oc(e){return e>1?el:e<-1?-el:Math.asin(e)}function $p(){}function jg(e,t){e&&jw.hasOwnProperty(e.type)&&jw[e.type](e,t)}var qw={Feature:function(e,t){jg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rBn?e-cl:e<-Bn?e+cl:e,t]}q0.invert=q0;function yR(e,t,n){return(e%=cl)?t||n?dI(Zw(e),Xw(t,n)):Zw(e):t||n?Xw(t,n):q0}function Hw(e){return function(t,n){return t+=e,[t>Bn?t-cl:t<-Bn?t+cl:t,n]}}function Zw(e){var t=Hw(e);return t.invert=Hw(-e),t}function Xw(e,t){var n=Vr(e),r=Ur(e),i=Vr(t),l=Ur(t);function h(u,y){var w=Vr(y),S=Vr(u)*w,C=Ur(u)*w,P=Ur(y),D=P*n+S*r;return[Cf(C*i-D*l,S*n-P*r),Oc(D*i+C*l)]}return h.invert=function(u,y){var w=Vr(y),S=Vr(u)*w,C=Ur(u)*w,P=Ur(y),D=P*i-C*l;return[Cf(C*i+P*l,S*n+D*r),Oc(D*n-S*r)]},h}function _R(e,t,n,r,i,l){if(n){var h=Vr(t),u=Ur(t),y=r*n;i==null?(i=t+r*cl,l=t-y/2):(i=Yw(h,i),l=Yw(h,l),(r>0?il)&&(i+=r*cl));for(var w,S=i;r>0?S>l:S1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vR(e,t,n,r,i,l){var h=e[0],u=e[1],y=t[0],w=t[1],S=0,C=1,P=y-h,D=w-u,N;if(N=n-h,!(!P&&N>0)){if(N/=P,P<0){if(N0){if(N>C)return;N>S&&(S=N)}if(N=i-h,!(!P&&N<0)){if(N/=P,P<0){if(N>C)return;N>S&&(S=N)}else if(P>0){if(N0)){if(N/=D,D<0){if(N0){if(N>C)return;N>S&&(S=N)}if(N=l-u,!(!D&&N<0)){if(N/=D,D<0){if(N>C)return;N>S&&(S=N)}else if(D>0){if(N0&&(e[0]=h+S*P,e[1]=u+S*D),C<1&&(t[0]=h+C*P,t[1]=u+C*D),!0}}}}}function gg(e,t){return Bi(e[0]-t[0])=0;--u)i.point((C=S[u])[0],C[1]);else r(P.x,P.p.x,-1,i);P=P.p}P=P.o,S=P.z,D=!D}while(!P.v);i.lineEnd()}}}function Kw(e){if(t=e.length){for(var t,n=0,r=e[0],i;++nt?1:e>=t?0:NaN}function bR(e){return e.length===1&&(e=xR(e)),{left:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[l],n)<0?r=l+1:i=l}return r},right:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[l],n)>0?i=l:r=l+1}return r}}}function xR(e){return function(t,n){return yI(e(t),n)}}bR(yI);function _I(e){for(var t=e.length,n,r=-1,i=0,l,h;++r=0;)for(h=e[t],n=h.length;--n>=0;)l[--i]=h[n];return l}var td=1e9,rg=-td;function wR(e,t,n,r){function i(w,S){return e<=w&&w<=n&&t<=S&&S<=r}function l(w,S,C,P){var D=0,N=0;if(w==null||(D=h(w,C))!==(N=h(S,C))||y(w,S)<0^C>0)do P.point(D===0||D===3?e:n,D>1?r:t);while((D=(D+C+4)%4)!==N);else P.point(S[0],S[1])}function h(w,S){return Bi(w[0]-e)0?0:3:Bi(w[0]-n)0?2:1:Bi(w[1]-t)0?1:0:S>0?3:2}function u(w,S){return y(w.x,S.x)}function y(w,S){var C=h(w,1),P=h(S,1);return C!==P?C-P:C===0?S[1]-w[1]:C===1?w[0]-S[0]:C===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,C=mI(),P,D,N,K,Y,J,B,G,H,at,gt,ft={point:rt,lineStart:Pt,lineEnd:Qt,polygonStart:Et,polygonEnd:$};function rt(re,fe){i(re,fe)&&S.point(re,fe)}function mt(){for(var re=0,fe=0,Wt=D.length;fer&&(An-Ce)*(r-en)>(dn-en)*(e-Ce)&&++re:dn<=r&&(An-Ce)*(r-en)<(dn-en)*(e-Ce)&&--re;return re}function Et(){S=C,P=[],D=[],gt=!0}function $(){var re=mt(),fe=gt&&re,Wt=(P=_I(P)).length;(fe||Wt)&&(w.polygonStart(),fe&&(w.lineStart(),l(null,null,1,w),w.lineEnd()),Wt&&gI(P,u,re,l,w),w.polygonEnd()),S=w,P=D=N=null}function Pt(){ft.point=Tt,D&&D.push(N=[]),at=!0,H=!1,B=G=NaN}function Qt(){P&&(Tt(K,Y),J&&H&&C.rejoin(),P.push(C.result())),ft.point=rt,H&&S.lineEnd()}function Tt(re,fe){var Wt=i(re,fe);if(D&&N.push([re,fe]),at)K=re,Y=fe,J=Wt,at=!1,Wt&&(S.lineStart(),S.point(re,fe));else if(Wt&&H)S.point(re,fe);else{var Re=[B=Math.max(rg,Math.min(td,B)),G=Math.max(rg,Math.min(td,G))],ze=[re=Math.max(rg,Math.min(td,re)),fe=Math.max(rg,Math.min(td,fe))];vR(Re,ze,e,t,n,r)?(H||(S.lineStart(),S.point(Re[0],Re[1])),S.point(ze[0],ze[1]),Wt||S.lineEnd(),gt=!1):Wt&&(S.lineStart(),S.point(re,fe),gt=!1)}B=re,G=fe,H=Wt}return ft}}var n0=ju();function SR(e,t){var n=t[0],r=t[1],i=[Ur(n),-Vr(n),0],l=0,h=0;n0.reset();for(var u=0,y=e.length;u=0?1:-1,rt=ft*gt,mt=rt>Bn,Et=N*H;if(n0.add(Cf(Et*ft*Ur(rt),K*at+Et*Vr(rt))),l+=mt?gt+ft*cl:gt,mt^P>=n^B>=n){var $=Wg(Tf(C),Tf(J));G0($);var Pt=Wg(i,$);G0(Pt);var Qt=(mt^gt>=0?-1:1)*Oc(Pt[2]);(r>Qt||r===Qt&&($[0]||$[1]))&&(h+=mt^gt>=0?1:-1)}}return(l<-gr||lCd&&(Cd=e),tZg&&(Zg=t)}ju();function vI(e,t,n,r){return function(i,l){var h=t(l),u=i.invert(r[0],r[1]),y=mI(),w=t(y),S=!1,C,P,D,N={point:K,lineStart:J,lineEnd:B,polygonStart:function(){N.point=G,N.lineStart=H,N.lineEnd=at,P=[],C=[]},polygonEnd:function(){N.point=K,N.lineStart=J,N.lineEnd=B,P=_I(P);var gt=SR(C,u);P.length?(S||(l.polygonStart(),S=!0),gI(P,CR,gt,n,l)):gt&&(S||(l.polygonStart(),S=!0),l.lineStart(),n(null,null,1,l),l.lineEnd()),S&&(l.polygonEnd(),S=!1),P=C=null},sphere:function(){l.polygonStart(),l.lineStart(),n(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function K(gt,ft){var rt=i(gt,ft);e(gt=rt[0],ft=rt[1])&&l.point(gt,ft)}function Y(gt,ft){var rt=i(gt,ft);h.point(rt[0],rt[1])}function J(){N.point=Y,h.lineStart()}function B(){N.point=K,h.lineEnd()}function G(gt,ft){D.push([gt,ft]);var rt=i(gt,ft);w.point(rt[0],rt[1])}function H(){w.lineStart(),D=[]}function at(){G(D[0][0],D[0][1]),w.lineEnd();var gt=w.clean(),ft=y.result(),rt,mt=ft.length,Et,$,Pt;if(D.pop(),C.push(D),D=null,!!mt){if(gt&1){if($=ft[0],(Et=$.length-1)>0){for(S||(l.polygonStart(),S=!0),l.lineStart(),rt=0;rt1&>&2&&ft.push(ft.pop().concat(ft.shift())),P.push(ft.filter(IR))}}return N}}function IR(e){return e.length>1}function CR(e,t){return((e=e.x)[0]<0?e[1]-el-gr:el-e[1])-((t=t.x)[0]<0?t[1]-el-gr:el-t[1])}const $w=vI(function(){return!0},TR,PR,[-Bn,-el]);function TR(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(l,h){var u=l>0?Bn:-Bn,y=Bi(l-t);Bi(y-Bn)0?el:-el),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(u,n),e.point(l,n),i=0):r!==u&&y>=Bn&&(Bi(t-r)gr?mR((Ur(t)*(l=Vr(r))*Ur(n)-Ur(r)*(i=Vr(t))*Ur(e))/(i*l*h)):(t+r)/2}function PR(e,t,n,r){var i;if(e==null)i=n*el,r.point(-Bn,i),r.point(0,i),r.point(Bn,i),r.point(Bn,0),r.point(Bn,-i),r.point(0,-i),r.point(-Bn,-i),r.point(-Bn,0),r.point(-Bn,i);else if(Bi(e[0]-t[0])>gr){var l=e[0]0,i=Bi(n)>gr;function l(S,C,P,D){_R(D,e,t,P,S,C)}function h(S,C){return Vr(S)*Vr(C)>n}function u(S){var C,P,D,N,K;return{lineStart:function(){N=D=!1,K=1},point:function(Y,J){var B=[Y,J],G,H=h(Y,J),at=r?H?0:w(Y,J):H?w(Y+(Y<0?Bn:-Bn),J):0;if(!C&&(N=D=H)&&S.lineStart(),H!==D&&(G=y(C,B),(!G||gg(C,G)||gg(B,G))&&(B[0]+=gr,B[1]+=gr,H=h(B[0],B[1]))),H!==D)K=0,H?(S.lineStart(),G=y(B,C),S.point(G[0],G[1])):(G=y(C,B),S.point(G[0],G[1]),S.lineEnd()),C=G;else if(i&&C&&r^H){var gt;!(at&P)&&(gt=y(B,C,!0))&&(K=0,r?(S.lineStart(),S.point(gt[0][0],gt[0][1]),S.point(gt[1][0],gt[1][1]),S.lineEnd()):(S.point(gt[1][0],gt[1][1]),S.lineEnd(),S.lineStart(),S.point(gt[0][0],gt[0][1])))}H&&(!C||!gg(C,B))&&S.point(B[0],B[1]),C=B,D=H,P=at},lineEnd:function(){D&&S.lineEnd(),C=null},clean:function(){return K|(N&&D)<<1}}}function y(S,C,P){var D=Tf(S),N=Tf(C),K=[1,0,0],Y=Wg(D,N),J=tg(Y,Y),B=Y[0],G=J-B*B;if(!G)return!P&&S;var H=n*J/G,at=-n*B/G,gt=Wg(K,Y),ft=eg(K,H),rt=eg(Y,at);e0(ft,rt);var mt=gt,Et=tg(ft,mt),$=tg(mt,mt),Pt=Et*Et-$*(tg(ft,ft)-1);if(!(Pt<0)){var Qt=Bf(Pt),Tt=eg(mt,(-Et-Qt)/$);if(e0(Tt,ft),Tt=U0(Tt),!P)return Tt;var re=S[0],fe=C[0],Wt=S[1],Re=C[1],ze;fe0^Tt[1]<(Bi(Tt[0]-re)Bn^(re<=Tt[0]&&Tt[0]<=fe)){var en=eg(mt,(-Et+Qt)/$);return e0(en,ft),[Tt,U0(en)]}}}function w(S,C){var P=r?e:Bn-e,D=0;return S<-P?D|=1:S>P&&(D|=2),C<-P?D|=4:C>P&&(D|=8),D}return vI(h,u,l,r?[0,-e]:[-Bn,e-Bn])}function bI(e){return function(t){var n=new j0;for(var r in e)n[r]=e[r];return n.stream=t,n}}function j0(){}j0.prototype={constructor:j0,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function xI(e,t,n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],l=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),l!=null&&e.clipExtent(null),gR(n,e.stream(Qw));var h=Qw.result(),u=Math.min(r/(h[1][0]-h[0][0]),i/(h[1][1]-h[0][1])),y=+t[0][0]+(r-u*(h[1][0]+h[0][0]))/2,w=+t[0][1]+(i-u*(h[1][1]+h[0][1]))/2;return l!=null&&e.clipExtent(l),e.scale(u*150).translate([y,w])}function AR(e,t,n){return xI(e,[[0,0],t],n)}var t2=16,kR=Vr(30*qs);function e2(e,t){return+t?RR(e,t):DR(e)}function DR(e){return bI({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function RR(e,t){function n(r,i,l,h,u,y,w,S,C,P,D,N,K,Y){var J=w-r,B=S-i,G=J*J+B*B;if(G>4*t&&K--){var H=h+P,at=u+D,gt=y+N,ft=Bf(H*H+at*at+gt*gt),rt=Oc(gt/=ft),mt=Bi(Bi(gt)-1)t||Bi((J*Qt+B*Tt)/G-.5)>.3||h*P+u*D+y*N2?Tt[2]%360*qs:0,Pt()):[w*vu,S*vu,C*vu]},mt.precision=function(Tt){return arguments.length?(gt=e2($,at=Tt*Tt),Qt()):Bf(at)},mt.fitExtent=function(Tt,re){return xI(mt,Tt,re)},mt.fitSize=function(Tt,re){return AR(mt,Tt,re)};function Pt(){D=dI(P=yR(w,S,C),t);var Tt=t(u,y);return l=r-Tt[0]*n,h=i+Tt[1]*n,Qt()}function Qt(){return ft=rt=null,mt}return function(){return t=e.apply(this,arguments),mt.invert=t.invert&&Et,Pt()}}function wI(e){return function(t,n){var r=Vr(t),i=Vr(n),l=e(r*i);return[l*i*Ur(t),l*Ur(n)]}}function SI(e){return function(t,n){var r=Bf(t*t+n*n),i=e(r),l=Ur(i),h=Vr(i);return[Cf(t*l,r*h),Oc(r&&n*l/r)]}}var FR=wI(function(e){return Bf(2/(1+e))});FR.invert=SI(function(e){return 2*Oc(e/2)});var EI=wI(function(e){return(e=pI(e))&&e/Ur(e)});EI.invert=SI(function(e){return e});function BR(){return OR(EI).scale(79.4188).clipAngle(180-.001)}function n2(e,t){return[e,t]}n2.invert=n2;function VR(e,t,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var l=[];switch(e.type){case"GeometryCollection":return BE(e,function(h){var u=yg(h,t,r,i);u&&l.push(u)}),z0(l);case"FeatureCollection":return Ow(e,function(h){var u=yg(h,t,r,i);u&&Ow(u,function(y){y&&l.push(y)})}),z0(l)}return yg(e,t,r,i)}function yg(e,t,n,r){var i=e.properties||{},l=e.type==="Feature"?e.geometry:e;if(l.type==="GeometryCollection"){var h=[];return BE(e,function(K){var Y=yg(K,t,n,r);Y&&h.push(Y)}),z0(h)}var u=UR(l),y={type:l.type,coordinates:CI(l.coordinates,u)},w=new Rv,S=w.read(y),C=X4(Y4(t,n),"meters"),P=vi.bufferOp(S,C,r),D=new YE;if(P=D.write(P),!II(P.coordinates)){var N={type:P.type,coordinates:TI(P.coordinates,u)};return sy(N,i)}}function II(e){return Array.isArray(e[0])?II(e[0]):isNaN(e[0])}function CI(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return CI(n,t)})}function TI(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return TI(n,t)})}function UR(e){var t=J4(e).geometry.coordinates,n=[-t[0],-t[1]];return BR().rotate(n).scale(zo)}function GR(e,t){var n=zg(e),r=zg(t),i=e.properties||{},l=RE.difference(n.coordinates,r.coordinates);return l.length===0?null:l.length===1?OE(l[0],i):zE(l,i)}function r2(e){let t;for(const n of e)t&&n[0]-t[0]>=180?n[0]-=360:t&&n[0]-t[0]<-180&&(n[0]+=360),t=n}function i2(e,t){const n=GR({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},e);if(!n)return;n.properties={isMask:"y"};const r=VR(e,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)r2(i);else for(const i of r.geometry.coordinates)for(const l of i)r2(l);t({type:"FeatureCollection",features:[r,n]})}let o2={type:"FeatureCollection",features:[]};function qR(e,t,n=!0,r=!0,i={},l={},h={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 u,y=[],w,S;function C(){(h!=null&&h.fill||h!=null&&h.line)&&e.addSource("full-geom",{type:"geojson",data:o2}),h!=null&&h.fill&&e.addLayer({...h==null?void 0:h.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),h!=null&&h.line&&e.addLayer({...h==null?void 0:h.line,id:"full-geom-line",type:"line",source:"full-geom"})}e.loaded()?C():e.once("load",()=>{C()});const P=N=>{u==null||u({type:"mapClick",coordinates:[N.lngLat.lng,N.lngLat.lat]})};function D(N=!1){if(!t)throw new Error;const K=document.createElement("div");return N&&K.classList.add("marker-interactive"),new _4({props:{displayIn:"maplibre"},target:K}),new t.Marker({element:K,offset:[1,-13]})}return{setEventHandler(N){N?(u=N,e.on("click",P)):(u=void 0,e.off("click",P))},flyTo(N,K){e.flyTo({center:N,zoom:K,...i})},fitBounds(N,K,Y){e.fitBounds([[N[0],N[1]],[N[2],N[3]]],{padding:K,maxZoom:Y,...l})},indicateReverse(N){e.getCanvasContainer().style.cursor=N?"crosshair":""},setReverseMarker(N){!t||!n||(S?N?S.setLngLat(N):(S.remove(),S=void 0):N&&(S=(typeof n=="object"?new t.Marker(n):D()).setLngLat(N).addTo(e),S.getElement().classList.add("marker-reverse")))},setMarkers(N,K){if(!n)return;function Y(J){var B;(B=e.getSource("full-geom"))==null||B.setData(J)}for(const J of y)J.remove();if(y.length=0,Y(o2),!!t){if(K){let J=!1;if(K.geometry.type==="GeometryCollection"){const B=K.geometry.geometries.filter(G=>G.type==="Polygon"||G.type==="MultiPolygon");if(B.length>0){let G=B.pop();for(const H of B)G=K4(G,H);i2({...K,geometry:G},Y),J=!0}else{const G=K.geometry.geometries.filter(H=>H.type==="LineString"||H.type==="MultiLineString");G.length>0&&(Y({...K,geometry:{type:"GeometryCollection",geometries:G}}),J=!0)}}if(!J){if(K.geometry.type==="Polygon"||K.geometry.type==="MultiPolygon")i2(K,Y);else if(K.geometry.type==="LineString"||K.geometry.type==="MultiLineString"){Y(K);return}}n&&y.push((typeof n=="object"?new t.Marker(n):D()).setLngLat(K.center).addTo(e))}if(r)for(const J of N??[]){if(J===K)continue;const B=(typeof r=="object"?new t.Marker(r):D(!0)).setLngLat(J.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(J.place_type[0]==="reverse"?J.place_name:J.place_name.replace(/,.*/,""))).addTo(e),G=B.getElement();G.addEventListener("click",H=>{H.stopPropagation(),u==null||u({type:"markerClick",id:J.id})}),G.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:J.id}),B.togglePopup()}),G.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:J.id}),B.togglePopup()}),y.push(B)}}},setSelectedMarker(N){w&&w.getElement().classList.toggle("marker-selected",!1),w=N>-1?y[N]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const N=e.getCenter();return[e.getZoom(),N.lng,N.lat]}}}function jR(e){let t,n;return{c(){t=Vl("svg"),n=Vl("path"),Vt(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"),Vt(t,"viewBox","0 0 14 14"),Vt(t,"width","13"),Vt(t,"height","13"),Vt(t,"class","svelte-en2qvf")},m(r,i){zt(r,t,i),Xt(t,n)},p:Ae,i:Ae,o:Ae,d(r){r&&Nt(t)}}}class LI extends an{constructor(t){super(),sn(this,t,null,jR,Xe,{})}}function WR(e){let t,n;return{c(){t=Vl("svg"),n=Vl("path"),Vt(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"),Vt(t,"viewBox","0 0 30 30"),Vt(t,"fill","none"),Vt(t,"xmlns","http://www.w3.org/2000/svg"),Vt(t,"class","svelte-d2loi5")},m(r,i){zt(r,t,i),Xt(t,n)},p:Ae,i:Ae,o:Ae,d(r){r&&Nt(t)}}}class PI extends an{constructor(t){super(),sn(this,t,null,WR,Xe,{})}}function HR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"area.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"area.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function ZR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"reverse.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"reverse.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function XR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"poi.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"poi.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function YR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"postal_code.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"postal_code.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function KR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"street.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"street.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function JR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"road.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"road.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function QR(e){let t,n;return{c(){t=qt("img"),xo(t.src,n=e[3]+"housenumber.svg")||Vt(t,"src",n),Vt(t,"alt",e[6]),Vt(t,"class","svelte-ltkwvy")},m(r,i){zt(r,t,i)},p(r,i){i&8&&!xo(t.src,n=r[3]+"housenumber.svg")&&Vt(t,"src",n),i&64&&Vt(t,"alt",r[6])},d(r){r&&Nt(t)}}}function $R(e){let t,n,r,i;return{c(){t=qt("img"),xo(t.src,n=e[5])||Vt(t,"src",n),Vt(t,"alt",e[4]),Vt(t,"class","svelte-ltkwvy")},m(l,h){zt(l,t,h),r||(i=un(t,"error",e[14]),r=!0)},p(l,h){h&32&&!xo(t.src,n=l[5])&&Vt(t,"src",n),h&16&&Vt(t,"alt",l[4])},d(l){l&&Nt(t),r=!1,i()}}}function s2(e){let t,n;return{c(){t=qt("span"),n=yn(e[6]),Vt(t,"class","secondary svelte-ltkwvy")},m(r,i){zt(r,t,i),Xt(t,n)},p(r,i){i&64&&Ui(n,r[6])},d(r){r&&Nt(t)}}}function tN(e){var ft,rt;let t,n,r,i,l,h,u,y,w=(e[7]?e[0].place_name:e[0].place_name.replace(/,.*/,""))+"",S,C,P=e[2]==="always"||e[2]&&!e[0].address&&((ft=e[0].properties)==null?void 0:ft.kind)!=="road"&&((rt=e[0].properties)==null?void 0:rt.kind)!=="road_relation"&&!e[0].id.startsWith("address.")&&!e[0].id.startsWith("postal_code.")&&(!e[0].id.startsWith("poi.")||!e[5])&&!e[7],D,N,K=(e[7]?"":e[0].place_name.replace(/[^,]*,?\s*/,""))+"",Y,J,B;function G(mt,Et){var $,Pt;return Et&1&&(n=null),Et&1&&(r=null),Et&1&&(i=null),mt[5]?$R:mt[0].address?QR:(($=mt[0].properties)==null?void 0:$.kind)==="road"||((Pt=mt[0].properties)==null?void 0:Pt.kind)==="road_relation"?JR:(n==null&&(n=!!mt[0].id.startsWith("address.")),n?KR:(r==null&&(r=!!mt[0].id.startsWith("postal_code.")),r?YR:(i==null&&(i=!!mt[0].id.startsWith("poi.")),i?XR:mt[7]?ZR:HR)))}let H=G(e,-1),at=H(e),gt=P&&s2(e);return{c(){t=qt("li"),at.c(),l=ye(),h=qt("span"),u=qt("span"),y=qt("span"),S=yn(w),C=ye(),gt&>.c(),D=ye(),N=qt("span"),Y=yn(K),Vt(y,"class","primary svelte-ltkwvy"),Vt(u,"class","svelte-ltkwvy"),Vt(N,"class","line2 svelte-ltkwvy"),Vt(h,"class","texts svelte-ltkwvy"),Vt(t,"tabindex","0"),Vt(t,"data-selected",e[1]),Vt(t,"class","svelte-ltkwvy"),tl(t,"selected",e[1])},m(mt,Et){zt(mt,t,Et),at.m(t,null),Xt(t,l),Xt(t,h),Xt(h,u),Xt(u,y),Xt(y,S),Xt(u,C),gt&>.m(u,null),Xt(h,D),Xt(h,N),Xt(N,Y),J||(B=[un(t,"mouseenter",e[12]),un(t,"focus",e[13])],J=!0)},p(mt,[Et]){var $,Pt;H===(H=G(mt,Et))&&at?at.p(mt,Et):(at.d(1),at=H(mt),at&&(at.c(),at.m(t,l))),Et&1&&w!==(w=(mt[7]?mt[0].place_name:mt[0].place_name.replace(/,.*/,""))+"")&&Ui(S,w),Et&37&&(P=mt[2]==="always"||mt[2]&&!mt[0].address&&(($=mt[0].properties)==null?void 0:$.kind)!=="road"&&((Pt=mt[0].properties)==null?void 0:Pt.kind)!=="road_relation"&&!mt[0].id.startsWith("address.")&&!mt[0].id.startsWith("postal_code.")&&(!mt[0].id.startsWith("poi.")||!mt[5])&&!mt[7]),P?gt?gt.p(mt,Et):(gt=s2(mt),gt.c(),gt.m(u,null)):gt&&(gt.d(1),gt=null),Et&1&&K!==(K=(mt[7]?"":mt[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Ui(Y,K),Et&2&&Vt(t,"data-selected",mt[1]),Et&2&&tl(t,"selected",mt[1])},i:Ae,o:Ae,d(mt){mt&&Nt(t),at.d(),gt&>.d(),J=!1,oo(B)}}}function eN(e,t,n){var G;let r,i,{feature:l}=t,{selected:h=!1}=t,{showPlaceType:u}=t,{missingIconsCache:y}=t,{iconsBaseUrl:w}=t;const S=(G=l.properties)==null?void 0:G.categories;let C,P,D=0,N=l.place_type[0]==="reverse";function K(H){P&&y.add(P),n(10,D++,D)}function Y(H){Nn.call(this,e,H)}function J(H){Nn.call(this,e,H)}const B=H=>K(H.currentTarget);return e.$$set=H=>{"feature"in H&&n(0,l=H.feature),"selected"in H&&n(1,h=H.selected),"showPlaceType"in H&&n(2,u=H.showPlaceType),"missingIconsCache"in H&&n(9,y=H.missingIconsCache),"iconsBaseUrl"in H&&n(3,w=H.iconsBaseUrl)},e.$$.update=()=>{var H,at,gt,ft;if(e.$$.dirty&3640)do n(11,r--,r),n(4,C=S==null?void 0:S[r]),n(5,P=C?w+C.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!P||y.has(P)));e.$$.dirty&1&&n(6,i=l.id.startsWith("poi.")?(at=(H=l.properties)==null?void 0:H.categories)==null?void 0:at.join(", "):((ft=(gt=l.properties)==null?void 0:gt.place_type_name)==null?void 0:ft[0])??l.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[l,h,u,w,C,P,i,N,K,y,D,r,Y,J,B]}class nN extends an{constructor(t){super(),sn(this,t,eN,tN,Xe,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function rN(e){let t;return{c(){t=qt("div"),t.innerHTML='',Vt(t,"class","svelte-7cmwmc")},m(n,r){zt(n,t,r)},p:Ae,i:Ae,o:Ae,d(n){n&&Nt(t)}}}class iN extends an{constructor(t){super(),sn(this,t,null,rN,Xe,{})}}function oN(e){let t,n;return{c(){t=Vl("svg"),n=Vl("path"),Vt(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"),Vt(t,"viewBox","0 0 60.006 21.412"),Vt(t,"width","14"),Vt(t,"height","20"),Vt(t,"class","svelte-en2qvf")},m(r,i){zt(r,t,i),Xt(t,n)},p:Ae,i:Ae,o:Ae,d(r){r&&Nt(t)}}}class sN extends an{constructor(t){super(),sn(this,t,null,oN,Xe,{})}}function aN(e){let t,n,r;return{c(){t=Vl("svg"),n=Vl("circle"),r=Vl("path"),Vt(n,"cx","4.789"),Vt(n,"cy","4.787"),Vt(n,"r","3.85"),Gr(n,"stroke-width","1.875"),Gr(n,"fill","none"),Vt(r,"d","M12.063 12.063 7.635 7.635"),Gr(r,"stroke-width","1.875"),Gr(r,"stroke-linecap","round"),Vt(t,"xmlns","http://www.w3.org/2000/svg"),Vt(t,"width","13"),Vt(t,"height","13"),Vt(t,"viewBox","0 0 13 13"),Vt(t,"class","svelte-1bpbt60")},m(i,l){zt(i,t,l),Xt(t,n),Xt(t,r)},p:Ae,i:Ae,o:Ae,d(i){i&&Nt(t)}}}class lN extends an{constructor(t){super(),sn(this,t,null,aN,Xe,{})}}function uN(e,t,n){const r=t[1],i=t[0],l=r-i;return e===r&&n?e:((e-i)%l+l)%l+i}function a2(e){const t=[...e];return t[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Hp.coords)break t;return Hp.coords}let l;try{return l=await new Promise((h,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(y=>{h([y.coords.longitude,y.coords.latitude].map(w=>w.toFixed(6)).join(","))},y=>{u(y)},i)}),l}catch{}finally{i.cachedLocationExpiry&&(Hp={time:Date.now(),coords:l})}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 l2=/(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,u2=/(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,c2=/(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,h2=/(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 hN(e){if(!["DMS","DM","DD"].includes(e))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(e=="DD")return this.decimalCoordinates;const t=this.decimalCoordinates.split(",").map(h=>Number(h.trim()));let n=f2(t[0],e),r=f2(t[1],e);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=t[0]>=0?" N":" S",l=t[1]>=0?" E":" W";return`${n+i}, ${r+l}`}else throw new Error("no decimal coordinates to convert")}function f2(e,t){const n=Math.abs(e),r=Math.floor(n),i=(n-r)*60;if(t=="DM"){let u=fN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${u}'`}let l=Math.floor(i),h=((i-l)*60).toFixed(1).padStart(4,"0");return l=l.toString().padStart(2,"0"),`${r}° ${l}' ${h}"`}function fN(e,t){const n=Math.pow(10,t);return Math.round((e+Number.EPSILON)*n)/n}function qv(e,t){t||(t=5),e=e.replace(/\s+/g," ").trim();let n=null,r=null,i="",l="",h=[],u=!1;if(l2.test(e))if(h=l2.exec(e),u=ig(h),u){if(n=h[2],r=h[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");h[1]?(i=h[1],l=h[5]):h[4]&&(i=h[4],l=h[8])}else throw new Error("invalid decimal coordinate format");else if(u2.test(e))if(h=u2.exec(e),u=ig(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6].replace(",",".")/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[9])),h[11]&&(r+=h[11]/60),h[13]&&(r+=h[13].replace(",",".")/3600),parseInt(h[9])<0&&(r=-1*r),h[1]?(i=h[1],l=h[8]):h[7]&&(i=h[7],l=h[14]);else throw new Error("invalid DMS coordinates format");else if(c2.test(e))if(h=c2.exec(e),u=ig(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],l=h[9]):h[8]&&(i=h[8],l=h[16]);else throw new Error("invalid DMS coordinates format");else if(h2.test(e))if(h=h2.exec(e),u=ig(h),u)n=Math.abs(parseInt(h[2])),h[4]&&(n+=h[4]/60),h[6]&&(n+=h[6]/3600),parseInt(h[2])<0&&(n=-1*n),r=Math.abs(parseInt(h[10])),h[12]&&(r+=h[12]/60),h[14]&&(r+=h[14]/3600),parseInt(h[10])<0&&(r=-1*r),h[1]?(i=h[1],l=h[9]):h[8]&&(i=h[8],l=h[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||l)&&(!i||!l))throw new Error("invalid coordinates format");if(i&&i==l)throw new Error("invalid coordinates format");let y=/S|SOUTH/i;y.test(i)&&n>0&&(n=-1*n),y=/W|WEST/i,y.test(l)&&r>0&&(r=-1*r);const w=h[0].trim();let S,C;const P=/[,/;\u0020]/g,D=w.match(P);if(D==null){const Y=Math.floor(e.length/2);S=w.substring(0,Y).trim(),C=w.substring(Y).trim()}else{let Y;D.length%2==1?Y=Math.floor(D.length/2):Y=D.length/2-1;let J=0;if(Y==0)J=w.indexOf(D[0]),S=w.substring(0,J).trim(),C=w.substring(J+1).trim();else{let B=0,G=0;for(;B<=Y;)J=w.indexOf(D[B],G),G=J+1,B++;S=w.substring(0,J).trim(),C=w.substring(J+1).trim()}}const N=S.split(".");if(N.length==2&&N[1]==0&&N[1].length!=2)throw new Error("invalid coordinates format");const K=C.split(".");if(K.length==2&&K[1]==0&&K[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(C))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(t)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(t)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:C,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:pN,toCoordinateFormat:hN})}else throw new Error("coordinates pattern match failed")}function ig(e){if(!isNaN(e[0]))return!1;const t=[...e];if(t.shift(),t.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=t.length/2;for(let l=0;l{t.decimalLatitude?e.push(t):e.push({...t,...gN})}),[...e,...yN,..._N]}const bN=vN();qv.formats=bN.map(e=>e.verbatimCoordinates);const xN=qv;function d2(e,t,n){const r=e.slice();return r[81]=t[n],r[83]=n,r}function m2(e){let t,n;return t=new iN({}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function g2(e){let t,n,r,i,l;return n=new sN({}),{c(){t=qt("button"),Ie(n.$$.fragment),Vt(t,"type","button"),Vt(t,"title",e[9]),Vt(t,"class","svelte-zh3kmv"),tl(t,"active",e[0])},m(h,u){zt(h,t,u),we(n,t,null),r=!0,i||(l=un(t,"click",e[67]),i=!0)},p(h,u){(!r||u[0]&512)&&Vt(t,"title",h[9]),(!r||u[0]&1)&&tl(t,"active",h[0])},i(h){r||(Dt(n.$$.fragment,h),r=!0)},o(h){jt(n.$$.fragment,h),r=!1},d(h){h&&Nt(t),Se(n),i=!1,l()}}}function wN(e){let t,n=[],r=new Map,i,l,h,u=vo(e[14]);const y=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{ft=null}),lr()),(!G||re[0]&2)&&tl(w,"displayable",Tt[1]!==""),Tt[5]===!0?rt?(rt.p(Tt,re),re[0]&32&&Dt(rt,1)):(rt=g2(Tt),rt.c(),Dt(rt,1),rt.m(r,N)):rt&&(ar(),jt(rt,1,1,()=>{rt=null}),lr()),Et&&Et.p&&(!G||re[1]&134217728)&&ci(Et,mt,Tt,Tt[58],G?ui(mt,Tt[58],re,null):hi(Tt[58]),null);let fe=Y;Y=Qt(Tt),Y===fe?~Y&&Pt[Y].p(Tt,re):(J&&(ar(),jt(Pt[fe],1,1,()=>{Pt[fe]=null}),lr()),~Y?(J=Pt[Y],J?J.p(Tt,re):(J=Pt[Y]=$[Y](Tt),J.c()),Dt(J,1),J.m(n,null)):J=null),(!G||re[0]&4&&B!==(B=_g(Tt[2])+" svelte-zh3kmv"))&&Vt(n,"class",B),(!G||re[0]&22)&&tl(n,"can-collapse",Tt[4]&&Tt[1]==="")},i(Tt){G||(Dt(gt),Dt(l.$$.fragment,Tt),Dt(C.$$.fragment,Tt),Dt(ft),Dt(rt),Dt(Et,Tt),Dt(J),G=!0)},o(Tt){jt(gt),jt(l.$$.fragment,Tt),jt(C.$$.fragment,Tt),jt(ft),jt(rt),jt(Et,Tt),jt(J),G=!1},d(Tt){Tt&&(Nt(t),Nt(n)),Se(l),e[61](null),Se(C),ft&&ft.d(),rt&&rt.d(),Et&&Et.d(Tt),~Y&&Pt[Y].d(),H=!1,oo(at)}}}function TN(e,t,n){let r,{$$slots:i={},$$scope:l}=t,{class:h=void 0}=t,{apiKey:u}=t,{bbox:y=void 0}=t,{clearButtonTitle:w="clear"}=t,{clearOnBlur:S=!1}=t,{collapsed:C=!1}=t,{country:P=void 0}=t,{debounceSearch:D=200}=t,{enableReverse:N=!1}=t,{errorMessage:K="Something went wrong…"}=t,{filter:Y=()=>!0}=t,{flyTo:J=!0}=t,{fuzzyMatch:B=!0}=t,{language:G=void 0}=t,{limit:H=void 0}=t,{mapController:at=void 0}=t,{minLength:gt=2}=t,{noResultsMessage:ft="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=t,{placeholder:rt="Search"}=t,{proximity:mt=[{type:"server-geolocation"}]}=t,{reverseActive:Et=N==="always"}=t,{reverseButtonTitle:$="toggle reverse geocoding"}=t,{searchValue:Pt=""}=t,{showFullGeometry:Qt=!0}=t,{showPlaceType:Tt="ifNeeded"}=t,{showResultsWhileTyping:re=!0}=t,{selectFirst:fe=!0}=t,{flyToSelected:Wt=!1}=t,{markerOnSelected:Re=!0}=t,{types:ze=void 0}=t,{excludeTypes:We=!1}=t,{zoom:Ue=16}=t,{maxZoom:Ce=18}=t,{apiUrl:en="https://api.maptiler.com/geocoding"}=t,{fetchParameters:An={}}=t,{iconsBaseUrl:dn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=t,{adjustUrlQuery:cn=Q=>{}}=t;function kn(){Mt.focus()}function Yn(){Mt.blur()}function Wr(Q,bt=!0){n(1,Pt=Q),bt?(n(15,He=-1),gl()):(Hr(),setTimeout(()=>{Mt.focus(),Mt.select()}))}function hr(){n(14,nt=void 0),n(55,ce=void 0),n(15,He=-1)}function er(){n(54,xt=[]),n(55,ce=void 0)}let Kn=!1,nt,xt,ce,mn="",Mt,He=-1,Tr,on=[],Hn,To,ls,ks;const Ra=new Set,Ii=Vu();ws(()=>{at&&(at.setEventHandler(void 0),at.indicateReverse(!1),at.setSelectedMarker(-1),at.setMarkers(void 0,void 0))});function gl(Q){if(To&&(clearTimeout(To),To=void 0),He>-1&&nt)n(55,ce=nt[He]),n(1,Pt=ce.place_type[0]==="reverse"?ce.place_name:ce.place_name.replace(/,.*/,"")),n(18,Tr=void 0),n(54,xt=void 0),n(15,He=-1);else if(Pt){const bt=Q||!us(Pt);te(Pt,{exact:!0}).then(()=>{n(54,xt=nt),n(55,ce=void 0),bt&&Ho()}).catch(dt=>n(18,Tr=dt))}}function us(Q){try{return xN(Q,6)}catch{return!1}}async function te(Q,{byId:bt=!1,exact:dt=!1}={}){n(18,Tr=void 0),Hn==null||Hn.abort();const It=new AbortController;n(19,Hn=It);try{const Ot=us(Q),Ut=new URLSearchParams;if(G!==void 0&&Ut.set("language",Array.isArray(G)?G.join(","):G??""),ze&&Ut.set("types",ze.join(",")),We&&Ut.set("excludeTypes",String(We)),y&&Ut.set("bbox",y.map(Ge=>Ge.toFixed(6)).join(",")),P&&Ut.set("country",Array.isArray(P)?P.join(","):P),!bt&&!Ot){const Ge=await cN(at,mt,It);Ge&&Ut.set("proximity",Ge),(dt||!re)&&Ut.set("autocomplete","false"),Ut.set("fuzzyMatch",String(B))}H!==void 0&&(!Ot||(ze==null?void 0:ze.length)===1)&&Ut.set("limit",String(H)),Ut.set("key",u),cn(Ut);const Ht=en+"/"+encodeURIComponent(Ot?Ot.decimalLongitude+","+Ot.decimalLatitude:Q)+".json?"+Ut.toString();if(Ht===mn){bt?(n(14,nt=void 0),n(55,ce=on[0])):n(14,nt=on);return}mn=Ht;const xe=await fetch(Ht,{signal:It.signal,...An});if(!xe.ok)throw new Error(await xe.text());const Le=await xe.json();Ii("response",{url:Ht,featureCollection:Le}),bt?(n(14,nt=void 0),n(55,ce=Le.features[0]),on=[ce]):(n(14,nt=Le.features.filter(Y)),Ot&&nt.unshift({type:"Feature",properties:{},id:"reverse_"+Ot.decimalLongitude+"_"+Ot.decimalLatitude,text:Ot.decimalLatitude+", "+Ot.decimalLongitude,place_name:Ot.decimalLatitude+", "+Ot.decimalLongitude,place_type:["reverse"],center:[Ot.decimalLongitude,Ot.decimalLatitude],bbox:[Ot.decimalLongitude,Ot.decimalLatitude,Ot.decimalLongitude,Ot.decimalLatitude],geometry:{type:"Point",coordinates:[Ot.decimalLongitude,Ot.decimalLatitude]}}),on=nt,Ot&&Mt.focus())}catch(Ot){if(Ot&&typeof Ot=="object"&&"name"in Ot&&Ot.name==="AbortError")return;throw Ot}finally{It===Hn&&n(19,Hn=void 0)}}function Ho(){var dt;if(!(xt!=null&&xt.length)||!J)return;const Q=[180,90,-180,-90],bt=!xt.some(It=>!It.matching_text);for(const It of xt)if(bt||!It.matching_text)for(const Ot of[0,1,2,3])Q[Ot]=Math[Ot<2?"min":"max"](Q[Ot],((dt=It.bbox)==null?void 0:dt[Ot])??It.center[Ot%2]);at&&xt.length>0&&(ce&&Q[0]===Q[2]&&Q[1]===Q[3]?at.flyTo(ce.center,Ue):at.fitBounds(a2(Q),50,Ce))}function Hi(Q){n(0,Et=N==="always"),n(14,nt=void 0),n(55,ce=void 0),n(15,He=-1),Wr(Q[1].toFixed(6)+", "+uN(Q[0],[-180,180],!0).toFixed(6),!1)}function yl(Q){if(!nt)return;let bt=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;bt&&(He===(fe?0:-1)&&bt===-1&&n(15,He=nt.length),n(15,He+=bt),He>=nt.length&&n(15,He=-1),He<0&&fe&&n(15,He=0),Q.preventDefault())}function Hr(Q=!0){if(n(18,Tr=void 0),re){if(To&&clearTimeout(To),Pt.length{te(bt).catch(dt=>n(18,Tr=dt))},Q?D:0)}else n(14,nt=void 0),n(18,Tr=void 0)}function oe(Q){n(55,ce=Q),n(1,Pt=Q.place_name),n(15,He=-1)}const Je=()=>Mt.focus();function Ye(Q){fi[Q?"unshift":"push"](()=>{Mt=Q,n(17,Mt)})}function Lr(){Pt=this.value,n(1,Pt),n(13,Kn),n(27,S)}const Zo=()=>n(13,Kn=!0),Ze=()=>n(13,Kn=!1),ha=()=>Hr(),Rr=()=>{n(1,Pt=""),Mt.focus()},ut=()=>n(0,Et=!Et),V=()=>n(18,Tr=void 0),q=Q=>n(15,He=Q),X=Q=>oe(Q),it=()=>{fe||n(15,He=-1)},vt=()=>{};return e.$$set=Q=>{"class"in Q&&n(2,h=Q.class),"apiKey"in Q&&n(25,u=Q.apiKey),"bbox"in Q&&n(26,y=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,C=Q.collapsed),"country"in Q&&n(28,P=Q.country),"debounceSearch"in Q&&n(29,D=Q.debounceSearch),"enableReverse"in Q&&n(5,N=Q.enableReverse),"errorMessage"in Q&&n(6,K=Q.errorMessage),"filter"in Q&&n(30,Y=Q.filter),"flyTo"in Q&&n(31,J=Q.flyTo),"fuzzyMatch"in Q&&n(32,B=Q.fuzzyMatch),"language"in Q&&n(33,G=Q.language),"limit"in Q&&n(34,H=Q.limit),"mapController"in Q&&n(35,at=Q.mapController),"minLength"in Q&&n(36,gt=Q.minLength),"noResultsMessage"in Q&&n(7,ft=Q.noResultsMessage),"placeholder"in Q&&n(8,rt=Q.placeholder),"proximity"in Q&&n(37,mt=Q.proximity),"reverseActive"in Q&&n(0,Et=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,$=Q.reverseButtonTitle),"searchValue"in Q&&n(1,Pt=Q.searchValue),"showFullGeometry"in Q&&n(38,Qt=Q.showFullGeometry),"showPlaceType"in Q&&n(10,Tt=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,re=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,fe=Q.selectFirst),"flyToSelected"in Q&&n(40,Wt=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Re=Q.markerOnSelected),"types"in Q&&n(42,ze=Q.types),"excludeTypes"in Q&&n(43,We=Q.excludeTypes),"zoom"in Q&&n(44,Ue=Q.zoom),"maxZoom"in Q&&n(45,Ce=Q.maxZoom),"apiUrl"in Q&&n(46,en=Q.apiUrl),"fetchParameters"in Q&&n(47,An=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,dn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,cn=Q.adjustUrlQuery),"$$scope"in Q&&n(58,l=Q.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,ls=Kn),S&&!Kn&&n(1,Pt="")}),e.$$.dirty[0]&16386|e.$$.dirty[1]&32&&Pt.lengthn(18,Tr=Q)),e.$$.dirty[1]&50356241&&(at&&ce&&ce.id!==ks&&J&&(!ce.bbox||ce.bbox[0]===ce.bbox[2]&&ce.bbox[1]===ce.bbox[3]?at.flyTo(ce.center,ce.id.startsWith("poi.")||ce.id.startsWith("address.")?Ce:Ue):at.fitBounds(a2(ce.bbox),50,Ce),n(14,nt=void 0),n(54,xt=void 0),n(15,He=-1)),n(56,ks=ce==null?void 0:ce.id)),e.$$.dirty[0]&18432&&fe&&nt!=null&&nt.length&&n(15,He=0),e.$$.dirty[0]&2050&&(fe||n(15,He=-1)),e.$$.dirty[0]&16384|e.$$.dirty[1]&8388608&&xt!==nt&&n(54,xt=void 0),e.$$.dirty[0]&81921|e.$$.dirty[1]&8388624&&at&&at.setEventHandler(Q=>{switch(Q.type){case"mapClick":Et&&Hi(Q.coordinates);break;case"markerClick":{const bt=nt==null?void 0:nt.find(dt=>dt.id===Q.id);bt&&oe(bt)}break;case"markerMouseEnter":xt&&n(15,He=ls?(nt==null?void 0:nt.findIndex(bt=>bt.id===Q.id))??-1:-1);break;case"markerMouseLeave":xt&&n(15,He=-1);break}}),e.$$.dirty[0]&49152&&n(57,r=nt==null?void 0:nt[He]),e.$$.dirty[1]&67133969&&at&&r&&J&&Wt&&at.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Ce:Ue),e.$$.dirty[1]&1040&&(Re||at==null||at.setMarkers(void 0,void 0)),e.$$.dirty[1]&75498512&&at&&Re&&!xt&&(at.setMarkers(r?[r]:void 0,void 0),at.setSelectedMarker(r?0:-1)),e.$$.dirty[1]&25165840&&at&&at.setMarkers(xt,ce),e.$$.dirty[0]&32768|e.$$.dirty[1]&8388624&&xt&&at&&at.setSelectedMarker(He),e.$$.dirty[0]&2|e.$$.dirty[1]&16&&at){const Q=us(Pt);at.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}e.$$.dirty[1]&67108864&&Ii("select",r),e.$$.dirty[1]&16777216&&Ii("pick",ce),e.$$.dirty[0]&81920&&Ii("optionsVisibilityChange",ls&&!!nt),e.$$.dirty[0]&16384&&Ii("featuresListed",nt),e.$$.dirty[1]&8388608&&Ii("featuresMarked",xt),e.$$.dirty[0]&1&&Ii("reverseToggle",Et),e.$$.dirty[0]&2&&Ii("queryChange",Pt),e.$$.dirty[0]&1|e.$$.dirty[1]&16&&at&&at.indicateReverse(Et)},[Et,Pt,h,w,C,N,K,ft,rt,$,Tt,fe,dn,Kn,nt,He,ls,Mt,Tr,Hn,Ra,gl,yl,Hr,oe,u,y,S,P,D,Y,J,B,G,H,at,gt,mt,Qt,re,Wt,Re,ze,We,Ue,Ce,en,An,cn,kn,Yn,Wr,hr,er,xt,ce,ks,r,l,i,Je,Ye,Lr,Zo,Ze,ha,Rr,ut,V,q,X,it,vt]}class LN extends an{constructor(t){super(),sn(this,t,TN,CN,Xe,{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 _2(e){let t,n,r;return n=new LN({props:{mapController:e[1],apiKey:e[0]}}),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"class","svelte-ixhnie")},m(i,l){zt(i,t,l),we(n,t,null),r=!0},p(i,l){const h={};l&2&&(h.mapController=i[1]),l&1&&(h.apiKey=i[0]),n.$set(h)},i(i){r||(Dt(n.$$.fragment,i),r=!0)},o(i){jt(n.$$.fragment,i),r=!1},d(i){i&&Nt(t),Se(n)}}}function PN(e){let t,n,r=e[1]&&_2(e);return{c(){r&&r.c(),t=so()},m(i,l){r&&r.m(i,l),zt(i,t,l),n=!0},p(i,[l]){i[1]?r?(r.p(i,l),l&2&&Dt(r,1)):(r=_2(i),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function MN(e,t,n){let r,{apiKey:i}=t,{map:l}=t;return e.$$set=h=>{"apiKey"in h&&n(0,i=h.apiKey),"map"in h&&n(2,l=h.map)},e.$$.update=()=>{e.$$.dirty&4&&n(1,r=l?qR(l,vs):null)},[i,r,l]}class AN extends an{constructor(t){super(),sn(this,t,MN,PN,Xe,{apiKey:0,map:2})}}const kN=Symbol.for("svelte-maplibre");function DN(){return $0(kN)}function RN(e){return"layerType"in e&&e.layerType==="deckgl"}const NN=e=>({features:e[0]&16,data:e[0]&16,map:e[0]&4,close:e[0]&1}),v2=e=>{var t;return{features:e[4],data:(t=e[4])==null?void 0:t[0],map:e[2],close:e[31]}};function b2(e){let t,n,r=(e[4]||e[3]instanceof vs.Marker)&&x2(e);return{c(){t=qt("div"),r&&r.c()},m(i,l){zt(i,t,l),r&&r.m(t,null),e[32](t),n=!0},p(i,l){i[4]||i[3]instanceof vs.Marker?r?(r.p(i,l),l[0]&24&&Dt(r,1)):(r=x2(i),r.c(),Dt(r,1),r.m(t,null)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(),e[32](null)}}}function x2(e){let t;const n=e[30].default,r=li(n,e,e[29],v2);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l[0]&536870933)&&ci(r,n,i,i[29],t?ui(n,i[29],l,NN):hi(i[29]),v2)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function ON(e){let t,n,r=e[9].default&&b2(e);return{c(){r&&r.c(),t=so()},m(i,l){r&&r.m(i,l),zt(i,t,l),n=!0},p(i,l){i[9].default?r?(r.p(i,l),l[0]&512&&Dt(r,1)):(r=b2(i),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function zN(e,t,n){let r,i,l,h,u,y,{$$slots:w={},$$scope:S}=t;const C=WT(w);let{closeButton:P=void 0}=t,{closeOnClickOutside:D=!0}=t,{closeOnClickInside:N=!1}=t,{closeOnMove:K=!1}=t,{openOn:Y="click"}=t,{openIfTopMost:J=!0}=t,{focusAfterOpen:B=!0}=t,{anchor:G=void 0}=t,{offset:H=void 0}=t,{popupClass:at=void 0}=t,{maxWidth:gt=void 0}=t,{lngLat:ft=void 0}=t,{html:rt=void 0}=t,{open:mt=!1}=t;const Et=Vu(),{map:$,popupTarget:Pt,layerEvent:Qt,layer:Tt,eventTopMost:re}=DN();Ve(e,$,xt=>n(2,l=xt)),Ve(e,Pt,xt=>n(3,u=xt)),Ve(e,Qt,xt=>n(28,h=xt)),Ve(e,Tt,xt=>n(35,y=xt));const fe=["click","dblclick","contextmenu"];let Wt,Re=!1,ze;function We(){if(!Wt)return;let xt=Wt.getElement();!xt||xt===ze||(ze=xt,Y==="hover"&&(ze.style.pointerEvents="none"),ze.addEventListener("mouseenter",()=>{n(24,Re=!0)},{passive:!0}),ze.addEventListener("mouseleave",()=>{n(24,Re=!1)},{passive:!0}),ze.addEventListener("click",()=>{N&&n(0,mt=!1)},{passive:!0}))}J0(()=>{if(l)return l.on("click",hr),l.on("contextmenu",hr),typeof u=="string"&&(l.on("click",u,An),l.on("dblclick",u,An),l.on("contextmenu",u,An),l.on("mousemove",u,Wr),l.on("mouseleave",u,Yn),l.on("touchstart",u,cn),l.on("touchend",u,kn)),()=>{l!=null&&l.loaded()&&(Wt==null||Wt.remove(),l.off("click",hr),l.off("contextmenu",hr),u instanceof vs.Marker?u.getPopup()===Wt&&u.setPopup(void 0):typeof u=="string"&&(l.off("click",u,An),l.off("dblclick",u,An),l.off("contextmenu",u,An),l.off("mousemove",u,Wr),l.off("mouseleave",u,Yn),l.off("touchstart",u,cn),l.off("touchend",u,kn)))}});function Ue(xt){return J?!("marker"in xt)&&!RN(xt)&&re(xt)!==y:!1}let Ce=null,en="normal";function An(xt){xt.type===Y&&(Ue(xt)||("layerType"in xt?xt.layerType==="deckgl"?(n(10,ft=xt.coordinate),n(4,Ce=xt.object?[xt.object]:null)):(n(10,ft=xt.lngLat),n(4,Ce=xt.features??[])):(n(10,ft=xt.lngLat),n(4,Ce=xt.features??[])),setTimeout(()=>n(0,mt=!0))))}let dn=null;function cn(xt){dn=xt.point}function kn(xt){if(!dn||Y!=="hover")return;let ce=dn.dist(xt.point);dn=null,ce<3&&(n(10,ft=xt.lngLat),n(4,Ce=xt.features??[]),Wt.isOpen()?n(25,en="justOpened"):(n(25,en="opening"),n(0,mt=!0)))}function Yn(xt){Y!=="hover"||dn||en!=="normal"||(n(0,mt=!1),n(4,Ce=null))}function Wr(xt){if(!(Y!=="hover"||dn||en!=="normal")){if(Ue(xt)){n(0,mt=!1),n(4,Ce=null);return}n(0,mt=!0),n(4,Ce=xt.features??[]),n(10,ft=xt.lngLat)}}function hr(xt){if(en==="justOpened"){n(25,en="normal");return}if(!D)return;let ce=[ze,u instanceof vs.Marker?u==null?void 0:u.getElement():null];mt&&Wt.isOpen()&&!ce.some(mn=>mn==null?void 0:mn.contains(xt.originalEvent.target))&&(xt.type==="contextmenu"&&Y==="contextmenu"||xt.type!=="contextmenu")&&n(0,mt=!1)}ws(()=>{l&&(Wt!=null&&Wt.isOpen())&&Wt.remove()});let er;const Kn=()=>n(0,mt=!1);function nt(xt){fi[xt?"unshift":"push"](()=>{er=xt,n(1,er)})}return e.$$set=xt=>{"closeButton"in xt&&n(11,P=xt.closeButton),"closeOnClickOutside"in xt&&n(12,D=xt.closeOnClickOutside),"closeOnClickInside"in xt&&n(13,N=xt.closeOnClickInside),"closeOnMove"in xt&&n(14,K=xt.closeOnMove),"openOn"in xt&&n(15,Y=xt.openOn),"openIfTopMost"in xt&&n(16,J=xt.openIfTopMost),"focusAfterOpen"in xt&&n(17,B=xt.focusAfterOpen),"anchor"in xt&&n(18,G=xt.anchor),"offset"in xt&&n(19,H=xt.offset),"popupClass"in xt&&n(20,at=xt.popupClass),"maxWidth"in xt&&n(21,gt=xt.maxWidth),"lngLat"in xt&&n(10,ft=xt.lngLat),"html"in xt&&n(22,rt=xt.html),"open"in xt&&n(0,mt=xt.open),"$$scope"in xt&&n(29,S=xt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&14336&&n(27,r=P??(!D&&!N)),e.$$.dirty[0]&146685952&&(Wt||(n(23,Wt=new vs.Popup({closeButton:r,closeOnClick:!1,closeOnMove:K,focusAfterOpen:B,maxWidth:gt,className:at,anchor:G,offset:H})),ze=Wt.getElement(),Wt.on("open",()=>{n(0,mt=!0),We(),Et("open",Wt)}),Wt.on("close",()=>{n(0,mt=!1),Et("close",Wt)}),Wt.on("hover",()=>{Et("hover",Wt)}))),e.$$.dirty[0]&8421384&&Wt&&u instanceof vs.Marker&&(Y==="click"?u.setPopup(Wt):u.getPopup()===Wt&&u.setPopup(void 0)),e.$$.dirty[0]&268468224&&fe.includes(Y)&&(h==null?void 0:h.type)===Y&&(An(h),Ar(Qt,h=null,h)),e.$$.dirty[0]&268468224&&n(26,i=Y==="hover"&&((h==null?void 0:h.type)==="mousemove"||(h==null?void 0:h.type)==="mouseenter")),e.$$.dirty[0]&352354304&&Y==="hover"&&Qt&&(i&&h&&(h.layerType==="deckgl"?(n(10,ft=h.coordinate),n(4,Ce=h.object?[h.object]:null)):(n(10,ft=h.lngLat),n(4,Ce=h.features??[]))),n(0,mt=(i||Re)??!1)),e.$$.dirty[0]&12582914&&(er?Wt.setDOMContent(er):rt&&Wt.setHTML(rt)),e.$$.dirty[0]&8389632&&ft&&Wt.setLngLat(ft),e.$$.dirty[0]&41943045&&l){let xt=Wt.isOpen();mt&&!xt?(Wt.addTo(l),en==="opening"&&n(25,en="justOpened")):!mt&&xt&&Wt.remove()}},[mt,er,l,u,Ce,$,Pt,Qt,Tt,C,ft,P,D,N,K,Y,J,B,G,H,at,gt,rt,Wt,Re,en,i,r,h,S,w,Kn,nt]}class FN extends an{constructor(t){super(),sn(this,t,zN,ON,Xe,{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])}}const BN=e=>({props:e&8}),w2=e=>({props:GN(e[3])});function VN(e){let t;const n=e[1].default,r=li(n,e,e[2],w2);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&12)&&ci(r,n,i,i[2],t?ui(n,i[2],l,BN):hi(i[2]),w2)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function UN(e){let t,n;return t=new FN({props:{openOn:e[0],$$slots:{default:[VN,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&1&&(l.openOn=r[0]),i&12&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function GN(e){return e?e[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function qN(e,t,n){let{$$slots:r={},$$scope:i}=t,{openOn:l="hover"}=t;return e.$$set=h=>{"openOn"in h&&n(0,l=h.openOn),"$$scope"in h&&n(2,i=h.$$scope)},[l,r,i]}class MI extends an{constructor(t){super(),sn(this,t,qN,UN,Xe,{openOn:0})}}function Iu(e,t,n){let r=["match",e];for(let[i,l]of Object.entries(t))r.push(i),r.push(l);return r.push(n),r}function jN(e,t,n){let r=["step",e];for(let i=1;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n}function Hv(e,t){t===void 0&&(t="kilometers");var n=jv[t];if(!n)throw new Error(t+" units is invalid");return e*n}function vy(e,t){t===void 0&&(t="kilometers");var n=jv[t];if(!n)throw new Error(t+" units is invalid");return e/n}function QN(e,t){return Td(vy(e,t))}function $N(e){var t=e%360;return t<0&&(t+=360),t}function Td(e){var t=e%(2*Math.PI);return t*180/Math.PI}function Zs(e){var t=e%360;return t*Math.PI/180}function tO(e,t,n){if(t===void 0&&(t="kilometers"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return Hv(vy(e,t),n)}function eO(e,t,n){if(t===void 0&&(t="meters"),n===void 0&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var r=W0[t];if(!r)throw new Error("invalid original units");var i=W0[n];if(!i)throw new Error("invalid final units");return e/r*i}function Xg(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Zv(e){return!!e&&e.constructor===Object}function nO(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(e.length!==4&&e.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach(function(t){if(!Xg(t))throw new Error("bbox must only contain numbers")})}function rO(e){if(!e)throw new Error("id is required");if(["string","number"].indexOf(typeof e)===-1)throw new Error("id must be a number or a string")}const iO=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:W0,bearingToAzimuth:$N,convertArea:eO,convertLength:tO,degreesToRadians:Zs,earthRadius:_o,factors:jv,feature:sa,featureCollection:zc,geometry:HN,geometryCollection:KN,isNumber:Xg,isObject:Zv,lengthToDegrees:QN,lengthToRadians:vy,lineString:Hs,lineStrings:YN,multiLineString:AI,multiPoint:kI,multiPolygon:DI,point:$o,points:ZN,polygon:Wv,polygons:XN,radiansToDegrees:Td,radiansToLength:Hv,round:JN,unitsFactors:WN,validateBBox:nO,validateId:rO},Symbol.toStringTag,{value:"Module"}));function Ld(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return e.geometry.coordinates;if(e.type==="Point")return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Pf(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function RI(e,t,n){if(n===void 0&&(n={}),n.final===!0)return oO(e,t);var r=Ld(e),i=Ld(t),l=Zs(r[0]),h=Zs(i[0]),u=Zs(r[1]),y=Zs(i[1]),w=Math.sin(h-l)*Math.cos(y),S=Math.cos(u)*Math.sin(y)-Math.sin(u)*Math.cos(y)*Math.cos(h-l);return Td(Math.atan2(w,S))}function oO(e,t){var n=RI(t,e);return n=(n+180)%360,n}function Zp(e,t,n){n===void 0&&(n={});var r=Ld(e),i=Ld(t),l=Zs(i[1]-r[1]),h=Zs(i[0]-r[0]),u=Zs(r[1]),y=Zs(i[1]),w=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(h/2),2)*Math.cos(u)*Math.cos(y);return Hv(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function S2(e,t,n,r){r===void 0&&(r={});var i=Ld(e),l=Zs(i[0]),h=Zs(i[1]),u=Zs(n),y=vy(t,r.units),w=Math.asin(Math.sin(h)*Math.cos(y)+Math.cos(h)*Math.sin(y)*Math.cos(u)),S=l+Math.atan2(Math.sin(u)*Math.sin(y)*Math.cos(h),Math.cos(y)-Math.sin(h)*Math.sin(w)),C=Td(S),P=Td(w);return $o([C,P],r.properties)}function Ud(e,t,n){if(e!==null)for(var r,i,l,h,u,y,w,S=0,C=0,P,D=e.type,N=D==="FeatureCollection",K=D==="Feature",Y=N?e.features.length:1,J=0;Jy||N>w||K>S){u=C,y=r,w=N,S=K,l=0;return}var Y=Hs([u,C],n.properties);if(t(Y,r,i,K,l)===!1)return!1;l++,u=C})===!1)return!1}}})}function fO(e,t,n){var r=n,i=!1;return OI(e,function(l,h,u,y,w){i===!1&&n===void 0?r=l:r=t(r,l,h,u,y,w),i=!0}),r}function zI(e,t){if(!e)throw new Error("geojson is required");Vf(e,function(n,r,i){if(n.geometry!==null){var l=n.geometry.type,h=n.geometry.coordinates;switch(l){case"LineString":if(t(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var u=0;ui?n:i,w=r>l?r:l;return[h,u,y,w]}var Yv={exports:{}},FI={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Md,function(){function n(B,G,H,at,gt){(function ft(rt,mt,Et,$,Pt){for(;$>Et;){if($-Et>600){var Qt=$-Et+1,Tt=mt-Et+1,re=Math.log(Qt),fe=.5*Math.exp(2*re/3),Wt=.5*Math.sqrt(re*fe*(Qt-fe)/Qt)*(Tt-Qt/2<0?-1:1),Re=Math.max(Et,Math.floor(mt-Tt*fe/Qt+Wt)),ze=Math.min($,Math.floor(mt+(Qt-Tt)*fe/Qt+Wt));ft(rt,mt,Re,ze,Pt)}var We=rt[mt],Ue=Et,Ce=$;for(r(rt,Et,mt),Pt(rt[$],We)>0&&r(rt,Et,$);Ue0;)Ce--}Pt(rt[Et],We)===0?r(rt,Et,Ce):r(rt,++Ce,$),Ce<=mt&&(Et=Ce+1),mt<=Ce&&($=Ce-1)}})(B,G,H||0,at||B.length-1,gt||i)}function r(B,G,H){var at=B[G];B[G]=B[H],B[H]=at}function i(B,G){return BG?1:0}var l=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function h(B,G,H){if(!H)return G.indexOf(B);for(var at=0;at=B.minX&&G.maxY>=B.minY}function Y(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function J(B,G,H,at,gt){for(var ft=[G,H];ft.length;)if(!((H=ft.pop())-(G=ft.pop())<=at)){var rt=G+Math.ceil((H-G)/at/2)*at;n(B,rt,G,H,gt),ft.push(G,rt,rt,H)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(B){var G=this.data,H=[];if(!K(B,G))return H;for(var at=this.toBBox,gt=[];G;){for(var ft=0;ft=0&>[G].children.length>this._maxEntries;)this._split(gt,G),G--;this._adjustParentBBoxes(at,gt,G)},l.prototype._split=function(B,G){var H=B[G],at=H.children.length,gt=this._minEntries;this._chooseSplitAxis(H,gt,at);var ft=this._chooseSplitIndex(H,gt,at),rt=Y(H.children.splice(ft,H.children.length-ft));rt.height=H.height,rt.leaf=H.leaf,u(H,this.toBBox),u(rt,this.toBBox),G?B[G-1].children.push(rt):this._splitRoot(H,rt)},l.prototype._splitRoot=function(B,G){this.data=Y([B,G]),this.data.height=B.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(B,G,H){for(var at,gt,ft,rt,mt,Et,$,Pt=1/0,Qt=1/0,Tt=G;Tt<=H-G;Tt++){var re=y(B,0,Tt,this.toBBox),fe=y(B,Tt,H,this.toBBox),Wt=(gt=re,ft=fe,rt=void 0,mt=void 0,Et=void 0,$=void 0,rt=Math.max(gt.minX,ft.minX),mt=Math.max(gt.minY,ft.minY),Et=Math.min(gt.maxX,ft.maxX),$=Math.min(gt.maxY,ft.maxY),Math.max(0,Et-rt)*Math.max(0,$-mt)),Re=P(re)+P(fe);Wt=G;Pt--){var Qt=B.children[Pt];w(rt,B.leaf?gt(Qt):Qt),mt+=D(rt)}return mt},l.prototype._adjustParentBBoxes=function(B,G,H){for(var at=H;at>=0;at--)w(G[at],B)},l.prototype._condense=function(B){for(var G=B.length-1,H=void 0;G>=0;G--)B[G].children.length===0?G>0?(H=B[G-1].children).splice(H.indexOf(B[G]),1):this.clear():u(B[G],this.toBBox)},l})})(FI);var bO=FI.exports;const xO=$g(iO),wO=$g(gO),SO=$g(KD);var Za=bO,BI=xO,VI=wO,Xh=SO.default,EO=VI.featureEach;VI.coordEach;BI.polygon;var I2=BI.featureCollection;function UI(e){var t=new Za(e);return t.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Xh(n),Za.prototype.insert.call(this,n)},t.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Xh(i),r.push(i)}):EO(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Xh(i),r.push(i)}),Za.prototype.load.call(this,r)},t.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Xh(n),Za.prototype.remove.call(this,n,r)},t.clear=function(){return Za.prototype.clear.call(this)},t.search=function(n){var r=Za.prototype.search.call(this,this.toBBox(n));return I2(r)},t.collides=function(n){return Za.prototype.collides.call(this,this.toBBox(n))},t.all=function(){var n=Za.prototype.all.call(this);return I2(n)},t.toJSON=function(){return Za.prototype.toJSON.call(this)},t.fromJSON=function(n){return Za.prototype.fromJSON.call(this,n)},t.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=Xh(n);else if(n.type==="FeatureCollection")r=Xh(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},t}Yv.exports=UI;Yv.exports.default=UI;var IO=Yv.exports;const CO=nv(IO);function TO(e,t){var n={},r=[];if(e.type==="LineString"&&(e=sa(e)),t.type==="LineString"&&(t=sa(t)),e.type==="Feature"&&t.type==="Feature"&&e.geometry!==null&&t.geometry!==null&&e.geometry.type==="LineString"&&t.geometry.type==="LineString"&&e.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var i=C2(e,t);return i&&r.push(i),zc(r)}var l=CO();return l.load(E2(t)),Yg(E2(e),function(h){Yg(l.search(h),function(u){var y=C2(h,u);if(y){var w=Pf(y).join(",");n[w]||(n[w]=!0,r.push(y))}})}),zc(r)}function C2(e,t){var n=Pf(e),r=Pf(t);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],l=n[0][1],h=n[1][0],u=n[1][1],y=r[0][0],w=r[0][1],S=r[1][0],C=r[1][1],P=(C-w)*(h-i)-(S-y)*(u-l),D=(S-y)*(l-w)-(C-w)*(i-y),N=(h-i)*(l-w)-(u-l)*(i-y);if(P===0)return null;var K=D/P,Y=N/P;if(K>=0&&K<=1&&Y>=0&&Y<=1){var J=i+K*(h-i),B=l+K*(u-l);return $o([J,B])}return null}function LO(e,t,n){n===void 0&&(n={});var r=$o([1/0,1/0],{dist:1/0}),i=0;return Vf(e,function(l){for(var h=Pf(l),u=0;u0&&(Y=K.features[0],Y.properties.dist=Zp(t,Y,n),Y.properties.location=i+Zp(y,Y,n)),y.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(t);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-t.lngLat.lng,r=this.dragFrom[1]-t.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=t.lngLat.toArray();this.dragFrom=t.lngLat.toArray(),this.redraw()}});yi(this,"onClick",t=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(T2(this.points).forEach((r,i)=>{n.push([i+1,LO(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(t))});yi(this,"onDoubleClick",t=>{this.active&&(t.preventDefault(),this.cursor=r0(t.lngLat.toArray()),this.onClick(t),this.finish())});yi(this,"onMouseDown",t=>{this.active&&!this.dragFrom&&this.hover!=null&&(t.preventDefault(),this.cursor=null,this.dragFrom=t.lngLat.toArray(),this.beforeUpdate(),this.redraw())});yi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});yi(this,"onKeypress",t=>{this.active&&(t.key=="Enter"?(t.stopPropagation(),this.finish()):t.key=="z"&&t.ctrlKey&&this.undo())});yi(this,"onKeyDown",t=>{this.active&&t.key=="Escape"&&(t.stopPropagation(),this.cancel())});this.map=t,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersSuccess)n(t);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let t of this.eventListenersFailure)t();this.stop()}addEventListenerSuccess(t){this.eventListenersSuccess.push(t)}addEventListenerUpdated(t){this.eventListenersUpdated.push(t)}addEventListenerFailure(t){this.eventListenersFailure.push(t)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(t){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(t.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let t={type:"FeatureCollection",features:[]};this.points.forEach((i,l)=>{let h=r0(i);h.properties.hover=this.hover==l,h.properties.idx=l,t.features.push(h)}),t.features=t.features.concat(T2(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",t.features.push(n)),qI.set(t);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,jI.set(this.previousStates.length)}pointsUpdated(){let t=this.polygonFeature();if(t)for(let n of this.eventListenersUpdated)n(t)}recalculateHovering(t){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(t.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=r0(t.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let t=this.points.map(GI),n=[JSON.parse(JSON.stringify(t))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>kO&&this.previousStates.shift()}}function T2(e){let t=[];for(let n=0;n=3&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[e[e.length-1],e[0]]},properties:{}}),t}function RO(e){let t,n,r;return{c(){t=yn("Undo ("),n=yn(e[1]),r=yn(")")},m(i,l){zt(i,t,l),zt(i,n,l),zt(i,r,l)},p(i,l){l&2&&Ui(n,i[1])},d(i){i&&(Nt(t),Nt(n),Nt(r))}}}function NO(e){let t;return{c(){t=yn("Undo")},m(n,r){zt(n,t,r)},p:Ae,d(n){n&&Nt(t)}}}function OO(e){let t,n,r,i,l,h,u,y,w,S,C;function P(K,Y){return K[1]==0?NO:RO}let D=P(e),N=D(e);return{c(){t=qt("div"),n=qt("button"),n.textContent="Finish",r=ye(),i=qt("button"),i.textContent="Cancel",l=ye(),h=qt("button"),N.c(),y=ye(),w=qt("ul"),w.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 @@ -614,33 +614,33 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,h.disabled=u=e[1]==0,Gr(t,"display","flex"),Gr(t,"justify-content","space-between")},m(J,Y){zt(J,t,Y),Xt(t,n),Xt(t,r),Xt(t,o),Xt(t,l),Xt(t,h),R.m(h,null),zt(J,y,Y),zt(J,w,Y),S||(C=[hn(n,"click",e[2]),hn(o,"click",e[3]),hn(h,"click",e[4])],S=!0)},p(J,[Y]){N===(N=P(J))&&R?R.p(J,Y):(R.d(1),R=N(J),R&&(R.c(),R.m(h,null))),Y&2&&u!==(u=J[1]==0)&&(h.disabled=u)},i:Me,o:Me,d(J){J&&(Nt(t),Nt(y),Nt(w)),R.d(),S=!1,oo(C)}}}function OO(e,t,n){let r;Ge(e,jI,y=>n(1,r=y));let{polygonTool:o}=t;const l=()=>o.finish(),h=()=>o.cancel(),u=()=>o.undo();return e.$$set=y=>{"polygonTool"in y&&n(0,o=y.polygonTool)},[o,r,l,h,u]}class zO extends an{constructor(t){super(),sn(this,t,OO,NO,Xe,{polygonTool:0})}}let FO=Date.now();function Gd(e){return`${e}-${FO++}`}const WI=Symbol.for("svelte-maplibre");function BO(){return Q0(WI)}function T2(e){return{subscribe:e.subscribe}}function HI({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let o=BO(),l=zr(null),h=T2(l),u={...o,[e]:T2(l)};if(t&&(u.popupTarget=h),r){let y=zr(null);u.layerEvent=y,o.layerEvent=y}return n&&(u.cluster=zr()),J0(WI,u),{...o,self:l}}function VO(){return HI({key:"source",setCluster:!0})}function UO(e=!0){return HI({key:"layer",setPopupTarget:e,setMouseEvent:e})}function L2(e){let t;return n=>{if(n)for(let r in n){let o=t==null?void 0:t[r],l=n[r];o!==l&&e(r,l,o)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function GO(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function qO(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function P2(e){let t=e[0],n,r,o=M2(e);return{c(){o.c(),n=so()},m(l,h){o.m(l,h),zt(l,n,h),r=!0},p(l,h){h[0]&1&&Xe(t,t=l[0])?(ar(),qt(o,1,1,Me),lr(),o=M2(l),o.c(),Dt(o,1),o.m(n.parentNode,n)):o.p(l,h)},i(l){r||(Dt(o),r=!0)},o(l){qt(o),r=!1},d(l){l&&Nt(n),o.d(l)}}}function M2(e){let t;const n=e[36].default,r=li(n,e,e[35],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l[1]&16)&&ci(r,n,o,o[35],t?ui(n,o[35],l,null):hi(o[35]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function jO(e){let t,n,r=e[0]&&P2(e);return{c(){r&&r.c(),t=so()},m(o,l){r&&r.m(o,l),zt(o,t,l),n=!0},p(o,l){o[0]?r?(r.p(o,l),l[0]&1&&Dt(r,1)):(r=P2(o),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function WO(e,t,n){let r,o,l,h,u,y,w,S,C,P,N,R,{$$slots:J={},$$scope:Y}=t,{id:K=Gd("layer")}=t,{source:B=void 0}=t,{sourceLayer:G=void 0}=t,{beforeId:H=void 0}=t,{beforeLayerType:at=void 0}=t,{type:gt}=t,{paint:ft=void 0}=t,{layout:rt=void 0}=t,{filter:mt=void 0}=t,{applyToClusters:Et=void 0}=t,{minzoom:$=void 0}=t,{maxzoom:Pt=void 0}=t,{manageHoverState:Qt=!1}=t,{hovered:Tt=null}=t,{interactive:re=!0}=t,{hoverCursor:fe=void 0}=t,{eventsIfTopMost:Wt=!1}=t;const Re=Bu(),{map:ze,source:We,self:Ve,minzoom:Ce,maxzoom:en,eventTopMost:An,layerInfo:dn}=UO();Ge(e,ze,nt=>n(31,C=nt)),Ge(e,We,nt=>n(32,P=nt)),Ge(e,Ve,nt=>n(0,S=nt)),Ge(e,Ce,nt=>n(34,R=nt)),Ge(e,en,nt=>n(33,N=nt)),ws(()=>{S&&C&&(dn.delete(S),C==null||C.removeLayer(S))});let un;function kn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn={event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt};Re(nt.type,mn)}function Yn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;fe&&(C.getCanvas().style.cursor=fe);let xt=nt.features??[];n(6,Tt=xt[0]??null);let ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id;Re("mouseenter",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function Wr(nt){var Mt,He,Tr;if(!re||!C)return;if(Wt&&An(nt)!==S){n(6,Tt=null),Qt&&un!==void 0&&(C==null||C.setFeatureState({source:u,sourceLayer:G,id:un},{hover:!1}),un=void 0);return}C.getCanvas().style.cursor=fe;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn=(Tr=xt[0])==null?void 0:Tr.id;mn!==un&&(Qt&&(un!==void 0&&(C==null||C.setFeatureState({source:u,id:un,sourceLayer:G},{hover:!1})),C==null||C.setFeatureState({source:u,id:mn,sourceLayer:G},{hover:!0})),un=mn,n(6,Tt=xt[0]??null)),Re("mousemove",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function hr(nt){if(!(!re||!S||!C)){if(fe&&(C.getCanvas().style.cursor=""),n(6,Tt=null),Qt&&un!==void 0){const xt={source:u,id:un,sourceLayer:G};C==null||C.setFeatureState(xt,{hover:!1}),un=void 0}Re("mouseleave",{map:C,layer:S,source:u})}}let er=!0;function Kn(nt){C&&(C.off("click",nt,kn),C.off("dblclick",nt,kn),C.off("contextmenu",nt,kn),C.off("mouseenter",nt,Yn),C.off("mousemove",nt,Wr),C.off("mouseleave",nt,hr))}return ws(()=>{C&&S&&Kn(S)}),e.$$set=nt=>{"id"in nt&&n(7,K=nt.id),"source"in nt&&n(8,B=nt.source),"sourceLayer"in nt&&n(9,G=nt.sourceLayer),"beforeId"in nt&&n(10,H=nt.beforeId),"beforeLayerType"in nt&&n(11,at=nt.beforeLayerType),"type"in nt&&n(12,gt=nt.type),"paint"in nt&&n(13,ft=nt.paint),"layout"in nt&&n(14,rt=nt.layout),"filter"in nt&&n(15,mt=nt.filter),"applyToClusters"in nt&&n(16,Et=nt.applyToClusters),"minzoom"in nt&&n(17,$=nt.minzoom),"maxzoom"in nt&&n(18,Pt=nt.maxzoom),"manageHoverState"in nt&&n(19,Qt=nt.manageHoverState),"hovered"in nt&&n(6,Tt=nt.hovered),"interactive"in nt&&n(20,re=nt.interactive),"hoverCursor"in nt&&n(21,fe=nt.hoverCursor),"eventsIfTopMost"in nt&&n(22,Wt=nt.eventsIfTopMost),"$$scope"in nt&&n(35,Y=nt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=qO(Et)),e.$$.dirty[0]&1073774592&&n(24,o=GO("all",r,mt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=$??R),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=Pt??N),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&C&&S!==K&&u){S&&(Kn(S),dn.delete(S));let nt=H;if(!H&&at){let xt=C.getStyle().layers,ce=typeof at=="function"?at:Mt=>Mt.type===at,mn=xt==null?void 0:xt.find(ce);mn&&(nt=mn.id)}Ur(Ve,S=K,S),C.addLayer(Sc({id:S,type:gt,source:u,"source-layer":G,filter:o,paint:ft,layout:rt,minzoom:l,maxzoom:h}),nt),n(23,er=!0),C.on("click",S,kn),C.on("dblclick",S,kn),C.on("contextmenu",S,kn),C.on("mouseenter",S,Yn),C.on("mousemove",S,Wr),C.on("mouseleave",S,hr)}e.$$.dirty[0]&1048577&&S&&dn.set(S,{interactive:re}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?L2((nt,xt)=>C==null?void 0:C.setPaintProperty(S,nt,xt)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?L2((nt,xt)=>C==null?void 0:C.setLayoutProperty(S,nt,xt)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(ft)),e.$$.dirty[0]&134234112&&(w==null||w(rt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(C==null||C.setLayerZoomRange(S,l,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(er?n(23,er=!1):C==null||C.setFilter(S,o))},[S,ze,We,Ve,Ce,en,Tt,K,B,G,H,at,gt,ft,rt,mt,Et,$,Pt,Qt,re,fe,Wt,er,o,h,l,w,y,u,r,C,P,N,R,Y,J]}class Yv extends an{constructor(t){super(),sn(this,t,WO,jO,Xe,{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 HO(e){let t;const n=e[16].default,r=li(n,e,e[24],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&16777216)&&ci(r,n,o,o[24],t?ui(n,o[24],l,null):hi(o[24]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function ZO(e){let t,n,r;function o(h){e[17](h)}let l={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[HO]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new Yv({props:l}),fi.push(()=>Lu(t,"hovered",o)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.applyToClusters=h[9]),u&1024&&(y.minzoom=h[10]),u&2048&&(y.maxzoom=h[11]),u&4096&&(y.hoverCursor=h[12]),u&8192&&(y.manageHoverState=h[13]),u&16384&&(y.eventsIfTopMost=h[14]),u&32768&&(y.interactive=h[15]),u&16777216&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Tu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){qt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function XO(e,t,n){let{$$slots:r={},$$scope:o}=t,{id:l=Gd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{applyToClusters:N=void 0}=t,{minzoom:R=void 0}=t,{maxzoom:J=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:K=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:G=!1}=t,{interactive:H=!0}=t;function at(Pt){B=Pt,n(0,B)}function gt(Pt){Nn.call(this,e,Pt)}function ft(Pt){Nn.call(this,e,Pt)}function rt(Pt){Nn.call(this,e,Pt)}function mt(Pt){Nn.call(this,e,Pt)}function Et(Pt){Nn.call(this,e,Pt)}function $(Pt){Nn.call(this,e,Pt)}return e.$$set=Pt=>{"id"in Pt&&n(1,l=Pt.id),"source"in Pt&&n(2,h=Pt.source),"sourceLayer"in Pt&&n(3,u=Pt.sourceLayer),"beforeId"in Pt&&n(4,y=Pt.beforeId),"beforeLayerType"in Pt&&n(5,w=Pt.beforeLayerType),"paint"in Pt&&n(6,S=Pt.paint),"layout"in Pt&&n(7,C=Pt.layout),"filter"in Pt&&n(8,P=Pt.filter),"applyToClusters"in Pt&&n(9,N=Pt.applyToClusters),"minzoom"in Pt&&n(10,R=Pt.minzoom),"maxzoom"in Pt&&n(11,J=Pt.maxzoom),"hoverCursor"in Pt&&n(12,Y=Pt.hoverCursor),"manageHoverState"in Pt&&n(13,K=Pt.manageHoverState),"hovered"in Pt&&n(0,B=Pt.hovered),"eventsIfTopMost"in Pt&&n(14,G=Pt.eventsIfTopMost),"interactive"in Pt&&n(15,H=Pt.interactive),"$$scope"in Pt&&n(24,o=Pt.$$scope)},[B,l,h,u,y,w,S,C,P,N,R,J,Y,K,G,H,r,at,gt,ft,rt,mt,Et,$,o]}class YO extends an{constructor(t){super(),sn(this,t,XO,ZO,Xe,{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 KO(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,o,o[23],t?ui(n,o[23],l,null):hi(o[23]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function JO(e){let t,n,r;function o(h){e[16](h)}let l={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[KO]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new Yv({props:l}),fi.push(()=>Lu(t,"hovered",o)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Tu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){qt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function QO(e,t,n){let{$$slots:r={},$$scope:o}=t,{id:l=Gd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:J=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){K=$,n(0,K)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,N=$.minzoom),"maxzoom"in $&&n(10,R=$.maxzoom),"hoverCursor"in $&&n(11,J=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,K=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,o=$.$$scope)},[K,l,h,u,y,w,S,C,P,N,R,J,Y,B,G,r,H,at,gt,ft,rt,mt,Et,o]}class $O extends an{constructor(t){super(),sn(this,t,QO,JO,Xe,{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 tz(e,t,n,r,o){let l=!1;e.getSource(t)&&(l=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),o())};if(l){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function ez(e,t,n){sS().then(()=>{let r=nS(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function A2(e){let t=e[0],n,r,o=k2(e);return{c(){o.c(),n=so()},m(l,h){o.m(l,h),zt(l,n,h),r=!0},p(l,h){h&1&&Xe(t,t=l[0])?(ar(),qt(o,1,1,Me),lr(),o=k2(l),o.c(),Dt(o,1),o.m(n.parentNode,n)):o.p(l,h)},i(l){r||(Dt(o),r=!0)},o(l){qt(o),r=!1},d(l){l&&Nt(n),o.d(l)}}}function k2(e){let t;const n=e[15].default,r=li(n,e,e[14],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&16384)&&ci(r,n,o,o[14],t?ui(n,o[14],l,null):hi(o[14]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function nz(e){let t,n,r=e[0]&&A2(e);return{c(){r&&r.c(),t=so()},m(o,l){r&&r.m(o,l),zt(o,t,l),n=!0},p(o,[l]){o[0]?r?(r.p(o,l),l&1&&Dt(r,1)):(r=A2(o),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function rz(e,t,n){let r,o,l,{$$slots:h={},$$scope:u}=t,{id:y=Gd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:C=void 0}=t,{filter:P=void 0}=t,{lineMetrics:N=void 0}=t,{cluster:R=void 0}=t;const{map:J,cluster:Y,self:K}=VO();Ge(e,J,H=>n(13,o=H)),Ge(e,Y,H=>n(16,l=H)),Ge(e,K,H=>n(0,r=H));let B,G=!0;return ws(()=>{r&&B&&o&&(ez(J,r,B),Ur(K,r=null,r),n(11,B=void 0))}),e.$$set=H=>{"id"in H&&n(4,y=H.id),"data"in H&&n(5,w=H.data),"generateId"in H&&n(6,S=H.generateId),"promoteId"in H&&n(7,C=H.promoteId),"filter"in H&&n(8,P=H.filter),"lineMetrics"in H&&n(9,N=H.lineMetrics),"cluster"in H&&n(10,R=H.cluster),"$$scope"in H&&n(14,u=H.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Ur(Y,l=R,l),e.$$.dirty&12273&&o&&r!==y&&(Ur(K,r=y,r),tz(o,r,Sc({type:"geojson",data:w,filter:P,lineMetrics:N,generateId:S,promoteId:C,cluster:!!R,clusterMinPoints:R==null?void 0:R.minPoints,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius,clusterProperties:R==null?void 0:R.properties}),H=>o&&H===r,()=>{r&&(n(11,B=o==null?void 0:o.getSource(r)),n(12,G=!0))})),e.$$.dirty&8208&&(o==null||o.on("style.load",()=>{n(11,B=o==null?void 0:o.getSource(y))})),e.$$.dirty&6176&&B&&(G?n(12,G=!1):B.setData(w)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Sc({cluster:!!R,clusterMaxZoom:R==null?void 0:R.maxZoom,clusterRadius:R==null?void 0:R.radius})))},[r,J,Y,K,y,w,S,C,P,N,R,B,G,o,u,h]}class iz extends an{constructor(t){super(),sn(this,t,rz,nz,Xe,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function oz(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(o,l){r&&r.m(o,l),t=!0},p(o,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,o,o[23],t?ui(n,o[23],l,null):hi(o[23]),null)},i(o){t||(Dt(r,o),t=!0)},o(o){qt(r,o),t=!1},d(o){r&&r.d(o)}}}function sz(e){let t,n,r;function o(h){e[16](h)}let l={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[oz]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new Yv({props:l}),fi.push(()=>Lu(t,"hovered",o)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Tu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){qt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function az(e,t,n){let{$$slots:r={},$$scope:o}=t,{id:l=Gd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:R=void 0}=t,{hoverCursor:J=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:K=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){K=$,n(0,K)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,N=$.minzoom),"maxzoom"in $&&n(10,R=$.maxzoom),"hoverCursor"in $&&n(11,J=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,K=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,o=$.$$scope)},[K,l,h,u,y,w,S,C,P,N,R,J,Y,B,G,r,H,at,gt,ft,rt,mt,Et,o]}class lz extends an{constructor(t){super(),sn(this,t,az,sz,Xe,{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 uz(e){let t,n,r,o,l,h;return t=new $O({props:{id:"edit-polygon-fill",filter:LO,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new lz({props:{id:"edit-polygon-lines",filter:PO,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),l=new YO({props:{id:"edit-polygon-vertices",filter:MO,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){Ie(t.$$.fragment),n=ye(),Ie(r.$$.fragment),o=ye(),Ie(l.$$.fragment)},m(u,y){we(t,u,y),zt(u,n,y),we(r,u,y),zt(u,o,y),we(l,u,y),h=!0},p:Me,i(u){h||(Dt(t.$$.fragment,u),Dt(r.$$.fragment,u),Dt(l.$$.fragment,u),h=!0)},o(u){qt(t.$$.fragment,u),qt(r.$$.fragment,u),qt(l.$$.fragment,u),h=!1},d(u){u&&(Nt(n),Nt(o)),Se(t,u),Se(r,u),Se(l,u)}}}function cz(e){let t,n;return t=new iz({props:{data:e[0],$$slots:{default:[uz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&1&&(l.data=r[0]),o&2&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function hz(e,t,n){let r;return Ge(e,qI,o=>n(0,r=o)),[r]}class ZI extends an{constructor(t){super(),sn(this,t,hz,cz,Xe,{})}}const fz=e=>({}),D2=e=>({}),pz=e=>({}),R2=e=>({}),dz=e=>({}),N2=e=>({});function mz(e){let t,n,r,o,l,h;const u=e[1].top,y=li(u,e,e[0],N2),w=e[1].left,S=li(w,e,e[0],R2),C=e[1].main,P=li(C,e,e[0],D2);return{c(){t=jt("div"),y&&y.c(),n=ye(),r=jt("div"),S&&S.c(),o=ye(),l=jt("div"),P&&P.c(),Vt(t,"class","top svelte-mpick2"),Vt(r,"class","left svelte-mpick2"),Vt(l,"class","main svelte-mpick2")},m(N,R){zt(N,t,R),y&&y.m(t,null),zt(N,n,R),zt(N,r,R),S&&S.m(r,null),zt(N,o,R),zt(N,l,R),P&&P.m(l,null),h=!0},p(N,[R]){y&&y.p&&(!h||R&1)&&ci(y,u,N,N[0],h?ui(u,N[0],R,dz):hi(N[0]),N2),S&&S.p&&(!h||R&1)&&ci(S,w,N,N[0],h?ui(w,N[0],R,pz):hi(N[0]),R2),P&&P.p&&(!h||R&1)&&ci(P,C,N,N[0],h?ui(C,N[0],R,fz):hi(N[0]),D2)},i(N){h||(Dt(y,N),Dt(S,N),Dt(P,N),h=!0)},o(N){qt(y,N),qt(S,N),qt(P,N),h=!1},d(N){N&&(Nt(t),Nt(n),Nt(r),Nt(o),Nt(l)),y&&y.d(N),S&&S.d(N),P&&P.d(N)}}}function gz(e,t,n){let{$$slots:r={},$$scope:o}=t;return e.$$set=l=>{"$$scope"in l&&n(0,o=l.$$scope)},[o,r]}class yz extends an{constructor(t){super(),sn(this,t,gz,mz,Xe,{})}}const _z=e=>({}),O2=e=>({}),vz=e=>({}),z2=e=>({}),bz=e=>({}),F2=e=>({});function xz(e){let t,n,r,o,l,h;const u=e[4].top,y=li(u,e,e[3],F2),w=e[4].sidebar,S=li(w,e,e[3],z2),C=e[4].map,P=li(C,e,e[3],O2);return{c(){t=jt("div"),y&&y.c(),n=ye(),r=jt("div"),S&&S.c(),o=ye(),l=jt("div"),P&&P.c()},m(N,R){zt(N,t,R),y&&y.m(t,null),e[5](t),zt(N,n,R),zt(N,r,R),S&&S.m(r,null),e[6](r),zt(N,o,R),zt(N,l,R),P&&P.m(l,null),e[7](l),h=!0},p(N,[R]){y&&y.p&&(!h||R&8)&&ci(y,u,N,N[3],h?ui(u,N[3],R,bz):hi(N[3]),F2),S&&S.p&&(!h||R&8)&&ci(S,w,N,N[3],h?ui(w,N[3],R,vz):hi(N[3]),z2),P&&P.p&&(!h||R&8)&&ci(P,C,N,N[3],h?ui(C,N[3],R,_z):hi(N[3]),O2)},i(N){h||(Dt(y,N),Dt(S,N),Dt(P,N),h=!0)},o(N){qt(y,N),qt(S,N),qt(P,N),h=!1},d(N){N&&(Nt(t),Nt(n),Nt(r),Nt(o),Nt(l)),y&&y.d(N),e[5](null),S&&S.d(N),e[6](null),P&&P.d(N),e[7](null)}}}function wz(e,t,n){let r,o,l;Ge(e,H0,C=>n(0,r=C)),Ge(e,Z0,C=>n(1,o=C)),Ge(e,X0,C=>n(2,l=C));let{$$slots:h={},$$scope:u}=t;function y(C){fi[C?"unshift":"push"](()=>{r=C,H0.set(r)})}function w(C){fi[C?"unshift":"push"](()=>{o=C,Z0.set(o)})}function S(C){fi[C?"unshift":"push"](()=>{l=C,X0.set(l)})}return e.$$set=C=>{"$$scope"in C&&n(3,u=C.$$scope)},[r,o,l,u,h,y,w,S]}class by extends an{constructor(t){super(),sn(this,t,wz,xz,Xe,{})}}let H0=zr(null),Z0=zr(null),X0=zr(null),XI="MZEJTanw3WpxRvt7qDfo",gc=zr("title"),Kl=zr(null),xy=zr(null),Kg=zr(!0),Y0=zr(!0);function Sz(e){let t,n,r,o,l,h,u,y,w,S,C,P,N,R,J,Y,K,B,G,H,at;return{c(){t=jt("nav"),n=jt("ul"),r=jt("li"),o=jt("button"),o.textContent="Change study area",l=ye(),h=jt("li"),u=jt("button"),y=wn("Score"),S=ye(),C=jt("li"),P=jt("button"),N=wn("Route"),J=ye(),Y=jt("li"),K=jt("button"),B=wn("Debug network"),u.disabled=w=e[0]=="score",P.disabled=R=e[0]=="route",K.disabled=G=e[0]=="debug"},m(gt,ft){zt(gt,t,ft),Xt(t,n),Xt(n,r),Xt(r,o),Xt(n,l),Xt(n,h),Xt(h,u),Xt(u,y),Xt(n,S),Xt(n,C),Xt(C,P),Xt(P,N),Xt(n,J),Xt(n,Y),Xt(Y,K),Xt(K,B),H||(at=[hn(o,"click",e[1]),hn(u,"click",e[2]),hn(P,"click",e[3]),hn(K,"click",e[4])],H=!0)},p(gt,[ft]){ft&1&&w!==(w=gt[0]=="score")&&(u.disabled=w),ft&1&&R!==(R=gt[0]=="route")&&(P.disabled=R),ft&1&&G!==(G=gt[0]=="debug")&&(K.disabled=G)},i:Me,o:Me,d(gt){gt&&Nt(t),H=!1,oo(at)}}}function Ez(e,t,n){let r;return Ge(e,gc,y=>n(0,r=y)),[r,()=>Ur(gc,r="title",r),()=>Ur(gc,r="score",r),()=>Ur(gc,r="route",r),()=>Ur(gc,r="debug",r)]}class Kv extends an{constructor(t){super(),sn(this,t,Ez,Sz,Xe,{})}}function Iz(e){let t,n,r;return n=new Kv({}),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"slot","top")},m(o,l){zt(o,t,l),we(n,t,null),r=!0},p:Me,i(o){r||(Dt(n.$$.fragment,o),r=!0)},o(o){qt(n.$$.fragment,o),r=!1},d(o){o&&Nt(t),Se(n)}}}function Cz(e){let t;return{c(){t=jt("div"),t.innerHTML="

    Debug mode

    Hover to see a segment's properties, and click to open OSM

    ",Vt(t,"slot","sidebar")},m(n,r){zt(n,t,r)},p:Me,d(n){n&&Nt(t)}}}function Tz(e){let t,n,r=e[4].kind+"",o,l,h,u;return h=new IP({props:{properties:e[4]}}),{c(){t=jt("h2"),n=wn("Classified as "),o=wn(r),l=ye(),Ie(h.$$.fragment)},m(y,w){zt(y,t,w),Xt(t,n),Xt(t,o),zt(y,l,w),we(h,y,w),u=!0},p(y,w){(!u||w&16)&&r!==(r=y[4].kind+"")&&Ui(o,r);const S={};w&16&&(S.properties=y[4]),h.$set(S)},i(y){u||(Dt(h.$$.fragment,y),u=!0)},o(y){qt(h.$$.fragment,y),u=!1},d(y){y&&(Nt(t),Nt(l)),Se(h,y)}}}function Lz(e){let t,n;return t=new MI({props:{openOn:"hover",$$slots:{default:[Tz,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&48&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Pz(e){let t,n;return t=new Ad({props:{id:"network",paint:{"line-width":Mb(5,7),"line-color":Eu(["get","kind"],Qa,"yellow"),"line-opacity":e[0]?e[1]/100:Eu(["get","kind"],{Severance:0},e[1]/100)},manageHoverState:!0,hoverCursor:"pointer",$$slots:{default:[Lz]},$$scope:{ctx:e}}}),t.$on("click",e[3]),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&3&&(l.paint={"line-width":Mb(5,7),"line-color":Eu(["get","kind"],Qa,"yellow"),"line-opacity":r[0]?r[1]/100:Eu(["get","kind"],{Severance:0},r[1]/100)}),o&32&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Mz(e){let t,n,r;return n=new Af({props:{data:JSON.parse(rl(e[2]).render()),generateId:!0,$$slots:{default:[Pz]},$$scope:{ctx:e}}}),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"slot","map")},m(o,l){zt(o,t,l),we(n,t,null),r=!0},p(o,l){const h={};l&4&&(h.data=JSON.parse(rl(o[2]).render())),l&35&&(h.$$scope={dirty:l,ctx:o}),n.$set(h)},i(o){r||(Dt(n.$$.fragment,o),r=!0)},o(o){qt(n.$$.fragment,o),r=!1},d(o){o&&Nt(t),Se(n)}}}function Az(e){let t,n;return t=new by({props:{$$slots:{map:[Mz],sidebar:[Cz],top:[Iz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&39&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function kz(e,t,n){let r;Ge(e,Kl,u=>n(2,r=u));let{showSeverances:o}=t,{opacity:l}=t;const h=u=>window.open(rl(u.detail.features[0].properties).way,"_blank");return e.$$set=u=>{"showSeverances"in u&&n(0,o=u.showSeverances),"opacity"in u&&n(1,l=u.opacity)},[o,l,r,h]}class Dz extends an{constructor(t){super(),sn(this,t,kz,Az,Xe,{showSeverances:0,opacity:1})}}function B2(e,t,n){const r=e.slice();return r[2]=t[n],r}function V2(e){let t,n,r=U2(e[2])+"",o,l;return{c(){t=jt("li"),n=jt("a"),l=ye(),Vt(n,"href",o=rl(e[2].properties).way),Vt(n,"target","_blank")},m(h,u){zt(h,t,u),Xt(t,n),n.innerHTML=r,Xt(t,l)},p(h,u){u&1&&r!==(r=U2(h[2])+"")&&(n.innerHTML=r),u&1&&o!==(o=rl(h[2].properties).way)&&Vt(n,"href",o)},d(h){h&&Nt(t)}}}function Rz(e){let t,n,r,o=(e[0].route_length/e[0].direct_length).toFixed(1)+"",l,h,u,y,w,S=e[1](e[0])+"",C,P,N,R,J=vo(e[0].features),Y=[];for(let K=0;K{"route_gj"in l&&n(0,r=l.route_gj)},[r,o]}class Oz extends an{constructor(t){super(),sn(this,t,Nz,Rz,Xe,{route_gj:0})}}function zz(e){let t,n;return t=new Ad({props:{id:"network",paint:{"line-width":5,"line-color":Eu(["get","kind"],Qa,"yellow"),"line-opacity":e[0]?e[1]/100:Eu(["get","kind"],{Severance:0},e[1]/100)}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&3&&(l.paint={"line-width":5,"line-color":Eu(["get","kind"],Qa,"yellow"),"line-opacity":r[0]?r[1]/100:Eu(["get","kind"],{Severance:0},r[1]/100)}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Fz(e){let t,n;return t=new Af({props:{data:JSON.parse(rl(e[2]).render()),$$slots:{default:[zz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&4&&(l.data=JSON.parse(rl(r[2]).render())),o&11&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Bz(e,t,n){let r;Ge(e,Kl,h=>n(2,r=h));let{showSeverances:o}=t,{opacity:l}=t;return e.$$set=h=>{"showSeverances"in h&&n(0,o=h.showSeverances),"opacity"in h&&n(1,l=h.opacity)},[o,l,r]}class YI extends an{constructor(t){super(),sn(this,t,Bz,Fz,Xe,{showSeverances:0,opacity:1})}}function Vz(e){let t,n,r;return n=new Kv({}),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"slot","top")},m(o,l){zt(o,t,l),we(n,t,null),r=!0},p:Me,i(o){r||(Dt(n.$$.fragment,o),r=!0)},o(o){qt(n.$$.fragment,o),r=!1},d(o){o&&Nt(t),Se(n)}}}function G2(e){let t,n;return{c(){t=jt("p"),n=wn(e[5])},m(r,o){zt(r,t,o),Xt(t,n)},p(r,o){o&32&&Ui(n,r[5])},d(r){r&&Nt(t)}}}function q2(e){let t,n;return t=new Oz({props:{route_gj:e[4]}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&16&&(l.route_gj=r[4]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Uz(e){let t,n,r,o,l,h,u,y=e[5]&&G2(e),w=e[4]&&q2(e);return{c(){t=jt("div"),n=jt("h2"),n.textContent="Route mode",r=ye(),o=jt("p"),o.innerHTML=`Move the A and B pins to find a walking route. (Hint: right-click - to set the first pin somewhere.)`,l=ye(),y&&y.c(),h=ye(),w&&w.c(),Vt(t,"slot","sidebar")},m(S,C){zt(S,t,C),Xt(t,n),Xt(t,r),Xt(t,o),Xt(t,l),y&&y.m(t,null),Xt(t,h),w&&w.m(t,null),u=!0},p(S,C){S[5]?y?y.p(S,C):(y=G2(S),y.c(),y.m(t,h)):y&&(y.d(1),y=null),S[4]?w?(w.p(S,C),C&16&&Dt(w,1)):(w=q2(S),w.c(),Dt(w,1),w.m(t,null)):w&&(ar(),qt(w,1,1,()=>{w=null}),lr())},i(S){u||(Dt(w),u=!0)},o(S){qt(w),u=!1},d(S){S&&Nt(t),y&&y.d(),w&&w.d()}}}function Gz(e){let t;return{c(){t=jt("span"),t.textContent="A",Vt(t,"class","dot svelte-1ej0v4r")},m(n,r){zt(n,t,r)},p:Me,d(n){n&&Nt(t)}}}function qz(e){let t;return{c(){t=jt("span"),t.textContent="B",Vt(t,"class","dot svelte-1ej0v4r")},m(n,r){zt(n,t,r)},p:Me,d(n){n&&Nt(t)}}}function j2(e){let t,n;return t=new Af({props:{data:e[4],$$slots:{default:[jz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&16&&(l.data=r[4]),o&2048&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function jz(e){let t,n;return t=new Ad({props:{id:"route",beforeId:"network",paint:{"line-width":20,"line-color":"cyan","line-opacity":.5}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p:Me,i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Wz(e){let t,n,r,o,l,h,u,y,w,S,C,P;n=new dS({}),n.$on("contextmenu",e[6]),o=new YI({props:{showSeverances:e[0],opacity:e[1]}});function N(B){e[8](B)}let R={draggable:!0,$$slots:{default:[Gz]},$$scope:{ctx:e}};e[2]!==void 0&&(R.lngLat=e[2]),h=new Vb({props:R}),fi.push(()=>Lu(h,"lngLat",N));function J(B){e[9](B)}let Y={draggable:!0,$$slots:{default:[qz]},$$scope:{ctx:e}};e[3]!==void 0&&(Y.lngLat=e[3]),w=new Vb({props:Y}),fi.push(()=>Lu(w,"lngLat",J));let K=e[4]&&j2(e);return{c(){t=jt("div"),Ie(n.$$.fragment),r=ye(),Ie(o.$$.fragment),l=ye(),Ie(h.$$.fragment),y=ye(),Ie(w.$$.fragment),C=ye(),K&&K.c(),Vt(t,"slot","map")},m(B,G){zt(B,t,G),we(n,t,null),Xt(t,r),we(o,t,null),Xt(t,l),we(h,t,null),Xt(t,y),we(w,t,null),Xt(t,C),K&&K.m(t,null),P=!0},p(B,G){const H={};G&1&&(H.showSeverances=B[0]),G&2&&(H.opacity=B[1]),o.$set(H);const at={};G&2048&&(at.$$scope={dirty:G,ctx:B}),!u&&G&4&&(u=!0,at.lngLat=B[2],Tu(()=>u=!1)),h.$set(at);const gt={};G&2048&&(gt.$$scope={dirty:G,ctx:B}),!S&&G&8&&(S=!0,gt.lngLat=B[3],Tu(()=>S=!1)),w.$set(gt),B[4]?K?(K.p(B,G),G&16&&Dt(K,1)):(K=j2(B),K.c(),Dt(K,1),K.m(t,null)):K&&(ar(),qt(K,1,1,()=>{K=null}),lr())},i(B){P||(Dt(n.$$.fragment,B),Dt(o.$$.fragment,B),Dt(h.$$.fragment,B),Dt(w.$$.fragment,B),Dt(K),P=!0)},o(B){qt(n.$$.fragment,B),qt(o.$$.fragment,B),qt(h.$$.fragment,B),qt(w.$$.fragment,B),qt(K),P=!1},d(B){B&&Nt(t),Se(n),Se(o),Se(h),Se(w),K&&K.d()}}}function Hz(e){let t,n;return t=new by({props:{$$slots:{map:[Wz],sidebar:[Uz],top:[Vz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&2111&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function og(e,t,n){return t+e*(n-t)}function Zz(e,t,n){let r;Ge(e,Kl,R=>n(7,r=R));let{showSeverances:o}=t,{opacity:l}=t,h=Array.from(r.getBounds()),u={lng:og(.4,h[0],h[2]),lat:og(.4,h[1],h[3])},y={lng:og(.6,h[0],h[2]),lat:og(.6,h[1],h[3])},w=null,S="";function C(R){n(2,u=R.detail.lngLat)}function P(R){u=R,n(2,u)}function N(R){y=R,n(3,y)}return e.$$set=R=>{"showSeverances"in R&&n(0,o=R.showSeverances),"opacity"in R&&n(1,l=R.opacity)},e.$$.update=()=>{if(e.$$.dirty&140&&u&&y)try{n(4,w=JSON.parse(r.compareRoute({x1:u.lng,y1:u.lat,x2:y.lng,y2:y.lat}))),n(5,S="")}catch(R){n(4,w=null),n(5,S=R.toString())}},[o,l,u,y,w,S,C,r,P,N]}class Xz extends an{constructor(t){super(),sn(this,t,Zz,Hz,Xe,{showSeverances:0,opacity:1})}}function Yz(e){let t,n,r;return n=new Kv({}),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"slot","top")},m(o,l){zt(o,t,l),we(n,t,null),r=!0},p:Me,i(o){r||(Dt(n.$$.fragment,o),r=!0)},o(o){qt(n.$$.fragment,o),r=!1},d(o){o&&Nt(t),Se(n)}}}function Kz(e){let t,n,r,o,l,h,u;return h=new MP({props:{colorScale:_S,limits:vS}}),{c(){t=jt("div"),n=jt("h2"),n.textContent="Score mode",r=ye(),o=jt("p"),o.innerHTML=`The desire lines are coloured based on their detour factor. Click one - to see the route`,l=ye(),Ie(h.$$.fragment),Vt(t,"slot","sidebar")},m(y,w){zt(y,t,w),Xt(t,n),Xt(t,r),Xt(t,o),Xt(t,l),we(h,t,null),u=!0},p:Me,i(y){u||(Dt(h.$$.fragment,y),u=!0)},o(y){qt(h.$$.fragment,y),u=!1},d(y){y&&Nt(t),Se(h)}}}function Jz(e){let t,n=e[7].score.toFixed(1)+"",r,o;return{c(){t=jt("span"),r=wn(n),o=wn("x"),Gr(t,"font-size","26px")},m(l,h){zt(l,t,h),Xt(t,r),Xt(t,o)},p(l,h){h&128&&n!==(n=l[7].score.toFixed(1)+"")&&Ui(r,n)},d(l){l&&Nt(t)}}}function Qz(e){let t,n;return t=new MI({props:{openOn:"hover",$$slots:{default:[Jz,({props:r})=>({7:r}),({props:r})=>r?128:0]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&384&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function $z(e){let t,n;return t=new Ad({props:{id:"scores",paint:{"line-width":8,"line-color":qN(["get","score"],vS,_S)},$$slots:{default:[Qz]},$$scope:{ctx:e}}}),t.$on("click",e[4]),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&256&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function W2(e){let t,n;return t=new Af({props:{data:e[2],$$slots:{default:[t5]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&4&&(l.data=r[2]),o&256&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function t5(e){let t,n;return t=new Ad({props:{id:"route",beforeId:"network",paint:{"line-width":20,"line-color":"cyan","line-opacity":.5}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p:Me,i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function e5(e){let t,n,r,o,l,h,u,y;n=new dS({}),n.$on("click",e[5]),o=new YI({props:{showSeverances:e[0],opacity:e[1]}}),h=new Af({props:{data:JSON.parse(rl(e[3]).makeHeatmap()),$$slots:{default:[$z]},$$scope:{ctx:e}}});let w=e[2]&&W2(e);return{c(){t=jt("div"),Ie(n.$$.fragment),r=ye(),Ie(o.$$.fragment),l=ye(),Ie(h.$$.fragment),u=ye(),w&&w.c(),Vt(t,"slot","map")},m(S,C){zt(S,t,C),we(n,t,null),Xt(t,r),we(o,t,null),Xt(t,l),we(h,t,null),Xt(t,u),w&&w.m(t,null),y=!0},p(S,C){const P={};C&1&&(P.showSeverances=S[0]),C&2&&(P.opacity=S[1]),o.$set(P);const N={};C&8&&(N.data=JSON.parse(rl(S[3]).makeHeatmap())),C&256&&(N.$$scope={dirty:C,ctx:S}),h.$set(N),S[2]?w?(w.p(S,C),C&4&&Dt(w,1)):(w=W2(S),w.c(),Dt(w,1),w.m(t,null)):w&&(ar(),qt(w,1,1,()=>{w=null}),lr())},i(S){y||(Dt(n.$$.fragment,S),Dt(o.$$.fragment,S),Dt(h.$$.fragment,S),Dt(w),y=!0)},o(S){qt(n.$$.fragment,S),qt(o.$$.fragment,S),qt(h.$$.fragment,S),qt(w),y=!1},d(S){S&&Nt(t),Se(n),Se(o),Se(h),w&&w.d()}}}function n5(e){let t,n;return t=new by({props:{$$slots:{map:[e5],sidebar:[Kz],top:[Yz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&271&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function r5(e,t,n){let r,o;Ge(e,xy,S=>n(6,r=S)),Ge(e,Kl,S=>n(3,o=S));let{showSeverances:l}=t,{opacity:h}=t,u=null;function y(S){try{let C=S.detail.features[0].geometry.coordinates;n(2,u=JSON.parse(o.compareRoute({x1:C[0][0],y1:C[0][1],x2:C[1][0],y2:C[1][1]})))}catch(C){window.alert(`No route: ${C}`),n(2,u=null)}}function w(S){r.queryRenderedFeatures(S.detail.point,{layers:["scores"]}).length>0||n(2,u=null)}return e.$$set=S=>{"showSeverances"in S&&n(0,l=S.showSeverances),"opacity"in S&&n(1,h=S.opacity)},[l,h,u,o,y,w]}class i5 extends an{constructor(t){super(),sn(this,t,r5,n5,Xe,{showSeverances:0,opacity:1})}}function o5(e){let t,n,r,o,l,h,u;return{c(){t=jt("button"),t.textContent="Import current view",n=ye(),r=jt("i"),r.textContent="or...",o=ye(),l=jt("button"),l.textContent="Draw an area to import on the map",Vt(t,"type","button"),Vt(l,"type","button")},m(y,w){zt(y,t,w),zt(y,n,w),zt(y,r,w),zt(y,o,w),zt(y,l,w),h||(u=[hn(t,"click",e[1]),hn(l,"click",e[2])],h=!0)},p:Me,i:Me,o:Me,d(y){y&&(Nt(t),Nt(n),Nt(r),Nt(o),Nt(l)),h=!1,oo(u)}}}function s5(e){let t,n;return t=new zO({props:{polygonTool:e[0]}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&1&&(l.polygonTool=r[0]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function a5(e){let t,n,r,o;const l=[s5,o5],h=[];function u(y,w){return y[0]?0:1}return t=u(e),n=h[t]=l[t](e),{c(){n.c(),r=so()},m(y,w){h[t].m(y,w),zt(y,r,w),o=!0},p(y,[w]){let S=t;t=u(y),t===S?h[t].p(y,w):(ar(),qt(h[S],1,1,()=>{h[S]=null}),lr(),n=h[t],n?n.p(y,w):(n=h[t]=l[t](y),n.c()),Dt(n,1),n.m(r.parentNode,r))},i(y){o||(Dt(n),o=!0)},o(y){qt(n),o=!1},d(y){y&&Nt(r),h[t].d(y)}}}function Xp(e){return[e.lng,e.lat]}function l5(e,t,n){let{map:r}=t;const o=Bu();let l=null;async function h(S){try{o("loading","Loading from Overpass");let P=await(await fetch(c5(S))).text();o("gotXml",P)}catch(C){o("error",C.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Xp(S.getSouthWest()),Xp(S.getNorthWest()),Xp(S.getNorthEast()),Xp(S.getSouthEast()),Xp(S.getSouthWest())]],type:"Polygon"}}}async function y(){if(r){if(r.getZoom()<13){o("error","Zoom in more to import");return}await h(u())}}function w(){r&&(n(0,l=new kO(r)),l.startNew(),l.addEventListenerSuccess(async S=>{n(0,l=null),await h(S)}),l.addEventListenerFailure(()=>{n(0,l=null)}))}return e.$$set=S=>{"map"in S&&n(3,r=S.map)},[l,y,w,r]}class u5 extends an{constructor(t){super(),sn(this,t,l5,a5,Xe,{map:3})}}function c5(e){let t='poly:"';for(let[r,o]of e.geometry.coordinates[0])t+=`${o} ${r} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function H2(e,t,n){const r=e.slice();return r[17]=t[n][0],r[18]=t[n][1],r}function Z2(e,t,n){const r=e.slice();return r[21]=t[n][0],r[22]=t[n][1],r}function X2(e){let t,n=e[22]+"",r,o;return{c(){t=jt("option"),r=wn(n),t.__value=o=e[21],wc(t,t.__value)},m(l,h){zt(l,t,h),Xt(t,r)},p(l,h){h&4&&n!==(n=l[22]+"")&&Ui(r,n),h&4&&o!==(o=l[21])&&(t.__value=o,wc(t,t.__value))},d(l){l&&Nt(t)}}}function Y2(e){let t,n,r=vo(e[18]),o=[];for(let l=0;le[7].call(h)),Vt(R,"type","file")},m(rt,mt){we(t,rt,mt),zt(rt,n,mt),zt(rt,r,mt),Xt(r,o),Xt(o,l),Xt(o,h),Xt(h,u);for(let Et=0;Etn(12,r=H)),Ge(e,Kl,H=>n(13,o=H)),Ge(e,xy,H=>n(4,l=H));let h="",u="",y=!1,w=[];K0(async()=>{try{let H=await fetch("/osm/areas.json");if(H.ok)y=!0,console.log("Using local cache, not od2net.org"),n(2,w=await H.json());else{let at=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await at.json())}}catch{}});let S;async function C(H){try{P(await S.files[0].arrayBuffer()),n(0,h="")}catch(at){window.alert(`Couldn't open this file: ${at}`)}n(1,u="")}function P(H){n(1,u="Building map model from OSM input"),console.time("load"),Ur(Kl,o=new lL(new Uint8Array(H),r),o),console.timeEnd("load")}function N(H){try{P(new TextEncoder().encode(H.detail)),n(0,h="")}catch(at){window.alert(`Couldn't import from Overpass: ${at}`)}n(1,u="")}async function R(H){H!=""&&(y?await J(`/osm/${H}.pbf`):await J(`https://assets.od2net.org/severance_pbfs/${H}.pbf`))}async function J(H){try{n(1,u=`Downloading ${H}`);let at=await fetch(H);P(await at.arrayBuffer())}catch(at){window.alert(`Couldn't open from URL ${H}: ${at}`)}n(1,u="")}function Y(){h=YT(this),n(0,h),n(2,w)}function K(H){fi[H?"unshift":"push"](()=>{S=H,n(3,S)})}const B=H=>n(1,u=H.detail),G=H=>window.alert(H.detail);return e.$$.update=()=>{e.$$.dirty&1&&R(h)},[h,u,w,S,l,C,N,Y,K,B,G]}class p5 extends an{constructor(t){super(),sn(this,t,f5,h5,Xe,{})}}function d5(e){let t;return{c(){t=jt("div"),Vt(t,"slot","top")},m(n,r){zt(n,t,r)},p:Me,d(n){n&&Nt(t)}}}function m5(e){let t;return{c(){t=jt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){zt(n,t,r)},i:Me,o:Me,d(n){n&&Nt(t)}}}function g5(e){let t,n;return t=new p5({}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function y5(e){let t,n,r,o,l,h,u,y,w,S,C,P,N,R,J;const Y=[g5,m5],K=[];function B(G,H){return G[1]&&G[0]?0:1}return o=B(e),l=K[o]=Y[o](e),{c(){t=jt("div"),n=jt("h2"),n.textContent="Choose your study area",r=ye(),l.c(),h=ye(),u=jt("div"),y=jt("label"),w=jt("input"),S=wn(` + to cancel`,h.disabled=u=e[1]==0,Gr(t,"display","flex"),Gr(t,"justify-content","space-between")},m(K,Y){zt(K,t,Y),Xt(t,n),Xt(t,r),Xt(t,i),Xt(t,l),Xt(t,h),N.m(h,null),zt(K,y,Y),zt(K,w,Y),S||(C=[un(n,"click",e[2]),un(i,"click",e[3]),un(h,"click",e[4])],S=!0)},p(K,[Y]){D===(D=P(K))&&N?N.p(K,Y):(N.d(1),N=D(K),N&&(N.c(),N.m(h,null))),Y&2&&u!==(u=K[1]==0)&&(h.disabled=u)},i:Ae,o:Ae,d(K){K&&(Nt(t),Nt(y),Nt(w)),N.d(),S=!1,oo(C)}}}function zO(e,t,n){let r;Ve(e,jI,y=>n(1,r=y));let{polygonTool:i}=t;const l=()=>i.finish(),h=()=>i.cancel(),u=()=>i.undo();return e.$$set=y=>{"polygonTool"in y&&n(0,i=y.polygonTool)},[i,r,l,h,u]}class FO extends an{constructor(t){super(),sn(this,t,zO,OO,Xe,{polygonTool:0})}}let BO=Date.now();function Gd(e){return`${e}-${BO++}`}const WI=Symbol.for("svelte-maplibre");function VO(){return $0(WI)}function L2(e){return{subscribe:e.subscribe}}function HI({key:e,setPopupTarget:t=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=VO(),l=Fr(null),h=L2(l),u={...i,[e]:L2(l)};if(t&&(u.popupTarget=h),r){let y=Fr(null);u.layerEvent=y,i.layerEvent=y}return n&&(u.cluster=Fr()),Q0(WI,u),{...i,self:l}}function UO(){return HI({key:"source",setCluster:!0})}function GO(e=!0){return HI({key:"layer",setPopupTarget:e,setMouseEvent:e})}function P2(e){let t;return n=>{if(n)for(let r in n){let i=t==null?void 0:t[r],l=n[r];i!==l&&e(r,l,i)}else if(t)for(let r in t)e(r,void 0,t[r]);t=n}}function qO(e,...t){let n=[e];for(let r of t)if(r)Array.isArray(r)&&r[0]===e?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function jO(e){return e===!0?["has","point_count"]:e===!1?["!",["has","point_count"]]:void 0}function M2(e){let t=e[0],n,r,i=A2(e);return{c(){i.c(),n=so()},m(l,h){i.m(l,h),zt(l,n,h),r=!0},p(l,h){h[0]&1&&Xe(t,t=l[0])?(ar(),jt(i,1,1,Ae),lr(),i=A2(l),i.c(),Dt(i,1),i.m(n.parentNode,n)):i.p(l,h)},i(l){r||(Dt(i),r=!0)},o(l){jt(i),r=!1},d(l){l&&Nt(n),i.d(l)}}}function A2(e){let t;const n=e[36].default,r=li(n,e,e[35],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l[1]&16)&&ci(r,n,i,i[35],t?ui(n,i[35],l,null):hi(i[35]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function WO(e){let t,n,r=e[0]&&M2(e);return{c(){r&&r.c(),t=so()},m(i,l){r&&r.m(i,l),zt(i,t,l),n=!0},p(i,l){i[0]?r?(r.p(i,l),l[0]&1&&Dt(r,1)):(r=M2(i),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function HO(e,t,n){let r,i,l,h,u,y,w,S,C,P,D,N,{$$slots:K={},$$scope:Y}=t,{id:J=Gd("layer")}=t,{source:B=void 0}=t,{sourceLayer:G=void 0}=t,{beforeId:H=void 0}=t,{beforeLayerType:at=void 0}=t,{type:gt}=t,{paint:ft=void 0}=t,{layout:rt=void 0}=t,{filter:mt=void 0}=t,{applyToClusters:Et=void 0}=t,{minzoom:$=void 0}=t,{maxzoom:Pt=void 0}=t,{manageHoverState:Qt=!1}=t,{hovered:Tt=null}=t,{interactive:re=!0}=t,{hoverCursor:fe=void 0}=t,{eventsIfTopMost:Wt=!1}=t;const Re=Vu(),{map:ze,source:We,self:Ue,minzoom:Ce,maxzoom:en,eventTopMost:An,layerInfo:dn}=GO();Ve(e,ze,nt=>n(31,C=nt)),Ve(e,We,nt=>n(32,P=nt)),Ve(e,Ue,nt=>n(0,S=nt)),Ve(e,Ce,nt=>n(34,N=nt)),Ve(e,en,nt=>n(33,D=nt)),ws(()=>{S&&C&&(dn.delete(S),C==null||C.removeLayer(S))});let cn;function kn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn={event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt};Re(nt.type,mn)}function Yn(nt){var Mt,He;if(!re||!S||!C||Wt&&An(nt)!==S)return;fe&&(C.getCanvas().style.cursor=fe);let xt=nt.features??[];n(6,Tt=xt[0]??null);let ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id;Re("mouseenter",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function Wr(nt){var Mt,He,Tr;if(!re||!C)return;if(Wt&&An(nt)!==S){n(6,Tt=null),Qt&&cn!==void 0&&(C==null||C.setFeatureState({source:u,sourceLayer:G,id:cn},{hover:!1}),cn=void 0);return}C.getCanvas().style.cursor=fe;let xt=nt.features??[],ce=(He=(Mt=xt[0])==null?void 0:Mt.properties)==null?void 0:He.cluster_id,mn=(Tr=xt[0])==null?void 0:Tr.id;mn!==cn&&(Qt&&(cn!==void 0&&(C==null||C.setFeatureState({source:u,id:cn,sourceLayer:G},{hover:!1})),C==null||C.setFeatureState({source:u,id:mn,sourceLayer:G},{hover:!0})),cn=mn,n(6,Tt=xt[0]??null)),Re("mousemove",{event:nt,map:C,clusterId:ce,layer:S,source:u,features:xt})}function hr(nt){if(!(!re||!S||!C)){if(fe&&(C.getCanvas().style.cursor=""),n(6,Tt=null),Qt&&cn!==void 0){const xt={source:u,id:cn,sourceLayer:G};C==null||C.setFeatureState(xt,{hover:!1}),cn=void 0}Re("mouseleave",{map:C,layer:S,source:u})}}let er=!0;function Kn(nt){C&&(C.off("click",nt,kn),C.off("dblclick",nt,kn),C.off("contextmenu",nt,kn),C.off("mouseenter",nt,Yn),C.off("mousemove",nt,Wr),C.off("mouseleave",nt,hr))}return ws(()=>{C&&S&&Kn(S)}),e.$$set=nt=>{"id"in nt&&n(7,J=nt.id),"source"in nt&&n(8,B=nt.source),"sourceLayer"in nt&&n(9,G=nt.sourceLayer),"beforeId"in nt&&n(10,H=nt.beforeId),"beforeLayerType"in nt&&n(11,at=nt.beforeLayerType),"type"in nt&&n(12,gt=nt.type),"paint"in nt&&n(13,ft=nt.paint),"layout"in nt&&n(14,rt=nt.layout),"filter"in nt&&n(15,mt=nt.filter),"applyToClusters"in nt&&n(16,Et=nt.applyToClusters),"minzoom"in nt&&n(17,$=nt.minzoom),"maxzoom"in nt&&n(18,Pt=nt.maxzoom),"manageHoverState"in nt&&n(19,Qt=nt.manageHoverState),"hovered"in nt&&n(6,Tt=nt.hovered),"interactive"in nt&&n(20,re=nt.interactive),"hoverCursor"in nt&&n(21,fe=nt.hoverCursor),"eventsIfTopMost"in nt&&n(22,Wt=nt.eventsIfTopMost),"$$scope"in nt&&n(35,Y=nt.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&65536&&n(30,r=jO(Et)),e.$$.dirty[0]&1073774592&&n(24,i=qO("all",r,mt)),e.$$.dirty[0]&131072|e.$$.dirty[1]&8&&n(26,l=$??N),e.$$.dirty[0]&262144|e.$$.dirty[1]&4&&n(25,h=Pt??D),e.$$.dirty[0]&256|e.$$.dirty[1]&2&&n(29,u=B||P),e.$$.dirty[0]&654343809|e.$$.dirty[1]&1&&C&&S!==J&&u){S&&(Kn(S),dn.delete(S));let nt=H;if(!H&&at){let xt=C.getStyle().layers,ce=typeof at=="function"?at:Mt=>Mt.type===at,mn=xt==null?void 0:xt.find(ce);mn&&(nt=mn.id)}Ar(Ue,S=J,S),C.addLayer(Sc({id:S,type:gt,source:u,"source-layer":G,filter:i,paint:ft,layout:rt,minzoom:l,maxzoom:h}),nt),n(23,er=!0),C.on("click",S,kn),C.on("dblclick",S,kn),C.on("contextmenu",S,kn),C.on("mouseenter",S,Yn),C.on("mousemove",S,Wr),C.on("mouseleave",S,hr)}e.$$.dirty[0]&1048577&&S&&dn.set(S,{interactive:re}),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(28,y=S?P2((nt,xt)=>C==null?void 0:C.setPaintProperty(S,nt,xt)):void 0),e.$$.dirty[0]&1|e.$$.dirty[1]&1&&n(27,w=S?P2((nt,xt)=>C==null?void 0:C.setLayoutProperty(S,nt,xt)):void 0),e.$$.dirty[0]&268443648&&(y==null||y(ft)),e.$$.dirty[0]&134234112&&(w==null||w(rt)),e.$$.dirty[0]&100663297|e.$$.dirty[1]&1&&S&&(C==null||C.setLayerZoomRange(S,l,h)),e.$$.dirty[0]&25165825|e.$$.dirty[1]&1&&S&&(er?n(23,er=!1):C==null||C.setFilter(S,i))},[S,ze,We,Ue,Ce,en,Tt,J,B,G,H,at,gt,ft,rt,mt,Et,$,Pt,Qt,re,fe,Wt,er,i,h,l,w,y,u,r,C,P,D,N,Y,K]}class Kv extends an{constructor(t){super(),sn(this,t,HO,WO,Xe,{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 ZO(e){let t;const n=e[16].default,r=li(n,e,e[24],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&16777216)&&ci(r,n,i,i[24],t?ui(n,i[24],l,null):hi(i[24]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function XO(e){let t,n,r;function i(h){e[17](h)}let l={id:e[1],type:"circle",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],applyToClusters:e[9],minzoom:e[10],maxzoom:e[11],hoverCursor:e[12],manageHoverState:e[13],eventsIfTopMost:e[14],interactive:e[15],$$slots:{default:[ZO]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new Kv({props:l}),fi.push(()=>Pu(t,"hovered",i)),t.$on("click",e[18]),t.$on("dblclick",e[19]),t.$on("contextmenu",e[20]),t.$on("mouseenter",e[21]),t.$on("mousemove",e[22]),t.$on("mouseleave",e[23]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.applyToClusters=h[9]),u&1024&&(y.minzoom=h[10]),u&2048&&(y.maxzoom=h[11]),u&4096&&(y.hoverCursor=h[12]),u&8192&&(y.manageHoverState=h[13]),u&16384&&(y.eventsIfTopMost=h[14]),u&32768&&(y.interactive=h[15]),u&16777216&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Lu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){jt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function YO(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:l=Gd("circle")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{applyToClusters:D=void 0}=t,{minzoom:N=void 0}=t,{maxzoom:K=void 0}=t,{hoverCursor:Y=void 0}=t,{manageHoverState:J=!1}=t,{hovered:B=null}=t,{eventsIfTopMost:G=!1}=t,{interactive:H=!0}=t;function at(Pt){B=Pt,n(0,B)}function gt(Pt){Nn.call(this,e,Pt)}function ft(Pt){Nn.call(this,e,Pt)}function rt(Pt){Nn.call(this,e,Pt)}function mt(Pt){Nn.call(this,e,Pt)}function Et(Pt){Nn.call(this,e,Pt)}function $(Pt){Nn.call(this,e,Pt)}return e.$$set=Pt=>{"id"in Pt&&n(1,l=Pt.id),"source"in Pt&&n(2,h=Pt.source),"sourceLayer"in Pt&&n(3,u=Pt.sourceLayer),"beforeId"in Pt&&n(4,y=Pt.beforeId),"beforeLayerType"in Pt&&n(5,w=Pt.beforeLayerType),"paint"in Pt&&n(6,S=Pt.paint),"layout"in Pt&&n(7,C=Pt.layout),"filter"in Pt&&n(8,P=Pt.filter),"applyToClusters"in Pt&&n(9,D=Pt.applyToClusters),"minzoom"in Pt&&n(10,N=Pt.minzoom),"maxzoom"in Pt&&n(11,K=Pt.maxzoom),"hoverCursor"in Pt&&n(12,Y=Pt.hoverCursor),"manageHoverState"in Pt&&n(13,J=Pt.manageHoverState),"hovered"in Pt&&n(0,B=Pt.hovered),"eventsIfTopMost"in Pt&&n(14,G=Pt.eventsIfTopMost),"interactive"in Pt&&n(15,H=Pt.interactive),"$$scope"in Pt&&n(24,i=Pt.$$scope)},[B,l,h,u,y,w,S,C,P,D,N,K,Y,J,G,H,r,at,gt,ft,rt,mt,Et,$,i]}class KO extends an{constructor(t){super(),sn(this,t,YO,XO,Xe,{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 JO(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,i,i[23],t?ui(n,i[23],l,null):hi(i[23]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function QO(e){let t,n,r;function i(h){e[16](h)}let l={id:e[1],type:"fill",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[JO]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new Kv({props:l}),fi.push(()=>Pu(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Lu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){jt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function $O(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:l=Gd("fill")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:K=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:J=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){J=$,n(0,J)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,D=$.minzoom),"maxzoom"in $&&n(10,N=$.maxzoom),"hoverCursor"in $&&n(11,K=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,J=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,i=$.$$scope)},[J,l,h,u,y,w,S,C,P,D,N,K,Y,B,G,r,H,at,gt,ft,rt,mt,Et,i]}class tz extends an{constructor(t){super(),sn(this,t,$O,QO,Xe,{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 ez(e,t,n,r,i){let l=!1;e.getSource(t)&&(l=!0,e.removeSource(t));const h=()=>{r(t)&&(e.addSource(t,n),i())};if(l){const u=()=>{t&&(e.getSource(t)?setTimeout(u,1):h())};u()}else h()}function nz(e,t,n){sS().then(()=>{let r=K0(e);if(!r)return;r.getSource(t)===n&&r.removeSource(t)})}function k2(e){let t=e[0],n,r,i=D2(e);return{c(){i.c(),n=so()},m(l,h){i.m(l,h),zt(l,n,h),r=!0},p(l,h){h&1&&Xe(t,t=l[0])?(ar(),jt(i,1,1,Ae),lr(),i=D2(l),i.c(),Dt(i,1),i.m(n.parentNode,n)):i.p(l,h)},i(l){r||(Dt(i),r=!0)},o(l){jt(i),r=!1},d(l){l&&Nt(n),i.d(l)}}}function D2(e){let t;const n=e[15].default,r=li(n,e,e[14],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&16384)&&ci(r,n,i,i[14],t?ui(n,i[14],l,null):hi(i[14]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function rz(e){let t,n,r=e[0]&&k2(e);return{c(){r&&r.c(),t=so()},m(i,l){r&&r.m(i,l),zt(i,t,l),n=!0},p(i,[l]){i[0]?r?(r.p(i,l),l&1&&Dt(r,1)):(r=k2(i),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function iz(e,t,n){let r,i,l,{$$slots:h={},$$scope:u}=t,{id:y=Gd("geojson")}=t,{data:w}=t,{generateId:S=!1}=t,{promoteId:C=void 0}=t,{filter:P=void 0}=t,{lineMetrics:D=void 0}=t,{cluster:N=void 0}=t;const{map:K,cluster:Y,self:J}=UO();Ve(e,K,H=>n(13,i=H)),Ve(e,Y,H=>n(16,l=H)),Ve(e,J,H=>n(0,r=H));let B,G=!0;return ws(()=>{r&&B&&i&&(nz(K,r,B),Ar(J,r=null,r),n(11,B=void 0))}),e.$$set=H=>{"id"in H&&n(4,y=H.id),"data"in H&&n(5,w=H.data),"generateId"in H&&n(6,S=H.generateId),"promoteId"in H&&n(7,C=H.promoteId),"filter"in H&&n(8,P=H.filter),"lineMetrics"in H&&n(9,D=H.lineMetrics),"cluster"in H&&n(10,N=H.cluster),"$$scope"in H&&n(14,u=H.$$scope)},e.$$.update=()=>{e.$$.dirty&1024&&Ar(Y,l=N,l),e.$$.dirty&12273&&i&&r!==y&&(Ar(J,r=y,r),ez(i,r,Sc({type:"geojson",data:w,filter:P,lineMetrics:D,generateId:S,promoteId:C,cluster:!!N,clusterMinPoints:N==null?void 0:N.minPoints,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius,clusterProperties:N==null?void 0:N.properties}),H=>i&&H===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,G=!0))})),e.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(y))})),e.$$.dirty&6176&&B&&(G?n(12,G=!1):B.setData(w)),e.$$.dirty&3072&&(B==null||B.setClusterOptions(Sc({cluster:!!N,clusterMaxZoom:N==null?void 0:N.maxZoom,clusterRadius:N==null?void 0:N.radius})))},[r,K,Y,J,y,w,S,C,P,D,N,B,G,i,u,h]}class oz extends an{constructor(t){super(),sn(this,t,iz,rz,Xe,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function sz(e){let t;const n=e[15].default,r=li(n,e,e[23],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),t=!0},p(i,l){r&&r.p&&(!t||l&8388608)&&ci(r,n,i,i[23],t?ui(n,i[23],l,null):hi(i[23]),null)},i(i){t||(Dt(r,i),t=!0)},o(i){jt(r,i),t=!1},d(i){r&&r.d(i)}}}function az(e){let t,n,r;function i(h){e[16](h)}let l={id:e[1],type:"line",source:e[2],sourceLayer:e[3],beforeId:e[4],beforeLayerType:e[5],paint:e[6],layout:e[7],filter:e[8],minzoom:e[9],maxzoom:e[10],hoverCursor:e[11],manageHoverState:e[12],eventsIfTopMost:e[13],interactive:e[14],$$slots:{default:[sz]},$$scope:{ctx:e}};return e[0]!==void 0&&(l.hovered=e[0]),t=new Kv({props:l}),fi.push(()=>Pu(t,"hovered",i)),t.$on("click",e[17]),t.$on("dblclick",e[18]),t.$on("contextmenu",e[19]),t.$on("mouseenter",e[20]),t.$on("mousemove",e[21]),t.$on("mouseleave",e[22]),{c(){Ie(t.$$.fragment)},m(h,u){we(t,h,u),r=!0},p(h,[u]){const y={};u&2&&(y.id=h[1]),u&4&&(y.source=h[2]),u&8&&(y.sourceLayer=h[3]),u&16&&(y.beforeId=h[4]),u&32&&(y.beforeLayerType=h[5]),u&64&&(y.paint=h[6]),u&128&&(y.layout=h[7]),u&256&&(y.filter=h[8]),u&512&&(y.minzoom=h[9]),u&1024&&(y.maxzoom=h[10]),u&2048&&(y.hoverCursor=h[11]),u&4096&&(y.manageHoverState=h[12]),u&8192&&(y.eventsIfTopMost=h[13]),u&16384&&(y.interactive=h[14]),u&8388608&&(y.$$scope={dirty:u,ctx:h}),!n&&u&1&&(n=!0,y.hovered=h[0],Lu(()=>n=!1)),t.$set(y)},i(h){r||(Dt(t.$$.fragment,h),r=!0)},o(h){jt(t.$$.fragment,h),r=!1},d(h){Se(t,h)}}}function lz(e,t,n){let{$$slots:r={},$$scope:i}=t,{id:l=Gd("line")}=t,{source:h=void 0}=t,{sourceLayer:u=void 0}=t,{beforeId:y=void 0}=t,{beforeLayerType:w=void 0}=t,{paint:S}=t,{layout:C=void 0}=t,{filter:P=void 0}=t,{minzoom:D=void 0}=t,{maxzoom:N=void 0}=t,{hoverCursor:K=void 0}=t,{manageHoverState:Y=!1}=t,{hovered:J=null}=t,{eventsIfTopMost:B=!1}=t,{interactive:G=!0}=t;function H($){J=$,n(0,J)}function at($){Nn.call(this,e,$)}function gt($){Nn.call(this,e,$)}function ft($){Nn.call(this,e,$)}function rt($){Nn.call(this,e,$)}function mt($){Nn.call(this,e,$)}function Et($){Nn.call(this,e,$)}return e.$$set=$=>{"id"in $&&n(1,l=$.id),"source"in $&&n(2,h=$.source),"sourceLayer"in $&&n(3,u=$.sourceLayer),"beforeId"in $&&n(4,y=$.beforeId),"beforeLayerType"in $&&n(5,w=$.beforeLayerType),"paint"in $&&n(6,S=$.paint),"layout"in $&&n(7,C=$.layout),"filter"in $&&n(8,P=$.filter),"minzoom"in $&&n(9,D=$.minzoom),"maxzoom"in $&&n(10,N=$.maxzoom),"hoverCursor"in $&&n(11,K=$.hoverCursor),"manageHoverState"in $&&n(12,Y=$.manageHoverState),"hovered"in $&&n(0,J=$.hovered),"eventsIfTopMost"in $&&n(13,B=$.eventsIfTopMost),"interactive"in $&&n(14,G=$.interactive),"$$scope"in $&&n(23,i=$.$$scope)},[J,l,h,u,y,w,S,C,P,D,N,K,Y,B,G,r,H,at,gt,ft,rt,mt,Et,i]}class uz extends an{constructor(t){super(),sn(this,t,lz,az,Xe,{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 cz(e){let t,n,r,i,l,h;return t=new tz({props:{id:"edit-polygon-fill",filter:PO,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new uz({props:{id:"edit-polygon-lines",filter:MO,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),l=new KO({props:{id:"edit-polygon-vertices",filter:AO,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){Ie(t.$$.fragment),n=ye(),Ie(r.$$.fragment),i=ye(),Ie(l.$$.fragment)},m(u,y){we(t,u,y),zt(u,n,y),we(r,u,y),zt(u,i,y),we(l,u,y),h=!0},p:Ae,i(u){h||(Dt(t.$$.fragment,u),Dt(r.$$.fragment,u),Dt(l.$$.fragment,u),h=!0)},o(u){jt(t.$$.fragment,u),jt(r.$$.fragment,u),jt(l.$$.fragment,u),h=!1},d(u){u&&(Nt(n),Nt(i)),Se(t,u),Se(r,u),Se(l,u)}}}function hz(e){let t,n;return t=new oz({props:{data:e[0],$$slots:{default:[cz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&1&&(l.data=r[0]),i&2&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function fz(e,t,n){let r;return Ve(e,qI,i=>n(0,r=i)),[r]}class ZI extends an{constructor(t){super(),sn(this,t,fz,hz,Xe,{})}}const pz=e=>({}),R2=e=>({}),dz=e=>({}),N2=e=>({}),mz=e=>({}),O2=e=>({});function gz(e){let t,n,r,i,l,h;const u=e[1].top,y=li(u,e,e[0],O2),w=e[1].left,S=li(w,e,e[0],N2),C=e[1].main,P=li(C,e,e[0],R2);return{c(){t=qt("div"),y&&y.c(),n=ye(),r=qt("div"),S&&S.c(),i=ye(),l=qt("div"),P&&P.c(),Vt(t,"class","top svelte-mpick2"),Vt(r,"class","left svelte-mpick2"),Vt(l,"class","main svelte-mpick2")},m(D,N){zt(D,t,N),y&&y.m(t,null),zt(D,n,N),zt(D,r,N),S&&S.m(r,null),zt(D,i,N),zt(D,l,N),P&&P.m(l,null),h=!0},p(D,[N]){y&&y.p&&(!h||N&1)&&ci(y,u,D,D[0],h?ui(u,D[0],N,mz):hi(D[0]),O2),S&&S.p&&(!h||N&1)&&ci(S,w,D,D[0],h?ui(w,D[0],N,dz):hi(D[0]),N2),P&&P.p&&(!h||N&1)&&ci(P,C,D,D[0],h?ui(C,D[0],N,pz):hi(D[0]),R2)},i(D){h||(Dt(y,D),Dt(S,D),Dt(P,D),h=!0)},o(D){jt(y,D),jt(S,D),jt(P,D),h=!1},d(D){D&&(Nt(t),Nt(n),Nt(r),Nt(i),Nt(l)),y&&y.d(D),S&&S.d(D),P&&P.d(D)}}}function yz(e,t,n){let{$$slots:r={},$$scope:i}=t;return e.$$set=l=>{"$$scope"in l&&n(0,i=l.$$scope)},[i,r]}class _z extends an{constructor(t){super(),sn(this,t,yz,gz,Xe,{})}}const vz=e=>({}),z2=e=>({}),bz=e=>({}),F2=e=>({}),xz=e=>({}),B2=e=>({});function wz(e){let t,n,r,i,l,h;const u=e[4].top,y=li(u,e,e[3],B2),w=e[4].sidebar,S=li(w,e,e[3],F2),C=e[4].map,P=li(C,e,e[3],z2);return{c(){t=qt("div"),y&&y.c(),n=ye(),r=qt("div"),S&&S.c(),i=ye(),l=qt("div"),P&&P.c()},m(D,N){zt(D,t,N),y&&y.m(t,null),e[5](t),zt(D,n,N),zt(D,r,N),S&&S.m(r,null),e[6](r),zt(D,i,N),zt(D,l,N),P&&P.m(l,null),e[7](l),h=!0},p(D,[N]){y&&y.p&&(!h||N&8)&&ci(y,u,D,D[3],h?ui(u,D[3],N,xz):hi(D[3]),B2),S&&S.p&&(!h||N&8)&&ci(S,w,D,D[3],h?ui(w,D[3],N,bz):hi(D[3]),F2),P&&P.p&&(!h||N&8)&&ci(P,C,D,D[3],h?ui(C,D[3],N,vz):hi(D[3]),z2)},i(D){h||(Dt(y,D),Dt(S,D),Dt(P,D),h=!0)},o(D){jt(y,D),jt(S,D),jt(P,D),h=!1},d(D){D&&(Nt(t),Nt(n),Nt(r),Nt(i),Nt(l)),y&&y.d(D),e[5](null),S&&S.d(D),e[6](null),P&&P.d(D),e[7](null)}}}function Sz(e,t,n){let r,i,l;Ve(e,H0,C=>n(0,r=C)),Ve(e,Z0,C=>n(1,i=C)),Ve(e,X0,C=>n(2,l=C));let{$$slots:h={},$$scope:u}=t;function y(C){fi[C?"unshift":"push"](()=>{r=C,H0.set(r)})}function w(C){fi[C?"unshift":"push"](()=>{i=C,Z0.set(i)})}function S(C){fi[C?"unshift":"push"](()=>{l=C,X0.set(l)})}return e.$$set=C=>{"$$scope"in C&&n(3,u=C.$$scope)},[r,i,l,u,h,y,w,S]}class by extends an{constructor(t){super(),sn(this,t,Sz,wz,Xe,{})}}let H0=Fr(null),Z0=Fr(null),X0=Fr(null),XI="MZEJTanw3WpxRvt7qDfo",zl=Fr({kind:"title"}),hl=Fr(null),xy=Fr(null),Kg=Fr(!0),Y0=Fr(!0);function YI(){let e=Array.from(K0(hl).getBounds());return{kind:"route",route_a:[og(.4,e[0],e[2]),og(.4,e[1],e[3])],route_b:[og(.6,e[0],e[2]),og(.6,e[1],e[3])]}}function og(e,t,n){return t+e*(n-t)}function Ez(e){let t,n,r,i,l,h,u,y,w,S,C,P,D,N,K,Y,J,B,G,H,at;return{c(){t=qt("nav"),n=qt("ul"),r=qt("li"),i=qt("button"),i.textContent="Change study area",l=ye(),h=qt("li"),u=qt("button"),y=yn("Score"),S=ye(),C=qt("li"),P=qt("button"),D=yn("Route"),K=ye(),Y=qt("li"),J=qt("button"),B=yn("Debug network"),u.disabled=w=e[0].kind=="score",P.disabled=N=e[0].kind=="route",J.disabled=G=e[0].kind=="debug"},m(gt,ft){zt(gt,t,ft),Xt(t,n),Xt(n,r),Xt(r,i),Xt(n,l),Xt(n,h),Xt(h,u),Xt(u,y),Xt(n,S),Xt(n,C),Xt(C,P),Xt(P,D),Xt(n,K),Xt(n,Y),Xt(Y,J),Xt(J,B),H||(at=[un(i,"click",e[1]),un(u,"click",e[2]),un(P,"click",e[3]),un(J,"click",e[4])],H=!0)},p(gt,[ft]){ft&1&&w!==(w=gt[0].kind=="score")&&(u.disabled=w),ft&1&&N!==(N=gt[0].kind=="route")&&(P.disabled=N),ft&1&&G!==(G=gt[0].kind=="debug")&&(J.disabled=G)},i:Ae,o:Ae,d(gt){gt&&Nt(t),H=!1,oo(at)}}}function Iz(e,t,n){let r;return Ve(e,zl,y=>n(0,r=y)),[r,()=>Ar(zl,r={kind:"title"},r),()=>Ar(zl,r={kind:"score"},r),()=>Ar(zl,r=YI(),r),()=>Ar(zl,r={kind:"debug"},r)]}class Jv extends an{constructor(t){super(),sn(this,t,Iz,Ez,Xe,{})}}function Cz(e){let t,n,r;return n=new Jv({}),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"slot","top")},m(i,l){zt(i,t,l),we(n,t,null),r=!0},p:Ae,i(i){r||(Dt(n.$$.fragment,i),r=!0)},o(i){jt(n.$$.fragment,i),r=!1},d(i){i&&Nt(t),Se(n)}}}function Tz(e){let t;return{c(){t=qt("div"),t.innerHTML="

    Debug mode

    Hover to see a segment's properties, and click to open OSM

    ",Vt(t,"slot","sidebar")},m(n,r){zt(n,t,r)},p:Ae,d(n){n&&Nt(t)}}}function Lz(e){let t,n,r=e[4].kind+"",i,l,h,u;return h=new CP({props:{properties:e[4]}}),{c(){t=qt("h2"),n=yn("Classified as "),i=yn(r),l=ye(),Ie(h.$$.fragment)},m(y,w){zt(y,t,w),Xt(t,n),Xt(t,i),zt(y,l,w),we(h,y,w),u=!0},p(y,w){(!u||w&16)&&r!==(r=y[4].kind+"")&&Ui(i,r);const S={};w&16&&(S.properties=y[4]),h.$set(S)},i(y){u||(Dt(h.$$.fragment,y),u=!0)},o(y){jt(h.$$.fragment,y),u=!1},d(y){y&&(Nt(t),Nt(l)),Se(h,y)}}}function Pz(e){let t,n;return t=new MI({props:{openOn:"hover",$$slots:{default:[Lz,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&48&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Mz(e){let t,n;return t=new Ad({props:{id:"network",paint:{"line-width":Ab(5,7),"line-color":Iu(["get","kind"],Qa,"yellow"),"line-opacity":e[0]?e[1]/100:Iu(["get","kind"],{Severance:0},e[1]/100)},manageHoverState:!0,hoverCursor:"pointer",$$slots:{default:[Pz]},$$scope:{ctx:e}}}),t.$on("click",e[3]),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&3&&(l.paint={"line-width":Ab(5,7),"line-color":Iu(["get","kind"],Qa,"yellow"),"line-opacity":r[0]?r[1]/100:Iu(["get","kind"],{Severance:0},r[1]/100)}),i&32&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Az(e){let t,n,r;return n=new Af({props:{data:JSON.parse(rl(e[2]).render()),generateId:!0,$$slots:{default:[Mz]},$$scope:{ctx:e}}}),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"slot","map")},m(i,l){zt(i,t,l),we(n,t,null),r=!0},p(i,l){const h={};l&4&&(h.data=JSON.parse(rl(i[2]).render())),l&35&&(h.$$scope={dirty:l,ctx:i}),n.$set(h)},i(i){r||(Dt(n.$$.fragment,i),r=!0)},o(i){jt(n.$$.fragment,i),r=!1},d(i){i&&Nt(t),Se(n)}}}function kz(e){let t,n;return t=new by({props:{$$slots:{map:[Az],sidebar:[Tz],top:[Cz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&39&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Dz(e,t,n){let r;Ve(e,hl,u=>n(2,r=u));let{showSeverances:i}=t,{opacity:l}=t;const h=u=>window.open(rl(u.detail.features[0].properties).way,"_blank");return e.$$set=u=>{"showSeverances"in u&&n(0,i=u.showSeverances),"opacity"in u&&n(1,l=u.opacity)},[i,l,r,h]}class Rz extends an{constructor(t){super(),sn(this,t,Dz,kz,Xe,{showSeverances:0,opacity:1})}}function V2(e,t,n){const r=e.slice();return r[2]=t[n],r}function U2(e){let t,n,r=G2(e[2])+"",i,l;return{c(){t=qt("li"),n=qt("a"),l=ye(),Vt(n,"href",i=rl(e[2].properties).way),Vt(n,"target","_blank")},m(h,u){zt(h,t,u),Xt(t,n),n.innerHTML=r,Xt(t,l)},p(h,u){u&1&&r!==(r=G2(h[2])+"")&&(n.innerHTML=r),u&1&&i!==(i=rl(h[2].properties).way)&&Vt(n,"href",i)},d(h){h&&Nt(t)}}}function Nz(e){let t,n,r,i=(e[0].route_length/e[0].direct_length).toFixed(1)+"",l,h,u,y,w,S=e[1](e[0])+"",C,P,D,N,K=vo(e[0].features),Y=[];for(let J=0;J{"route_gj"in l&&n(0,r=l.route_gj)},[r,i]}class zz extends an{constructor(t){super(),sn(this,t,Oz,Nz,Xe,{route_gj:0})}}function Fz(e){let t,n;return t=new Ad({props:{id:"network",paint:{"line-width":5,"line-color":Iu(["get","kind"],Qa,"yellow"),"line-opacity":e[0]?e[1]/100:Iu(["get","kind"],{Severance:0},e[1]/100)}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&3&&(l.paint={"line-width":5,"line-color":Iu(["get","kind"],Qa,"yellow"),"line-opacity":r[0]?r[1]/100:Iu(["get","kind"],{Severance:0},r[1]/100)}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Bz(e){let t,n;return t=new Af({props:{data:JSON.parse(rl(e[2]).render()),$$slots:{default:[Fz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&4&&(l.data=JSON.parse(rl(r[2]).render())),i&11&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Vz(e,t,n){let r;Ve(e,hl,h=>n(2,r=h));let{showSeverances:i}=t,{opacity:l}=t;return e.$$set=h=>{"showSeverances"in h&&n(0,i=h.showSeverances),"opacity"in h&&n(1,l=h.opacity)},[i,l,r]}class KI extends an{constructor(t){super(),sn(this,t,Vz,Bz,Xe,{showSeverances:0,opacity:1})}}function Uz(e){let t,n,r;return n=new Jv({}),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"slot","top")},m(i,l){zt(i,t,l),we(n,t,null),r=!0},p:Ae,i(i){r||(Dt(n.$$.fragment,i),r=!0)},o(i){jt(n.$$.fragment,i),r=!1},d(i){i&&Nt(t),Se(n)}}}function q2(e){let t,n;return{c(){t=qt("p"),n=yn(e[5])},m(r,i){zt(r,t,i),Xt(t,n)},p(r,i){i&32&&Ui(n,r[5])},d(r){r&&Nt(t)}}}function j2(e){let t,n;return t=new zz({props:{route_gj:e[4]}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&16&&(l.route_gj=r[4]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Gz(e){let t,n,r,i,l,h,u,y=e[5]&&q2(e),w=e[4]&&j2(e);return{c(){t=qt("div"),n=qt("h2"),n.textContent="Route mode",r=ye(),i=qt("p"),i.innerHTML=`Move the A and B pins to find a walking route. (Hint: right-click + to set the first pin somewhere.)`,l=ye(),y&&y.c(),h=ye(),w&&w.c(),Vt(t,"slot","sidebar")},m(S,C){zt(S,t,C),Xt(t,n),Xt(t,r),Xt(t,i),Xt(t,l),y&&y.m(t,null),Xt(t,h),w&&w.m(t,null),u=!0},p(S,C){S[5]?y?y.p(S,C):(y=q2(S),y.c(),y.m(t,h)):y&&(y.d(1),y=null),S[4]?w?(w.p(S,C),C&16&&Dt(w,1)):(w=j2(S),w.c(),Dt(w,1),w.m(t,null)):w&&(ar(),jt(w,1,1,()=>{w=null}),lr())},i(S){u||(Dt(w),u=!0)},o(S){jt(w),u=!1},d(S){S&&Nt(t),y&&y.d(),w&&w.d()}}}function qz(e){let t;return{c(){t=qt("span"),t.textContent="A",Vt(t,"class","dot svelte-1ej0v4r")},m(n,r){zt(n,t,r)},p:Ae,d(n){n&&Nt(t)}}}function jz(e){let t;return{c(){t=qt("span"),t.textContent="B",Vt(t,"class","dot svelte-1ej0v4r")},m(n,r){zt(n,t,r)},p:Ae,d(n){n&&Nt(t)}}}function W2(e){let t,n;return t=new Af({props:{data:e[4],$$slots:{default:[Wz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&16&&(l.data=r[4]),i&1024&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Wz(e){let t,n;return t=new Ad({props:{id:"route",beforeId:"network",paint:{"line-width":20,"line-color":"cyan","line-opacity":.5}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p:Ae,i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Hz(e){let t,n,r,i,l,h,u,y,w,S,C,P;n=new dS({}),n.$on("contextmenu",e[6]),i=new KI({props:{showSeverances:e[2],opacity:e[3]}});function D(B){e[8](B)}let N={draggable:!0,$$slots:{default:[qz]},$$scope:{ctx:e}};e[0]!==void 0&&(N.lngLat=e[0]),h=new Ub({props:N}),fi.push(()=>Pu(h,"lngLat",D));function K(B){e[9](B)}let Y={draggable:!0,$$slots:{default:[jz]},$$scope:{ctx:e}};e[1]!==void 0&&(Y.lngLat=e[1]),w=new Ub({props:Y}),fi.push(()=>Pu(w,"lngLat",K));let J=e[4]&&W2(e);return{c(){t=qt("div"),Ie(n.$$.fragment),r=ye(),Ie(i.$$.fragment),l=ye(),Ie(h.$$.fragment),y=ye(),Ie(w.$$.fragment),C=ye(),J&&J.c(),Vt(t,"slot","map")},m(B,G){zt(B,t,G),we(n,t,null),Xt(t,r),we(i,t,null),Xt(t,l),we(h,t,null),Xt(t,y),we(w,t,null),Xt(t,C),J&&J.m(t,null),P=!0},p(B,G){const H={};G&4&&(H.showSeverances=B[2]),G&8&&(H.opacity=B[3]),i.$set(H);const at={};G&1024&&(at.$$scope={dirty:G,ctx:B}),!u&&G&1&&(u=!0,at.lngLat=B[0],Lu(()=>u=!1)),h.$set(at);const gt={};G&1024&&(gt.$$scope={dirty:G,ctx:B}),!S&&G&2&&(S=!0,gt.lngLat=B[1],Lu(()=>S=!1)),w.$set(gt),B[4]?J?(J.p(B,G),G&16&&Dt(J,1)):(J=W2(B),J.c(),Dt(J,1),J.m(t,null)):J&&(ar(),jt(J,1,1,()=>{J=null}),lr())},i(B){P||(Dt(n.$$.fragment,B),Dt(i.$$.fragment,B),Dt(h.$$.fragment,B),Dt(w.$$.fragment,B),Dt(J),P=!0)},o(B){jt(n.$$.fragment,B),jt(i.$$.fragment,B),jt(h.$$.fragment,B),jt(w.$$.fragment,B),jt(J),P=!1},d(B){B&&Nt(t),Se(n),Se(i),Se(h),Se(w),J&&J.d()}}}function Zz(e){let t,n;return t=new by({props:{$$slots:{map:[Hz],sidebar:[Gz],top:[Uz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&1087&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function Xz(e,t,n){let r;Ve(e,hl,D=>n(7,r=D));let{route_a:i}=t,{route_b:l}=t,{showSeverances:h}=t,{opacity:u}=t,y=null,w="";function S(D){n(0,i=D.detail.lngLat.toArray())}function C(D){i=D,n(0,i)}function P(D){l=D,n(1,l)}return e.$$set=D=>{"route_a"in D&&n(0,i=D.route_a),"route_b"in D&&n(1,l=D.route_b),"showSeverances"in D&&n(2,h=D.showSeverances),"opacity"in D&&n(3,u=D.opacity)},e.$$.update=()=>{if(e.$$.dirty&131&&i&&l)try{n(4,y=JSON.parse(r.compareRoute({x1:i[0],y1:i[1],x2:l[0],y2:l[1]}))),n(5,w="")}catch(D){n(4,y=null),n(5,w=D.toString())}},[i,l,h,u,y,w,S,r,C,P]}class Yz extends an{constructor(t){super(),sn(this,t,Xz,Zz,Xe,{route_a:0,route_b:1,showSeverances:2,opacity:3})}}function Kz(e){let t,n,r;return n=new Jv({}),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"slot","top")},m(i,l){zt(i,t,l),we(n,t,null),r=!0},p:Ae,i(i){r||(Dt(n.$$.fragment,i),r=!0)},o(i){jt(n.$$.fragment,i),r=!1},d(i){i&&Nt(t),Se(n)}}}function Jz(e){let t,n,r,i,l,h,u,y,w,S,C,P,D;return h=new AP({props:{colorScale:_S,limits:vS}}),{c(){t=qt("div"),n=qt("h2"),n.textContent="Score mode",r=ye(),i=qt("p"),i.innerHTML=`The desire lines are coloured based on their detour factor. Click one + to see the route`,l=ye(),Ie(h.$$.fragment),u=ye(),y=qt("button"),w=yn("See this route in detail"),y.disabled=S=e[2]==null,Vt(t,"slot","sidebar")},m(N,K){zt(N,t,K),Xt(t,n),Xt(t,r),Xt(t,i),Xt(t,l),we(h,t,null),Xt(t,u),Xt(t,y),Xt(y,w),C=!0,P||(D=un(y,"click",e[7]),P=!0)},p(N,K){(!C||K&4&&S!==(S=N[2]==null))&&(y.disabled=S)},i(N){C||(Dt(h.$$.fragment,N),C=!0)},o(N){jt(h.$$.fragment,N),C=!1},d(N){N&&Nt(t),Se(h),P=!1,D()}}}function Qz(e){let t,n=e[10].score.toFixed(1)+"",r,i;return{c(){t=qt("span"),r=yn(n),i=yn("x"),Gr(t,"font-size","26px")},m(l,h){zt(l,t,h),Xt(t,r),Xt(t,i)},p(l,h){h&1024&&n!==(n=l[10].score.toFixed(1)+"")&&Ui(r,n)},d(l){l&&Nt(t)}}}function $z(e){let t,n;return t=new MI({props:{openOn:"hover",$$slots:{default:[Qz,({props:r})=>({10:r}),({props:r})=>r?1024:0]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&3072&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function t5(e){let t,n;return t=new Ad({props:{id:"scores",paint:{"line-width":8,"line-color":jN(["get","score"],vS,_S)},$$slots:{default:[$z]},$$scope:{ctx:e}}}),t.$on("click",e[5]),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&2048&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function H2(e){let t,n;return t=new Af({props:{data:e[3],$$slots:{default:[e5]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&8&&(l.data=r[3]),i&2048&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function e5(e){let t,n;return t=new Ad({props:{id:"route",beforeId:"network",paint:{"line-width":20,"line-color":"cyan","line-opacity":.5}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p:Ae,i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function n5(e){let t,n,r,i,l,h,u,y;n=new dS({}),n.$on("click",e[6]),i=new KI({props:{showSeverances:e[0],opacity:e[1]}}),h=new Af({props:{data:JSON.parse(rl(e[4]).makeHeatmap()),$$slots:{default:[t5]},$$scope:{ctx:e}}});let w=e[3]&&H2(e);return{c(){t=qt("div"),Ie(n.$$.fragment),r=ye(),Ie(i.$$.fragment),l=ye(),Ie(h.$$.fragment),u=ye(),w&&w.c(),Vt(t,"slot","map")},m(S,C){zt(S,t,C),we(n,t,null),Xt(t,r),we(i,t,null),Xt(t,l),we(h,t,null),Xt(t,u),w&&w.m(t,null),y=!0},p(S,C){const P={};C&1&&(P.showSeverances=S[0]),C&2&&(P.opacity=S[1]),i.$set(P);const D={};C&16&&(D.data=JSON.parse(rl(S[4]).makeHeatmap())),C&2048&&(D.$$scope={dirty:C,ctx:S}),h.$set(D),S[3]?w?(w.p(S,C),C&8&&Dt(w,1)):(w=H2(S),w.c(),Dt(w,1),w.m(t,null)):w&&(ar(),jt(w,1,1,()=>{w=null}),lr())},i(S){y||(Dt(n.$$.fragment,S),Dt(i.$$.fragment,S),Dt(h.$$.fragment,S),Dt(w),y=!0)},o(S){jt(n.$$.fragment,S),jt(i.$$.fragment,S),jt(h.$$.fragment,S),jt(w),y=!1},d(S){S&&Nt(t),Se(n),Se(i),Se(h),w&&w.d()}}}function r5(e){let t,n;return t=new by({props:{$$slots:{map:[n5],sidebar:[Jz],top:[Kz]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&2079&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function i5(e,t,n){let r,i,l;Ve(e,zl,D=>n(8,r=D)),Ve(e,xy,D=>n(9,i=D)),Ve(e,hl,D=>n(4,l=D));let{showSeverances:h}=t,{opacity:u}=t,y=null,w=null;function S(D){try{n(2,y=D.detail.features[0].geometry.coordinates),n(3,w=JSON.parse(l.compareRoute({x1:y[0][0],y1:y[0][1],x2:y[1][0],y2:y[1][1]})))}catch(N){window.alert(`No route: ${N}`),n(2,y=null),n(3,w=null)}}function C(D){i.queryRenderedFeatures(D.detail.point,{layers:["scores"]}).length>0||(n(2,y=null),n(3,w=null))}function P(){y&&Ar(zl,r={kind:"route",route_a:y[0],route_b:y[1]},r)}return e.$$set=D=>{"showSeverances"in D&&n(0,h=D.showSeverances),"opacity"in D&&n(1,u=D.opacity)},[h,u,y,w,l,S,C,P]}class o5 extends an{constructor(t){super(),sn(this,t,i5,r5,Xe,{showSeverances:0,opacity:1})}}function s5(e){let t,n,r,i,l,h,u;return{c(){t=qt("button"),t.textContent="Import current view",n=ye(),r=qt("i"),r.textContent="or...",i=ye(),l=qt("button"),l.textContent="Draw an area to import on the map",Vt(t,"type","button"),Vt(l,"type","button")},m(y,w){zt(y,t,w),zt(y,n,w),zt(y,r,w),zt(y,i,w),zt(y,l,w),h||(u=[un(t,"click",e[1]),un(l,"click",e[2])],h=!0)},p:Ae,i:Ae,o:Ae,d(y){y&&(Nt(t),Nt(n),Nt(r),Nt(i),Nt(l)),h=!1,oo(u)}}}function a5(e){let t,n;return t=new FO({props:{polygonTool:e[0]}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&1&&(l.polygonTool=r[0]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function l5(e){let t,n,r,i;const l=[a5,s5],h=[];function u(y,w){return y[0]?0:1}return t=u(e),n=h[t]=l[t](e),{c(){n.c(),r=so()},m(y,w){h[t].m(y,w),zt(y,r,w),i=!0},p(y,[w]){let S=t;t=u(y),t===S?h[t].p(y,w):(ar(),jt(h[S],1,1,()=>{h[S]=null}),lr(),n=h[t],n?n.p(y,w):(n=h[t]=l[t](y),n.c()),Dt(n,1),n.m(r.parentNode,r))},i(y){i||(Dt(n),i=!0)},o(y){jt(n),i=!1},d(y){y&&Nt(r),h[t].d(y)}}}function Xp(e){return[e.lng,e.lat]}function u5(e,t,n){let{map:r}=t;const i=Vu();let l=null;async function h(S){try{i("loading","Loading from Overpass");let P=await(await fetch(h5(S))).text();i("gotXml",P)}catch(C){i("error",C.toString())}}function u(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[Xp(S.getSouthWest()),Xp(S.getNorthWest()),Xp(S.getNorthEast()),Xp(S.getSouthEast()),Xp(S.getSouthWest())]],type:"Polygon"}}}async function y(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await h(u())}}function w(){r&&(n(0,l=new DO(r)),l.startNew(),l.addEventListenerSuccess(async S=>{n(0,l=null),await h(S)}),l.addEventListenerFailure(()=>{n(0,l=null)}))}return e.$$set=S=>{"map"in S&&n(3,r=S.map)},[l,y,w,r]}class c5 extends an{constructor(t){super(),sn(this,t,u5,l5,Xe,{map:3})}}function h5(e){let t='poly:"';for(let[r,i]of e.geometry.coordinates[0])t+=`${i} ${r} `;return t=t.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${t}); node(w)->.x; <;); out meta;`}`}function Z2(e,t,n){const r=e.slice();return r[17]=t[n][0],r[18]=t[n][1],r}function X2(e,t,n){const r=e.slice();return r[21]=t[n][0],r[22]=t[n][1],r}function Y2(e){let t,n=e[22]+"",r,i;return{c(){t=qt("option"),r=yn(n),t.__value=i=e[21],wc(t,t.__value)},m(l,h){zt(l,t,h),Xt(t,r)},p(l,h){h&4&&n!==(n=l[22]+"")&&Ui(r,n),h&4&&i!==(i=l[21])&&(t.__value=i,wc(t,t.__value))},d(l){l&&Nt(t)}}}function K2(e){let t,n,r=vo(e[18]),i=[];for(let l=0;le[7].call(h)),Vt(N,"type","file")},m(rt,mt){we(t,rt,mt),zt(rt,n,mt),zt(rt,r,mt),Xt(r,i),Xt(i,l),Xt(i,h),Xt(h,u);for(let Et=0;Etn(12,r=H)),Ve(e,hl,H=>n(13,i=H)),Ve(e,xy,H=>n(4,l=H));let h="",u="",y=!1,w=[];J0(async()=>{try{let H=await fetch("/osm/areas.json");if(H.ok)y=!0,console.log("Using local cache, not od2net.org"),n(2,w=await H.json());else{let at=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await at.json())}}catch{}});let S;async function C(H){try{P(await S.files[0].arrayBuffer()),n(0,h="")}catch(at){window.alert(`Couldn't open this file: ${at}`)}n(1,u="")}function P(H){n(1,u="Building map model from OSM input"),console.time("load"),Ar(hl,i=new uL(new Uint8Array(H),r),i),console.timeEnd("load")}function D(H){try{P(new TextEncoder().encode(H.detail)),n(0,h="")}catch(at){window.alert(`Couldn't import from Overpass: ${at}`)}n(1,u="")}async function N(H){H!=""&&(y?await K(`/osm/${H}.pbf`):await K(`https://assets.od2net.org/severance_pbfs/${H}.pbf`))}async function K(H){try{n(1,u=`Downloading ${H}`);let at=await fetch(H);P(await at.arrayBuffer())}catch(at){window.alert(`Couldn't open from URL ${H}: ${at}`)}n(1,u="")}function Y(){h=KT(this),n(0,h),n(2,w)}function J(H){fi[H?"unshift":"push"](()=>{S=H,n(3,S)})}const B=H=>n(1,u=H.detail),G=H=>window.alert(H.detail);return e.$$.update=()=>{e.$$.dirty&1&&N(h)},[h,u,w,S,l,C,D,Y,J,B,G]}class d5 extends an{constructor(t){super(),sn(this,t,p5,f5,Xe,{})}}function m5(e){let t;return{c(){t=qt("div"),Vt(t,"slot","top")},m(n,r){zt(n,t,r)},p:Ae,d(n){n&&Nt(t)}}}function g5(e){let t;return{c(){t=qt("p"),t.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){zt(n,t,r)},i:Ae,o:Ae,d(n){n&&Nt(t)}}}function y5(e){let t,n;return t=new d5({}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function _5(e){let t,n,r,i,l,h,u,y,w,S,C,P,D,N,K;const Y=[y5,g5],J=[];function B(G,H){return G[1]&&G[0]?0:1}return i=B(e),l=J[i]=Y[i](e),{c(){t=qt("div"),n=qt("h2"),n.textContent="Choose your study area",r=ye(),l.c(),h=ye(),u=qt("div"),y=qt("label"),w=qt("input"),S=yn(` When a road in OSM doesn't explicitly specify sidewalks, assume they exist or not? (This tool works best in places where sidewalks are consistently tagged as - `),C=jt("a"),C.textContent="separate ways",P=wn(". Disable this in those places.)"),Vt(w,"type","checkbox"),Vt(C,"href","https://wiki.openstreetmap.org/wiki/Sidewalks#Sidewalk_as_separate_way"),Vt(C,"target","_blank"),Vt(t,"slot","sidebar")},m(G,H){zt(G,t,H),Xt(t,n),Xt(t,r),K[o].m(t,null),Xt(t,h),Xt(t,u),Xt(u,y),Xt(y,w),w.checked=e[2],Xt(y,S),Xt(y,C),Xt(y,P),N=!0,R||(J=hn(w,"change",e[3]),R=!0)},p(G,H){let at=o;o=B(G),o!==at&&(ar(),qt(K[at],1,1,()=>{K[at]=null}),lr(),l=K[o],l||(l=K[o]=Y[o](G),l.c()),Dt(l,1),l.m(t,h)),H&4&&(w.checked=G[2])},i(G){N||(Dt(l),N=!0)},o(G){qt(l),N=!1},d(G){G&&Nt(t),K[o].d(),R=!1,J()}}}function _5(e){let t,n,r;return n=new ZI({}),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"slot","map")},m(o,l){zt(o,t,l),we(n,t,null),r=!0},p:Me,i(o){r||(Dt(n.$$.fragment,o),r=!0)},o(o){qt(n.$$.fragment,o),r=!1},d(o){o&&Nt(t),Se(n)}}}function v5(e){let t,n;return t=new by({props:{$$slots:{map:[_5],sidebar:[y5],top:[d5]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,[o]){const l={};o&39&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function b5(e,t,n){let r,o,l;Ge(e,Kl,y=>n(4,r=y)),Ge(e,xy,y=>n(1,o=y)),Ge(e,Y0,y=>n(2,l=y));let{wasmReady:h}=t;Ur(Kl,r=null,r);function u(){l=this.checked,Y0.set(l)}return e.$$set=y=>{"wasmReady"in y&&n(0,h=y.wasmReady)},[h,o,l,u]}class x5 extends an{constructor(t){super(),sn(this,t,b5,v5,Xe,{wasmReady:0})}}function K2(e){let t,n;return t=new wP({props:{$$slots:{default:[w5,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&24&&(l.$$scope={dirty:o,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function w5(e){let t,n,r,o,l,h,u,y,w,S,C,P,N,R,J,Y,K,B,G,H,at,gt;function ft(){return e[1](e[3])}return{c(){t=jt("h1"),t.textContent="Severance Snape",n=ye(),r=jt("p"),r.innerHTML=`This is an experimental tool to study "severances" for people walking. + `),C=qt("a"),C.textContent="separate ways",P=yn(". Disable this in those places.)"),Vt(w,"type","checkbox"),Vt(C,"href","https://wiki.openstreetmap.org/wiki/Sidewalks#Sidewalk_as_separate_way"),Vt(C,"target","_blank"),Vt(t,"slot","sidebar")},m(G,H){zt(G,t,H),Xt(t,n),Xt(t,r),J[i].m(t,null),Xt(t,h),Xt(t,u),Xt(u,y),Xt(y,w),w.checked=e[2],Xt(y,S),Xt(y,C),Xt(y,P),D=!0,N||(K=un(w,"change",e[3]),N=!0)},p(G,H){let at=i;i=B(G),i!==at&&(ar(),jt(J[at],1,1,()=>{J[at]=null}),lr(),l=J[i],l||(l=J[i]=Y[i](G),l.c()),Dt(l,1),l.m(t,h)),H&4&&(w.checked=G[2])},i(G){D||(Dt(l),D=!0)},o(G){jt(l),D=!1},d(G){G&&Nt(t),J[i].d(),N=!1,K()}}}function v5(e){let t,n,r;return n=new ZI({}),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"slot","map")},m(i,l){zt(i,t,l),we(n,t,null),r=!0},p:Ae,i(i){r||(Dt(n.$$.fragment,i),r=!0)},o(i){jt(n.$$.fragment,i),r=!1},d(i){i&&Nt(t),Se(n)}}}function b5(e){let t,n;return t=new by({props:{$$slots:{map:[v5],sidebar:[_5],top:[m5]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,[i]){const l={};i&39&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function x5(e,t,n){let r,i,l;Ve(e,hl,y=>n(4,r=y)),Ve(e,xy,y=>n(1,i=y)),Ve(e,Y0,y=>n(2,l=y));let{wasmReady:h}=t;Ar(hl,r=null,r);function u(){l=this.checked,Y0.set(l)}return e.$$set=y=>{"wasmReady"in y&&n(0,h=y.wasmReady)},[h,i,l,u]}class w5 extends an{constructor(t){super(),sn(this,t,x5,b5,Xe,{wasmReady:0})}}function J2(e){let t,n;return t=new SP({props:{$$slots:{default:[S5,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:e}}}),t.$on("close",e[2]),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&24&&(l.$$scope={dirty:i,ctx:r}),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function S5(e){let t,n,r,i,l,h,u,y,w,S,C,P,D,N,K,Y,J,B,G,H,at,gt;function ft(){return e[1](e[3])}return{c(){t=qt("h1"),t.textContent="Severance Snape",n=ye(),r=qt("p"),r.innerHTML=`This is an experimental tool to study "severances" for people walking. In some places, crossing a big road (a "severance") might be easy -- there's a zebra or signalized crossing right on the "desire line" where someone might want to cross. But often, a person might have to walk a few blocks to reach the nearest crossing -- and then they might have to go up or down stairs to - cross on a bridge or a tunnel!`,o=ye(),l=jt("p"),l.textContent=`This tool quantifies just how bad this crossing is with a "detour factor" + cross on a bridge or a tunnel!`,i=ye(),l=qt("p"),l.textContent=`This tool quantifies just how bad this crossing is with a "detour factor" -- the ratio of the length to cross in a straight line and the length of the actual path, according to OSM data. A score close to 1 is great, and a score of 4 means the actual path is 4 times the length of the straight - desire line.`,h=ye(),u=jt("p"),u.innerHTML=`This tool is experimental, so there will be bugs both with OSM data - and what the tool shows!`,y=ye(),w=jt("p"),w.textContent="To use this tool, you need to:",S=ye(),C=jt("ol"),C.innerHTML=`
  • Choose your study area to analyze
  • Check the severances that show up -- they're inferred from OSM data and + desire line.`,h=ye(),u=qt("p"),u.innerHTML=`This tool is experimental, so there will be bugs both with OSM data + and what the tool shows!`,y=ye(),w=qt("p"),w.textContent="To use this tool, you need to:",S=ye(),C=qt("ol"),C.innerHTML=`
  • Choose your study area to analyze
  • Check the severances that show up -- they're inferred from OSM data and might not be correct
  • Use the Route mode to explore the detour factor between any two points you choose
  • Use the Score mode to visualize the detour factor everywhere, looking - for places easy and hard to cross
  • `,P=ye(),N=jt("p"),N.innerHTML=`This tool aims to complement an "area porosity" analysis, defined in section 2.3.5 of TfL's Cycling Design Standards. That definition of porosity just counts the number of crossings per + for places easy and hard to cross`,P=ye(),D=qt("p"),D.innerHTML=`This tool aims to complement an "area porosity" analysis, defined in section 2.3.5 of TfL's Cycling Design Standards. That definition of porosity just counts the number of crossings per area, and isn't very detailed about how far you have to walk to a crossing - in that area.`,R=ye(),J=jt("p"),J.innerHTML=`This open source + in that area.`,N=ye(),K=qt("p"),K.innerHTML=`This open source tool is created by Dustin Carlino and relies heavily on - OpenStreetMap data.`,Y=ye(),K=jt("details"),K.innerHTML='Changelog

    GitHub has more detail; this is a summary

    • 17 February - use Pico for styling
    • 21 January - fix shortest route calculations
    ',B=ye(),G=jt("center"),H=jt("button"),H.textContent="Start!"},m(rt,mt){zt(rt,t,mt),zt(rt,n,mt),zt(rt,r,mt),zt(rt,o,mt),zt(rt,l,mt),zt(rt,h,mt),zt(rt,u,mt),zt(rt,y,mt),zt(rt,w,mt),zt(rt,S,mt),zt(rt,C,mt),zt(rt,P,mt),zt(rt,N,mt),zt(rt,R,mt),zt(rt,J,mt),zt(rt,Y,mt),zt(rt,K,mt),zt(rt,B,mt),zt(rt,G,mt),Xt(G,H),at||(gt=hn(H,"click",ft),at=!0)},p(rt,mt){e=rt},d(rt){rt&&(Nt(t),Nt(n),Nt(r),Nt(o),Nt(l),Nt(h),Nt(u),Nt(y),Nt(w),Nt(S),Nt(C),Nt(P),Nt(N),Nt(R),Nt(J),Nt(Y),Nt(K),Nt(B),Nt(G)),at=!1,gt()}}}function S5(e){let t,n,r=e[0]&&K2(e);return{c(){r&&r.c(),t=so()},m(o,l){r&&r.m(o,l),zt(o,t,l),n=!0},p(o,[l]){o[0]?r?(r.p(o,l),l&1&&Dt(r,1)):(r=K2(o),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),qt(r,1,1,()=>{r=null}),lr())},i(o){n||(Dt(r),n=!0)},o(o){qt(r),n=!1},d(o){o&&Nt(t),r&&r.d(o)}}}function E5(e,t,n){let r;return Ge(e,Kg,h=>n(0,r=h)),[r,h=>rl(h).close(),()=>Ur(Kg,r=!1,r)]}class I5 extends an{constructor(t){super(),sn(this,t,E5,S5,Xe,{})}}function C5(e){let t,n,r,o,l,h;return{c(){t=jt("div"),n=jt("button"),n.innerHTML=`A/B Street logo`,r=ye(),o=jt("span"),Vt(n,"class","outline"),Gr(o,"width","100%"),Vt(t,"slot","top"),Gr(t,"display","flex")},m(u,y){zt(u,t,y),Xt(t,n),Xt(t,r),Xt(t,o),e[21](o),l||(h=hn(n,"click",e[20]),l=!0)},p:Me,d(u){u&&Nt(t),e[21](null),l=!1,h()}}}function J2(e){let t,n,r,o,l,h,u,y,w,S,C,P,N,R,J,Y,K,B,G;return h=new mP({props:{rows:[["Footway (ground, outdoors)",Qa.Footway],["Indoors footway",Qa.Indoors],["Footway not on the ground",Qa.BridgeOrTunnel],["Street with vehicle traffic (maybe with a sidewalk, maybe not)",Qa.WithTraffic],["Crossing",Qa.Crossing],["Severance",Qa.Severance]]}}),{c(){t=jt("hr"),n=ye(),r=jt("div"),o=jt("button"),o.textContent="Zoom to fit",l=ye(),Ie(h.$$.fragment),u=ye(),y=jt("div"),w=jt("label"),S=jt("input"),C=wn(` - Show severances`),P=ye(),N=jt("div"),R=jt("label"),J=wn(`Network opacity: - `),Y=jt("input"),Vt(S,"type","checkbox"),Vt(Y,"type","range"),Vt(Y,"min","0"),Vt(Y,"max","100")},m(H,at){zt(H,t,at),zt(H,n,at),zt(H,r,at),Xt(r,o),zt(H,l,at),we(h,H,at),zt(H,u,at),zt(H,y,at),Xt(y,w),Xt(w,S),S.checked=e[7],Xt(w,C),zt(H,P,at),zt(H,N,at),Xt(N,R),Xt(R,J),Xt(R,Y),wc(Y,e[6]),K=!0,B||(G=[hn(o,"click",e[10]),hn(S,"change",e[18]),hn(Y,"change",e[19]),hn(Y,"input",e[19])],B=!0)},p(H,at){at&128&&(S.checked=H[7]),at&64&&wc(Y,H[6])},i(H){K||(Dt(h.$$.fragment,H),K=!0)},o(H){qt(h.$$.fragment,H),K=!1},d(H){H&&(Nt(t),Nt(n),Nt(r),Nt(l),Nt(u),Nt(y),Nt(P),Nt(N)),Se(h,H),B=!1,oo(G)}}}function T5(e){let t,n,r,o,l,h,u=e[8]!="title"&&J2(e);return{c(){t=jt("div"),n=jt("h1"),n.textContent="Severance Snape",r=ye(),o=jt("div"),l=ye(),u&&u.c(),Vt(t,"slot","left")},m(y,w){zt(y,t,w),Xt(t,n),Xt(t,r),Xt(t,o),e[17](o),Xt(t,l),u&&u.m(t,null),h=!0},p(y,w){y[8]!="title"?u?(u.p(y,w),w&256&&Dt(u,1)):(u=J2(y),u.c(),Dt(u,1),u.m(t,null)):u&&(ar(),qt(u,1,1,()=>{u=null}),lr())},i(y){h||(Dt(u),h=!0)},o(y){qt(u),h=!1},d(y){y&&Nt(t),e[17](null),u&&u.d()}}}function Q2(e){let t,n;return t=new x5({props:{wasmReady:e[5]}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&32&&(l.wasmReady=r[5]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function $2(e){let t,n,r,o,l,h;t=new Af({props:{data:JSON.parse(e[4].getInvertedBoundary()),$$slots:{default:[L5]},$$scope:{ctx:e}}});const u=[A5,M5,P5],y=[];function w(S,C){return S[8]=="route"?0:S[8]=="score"?1:S[8]=="debug"?2:-1}return~(r=w(e))&&(o=y[r]=u[r](e)),{c(){Ie(t.$$.fragment),n=ye(),o&&o.c(),l=so()},m(S,C){we(t,S,C),zt(S,n,C),~r&&y[r].m(S,C),zt(S,l,C),h=!0},p(S,C){const P={};C&16&&(P.data=JSON.parse(S[4].getInvertedBoundary())),C&8388608&&(P.$$scope={dirty:C,ctx:S}),t.$set(P);let N=r;r=w(S),r===N?~r&&y[r].p(S,C):(o&&(ar(),qt(y[N],1,1,()=>{y[N]=null}),lr()),~r?(o=y[r],o?o.p(S,C):(o=y[r]=u[r](S),o.c()),Dt(o,1),o.m(l.parentNode,l)):o=null)},i(S){h||(Dt(t.$$.fragment,S),Dt(o),h=!0)},o(S){qt(t.$$.fragment,S),qt(o),h=!1},d(S){S&&(Nt(n),Nt(l)),Se(t,S),~r&&y[r].d(S)}}}function L5(e){let t,n;return t=new TL({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p:Me,i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function P5(e){let t,n;return t=new Dz({props:{showSeverances:e[7],opacity:e[6]}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&128&&(l.showSeverances=r[7]),o&64&&(l.opacity=r[6]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function M5(e){let t,n;return t=new i5({props:{showSeverances:e[7],opacity:e[6]}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&128&&(l.showSeverances=r[7]),o&64&&(l.opacity=r[6]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function A5(e){let t,n;return t=new Xz({props:{showSeverances:e[7],opacity:e[6]}}),{c(){Ie(t.$$.fragment)},m(r,o){we(t,r,o),n=!0},p(r,o){const l={};o&128&&(l.showSeverances=r[7]),o&64&&(l.opacity=r[6]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){qt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function k5(e){let t,n,r,o,l,h,u,y,w;t=new MN({props:{map:e[0],apiKey:XI}}),l=new ZI({});let S=e[8]=="title"&&Q2(e),C=e[4]&&$2(e);return{c(){Ie(t.$$.fragment),n=ye(),r=jt("div"),o=ye(),Ie(l.$$.fragment),h=ye(),S&&S.c(),u=ye(),C&&C.c(),y=so()},m(P,N){we(t,P,N),zt(P,n,N),zt(P,r,N),e[14](r),zt(P,o,N),we(l,P,N),zt(P,h,N),S&&S.m(P,N),zt(P,u,N),C&&C.m(P,N),zt(P,y,N),w=!0},p(P,N){const R={};N&1&&(R.map=P[0]),t.$set(R),P[8]=="title"?S?(S.p(P,N),N&256&&Dt(S,1)):(S=Q2(P),S.c(),Dt(S,1),S.m(u.parentNode,u)):S&&(ar(),qt(S,1,1,()=>{S=null}),lr()),P[4]?C?(C.p(P,N),N&16&&Dt(C,1)):(C=$2(P),C.c(),Dt(C,1),C.m(y.parentNode,y)):C&&(ar(),qt(C,1,1,()=>{C=null}),lr())},i(P){w||(Dt(t.$$.fragment,P),Dt(l.$$.fragment,P),Dt(S),Dt(C),w=!0)},o(P){qt(t.$$.fragment,P),qt(l.$$.fragment,P),qt(S),qt(C),w=!1},d(P){P&&(Nt(n),Nt(r),Nt(o),Nt(h),Nt(u),Nt(y)),Se(t,P),e[14](null),Se(l,P),S&&S.d(P),C&&C.d(P)}}}function D5(e){let t,n,r,o;function l(u){e[15](u)}let h={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${XI}`,standardControls:!0,hash:!0,$$slots:{default:[k5]},$$scope:{ctx:e}};return e[0]!==void 0&&(h.map=e[0]),n=new QL({props:h}),fi.push(()=>Lu(n,"map",l)),n.$on("error",e[16]),{c(){t=jt("div"),Ie(n.$$.fragment),Vt(t,"slot","main"),Gr(t,"position","relative"),Gr(t,"width","100%"),Gr(t,"height","100vh")},m(u,y){zt(u,t,y),we(n,t,null),o=!0},p(u,y){const w={};y&8389113&&(w.$$scope={dirty:y,ctx:u}),!r&&y&1&&(r=!0,w.map=u[0],Tu(()=>r=!1)),n.$set(w)},i(u){o||(Dt(n.$$.fragment,u),o=!0)},o(u){qt(n.$$.fragment,u),o=!1},d(u){u&&Nt(t),Se(n)}}}function R5(e){let t,n,r,o;return t=new I5({}),r=new yz({props:{$$slots:{main:[D5],left:[T5],top:[C5]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment),n=ye(),Ie(r.$$.fragment)},m(l,h){we(t,l,h),zt(l,n,h),we(r,l,h),o=!0},p(l,[h]){const u={};h&8389631&&(u.$$scope={dirty:h,ctx:l}),r.$set(u)},i(l){o||(Dt(t.$$.fragment,l),Dt(r.$$.fragment,l),o=!0)},o(l){qt(t.$$.fragment,l),qt(r.$$.fragment,l),o=!1},d(l){l&&Nt(n),Se(t,l),Se(r,l)}}}function N5(e,t,n){let r,o,l,h,u,y;Ge(e,X0,Et=>n(11,r=Et)),Ge(e,Z0,Et=>n(12,o=Et)),Ge(e,H0,Et=>n(13,l=Et)),Ge(e,Kl,Et=>n(4,h=Et)),Ge(e,gc,Et=>n(8,u=Et)),Ge(e,Kg,Et=>n(9,y=Et));let w=!1;K0(async()=>{await cS(),n(5,w=!0)});let S,C=100,P=!0;function N(){S&&h&&S.fitBounds(Array.from(h.getBounds()),{animate:!1})}function R(Et){h&&(console.log("New map model loaded"),N(),Ur(gc,u="route",u))}let J,Y,K;function B(Et){fi[Et?"unshift":"push"](()=>{K=Et,n(3,K),n(11,r)})}function G(Et){S=Et,n(0,S)}const H=Et=>{console.log(Et.detail.error)};function at(Et){fi[Et?"unshift":"push"](()=>{Y=Et,n(2,Y),n(12,o)})}function gt(){P=this.checked,n(7,P)}function ft(){C=ZT(this.value),n(6,C)}const rt=()=>Ur(Kg,y=!0,y);function mt(Et){fi[Et?"unshift":"push"](()=>{J=Et,n(1,J),n(13,l)})}return e.$$.update=()=>{e.$$.dirty&1&&S&&xy.set(S),e.$$.dirty&16&&R(),e.$$.dirty&8194&&J&&l&&(n(1,J.innerHTML="",J),J.appendChild(l)),e.$$.dirty&4100&&Y&&o&&(n(2,Y.innerHTML="",Y),Y.appendChild(o)),e.$$.dirty&2056&&K&&r&&(n(3,K.innerHTML="",K),K.appendChild(r))},[S,J,Y,K,h,w,C,P,u,y,N,r,o,l,B,G,H,at,gt,ft,rt,mt]}class O5 extends an{constructor(t){super(),sn(this,t,N5,R5,Xe,{})}}new O5({target:document.getElementById("app")}); + OpenStreetMap data.`,Y=ye(),J=qt("details"),J.innerHTML='Changelog

    GitHub has more detail; this is a summary

    • 17 February - use Pico for styling
    • 21 January - fix shortest route calculations
    ',B=ye(),G=qt("center"),H=qt("button"),H.textContent="Start!"},m(rt,mt){zt(rt,t,mt),zt(rt,n,mt),zt(rt,r,mt),zt(rt,i,mt),zt(rt,l,mt),zt(rt,h,mt),zt(rt,u,mt),zt(rt,y,mt),zt(rt,w,mt),zt(rt,S,mt),zt(rt,C,mt),zt(rt,P,mt),zt(rt,D,mt),zt(rt,N,mt),zt(rt,K,mt),zt(rt,Y,mt),zt(rt,J,mt),zt(rt,B,mt),zt(rt,G,mt),Xt(G,H),at||(gt=un(H,"click",ft),at=!0)},p(rt,mt){e=rt},d(rt){rt&&(Nt(t),Nt(n),Nt(r),Nt(i),Nt(l),Nt(h),Nt(u),Nt(y),Nt(w),Nt(S),Nt(C),Nt(P),Nt(D),Nt(N),Nt(K),Nt(Y),Nt(J),Nt(B),Nt(G)),at=!1,gt()}}}function E5(e){let t,n,r=e[0]&&J2(e);return{c(){r&&r.c(),t=so()},m(i,l){r&&r.m(i,l),zt(i,t,l),n=!0},p(i,[l]){i[0]?r?(r.p(i,l),l&1&&Dt(r,1)):(r=J2(i),r.c(),Dt(r,1),r.m(t.parentNode,t)):r&&(ar(),jt(r,1,1,()=>{r=null}),lr())},i(i){n||(Dt(r),n=!0)},o(i){jt(r),n=!1},d(i){i&&Nt(t),r&&r.d(i)}}}function I5(e,t,n){let r;return Ve(e,Kg,h=>n(0,r=h)),[r,h=>rl(h).close(),()=>Ar(Kg,r=!1,r)]}class C5 extends an{constructor(t){super(),sn(this,t,I5,E5,Xe,{})}}function T5(e){let t,n,r,i,l,h;return{c(){t=qt("div"),n=qt("button"),n.innerHTML=`A/B Street logo`,r=ye(),i=qt("span"),Vt(n,"class","outline"),Gr(i,"width","100%"),Vt(t,"slot","top"),Gr(t,"display","flex")},m(u,y){zt(u,t,y),Xt(t,n),Xt(t,r),Xt(t,i),e[21](i),l||(h=un(n,"click",e[20]),l=!0)},p:Ae,d(u){u&&Nt(t),e[21](null),l=!1,h()}}}function Q2(e){let t,n,r,i,l,h,u,y,w,S,C,P,D,N,K,Y,J,B,G;return h=new gP({props:{rows:[["Footway (ground, outdoors)",Qa.Footway],["Indoors footway",Qa.Indoors],["Footway not on the ground",Qa.BridgeOrTunnel],["Street with vehicle traffic (maybe with a sidewalk, maybe not)",Qa.WithTraffic],["Crossing",Qa.Crossing],["Severance",Qa.Severance]]}}),{c(){t=qt("hr"),n=ye(),r=qt("div"),i=qt("button"),i.textContent="Zoom to fit",l=ye(),Ie(h.$$.fragment),u=ye(),y=qt("div"),w=qt("label"),S=qt("input"),C=yn(` + Show severances`),P=ye(),D=qt("div"),N=qt("label"),K=yn(`Network opacity: + `),Y=qt("input"),Vt(S,"type","checkbox"),Vt(Y,"type","range"),Vt(Y,"min","0"),Vt(Y,"max","100")},m(H,at){zt(H,t,at),zt(H,n,at),zt(H,r,at),Xt(r,i),zt(H,l,at),we(h,H,at),zt(H,u,at),zt(H,y,at),Xt(y,w),Xt(w,S),S.checked=e[7],Xt(w,C),zt(H,P,at),zt(H,D,at),Xt(D,N),Xt(N,K),Xt(N,Y),wc(Y,e[6]),J=!0,B||(G=[un(i,"click",e[10]),un(S,"change",e[18]),un(Y,"change",e[19]),un(Y,"input",e[19])],B=!0)},p(H,at){at&128&&(S.checked=H[7]),at&64&&wc(Y,H[6])},i(H){J||(Dt(h.$$.fragment,H),J=!0)},o(H){jt(h.$$.fragment,H),J=!1},d(H){H&&(Nt(t),Nt(n),Nt(r),Nt(l),Nt(u),Nt(y),Nt(P),Nt(D)),Se(h,H),B=!1,oo(G)}}}function L5(e){let t,n,r,i,l,h,u=e[8].kind!="title"&&Q2(e);return{c(){t=qt("div"),n=qt("h1"),n.textContent="Severance Snape",r=ye(),i=qt("div"),l=ye(),u&&u.c(),Vt(t,"slot","left")},m(y,w){zt(y,t,w),Xt(t,n),Xt(t,r),Xt(t,i),e[17](i),Xt(t,l),u&&u.m(t,null),h=!0},p(y,w){y[8].kind!="title"?u?(u.p(y,w),w&256&&Dt(u,1)):(u=Q2(y),u.c(),Dt(u,1),u.m(t,null)):u&&(ar(),jt(u,1,1,()=>{u=null}),lr())},i(y){h||(Dt(u),h=!0)},o(y){jt(u),h=!1},d(y){y&&Nt(t),e[17](null),u&&u.d()}}}function $2(e){let t,n;return t=new w5({props:{wasmReady:e[5]}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&32&&(l.wasmReady=r[5]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function tS(e){let t,n,r,i,l,h;t=new Af({props:{data:JSON.parse(e[4].getInvertedBoundary()),$$slots:{default:[P5]},$$scope:{ctx:e}}});const u=[k5,A5,M5],y=[];function w(S,C){return S[8].kind=="route"?0:S[8].kind=="score"?1:S[8].kind=="debug"?2:-1}return~(r=w(e))&&(i=y[r]=u[r](e)),{c(){Ie(t.$$.fragment),n=ye(),i&&i.c(),l=so()},m(S,C){we(t,S,C),zt(S,n,C),~r&&y[r].m(S,C),zt(S,l,C),h=!0},p(S,C){const P={};C&16&&(P.data=JSON.parse(S[4].getInvertedBoundary())),C&8388608&&(P.$$scope={dirty:C,ctx:S}),t.$set(P);let D=r;r=w(S),r===D?~r&&y[r].p(S,C):(i&&(ar(),jt(y[D],1,1,()=>{y[D]=null}),lr()),~r?(i=y[r],i?i.p(S,C):(i=y[r]=u[r](S),i.c()),Dt(i,1),i.m(l.parentNode,l)):i=null)},i(S){h||(Dt(t.$$.fragment,S),Dt(i),h=!0)},o(S){jt(t.$$.fragment,S),jt(i),h=!1},d(S){S&&(Nt(n),Nt(l)),Se(t,S),~r&&y[r].d(S)}}}function P5(e){let t,n;return t=new LL({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p:Ae,i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function M5(e){let t,n;return t=new Rz({props:{showSeverances:e[7],opacity:e[6]}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&128&&(l.showSeverances=r[7]),i&64&&(l.opacity=r[6]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function A5(e){let t,n;return t=new o5({props:{showSeverances:e[7],opacity:e[6]}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&128&&(l.showSeverances=r[7]),i&64&&(l.opacity=r[6]),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function k5(e){let t,n;return t=new Yz({props:{showSeverances:e[7],opacity:e[6],route_a:e[8].route_a,route_b:e[8].route_b}}),{c(){Ie(t.$$.fragment)},m(r,i){we(t,r,i),n=!0},p(r,i){const l={};i&128&&(l.showSeverances=r[7]),i&64&&(l.opacity=r[6]),i&256&&(l.route_a=r[8].route_a),i&256&&(l.route_b=r[8].route_b),t.$set(l)},i(r){n||(Dt(t.$$.fragment,r),n=!0)},o(r){jt(t.$$.fragment,r),n=!1},d(r){Se(t,r)}}}function D5(e){let t,n,r,i,l,h,u,y,w;t=new AN({props:{map:e[0],apiKey:XI}}),l=new ZI({});let S=e[8].kind=="title"&&$2(e),C=e[4]&&tS(e);return{c(){Ie(t.$$.fragment),n=ye(),r=qt("div"),i=ye(),Ie(l.$$.fragment),h=ye(),S&&S.c(),u=ye(),C&&C.c(),y=so()},m(P,D){we(t,P,D),zt(P,n,D),zt(P,r,D),e[14](r),zt(P,i,D),we(l,P,D),zt(P,h,D),S&&S.m(P,D),zt(P,u,D),C&&C.m(P,D),zt(P,y,D),w=!0},p(P,D){const N={};D&1&&(N.map=P[0]),t.$set(N),P[8].kind=="title"?S?(S.p(P,D),D&256&&Dt(S,1)):(S=$2(P),S.c(),Dt(S,1),S.m(u.parentNode,u)):S&&(ar(),jt(S,1,1,()=>{S=null}),lr()),P[4]?C?(C.p(P,D),D&16&&Dt(C,1)):(C=tS(P),C.c(),Dt(C,1),C.m(y.parentNode,y)):C&&(ar(),jt(C,1,1,()=>{C=null}),lr())},i(P){w||(Dt(t.$$.fragment,P),Dt(l.$$.fragment,P),Dt(S),Dt(C),w=!0)},o(P){jt(t.$$.fragment,P),jt(l.$$.fragment,P),jt(S),jt(C),w=!1},d(P){P&&(Nt(n),Nt(r),Nt(i),Nt(h),Nt(u),Nt(y)),Se(t,P),e[14](null),Se(l,P),S&&S.d(P),C&&C.d(P)}}}function R5(e){let t,n,r,i;function l(u){e[15](u)}let h={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${XI}`,standardControls:!0,hash:!0,$$slots:{default:[D5]},$$scope:{ctx:e}};return e[0]!==void 0&&(h.map=e[0]),n=new $L({props:h}),fi.push(()=>Pu(n,"map",l)),n.$on("error",e[16]),{c(){t=qt("div"),Ie(n.$$.fragment),Vt(t,"slot","main"),Gr(t,"position","relative"),Gr(t,"width","100%"),Gr(t,"height","100vh")},m(u,y){zt(u,t,y),we(n,t,null),i=!0},p(u,y){const w={};y&8389113&&(w.$$scope={dirty:y,ctx:u}),!r&&y&1&&(r=!0,w.map=u[0],Lu(()=>r=!1)),n.$set(w)},i(u){i||(Dt(n.$$.fragment,u),i=!0)},o(u){jt(n.$$.fragment,u),i=!1},d(u){u&&Nt(t),Se(n)}}}function N5(e){let t,n,r,i;return t=new C5({}),r=new _z({props:{$$slots:{main:[R5],left:[L5],top:[T5]},$$scope:{ctx:e}}}),{c(){Ie(t.$$.fragment),n=ye(),Ie(r.$$.fragment)},m(l,h){we(t,l,h),zt(l,n,h),we(r,l,h),i=!0},p(l,[h]){const u={};h&8389631&&(u.$$scope={dirty:h,ctx:l}),r.$set(u)},i(l){i||(Dt(t.$$.fragment,l),Dt(r.$$.fragment,l),i=!0)},o(l){jt(t.$$.fragment,l),jt(r.$$.fragment,l),i=!1},d(l){l&&Nt(n),Se(t,l),Se(r,l)}}}function O5(e,t,n){let r,i,l,h,u,y;Ve(e,X0,Et=>n(11,r=Et)),Ve(e,Z0,Et=>n(12,i=Et)),Ve(e,H0,Et=>n(13,l=Et)),Ve(e,hl,Et=>n(4,h=Et)),Ve(e,zl,Et=>n(8,u=Et)),Ve(e,Kg,Et=>n(9,y=Et));let w=!1;J0(async()=>{await cS(),n(5,w=!0)});let S,C=100,P=!0;function D(){S&&h&&S.fitBounds(Array.from(h.getBounds()),{animate:!1})}function N(Et){h&&(console.log("New map model loaded"),D(),Ar(zl,u=YI(),u))}let K,Y,J;function B(Et){fi[Et?"unshift":"push"](()=>{J=Et,n(3,J),n(11,r)})}function G(Et){S=Et,n(0,S)}const H=Et=>{console.log(Et.detail.error)};function at(Et){fi[Et?"unshift":"push"](()=>{Y=Et,n(2,Y),n(12,i)})}function gt(){P=this.checked,n(7,P)}function ft(){C=XT(this.value),n(6,C)}const rt=()=>Ar(Kg,y=!0,y);function mt(Et){fi[Et?"unshift":"push"](()=>{K=Et,n(1,K),n(13,l)})}return e.$$.update=()=>{e.$$.dirty&1&&S&&xy.set(S),e.$$.dirty&16&&N(),e.$$.dirty&8194&&K&&l&&(n(1,K.innerHTML="",K),K.appendChild(l)),e.$$.dirty&4100&&Y&&i&&(n(2,Y.innerHTML="",Y),Y.appendChild(i)),e.$$.dirty&2056&&J&&r&&(n(3,J.innerHTML="",J),J.appendChild(r))},[S,K,Y,J,h,w,C,P,u,y,D,r,i,l,B,G,H,at,gt,ft,rt,mt]}class z5 extends an{constructor(t){super(),sn(this,t,O5,N5,Xe,{})}}new z5({target:document.getElementById("app")}); diff --git a/index.html b/index.html index eb3cd95..5827dc1 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Severance Snape - +