From b88c1dd38fe4a4c50f0c85fd47e690350addf715 Mon Sep 17 00:00:00 2001 From: dabreegster Date: Fri, 29 Mar 2024 14:34:31 +0000 Subject: [PATCH] deploy: 38ee8be267952d9ab02e95579ca4bcafa8034648 --- ...713d.js => RenderLanePolygons-b4bc0e33.js} | 42 +++++++++---------- assets/{main-47acf589.js => main-2ee87bcc.js} | 2 +- ...{nested-a19638a8.js => nested-a080194a.js} | 2 +- index.html | 4 +- lane_editor.html | 4 +- 5 files changed, 27 insertions(+), 27 deletions(-) rename assets/{RenderLanePolygons-2fe1713d.js => RenderLanePolygons-b4bc0e33.js} (96%) rename assets/{main-47acf589.js => main-2ee87bcc.js} (99%) rename assets/{nested-a19638a8.js => nested-a080194a.js} (99%) diff --git a/assets/RenderLanePolygons-2fe1713d.js b/assets/RenderLanePolygons-b4bc0e33.js similarity index 96% rename from assets/RenderLanePolygons-2fe1713d.js rename to assets/RenderLanePolygons-b4bc0e33.js index 0231c4a1..710779a2 100644 --- a/assets/RenderLanePolygons-2fe1713d.js +++ b/assets/RenderLanePolygons-b4bc0e33.js @@ -1,8 +1,8 @@ -var Xw=Object.defineProperty;var Yw=(t,e,n)=>e in t?Xw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var or=(t,e,n)=>(Yw(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const p of c.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();function Ye(){}function Gh(t,e){for(const n in e)t[n]=e[n];return t}function m1(t){return t()}function W0(){return Object.create(null)}function eo(t){t.forEach(m1)}function V_(t){return typeof t=="function"}function In(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let sm;function fo(t,e){return t===e?!0:(sm||(sm=document.createElement("a")),sm.href=e,t===sm.href)}function Kw(t){return Object.keys(t).length===0}function g1(t,...e){if(t==null){for(const i of e)i(void 0);return Ye}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function _1(t){let e;return g1(t,n=>e=n)(),e}function Gn(t,e,n){t.$$.on_destroy.push(g1(e,n))}function Os(t,e,n,i){if(t){const a=y1(t,e,n,i);return t[0](a)}}function y1(t,e,n,i){return t[1]&&i?Gh(n.ctx.slice(),t[1](i(e))):n.ctx}function Fs(t,e,n,i){if(t[2]&&i){const a=t[2](i(n));if(e.dirty===void 0)return a;if(typeof a=="object"){const c=[],p=Math.max(e.dirty.length,a.length);for(let u=0;u32){const e=[],n=t.ctx.length/32;for(let i=0;it.removeEventListener(e,n,i)}function $w(t){return function(e){return e.preventDefault(),t.call(this,e)}}function zt(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function x1(t){let e;return{p(...n){e=n,e.forEach(i=>t.push(i))},r(){e.forEach(n=>t.splice(t.indexOf(n),1))}}}function t2(t){return Array.from(t.childNodes)}function Ga(t,e){e=""+e,t.data!==e&&(t.data=e)}function ls(t,e){t.value=e??""}function ju(t,e,n,i){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,i?"important":"")}function xm(t,e,n){for(let i=0;i{const a=t.$$.callbacks[e];if(a){const c=e2(e,n,{cancelable:i});return a.slice().forEach(p=>{p.call(t,c)}),!c.defaultPrevented}return!0}}function I1(t,e){return Of().$$.context.set(t,e),e}function n2(t){return Of().$$.context.get(t)}function Ji(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(i=>i.call(this,e))}const dh=[],Rr=[];let _h=[];const g_=[],E1=Promise.resolve();let __=!1;function S1(){__||(__=!0,E1.then(C1))}function i2(){return S1(),E1}function yf(t){_h.push(t)}function Wo(t){g_.push(t)}const a_=new Set;let uh=0;function C1(){if(uh!==0)return;const t=_f;do{try{for(;uht.indexOf(i)===-1?e.push(i):n.push(i)),n.forEach(i=>i()),_h=e}const mm=new Set;let Zu;function us(){Zu={r:0,c:[],p:Zu}}function cs(){Zu.r||eo(Zu.c),Zu=Zu.p}function ne(t,e){t&&t.i&&(mm.delete(t),t.i(e))}function he(t,e,n,i){if(t&&t.o){if(mm.has(t))return;mm.add(t),Zu.c.push(()=>{mm.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}else i&&i()}function bm(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function YT(t,e){t.d(1),e.delete(t.key)}function s2(t,e){he(t,1,1,()=>{e.delete(t.key)})}function a2(t,e,n,i,a,c,p,u,b,w,T,P){let k=t.length,B=c.length,V=k;const tt={};for(;V--;)tt[t[V].key]=V;const ot=[],ut=new Map,W=new Map,X=[];for(V=B;V--;){const gt=P(a,c,V),St=n(gt);let It=p.get(St);It?i&&X.push(()=>It.p(gt,e)):(It=w(St,gt),It.c()),ut.set(St,ot[V]=It),St in tt&&W.set(St,Math.abs(V-tt[St]))}const J=new Set,ht=new Set;function vt(gt){ne(gt,1),gt.m(u,T),p.set(gt.key,gt),T=gt.first,B--}for(;k&&B;){const gt=ot[B-1],St=t[k-1],It=gt.key,Ft=St.key;gt===St?(T=gt.first,k--,B--):ut.has(Ft)?!p.has(It)||J.has(It)?vt(gt):ht.has(Ft)?k--:W.get(It)>W.get(Ft)?(ht.add(It),vt(gt)):(J.add(Ft),k--):(b(St,p),k--)}for(;k--;){const gt=t[k];ut.has(gt.key)||b(gt,p)}for(;B;)vt(ot[B-1]);return eo(X),ot}function Bf(t,e){const n={},i={},a={$$scope:1};let c=t.length;for(;c--;){const p=t[c],u=e[c];if(u){for(const b in p)b in u||(i[b]=1);for(const b in u)a[b]||(n[b]=u[b],a[b]=1);t[c]=u}else for(const b in p)a[b]=1}for(const p in i)p in n||(n[p]=void 0);return n}function Ho(t,e,n){const i=t.$$.props[e];i!==void 0&&(t.$$.bound[i]=n,n(t.$$.ctx[i]))}function cn(t){t&&t.c()}function en(t,e,n){const{fragment:i,after_update:a}=t.$$;i&&i.m(e,n),yf(()=>{const c=t.$$.on_mount.map(m1).filter(V_);t.$$.on_destroy?t.$$.on_destroy.push(...c):eo(c),t.$$.on_mount=[]}),a.forEach(yf)}function nn(t,e){const n=t.$$;n.fragment!==null&&(o2(n.after_update),eo(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function l2(t,e){t.$$.dirty[0]===-1&&(dh.push(t),S1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const V=B.length?B[0]:k;return w.ctx&&a(w.ctx[P],w.ctx[P]=V)&&(!w.skip_bound&&w.bound[P]&&w.bound[P](V),T&&l2(t,P)),k}):[],w.update(),T=!0,eo(w.before_update),w.fragment=i?i(w.ctx):!1,e.target){if(e.hydrate){const P=t2(e.target);w.fragment&&w.fragment.l(P),P.forEach(pe)}else w.fragment&&w.fragment.c();e.intro&&ne(t.$$.fragment),en(t,e.target,e.anchor),C1()}hf(b)}class Tn{constructor(){or(this,"$$");or(this,"$$set")}$destroy(){nn(this,1),this.$destroy=Ye}$on(e,n){if(!V_(n))return Ye;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const a=i.indexOf(n);a!==-1&&i.splice(a,1)}}$set(e){this.$$set&&!Kw(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const u2="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(u2);const ch=[];function l_(t,e){return{subscribe:gr(t,e).subscribe}}function gr(t,e=Ye){let n;const i=new Set;function a(u){if(In(t,u)&&(t=u,n)){const b=!ch.length;for(const w of i)w[1](),ch.push(w,t);if(b){for(let w=0;w{i.delete(w),i.size===0&&n&&(n(),n=null)}}return{set:a,update:c,subscribe:p}}let c2=Date.now();function Vf(t){return`${t}-${c2++}`}const U_=Symbol.for("svelte-maplibre");function Uf(){return n2(U_)}function h2(t){let e=new WeakMap;return n=>{var p;let i=e.get(n.originalEvent);if(i!==void 0)return i;let c=(p=n.target.queryRenderedFeatures(n.point).find(u=>{var b;return(b=t.get(u.layer.id))==null?void 0:b.interactive}))==null?void 0:p.layer.id;return e.set(n.originalEvent,c),c}}function p2(){let t=new Map;return I1(U_,{map:gr(null),source:l_(null),layer:l_(null),popupTarget:l_(null),cluster:gr(),loadedImages:gr(new Set),minzoom:gr(0),maxzoom:gr(24),layerEvent:gr(null),layerInfo:t,eventTopMost:h2(t)})}function H0(t){return{subscribe:t.subscribe}}function T1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:i=!1}){let a=Uf(),c=gr(null),p=H0(c),u={...a,[t]:H0(c)};if(e&&(u.popupTarget=p),i){let b=gr(null);u.layerEvent=b,a.layerEvent=b}return n&&(u.cluster=gr()),I1(U_,u),{...a,self:c}}function f2(){return T1({key:"source",setCluster:!0})}function d2(t=!0){return T1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function KT(t){return"layerType"in t&&t.layerType==="deckgl"}var L1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function P1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function G_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){if(this instanceof i){var a=[null];a.push.apply(a,arguments);var c=Function.bind.apply(e,a);return new c}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:function(){return t[i]}})}),n}var M1={exports:{}};/** +var Xw=Object.defineProperty;var Yw=(t,e,n)=>e in t?Xw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var or=(t,e,n)=>(Yw(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const p of c.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&i(p)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();function Ye(){}function Gh(t,e){for(const n in e)t[n]=e[n];return t}function m1(t){return t()}function W0(){return Object.create(null)}function eo(t){t.forEach(m1)}function V_(t){return typeof t=="function"}function In(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let sm;function fo(t,e){return t===e?!0:(sm||(sm=document.createElement("a")),sm.href=e,t===sm.href)}function Kw(t){return Object.keys(t).length===0}function g1(t,...e){if(t==null){for(const i of e)i(void 0);return Ye}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function _1(t){let e;return g1(t,n=>e=n)(),e}function Gn(t,e,n){t.$$.on_destroy.push(g1(e,n))}function Os(t,e,n,i){if(t){const a=y1(t,e,n,i);return t[0](a)}}function y1(t,e,n,i){return t[1]&&i?Gh(n.ctx.slice(),t[1](i(e))):n.ctx}function Fs(t,e,n,i){if(t[2]&&i){const a=t[2](i(n));if(e.dirty===void 0)return a;if(typeof a=="object"){const c=[],p=Math.max(e.dirty.length,a.length);for(let u=0;u32){const e=[],n=t.ctx.length/32;for(let i=0;it.removeEventListener(e,n,i)}function $w(t){return function(e){return e.preventDefault(),t.call(this,e)}}function zt(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function x1(t){let e;return{p(...n){e=n,e.forEach(i=>t.push(i))},r(){e.forEach(n=>t.splice(t.indexOf(n),1))}}}function t2(t){return Array.from(t.childNodes)}function wl(t,e){e=""+e,t.data!==e&&(t.data=e)}function ls(t,e){t.value=e??""}function ju(t,e,n,i){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,i?"important":"")}function xm(t,e,n){for(let i=0;i{const a=t.$$.callbacks[e];if(a){const c=e2(e,n,{cancelable:i});return a.slice().forEach(p=>{p.call(t,c)}),!c.defaultPrevented}return!0}}function I1(t,e){return Of().$$.context.set(t,e),e}function n2(t){return Of().$$.context.get(t)}function Ji(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(i=>i.call(this,e))}const dh=[],Rr=[];let _h=[];const g_=[],E1=Promise.resolve();let __=!1;function S1(){__||(__=!0,E1.then(C1))}function i2(){return S1(),E1}function yf(t){_h.push(t)}function Wo(t){g_.push(t)}const a_=new Set;let uh=0;function C1(){if(uh!==0)return;const t=_f;do{try{for(;uht.indexOf(i)===-1?e.push(i):n.push(i)),n.forEach(i=>i()),_h=e}const mm=new Set;let Zu;function us(){Zu={r:0,c:[],p:Zu}}function cs(){Zu.r||eo(Zu.c),Zu=Zu.p}function ne(t,e){t&&t.i&&(mm.delete(t),t.i(e))}function he(t,e,n,i){if(t&&t.o){if(mm.has(t))return;mm.add(t),Zu.c.push(()=>{mm.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}else i&&i()}function bm(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function XT(t,e){t.d(1),e.delete(t.key)}function s2(t,e){he(t,1,1,()=>{e.delete(t.key)})}function a2(t,e,n,i,a,c,p,u,b,w,T,P){let k=t.length,B=c.length,V=k;const tt={};for(;V--;)tt[t[V].key]=V;const ot=[],ut=new Map,W=new Map,X=[];for(V=B;V--;){const gt=P(a,c,V),St=n(gt);let It=p.get(St);It?i&&X.push(()=>It.p(gt,e)):(It=w(St,gt),It.c()),ut.set(St,ot[V]=It),St in tt&&W.set(St,Math.abs(V-tt[St]))}const J=new Set,ht=new Set;function vt(gt){ne(gt,1),gt.m(u,T),p.set(gt.key,gt),T=gt.first,B--}for(;k&&B;){const gt=ot[B-1],St=t[k-1],It=gt.key,Ft=St.key;gt===St?(T=gt.first,k--,B--):ut.has(Ft)?!p.has(It)||J.has(It)?vt(gt):ht.has(Ft)?k--:W.get(It)>W.get(Ft)?(ht.add(It),vt(gt)):(J.add(Ft),k--):(b(St,p),k--)}for(;k--;){const gt=t[k];ut.has(gt.key)||b(gt,p)}for(;B;)vt(ot[B-1]);return eo(X),ot}function Bf(t,e){const n={},i={},a={$$scope:1};let c=t.length;for(;c--;){const p=t[c],u=e[c];if(u){for(const b in p)b in u||(i[b]=1);for(const b in u)a[b]||(n[b]=u[b],a[b]=1);t[c]=u}else for(const b in p)a[b]=1}for(const p in i)p in n||(n[p]=void 0);return n}function Ho(t,e,n){const i=t.$$.props[e];i!==void 0&&(t.$$.bound[i]=n,n(t.$$.ctx[i]))}function cn(t){t&&t.c()}function en(t,e,n){const{fragment:i,after_update:a}=t.$$;i&&i.m(e,n),yf(()=>{const c=t.$$.on_mount.map(m1).filter(V_);t.$$.on_destroy?t.$$.on_destroy.push(...c):eo(c),t.$$.on_mount=[]}),a.forEach(yf)}function nn(t,e){const n=t.$$;n.fragment!==null&&(o2(n.after_update),eo(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function l2(t,e){t.$$.dirty[0]===-1&&(dh.push(t),S1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const V=B.length?B[0]:k;return w.ctx&&a(w.ctx[P],w.ctx[P]=V)&&(!w.skip_bound&&w.bound[P]&&w.bound[P](V),T&&l2(t,P)),k}):[],w.update(),T=!0,eo(w.before_update),w.fragment=i?i(w.ctx):!1,e.target){if(e.hydrate){const P=t2(e.target);w.fragment&&w.fragment.l(P),P.forEach(pe)}else w.fragment&&w.fragment.c();e.intro&&ne(t.$$.fragment),en(t,e.target,e.anchor),C1()}hf(b)}class Tn{constructor(){or(this,"$$");or(this,"$$set")}$destroy(){nn(this,1),this.$destroy=Ye}$on(e,n){if(!V_(n))return Ye;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const a=i.indexOf(n);a!==-1&&i.splice(a,1)}}$set(e){this.$$set&&!Kw(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const u2="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(u2);const ch=[];function l_(t,e){return{subscribe:gr(t,e).subscribe}}function gr(t,e=Ye){let n;const i=new Set;function a(u){if(In(t,u)&&(t=u,n)){const b=!ch.length;for(const w of i)w[1](),ch.push(w,t);if(b){for(let w=0;w{i.delete(w),i.size===0&&n&&(n(),n=null)}}return{set:a,update:c,subscribe:p}}let c2=Date.now();function Vf(t){return`${t}-${c2++}`}const U_=Symbol.for("svelte-maplibre");function Uf(){return n2(U_)}function h2(t){let e=new WeakMap;return n=>{var p;let i=e.get(n.originalEvent);if(i!==void 0)return i;let c=(p=n.target.queryRenderedFeatures(n.point).find(u=>{var b;return(b=t.get(u.layer.id))==null?void 0:b.interactive}))==null?void 0:p.layer.id;return e.set(n.originalEvent,c),c}}function p2(){let t=new Map;return I1(U_,{map:gr(null),source:l_(null),layer:l_(null),popupTarget:l_(null),cluster:gr(),loadedImages:gr(new Set),minzoom:gr(0),maxzoom:gr(24),layerEvent:gr(null),layerInfo:t,eventTopMost:h2(t)})}function H0(t){return{subscribe:t.subscribe}}function T1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:i=!1}){let a=Uf(),c=gr(null),p=H0(c),u={...a,[t]:H0(c)};if(e&&(u.popupTarget=p),i){let b=gr(null);u.layerEvent=b,a.layerEvent=b}return n&&(u.cluster=gr()),I1(U_,u),{...a,self:c}}function f2(){return T1({key:"source",setCluster:!0})}function d2(t=!0){return T1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function YT(t){return"layerType"in t&&t.layerType==="deckgl"}var L1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function P1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function G_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){if(this instanceof i){var a=[null];a.push.apply(a,arguments);var c=Function.bind.apply(e,a);return new c}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:function(){return t[i]}})}),n}var M1={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.1.0/LICENSE.txt - */(function(t,e){(function(n,i){t.exports=i()})(L1,function(){var n={},i={};function a(p,u,b){if(i[p]=b,p==="index"){var w="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",T={};return i.shared(T),i.index(n,T),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([w],{type:"text/javascript"}))),n}}a("shared",["exports"],function(p){function u(s,r,l,f){return new(l||(l=Promise))(function(m,v){function x(M){try{S(f.next(M))}catch(D){v(D)}}function I(M){try{S(f.throw(M))}catch(D){v(D)}}function S(M){var D;M.done?m(M.value):(D=M.value,D instanceof l?D:new l(function(N){N(D)})).then(x,I)}S((f=f.apply(s,r||[])).next())})}function b(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var w=T;function T(s,r){this.x=s,this.y=r}T.prototype={clone:function(){return new T(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,r){return this.clone()._rotateAround(s,r)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var r=s.x-this.x,l=s.y-this.y;return r*r+l*l},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,r){return Math.atan2(this.x*r-this.y*s,this.x*s+this.y*r)},_matMult:function(s){var r=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=r,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var r=Math.cos(s),l=Math.sin(s),f=l*this.x+r*this.y;return this.x=r*this.x-l*this.y,this.y=f,this},_rotateAround:function(s,r){var l=Math.cos(s),f=Math.sin(s),m=r.y+f*(this.x-r.x)+l*(this.y-r.y);return this.x=r.x+l*(this.x-r.x)-f*(this.y-r.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},T.convert=function(s){return s instanceof T?s:Array.isArray(s)?new T(s[0],s[1]):s};var P=b(w),k=B;function B(s,r,l,f){this.cx=3*s,this.bx=3*(l-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(f-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=r,this.p2x=l,this.p2y=f}B.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,r){if(r===void 0&&(r=1e-6),s<0)return 0;if(s>1)return 1;for(var l=s,f=0;f<8;f++){var m=this.sampleCurveX(l)-s;if(Math.abs(m)m?x=l:I=l,l=.5*(I-x)+x;return l},solve:function(s,r){return this.sampleCurveY(this.solveCurveX(s,r))}};var V=b(k);let tt,ot;function ut(){return tt==null&&(tt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),tt}function W(){if(ot==null&&(ot=!1,ut())){const r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let f=0;f<5*5;f++){const m=4*f;r.fillStyle=`rgb(${m},${m+1},${m+2})`,r.fillRect(f%5,Math.floor(f/5),1,1)}const l=r.getImageData(0,0,5,5).data;for(let f=0;f<5*5*4;f++)if(f%4!=3&&l[f]!==f){ot=!0;break}}}return ot||!1}function X(s,r,l,f){const m=new V(s,r,l,f);return function(v){return m.solve(v)}}const J=X(.25,.1,.25,1);function ht(s,r,l){return Math.min(l,Math.max(r,s))}function vt(s,r,l){const f=l-r,m=((s-r)%f+f)%f+r;return m===r?l:m}function gt(s,...r){for(const l of r)for(const f in l)s[f]=l[f];return s}let St=1;function It(s,r,l){const f={};for(const m in s)f[m]=r.call(l||this,s[m],m,s);return f}function Ft(s,r,l){const f={};for(const m in s)r.call(l||this,s[m],m,s)&&(f[m]=s[m]);return f}function mt(s){return Array.isArray(s)?s.map(mt):typeof s=="object"&&s?It(s,mt):s}const Ct={};function ie(s){Ct[s]||(typeof console<"u"&&console.warn(s),Ct[s]=!0)}function Tt(s,r,l){return(l.y-s.y)*(r.x-s.x)>(r.y-s.y)*(l.x-s.x)}function ee(s){let r=0;for(let l,f,m=0,v=s.length,x=v-1;m"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(s,{timestamp:0});try{const x=v==null?void 0:v.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const I=x.startsWith("BGR"),S=new Uint8ClampedArray(f*m*4);if(yield v.copyTo(S,function(M,D,N,F,G){const j=4*Math.max(-D,0),Y=(Math.max(0,N)-N)*F*4+j,it=4*F,at=Math.max(0,D),bt=Math.max(0,N);return{rect:{x:at,y:bt,width:Math.min(M.width,D+F)-at,height:Math.min(M.height,N+G)-bt},layout:[{offset:Y,stride:it}]}}(s,r,l,f,m)),I)for(let M=0;Mge(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,yn=function(s,r){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const f=Wn(s.url);if(f)return f(s,r);if(ge(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:s,targetMapId:ri},r)}if(!(/^file:/.test(l=s.url)||/^file:/.test(Ue())&&!/^\w+:/.test(l))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(f,m){return u(this,void 0,void 0,function*(){const v=new Request(f.url,{method:f.method||"GET",body:f.body,credentials:f.credentials,headers:f.headers,cache:f.cache,referrer:Ue(),signal:m.signal});f.type==="json"&&v.headers.set("Accept","application/json");const x=yield fetch(v);if(!x.ok){const M=yield x.blob();throw new Kt(x.status,x.statusText,f.url,M)}const I=f.type==="arrayBuffer"||f.type==="image"?x.arrayBuffer():f.type==="json"?x.json():x.text(),S=yield I;if(m.signal.aborted)throw qn();return{data:S,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(s,r);if(ge(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:s,mustQueue:!0,targetMapId:ri},r)}var l;return function(f,m){return new Promise((v,x)=>{const I=new XMLHttpRequest;I.open(f.method||"GET",f.url,!0),f.type!=="arrayBuffer"&&f.type!=="image"||(I.responseType="arraybuffer");for(const S in f.headers)I.setRequestHeader(S,f.headers[S]);f.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=f.credentials==="include",I.onerror=()=>{x(new Error(I.statusText))},I.onload=()=>{if(!m.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let S=I.response;if(f.type==="json")try{S=JSON.parse(I.response)}catch(M){return void x(M)}v({data:S,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const S=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});x(new Kt(I.status,I.statusText,f.url,S))}},m.signal.addEventListener("abort",()=>{I.abort(),x(qn())}),I.send(f.body)})}(s,r)};function br(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const r=new URL(s),l=window.location;return r.protocol===l.protocol&&r.host===l.host}function er(s,r,l){l[s]&&l[s].indexOf(r)!==-1||(l[s]=l[s]||[],l[s].push(r))}function Gt(s,r,l){if(l&&l[s]){const f=l[s].indexOf(r);f!==-1&&l[s].splice(f,1)}}class Fe{constructor(r,l={}){gt(this,l),this.type=r}}class Ie extends Fe{constructor(r,l={}){super("error",gt({error:r},l))}}class Ri{on(r,l){return this._listeners=this._listeners||{},er(r,l,this._listeners),this}off(r,l){return Gt(r,l,this._listeners),Gt(r,l,this._oneTimeListeners),this}once(r,l){return l?(this._oneTimeListeners=this._oneTimeListeners||{},er(r,l,this._oneTimeListeners),this):new Promise(f=>this.once(r,f))}fire(r,l){typeof r=="string"&&(r=new Fe(r,l||{}));const f=r.type;if(this.listens(f)){r.target=this;const m=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];for(const I of m)I.call(this,r);const v=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];for(const I of v)Gt(f,I,this._oneTimeListeners),I.call(this,r);const x=this._eventedParent;x&&(gt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(r))}else r instanceof Ie&&console.error(r.error);return this}listens(r){return this._listeners&&this._listeners[r]&&this._listeners[r].length>0||this._oneTimeListeners&&this._oneTimeListeners[r]&&this._oneTimeListeners[r].length>0||this._eventedParent&&this._eventedParent.listens(r)}setEventedParent(r,l){return this._eventedParent=r,this._eventedParentData=l,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 sn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Bi(s,r){const l={};for(const f in s)f!=="ref"&&(l[f]=s[f]);return sn.forEach(f=>{f in r&&(l[f]=r[f])}),l}function Qe(s,r){if(Array.isArray(s)){if(!Array.isArray(r)||s.length!==r.length)return!1;for(let l=0;l`:s.itemType.kind==="value"?"array":`array<${r}>`}return s.kind}const ft=[Ni,Jt,He,je,yi,Ii,zo,Z(Ge),rt,O,U];function H(s,r){if(r.kind==="error")return null;if(s.kind==="array"){if(r.kind==="array"&&(r.N===0&&r.itemType.kind==="value"||!H(s.itemType,r.itemType))&&(typeof s.N!="number"||s.N===r.N))return null}else{if(s.kind===r.kind)return null;if(s.kind==="value"){for(const l of ft)if(!H(l,r))return null}}return`Expected ${$(s)} but found ${$(r)} instead.`}function dt(s,r){return r.some(l=>l.kind===s.kind)}function lt(s,r){return r.some(l=>l==="null"?s===null:l==="array"?Array.isArray(s):l==="object"?s&&!Array.isArray(s)&&typeof s=="object":l===typeof s)}function xt(s,r){return s.kind==="array"&&r.kind==="array"?s.itemType.kind===r.itemType.kind&&typeof s.N=="number":s.kind===r.kind}const At=.96422,Rt=.82521,Nt=4/29,xe=6/29,Ee=3*xe*xe,ze=xe*xe*xe,Be=Math.PI/180,fn=180/Math.PI;function Nn(s){return(s%=360)<0&&(s+=360),s}function ti([s,r,l,f]){let m,v;const x=Ke((.2225045*(s=zi(s))+.7168786*(r=zi(r))+.0606169*(l=zi(l)))/1);s===r&&r===l?m=v=x:(m=Ke((.4360747*s+.3850649*r+.1430804*l)/At),v=Ke((.0139322*s+.0971045*r+.7141733*l)/Rt));const I=116*x-16;return[I<0?0:I,500*(m-x),200*(x-v),f]}function zi(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Ke(s){return s>ze?Math.pow(s,1/3):s/Ee+Nt}function ui([s,r,l,f]){let m=(s+16)/116,v=isNaN(r)?m:m+r/500,x=isNaN(l)?m:m-l/200;return m=1*Vr(m),v=At*Vr(v),x=Rt*Vr(x),[Vi(3.1338561*v-1.6168667*m-.4906146*x),Vi(-.9787684*v+1.9161415*m+.033454*x),Vi(.0719453*v-.2289914*m+1.4052427*x),f]}function Vi(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Vr(s){return s>xe?s*s*s:Ee*(s-Nt)}function no(s){return parseInt(s.padEnd(2,s),16)/255}function nr(s,r){return Is(r?s/100:s,0,1)}function Is(s,r,l){return Math.min(Math.max(r,s),l)}function td(s){return!s.some(Number.isNaN)}const ng={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 Pn{constructor(r,l,f,m=1,v=!0){this.r=r,this.g=l,this.b=f,this.a=m,v||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[r,l,f,m]))}static parse(r){if(r instanceof Pn)return r;if(typeof r!="string")return;const l=function(f){if((f=f.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=ng[f];if(m){const[x,I,S]=m;return[x/255,I/255,S/255,1]}if(f.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(f)){const x=f.length<6?1:2;let I=1;return[no(f.slice(I,I+=x)),no(f.slice(I,I+=x)),no(f.slice(I,I+=x)),no(f.slice(I,I+x)||"ff")]}if(f.startsWith("rgb")){const x=f.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[I,S,M,D,N,F,G,j,Y,it,at,bt]=x,ct=[D||" ",G||" ",it].join("");if(ct===" "||ct===" /"||ct===",,"||ct===",,,"){const _t=[M,F,Y].join(""),Ot=_t==="%%%"?100:_t===""?255:0;if(Ot){const Vt=[Is(+S/Ot,0,1),Is(+N/Ot,0,1),Is(+j/Ot,0,1),at?nr(+at,bt):1];if(td(Vt))return Vt}}return}}const v=f.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[x,I,S,M,D,N,F,G,j]=v,Y=[S||" ",D||" ",F].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const it=[+I,Is(+M,0,100),Is(+N,0,100),G?nr(+G,j):1];if(td(it))return function([at,bt,ct,_t]){function Ot(Vt){const ue=(Vt+at/30)%12,ve=bt*Math.min(ct,1-ct);return ct-ve*Math.max(-1,Math.min(ue-3,9-ue,1))}return at=Nn(at),bt/=100,ct/=100,[Ot(0),Ot(8),Ot(4),_t]}(it)}}}(r);return l?new Pn(...l,!1):void 0}get rgb(){const{r,g:l,b:f,a:m}=this,v=m||1/0;return this.overwriteGetter("rgb",[r/v,l/v,f/v,m])}get hcl(){return this.overwriteGetter("hcl",function(r){const[l,f,m,v]=ti(r),x=Math.sqrt(f*f+m*m);return[Math.round(1e4*x)?Nn(Math.atan2(m,f)*fn):NaN,x,l,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ti(this.rgb))}overwriteGetter(r,l){return Object.defineProperty(this,r,{value:l}),l}toString(){const[r,l,f,m]=this.rgb;return`rgba(${[r,l,f].map(v=>Math.round(255*v)).join(",")},${m})`}}Pn.black=new Pn(0,0,0,1),Pn.white=new Pn(1,1,1,1),Pn.transparent=new Pn(0,0,0,0),Pn.red=new Pn(1,0,0,1);class Qh{constructor(r,l,f){this.sensitivity=r?l?"variant":"case":l?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(r,l){return this.collator.compare(r,l)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class $h{constructor(r,l,f,m,v){this.text=r,this.image=l,this.scale=f,this.fontStack=m,this.textColor=v}}class vo{constructor(r){this.sections=r}static fromString(r){return new vo([new $h(r,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(r=>r.text.length!==0||r.image&&r.image.name.length!==0)}static factory(r){return r instanceof vo?r:vo.fromString(r)}toString(){return this.sections.length===0?"":this.sections.map(r=>r.text).join("")}}class io{constructor(r){this.values=r.slice()}static parse(r){if(r instanceof io)return r;if(typeof r=="number")return new io([r,r,r,r]);if(Array.isArray(r)&&!(r.length<1||r.length>4)){for(const l of r)if(typeof l!="number")return;switch(r.length){case 1:r=[r[0],r[0],r[0],r[0]];break;case 2:r=[r[0],r[1],r[0],r[1]];break;case 3:r=[r[0],r[1],r[2],r[1]]}return new io(r)}}toString(){return JSON.stringify(this.values)}}const yu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Oo{constructor(r){this.values=r.slice()}static parse(r){if(r instanceof Oo)return r;if(Array.isArray(r)&&!(r.length<1)&&r.length%2==0){for(let l=0;l=0&&s<=255&&typeof r=="number"&&r>=0&&r<=255&&typeof l=="number"&&l>=0&&l<=255?f===void 0||typeof f=="number"&&f>=0&&f<=1?null:`Invalid rgba value [${[s,r,l,f].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof f=="number"?[s,r,l,f]:[s,r,l]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function mc(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Pn||s instanceof Qh||s instanceof vo||s instanceof io||s instanceof Oo||s instanceof Fo)return!0;if(Array.isArray(s)){for(const r of s)if(!mc(r))return!1;return!0}if(typeof s=="object"){for(const r in s)if(!mc(s[r]))return!1;return!0}return!1}function Oi(s){if(s===null)return Ni;if(typeof s=="string")return He;if(typeof s=="boolean")return je;if(typeof s=="number")return Jt;if(s instanceof Pn)return yi;if(s instanceof Qh)return ea;if(s instanceof vo)return Ii;if(s instanceof io)return rt;if(s instanceof Oo)return U;if(s instanceof Fo)return O;if(Array.isArray(s)){const r=s.length;let l;for(const f of s){const m=Oi(f);if(l){if(l===m)continue;l=Ge;break}l=m}return Z(l||Ge,r)}return zo}function vu(s){const r=typeof s;return s===null?"":r==="string"||r==="number"||r==="boolean"?String(s):s instanceof Pn||s instanceof vo||s instanceof io||s instanceof Oo||s instanceof Fo?s.toString():JSON.stringify(s)}class Ea{constructor(r,l){this.type=r,this.value=l}static parse(r,l){if(r.length!==2)return l.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!mc(r[1]))return l.error("invalid value");const f=r[1];let m=Oi(f);const v=l.expectedType;return m.kind!=="array"||m.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(m=v),new Ea(m,f)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class oi{constructor(r){this.name="ExpressionEvaluationError",this.message=r}toJSON(){return this.message}}const gc={string:He,number:Jt,boolean:je,object:zo};class xo{constructor(r,l){this.type=r,this.args=l}static parse(r,l){if(r.length<2)return l.error("Expected at least one argument.");let f,m=1;const v=r[0];if(v==="array"){let I,S;if(r.length>2){const M=r[1];if(typeof M!="string"||!(M in gc)||M==="object")return l.error('The item type argument of "array" must be one of string, number, boolean',1);I=gc[M],m++}else I=Ge;if(r.length>3){if(r[2]!==null&&(typeof r[2]!="number"||r[2]<0||r[2]!==Math.floor(r[2])))return l.error('The length argument to "array" must be a positive integer literal',2);S=r[2],m++}f=Z(I,S)}else{if(!gc[v])throw new Error(`Types doesn't contain name = ${v}`);f=gc[v]}const x=[];for(;mr.outputDefined())}}const _c={"to-boolean":je,"to-color":yi,"to-number":Jt,"to-string":He};class Es{constructor(r,l){this.type=r,this.args=l}static parse(r,l){if(r.length<2)return l.error("Expected at least one argument.");const f=r[0];if(!_c[f])throw new Error(`Can't parse ${f} as it is not part of the known types`);if((f==="to-boolean"||f==="to-string")&&r.length!==2)return l.error("Expected one argument.");const m=_c[f],v=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(l)}: expected an array containing either three or four numeric values.`:Rl(l[0],l[1],l[2],l[3]),!f))return new Pn(l[0]/255,l[1]/255,l[2]/255,l[3])}throw new oi(f||`Could not parse color from value '${typeof l=="string"?l:JSON.stringify(l)}'`)}case"padding":{let l;for(const f of this.args){l=f.evaluate(r);const m=io.parse(l);if(m)return m}throw new oi(`Could not parse padding from value '${typeof l=="string"?l:JSON.stringify(l)}'`)}case"variableAnchorOffsetCollection":{let l;for(const f of this.args){l=f.evaluate(r);const m=Oo.parse(l);if(m)return m}throw new oi(`Could not parse variableAnchorOffsetCollection from value '${typeof l=="string"?l:JSON.stringify(l)}'`)}case"number":{let l=null;for(const f of this.args){if(l=f.evaluate(r),l===null)return 0;const m=Number(l);if(!isNaN(m))return m}throw new oi(`Could not convert ${JSON.stringify(l)} to number.`)}case"formatted":return vo.fromString(vu(this.args[0].evaluate(r)));case"resolvedImage":return Fo.fromString(vu(this.args[0].evaluate(r)));default:return vu(this.args[0].evaluate(r))}}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}}const xu=["Unknown","Point","LineString","Polygon"];class Mn{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"?xu[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(r){let l=this._parseColorCache[r];return l||(l=this._parseColorCache[r]=Pn.parse(r)),l}}class yc{constructor(r,l,f=[],m,v=new Qa,x=[]){this.registry=r,this.path=f,this.key=f.map(I=>`[${I}]`).join(""),this.scope=v,this.errors=x,this.expectedType=m,this._isConstant=l}parse(r,l,f,m,v={}){return l?this.concat(l,f,m)._parse(r,v):this._parse(r,v)}_parse(r,l){function f(m,v,x){return x==="assert"?new xo(v,[m]):x==="coerce"?new Es(v,[m]):m}if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"||(r=["literal",r]),Array.isArray(r)){if(r.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=r[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[m];if(v){let x=v.parse(r,this);if(!x)return null;if(this.expectedType){const I=this.expectedType,S=x.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||S.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||S.kind!=="value"&&S.kind!=="string")if(I.kind!=="padding"||S.kind!=="value"&&S.kind!=="number"&&S.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||S.kind!=="value"&&S.kind!=="array"){if(this.checkSubtype(I,S))return null}else x=f(x,I,l.typeAnnotation||"coerce");else x=f(x,I,l.typeAnnotation||"coerce");else x=f(x,I,l.typeAnnotation||"coerce");else x=f(x,I,l.typeAnnotation||"assert")}if(!(x instanceof Ea)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const I=new Mn;try{x=new Ea(x.type,x.evaluate(I))}catch(S){return this.error(S.message),null}}return x}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(r===void 0?"'undefined' value invalid. Use null instead.":typeof r=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof r} instead.`)}concat(r,l,f){const m=typeof r=="number"?this.path.concat(r):this.path,v=f?this.scope.concat(f):this.scope;return new yc(this.registry,this._isConstant,m,l||null,v,this.errors)}error(r,...l){const f=`${this.key}${l.map(m=>`[${m}]`).join("")}`;this.errors.push(new Br(f,r))}checkSubtype(r,l){const f=H(r,l);return f&&this.error(f),f}}class Nl{constructor(r,l,f){this.type=ea,this.locale=f,this.caseSensitive=r,this.diacriticSensitive=l}static parse(r,l){if(r.length!==2)return l.error("Expected one argument.");const f=r[1];if(typeof f!="object"||Array.isArray(f))return l.error("Collator options argument must be an object.");const m=l.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,je);if(!m)return null;const v=l.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,je);if(!v)return null;let x=null;return f.locale&&(x=l.parse(f.locale,1,He),!x)?null:new Nl(m,v,x)}evaluate(r){return new Qh(this.caseSensitive.evaluate(r),this.diacriticSensitive.evaluate(r),this.locale?this.locale.evaluate(r):null)}eachChild(r){r(this.caseSensitive),r(this.diacriticSensitive),this.locale&&r(this.locale)}outputDefined(){return!1}}const Sa=8192;function vc(s,r){s[0]=Math.min(s[0],r[0]),s[1]=Math.min(s[1],r[1]),s[2]=Math.max(s[2],r[0]),s[3]=Math.max(s[3],r[1])}function bu(s,r){return!(s[0]<=r[0]||s[2]>=r[2]||s[1]<=r[1]||s[3]>=r[3])}function ig(s,r){const l=(180+s[0])/360,f=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,m=Math.pow(2,r.z);return[Math.round(l*m*Sa),Math.round(f*m*Sa)]}function ed(s,r,l){const f=s[0]-r[0],m=s[1]-r[1],v=s[0]-l[0],x=s[1]-l[1];return f*x-v*m==0&&f*v<=0&&m*x<=0}function xc(s,r){let l=!1;for(let x=0,I=r.length;x(f=s)[1]!=(v=S[M+1])[1]>f[1]&&f[0]<(v[0]-m[0])*(f[1]-m[1])/(v[1]-m[1])+m[0]&&(l=!l)}}var f,m,v;return l}function rg(s,r){for(let l=0;l0&&I<0||x<0&&I>0}function og(s,r,l){for(const M of l)for(let D=0;Dl[2]){const m=.5*f;let v=s[0]-l[0]>m?-f:l[0]-s[0]>m?f:0;v===0&&(v=s[0]-l[2]>m?-f:l[2]-s[0]>m?f:0),s[0]+=v}vc(r,s)}function wc(s,r,l,f){const m=Math.pow(2,f.z)*Sa,v=[f.x*Sa,f.y*Sa],x=[];for(const I of s)for(const S of I){const M=[S.x+v[0],S.y+v[1]];sd(M,r,l,m),x.push(M)}return x}function ad(s,r,l,f){const m=Math.pow(2,f.z)*Sa,v=[f.x*Sa,f.y*Sa],x=[];for(const S of s){const M=[];for(const D of S){const N=[D.x+v[0],D.y+v[1]];vc(r,N),M.push(N)}x.push(M)}if(r[2]-r[0]<=m/2){(I=r)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const S of x)for(const M of S)sd(M,r,l,m)}var I;return x}class $a{constructor(r,l){this.type=je,this.geojson=r,this.geometries=l}static parse(r,l){if(r.length!==2)return l.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(mc(r[1])){const f=r[1];if(f.type==="FeatureCollection"){const m=[];for(const v of f.features){const{type:x,coordinates:I}=v.geometry;x==="Polygon"&&m.push(I),x==="MultiPolygon"&&m.push(...I)}if(m.length)return new $a(f,{type:"MultiPolygon",coordinates:m})}else if(f.type==="Feature"){const m=f.geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new $a(f,f.geometry)}else if(f.type==="Polygon"||f.type==="MultiPolygon")return new $a(f,f)}return l.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(r){if(r.geometry()!=null&&r.canonicalID()!=null){if(r.geometryType()==="Point")return function(l,f){const m=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=l.canonicalID();if(f.type==="Polygon"){const I=bc(f.coordinates,v,x),S=wc(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!xc(M,I))return!1}if(f.type==="MultiPolygon"){const I=od(f.coordinates,v,x),S=wc(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!rg(M,I))return!1}return!0}(r,this.geometries);if(r.geometryType()==="LineString")return function(l,f){const m=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=l.canonicalID();if(f.type==="Polygon"){const I=bc(f.coordinates,v,x),S=ad(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!id(M,I))return!1}if(f.type==="MultiPolygon"){const I=od(f.coordinates,v,x),S=ad(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!rd(M,I))return!1}return!0}(r,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ic{constructor(r,l){this.type=l.type,this.name=r,this.boundExpression=l}static parse(r,l){if(r.length!==2||typeof r[1]!="string")return l.error("'var' expression requires exactly one string literal argument.");const f=r[1];return l.scope.has(f)?new Ic(f,l.scope.get(f)):l.error(`Unknown variable "${f}". Make sure "${f}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(r){return this.boundExpression.evaluate(r)}eachChild(){}outputDefined(){return!1}}class bo{constructor(r,l,f,m){this.name=r,this.type=l,this._evaluate=f,this.args=m}evaluate(r){return this._evaluate(r,this.args)}eachChild(r){this.args.forEach(r)}outputDefined(){return!1}static parse(r,l){const f=r[0],m=bo.definitions[f];if(!m)return l.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(m)?m[0]:m.type,x=Array.isArray(m)?[[m[1],m[2]]]:m.overloads,I=x.filter(([M])=>!Array.isArray(M)||M.length===r.length-1);let S=null;for(const[M,D]of I){S=new yc(l.registry,wu,l.path,null,l.scope);const N=[];let F=!1;for(let G=1;G{return F=N,Array.isArray(F)?`(${F.map($).join(", ")})`:`(${$(F.type)}...)`;var F}).join(" | "),D=[];for(let N=1;N{l=r?l&&wu(f):l&&f instanceof Ea}),!!l&&Ec(s)&&Eu(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ec(s){if(s instanceof bo&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof $a)return!1;let r=!0;return s.eachChild(l=>{r&&!Ec(l)&&(r=!1)}),r}function Iu(s){if(s instanceof bo&&s.name==="feature-state")return!1;let r=!0;return s.eachChild(l=>{r&&!Iu(l)&&(r=!1)}),r}function Eu(s,r){if(s instanceof bo&&r.indexOf(s.name)>=0)return!1;let l=!0;return s.eachChild(f=>{l&&!Eu(f,r)&&(l=!1)}),l}function Su(s,r){const l=s.length-1;let f,m,v=0,x=l,I=0;for(;v<=x;)if(I=Math.floor((v+x)/2),f=s[I],m=s[I+1],f<=r){if(I===l||rr))throw new oi("Input is not a number.");x=I-1}return 0}class Cu{constructor(r,l,f){this.type=r,this.input=l,this.labels=[],this.outputs=[];for(const[m,v]of f)this.labels.push(m),this.outputs.push(v)}static parse(r,l){if(r.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return l.error("Expected an even number of arguments.");const f=l.parse(r[1],1,Jt);if(!f)return null;const m=[];let v=null;l.expectedType&&l.expectedType.kind!=="value"&&(v=l.expectedType);for(let x=1;x=I)return l.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',M);const N=l.parse(S,D,v);if(!N)return null;v=v||N.type,m.push([I,N])}return new Cu(v,f,m)}evaluate(r){const l=this.labels,f=this.outputs;if(l.length===1)return f[0].evaluate(r);const m=this.input.evaluate(r);if(m<=l[0])return f[0].evaluate(r);const v=l.length;return m>=l[v-1]?f[v-1].evaluate(r):f[Su(l,m)].evaluate(r)}eachChild(r){r(this.input);for(const l of this.outputs)r(l)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}}function sg(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ag=ld;function ld(s,r,l,f){this.cx=3*s,this.bx=3*(l-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(f-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=r,this.p2x=l,this.p2y=f}ld.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,r){if(r===void 0&&(r=1e-6),s<0)return 0;if(s>1)return 1;for(var l=s,f=0;f<8;f++){var m=this.sampleCurveX(l)-s;if(Math.abs(m)m?x=l:I=l,l=.5*(I-x)+x;return l},solve:function(s,r){return this.sampleCurveY(this.solveCurveX(s,r))}};var lg=sg(ag);function tl(s,r,l){return s+l*(r-s)}function Sc(s,r,l){return s.map((f,m)=>tl(f,r[m],l))}const Ur={number:tl,color:function(s,r,l,f="rgb"){switch(f){case"rgb":{const[m,v,x,I]=Sc(s.rgb,r.rgb,l);return new Pn(m,v,x,I,!1)}case"hcl":{const[m,v,x,I]=s.hcl,[S,M,D,N]=r.hcl;let F,G;if(isNaN(m)||isNaN(S))isNaN(m)?isNaN(S)?F=NaN:(F=S,x!==1&&x!==0||(G=M)):(F=m,D!==1&&D!==0||(G=v));else{let bt=S-m;S>m&&bt>180?bt-=360:S180&&(bt+=360),F=m+l*bt}const[j,Y,it,at]=function([bt,ct,_t,Ot]){return bt=isNaN(bt)?0:bt*Be,ui([_t,Math.cos(bt)*ct,Math.sin(bt)*ct,Ot])}([F,G??tl(v,M,l),tl(x,D,l),tl(I,N,l)]);return new Pn(j,Y,it,at,!1)}case"lab":{const[m,v,x,I]=ui(Sc(s.lab,r.lab,l));return new Pn(m,v,x,I,!1)}}},array:Sc,padding:function(s,r,l){return new io(Sc(s.values,r.values,l))},variableAnchorOffsetCollection:function(s,r,l){const f=s.values,m=r.values;if(f.length!==m.length)throw new oi(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${r.toString()}`);const v=[];for(let x=0;xtypeof D!="number"||D<0||D>1))return l.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:M}}}if(r.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return l.error("Expected an even number of arguments.");if(v=l.parse(v,2,Jt),!v)return null;const I=[];let S=null;f==="interpolate-hcl"||f==="interpolate-lab"?S=yi:l.expectedType&&l.expectedType.kind!=="value"&&(S=l.expectedType);for(let M=0;M=D)return l.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',F);const j=l.parse(N,G,S);if(!j)return null;S=S||j.type,I.push([D,j])}return xt(S,Jt)||xt(S,yi)||xt(S,rt)||xt(S,U)||xt(S,Z(Jt))?new Ir(S,f,m,v,I):l.error(`Type ${$(S)} is not interpolatable.`)}evaluate(r){const l=this.labels,f=this.outputs;if(l.length===1)return f[0].evaluate(r);const m=this.input.evaluate(r);if(m<=l[0])return f[0].evaluate(r);const v=l.length;if(m>=l[v-1])return f[v-1].evaluate(r);const x=Su(l,m),I=Ir.interpolationFactor(this.interpolation,m,l[x],l[x+1]),S=f[x].evaluate(r),M=f[x+1].evaluate(r);switch(this.operator){case"interpolate":return Ur[this.type.kind](S,M,I);case"interpolate-hcl":return Ur.color(S,M,I,"hcl");case"interpolate-lab":return Ur.color(S,M,I,"lab")}}eachChild(r){r(this.input);for(const l of this.outputs)r(l)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}}function En(s,r,l,f){const m=f-l,v=s-l;return m===0?0:r===1?v/m:(Math.pow(r,v)-1)/(Math.pow(r,m)-1)}class Cc{constructor(r,l){this.type=r,this.args=l}static parse(r,l){if(r.length<2)return l.error("Expectected at least one argument.");let f=null;const m=l.expectedType;m&&m.kind!=="value"&&(f=m);const v=[];for(const I of r.slice(1)){const S=l.parse(I,1+v.length,f,void 0,{typeAnnotation:"omit"});if(!S)return null;f=f||S.type,v.push(S)}if(!f)throw new Error("No output type");const x=m&&v.some(I=>H(m,I.type));return new Cc(x?Ge:f,v)}evaluate(r){let l,f=null,m=0;for(const v of this.args)if(m++,f=v.evaluate(r),f&&f instanceof Fo&&!f.available&&(l||(l=f.name),f=null,m===this.args.length&&(f=l)),f!==null)break;return f}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}}class Tc{constructor(r,l){this.type=l.type,this.bindings=[].concat(r),this.result=l}evaluate(r){return this.result.evaluate(r)}eachChild(r){for(const l of this.bindings)r(l[1]);r(this.result)}static parse(r,l){if(r.length<4)return l.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);const f=[];for(let v=1;v=f.length)throw new oi(`Array index out of bounds: ${l} > ${f.length-1}.`);if(l!==Math.floor(l))throw new oi(`Array index must be an integer, but found ${l} instead.`);return f[l]}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}}class ep{constructor(r,l){this.type=je,this.needle=r,this.haystack=l}static parse(r,l){if(r.length!==3)return l.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const f=l.parse(r[1],1,Ge),m=l.parse(r[2],2,Ge);return f&&m?dt(f.type,[je,He,Jt,Ni,Ge])?new ep(f,m):l.error(`Expected first argument to be of type boolean, string, number or null, but found ${$(f.type)} instead`):null}evaluate(r){const l=this.needle.evaluate(r),f=this.haystack.evaluate(r);if(!f)return!1;if(!lt(l,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${$(Oi(l))} instead.`);if(!lt(f,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${$(Oi(f))} instead.`);return f.indexOf(l)>=0}eachChild(r){r(this.needle),r(this.haystack)}outputDefined(){return!0}}class Lc{constructor(r,l,f){this.type=Jt,this.needle=r,this.haystack=l,this.fromIndex=f}static parse(r,l){if(r.length<=2||r.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const f=l.parse(r[1],1,Ge),m=l.parse(r[2],2,Ge);if(!f||!m)return null;if(!dt(f.type,[je,He,Jt,Ni,Ge]))return l.error(`Expected first argument to be of type boolean, string, number or null, but found ${$(f.type)} instead`);if(r.length===4){const v=l.parse(r[3],3,Jt);return v?new Lc(f,m,v):null}return new Lc(f,m)}evaluate(r){const l=this.needle.evaluate(r),f=this.haystack.evaluate(r);if(!lt(l,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${$(Oi(l))} instead.`);if(!lt(f,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${$(Oi(f))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(r);return f.indexOf(l,m)}return f.indexOf(l)}eachChild(r){r(this.needle),r(this.haystack),this.fromIndex&&r(this.fromIndex)}outputDefined(){return!1}}class np{constructor(r,l,f,m,v,x){this.inputType=r,this.type=l,this.input=f,this.cases=m,this.outputs=v,this.otherwise=x}static parse(r,l){if(r.length<5)return l.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return l.error("Expected an even number of arguments.");let f,m;l.expectedType&&l.expectedType.kind!=="value"&&(m=l.expectedType);const v={},x=[];for(let M=2;MNumber.MAX_SAFE_INTEGER)return F.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof j=="number"&&Math.floor(j)!==j)return F.error("Numeric branch labels must be integer values.");if(f){if(F.checkSubtype(f,Oi(j)))return null}else f=Oi(j);if(v[String(j)]!==void 0)return F.error("Branch labels must be unique.");v[String(j)]=x.length}const G=l.parse(N,M,m);if(!G)return null;m=m||G.type,x.push(G)}const I=l.parse(r[1],1,Ge);if(!I)return null;const S=l.parse(r[r.length-1],r.length-1,m);return S?I.type.kind!=="value"&&l.concat(1).checkSubtype(f,I.type)?null:new np(f,m,I,v,x,S):null}evaluate(r){const l=this.input.evaluate(r);return(Oi(l)===this.inputType&&this.outputs[this.cases[l]]||this.otherwise).evaluate(r)}eachChild(r){r(this.input),this.outputs.forEach(r),r(this.otherwise)}outputDefined(){return this.outputs.every(r=>r.outputDefined())&&this.otherwise.outputDefined()}}class ip{constructor(r,l,f){this.type=r,this.branches=l,this.otherwise=f}static parse(r,l){if(r.length<4)return l.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return l.error("Expected an odd number of arguments.");let f;l.expectedType&&l.expectedType.kind!=="value"&&(f=l.expectedType);const m=[];for(let x=1;xl.outputDefined())&&this.otherwise.outputDefined()}}class Pc{constructor(r,l,f,m){this.type=r,this.input=l,this.beginIndex=f,this.endIndex=m}static parse(r,l){if(r.length<=2||r.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const f=l.parse(r[1],1,Ge),m=l.parse(r[2],2,Jt);if(!f||!m)return null;if(!dt(f.type,[Z(Ge),He,Ge]))return l.error(`Expected first argument to be of type array or string, but found ${$(f.type)} instead`);if(r.length===4){const v=l.parse(r[3],3,Jt);return v?new Pc(f.type,f,m,v):null}return new Pc(f.type,f,m)}evaluate(r){const l=this.input.evaluate(r),f=this.beginIndex.evaluate(r);if(!lt(l,["string","array"]))throw new oi(`Expected first argument to be of type array or string, but found ${$(Oi(l))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(r);return l.slice(f,m)}return l.slice(f)}eachChild(r){r(this.input),r(this.beginIndex),this.endIndex&&r(this.endIndex)}outputDefined(){return!1}}function ud(s,r){return s==="=="||s==="!="?r.kind==="boolean"||r.kind==="string"||r.kind==="number"||r.kind==="null"||r.kind==="value":r.kind==="string"||r.kind==="number"||r.kind==="value"}function cd(s,r,l,f){return f.compare(r,l)===0}function zl(s,r,l){const f=s!=="=="&&s!=="!=";return class A1{constructor(v,x,I){this.type=je,this.lhs=v,this.rhs=x,this.collator=I,this.hasUntypedArgument=v.type.kind==="value"||x.type.kind==="value"}static parse(v,x){if(v.length!==3&&v.length!==4)return x.error("Expected two or three arguments.");const I=v[0];let S=x.parse(v[1],1,Ge);if(!S)return null;if(!ud(I,S.type))return x.concat(1).error(`"${I}" comparisons are not supported for type '${$(S.type)}'.`);let M=x.parse(v[2],2,Ge);if(!M)return null;if(!ud(I,M.type))return x.concat(2).error(`"${I}" comparisons are not supported for type '${$(M.type)}'.`);if(S.type.kind!==M.type.kind&&S.type.kind!=="value"&&M.type.kind!=="value")return x.error(`Cannot compare types '${$(S.type)}' and '${$(M.type)}'.`);f&&(S.type.kind==="value"&&M.type.kind!=="value"?S=new xo(M.type,[S]):S.type.kind!=="value"&&M.type.kind==="value"&&(M=new xo(S.type,[M])));let D=null;if(v.length===4){if(S.type.kind!=="string"&&M.type.kind!=="string"&&S.type.kind!=="value"&&M.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(D=x.parse(v[3],3,ea),!D)return null}return new A1(S,M,D)}evaluate(v){const x=this.lhs.evaluate(v),I=this.rhs.evaluate(v);if(f&&this.hasUntypedArgument){const S=Oi(x),M=Oi(I);if(S.kind!==M.kind||S.kind!=="string"&&S.kind!=="number")throw new oi(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${S.kind}, ${M.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){const S=Oi(x),M=Oi(I);if(S.kind!=="string"||M.kind!=="string")return r(v,x,I)}return this.collator?l(v,x,I,this.collator.evaluate(v)):r(v,x,I)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const ug=zl("==",function(s,r,l){return r===l},cd),cg=zl("!=",function(s,r,l){return r!==l},function(s,r,l,f){return!cd(0,r,l,f)}),hg=zl("<",function(s,r,l){return r",function(s,r,l){return r>l},function(s,r,l,f){return f.compare(r,l)>0}),fg=zl("<=",function(s,r,l){return r<=l},function(s,r,l,f){return f.compare(r,l)<=0}),dg=zl(">=",function(s,r,l){return r>=l},function(s,r,l,f){return f.compare(r,l)>=0});class rp{constructor(r,l,f,m,v){this.type=He,this.number=r,this.locale=l,this.currency=f,this.minFractionDigits=m,this.maxFractionDigits=v}static parse(r,l){if(r.length!==3)return l.error("Expected two arguments.");const f=l.parse(r[1],1,Jt);if(!f)return null;const m=r[2];if(typeof m!="object"||Array.isArray(m))return l.error("NumberFormat options argument must be an object.");let v=null;if(m.locale&&(v=l.parse(m.locale,1,He),!v))return null;let x=null;if(m.currency&&(x=l.parse(m.currency,1,He),!x))return null;let I=null;if(m["min-fraction-digits"]&&(I=l.parse(m["min-fraction-digits"],1,Jt),!I))return null;let S=null;return m["max-fraction-digits"]&&(S=l.parse(m["max-fraction-digits"],1,Jt),!S)?null:new rp(f,v,x,I,S)}evaluate(r){return new Intl.NumberFormat(this.locale?this.locale.evaluate(r):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(r):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(r):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(r):void 0}).format(this.number.evaluate(r))}eachChild(r){r(this.number),this.locale&&r(this.locale),this.currency&&r(this.currency),this.minFractionDigits&&r(this.minFractionDigits),this.maxFractionDigits&&r(this.maxFractionDigits)}outputDefined(){return!1}}class Mc{constructor(r){this.type=Ii,this.sections=r}static parse(r,l){if(r.length<2)return l.error("Expected at least one argument.");const f=r[1];if(!Array.isArray(f)&&typeof f=="object")return l.error("First argument must be an image or text section.");const m=[];let v=!1;for(let x=1;x<=r.length-1;++x){const I=r[x];if(v&&typeof I=="object"&&!Array.isArray(I)){v=!1;let S=null;if(I["font-scale"]&&(S=l.parse(I["font-scale"],1,Jt),!S))return null;let M=null;if(I["text-font"]&&(M=l.parse(I["text-font"],1,Z(He)),!M))return null;let D=null;if(I["text-color"]&&(D=l.parse(I["text-color"],1,yi),!D))return null;const N=m[m.length-1];N.scale=S,N.font=M,N.textColor=D}else{const S=l.parse(r[x],1,Ge);if(!S)return null;const M=S.type.kind;if(M!=="string"&&M!=="value"&&M!=="null"&&M!=="resolvedImage")return l.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,m.push({content:S,scale:null,font:null,textColor:null})}}return new Mc(m)}evaluate(r){return new vo(this.sections.map(l=>{const f=l.content.evaluate(r);return Oi(f)===O?new $h("",f,null,null,null):new $h(vu(f),null,l.scale?l.scale.evaluate(r):null,l.font?l.font.evaluate(r).join(","):null,l.textColor?l.textColor.evaluate(r):null)}))}eachChild(r){for(const l of this.sections)r(l.content),l.scale&&r(l.scale),l.font&&r(l.font),l.textColor&&r(l.textColor)}outputDefined(){return!1}}class op{constructor(r){this.type=O,this.input=r}static parse(r,l){if(r.length!==2)return l.error("Expected two arguments.");const f=l.parse(r[1],1,He);return f?new op(f):l.error("No image name provided.")}evaluate(r){const l=this.input.evaluate(r),f=Fo.fromString(l);return f&&r.availableImages&&(f.available=r.availableImages.indexOf(l)>-1),f}eachChild(r){r(this.input)}outputDefined(){return!1}}class sp{constructor(r){this.type=Jt,this.input=r}static parse(r,l){if(r.length!==2)return l.error(`Expected 1 argument, but found ${r.length-1} instead.`);const f=l.parse(r[1],1);return f?f.type.kind!=="array"&&f.type.kind!=="string"&&f.type.kind!=="value"?l.error(`Expected argument of type string or array, but found ${$(f.type)} instead.`):new sp(f):null}evaluate(r){const l=this.input.evaluate(r);if(typeof l=="string"||Array.isArray(l))return l.length;throw new oi(`Expected value to be of type string or array, but found ${$(Oi(l))} instead.`)}eachChild(r){r(this.input)}outputDefined(){return!1}}const Ol={"==":ug,"!=":cg,">":pg,"<":hg,">=":dg,"<=":fg,array:xo,at:tp,boolean:xo,case:ip,coalesce:Cc,collator:Nl,format:Mc,image:op,in:ep,"index-of":Lc,interpolate:Ir,"interpolate-hcl":Ir,"interpolate-lab":Ir,length:sp,let:Tc,literal:Ea,match:np,number:xo,"number-format":rp,object:xo,slice:Pc,step:Cu,string:xo,"to-boolean":Es,"to-color":Es,"to-number":Es,"to-string":Es,var:Ic,within:$a};function hd(s,[r,l,f,m]){r=r.evaluate(s),l=l.evaluate(s),f=f.evaluate(s);const v=m?m.evaluate(s):1,x=Rl(r,l,f,v);if(x)throw new oi(x);return new Pn(r/255,l/255,f/255,v,!1)}function pd(s,r){return s in r}function ap(s,r){const l=r[s];return l===void 0?null:l}function el(s){return{type:s}}function fd(s){return{result:"success",value:s}}function Fl(s){return{result:"error",value:s}}function Bl(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function dd(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function lp(s){return!!s.expression&&s.expression.interpolated}function _n(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function Ac(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function mg(s){return s}function md(s,r){const l=r.type==="color",f=s.stops&&typeof s.stops[0][0]=="object",m=f||!(f||s.property!==void 0),v=s.type||(lp(r)?"exponential":"interval");if(l||r.type==="padding"){const D=l?Pn.parse:io.parse;(s=No({},s)).stops&&(s.stops=s.stops.map(N=>[N[0],D(N[1])])),s.default=D(s.default?s.default:r.default)}if(s.colorSpace&&(x=s.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var x;let I,S,M;if(v==="exponential")I=dn;else if(v==="interval")I=gg;else if(v==="categorical"){I=Ei,S=Object.create(null);for(const D of s.stops)S[D[0]]=D[1];M=typeof s.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);I=up}if(f){const D={},N=[];for(let j=0;jj[0]),evaluate:({zoom:j},Y)=>dn({stops:F,base:s.base},r,j).evaluate(j,Y)}}if(m){const D=v==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ir.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(N=>N[0]),evaluate:({zoom:N})=>I(s,r,N,S,M)}}return{kind:"source",evaluate(D,N){const F=N&&N.properties?N.properties[s.property]:void 0;return F===void 0?Tu(s.default,r.default):I(s,r,F,S,M)}}}function Tu(s,r,l){return s!==void 0?s:r!==void 0?r:l!==void 0?l:void 0}function Ei(s,r,l,f,m){return Tu(typeof l===m?f[l]:void 0,s.default,r.default)}function gg(s,r,l){if(_n(l)!=="number")return Tu(s.default,r.default);const f=s.stops.length;if(f===1||l<=s.stops[0][0])return s.stops[0][1];if(l>=s.stops[f-1][0])return s.stops[f-1][1];const m=Su(s.stops.map(v=>v[0]),l);return s.stops[m][1]}function dn(s,r,l){const f=s.base!==void 0?s.base:1;if(_n(l)!=="number")return Tu(s.default,r.default);const m=s.stops.length;if(m===1||l<=s.stops[0][0])return s.stops[0][1];if(l>=s.stops[m-1][0])return s.stops[m-1][1];const v=Su(s.stops.map(D=>D[0]),l),x=function(D,N,F,G){const j=G-F,Y=D-F;return j===0?0:N===1?Y/j:(Math.pow(N,Y)-1)/(Math.pow(N,j)-1)}(l,f,s.stops[v][0],s.stops[v+1][0]),I=s.stops[v][1],S=s.stops[v+1][1],M=Ur[r.type]||mg;return typeof I.evaluate=="function"?{evaluate(...D){const N=I.evaluate.apply(void 0,D),F=S.evaluate.apply(void 0,D);if(N!==void 0&&F!==void 0)return M(N,F,x,s.colorSpace)}}:M(I,S,x,s.colorSpace)}function up(s,r,l){switch(r.type){case"color":l=Pn.parse(l);break;case"formatted":l=vo.fromString(l.toString());break;case"resolvedImage":l=Fo.fromString(l.toString());break;case"padding":l=io.parse(l);break;default:_n(l)===r.type||r.type==="enum"&&r.values[l]||(l=void 0)}return Tu(l,s.default,r.default)}bo.register(Ol,{error:[{kind:"error"},[He],(s,[r])=>{throw new oi(r.evaluate(s))}],typeof:[He,[Ge],(s,[r])=>$(Oi(r.evaluate(s)))],"to-rgba":[Z(Jt,4),[yi],(s,[r])=>{const[l,f,m,v]=r.evaluate(s).rgb;return[255*l,255*f,255*m,v]}],rgb:[yi,[Jt,Jt,Jt],hd],rgba:[yi,[Jt,Jt,Jt,Jt],hd],has:{type:je,overloads:[[[He],(s,[r])=>pd(r.evaluate(s),s.properties())],[[He,zo],(s,[r,l])=>pd(r.evaluate(s),l.evaluate(s))]]},get:{type:Ge,overloads:[[[He],(s,[r])=>ap(r.evaluate(s),s.properties())],[[He,zo],(s,[r,l])=>ap(r.evaluate(s),l.evaluate(s))]]},"feature-state":[Ge,[He],(s,[r])=>ap(r.evaluate(s),s.featureState||{})],properties:[zo,[],s=>s.properties()],"geometry-type":[He,[],s=>s.geometryType()],id:[Ge,[],s=>s.id()],zoom:[Jt,[],s=>s.globals.zoom],"heatmap-density":[Jt,[],s=>s.globals.heatmapDensity||0],"line-progress":[Jt,[],s=>s.globals.lineProgress||0],accumulated:[Ge,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Jt,el(Jt),(s,r)=>{let l=0;for(const f of r)l+=f.evaluate(s);return l}],"*":[Jt,el(Jt),(s,r)=>{let l=1;for(const f of r)l*=f.evaluate(s);return l}],"-":{type:Jt,overloads:[[[Jt,Jt],(s,[r,l])=>r.evaluate(s)-l.evaluate(s)],[[Jt],(s,[r])=>-r.evaluate(s)]]},"/":[Jt,[Jt,Jt],(s,[r,l])=>r.evaluate(s)/l.evaluate(s)],"%":[Jt,[Jt,Jt],(s,[r,l])=>r.evaluate(s)%l.evaluate(s)],ln2:[Jt,[],()=>Math.LN2],pi:[Jt,[],()=>Math.PI],e:[Jt,[],()=>Math.E],"^":[Jt,[Jt,Jt],(s,[r,l])=>Math.pow(r.evaluate(s),l.evaluate(s))],sqrt:[Jt,[Jt],(s,[r])=>Math.sqrt(r.evaluate(s))],log10:[Jt,[Jt],(s,[r])=>Math.log(r.evaluate(s))/Math.LN10],ln:[Jt,[Jt],(s,[r])=>Math.log(r.evaluate(s))],log2:[Jt,[Jt],(s,[r])=>Math.log(r.evaluate(s))/Math.LN2],sin:[Jt,[Jt],(s,[r])=>Math.sin(r.evaluate(s))],cos:[Jt,[Jt],(s,[r])=>Math.cos(r.evaluate(s))],tan:[Jt,[Jt],(s,[r])=>Math.tan(r.evaluate(s))],asin:[Jt,[Jt],(s,[r])=>Math.asin(r.evaluate(s))],acos:[Jt,[Jt],(s,[r])=>Math.acos(r.evaluate(s))],atan:[Jt,[Jt],(s,[r])=>Math.atan(r.evaluate(s))],min:[Jt,el(Jt),(s,r)=>Math.min(...r.map(l=>l.evaluate(s)))],max:[Jt,el(Jt),(s,r)=>Math.max(...r.map(l=>l.evaluate(s)))],abs:[Jt,[Jt],(s,[r])=>Math.abs(r.evaluate(s))],round:[Jt,[Jt],(s,[r])=>{const l=r.evaluate(s);return l<0?-Math.round(-l):Math.round(l)}],floor:[Jt,[Jt],(s,[r])=>Math.floor(r.evaluate(s))],ceil:[Jt,[Jt],(s,[r])=>Math.ceil(r.evaluate(s))],"filter-==":[je,[He,Ge],(s,[r,l])=>s.properties()[r.value]===l.value],"filter-id-==":[je,[Ge],(s,[r])=>s.id()===r.value],"filter-type-==":[je,[He],(s,[r])=>s.geometryType()===r.value],"filter-<":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f{const l=s.id(),f=r.value;return typeof l==typeof f&&l":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f>m}],"filter-id->":[je,[Ge],(s,[r])=>{const l=s.id(),f=r.value;return typeof l==typeof f&&l>f}],"filter-<=":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f<=m}],"filter-id-<=":[je,[Ge],(s,[r])=>{const l=s.id(),f=r.value;return typeof l==typeof f&&l<=f}],"filter->=":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f>=m}],"filter-id->=":[je,[Ge],(s,[r])=>{const l=s.id(),f=r.value;return typeof l==typeof f&&l>=f}],"filter-has":[je,[Ge],(s,[r])=>r.value in s.properties()],"filter-has-id":[je,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[je,[Z(He)],(s,[r])=>r.value.indexOf(s.geometryType())>=0],"filter-id-in":[je,[Z(Ge)],(s,[r])=>r.value.indexOf(s.id())>=0],"filter-in-small":[je,[He,Z(Ge)],(s,[r,l])=>l.value.indexOf(s.properties()[r.value])>=0],"filter-in-large":[je,[He,Z(Ge)],(s,[r,l])=>function(f,m,v,x){for(;v<=x;){const I=v+x>>1;if(m[I]===f)return!0;m[I]>f?x=I-1:v=I+1}return!1}(s.properties()[r.value],l.value,0,l.value.length-1)],all:{type:je,overloads:[[[je,je],(s,[r,l])=>r.evaluate(s)&&l.evaluate(s)],[el(je),(s,r)=>{for(const l of r)if(!l.evaluate(s))return!1;return!0}]]},any:{type:je,overloads:[[[je,je],(s,[r,l])=>r.evaluate(s)||l.evaluate(s)],[el(je),(s,r)=>{for(const l of r)if(l.evaluate(s))return!0;return!1}]]},"!":[je,[je],(s,[r])=>!r.evaluate(s)],"is-supported-script":[je,[He],(s,[r])=>{const l=s.globals&&s.globals.isSupportedScript;return!l||l(r.evaluate(s))}],upcase:[He,[He],(s,[r])=>r.evaluate(s).toUpperCase()],downcase:[He,[He],(s,[r])=>r.evaluate(s).toLowerCase()],concat:[He,el(Ge),(s,r)=>r.map(l=>vu(l.evaluate(s))).join("")],"resolved-locale":[He,[ea],(s,[r])=>r.evaluate(s).resolvedLocale()]});class Hn{constructor(r,l){var f;this.expression=r,this._warningHistory={},this._evaluator=new Mn,this._defaultValue=l?(f=l).type==="color"&&Ac(f.default)?new Pn(0,0,0,0):f.type==="color"?Pn.parse(f.default)||null:f.type==="padding"?io.parse(f.default)||null:f.type==="variableAnchorOffsetCollection"?Oo.parse(f.default)||null:f.default===void 0?null:f.default:null,this._enumValues=l&&l.type==="enum"?l.values:null}evaluateWithoutErrorHandling(r,l,f,m,v,x){return this._evaluator.globals=r,this._evaluator.feature=l,this._evaluator.featureState=f,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(r,l,f,m,v,x){this._evaluator.globals=r,this._evaluator.feature=l||null,this._evaluator.featureState=f||null,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x||null;try{const I=this.expression.evaluate(this._evaluator);if(I==null||typeof I=="number"&&I!=I)return this._defaultValue;if(this._enumValues&&!(I in this._enumValues))throw new oi(`Expected value to be one of ${Object.keys(this._enumValues).map(S=>JSON.stringify(S)).join(", ")}, but found ${JSON.stringify(I)} instead.`);return I}catch(I){return this._warningHistory[I.message]||(this._warningHistory[I.message]=!0,typeof console<"u"&&console.warn(I.message)),this._defaultValue}}}function Un(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Ol}function nl(s,r){const l=new yc(Ol,wu,[],r?function(m){const v={color:yi,string:He,number:Jt,enum:He,boolean:je,formatted:Ii,padding:rt,resolvedImage:O,variableAnchorOffsetCollection:U};return m.type==="array"?Z(v[m.value]||Ge,m.length):v[m.type]}(r):void 0),f=l.parse(s,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?fd(new Hn(f,r)):Fl(l.errors)}class kc{constructor(r,l){this.kind=r,this._styleExpression=l,this.isStateDependent=r!=="constant"&&!Iu(l.expression)}evaluateWithoutErrorHandling(r,l,f,m,v,x){return this._styleExpression.evaluateWithoutErrorHandling(r,l,f,m,v,x)}evaluate(r,l,f,m,v,x){return this._styleExpression.evaluate(r,l,f,m,v,x)}}class cp{constructor(r,l,f,m){this.kind=r,this.zoomStops=f,this._styleExpression=l,this.isStateDependent=r!=="camera"&&!Iu(l.expression),this.interpolationType=m}evaluateWithoutErrorHandling(r,l,f,m,v,x){return this._styleExpression.evaluateWithoutErrorHandling(r,l,f,m,v,x)}evaluate(r,l,f,m,v,x){return this._styleExpression.evaluate(r,l,f,m,v,x)}interpolationFactor(r,l,f){return this.interpolationType?Ir.interpolationFactor(this.interpolationType,r,l,f):0}}function gd(s,r){const l=nl(s,r);if(l.result==="error")return l;const f=l.value.expression,m=Ec(f);if(!m&&!Bl(r))return Fl([new Br("","data expressions not supported")]);const v=Eu(f,["zoom"]);if(!v&&!dd(r))return Fl([new Br("","zoom expressions not supported")]);const x=Rc(f);return x||v?x instanceof Br?Fl([x]):x instanceof Ir&&!lp(r)?Fl([new Br("",'"interpolate" expressions cannot be used with this property')]):fd(x?new cp(m?"camera":"composite",l.value,x.labels,x instanceof Ir?x.interpolation:void 0):new kc(m?"constant":"source",l.value)):Fl([new Br("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Dc{constructor(r,l){this._parameters=r,this._specification=l,No(this,md(this._parameters,this._specification))}static deserialize(r){return new Dc(r._parameters,r._specification)}static serialize(r){return{_parameters:r._parameters,_specification:r._specification}}}function Rc(s){let r=null;if(s instanceof Tc)r=Rc(s.result);else if(s instanceof Cc){for(const l of s.args)if(r=Rc(l),r)break}else(s instanceof Cu||s instanceof Ir)&&s.input instanceof bo&&s.input.name==="zoom"&&(r=s);return r instanceof Br||s.eachChild(l=>{const f=Rc(l);f instanceof Br?r=f:!r&&f?r=new Br("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&f&&r!==f&&(r=new Br("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}function Nc(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const r of s.slice(1))if(!Nc(r)&&typeof r!="boolean")return!1;return!0;default:return!0}}const _d={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zc(s){if(s==null)return{filter:()=>!0,needGeometry:!1};Nc(s)||(s=Fc(s));const r=nl(s,_d);if(r.result==="error")throw new Error(r.value.map(l=>`${l.key}: ${l.message}`).join(", "));return{filter:(l,f,m)=>r.value.evaluate(l,f,{},m),needGeometry:Oc(s)}}function yd(s,r){return sr?1:0}function Oc(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let r=1;r"||r==="<="||r===">="?hp(s[1],s[2],r):r==="any"?(l=s.slice(1),["any"].concat(l.map(Fc))):r==="all"?["all"].concat(s.slice(1).map(Fc)):r==="none"?["all"].concat(s.slice(1).map(Fc).map(Bc)):r==="in"?vd(s[1],s.slice(2)):r==="!in"?Bc(vd(s[1],s.slice(2))):r==="has"?xd(s[1]):r==="!has"?Bc(xd(s[1])):r!=="within"||s;var l}function hp(s,r,l){switch(s){case"$type":return[`filter-type-${l}`,r];case"$id":return[`filter-id-${l}`,r];default:return[`filter-${l}`,s,r]}}function vd(s,r){if(r.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(l=>typeof l!=typeof r[0])?["filter-in-large",s,["literal",r.sort(yd)]]:["filter-in-small",s,["literal",r]]}}function xd(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Bc(s){return["!",s]}function pp(s){const r=typeof s;if(r==="number"||r==="boolean"||r==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let m="[";for(const v of s)m+=`${pp(v)},`;return`${m}]`}const l=Object.keys(s).sort();let f="{";for(let m=0;mf.maximum?[new Wt(r,l,`${l} is greater than the maximum value ${f.maximum}`)]:[]}function wd(s){const r=s.valueSpec,l=ci(s.value.type);let f,m,v,x={};const I=l!=="categorical"&&s.value.property===void 0,S=!I,M=_n(s.value.stops)==="array"&&_n(s.value.stops[0])==="array"&&_n(s.value.stops[0][0])==="object",D=Gr({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(G){if(l==="identity")return[new Wt(G.key,G.value,'identity function may not have a "stops" property')];let j=[];const Y=G.value;return j=j.concat(fp({key:G.key,value:Y,valueSpec:G.valueSpec,validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec,arrayElementValidator:N})),_n(Y)==="array"&&Y.length===0&&j.push(new Wt(G.key,Y,"array must have at least one stop")),j},default:function(G){return G.validateSpec({key:G.key,value:G.value,valueSpec:r,validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec})}}});return l==="identity"&&I&&D.push(new Wt(s.key,s.value,'missing required property "property"')),l==="identity"||s.value.stops||D.push(new Wt(s.key,s.value,'missing required property "stops"')),l==="exponential"&&s.valueSpec.expression&&!lp(s.valueSpec)&&D.push(new Wt(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(S&&!Bl(s.valueSpec)?D.push(new Wt(s.key,s.value,"property functions not supported")):I&&!dd(s.valueSpec)&&D.push(new Wt(s.key,s.value,"zoom functions not supported"))),l!=="categorical"&&!M||s.value.property!==void 0||D.push(new Wt(s.key,s.value,'"property" property is required')),D;function N(G){let j=[];const Y=G.value,it=G.key;if(_n(Y)!=="array")return[new Wt(it,Y,`array expected, ${_n(Y)} found`)];if(Y.length!==2)return[new Wt(it,Y,`array length 2 expected, length ${Y.length} found`)];if(M){if(_n(Y[0])!=="object")return[new Wt(it,Y,`object expected, ${_n(Y[0])} found`)];if(Y[0].zoom===void 0)return[new Wt(it,Y,"object stop key must have zoom")];if(Y[0].value===void 0)return[new Wt(it,Y,"object stop key must have value")];if(v&&v>ci(Y[0].zoom))return[new Wt(it,Y[0].zoom,"stop zoom values must appear in ascending order")];ci(Y[0].zoom)!==v&&(v=ci(Y[0].zoom),m=void 0,x={}),j=j.concat(Gr({key:`${it}[0]`,value:Y[0],valueSpec:{zoom:{}},validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec,objectElementValidators:{zoom:Vc,value:F}}))}else j=j.concat(F({key:`${it}[0]`,value:Y[0],valueSpec:{},validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec},Y));return Un(Ca(Y[1]))?j.concat([new Wt(`${it}[1]`,Y[1],"expressions are not allowed in function stops.")]):j.concat(G.validateSpec({key:`${it}[1]`,value:Y[1],valueSpec:r,validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec}))}function F(G,j){const Y=_n(G.value),it=ci(G.value),at=G.value!==null?G.value:j;if(f){if(Y!==f)return[new Wt(G.key,at,`${Y} stop domain type must match previous stop domain type ${f}`)]}else f=Y;if(Y!=="number"&&Y!=="string"&&Y!=="boolean")return[new Wt(G.key,at,"stop domain value must be a number, string, or boolean")];if(Y!=="number"&&l!=="categorical"){let bt=`number expected, ${Y} found`;return Bl(r)&&l===void 0&&(bt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Wt(G.key,at,bt)]}return l!=="categorical"||Y!=="number"||isFinite(it)&&Math.floor(it)===it?l!=="categorical"&&Y==="number"&&m!==void 0&&itnew Wt(`${s.key}${f.key}`,s.value,f.message));const l=r.value.expression||r.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!l.outputDefined())return[new Wt(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Iu(l))return[new Wt(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Iu(l))return[new Wt(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!Eu(l,["zoom","feature-state"]))return[new Wt(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!Ec(l))return[new Wt(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function La(s){const r=s.key,l=s.value,f=s.valueSpec,m=[];return Array.isArray(f.values)?f.values.indexOf(ci(l))===-1&&m.push(new Wt(r,l,`expected one of [${f.values.join(", ")}], ${JSON.stringify(l)} found`)):Object.keys(f.values).indexOf(ci(l))===-1&&m.push(new Wt(r,l,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(l)} found`)),m}function Vl(s){return Nc(Ca(s.value))?Ta(No({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Uc(s)}function Uc(s){const r=s.value,l=s.key;if(_n(r)!=="array")return[new Wt(l,r,`array expected, ${_n(r)} found`)];const f=s.styleSpec;let m,v=[];if(r.length<1)return[new Wt(l,r,"filter array must have at least 1 element")];switch(v=v.concat(La({key:`${l}[0]`,value:r[0],valueSpec:f.filter_operator,style:s.style,styleSpec:s.styleSpec})),ci(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&ci(r[1])==="$type"&&v.push(new Wt(l,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&v.push(new Wt(l,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(m=_n(r[1]),m!=="string"&&v.push(new Wt(`${l}[1]`,r[1],`string expected, ${m} found`)));for(let x=2;x{M in l&&r.push(new Wt(f,l[M],`"${M}" is prohibited for ref layers`))}),m.layers.forEach(M=>{ci(M.id)===I&&(S=M)}),S?S.ref?r.push(new Wt(f,l.ref,"ref cannot reference another ref layer")):x=ci(S.type):r.push(new Wt(f,l.ref,`ref layer "${I}" not found`))}else if(x!=="background")if(l.source){const S=m.sources&&m.sources[l.source],M=S&&ci(S.type);S?M==="vector"&&x==="raster"?r.push(new Wt(f,l.source,`layer "${l.id}" requires a raster source`)):M!=="raster-dem"&&x==="hillshade"?r.push(new Wt(f,l.source,`layer "${l.id}" requires a raster-dem source`)):M==="raster"&&x!=="raster"?r.push(new Wt(f,l.source,`layer "${l.id}" requires a vector source`)):M!=="vector"||l["source-layer"]?M==="raster-dem"&&x!=="hillshade"?r.push(new Wt(f,l.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!l.paint||!l.paint["line-gradient"]||M==="geojson"&&S.lineMetrics||r.push(new Wt(f,l,`layer "${l.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new Wt(f,l,`layer "${l.id}" must specify a "source-layer"`)):r.push(new Wt(f,l.source,`source "${l.source}" not found`))}else r.push(new Wt(f,l,'missing required property "source"'));return r=r.concat(Gr({key:f,value:l,valueSpec:v.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${f}.type`,value:l.type,valueSpec:v.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:l,objectKey:"type"}),filter:Vl,layout:S=>Gr({layer:l,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":M=>Lu(No({layerType:x},M))}}),paint:S=>Gr({layer:l,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":M=>mp(No({layerType:x},M))}})}})),r}function il(s){const r=s.value,l=s.key,f=_n(r);return f!=="string"?[new Wt(l,r,`string expected, ${f} found`)]:[]}const Ed={promoteId:function({key:s,value:r}){if(_n(r)==="string")return il({key:s,value:r});{const l=[];for(const f in r)l.push(...il({key:`${s}.${f}`,value:r[f]}));return l}}};function Sd(s){const r=s.value,l=s.key,f=s.styleSpec,m=s.style,v=s.validateSpec;if(!r.type)return[new Wt(l,r,'"type" is required')];const x=ci(r.type);let I;switch(x){case"vector":case"raster":return I=Gr({key:l,value:r,valueSpec:f[`source_${x.replace("-","_")}`],style:s.style,styleSpec:f,objectElementValidators:Ed,validateSpec:v}),I;case"raster-dem":return I=function(S){var M;const D=(M=S.sourceName)!==null&&M!==void 0?M:"",N=S.value,F=S.styleSpec,G=F.source_raster_dem,j=S.style;let Y=[];const it=_n(N);if(N===void 0)return Y;if(it!=="object")return Y.push(new Wt("source_raster_dem",N,`object expected, ${it} found`)),Y;const at=ci(N.encoding)==="custom",bt=["redFactor","greenFactor","blueFactor","baseShift"],ct=S.value.encoding?`"${S.value.encoding}"`:"Default";for(const _t in N)!at&&bt.includes(_t)?Y.push(new Wt(_t,N[_t],`In "${D}": "${_t}" is only valid when "encoding" is set to "custom". ${ct} encoding found`)):G[_t]?Y=Y.concat(S.validateSpec({key:_t,value:N[_t],valueSpec:G[_t],validateSpec:S.validateSpec,style:j,styleSpec:F})):Y.push(new Wt(_t,N[_t],`unknown property "${_t}"`));return Y}({sourceName:l,value:r,style:s.style,styleSpec:f,validateSpec:v}),I;case"geojson":if(I=Gr({key:l,value:r,valueSpec:f.source_geojson,style:m,styleSpec:f,validateSpec:v,objectElementValidators:Ed}),r.cluster)for(const S in r.clusterProperties){const[M,D]=r.clusterProperties[S],N=typeof M=="string"?[M,["accumulated"],["get",S]]:M;I.push(...Ta({key:`${l}.${S}.map`,value:D,validateSpec:v,expressionContext:"cluster-map"})),I.push(...Ta({key:`${l}.${S}.reduce`,value:N,validateSpec:v,expressionContext:"cluster-reduce"}))}return I;case"video":return Gr({key:l,value:r,valueSpec:f.source_video,style:m,validateSpec:v,styleSpec:f});case"image":return Gr({key:l,value:r,valueSpec:f.source_image,style:m,validateSpec:v,styleSpec:f});case"canvas":return[new Wt(l,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return La({key:`${l}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:f})}}function Cd(s){const r=s.value,l=s.styleSpec,f=l.light,m=s.style;let v=[];const x=_n(r);if(r===void 0)return v;if(x!=="object")return v=v.concat([new Wt("light",r,`object expected, ${x} found`)]),v;for(const I in r){const S=I.match(/^(.*)-transition$/);v=v.concat(S&&f[S[1]]&&f[S[1]].transition?s.validateSpec({key:I,value:r[I],valueSpec:l.transition,validateSpec:s.validateSpec,style:m,styleSpec:l}):f[I]?s.validateSpec({key:I,value:r[I],valueSpec:f[I],validateSpec:s.validateSpec,style:m,styleSpec:l}):[new Wt(I,r[I],`unknown property "${I}"`)])}return v}function Pu(s){const r=s.value,l=s.styleSpec,f=l.sky,m=s.style,v=_n(r);if(r===void 0)return[];if(v!=="object")return[new Wt("sky",r,`object expected, ${v} found`)];let x=[];for(const I in r)x=x.concat(f[I]?rl({key:I,value:r[I],valueSpec:f[I],style:m,styleSpec:l}):[new Wt(I,r[I],`unknown property "${I}"`)]);return x}function Mu(s){const r=s.value,l=s.styleSpec,f=l.terrain,m=s.style;let v=[];const x=_n(r);if(r===void 0)return v;if(x!=="object")return v=v.concat([new Wt("terrain",r,`object expected, ${x} found`)]),v;for(const I in r)v=v.concat(f[I]?s.validateSpec({key:I,value:r[I],valueSpec:f[I],validateSpec:s.validateSpec,style:m,styleSpec:l}):[new Wt(I,r[I],`unknown property "${I}"`)]);return v}function ro(s){let r=[];const l=s.value,f=s.key;if(Array.isArray(l)){const m=[],v=[];for(const x in l)l[x].id&&m.includes(l[x].id)&&r.push(new Wt(f,l,`all the sprites' ids must be unique, but ${l[x].id} is duplicated`)),m.push(l[x].id),l[x].url&&v.includes(l[x].url)&&r.push(new Wt(f,l,`all the sprites' URLs must be unique, but ${l[x].url} is duplicated`)),v.push(l[x].url),r=r.concat(Gr({key:`${f}[${x}]`,value:l[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return r}return il({key:f,value:l})}const Ul={"*":()=>[],array:fp,boolean:function(s){const r=s.value,l=s.key,f=_n(r);return f!=="boolean"?[new Wt(l,r,`boolean expected, ${f} found`)]:[]},number:Vc,color:function(s){const r=s.key,l=s.value,f=_n(l);return f!=="string"?[new Wt(r,l,`color expected, ${f} found`)]:Pn.parse(String(l))?[]:[new Wt(r,l,`color expected, "${l}" found`)]},constants:bd,enum:La,filter:Vl,function:wd,layer:Id,object:Gr,source:Sd,light:Cd,sky:Pu,terrain:Mu,string:il,formatted:function(s){return il(s).length===0?[]:Ta(s)},resolvedImage:function(s){return il(s).length===0?[]:Ta(s)},padding:function(s){const r=s.key,l=s.value;if(_n(l)==="array"){if(l.length<1||l.length>4)return[new Wt(r,l,`padding requires 1 to 4 values; ${l.length} values found`)];const f={type:"number"};let m=[];for(let v=0;v[]}})),s.constants&&(l=l.concat(bd({key:"constants",value:s.constants,style:s,styleSpec:r,validateSpec:rl}))),gp(l)}function oo(s){return function(r){return s({...r,validateSpec:rl})}}function gp(s){return[].concat(s).sort((r,l)=>r.line-l.line)}function Bo(s){return function(...r){return gp(s.apply(this,r))}}es.source=Bo(oo(Sd)),es.sprite=Bo(oo(ro)),es.glyphs=Bo(oo(Td)),es.light=Bo(oo(Cd)),es.sky=Bo(oo(Pu)),es.terrain=Bo(oo(Mu)),es.layer=Bo(oo(Id)),es.filter=Bo(oo(Vl)),es.paintProperty=Bo(oo(mp)),es.layoutProperty=Bo(oo(Lu));const Au=es,_p=Au.light,yg=Au.paintProperty,ku=Au.layoutProperty;function Ld(s,r){let l=!1;if(r&&r.length)for(const f of r)s.fire(new Ie(new Error(f.message))),l=!0;return l}class ol{constructor(r,l,f){const m=this.cells=[];if(r instanceof ArrayBuffer){this.arrayBuffer=r;const x=new Int32Array(this.arrayBuffer);r=x[0],this.d=(l=x[1])+2*(f=x[2]);for(let S=0;S=N[j+0]&&m>=N[j+1])?(I[G]=!0,x.push(D[G])):I[G]=!1}}}}_forEachCell(r,l,f,m,v,x,I,S){const M=this._convertToCellCoord(r),D=this._convertToCellCoord(l),N=this._convertToCellCoord(f),F=this._convertToCellCoord(m);for(let G=M;G<=N;G++)for(let j=D;j<=F;j++){const Y=this.d*j+G;if((!S||S(this._convertFromCellCoord(G),this._convertFromCellCoord(j),this._convertFromCellCoord(G+1),this._convertFromCellCoord(j+1)))&&v.call(this,r,l,f,m,Y,x,I,S))return}}_convertFromCellCoord(r){return(r-this.padding)/this.scale}_convertToCellCoord(r){return Math.max(0,Math.min(this.d-1,Math.floor(r*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const r=this.cells,l=3+this.cells.length+1+1;let f=0;for(let x=0;x=0)continue;const x=s[v];m[v]=na[f].shallow.indexOf(v)>=0?x:Gl(x,r)}s instanceof Error&&(m.message=s.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(m.$name=f),m}throw new Error("can't serialize object of type "+typeof s)}function Du(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||s instanceof Blob||s instanceof Error||yp(s)||Oe(s)||ArrayBuffer.isView(s)||s instanceof ImageData)return s;if(Array.isArray(s))return s.map(Du);if(typeof s=="object"){const r=s.$name||"Object";if(!na[r])throw new Error(`can't deserialize unregistered class ${r}`);const{klass:l}=na[r];if(!l)throw new Error(`can't deserialize unregistered class ${r}`);if(l.deserialize)return l.deserialize(s);const f=Object.create(l.prototype);for(const m of Object.keys(s)){if(m==="$name")continue;const v=s[m];f[m]=na[r].shallow.indexOf(m)>=0?v:Du(v)}return f}throw new Error("can't deserialize object of type "+typeof s)}class Gc{constructor(){this.first=!0}update(r,l){const f=Math.floor(r);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=r,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=l):this.lastFloorZooms>=128&&s<=255,Arabic:s=>s>=1536&&s<=1791,"Arabic Supplement":s=>s>=1872&&s<=1919,"Arabic Extended-A":s=>s>=2208&&s<=2303,"Hangul Jamo":s=>s>=4352&&s<=4607,"Unified Canadian Aboriginal Syllabics":s=>s>=5120&&s<=5759,Khmer:s=>s>=6016&&s<=6143,"Unified Canadian Aboriginal Syllabics Extended":s=>s>=6320&&s<=6399,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"CJK Radicals Supplement":s=>s>=11904&&s<=12031,"Kangxi Radicals":s=>s>=12032&&s<=12255,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Hiragana:s=>s>=12352&&s<=12447,Katakana:s=>s>=12448&&s<=12543,Bopomofo:s=>s>=12544&&s<=12591,"Hangul Compatibility Jamo":s=>s>=12592&&s<=12687,Kanbun:s=>s>=12688&&s<=12703,"Bopomofo Extended":s=>s>=12704&&s<=12735,"CJK Strokes":s=>s>=12736&&s<=12783,"Katakana Phonetic Extensions":s=>s>=12784&&s<=12799,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"CJK Unified Ideographs Extension A":s=>s>=13312&&s<=19903,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"CJK Unified Ideographs":s=>s>=19968&&s<=40959,"Yi Syllables":s=>s>=40960&&s<=42127,"Yi Radicals":s=>s>=42128&&s<=42191,"Hangul Jamo Extended-A":s=>s>=43360&&s<=43391,"Hangul Syllables":s=>s>=44032&&s<=55215,"Hangul Jamo Extended-B":s=>s>=55216&&s<=55295,"Private Use Area":s=>s>=57344&&s<=63743,"CJK Compatibility Ideographs":s=>s>=63744&&s<=64255,"Arabic Presentation Forms-A":s=>s>=64336&&s<=65023,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Arabic Presentation Forms-B":s=>s>=65136&&s<=65279,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function qc(s){for(const r of s)if(jc(r.charCodeAt(0)))return!0;return!1}function Pd(s){for(const r of s)if(!Md(r.charCodeAt(0)))return!1;return!0}function Md(s){return!(ae.Arabic(s)||ae["Arabic Supplement"](s)||ae["Arabic Extended-A"](s)||ae["Arabic Presentation Forms-A"](s)||ae["Arabic Presentation Forms-B"](s))}function jc(s){return!(s!==746&&s!==747&&(s<4352||!(ae["Bopomofo Extended"](s)||ae.Bopomofo(s)||ae["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ae["CJK Compatibility Ideographs"](s)||ae["CJK Compatibility"](s)||ae["CJK Radicals Supplement"](s)||ae["CJK Strokes"](s)||!(!ae["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ae["CJK Unified Ideographs Extension A"](s)||ae["CJK Unified Ideographs"](s)||ae["Enclosed CJK Letters and Months"](s)||ae["Hangul Compatibility Jamo"](s)||ae["Hangul Jamo Extended-A"](s)||ae["Hangul Jamo Extended-B"](s)||ae["Hangul Jamo"](s)||ae["Hangul Syllables"](s)||ae.Hiragana(s)||ae["Ideographic Description Characters"](s)||ae.Kanbun(s)||ae["Kangxi Radicals"](s)||ae["Katakana Phonetic Extensions"](s)||ae.Katakana(s)&&s!==12540||!(!ae["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ae["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ae["Unified Canadian Aboriginal Syllabics"](s)||ae["Unified Canadian Aboriginal Syllabics Extended"](s)||ae["Vertical Forms"](s)||ae["Yijing Hexagram Symbols"](s)||ae["Yi Syllables"](s)||ae["Yi Radicals"](s))))}function Zc(s){return!(jc(s)||function(r){return!!(ae["Latin-1 Supplement"](r)&&(r===167||r===169||r===174||r===177||r===188||r===189||r===190||r===215||r===247)||ae["General Punctuation"](r)&&(r===8214||r===8224||r===8225||r===8240||r===8241||r===8251||r===8252||r===8258||r===8263||r===8264||r===8265||r===8273)||ae["Letterlike Symbols"](r)||ae["Number Forms"](r)||ae["Miscellaneous Technical"](r)&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||r===9003||r>=9085&&r<=9114||r>=9150&&r<=9165||r===9167||r>=9169&&r<=9179||r>=9186&&r<=9215)||ae["Control Pictures"](r)&&r!==9251||ae["Optical Character Recognition"](r)||ae["Enclosed Alphanumerics"](r)||ae["Geometric Shapes"](r)||ae["Miscellaneous Symbols"](r)&&!(r>=9754&&r<=9759)||ae["Miscellaneous Symbols and Arrows"](r)&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||ae["CJK Symbols and Punctuation"](r)||ae.Katakana(r)||ae["Private Use Area"](r)||ae["CJK Compatibility Forms"](r)||ae["Small Form Variants"](r)||ae["Halfwidth and Fullwidth Forms"](r)||r===8734||r===8756||r===8757||r>=9984&&r<=10087||r>=10102&&r<=10131||r===65532||r===65533)}(s))}function vp(s){return s>=1424&&s<=2303||ae["Arabic Presentation Forms-A"](s)||ae["Arabic Presentation Forms-B"](s)}function vg(s,r){return!(!r&&vp(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ae.Khmer(s))}function Ad(s){for(const r of s)if(vp(r.charCodeAt(0)))return!0;return!1}const sl=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Xn{constructor(r,l){this.zoom=r,l?(this.now=l.now,this.fadeDuration=l.fadeDuration,this.zoomHistory=l.zoomHistory,this.transition=l.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gc,this.transition={})}isSupportedScript(r){return function(l,f){for(const m of l)if(!vg(m.charCodeAt(0),f))return!1;return!0}(r,sl.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const r=this.zoom,l=r-Math.floor(r),f=this.crossFadingFactor();return r>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:l+(1-l)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*l}}}class Ru{constructor(r,l){this.property=r,this.value=l,this.expression=function(f,m){if(Ac(f))return new Dc(f,m);if(Un(f)){const v=gd(f,m);if(v.result==="error")throw new Error(v.value.map(x=>`${x.key}: ${x.message}`).join(", "));return v.value}{let v=f;return m.type==="color"&&typeof f=="string"?v=Pn.parse(f):m.type!=="padding"||typeof f!="number"&&!Array.isArray(f)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(f)&&(v=Oo.parse(f)):v=io.parse(f),{kind:"constant",evaluate:()=>v}}}(l===void 0?r.specification.default:l,r.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(r,l,f){return this.property.possiblyEvaluate(this,r,l,f)}}class Wc{constructor(r){this.property=r,this.value=new Ru(r,void 0)}transitioned(r,l){return new Dd(this.property,this.value,l,gt({},r.transition,this.transition),r.now)}untransitioned(){return new Dd(this.property,this.value,null,{},0)}}class kd{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitionablePropertyValues)}getValue(r){return mt(this._values[r].value.value)}setValue(r,l){Object.prototype.hasOwnProperty.call(this._values,r)||(this._values[r]=new Wc(this._values[r].property)),this._values[r].value=new Ru(this._values[r].property,l===null?void 0:mt(l))}getTransition(r){return mt(this._values[r].transition)}setTransition(r,l){Object.prototype.hasOwnProperty.call(this._values,r)||(this._values[r]=new Wc(this._values[r].property)),this._values[r].transition=mt(l)||void 0}serialize(){const r={};for(const l of Object.keys(this._values)){const f=this.getValue(l);f!==void 0&&(r[l]=f);const m=this.getTransition(l);m!==void 0&&(r[`${l}-transition`]=m)}return r}transitioned(r,l){const f=new xp(this._properties);for(const m of Object.keys(this._values))f._values[m]=this._values[m].transitioned(r,l._values[m]);return f}untransitioned(){const r=new xp(this._properties);for(const l of Object.keys(this._values))r._values[l]=this._values[l].untransitioned();return r}}class Dd{constructor(r,l,f,m,v){this.property=r,this.value=l,this.begin=v+m.delay||0,this.end=this.begin+m.duration||0,r.specification.transition&&(m.delay||m.duration)&&(this.prior=f)}possiblyEvaluate(r,l,f){const m=r.now||0,v=this.value.possiblyEvaluate(r,l,f),x=this.prior;if(x){if(m>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(m=1)return 1;const M=S*S,D=M*S;return 4*(S<.5?D:3*(S-M)+D-.75)}(I))}}return v}}class xp{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitioningPropertyValues)}possiblyEvaluate(r,l,f){const m=new Nu(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(r,l,f);return m}hasTransition(){for(const r of Object.keys(this._values))if(this._values[r].prior)return!0;return!1}}class Rd{constructor(r){this._properties=r,this._values=Object.create(r.defaultPropertyValues)}hasValue(r){return this._values[r].value!==void 0}getValue(r){return mt(this._values[r].value)}setValue(r,l){this._values[r]=new Ru(this._values[r].property,l===null?void 0:mt(l))}serialize(){const r={};for(const l of Object.keys(this._values)){const f=this.getValue(l);f!==void 0&&(r[l]=f)}return r}possiblyEvaluate(r,l,f){const m=new Nu(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(r,l,f);return m}}class ns{constructor(r,l,f){this.property=r,this.value=l,this.parameters=f}isConstant(){return this.value.kind==="constant"}constantOr(r){return this.value.kind==="constant"?this.value.value:r}evaluate(r,l,f,m){return this.property.evaluate(this.value,this.parameters,r,l,f,m)}}class Nu{constructor(r){this._properties=r,this._values=Object.create(r.defaultPossiblyEvaluatedValues)}get(r){return this._values[r]}}class be{constructor(r){this.specification=r}possiblyEvaluate(r,l){if(r.isDataDriven())throw new Error("Value should not be data driven");return r.expression.evaluate(l)}interpolate(r,l,f){const m=Ur[this.specification.type];return m?m(r,l,f):r}}class ke{constructor(r,l){this.specification=r,this.overrides=l}possiblyEvaluate(r,l,f,m){return new ns(this,r.expression.kind==="constant"||r.expression.kind==="camera"?{kind:"constant",value:r.expression.evaluate(l,null,{},f,m)}:r.expression,l)}interpolate(r,l,f){if(r.value.kind!=="constant"||l.value.kind!=="constant")return r;if(r.value.value===void 0||l.value.value===void 0)return new ns(this,{kind:"constant",value:void 0},r.parameters);const m=Ur[this.specification.type];if(m){const v=m(r.value.value,l.value.value,f);return new ns(this,{kind:"constant",value:v},r.parameters)}return r}evaluate(r,l,f,m,v,x){return r.kind==="constant"?r.value:r.evaluate(l,f,m,v,x)}}class ql extends ke{possiblyEvaluate(r,l,f,m){if(r.value===void 0)return new ns(this,{kind:"constant",value:void 0},l);if(r.expression.kind==="constant"){const v=r.expression.evaluate(l,null,{},f,m),x=r.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,I=this._calculate(x,x,x,l);return new ns(this,{kind:"constant",value:I},l)}if(r.expression.kind==="camera"){const v=this._calculate(r.expression.evaluate({zoom:l.zoom-1}),r.expression.evaluate({zoom:l.zoom}),r.expression.evaluate({zoom:l.zoom+1}),l);return new ns(this,{kind:"constant",value:v},l)}return new ns(this,r.expression,l)}evaluate(r,l,f,m,v,x){if(r.kind==="source"){const I=r.evaluate(l,f,m,v,x);return this._calculate(I,I,I,l)}return r.kind==="composite"?this._calculate(r.evaluate({zoom:Math.floor(l.zoom)-1},f,m),r.evaluate({zoom:Math.floor(l.zoom)},f,m),r.evaluate({zoom:Math.floor(l.zoom)+1},f,m),l):r.value}_calculate(r,l,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:r,to:l}:{from:f,to:l}}interpolate(r){return r}}class bp{constructor(r){this.specification=r}possiblyEvaluate(r,l,f,m){if(r.value!==void 0){if(r.expression.kind==="constant"){const v=r.expression.evaluate(l,null,{},f,m);return this._calculate(v,v,v,l)}return this._calculate(r.expression.evaluate(new Xn(Math.floor(l.zoom-1),l)),r.expression.evaluate(new Xn(Math.floor(l.zoom),l)),r.expression.evaluate(new Xn(Math.floor(l.zoom+1),l)),l)}}_calculate(r,l,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:r,to:l}:{from:f,to:l}}interpolate(r){return r}}class wp{constructor(r){this.specification=r}possiblyEvaluate(r,l,f,m){return!!r.expression.evaluate(l,null,{},f,m)}interpolate(){return!1}}class qr{constructor(r){this.properties=r,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const l in r){const f=r[l];f.specification.overridable&&this.overridableProperties.push(l);const m=this.defaultPropertyValues[l]=new Ru(f,void 0),v=this.defaultTransitionablePropertyValues[l]=new Wc(f);this.defaultTransitioningPropertyValues[l]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[l]=m.possiblyEvaluate({})}}}de("DataDrivenProperty",ke),de("DataConstantProperty",be),de("CrossFadedDataDrivenProperty",ql),de("CrossFadedProperty",bp),de("ColorRampProperty",wp);const Ip="-transition";class is extends Ri{constructor(r,l){if(super(),this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1},r.type!=="custom"&&(this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),l.layout&&(this._unevaluatedLayout=new Rd(l.layout)),l.paint)){this._transitionablePaint=new kd(l.paint);for(const f in r.paint)this.setPaintProperty(f,r.paint[f],{validate:!1});for(const f in r.layout)this.setLayoutProperty(f,r.layout[f],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Nu(l.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,l,f={}){l!=null&&this._validate(ku,`layers.${this.id}.layout.${r}`,r,l,f)||(r!=="visibility"?this._unevaluatedLayout.setValue(r,l):this.visibility=l)}getPaintProperty(r){return r.endsWith(Ip)?this._transitionablePaint.getTransition(r.slice(0,-11)):this._transitionablePaint.getValue(r)}setPaintProperty(r,l,f={}){if(l!=null&&this._validate(yg,`layers.${this.id}.paint.${r}`,r,l,f))return!1;if(r.endsWith(Ip))return this._transitionablePaint.setTransition(r.slice(0,-11),l||void 0),!1;{const m=this._transitionablePaint._values[r],v=m.property.specification["property-type"]==="cross-faded-data-driven",x=m.value.isDataDriven(),I=m.value;this._transitionablePaint.setValue(r,l),this._handleSpecialPaintPropertyUpdate(r);const S=this._transitionablePaint._values[r].value;return S.isDataDriven()||x||v||this._handleOverridablePaintPropertyUpdate(r,I,S)}}_handleSpecialPaintPropertyUpdate(r){}_handleOverridablePaintPropertyUpdate(r,l,f){return!1}isHidden(r){return!!(this.minzoom&&r=this.maxzoom)||this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,l){r.getCrossfadeParameters&&(this._crossfadeParameters=r.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,l)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,l)}serialize(){const r={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&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),Ft(r,(l,f)=>!(l===void 0||f==="layout"&&!Object.keys(l).length||f==="paint"&&!Object.keys(l).length))}_validate(r,l,f,m,v={}){return(!v||v.validate!==!1)&&Ld(this,r.call(Au,{key:l,layerType:this.type,objectKey:f,value:m,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const r in this.paint._values){const l=this.paint.get(r);if(l instanceof ns&&Bl(l.property.specification)&&(l.value.kind==="source"||l.value.kind==="composite")&&l.value.isStateDependent)return!0}return!1}}const xg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class zu{constructor(r,l){this._structArray=r,this._pos1=l*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class hi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(r,l){return r._trim(),l&&(r.isTransferred=!0,l.push(r.arrayBuffer)),{length:r.length,arrayBuffer:r.arrayBuffer}}static deserialize(r){const l=Object.create(this.prototype);return l.arrayBuffer=r.arrayBuffer,l.length=r.length,l.capacity=r.arrayBuffer.byteLength/l.bytesPerElement,l._refreshViews(),l}_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(r){this.reserve(r),this.length=r}reserve(r){if(r>this.capacity){this.capacity=Math.max(r,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const l=this.uint8;this._refreshViews(),l&&this.uint8.set(l)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Si(s,r=1){let l=0,f=0;return{members:s.map(m=>{const v=xg[m.type].BYTES_PER_ELEMENT,x=l=Nd(l,Math.max(r,v)),I=m.components||1;return f=Math.max(f,v),l+=v*I,{name:m.name,type:m.type,components:I,offset:x}}),size:Nd(l,Math.max(f,r)),alignment:r}}function Nd(s,r){return Math.ceil(s/r)*r}class Ss extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l){const f=this.length;return this.resize(f+1),this.emplace(f,r,l)}emplace(r,l,f){const m=2*r;return this.int16[m+0]=l,this.int16[m+1]=f,r}}Ss.prototype.bytesPerElement=4,de("StructArrayLayout2i4",Ss);class Hc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.int16[v+0]=l,this.int16[v+1]=f,this.int16[v+2]=m,r}}Hc.prototype.bytesPerElement=6,de("StructArrayLayout3i6",Hc);class Ep extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,r,l,f,m)}emplace(r,l,f,m,v){const x=4*r;return this.int16[x+0]=l,this.int16[x+1]=f,this.int16[x+2]=m,this.int16[x+3]=v,r}}Ep.prototype.bytesPerElement=8,de("StructArrayLayout4i8",Ep);class Sp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x){const I=this.length;return this.resize(I+1),this.emplace(I,r,l,f,m,v,x)}emplace(r,l,f,m,v,x,I){const S=6*r;return this.int16[S+0]=l,this.int16[S+1]=f,this.int16[S+2]=m,this.int16[S+3]=v,this.int16[S+4]=x,this.int16[S+5]=I,r}}Sp.prototype.bytesPerElement=12,de("StructArrayLayout2i4i12",Sp);class Cp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x){const I=this.length;return this.resize(I+1),this.emplace(I,r,l,f,m,v,x)}emplace(r,l,f,m,v,x,I){const S=4*r,M=8*r;return this.int16[S+0]=l,this.int16[S+1]=f,this.uint8[M+4]=m,this.uint8[M+5]=v,this.uint8[M+6]=x,this.uint8[M+7]=I,r}}Cp.prototype.bytesPerElement=8,de("StructArrayLayout2i4ub8",Cp);class jl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l){const f=this.length;return this.resize(f+1),this.emplace(f,r,l)}emplace(r,l,f){const m=2*r;return this.float32[m+0]=l,this.float32[m+1]=f,r}}jl.prototype.bytesPerElement=8,de("StructArrayLayout2f8",jl);class Tp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x,I,S,M,D){const N=this.length;return this.resize(N+1),this.emplace(N,r,l,f,m,v,x,I,S,M,D)}emplace(r,l,f,m,v,x,I,S,M,D,N){const F=10*r;return this.uint16[F+0]=l,this.uint16[F+1]=f,this.uint16[F+2]=m,this.uint16[F+3]=v,this.uint16[F+4]=x,this.uint16[F+5]=I,this.uint16[F+6]=S,this.uint16[F+7]=M,this.uint16[F+8]=D,this.uint16[F+9]=N,r}}Tp.prototype.bytesPerElement=20,de("StructArrayLayout10ui20",Tp);class Lp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x,I,S,M,D,N,F){const G=this.length;return this.resize(G+1),this.emplace(G,r,l,f,m,v,x,I,S,M,D,N,F)}emplace(r,l,f,m,v,x,I,S,M,D,N,F,G){const j=12*r;return this.int16[j+0]=l,this.int16[j+1]=f,this.int16[j+2]=m,this.int16[j+3]=v,this.uint16[j+4]=x,this.uint16[j+5]=I,this.uint16[j+6]=S,this.uint16[j+7]=M,this.int16[j+8]=D,this.int16[j+9]=N,this.int16[j+10]=F,this.int16[j+11]=G,r}}Lp.prototype.bytesPerElement=24,de("StructArrayLayout4i4ui4i24",Lp);class ia extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.float32[v+0]=l,this.float32[v+1]=f,this.float32[v+2]=m,r}}ia.prototype.bytesPerElement=12,de("StructArrayLayout3f12",ia);class Xc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){const l=this.length;return this.resize(l+1),this.emplace(l,r)}emplace(r,l){return this.uint32[1*r+0]=l,r}}Xc.prototype.bytesPerElement=4,de("StructArrayLayout1ul4",Xc);class Ou extends hi{_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(r,l,f,m,v,x,I,S,M){const D=this.length;return this.resize(D+1),this.emplace(D,r,l,f,m,v,x,I,S,M)}emplace(r,l,f,m,v,x,I,S,M,D){const N=10*r,F=5*r;return this.int16[N+0]=l,this.int16[N+1]=f,this.int16[N+2]=m,this.int16[N+3]=v,this.int16[N+4]=x,this.int16[N+5]=I,this.uint32[F+3]=S,this.uint16[N+8]=M,this.uint16[N+9]=D,r}}Ou.prototype.bytesPerElement=20,de("StructArrayLayout6i1ul2ui20",Ou);class Yc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x){const I=this.length;return this.resize(I+1),this.emplace(I,r,l,f,m,v,x)}emplace(r,l,f,m,v,x,I){const S=6*r;return this.int16[S+0]=l,this.int16[S+1]=f,this.int16[S+2]=m,this.int16[S+3]=v,this.int16[S+4]=x,this.int16[S+5]=I,r}}Yc.prototype.bytesPerElement=12,de("StructArrayLayout2i2i2i12",Yc);class Fu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v){const x=this.length;return this.resize(x+1),this.emplace(x,r,l,f,m,v)}emplace(r,l,f,m,v,x){const I=4*r,S=8*r;return this.float32[I+0]=l,this.float32[I+1]=f,this.float32[I+2]=m,this.int16[S+6]=v,this.int16[S+7]=x,r}}Fu.prototype.bytesPerElement=16,de("StructArrayLayout2f1f2i16",Fu);class Pp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,r,l,f,m)}emplace(r,l,f,m,v){const x=12*r,I=3*r;return this.uint8[x+0]=l,this.uint8[x+1]=f,this.float32[I+1]=m,this.float32[I+2]=v,r}}Pp.prototype.bytesPerElement=12,de("StructArrayLayout2ub2f12",Pp);class al extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.uint16[v+0]=l,this.uint16[v+1]=f,this.uint16[v+2]=m,r}}al.prototype.bytesPerElement=6,de("StructArrayLayout3ui6",al);class ll extends hi{_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(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at){const bt=this.length;return this.resize(bt+1),this.emplace(bt,r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at)}emplace(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt){const ct=24*r,_t=12*r,Ot=48*r;return this.int16[ct+0]=l,this.int16[ct+1]=f,this.uint16[ct+2]=m,this.uint16[ct+3]=v,this.uint32[_t+2]=x,this.uint32[_t+3]=I,this.uint32[_t+4]=S,this.uint16[ct+10]=M,this.uint16[ct+11]=D,this.uint16[ct+12]=N,this.float32[_t+7]=F,this.float32[_t+8]=G,this.uint8[Ot+36]=j,this.uint8[Ot+37]=Y,this.uint8[Ot+38]=it,this.uint32[_t+10]=at,this.int16[ct+22]=bt,r}}ll.prototype.bytesPerElement=48,de("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ll);class Mp extends hi{_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(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt,ct,_t,Ot,Vt,ue,ve,le,oe,Qt,_e){const $t=this.length;return this.resize($t+1),this.emplace($t,r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt,ct,_t,Ot,Vt,ue,ve,le,oe,Qt,_e)}emplace(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt,ct,_t,Ot,Vt,ue,ve,le,oe,Qt,_e,$t){const jt=32*r,Le=16*r;return this.int16[jt+0]=l,this.int16[jt+1]=f,this.int16[jt+2]=m,this.int16[jt+3]=v,this.int16[jt+4]=x,this.int16[jt+5]=I,this.int16[jt+6]=S,this.int16[jt+7]=M,this.uint16[jt+8]=D,this.uint16[jt+9]=N,this.uint16[jt+10]=F,this.uint16[jt+11]=G,this.uint16[jt+12]=j,this.uint16[jt+13]=Y,this.uint16[jt+14]=it,this.uint16[jt+15]=at,this.uint16[jt+16]=bt,this.uint16[jt+17]=ct,this.uint16[jt+18]=_t,this.uint16[jt+19]=Ot,this.uint16[jt+20]=Vt,this.uint16[jt+21]=ue,this.uint16[jt+22]=ve,this.uint32[Le+12]=le,this.float32[Le+13]=oe,this.float32[Le+14]=Qt,this.uint16[jt+30]=_e,this.uint16[jt+31]=$t,r}}Mp.prototype.bytesPerElement=64,de("StructArrayLayout8i15ui1ul2f2ui64",Mp);class Bu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){const l=this.length;return this.resize(l+1),this.emplace(l,r)}emplace(r,l){return this.float32[1*r+0]=l,r}}Bu.prototype.bytesPerElement=4,de("StructArrayLayout1f4",Bu);class ul extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.uint16[6*r+0]=l,this.float32[v+1]=f,this.float32[v+2]=m,r}}ul.prototype.bytesPerElement=12,de("StructArrayLayout1ui2f12",ul);class Ap extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=4*r;return this.uint32[2*r+0]=l,this.uint16[v+2]=f,this.uint16[v+3]=m,r}}Ap.prototype.bytesPerElement=8,de("StructArrayLayout1ul2ui8",Ap);class kp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l){const f=this.length;return this.resize(f+1),this.emplace(f,r,l)}emplace(r,l,f){const m=2*r;return this.uint16[m+0]=l,this.uint16[m+1]=f,r}}kp.prototype.bytesPerElement=4,de("StructArrayLayout2ui4",kp);class Kc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){const l=this.length;return this.resize(l+1),this.emplace(l,r)}emplace(r,l){return this.uint16[1*r+0]=l,r}}Kc.prototype.bytesPerElement=2,de("StructArrayLayout1ui2",Kc);class Dp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,r,l,f,m)}emplace(r,l,f,m,v){const x=4*r;return this.float32[x+0]=l,this.float32[x+1]=f,this.float32[x+2]=m,this.float32[x+3]=v,r}}Dp.prototype.bytesPerElement=16,de("StructArrayLayout4f16",Dp);class _ extends zu{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 P(this.anchorPointX,this.anchorPointY)}}_.prototype.size=20;class o extends Ou{get(r){return new _(this,r)}}de("CollisionBoxArray",o);class h extends zu{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(r){this._structArray.uint8[this._pos1+37]=r}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(r){this._structArray.uint8[this._pos1+38]=r}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(r){this._structArray.uint32[this._pos4+10]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}h.prototype.size=48;class d extends ll{get(r){return new h(this,r)}}de("PlacedSymbolArray",d);class g extends zu{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(r){this._structArray.uint32[this._pos4+12]=r}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]}}g.prototype.size=64;class y extends Mp{get(r){return new g(this,r)}}de("SymbolInstanceArray",y);class E extends Bu{getoffsetX(r){return this.float32[1*r+0]}}de("GlyphOffsetArray",E);class C extends Hc{getx(r){return this.int16[3*r+0]}gety(r){return this.int16[3*r+1]}gettileUnitDistanceFromAnchor(r){return this.int16[3*r+2]}}de("SymbolLineVertexArray",C);class L extends zu{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}L.prototype.size=12;class A extends ul{get(r){return new L(this,r)}}de("TextAnchorOffsetArray",A);class R extends zu{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]}}R.prototype.size=8;class z extends Ap{get(r){return new R(this,r)}}de("FeatureIndexArray",z);class q extends Ss{}class et extends Ss{}class Q extends Ss{}class nt extends Sp{}class K extends Cp{}class pt extends jl{}class Et extends Tp{}class st extends Lp{}class yt extends ia{}class kt extends Xc{}class Pt extends Yc{}class Bt extends Pp{}class qt extends al{}class Ut extends kp{}const Ht=Si([{name:"a_pos",components:2,type:"Int16"}],4),{members:me}=Ht;class Ae{constructor(r=[]){this.segments=r}prepareSegment(r,l,f,m){let v=this.segments[this.segments.length-1];return r>Ae.MAX_VERTEX_ARRAY_LENGTH&&ie(`Max vertices per segment is ${Ae.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}`),(!v||v.vertexLength+r>Ae.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==m)&&(v={vertexOffset:l.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},m!==void 0&&(v.sortKey=m),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const r of this.segments)for(const l in r.vaos)r.vaos[l].destroy()}static simpleSegment(r,l,f,m){return new Ae([{vertexOffset:r,primitiveOffset:l,vertexLength:f,primitiveLength:m,vaos:{},sortKey:0}])}}function re(s,r){return 256*(s=ht(Math.floor(s),0,255))+ht(Math.floor(r),0,255)}Ae.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,de("SegmentVector",Ae);const Pe=Si([{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 ye={exports:{}},Yn={exports:{}};Yn.exports=function(s,r){var l,f,m,v,x,I,S,M;for(f=s.length-(l=3&s.length),m=r,x=3432918353,I=461845907,M=0;M>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*I+(((S>>>16)*I&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(S=0,l){case 3:S^=(255&s.charCodeAt(M+2))<<16;case 2:S^=(255&s.charCodeAt(M+1))<<8;case 1:m^=S=(65535&(S=(S=(65535&(S^=255&s.charCodeAt(M)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*I+(((S>>>16)*I&65535)<<16)&4294967295}return m^=s.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var an=Yn.exports,Je={exports:{}};Je.exports=function(s,r){for(var l,f=s.length,m=r^f,v=0;f>=4;)l=1540483477*(65535&(l=255&s.charCodeAt(v)|(255&s.charCodeAt(++v))<<8|(255&s.charCodeAt(++v))<<16|(255&s.charCodeAt(++v))<<24))+((1540483477*(l>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),f-=4,++v;switch(f){case 3:m^=(255&s.charCodeAt(v+2))<<16;case 2:m^=(255&s.charCodeAt(v+1))<<8;case 1:m=1540483477*(65535&(m^=255&s.charCodeAt(v)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var ln=an,Ci=Je.exports;ye.exports=ln,ye.exports.murmur3=ln,ye.exports.murmur2=Ci;var zn=b(ye.exports);class jr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(r,l,f,m){this.ids.push(ir(r)),this.positions.push(l,f,m)}getPositions(r){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const l=ir(r);let f=0,m=this.ids.length-1;for(;f>1;this.ids[x]>=l?m=x:f=x+1}const v=[];for(;this.ids[f]===l;)v.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return v}static serialize(r,l){const f=new Float64Array(r.ids),m=new Uint32Array(r.positions);return pi(f,m,0,f.length-1),l&&l.push(f.buffer,m.buffer),{ids:f,positions:m}}static deserialize(r){const l=new jr;return l.ids=r.ids,l.positions=r.positions,l.indexed=!0,l}}function ir(s){const r=+s;return!isNaN(r)&&r<=Number.MAX_SAFE_INTEGER?r:zn(String(s))}function pi(s,r,l,f){for(;l>1];let v=l-1,x=f+1;for(;;){do v++;while(s[v]m);if(v>=x)break;Er(s,v,x),Er(r,3*v,3*x),Er(r,3*v+1,3*x+1),Er(r,3*v+2,3*x+2)}x-l`u_${m}`),this.type=f}setUniform(r,l,f){r.set(f.constantOr(this.value))}getBinding(r,l,f){return this.type==="color"?new Zl(r,l):new Vo(r,l)}}class Ti{constructor(r,l){this.uniformNames=l.map(f=>`u_${f}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(r,l){this.pixelRatioFrom=l.pixelRatio,this.pixelRatioTo=r.pixelRatio,this.patternFrom=l.tlbr,this.patternTo=r.tlbr}setUniform(r,l,f,m){const v=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&r.set(v)}getBinding(r,l,f){return f.substr(0,9)==="u_pattern"?new Pa(r,l):new Vo(r,l)}}class fi{constructor(r,l,f,m){this.expression=r,this.type=f,this.maxValue=0,this.paintVertexAttributes=l.map(v=>({name:`a_${v}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(r,l,f,m,v){const x=this.paintVertexArray.length,I=this.expression.evaluate(new Xn(0),l,{},m,[],v);this.paintVertexArray.resize(r),this._setPaintValue(x,r,I)}updatePaintArray(r,l,f,m){const v=this.expression.evaluate({zoom:0},f,m);this._setPaintValue(r,l,v)}_setPaintValue(r,l,f){if(this.type==="color"){const m=Ma(f);for(let v=r;v`u_${I}_t`),this.type=f,this.useIntegerZoom=m,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=l.map(I=>({name:`a_${I}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(r,l,f,m,v){const x=this.expression.evaluate(new Xn(this.zoom),l,{},m,[],v),I=this.expression.evaluate(new Xn(this.zoom+1),l,{},m,[],v),S=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValue(S,r,x,I)}updatePaintArray(r,l,f,m){const v=this.expression.evaluate({zoom:this.zoom},f,m),x=this.expression.evaluate({zoom:this.zoom+1},f,m);this._setPaintValue(r,l,v,x)}_setPaintValue(r,l,f,m){if(this.type==="color"){const v=Ma(f),x=Ma(m);for(let I=r;I`#define HAS_UNIFORM_${m}`))}return r}getBinderAttributes(){const r=[];for(const l in this.binders){const f=this.binders[l];if(f instanceof fi||f instanceof Zr)for(let m=0;m!0){this.programConfigurations={};for(const m of r)this.programConfigurations[m.id]=new Gi(m,l,f);this.needsUpload=!1,this._featureMap=new jr,this._bufferOffset=0}populatePaintArrays(r,l,f,m,v,x){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(r,l,m,v,x);l.id!==void 0&&this._featureMap.add(l.id,f,this._bufferOffset,r),this._bufferOffset=r,this.needsUpload=!0}updatePaintArrays(r,l,f,m){for(const v of f)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(r,this._featureMap,l,v,m)||this.needsUpload}get(r){return this.programConfigurations[r]}upload(r){if(this.needsUpload){for(const l in this.programConfigurations)this.programConfigurations[l].upload(r);this.needsUpload=!1}}destroy(){for(const r in this.programConfigurations)this.programConfigurations[r].destroy()}}function qi(s,r){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"]}[s]||[s.replace(`${r}-`,"").replace(/-/g,"_")]}function zd(s,r,l){const f={color:{source:jl,composite:Dp},number:{source:Bu,composite:jl}},m=function(v){return{"line-pattern":{source:Et,composite:Et},"fill-pattern":{source:Et,composite:Et},"fill-extrusion-pattern":{source:Et,composite:Et}}[v]}(s);return m&&m[l]||f[r][l]}de("ConstantBinder",Ui),de("CrossFadedConstantBinder",Ti),de("SourceExpressionBinder",fi),de("CrossFadedCompositeBinder",Kn),de("CompositeExpressionBinder",Zr),de("ProgramConfiguration",Gi,{omit:["_buffers"]}),de("ProgramConfigurationSet",rr);const vi=8192,Rp=Math.pow(2,14)-1,Od=-Rp-1;function cl(s){const r=vi/s.extent,l=s.loadGeometry();for(let f=0;fx.x+1||Sx.y+1)&&ie("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return l}function hl(s,r){return{type:s.type,id:s.id,properties:s.properties,geometry:r?cl(s):[]}}function ra(s,r,l,f,m){s.emplaceBack(2*r+(f+1)/2,2*l+(m+1)/2)}class Jc{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(l=>l.id),this.index=r.index,this.hasPattern=!1,this.layoutVertexArray=new et,this.indexArray=new qt,this.segments=new Ae,this.programConfigurations=new rr(r.layers,r.zoom),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){const m=this.layers[0],v=[];let x=null,I=!1;m.type==="circle"&&(x=m.layout.get("circle-sort-key"),I=!x.isConstant());for(const{feature:S,id:M,index:D,sourceLayerIndex:N}of r){const F=this.layers[0]._featureFilter.needGeometry,G=hl(S,F);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),G,f))continue;const j=I?x.evaluate(G,{},f):void 0,Y={id:M,properties:S.properties,type:S.type,sourceLayerIndex:N,index:D,geometry:F?G.geometry:cl(S),patterns:{},sortKey:j};v.push(Y)}I&&v.sort((S,M)=>S.sortKey-M.sortKey);for(const S of v){const{geometry:M,index:D,sourceLayerIndex:N}=S,F=r[D].feature;this.addFeature(S,M,D,f),l.featureIndex.insert(F,M,D,N,this.index)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,me),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(r,l,f,m){for(const v of l)for(const x of v){const I=x.x,S=x.y;if(I<0||I>=vi||S<0||S>=vi)continue;const M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,r.sortKey),D=M.vertexLength;ra(this.layoutVertexArray,I,S,-1,-1),ra(this.layoutVertexArray,I,S,1,-1),ra(this.layoutVertexArray,I,S,1,1),ra(this.layoutVertexArray,I,S,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),M.vertexLength+=4,M.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,f,{},m)}}function Np(s,r){for(let l=0;l1){if(Vu(s,r))return!0;for(let f=0;f1?l:l.sub(r)._mult(m)._add(r))}function yy(s,r){let l,f,m,v=!1;for(let x=0;xr.y!=m.y>r.y&&r.x<(m.x-f.x)*(r.y-f.y)/(m.y-f.y)+f.x&&(v=!v)}return v}function $c(s,r){let l=!1;for(let f=0,m=s.length-1;fr.y!=x.y>r.y&&r.x<(x.x-v.x)*(r.y-v.y)/(x.y-v.y)+v.x&&(l=!l)}return l}function rb(s,r,l){const f=l[0],m=l[2];if(s.xm.x&&r.x>m.x||s.ym.y&&r.y>m.y)return!1;const v=Tt(s,r,l[0]);return v!==Tt(s,r,l[1])||v!==Tt(s,r,l[2])||v!==Tt(s,r,l[3])}function zp(s,r,l){const f=r.paint.get(s).value;return f.kind==="constant"?f.value:l.programConfigurations.get(r.id).getMaxValue(s)}function Vd(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function Ud(s,r,l,f,m){if(!r[0]&&!r[1])return s;const v=P.convert(r)._mult(m);l==="viewport"&&v._rotate(-f);const x=[];for(let I=0;Iwy(it,Y))}(M,S),G=N?D*I:D;for(const j of m)for(const Y of j){const it=N?Y:wy(Y,S);let at=G;const bt=Gd([],[Y.x,Y.y,0,1],S);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?at*=bt[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(at*=x.cameraToCenterDistance/bt[3]),Fd(F,it,at))return!0}return!1}}function wy(s,r){const l=Gd([],[s.x,s.y,0,1],r);return new P(l[0]/l[3],l[1]/l[3])}class Iy extends Jc{}let Ey;de("HeatmapBucket",Iy,{omit:["layers"]});var lb={get paint(){return Ey=Ey||new qr({"heatmap-radius":new ke(Mt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ke(Mt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new be(Mt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new wp(Mt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new be(Mt.paint_heatmap["heatmap-opacity"])})}};function Ig(s,{width:r,height:l},f,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==r*l*f)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${r*l*f}`)}else m=new Uint8Array(r*l*f);return s.width=r,s.height=l,s.data=m,s}function Sy(s,{width:r,height:l},f){if(r===s.width&&l===s.height)return;const m=Ig({},{width:r,height:l},f);Eg(s,m,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,r),height:Math.min(s.height,l)},f),s.width=r,s.height=l,s.data=m.data}function Eg(s,r,l,f,m,v){if(m.width===0||m.height===0)return r;if(m.width>s.width||m.height>s.height||l.x>s.width-m.width||l.y>s.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>r.width||m.height>r.height||f.x>r.width-m.width||f.y>r.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const x=s.data,I=r.data;if(x===I)throw new Error("srcData equals dstData, so image is already copied");for(let S=0;S{r[s.evaluationKey]=S;const M=s.expression.evaluate(r);m.data[x+I+0]=Math.floor(255*M.r/M.a),m.data[x+I+1]=Math.floor(255*M.g/M.a),m.data[x+I+2]=Math.floor(255*M.b/M.a),m.data[x+I+3]=Math.floor(255*M.a)};if(s.clips)for(let x=0,I=0;x80*l){f=v=s[0],m=x=s[1];for(var j=l;jv&&(v=I),S>x&&(x=S);M=(M=Math.max(v-f,x-m))!==0?32767/M:0}return Bp(F,G,l,f,m,M,0),G}function Ly(s,r,l,f,m){var v,x;if(m===Lg(s,r,l,f)>0)for(v=r;v=r;v-=f)x=Ay(v,s[v],s[v+1],x);return x&&jd(x,x.next)&&(Up(x),x=x.next),x}function Uu(s,r){if(!s)return s;r||(r=s);var l,f=s;do if(l=!1,f.steiner||!jd(f,f.next)&&Li(f.prev,f,f.next)!==0)f=f.next;else{if(Up(f),(f=r=f.prev)===f.next)break;l=!0}while(l||f!==r);return r}function Bp(s,r,l,f,m,v,x){if(s){!x&&v&&function(D,N,F,G){var j=D;do j.z===0&&(j.z=Cg(j.x,j.y,N,F,G)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==D);j.prevZ.nextZ=null,j.prevZ=null,function(Y){var it,at,bt,ct,_t,Ot,Vt,ue,ve=1;do{for(at=Y,Y=null,_t=null,Ot=0;at;){for(Ot++,bt=at,Vt=0,it=0;it0||ue>0&&bt;)Vt!==0&&(ue===0||!bt||at.z<=bt.z)?(ct=at,at=at.nextZ,Vt--):(ct=bt,bt=bt.nextZ,ue--),_t?_t.nextZ=ct:Y=ct,ct.prevZ=_t,_t=ct;at=bt}_t.nextZ=null,ve*=2}while(Ot>1)}(j)}(s,f,m,v);for(var I,S,M=s;s.prev!==s.next;)if(I=s.prev,S=s.next,v?mb(s,f,m,v):db(s))r.push(I.i/l|0),r.push(s.i/l|0),r.push(S.i/l|0),Up(s),s=S.next,M=S.next;else if((s=S)===M){x?x===1?Bp(s=gb(Uu(s),r,l),r,l,f,m,v,2):x===2&&_b(s,r,l,f,m,v):Bp(Uu(s),r,l,f,m,v,1);break}}}function db(s){var r=s.prev,l=s,f=s.next;if(Li(r,l,f)>=0)return!1;for(var m=r.x,v=l.x,x=f.x,I=r.y,S=l.y,M=f.y,D=mv?m>x?m:x:v>x?v:x,G=I>S?I>M?I:M:S>M?S:M,j=f.next;j!==r;){if(j.x>=D&&j.x<=F&&j.y>=N&&j.y<=G&&eh(m,I,v,S,x,M,j.x,j.y)&&Li(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function mb(s,r,l,f){var m=s.prev,v=s,x=s.next;if(Li(m,v,x)>=0)return!1;for(var I=m.x,S=v.x,M=x.x,D=m.y,N=v.y,F=x.y,G=IS?I>M?I:M:S>M?S:M,it=D>N?D>F?D:F:N>F?N:F,at=Cg(G,j,r,l,f),bt=Cg(Y,it,r,l,f),ct=s.prevZ,_t=s.nextZ;ct&&ct.z>=at&&_t&&_t.z<=bt;){if(ct.x>=G&&ct.x<=Y&&ct.y>=j&&ct.y<=it&&ct!==m&&ct!==x&&eh(I,D,S,N,M,F,ct.x,ct.y)&&Li(ct.prev,ct,ct.next)>=0||(ct=ct.prevZ,_t.x>=G&&_t.x<=Y&&_t.y>=j&&_t.y<=it&&_t!==m&&_t!==x&&eh(I,D,S,N,M,F,_t.x,_t.y)&&Li(_t.prev,_t,_t.next)>=0))return!1;_t=_t.nextZ}for(;ct&&ct.z>=at;){if(ct.x>=G&&ct.x<=Y&&ct.y>=j&&ct.y<=it&&ct!==m&&ct!==x&&eh(I,D,S,N,M,F,ct.x,ct.y)&&Li(ct.prev,ct,ct.next)>=0)return!1;ct=ct.prevZ}for(;_t&&_t.z<=bt;){if(_t.x>=G&&_t.x<=Y&&_t.y>=j&&_t.y<=it&&_t!==m&&_t!==x&&eh(I,D,S,N,M,F,_t.x,_t.y)&&Li(_t.prev,_t,_t.next)>=0)return!1;_t=_t.nextZ}return!0}function gb(s,r,l){var f=s;do{var m=f.prev,v=f.next.next;!jd(m,v)&&Py(m,f,f.next,v)&&Vp(m,v)&&Vp(v,m)&&(r.push(m.i/l|0),r.push(f.i/l|0),r.push(v.i/l|0),Up(f),Up(f.next),f=s=v),f=f.next}while(f!==s);return Uu(f)}function _b(s,r,l,f,m,v){var x=s;do{for(var I=x.next.next;I!==x.prev;){if(x.i!==I.i&&wb(x,I)){var S=My(x,I);return x=Uu(x,x.next),S=Uu(S,S.next),Bp(x,r,l,f,m,v,0),void Bp(S,r,l,f,m,v,0)}I=I.next}x=x.next}while(x!==s)}function yb(s,r){return s.x-r.x}function vb(s,r){var l=function(m,v){var x,I=v,S=m.x,M=m.y,D=-1/0;do{if(M<=I.y&&M>=I.next.y&&I.next.y!==I.y){var N=I.x+(M-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(N<=S&&N>D&&(D=N,x=I.x=I.x&&I.x>=j&&S!==I.x&&eh(Mx.x||I.x===x.x&&xb(x,I)))&&(x=I,it=F)),I=I.next;while(I!==G);return x}(s,r);if(!l)return r;var f=My(l,s);return Uu(f,f.next),Uu(l,l.next)}function xb(s,r){return Li(s.prev,s,r.prev)<0&&Li(r.next,s,s.next)<0}function Cg(s,r,l,f,m){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-l)*m|0)|s<<8))|s<<4))|s<<2))|s<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-f)*m|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function bb(s){var r=s,l=s;do(r.x=(s-x)*(v-I)&&(s-x)*(f-I)>=(l-x)*(r-I)&&(l-x)*(v-I)>=(m-x)*(f-I)}function wb(s,r){return s.next.i!==r.i&&s.prev.i!==r.i&&!function(l,f){var m=l;do{if(m.i!==l.i&&m.next.i!==l.i&&m.i!==f.i&&m.next.i!==f.i&&Py(m,m.next,l,f))return!0;m=m.next}while(m!==l);return!1}(s,r)&&(Vp(s,r)&&Vp(r,s)&&function(l,f){var m=l,v=!1,x=(l.x+f.x)/2,I=(l.y+f.y)/2;do m.y>I!=m.next.y>I&&m.next.y!==m.y&&x<(m.next.x-m.x)*(I-m.y)/(m.next.y-m.y)+m.x&&(v=!v),m=m.next;while(m!==l);return v}(s,r)&&(Li(s.prev,s,r.prev)||Li(s,r.prev,r))||jd(s,r)&&Li(s.prev,s,s.next)>0&&Li(r.prev,r,r.next)>0)}function Li(s,r,l){return(r.y-s.y)*(l.x-r.x)-(r.x-s.x)*(l.y-r.y)}function jd(s,r){return s.x===r.x&&s.y===r.y}function Py(s,r,l,f){var m=Wd(Li(s,r,l)),v=Wd(Li(s,r,f)),x=Wd(Li(l,f,s)),I=Wd(Li(l,f,r));return m!==v&&x!==I||!(m!==0||!Zd(s,l,r))||!(v!==0||!Zd(s,f,r))||!(x!==0||!Zd(l,s,f))||!(I!==0||!Zd(l,r,f))}function Zd(s,r,l){return r.x<=Math.max(s.x,l.x)&&r.x>=Math.min(s.x,l.x)&&r.y<=Math.max(s.y,l.y)&&r.y>=Math.min(s.y,l.y)}function Wd(s){return s>0?1:s<0?-1:0}function Vp(s,r){return Li(s.prev,s,s.next)<0?Li(s,r,s.next)>=0&&Li(s,s.prev,r)>=0:Li(s,r,s.prev)<0||Li(s,s.next,r)<0}function My(s,r){var l=new Tg(s.i,s.x,s.y),f=new Tg(r.i,r.x,r.y),m=s.next,v=r.prev;return s.next=r,r.prev=s,l.next=m,m.prev=l,f.next=l,l.prev=f,v.next=f,f.prev=v,f}function Ay(s,r,l,f){var m=new Tg(s,r,l);return f?(m.next=f.next,m.prev=f,f.next.prev=m,f.next=m):(m.prev=m,m.next=m),m}function Up(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Tg(s,r,l){this.i=s,this.x=r,this.y=l,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Lg(s,r,l,f){for(var m=0,v=r,x=l-f;v0&&l.holes.push(f+=s[m-1].length)}return l};var ky=b(Sg.exports);function Ib(s,r,l,f,m){Dy(s,r,l||0,f||s.length-1,m||Eb)}function Dy(s,r,l,f,m){for(;f>l;){if(f-l>600){var v=f-l+1,x=r-l+1,I=Math.log(v),S=.5*Math.exp(2*I/3),M=.5*Math.sqrt(I*S*(v-S)/v)*(x-v/2<0?-1:1);Dy(s,r,Math.max(l,Math.floor(r-x*S/v+M)),Math.min(f,Math.floor(r+(v-x)*S/v+M)),m)}var D=s[r],N=l,F=f;for(Gp(s,l,r),m(s[f],D)>0&&Gp(s,l,f);N0;)F--}m(s[l],D)===0?Gp(s,l,F):Gp(s,++F,f),F<=r&&(l=F+1),r<=F&&(f=F-1)}}function Gp(s,r,l){var f=s[r];s[r]=s[l],s[l]=f}function Eb(s,r){return sr?1:0}function Pg(s,r){const l=s.length;if(l<=1)return[s];const f=[];let m,v;for(let x=0;x1)for(let x=0;xl.id),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Q,this.indexArray=new qt,this.indexArray2=new Ut,this.programConfigurations=new rr(r.layers,r.zoom),this.segments=new Ae,this.segments2=new Ae,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){this.hasPattern=Mg("fill",this.layers,l);const m=this.layers[0].layout.get("fill-sort-key"),v=!m.isConstant(),x=[];for(const{feature:I,id:S,index:M,sourceLayerIndex:D}of r){const N=this.layers[0]._featureFilter.needGeometry,F=hl(I,N);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),F,f))continue;const G=v?m.evaluate(F,{},f,l.availableImages):void 0,j={id:S,properties:I.properties,type:I.type,sourceLayerIndex:D,index:M,geometry:N?F.geometry:cl(I),patterns:{},sortKey:G};x.push(j)}v&&x.sort((I,S)=>I.sortKey-S.sortKey);for(const I of x){const{geometry:S,index:M,sourceLayerIndex:D}=I;if(this.hasPattern){const N=Ag("fill",this.layers,I,this.zoom,l);this.patternFeatures.push(N)}else this.addFeature(I,S,M,f,{});l.featureIndex.insert(r[M].feature,S,M,D,this.index)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}addFeatures(r,l,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,l,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,fb),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.indexBuffer2=r.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(r),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(r,l,f,m,v){for(const x of Pg(l,500)){let I=0;for(const G of x)I+=G.length;const S=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),M=S.vertexLength,D=[],N=[];for(const G of x){if(G.length===0)continue;G!==x[0]&&N.push(D.length/2);const j=this.segments2.prepareSegment(G.length,this.layoutVertexArray,this.indexArray2),Y=j.vertexLength;this.layoutVertexArray.emplaceBack(G[0].x,G[0].y),this.indexArray2.emplaceBack(Y+G.length-1,Y),D.push(G[0].x),D.push(G[0].y);for(let it=1;it>3}if(m--,f===1||f===2)v+=s.readSVarint(),x+=s.readSVarint(),f===1&&(r&&I.push(r),r=[]),r.push(new Ab(v,x));else{if(f!==7)throw new Error("unknown command "+f);r&&r.push(r[0].clone())}}return r&&I.push(r),I},nh.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var r=s.readVarint()+s.pos,l=1,f=0,m=0,v=0,x=1/0,I=-1/0,S=1/0,M=-1/0;s.pos>3}if(f--,l===1||l===2)(m+=s.readSVarint())I&&(I=m),(v+=s.readSVarint())M&&(M=v);else if(l!==7)throw new Error("unknown command "+l)}return[x,S,I,M]},nh.prototype.toGeoJSON=function(s,r,l){var f,m,v=this.extent*Math.pow(2,l),x=this.extent*s,I=this.extent*r,S=this.loadGeometry(),M=nh.types[this.type];function D(G){for(var j=0;j>3;m=x===1?f.readString():x===2?f.readFloat():x===3?f.readDouble():x===4?f.readVarint64():x===5?f.readVarint():x===6?f.readSVarint():x===7?f.readBoolean():null}return m}(l))}Fy.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var r=this._pbf.readVarint()+this._pbf.pos;return new Rb(this._pbf,r,this.extent,this._keys,this._values)};var zb=Oy;function Ob(s,r,l){if(s===3){var f=new zb(l,l.readVarint()+l.pos);f.length&&(r[f.name]=f)}}Hl.VectorTile=function(s,r){this.layers=s.readFields(Ob,{},r)},Hl.VectorTileFeature=zy,Hl.VectorTileLayer=Oy;const Fb=Hl.VectorTileFeature.types,Dg=Math.pow(2,13);function qp(s,r,l,f,m,v,x,I){s.emplaceBack(r,l,2*Math.floor(f*Dg)+x,m*Dg*2,v*Dg*2,Math.round(I))}class Rg{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(l=>l.id),this.index=r.index,this.hasPattern=!1,this.layoutVertexArray=new nt,this.centroidVertexArray=new q,this.indexArray=new qt,this.programConfigurations=new rr(r.layers,r.zoom),this.segments=new Ae,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){this.features=[],this.hasPattern=Mg("fill-extrusion",this.layers,l);for(const{feature:m,id:v,index:x,sourceLayerIndex:I}of r){const S=this.layers[0]._featureFilter.needGeometry,M=hl(m,S);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),M,f))continue;const D={id:v,sourceLayerIndex:I,index:x,geometry:S?M.geometry:cl(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(Ag("fill-extrusion",this.layers,D,this.zoom,l)):this.addFeature(D,D.geometry,x,f,{}),l.featureIndex.insert(m,D.geometry,x,I,this.index,!0)}}addFeatures(r,l,f){for(const m of this.features){const{geometry:v}=m;this.addFeature(m,v,m.index,l,f)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,Mb),this.centroidVertexBuffer=r.createVertexBuffer(this.centroidVertexArray,Pb.members,!0),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(r,l,f,m,v){const x={x:0,y:0,vertexCount:0};for(const I of Pg(l,500)){let S=0;for(const j of I)S+=j.length;let M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const j of I){if(j.length===0||Vb(j))continue;let Y=0;for(let it=0;it=1){const bt=j[it-1];if(!Bb(at,bt)){M.vertexLength+4>Ae.MAX_VERTEX_ARRAY_LENGTH&&(M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ct=at.sub(bt)._perp()._unit(),_t=bt.dist(at);Y+_t>32768&&(Y=0),qp(this.layoutVertexArray,at.x,at.y,ct.x,ct.y,0,0,Y),qp(this.layoutVertexArray,at.x,at.y,ct.x,ct.y,0,1,Y),x.x+=2*at.x,x.y+=2*at.y,x.vertexCount+=2,Y+=_t,qp(this.layoutVertexArray,bt.x,bt.y,ct.x,ct.y,0,0,Y),qp(this.layoutVertexArray,bt.x,bt.y,ct.x,ct.y,0,1,Y),x.x+=2*bt.x,x.y+=2*bt.y,x.vertexCount+=2;const Ot=M.vertexLength;this.indexArray.emplaceBack(Ot,Ot+2,Ot+1),this.indexArray.emplaceBack(Ot+1,Ot+2,Ot+3),M.vertexLength+=4,M.primitiveLength+=2}}}}if(M.vertexLength+S>Ae.MAX_VERTEX_ARRAY_LENGTH&&(M=this.segments.prepareSegment(S,this.layoutVertexArray,this.indexArray)),Fb[r.type]!=="Polygon")continue;const D=[],N=[],F=M.vertexLength;for(const j of I)if(j.length!==0){j!==I[0]&&N.push(D.length/2);for(let Y=0;Yvi)||s.y===r.y&&(s.y<0||s.y>vi)}function Vb(s){return s.every(r=>r.x<0)||s.every(r=>r.x>vi)||s.every(r=>r.y<0)||s.every(r=>r.y>vi)}let By;de("FillExtrusionBucket",Rg,{omit:["layers","features"]});var Ub={get paint(){return By=By||new qr({"fill-extrusion-opacity":new be(Mt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ke(Mt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new be(Mt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new be(Mt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ql(Mt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ke(Mt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ke(Mt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new be(Mt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Gb extends is{constructor(r){super(r,Ub)}createBucket(r){return new Rg(r)}queryRadius(){return Vd(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(r,l,f,m,v,x,I,S){const M=Ud(r,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,I),D=this.paint.get("fill-extrusion-height").evaluate(l,f),N=this.paint.get("fill-extrusion-base").evaluate(l,f),F=function(j,Y,it,at){const bt=[];for(const ct of j){const _t=[ct.x,ct.y,0,1];Gd(_t,_t,Y),bt.push(new P(_t[0]/_t[3],_t[1]/_t[3]))}return bt}(M,S),G=function(j,Y,it,at){const bt=[],ct=[],_t=at[8]*Y,Ot=at[9]*Y,Vt=at[10]*Y,ue=at[11]*Y,ve=at[8]*it,le=at[9]*it,oe=at[10]*it,Qt=at[11]*it;for(const _e of j){const $t=[],jt=[];for(const Le of _e){const we=Le.x,$e=Le.y,Jn=at[0]*we+at[4]*$e+at[12],ei=at[1]*we+at[5]*$e+at[13],Zi=at[2]*we+at[6]*$e+at[14],Uo=at[3]*we+at[7]*$e+at[15],ao=Zi+Vt,Fi=Uo+ue,dr=Jn+ve,Tr=ei+le,lo=Zi+oe,uo=Uo+Qt,Wi=new P((Jn+_t)/Fi,(ei+Ot)/Fi);Wi.z=ao/Fi,$t.push(Wi);const Hi=new P(dr/uo,Tr/uo);Hi.z=lo/uo,jt.push(Hi)}bt.push($t),ct.push(jt)}return[bt,ct]}(m,N,D,S);return function(j,Y,it){let at=1/0;Qc(it,Y)&&(at=Vy(it,Y[0]));for(let bt=0;btl.id),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(l=>{this.gradients[l.id]={}}),this.layoutVertexArray=new K,this.layoutVertexArray2=new pt,this.indexArray=new qt,this.programConfigurations=new rr(r.layers,r.zoom),this.segments=new Ae,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){this.hasPattern=Mg("line",this.layers,l);const m=this.layers[0].layout.get("line-sort-key"),v=!m.isConstant(),x=[];for(const{feature:I,id:S,index:M,sourceLayerIndex:D}of r){const N=this.layers[0]._featureFilter.needGeometry,F=hl(I,N);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),F,f))continue;const G=v?m.evaluate(F,{},f):void 0,j={id:S,properties:I.properties,type:I.type,sourceLayerIndex:D,index:M,geometry:N?F.geometry:cl(I),patterns:{},sortKey:G};x.push(j)}v&&x.sort((I,S)=>I.sortKey-S.sortKey);for(const I of x){const{geometry:S,index:M,sourceLayerIndex:D}=I;if(this.hasPattern){const N=Ag("line",this.layers,I,this.zoom,l);this.patternFeatures.push(N)}else this.addFeature(I,S,M,f,{});l.featureIndex.insert(r[M].feature,S,M,D,this.index)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}addFeatures(r,l,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,l,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=r.createVertexBuffer(this.layoutVertexArray2,Wb)),this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,jb),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(r){if(r.properties&&Object.prototype.hasOwnProperty.call(r.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(r.properties,"mapbox_clip_end"))return{start:+r.properties.mapbox_clip_start,end:+r.properties.mapbox_clip_end}}addFeature(r,l,f,m,v){const x=this.layers[0].layout,I=x.get("line-join").evaluate(r,{}),S=x.get("line-cap"),M=x.get("line-miter-limit"),D=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(r);for(const N of l)this.addLine(N,r,I,S,M,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,f,v,m)}addLine(r,l,f,m,v,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let at=0;at=2&&r[S-1].equals(r[S-2]);)S--;let M=0;for(;M0;if(ue&&at>M){const Qt=F.dist(G);if(Qt>2*D){const _e=F.sub(F.sub(G)._mult(D/Qt)._round());this.updateDistance(G,_e),this.addCurrentVertex(_e,Y,0,0,N),G=_e}}const le=G&&j;let oe=le?f:I?"butt":m;if(le&&oe==="round"&&(Otv&&(oe="bevel"),oe==="bevel"&&(Ot>2&&(oe="flipbevel"),Ot100)bt=it.mult(-1);else{const Qt=Ot*Y.add(it).mag()/Y.sub(it).mag();bt._perp()._mult(Qt*(ve?-1:1))}this.addCurrentVertex(F,bt,0,0,N),this.addCurrentVertex(F,bt.mult(-1),0,0,N)}else if(oe==="bevel"||oe==="fakeround"){const Qt=-Math.sqrt(Ot*Ot-1),_e=ve?Qt:0,$t=ve?0:Qt;if(G&&this.addCurrentVertex(F,Y,_e,$t,N),oe==="fakeround"){const jt=Math.round(180*Vt/Math.PI/20);for(let Le=1;Le2*D){const _e=F.add(j.sub(F)._mult(D/Qt)._round());this.updateDistance(F,_e),this.addCurrentVertex(_e,it,0,0,N),F=_e}}}}addCurrentVertex(r,l,f,m,v,x=!1){const I=l.y*m-l.x,S=-l.y-l.x*m;this.addHalfVertex(r,l.x+l.y*f,l.y-l.x*f,x,!1,f,v),this.addHalfVertex(r,I,S,x,!0,-m,v),this.distance>Uy/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(r,l,f,m,v,x))}addHalfVertex({x:r,y:l},f,m,v,x,I,S){const M=.5*(this.lineClips?this.scaledDistance*(Uy-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((r<<1)+(v?1:0),(l<<1)+(x?1:0),Math.round(63*f)+128,Math.round(63*m)+128,1+(I===0?0:I<0?-1:1)|(63&M)<<2,M>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=S.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),S.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(r,l){this.distance+=r.dist(l),this.updateScaledDistance()}}let Gy,qy;de("LineBucket",Ng,{omit:["layers","patternFeatures"]});var jy={get paint(){return qy=qy||new qr({"line-opacity":new ke(Mt.paint_line["line-opacity"]),"line-color":new ke(Mt.paint_line["line-color"]),"line-translate":new be(Mt.paint_line["line-translate"]),"line-translate-anchor":new be(Mt.paint_line["line-translate-anchor"]),"line-width":new ke(Mt.paint_line["line-width"]),"line-gap-width":new ke(Mt.paint_line["line-gap-width"]),"line-offset":new ke(Mt.paint_line["line-offset"]),"line-blur":new ke(Mt.paint_line["line-blur"]),"line-dasharray":new bp(Mt.paint_line["line-dasharray"]),"line-pattern":new ql(Mt.paint_line["line-pattern"]),"line-gradient":new wp(Mt.paint_line["line-gradient"])})},get layout(){return Gy=Gy||new qr({"line-cap":new be(Mt.layout_line["line-cap"]),"line-join":new ke(Mt.layout_line["line-join"]),"line-miter-limit":new be(Mt.layout_line["line-miter-limit"]),"line-round-limit":new be(Mt.layout_line["line-round-limit"]),"line-sort-key":new ke(Mt.layout_line["line-sort-key"])})}};class Yb extends ke{possiblyEvaluate(r,l){return l=new Xn(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,zoomHistory:l.zoomHistory,transition:l.transition}),super.possiblyEvaluate(r,l)}evaluate(r,l,f,m){return l=gt({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(r,l,f,m)}}let Hd;class Kb extends is{constructor(r){super(r,jy),this.gradientVersion=0,Hd||(Hd=new Yb(jy.paint.properties["line-width"].specification),Hd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const l=this.gradientExpression();this.stepInterpolant=!!function(f){return f._styleExpression!==void 0}(l)&&l._styleExpression.expression instanceof Cu,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(r,l){super.recalculate(r,l),this.paint._values["line-floorwidth"]=Hd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Ng(r)}queryRadius(r){const l=r,f=Zy(zp("line-width",this,l),zp("line-gap-width",this,l)),m=zp("line-offset",this,l);return f/2+Math.abs(m)+Vd(this.paint.get("line-translate"))}queryIntersectsFeature(r,l,f,m,v,x,I){const S=Ud(r,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,I),M=I/2*Zy(this.paint.get("line-width").evaluate(l,f),this.paint.get("line-gap-width").evaluate(l,f)),D=this.paint.get("line-offset").evaluate(l,f);return D&&(m=function(N,F){const G=[];for(let j=0;j=3){for(let it=0;it0?r+2*s:s}const Jb=Si([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Qb=Si([{name:"a_projected_pos",components:3,type:"Float32"}],4);Si([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $b=Si([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Si([{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 Wy=Si([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tw=Si([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ew(s,r,l){return s.sections.forEach(f=>{f.text=function(m,v,x){const I=v.layout.get("text-transform").evaluate(x,{});return I==="uppercase"?m=m.toLocaleUpperCase():I==="lowercase"&&(m=m.toLocaleLowerCase()),sl.applyArabicShaping&&(m=sl.applyArabicShaping(m)),m}(f.text,r,l)}),s}Si([{name:"triangle",components:3,type:"Uint16"}]),Si([{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"}]),Si([{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"}]),Si([{type:"Float32",name:"offsetX"}]),Si([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Si([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ji=24,Hy=On,Xy=function(s,r,l,f,m){var v,x,I=8*m-f-1,S=(1<>1,D=-7,N=l?m-1:0,F=l?-1:1,G=s[r+N];for(N+=F,v=G&(1<<-D)-1,G>>=-D,D+=I;D>0;v=256*v+s[r+N],N+=F,D-=8);for(x=v&(1<<-D)-1,v>>=-D,D+=f;D>0;x=256*x+s[r+N],N+=F,D-=8);if(v===0)v=1-M;else{if(v===S)return x?NaN:1/0*(G?-1:1);x+=Math.pow(2,f),v-=M}return(G?-1:1)*x*Math.pow(2,v-f)},Yy=function(s,r,l,f,m,v){var x,I,S,M=8*v-m-1,D=(1<>1,F=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,G=f?0:v-1,j=f?1:-1,Y=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(I=isNaN(r)?1:0,x=D):(x=Math.floor(Math.log(r)/Math.LN2),r*(S=Math.pow(2,-x))<1&&(x--,S*=2),(r+=x+N>=1?F/S:F*Math.pow(2,1-N))*S>=2&&(x++,S/=2),x+N>=D?(I=0,x=D):x+N>=1?(I=(r*S-1)*Math.pow(2,m),x+=N):(I=r*Math.pow(2,N-1)*Math.pow(2,m),x=0));m>=8;s[l+G]=255&I,G+=j,I/=256,m-=8);for(x=x<0;s[l+G]=255&x,G+=j,x/=256,M-=8);s[l+G-j]|=128*Y};function On(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}On.Varint=0,On.Fixed64=1,On.Bytes=2,On.Fixed32=5;var zg=4294967296,Ky=1/zg,Jy=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function pl(s){return s.type===On.Bytes?s.readVarint()+s.pos:s.pos+1}function ih(s,r,l){return l?4294967296*r+(s>>>0):4294967296*(r>>>0)+(s>>>0)}function Qy(s,r,l){var f=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));l.realloc(f);for(var m=l.pos-1;m>=s;m--)l.buf[m+f]=l.buf[m]}function nw(s,r){for(var l=0;l>>8,s[l+2]=r>>>16,s[l+3]=r>>>24}function $y(s,r){return(s[r]|s[r+1]<<8|s[r+2]<<16)+(s[r+3]<<24)}On.prototype={destroy:function(){this.buf=null},readFields:function(s,r,l){for(l=l||this.length;this.pos>3,v=this.pos;this.type=7&f,s(m,r,this),this.pos===v&&this.skip(f)}return r},readMessage:function(s,r){return this.readFields(s,r,this.readVarint()+this.pos)},readFixed32:function(){var s=Xd(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=$y(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=Xd(this.buf,this.pos)+Xd(this.buf,this.pos+4)*zg;return this.pos+=8,s},readSFixed64:function(){var s=Xd(this.buf,this.pos)+$y(this.buf,this.pos+4)*zg;return this.pos+=8,s},readFloat:function(){var s=Xy(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=Xy(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var r,l,f=this.buf;return r=127&(l=f[this.pos++]),l<128?r:(r|=(127&(l=f[this.pos++]))<<7,l<128?r:(r|=(127&(l=f[this.pos++]))<<14,l<128?r:(r|=(127&(l=f[this.pos++]))<<21,l<128?r:function(m,v,x){var I,S,M=x.buf;if(I=(112&(S=M[x.pos++]))>>4,S<128||(I|=(127&(S=M[x.pos++]))<<3,S<128)||(I|=(127&(S=M[x.pos++]))<<10,S<128)||(I|=(127&(S=M[x.pos++]))<<17,S<128)||(I|=(127&(S=M[x.pos++]))<<24,S<128)||(I|=(1&(S=M[x.pos++]))<<31,S<128))return ih(m,I,v);throw new Error("Expected varint not more than 10 bytes")}(r|=(15&(l=f[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,r=this.pos;return this.pos=s,s-r>=12&&Jy?function(l,f,m){return Jy.decode(l.subarray(f,m))}(this.buf,r,s):function(l,f,m){for(var v="",x=f;x239?4:D>223?3:D>191?2:1;if(x+F>m)break;F===1?D<128&&(N=D):F===2?(192&(I=l[x+1]))==128&&(N=(31&D)<<6|63&I)<=127&&(N=null):F===3?(S=l[x+2],(192&(I=l[x+1]))==128&&(192&S)==128&&((N=(15&D)<<12|(63&I)<<6|63&S)<=2047||N>=55296&&N<=57343)&&(N=null)):F===4&&(S=l[x+2],M=l[x+3],(192&(I=l[x+1]))==128&&(192&S)==128&&(192&M)==128&&((N=(15&D)<<18|(63&I)<<12|(63&S)<<6|63&M)<=65535||N>=1114112)&&(N=null)),N===null?(N=65533,F=1):N>65535&&(N-=65536,v+=String.fromCharCode(N>>>10&1023|55296),N=56320|1023&N),v+=String.fromCharCode(N),x+=F}return v}(this.buf,r,s)},readBytes:function(){var s=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,s);return this.pos=s,r},readPackedVarint:function(s,r){if(this.type!==On.Bytes)return s.push(this.readVarint(r));var l=pl(this);for(s=s||[];this.pos127;);else if(r===On.Bytes)this.pos=this.readVarint()+this.pos;else if(r===On.Fixed32)this.pos+=4;else{if(r!==On.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(s,r){this.writeVarint(s<<3|r)},realloc:function(s){for(var r=this.length||16;r268435455||s<0?function(r,l){var f,m;if(r>=0?(f=r%4294967296|0,m=r/4294967296|0):(m=~(-r/4294967296),4294967295^(f=~(-r%4294967296))?f=f+1|0:(f=0,m=m+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");l.realloc(10),function(v,x,I){I.buf[I.pos++]=127&v|128,v>>>=7,I.buf[I.pos++]=127&v|128,v>>>=7,I.buf[I.pos++]=127&v|128,v>>>=7,I.buf[I.pos++]=127&v|128,I.buf[I.pos]=127&(v>>>=7)}(f,0,l),function(v,x){var I=(7&v)<<4;x.buf[x.pos++]|=I|((v>>>=3)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v)))))}(m,l)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var r=this.pos;this.pos=function(f,m,v){for(var x,I,S=0;S55295&&x<57344){if(!I){x>56319||S+1===m.length?(f[v++]=239,f[v++]=191,f[v++]=189):I=x;continue}if(x<56320){f[v++]=239,f[v++]=191,f[v++]=189,I=x;continue}x=I-55296<<10|x-56320|65536,I=null}else I&&(f[v++]=239,f[v++]=191,f[v++]=189,I=null);x<128?f[v++]=x:(x<2048?f[v++]=x>>6|192:(x<65536?f[v++]=x>>12|224:(f[v++]=x>>18|240,f[v++]=x>>12&63|128),f[v++]=x>>6&63|128),f[v++]=63&x|128)}return v}(this.buf,s,this.pos);var l=this.pos-r;l>=128&&Qy(r,l,this),this.pos=r-1,this.writeVarint(l),this.pos+=l},writeFloat:function(s){this.realloc(4),Yy(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),Yy(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var r=s.length;this.writeVarint(r),this.realloc(r);for(var l=0;l=128&&Qy(l,f,this),this.pos=l-1,this.writeVarint(f),this.pos+=f},writeMessage:function(s,r,l){this.writeTag(s,On.Bytes),this.writeRawMessage(r,l)},writePackedVarint:function(s,r){r.length&&this.writeMessage(s,nw,r)},writePackedSVarint:function(s,r){r.length&&this.writeMessage(s,iw,r)},writePackedBoolean:function(s,r){r.length&&this.writeMessage(s,sw,r)},writePackedFloat:function(s,r){r.length&&this.writeMessage(s,rw,r)},writePackedDouble:function(s,r){r.length&&this.writeMessage(s,ow,r)},writePackedFixed32:function(s,r){r.length&&this.writeMessage(s,aw,r)},writePackedSFixed32:function(s,r){r.length&&this.writeMessage(s,lw,r)},writePackedFixed64:function(s,r){r.length&&this.writeMessage(s,uw,r)},writePackedSFixed64:function(s,r){r.length&&this.writeMessage(s,cw,r)},writeBytesField:function(s,r){this.writeTag(s,On.Bytes),this.writeBytes(r)},writeFixed32Field:function(s,r){this.writeTag(s,On.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(s,r){this.writeTag(s,On.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(s,r){this.writeTag(s,On.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(s,r){this.writeTag(s,On.Fixed64),this.writeSFixed64(r)},writeVarintField:function(s,r){this.writeTag(s,On.Varint),this.writeVarint(r)},writeSVarintField:function(s,r){this.writeTag(s,On.Varint),this.writeSVarint(r)},writeStringField:function(s,r){this.writeTag(s,On.Bytes),this.writeString(r)},writeFloatField:function(s,r){this.writeTag(s,On.Fixed32),this.writeFloat(r)},writeDoubleField:function(s,r){this.writeTag(s,On.Fixed64),this.writeDouble(r)},writeBooleanField:function(s,r){this.writeVarintField(s,!!r)}};var Og=b(Hy);const Fg=3;function hw(s,r,l){s===1&&l.readMessage(pw,r)}function pw(s,r,l){if(s===3){const{id:f,bitmap:m,width:v,height:x,left:I,top:S,advance:M}=l.readMessage(fw,{});r.push({id:f,bitmap:new Fp({width:v+2*Fg,height:x+2*Fg},m),metrics:{width:v,height:x,left:I,top:S,advance:M}})}}function fw(s,r,l){s===1?r.id=l.readVarint():s===2?r.bitmap=l.readBytes():s===3?r.width=l.readVarint():s===4?r.height=l.readVarint():s===5?r.left=l.readSVarint():s===6?r.top=l.readSVarint():s===7&&(r.advance=l.readVarint())}const t0=Fg;function e0(s){let r=0,l=0;for(const x of s)r+=x.w*x.h,l=Math.max(l,x.w);s.sort((x,I)=>I.h-x.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),l),h:1/0}];let m=0,v=0;for(const x of s)for(let I=f.length-1;I>=0;I--){const S=f[I];if(!(x.w>S.w||x.h>S.h)){if(x.x=S.x,x.y=S.y,v=Math.max(v,x.y+x.h),m=Math.max(m,x.x+x.w),x.w===S.w&&x.h===S.h){const M=f.pop();I=0&&f>=r&&Kd[this.text.charCodeAt(f)];f--)l--;this.text=this.text.substring(r,l),this.sectionIndex=this.sectionIndex.slice(r,l)}substring(r,l){const f=new oh;return f.text=this.text.substring(r,l),f.sectionIndex=this.sectionIndex.slice(r,l),f.sections=this.sections,f}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((r,l)=>Math.max(r,this.sections[l].scale),0)}addTextSection(r,l){this.text+=r.text,this.sections.push(Hp.forText(r.scale,r.fontStack||l));const f=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Yd(s,r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y){const it=oh.fromFeature(s,m);let at;N===p.ah.vertical&&it.verticalizePunctuation();const{processBidirectionalText:bt,processStyledBidirectionalText:ct}=sl;if(bt&&it.sections.length===1){at=[];const Vt=bt(it.toString(),Vg(it,M,v,r,f,G,j));for(const ue of Vt){const ve=new oh;ve.text=ue,ve.sections=it.sections;for(let le=0;le0&&dl>Io&&(Io=dl)}else{const ss=ve[hn.fontStack],So=ss&&ss[Lr];if(So&&So.rect)oa=So.rect,Cs=So.metrics;else{const dl=ue[hn.fontStack],Qp=dl&&dl[Lr];if(!Qp)continue;Cs=Qp.metrics}Yi=(Hi-hn.scale)*ji}Ts?(Vt.verticalizable=!0,Hr.push({glyph:Lr,imageName:sa,x:Jn,y:ei+Yi,vertical:Ts,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Xr,metrics:Cs,rect:oa}),Jn+=fl*hn.scale+Le):(Hr.push({glyph:Lr,imageName:sa,x:Jn,y:ei+Yi,vertical:Ts,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Xr,metrics:Cs,rect:oa}),Jn+=Cs.advance*hn.scale+Le)}Hr.length!==0&&(Zi=Math.max(Jn-Le,Zi),gw(Hr,0,Hr.length-1,ao,Io)),Jn=0;const Eo=Qt*Hi+Io;co.lineOffset=Math.max(Io,Wr),ei+=Eo,Uo=Math.max(Eo,Uo),++Fi}var dr;const Tr=ei-Wp,{horizontalAlign:lo,verticalAlign:uo}=Ug(_e);(function(Wi,Hi,Wr,co,Hr,Io,Eo,Xi,hn){const Xr=(Hi-Wr)*Hr;let Lr=0;Lr=Io!==Eo?-Xi*co-Wp:(-co*hn+.5)*Eo;for(const Yi of Wi)for(const Cs of Yi.positionedGlyphs)Cs.x+=Xr,Cs.y+=Lr})(Vt.positionedLines,ao,lo,uo,Zi,Uo,Qt,Tr,oe.length),Vt.top+=-uo*Tr,Vt.bottom=Vt.top+Tr,Vt.left+=-lo*Zi,Vt.right=Vt.left+Zi}(Ot,r,l,f,at,x,I,S,N,M,F,Y),!function(Vt){for(const ue of Vt)if(ue.positionedGlyphs.length!==0)return!1;return!0}(_t)&&Ot}const Kd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},dw={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 i0(s,r,l,f,m,v){if(r.imageName){const x=f[r.imageName];return x?x.displaySize[0]*r.scale*ji/v+m:0}{const x=l[r.fontStack],I=x&&x[s];return I?I.metrics.advance*r.scale+m:0}}function r0(s,r,l,f){const m=Math.pow(s-r,2);return f?s=0;let D=0;for(let F=0;Fx.id),this.index=r.index,this.pixelRatio=r.pixelRatio,this.sourceLayerIndex=r.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=wg([]),this.placementViewportMatrix=wg([]);const l=this.layers[0]._unevaluatedLayout._values;this.textSizeData=l0(this.zoom,l["text-size"]),this.iconSizeData=l0(this.zoom,l["icon-size"]);const f=this.layers[0].layout,m=f.get("symbol-sort-key"),v=f.get("symbol-z-order");this.canOverlap=Gg(f,"text-overlap","text-allow-overlap")!=="never"||Gg(f,"icon-overlap","icon-allow-overlap")!=="never"||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(x=>p.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=r.sourceID}createArrays(){this.text=new jg(new rr(this.layers,this.zoom,r=>/^text/.test(r))),this.icon=new jg(new rr(this.layers,this.zoom,r=>/^icon/.test(r))),this.glyphOffsetArray=new E,this.lineVertexArray=new C,this.symbolInstances=new y,this.textAnchorOffsets=new A}calculateGlyphDependencies(r,l,f,m,v){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),D=S.value.kind!=="constant"||!!S.value.value||Object.keys(S.parameters).length>0,N=v.get("symbol-sort-key");if(this.features=[],!M&&!D)return;const F=l.iconDependencies,G=l.glyphDependencies,j=l.availableImages,Y=new Xn(this.zoom);for(const{feature:it,id:at,index:bt,sourceLayerIndex:ct}of r){const _t=m._featureFilter.needGeometry,Ot=hl(it,_t);if(!m._featureFilter.filter(Y,Ot,f))continue;let Vt,ue;if(_t||(Ot.geometry=cl(it)),M){const le=m.getValueAndResolveTokens("text-field",Ot,f,j),oe=vo.factory(le);xw(oe)&&(this.hasRTLText=!0),(!this.hasRTLText||sl.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&sl.isParsed())&&(Vt=ew(oe,m,Ot))}if(D){const le=m.getValueAndResolveTokens("icon-image",Ot,f,j);ue=le instanceof Fo?le:Fo.fromString(le)}if(!Vt&&!ue)continue;const ve=this.sortFeaturesByKey?N.evaluate(Ot,{},f):void 0;if(this.features.push({id:at,text:Vt,icon:ue,index:bt,sourceLayerIndex:ct,geometry:Ot.geometry,properties:it.properties,type:yw[it.type],sortKey:ve}),ue&&(F[ue.name]=!0),Vt){const le=x.evaluate(Ot,{},f).join(","),oe=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(p.ah.vertical)>=0;for(const Qt of Vt.sections)if(Qt.image)F[Qt.image.name]=!0;else{const _e=qc(Vt.toString()),$t=Qt.fontStack||le,jt=G[$t]=G[$t]||{};this.calculateGlyphDependencies(Qt.text,jt,oe,this.allowVerticalPlacement,_e)}}}v.get("symbol-placement")==="line"&&(this.features=function(it){const at={},bt={},ct=[];let _t=0;function Ot(le){ct.push(it[le]),_t++}function Vt(le,oe,Qt){const _e=bt[le];return delete bt[le],bt[oe]=_e,ct[_e].geometry[0].pop(),ct[_e].geometry[0]=ct[_e].geometry[0].concat(Qt[0]),_e}function ue(le,oe,Qt){const _e=at[oe];return delete at[oe],at[le]=_e,ct[_e].geometry[0].shift(),ct[_e].geometry[0]=Qt[0].concat(ct[_e].geometry[0]),_e}function ve(le,oe,Qt){const _e=Qt?oe[0][oe[0].length-1]:oe[0][0];return`${le}:${_e.x}:${_e.y}`}for(let le=0;lele.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((it,at)=>it.sortKey-at.sortKey)}update(r,l,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(r,l,this.layers,f),this.icon.programConfigurations.updatePaintArrays(r,l,this.layers,f))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(r){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(r),this.iconCollisionBox.upload(r)),this.text.upload(r,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(r,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(r,l){const f=this.lineVertexArray.length;if(r.segment!==void 0){let m=r.dist(l[r.segment+1]),v=r.dist(l[r.segment]);const x={};for(let I=r.segment+1;I=0;I--)x[I]={x:l[I].x,y:l[I].y,tileUnitDistanceFromAnchor:v},I>0&&(v+=l[I-1].dist(l[I]));for(let I=0;I0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(r,l){const f=r.placedSymbolArray.get(l),m=f.vertexStartIndex+4*f.numGlyphs;for(let v=f.vertexStartIndex;vm[I]-m[S]||v[S]-v[I]),x}addToSortKeyRanges(r,l){const f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===l?f.symbolInstanceEnd=r+1:this.sortKeyRanges.push({sortKey:l,symbolInstanceStart:r,symbolInstanceEnd:r+1})}sortFeatures(r){if(this.sortFeaturesByY&&this.sortedAngle!==r&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(r),this.sortedAngle=r,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const l of this.symbolInstanceIndexes){const f=this.symbolInstances.get(l);this.featureSortOrder.push(f.featureIndex),[f.rightJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.leftJustifiedTextSymbolIndex].forEach((m,v,x)=>{m>=0&&x.indexOf(m)===v&&this.addIndicesForPlacedSymbol(this.text,m)}),f.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,f.verticalPlacedTextSymbolIndex),f.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.placedIconSymbolIndex),f.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let u0,c0;de("SymbolBucket",sh,{omit:["layers","collisionBoxArray","features","compareText"]}),sh.MAX_GLYPHS=65535,sh.addDynamicAttributes=qg;var Wg={get paint(){return c0=c0||new qr({"icon-opacity":new ke(Mt.paint_symbol["icon-opacity"]),"icon-color":new ke(Mt.paint_symbol["icon-color"]),"icon-halo-color":new ke(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new ke(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ke(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new be(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new be(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new ke(Mt.paint_symbol["text-opacity"]),"text-color":new ke(Mt.paint_symbol["text-color"],{runtimeType:yi,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new ke(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new ke(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new ke(Mt.paint_symbol["text-halo-blur"]),"text-translate":new be(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new be(Mt.paint_symbol["text-translate-anchor"])})},get layout(){return u0=u0||new qr({"symbol-placement":new be(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new be(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new be(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ke(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new be(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new be(Mt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new be(Mt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new be(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new be(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new be(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new ke(Mt.layout_symbol["icon-size"]),"icon-text-fit":new be(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new be(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new ke(Mt.layout_symbol["icon-image"]),"icon-rotate":new ke(Mt.layout_symbol["icon-rotate"]),"icon-padding":new ke(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new be(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new ke(Mt.layout_symbol["icon-offset"]),"icon-anchor":new ke(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new be(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new be(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new be(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new ke(Mt.layout_symbol["text-field"]),"text-font":new ke(Mt.layout_symbol["text-font"]),"text-size":new ke(Mt.layout_symbol["text-size"]),"text-max-width":new ke(Mt.layout_symbol["text-max-width"]),"text-line-height":new be(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new ke(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new ke(Mt.layout_symbol["text-justify"]),"text-radial-offset":new ke(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new be(Mt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ke(Mt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ke(Mt.layout_symbol["text-anchor"]),"text-max-angle":new be(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new be(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new ke(Mt.layout_symbol["text-rotate"]),"text-padding":new be(Mt.layout_symbol["text-padding"]),"text-keep-upright":new be(Mt.layout_symbol["text-keep-upright"]),"text-transform":new ke(Mt.layout_symbol["text-transform"]),"text-offset":new ke(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new be(Mt.layout_symbol["text-allow-overlap"]),"text-overlap":new be(Mt.layout_symbol["text-overlap"]),"text-ignore-placement":new be(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new be(Mt.layout_symbol["text-optional"])})}};class h0{constructor(r){if(r.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=r.property.overrides?r.property.overrides.runtimeType:Ni,this.defaultValue=r}evaluate(r){if(r.formattedSection){const l=this.defaultValue.property.overrides;if(l&&l.hasOverride(r.formattedSection))return l.getOverride(r.formattedSection)}return r.feature&&r.featureState?this.defaultValue.evaluate(r.feature,r.featureState):this.defaultValue.property.specification.default}eachChild(r){this.defaultValue.isConstant()||r(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}de("FormatSectionOverride",h0,{omit:["defaultValue"]});class Qd extends is{constructor(r){super(r,Wg)}recalculate(r,l){if(super.recalculate(r,l),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 f=this.layout.get("text-writing-mode");if(f){const m=[];for(const v of f)m.indexOf(v)<0&&m.push(v);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(r,l,f,m){const v=this.layout.get(r).evaluate(l,{},f,m),x=this._unevaluatedLayout._values[r];return x.isDataDriven()||Un(x.value)||!v?v:function(I,S){return S.replace(/{([^{}]+)}/g,(M,D)=>I&&D in I?String(I[D]):"")}(l.properties,v)}createBucket(r){return new sh(r)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const r of Wg.paint.overridableProperties){if(!Qd.hasPaintOverride(this.layout,r))continue;const l=this.paint.get(r),f=new h0(l),m=new Hn(f,l.property.specification);let v=null;v=l.value.kind==="constant"||l.value.kind==="source"?new kc("source",m):new cp("composite",m,l.value.zoomStops),this.paint._values[r]=new ns(l.property,v,l.parameters)}}_handleOverridablePaintPropertyUpdate(r,l,f){return!(!this.layout||l.isDataDriven()||f.isDataDriven())&&Qd.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,l){const f=r.get("text-field"),m=Wg.paint.properties[l];let v=!1;const x=I=>{for(const S of I)if(m.overrides&&m.overrides.hasOverride(S))return void(v=!0)};if(f.value.kind==="constant"&&f.value.value instanceof vo)x(f.value.value.sections);else if(f.value.kind==="source"){const I=M=>{v||(M instanceof Ea&&Oi(M.value)===Ii?x(M.value.sections):M instanceof Mc?x(M.sections):M.eachChild(I))},S=f.value;S._styleExpression&&I(S._styleExpression.expression)}return v}}let p0;var bw={get paint(){return p0=p0||new qr({"background-color":new be(Mt.paint_background["background-color"]),"background-pattern":new bp(Mt.paint_background["background-pattern"]),"background-opacity":new be(Mt.paint_background["background-opacity"])})}};class ww extends is{constructor(r){super(r,bw)}}let f0;var Iw={get paint(){return f0=f0||new qr({"raster-opacity":new be(Mt.paint_raster["raster-opacity"]),"raster-hue-rotate":new be(Mt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new be(Mt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new be(Mt.paint_raster["raster-brightness-max"]),"raster-saturation":new be(Mt.paint_raster["raster-saturation"]),"raster-contrast":new be(Mt.paint_raster["raster-contrast"]),"raster-resampling":new be(Mt.paint_raster["raster-resampling"]),"raster-fade-duration":new be(Mt.paint_raster["raster-fade-duration"])})}};class Ew extends is{constructor(r){super(r,Iw)}}class Sw extends is{constructor(r){super(r,{}),this.onAdd=l=>{this.implementation.onAdd&&this.implementation.onAdd(l,l.painter.context.gl)},this.onRemove=l=>{this.implementation.onRemove&&this.implementation.onRemove(l,l.painter.context.gl)},this.implementation=r}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 Cw{constructor(r){this._methodToThrottle=r,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 Hg=63710088e-1;class Kl{constructor(r,l){if(isNaN(r)||isNaN(l))throw new Error(`Invalid LngLat object: (${r}, ${l})`);if(this.lng=+r,this.lat=+l,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Kl(vt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(r){const l=Math.PI/180,f=this.lat*l,m=r.lat*l,v=Math.sin(f)*Math.sin(m)+Math.cos(f)*Math.cos(m)*Math.cos((r.lng-this.lng)*l);return Hg*Math.acos(Math.min(v,1))}static convert(r){if(r instanceof Kl)return r;if(Array.isArray(r)&&(r.length===2||r.length===3))return new Kl(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&typeof r=="object"&&r!==null)return new Kl(Number("lng"in r?r.lng:r.lon),Number(r.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 d0=2*Math.PI*Hg;function m0(s){return d0*Math.cos(s*Math.PI/180)}function g0(s){return(180+s)/360}function _0(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function y0(s,r){return s/m0(r)}function Xg(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class $d{constructor(r,l,f=0){this.x=+r,this.y=+l,this.z=+f}static fromLngLat(r,l=0){const f=Kl.convert(r);return new $d(g0(f.lng),_0(f.lat),y0(l,f.lat))}toLngLat(){return new Kl(360*this.x-180,Xg(this.y))}toAltitude(){return this.z*m0(Xg(this.y))}meterInMercatorCoordinateUnits(){return 1/d0*(r=Xg(this.y),1/Math.cos(r*Math.PI/180));var r}}function v0(s,r,l){var f=2*Math.PI*6378137/256/Math.pow(2,l);return[s*f-2*Math.PI*6378137/2,r*f-2*Math.PI*6378137/2]}class Yg{constructor(r,l,f){if(r<0||r>25||f<0||f>=Math.pow(2,r)||l<0||l>=Math.pow(2,r))throw new Error(`x=${l}, y=${f}, z=${r} outside of bounds. 0<=x<${Math.pow(2,r)}, 0<=y<${Math.pow(2,r)} 0<=z<=25 `);this.z=r,this.x=l,this.y=f,this.key=Yp(0,r,r,l,f)}equals(r){return this.z===r.z&&this.x===r.x&&this.y===r.y}url(r,l,f){const m=(x=this.y,I=this.z,S=v0(256*(v=this.x),256*(x=Math.pow(2,I)-x-1),I),M=v0(256*(v+1),256*(x+1),I),S[0]+","+S[1]+","+M[0]+","+M[1]);var v,x,I,S,M;const D=function(N,F,G){let j,Y="";for(let it=N;it>0;it--)j=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,m)}isChildOf(r){const l=this.z-r.z;return l>0&&r.x===this.x>>l&&r.y===this.y>>l}getTilePoint(r){const l=Math.pow(2,this.z);return new P((r.x*l-this.x)*vi,(r.y*l-this.y)*vi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class x0{constructor(r,l){this.wrap=r,this.canonical=l,this.key=Yp(r,l.z,l.z,l.x,l.y)}}class os{constructor(r,l,f,m,v){if(r= z; overscaledZ = ${r}; z = ${f}`);this.overscaledZ=r,this.wrap=l,this.canonical=new Yg(f,+m,+v),this.key=Yp(l,r,f,m,v)}clone(){return new os(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(r){return this.overscaledZ===r.overscaledZ&&this.wrap===r.wrap&&this.canonical.equals(r.canonical)}scaledTo(r){if(r>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${r}; overscaledZ = ${this.overscaledZ}`);const l=this.canonical.z-r;return r>this.canonical.z?new os(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new os(r,this.wrap,r,this.canonical.x>>l,this.canonical.y>>l)}calculateScaledKey(r,l){if(r>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${r}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-r;return r>this.canonical.z?Yp(this.wrap*+l,r,this.canonical.z,this.canonical.x,this.canonical.y):Yp(this.wrap*+l,r,r,this.canonical.x>>f,this.canonical.y>>f)}isChildOf(r){if(r.wrap!==this.wrap)return!1;const l=this.canonical.z-r.canonical.z;return r.overscaledZ===0||r.overscaledZ>l&&r.canonical.y===this.canonical.y>>l}children(r){if(this.overscaledZ>=r)return[new os(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const l=this.canonical.z+1,f=2*this.canonical.x,m=2*this.canonical.y;return[new os(l,this.wrap,l,f,m),new os(l,this.wrap,l,f+1,m),new os(l,this.wrap,l,f,m+1),new os(l,this.wrap,l,f+1,m+1)]}isLessThan(r){return this.wrapr.wrap)&&(this.overscaledZr.overscaledZ)&&(this.canonical.xr.canonical.x)&&this.canonical.ythis.max&&(this.max=N),N=this.dim+1||l<-1||l>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(l+1)*this.stride+(r+1)}unpack(r,l,f){return r*this.redFactor+l*this.greenFactor+f*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(r,l,f){if(this.dim!==r.dim)throw new Error("dem dimension mismatch");let m=l*this.dim,v=l*this.dim+this.dim,x=f*this.dim,I=f*this.dim+this.dim;switch(l){case-1:m=v-1;break;case 1:v=m+1}switch(f){case-1:x=I-1;break;case 1:I=x+1}const S=-l*this.dim,M=-f*this.dim;for(let D=x;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${r} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[r]}}class I0{constructor(r,l,f,m,v){this.type="Feature",this._vectorTileFeature=r,r._z=l,r._x=f,r._y=m,this.properties=r.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(r){this._geometry=r}toJSON(){const r={geometry:this.geometry};for(const l in this)l!=="_geometry"&&l!=="_vectorTileFeature"&&(r[l]=this[l]);return r}}class E0{constructor(r,l){this.tileID=r,this.x=r.canonical.x,this.y=r.canonical.y,this.z=r.canonical.z,this.grid=new ol(vi,16,0),this.grid3D=new ol(vi,16,0),this.featureIndexArray=new z,this.promoteId=l}insert(r,l,f,m,v,x){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,m,v);const S=x?this.grid3D:this.grid;for(let M=0;M=0&&N[3]>=0&&S.insert(I,N[0],N[1],N[2],N[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Hl.VectorTile(new Og(this.rawTileData)).layers,this.sourceLayerCoder=new w0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(r,l,f,m){this.loadVTLayers();const v=r.params||{},x=vi/r.tileSize/r.scale,I=zc(v.filter),S=r.queryGeometry,M=r.queryPadding*x,D=C0(S),N=this.grid.query(D.minX-M,D.minY-M,D.maxX+M,D.maxY+M),F=C0(r.cameraQueryGeometry),G=this.grid3D.query(F.minX-M,F.minY-M,F.maxX+M,F.maxY+M,(it,at,bt,ct)=>function(_t,Ot,Vt,ue,ve){for(const oe of _t)if(Ot<=oe.x&&Vt<=oe.y&&ue>=oe.x&&ve>=oe.y)return!0;const le=[new P(Ot,Vt),new P(Ot,ve),new P(ue,ve),new P(ue,Vt)];if(_t.length>2){for(const oe of le)if($c(_t,oe))return!0}for(let oe=0;oe<_t.length-1;oe++)if(rb(_t[oe],_t[oe+1],le))return!0;return!1}(r.cameraQueryGeometry,it-M,at-M,bt+M,ct+M));for(const it of G)N.push(it);N.sort(Tw);const j={};let Y;for(let it=0;it(ct||(ct=cl(_t)),Ot.queryIntersectsFeature(S,_t,Vt,ct,this.z,r.transform,x,r.pixelPosMatrix)))}return j}loadMatchingFeature(r,l,f,m,v,x,I,S,M,D,N){const F=this.bucketLayerIDs[l];if(x&&!function(it,at){for(let bt=0;bt=0)return!0;return!1}(x,F))return;const G=this.sourceLayerCoder.decode(f),j=this.vtLayers[G].feature(m);if(v.needGeometry){const it=hl(j,!0);if(!v.filter(new Xn(this.tileID.overscaledZ),it,this.tileID.canonical))return}else if(!v.filter(new Xn(this.tileID.overscaledZ),j))return;const Y=this.getId(j,G);for(let it=0;it{const I=r instanceof Nu?r.get(x):null;return I&&I.evaluate?I.evaluate(l,f,m):I})}function C0(s){let r=1/0,l=1/0,f=-1/0,m=-1/0;for(const v of s)r=Math.min(r,v.x),l=Math.min(l,v.y),f=Math.max(f,v.x),m=Math.max(m,v.y);return{minX:r,minY:l,maxX:f,maxY:m}}function Tw(s,r){return r-s}function T0(s,r,l,f,m){const v=[];for(let x=0;x=f&&N.x>=f||(D.x>=f?D=new P(f,D.y+(f-D.x)/(N.x-D.x)*(N.y-D.y))._round():N.x>=f&&(N=new P(f,D.y+(f-D.x)/(N.x-D.x)*(N.y-D.y))._round()),D.y>=m&&N.y>=m||(D.y>=m?D=new P(D.x+(m-D.y)/(N.y-D.y)*(N.x-D.x),m)._round():N.y>=m&&(N=new P(D.x+(m-D.y)/(N.y-D.y)*(N.x-D.x),m)._round()),S&&D.equals(S[S.length-1])||(S=[D],v.push(S)),S.push(N)))))}}return v}de("FeatureIndex",E0,{omit:["rawTileData","sourceLayerCoder"]});class Jl extends P{constructor(r,l,f,m){super(r,l),this.angle=f,m!==void 0&&(this.segment=m)}clone(){return new Jl(this.x,this.y,this.angle,this.segment)}}function L0(s,r,l,f,m){if(r.segment===void 0||l===0)return!0;let v=r,x=r.segment+1,I=0;for(;I>-l/2;){if(x--,x<0)return!1;I-=s[x].dist(v),v=s[x]}I+=s[x].dist(s[x+1]),x++;const S=[];let M=0;for(;If;)M-=S.shift().angleDelta;if(M>m)return!1;x++,I+=D.dist(N)}return!0}function P0(s){let r=0;for(let l=0;lM){const j=(M-S)/G,Y=Ur.number(N.x,F.x,j),it=Ur.number(N.y,F.y,j),at=new Jl(Y,it,F.angleTo(N),D);return at._round(),!x||L0(s,at,I,x,r)?at:void 0}S+=G}}function Pw(s,r,l,f,m,v,x,I,S){const M=M0(f,v,x),D=A0(f,m),N=D*x,F=s[0].x===0||s[0].x===S||s[0].y===0||s[0].y===S;return r-N=0&&_t=0&&Ot=0&&F+M<=D){const Vt=new Jl(_t,Ot,bt,j);Vt._round(),f&&!L0(s,Vt,v,f,m)||G.push(Vt)}}N+=at}return I||G.length||x||(G=k0(s,N/2,l,f,m,v,x,!0,S)),G}de("Anchor",Jl);const ah=wo;function D0(s,r,l,f){const m=[],v=s.image,x=v.pixelRatio,I=v.paddedRect.w-2*ah,S=v.paddedRect.h-2*ah,M=s.right-s.left,D=s.bottom-s.top,N=v.stretchX||[[0,I]],F=v.stretchY||[[0,S]],G=(Qt,_e)=>Qt+_e[1]-_e[0],j=N.reduce(G,0),Y=F.reduce(G,0),it=I-j,at=S-Y;let bt=0,ct=j,_t=0,Ot=Y,Vt=0,ue=it,ve=0,le=at;if(v.content&&f){const Qt=v.content;bt=tm(N,0,Qt[0]),_t=tm(F,0,Qt[1]),ct=tm(N,Qt[0],Qt[2]),Ot=tm(F,Qt[1],Qt[3]),Vt=Qt[0]-bt,ve=Qt[1]-_t,ue=Qt[2]-Qt[0]-ct,le=Qt[3]-Qt[1]-Ot}const oe=(Qt,_e,$t,jt)=>{const Le=em(Qt.stretch-bt,ct,M,s.left),we=nm(Qt.fixed-Vt,ue,Qt.stretch,j),$e=em(_e.stretch-_t,Ot,D,s.top),Jn=nm(_e.fixed-ve,le,_e.stretch,Y),ei=em($t.stretch-bt,ct,M,s.left),Zi=nm($t.fixed-Vt,ue,$t.stretch,j),Uo=em(jt.stretch-_t,Ot,D,s.top),ao=nm(jt.fixed-ve,le,jt.stretch,Y),Fi=new P(Le,$e),dr=new P(ei,$e),Tr=new P(ei,Uo),lo=new P(Le,Uo),uo=new P(we/x,Jn/x),Wi=new P(Zi/x,ao/x),Hi=r*Math.PI/180;if(Hi){const Hr=Math.sin(Hi),Io=Math.cos(Hi),Eo=[Io,-Hr,Hr,Io];Fi._matMult(Eo),dr._matMult(Eo),lo._matMult(Eo),Tr._matMult(Eo)}const Wr=Qt.stretch+Qt.fixed,co=_e.stretch+_e.fixed;return{tl:Fi,tr:dr,bl:lo,br:Tr,tex:{x:v.paddedRect.x+ah+Wr,y:v.paddedRect.y+ah+co,w:$t.stretch+$t.fixed-Wr,h:jt.stretch+jt.fixed-co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:uo,pixelOffsetBR:Wi,minFontScaleX:ue/x/M,minFontScaleY:le/x/D,isSDF:l}};if(f&&(v.stretchX||v.stretchY)){const Qt=R0(N,it,j),_e=R0(F,at,Y);for(let $t=0;$t0&&(j=Math.max(10,j),this.circleDiameter=j)}else{let N=x.top*I-S[0],F=x.bottom*I+S[2],G=x.left*I-S[3],j=x.right*I+S[1];const Y=x.collisionPadding;if(Y&&(G-=Y[0]*I,N-=Y[1]*I,j+=Y[2]*I,F+=Y[3]*I),D){const it=new P(G,N),at=new P(j,N),bt=new P(G,F),ct=new P(j,F),_t=D*Math.PI/180;it._rotate(_t),at._rotate(_t),bt._rotate(_t),ct._rotate(_t),G=Math.min(it.x,at.x,bt.x,ct.x),j=Math.max(it.x,at.x,bt.x,ct.x),N=Math.min(it.y,at.y,bt.y,ct.y),F=Math.max(it.y,at.y,bt.y,ct.y)}r.emplaceBack(l.x,l.y,G,N,j,F,f,m,v)}this.boxEndIndex=r.length}}class Mw{constructor(r=[],l=Aw){if(this.data=r,this.length=this.data.length,this.compare=l,this.length>0)for(let f=(this.length>>1)-1;f>=0;f--)this._down(f)}push(r){this.data.push(r),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const r=this.data[0],l=this.data.pop();return this.length--,this.length>0&&(this.data[0]=l,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:l,compare:f}=this,m=l[r];for(;r>0;){const v=r-1>>1,x=l[v];if(f(m,x)>=0)break;l[r]=x,r=v}l[r]=m}_down(r){const{data:l,compare:f}=this,m=this.length>>1,v=l[r];for(;r=0)break;l[r]=I,r=x}l[r]=v}}function Aw(s,r){return sr?1:0}function kw(s,r=1,l=!1){let f=1/0,m=1/0,v=-1/0,x=-1/0;const I=s[0];for(let G=0;Gv)&&(v=j.x),(!G||j.y>x)&&(x=j.y)}const S=Math.min(v-f,x-m);let M=S/2;const D=new Mw([],Dw);if(S===0)return new P(f,m);for(let G=f;GN.d||!N.d)&&(N=G,l&&console.log("found best %d after %d probes",Math.round(1e4*G.d)/1e4,F)),G.max-N.d<=r||(M=G.h/2,D.push(new lh(G.p.x-M,G.p.y-M,M,s)),D.push(new lh(G.p.x+M,G.p.y-M,M,s)),D.push(new lh(G.p.x-M,G.p.y+M,M,s)),D.push(new lh(G.p.x+M,G.p.y+M,M,s)),F+=4)}return l&&(console.log(`num probes: ${F}`),console.log(`best distance: ${N.d}`)),N.p}function Dw(s,r){return r.max-s.max}function lh(s,r,l,f){this.p=new P(s,r),this.h=l,this.d=function(m,v){let x=!1,I=1/0;for(let S=0;Sm.y!=j.y>m.y&&m.x<(j.x-G.x)*(m.y-G.y)/(j.y-G.y)+G.x&&(x=!x),I=Math.min(I,_y(m,G,j))}}return(x?1:-1)*Math.sqrt(I)}(this.p,f),this.max=this.d+this.h*Math.SQRT2}var Cr;p.ap=void 0,(Cr=p.ap||(p.ap={}))[Cr.center=1]="center",Cr[Cr.left=2]="left",Cr[Cr.right=3]="right",Cr[Cr.top=4]="top",Cr[Cr.bottom=5]="bottom",Cr[Cr["top-left"]=6]="top-left",Cr[Cr["top-right"]=7]="top-right",Cr[Cr["bottom-left"]=8]="bottom-left",Cr[Cr["bottom-right"]=9]="bottom-right";const Ql=7,Kg=Number.POSITIVE_INFINITY;function N0(s,r){return r[1]!==Kg?function(l,f,m){let v=0,x=0;switch(f=Math.abs(f),m=Math.abs(m),l){case"top-right":case"top-left":case"top":x=m-Ql;break;case"bottom-right":case"bottom-left":case"bottom":x=-m+Ql}switch(l){case"top-right":case"bottom-right":case"right":v=-f;break;case"top-left":case"bottom-left":case"left":v=f}return[v,x]}(s,r[0],r[1]):function(l,f){let m=0,v=0;f<0&&(f=0);const x=f/Math.SQRT2;switch(l){case"top-right":case"top-left":v=x-Ql;break;case"bottom-right":case"bottom-left":v=-x+Ql;break;case"bottom":v=-f+Ql;break;case"top":v=f-Ql}switch(l){case"top-right":case"bottom-right":m=-x;break;case"top-left":case"bottom-left":m=x;break;case"left":m=f;break;case"right":m=-f}return[m,v]}(s,r[0])}function z0(s,r,l){var f;const m=s.layout,v=(f=m.get("text-variable-anchor-offset"))===null||f===void 0?void 0:f.evaluate(r,{},l);if(v){const I=v.values,S=[];for(let M=0;MF*ji);D.startsWith("top")?N[1]-=Ql:D.startsWith("bottom")&&(N[1]+=Ql),S[M+1]=N}return new Oo(S)}const x=m.get("text-variable-anchor");if(x){let I;I=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(r,{},l)*ji,Kg]:m.get("text-offset").evaluate(r,{},l).map(M=>M*ji);const S=[];for(const M of x)S.push(M,N0(M,I));return new Oo(S)}return null}function Jg(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Rw(s,r,l,f,m,v,x,I,S,M,D){let N=v.textMaxSize.evaluate(r,{});N===void 0&&(N=x);const F=s.layers[0].layout,G=F.get("icon-offset").evaluate(r,{},D),j=F0(l.horizontal),Y=x/24,it=s.tilePixelRatio*Y,at=s.tilePixelRatio*N/24,bt=s.tilePixelRatio*I,ct=s.tilePixelRatio*F.get("symbol-spacing"),_t=F.get("text-padding")*s.tilePixelRatio,Ot=function(jt,Le,we,$e=1){const Jn=jt.get("icon-padding").evaluate(Le,{},we),ei=Jn&&Jn.values;return[ei[0]*$e,ei[1]*$e,ei[2]*$e,ei[3]*$e]}(F,r,D,s.tilePixelRatio),Vt=F.get("text-max-angle")/180*Math.PI,ue=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",ve=F.get("icon-rotation-alignment")==="map"&&F.get("symbol-placement")!=="point",le=F.get("symbol-placement"),oe=ct/2,Qt=F.get("icon-text-fit");let _e;f&&Qt!=="none"&&(s.allowVerticalPlacement&&l.vertical&&(_e=a0(f,l.vertical,Qt,F.get("icon-text-fit-padding"),G,Y)),j&&(f=a0(f,j,Qt,F.get("icon-text-fit-padding"),G,Y)));const $t=(jt,Le)=>{Le.x<0||Le.x>=vi||Le.y<0||Le.y>=vi||function(we,$e,Jn,ei,Zi,Uo,ao,Fi,dr,Tr,lo,uo,Wi,Hi,Wr,co,Hr,Io,Eo,Xi,hn,Xr,Lr,Yi,Cs){const oa=we.addToLineVertexArray($e,Jn);let sa,fl,Ts,ss,So=0,dl=0,Qp=0,G0=0,o_=-1,s_=-1;const ml={};let q0=zn("");if(we.allowVerticalPlacement&&ei.vertical){const Yr=Fi.layout.get("text-rotate").evaluate(hn,{},Yi)+90;Ts=new im(dr,$e,Tr,lo,uo,ei.vertical,Wi,Hi,Wr,Yr),ao&&(ss=new im(dr,$e,Tr,lo,uo,ao,Hr,Io,Wr,Yr))}if(Zi){const Yr=Fi.layout.get("icon-rotate").evaluate(hn,{}),as=Fi.layout.get("icon-text-fit")!=="none",Gu=D0(Zi,Yr,Lr,as),la=ao?D0(ao,Yr,Lr,as):void 0;fl=new im(dr,$e,Tr,lo,uo,Zi,Hr,Io,!1,Yr),So=4*Gu.length;const qu=we.iconSizeData;let ka=null;qu.kind==="source"?(ka=[Aa*Fi.layout.get("icon-size").evaluate(hn,{})],ka[0]>Yl&&ie(`${we.layerIds[0]}: Value for "icon-size" is >= ${Xp}. Reduce your "icon-size".`)):qu.kind==="composite"&&(ka=[Aa*Xr.compositeIconSizes[0].evaluate(hn,{},Yi),Aa*Xr.compositeIconSizes[1].evaluate(hn,{},Yi)],(ka[0]>Yl||ka[1]>Yl)&&ie(`${we.layerIds[0]}: Value for "icon-size" is >= ${Xp}. Reduce your "icon-size".`)),we.addSymbols(we.icon,Gu,ka,Xi,Eo,hn,p.ah.none,$e,oa.lineStartIndex,oa.lineLength,-1,Yi),o_=we.icon.placedSymbolArray.length-1,la&&(dl=4*la.length,we.addSymbols(we.icon,la,ka,Xi,Eo,hn,p.ah.vertical,$e,oa.lineStartIndex,oa.lineLength,-1,Yi),s_=we.icon.placedSymbolArray.length-1)}const j0=Object.keys(ei.horizontal);for(const Yr of j0){const as=ei.horizontal[Yr];if(!sa){q0=zn(as.text);const la=Fi.layout.get("text-rotate").evaluate(hn,{},Yi);sa=new im(dr,$e,Tr,lo,uo,as,Wi,Hi,Wr,la)}const Gu=as.positionedLines.length===1;if(Qp+=O0(we,$e,as,Uo,Fi,Wr,hn,co,oa,ei.vertical?p.ah.horizontal:p.ah.horizontalOnly,Gu?j0:[Yr],ml,o_,Xr,Yi),Gu)break}ei.vertical&&(G0+=O0(we,$e,ei.vertical,Uo,Fi,Wr,hn,co,oa,p.ah.vertical,["vertical"],ml,s_,Xr,Yi));const Ow=sa?sa.boxStartIndex:we.collisionBoxArray.length,Fw=sa?sa.boxEndIndex:we.collisionBoxArray.length,Bw=Ts?Ts.boxStartIndex:we.collisionBoxArray.length,Vw=Ts?Ts.boxEndIndex:we.collisionBoxArray.length,Uw=fl?fl.boxStartIndex:we.collisionBoxArray.length,Gw=fl?fl.boxEndIndex:we.collisionBoxArray.length,qw=ss?ss.boxStartIndex:we.collisionBoxArray.length,jw=ss?ss.boxEndIndex:we.collisionBoxArray.length;let aa=-1;const om=(Yr,as)=>Yr&&Yr.circleDiameter?Math.max(Yr.circleDiameter,as):as;aa=om(sa,aa),aa=om(Ts,aa),aa=om(fl,aa),aa=om(ss,aa);const Z0=aa>-1?1:0;Z0&&(aa*=Cs/ji),we.glyphOffsetArray.length>=sh.MAX_GLYPHS&&ie("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),hn.sortKey!==void 0&&we.addToSortKeyRanges(we.symbolInstances.length,hn.sortKey);const Zw=z0(Fi,hn,Yi),[Ww,Hw]=function(Yr,as){const Gu=Yr.length,la=as==null?void 0:as.values;if((la==null?void 0:la.length)>0)for(let qu=0;qu=0?ml.right:-1,ml.center>=0?ml.center:-1,ml.left>=0?ml.left:-1,ml.vertical||-1,o_,s_,q0,Ow,Fw,Bw,Vw,Uw,Gw,qw,jw,Tr,Qp,G0,So,dl,Z0,0,Wi,aa,Ww,Hw)}(s,Le,jt,l,f,m,_e,s.layers[0],s.collisionBoxArray,r.index,r.sourceLayerIndex,s.index,it,[_t,_t,_t,_t],ue,S,bt,Ot,ve,G,r,v,M,D,x)};if(le==="line")for(const jt of T0(r.geometry,0,0,vi,vi)){const Le=Pw(jt,ct,Vt,l.vertical||j,f,24,at,s.overscaling,vi);for(const we of Le)j&&Nw(s,j.text,oe,we)||$t(jt,we)}else if(le==="line-center"){for(const jt of r.geometry)if(jt.length>1){const Le=Lw(jt,Vt,l.vertical||j,f,24,at);Le&&$t(jt,Le)}}else if(r.type==="Polygon")for(const jt of Pg(r.geometry,0)){const Le=kw(jt,16);$t(jt[0],new Jl(Le.x,Le.y,0))}else if(r.type==="LineString")for(const jt of r.geometry)$t(jt,new Jl(jt[0].x,jt[0].y,0));else if(r.type==="Point")for(const jt of r.geometry)for(const Le of jt)$t([Le],new Jl(Le.x,Le.y,0))}function O0(s,r,l,f,m,v,x,I,S,M,D,N,F,G,j){const Y=function(bt,ct,_t,Ot,Vt,ue,ve,le){const oe=Ot.layout.get("text-rotate").evaluate(ue,{})*Math.PI/180,Qt=[];for(const _e of ct.positionedLines)for(const $t of _e.positionedGlyphs){if(!$t.rect)continue;const jt=$t.rect||{};let Le=t0+1,we=!0,$e=1,Jn=0;const ei=(Vt||le)&&$t.vertical,Zi=$t.metrics.advance*$t.scale/2;if(le&&ct.verticalizable&&(Jn=_e.lineOffset/2-($t.imageName?-(ji-$t.metrics.width*$t.scale)/2:($t.scale-1)*ji)),$t.imageName){const Xi=ve[$t.imageName];we=Xi.sdf,$e=Xi.pixelRatio,Le=wo/$e}const Uo=Vt?[$t.x+Zi,$t.y]:[0,0];let ao=Vt?[0,0]:[$t.x+Zi+_t[0],$t.y+_t[1]-Jn],Fi=[0,0];ei&&(Fi=ao,ao=[0,0]);const dr=$t.metrics.isDoubleResolution?2:1,Tr=($t.metrics.left-Le)*$t.scale-Zi+ao[0],lo=(-$t.metrics.top-Le)*$t.scale+ao[1],uo=Tr+jt.w/dr*$t.scale/$e,Wi=lo+jt.h/dr*$t.scale/$e,Hi=new P(Tr,lo),Wr=new P(uo,lo),co=new P(Tr,Wi),Hr=new P(uo,Wi);if(ei){const Xi=new P(-Zi,Zi-Wp),hn=-Math.PI/2,Xr=ji/2-Zi,Lr=new P(5-Wp-Xr,-($t.imageName?Xr:0)),Yi=new P(...Fi);Hi._rotateAround(hn,Xi)._add(Lr)._add(Yi),Wr._rotateAround(hn,Xi)._add(Lr)._add(Yi),co._rotateAround(hn,Xi)._add(Lr)._add(Yi),Hr._rotateAround(hn,Xi)._add(Lr)._add(Yi)}if(oe){const Xi=Math.sin(oe),hn=Math.cos(oe),Xr=[hn,-Xi,Xi,hn];Hi._matMult(Xr),Wr._matMult(Xr),co._matMult(Xr),Hr._matMult(Xr)}const Io=new P(0,0),Eo=new P(0,0);Qt.push({tl:Hi,tr:Wr,bl:co,br:Hr,tex:jt,writingMode:ct.writingMode,glyphOffset:Uo,sectionIndex:$t.sectionIndex,isSDF:we,pixelOffsetTL:Io,pixelOffsetBR:Eo,minFontScaleX:0,minFontScaleY:0})}return Qt}(0,l,I,m,v,x,f,s.allowVerticalPlacement),it=s.textSizeData;let at=null;it.kind==="source"?(at=[Aa*m.layout.get("text-size").evaluate(x,{})],at[0]>Yl&&ie(`${s.layerIds[0]}: Value for "text-size" is >= ${Xp}. Reduce your "text-size".`)):it.kind==="composite"&&(at=[Aa*G.compositeTextSizes[0].evaluate(x,{},j),Aa*G.compositeTextSizes[1].evaluate(x,{},j)],(at[0]>Yl||at[1]>Yl)&&ie(`${s.layerIds[0]}: Value for "text-size" is >= ${Xp}. Reduce your "text-size".`)),s.addSymbols(s.text,Y,at,I,v,x,M,r,S.lineStartIndex,S.lineLength,F,j);for(const bt of D)N[bt]=s.text.placedSymbolArray.length-1;return 4*Y.length}function F0(s){for(const r in s)return s[r];return null}function Nw(s,r,l,f){const m=s.compareText;if(r in m){const v=m[r];for(let x=v.length-1;x>=0;x--)if(f.dist(v[x])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const v=B0[15&f];if(!v)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(r,2,1),[I]=new Uint32Array(r,4,1);return new Qg(I,x,v,r)}constructor(r,l=64,f=Float64Array,m){if(isNaN(r)||r<0)throw new Error(`Unpexpected numItems value: ${r}.`);this.numItems=+r,this.nodeSize=Math.min(Math.max(+l,2),65535),this.ArrayType=f,this.IndexArrayType=r<65536?Uint16Array:Uint32Array;const v=B0.indexOf(this.ArrayType),x=2*r*this.ArrayType.BYTES_PER_ELEMENT,I=r*this.IndexArrayType.BYTES_PER_ELEMENT,S=(8-I%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${f}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+I+S,2*r),this._pos=2*r,this._finished=!0):(this.data=new ArrayBuffer(8+x+I+S),this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+I+S,2*r),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=l,new Uint32Array(this.data,4,1)[0]=r)}add(r,l){const f=this._pos>>1;return this.ids[f]=f,this.coords[this._pos++]=r,this.coords[this._pos++]=l,f}finish(){const r=this._pos>>1;if(r!==this.numItems)throw new Error(`Added ${r} items when expected ${this.numItems}.`);return $g(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(r,l,f,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:x,nodeSize:I}=this,S=[0,v.length-1,0],M=[];for(;S.length;){const D=S.pop()||0,N=S.pop()||0,F=S.pop()||0;if(N-F<=I){for(let it=F;it<=N;it++){const at=x[2*it],bt=x[2*it+1];at>=r&&at<=f&&bt>=l&&bt<=m&&M.push(v[it])}continue}const G=F+N>>1,j=x[2*G],Y=x[2*G+1];j>=r&&j<=f&&Y>=l&&Y<=m&&M.push(v[G]),(D===0?r<=j:l<=Y)&&(S.push(F),S.push(G-1),S.push(1-D)),(D===0?f>=j:m>=Y)&&(S.push(G+1),S.push(N),S.push(1-D))}return M}within(r,l,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:v,nodeSize:x}=this,I=[0,m.length-1,0],S=[],M=f*f;for(;I.length;){const D=I.pop()||0,N=I.pop()||0,F=I.pop()||0;if(N-F<=x){for(let it=F;it<=N;it++)U0(v[2*it],v[2*it+1],r,l)<=M&&S.push(m[it]);continue}const G=F+N>>1,j=v[2*G],Y=v[2*G+1];U0(j,Y,r,l)<=M&&S.push(m[G]),(D===0?r-f<=j:l-f<=Y)&&(I.push(F),I.push(G-1),I.push(1-D)),(D===0?r+f>=j:l+f>=Y)&&(I.push(G+1),I.push(N),I.push(1-D))}return S}}function $g(s,r,l,f,m,v){if(m-f<=l)return;const x=f+m>>1;V0(s,r,x,f,m,v),$g(s,r,l,f,x-1,1-v),$g(s,r,l,x+1,m,1-v)}function V0(s,r,l,f,m,v){for(;m>f;){if(m-f>600){const M=m-f+1,D=l-f+1,N=Math.log(M),F=.5*Math.exp(2*N/3),G=.5*Math.sqrt(N*F*(M-F)/M)*(D-M/2<0?-1:1);V0(s,r,l,Math.max(f,Math.floor(l-D*F/M+G)),Math.min(m,Math.floor(l+(M-D)*F/M+G)),v)}const x=r[2*l+v];let I=f,S=m;for(Kp(s,r,f,l),r[2*m+v]>x&&Kp(s,r,f,m);Ix;)S--}r[2*f+v]===x?Kp(s,r,f,S):(S++,Kp(s,r,S,m)),S<=l&&(f=S+1),l<=S&&(m=S-1)}}function Kp(s,r,l,f){t_(s,l,f),t_(r,2*l,2*f),t_(r,2*l+1,2*f+1)}function t_(s,r,l){const f=s[r];s[r]=s[l],s[l]=f}function U0(s,r,l,f){const m=s-l,v=r-f;return m*m+v*v}var e_;p.bc=void 0,(e_=p.bc||(p.bc={})).create="create",e_.load="load",e_.fullLoad="fullLoad";let rm=null,Jp=[];const n_=1e3/60,i_="loadTime",r_="fullLoadTime",zw={mark(s){performance.mark(s)},frame(s){const r=s;rm!=null&&Jp.push(r-rm),rm=r},clearMetrics(){rm=null,Jp=[],performance.clearMeasures(i_),performance.clearMeasures(r_);for(const s in p.bc)performance.clearMarks(p.bc[s])},getPerformanceMetrics(){performance.measure(i_,p.bc.create,p.bc.load),performance.measure(r_,p.bc.create,p.bc.fullLoad);const s=performance.getEntriesByName(i_)[0].duration,r=performance.getEntriesByName(r_)[0].duration,l=Jp.length,f=1/(Jp.reduce((v,x)=>v+x,0)/l/1e3),m=Jp.filter(v=>v>n_).reduce((v,x)=>v+(x-n_)/n_,0);return{loadTime:s,fullLoadTime:r,fps:f,percentDroppedFrames:m/(l+m)*100,totalFrames:l}}};p.$=Ae,p.A=th,p.B=function(s){if(Te==null){const r=s.navigator?s.navigator.userAgent:null;Te=!!s.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return Te},p.C=class{constructor(s,r){this.target=s,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Cw(()=>this.process()),this.subscription=function(l,f,m,v){return l.addEventListener(f,m,!1),{unsubscribe:()=>{l.removeEventListener(f,m,!1)}}}(this.target,"message",l=>this.receive(l)),this.globalScope=ge(self)?s:window}registerMessageHandler(s,r){this.messageHandlers[s]=r}sendAsync(s,r){return new Promise((l,f)=>{const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[m]={resolve:l,reject:f},r&&r.signal.addEventListener("abort",()=>{delete this.resolveRejects[m];const I={id:m,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(I)},{once:!0});const v=[],x=Object.assign(Object.assign({},s),{id:m,sourceMapId:this.mapId,origin:location.origin,data:Gl(s.data,v)});this.target.postMessage(x,{transfer:v})})}receive(s){const r=s.data,l=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!==location.origin||r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type===""){delete this.tasks[l];const f=this.abortControllers[l];return delete this.abortControllers[l],void(f&&f.abort())}if(ge(self)||r.mustQueue)return this.tasks[l]=r,this.taskQueue.push(l),void this.invoker.trigger();this.processTask(l,r)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),r=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(s,r)}processTask(s,r){return u(this,void 0,void 0,function*(){if(r.type===""){const m=this.resolveRejects[s];return delete this.resolveRejects[s],m?void(r.error?m.reject(Du(r.error)):m.resolve(Du(r.data))):void 0}if(!this.messageHandlers[r.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const l=Du(r.data),f=new AbortController;this.abortControllers[s]=f;try{const m=yield this.messageHandlers[r.type](r.sourceMapId,l,f);this.completeTask(s,null,m)}catch(m){this.completeTask(s,m)}})}completeTask(s,r,l){const f=[];delete this.abortControllers[s];const m={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:r?Gl(r):null,data:Gl(l,f)};this.target.postMessage(m,{transfer:f})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},p.D=be,p.E=Ri,p.F=function(){var s=new th(16);return th!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},p.G=ri,p.H=function(s,r,l){var f,m,v,x,I,S,M,D,N,F,G,j,Y=l[0],it=l[1],at=l[2];return r===s?(s[12]=r[0]*Y+r[4]*it+r[8]*at+r[12],s[13]=r[1]*Y+r[5]*it+r[9]*at+r[13],s[14]=r[2]*Y+r[6]*it+r[10]*at+r[14],s[15]=r[3]*Y+r[7]*it+r[11]*at+r[15]):(m=r[1],v=r[2],x=r[3],I=r[4],S=r[5],M=r[6],D=r[7],N=r[8],F=r[9],G=r[10],j=r[11],s[0]=f=r[0],s[1]=m,s[2]=v,s[3]=x,s[4]=I,s[5]=S,s[6]=M,s[7]=D,s[8]=N,s[9]=F,s[10]=G,s[11]=j,s[12]=f*Y+I*it+N*at+r[12],s[13]=m*Y+S*it+F*at+r[13],s[14]=v*Y+M*it+G*at+r[14],s[15]=x*Y+D*it+j*at+r[15]),s},p.I=Bg,p.J=function(s,r,l){var f=l[0],m=l[1],v=l[2];return s[0]=r[0]*f,s[1]=r[1]*f,s[2]=r[2]*f,s[3]=r[3]*f,s[4]=r[4]*m,s[5]=r[5]*m,s[6]=r[6]*m,s[7]=r[7]*m,s[8]=r[8]*v,s[9]=r[9]*v,s[10]=r[10]*v,s[11]=r[11]*v,s[12]=r[12],s[13]=r[13],s[14]=r[14],s[15]=r[15],s},p.K=by,p.L=function(s,r){const l={};for(let f=0;f{const r=window.document.createElement("video");return r.muted=!0,new Promise(l=>{r.onloadstart=()=>{l(r)};for(const f of s){const m=window.document.createElement("source");br(f)||(r.crossOrigin="Anonymous"),m.src=f,r.appendChild(m)}})},p.a3=function(){return St++},p.a4=o,p.a5=sh,p.a6=zc,p.a7=hl,p.a8=Xn,p.a9=I0,p.aA=mt,p.aB=function(s,r){if(!s)return[{command:"setStyle",args:[r]}];let l=[];try{if(!Qe(s.version,r.version))return[{command:"setStyle",args:[r]}];Qe(s.center,r.center)||l.push({command:"setCenter",args:[r.center]}),Qe(s.zoom,r.zoom)||l.push({command:"setZoom",args:[r.zoom]}),Qe(s.bearing,r.bearing)||l.push({command:"setBearing",args:[r.bearing]}),Qe(s.pitch,r.pitch)||l.push({command:"setPitch",args:[r.pitch]}),Qe(s.sprite,r.sprite)||l.push({command:"setSprite",args:[r.sprite]}),Qe(s.glyphs,r.glyphs)||l.push({command:"setGlyphs",args:[r.glyphs]}),Qe(s.transition,r.transition)||l.push({command:"setTransition",args:[r.transition]}),Qe(s.light,r.light)||l.push({command:"setLight",args:[r.light]}),Qe(s.terrain,r.terrain)||l.push({command:"setTerrain",args:[r.terrain]}),Qe(s.sky,r.sky)||l.push({command:"setSky",args:[r.sky]});const f={},m=[];(function(x,I,S,M){let D;for(D in I=I||{},x=x||{})Object.prototype.hasOwnProperty.call(x,D)&&(Object.prototype.hasOwnProperty.call(I,D)||$o(D,S,M));for(D in I)Object.prototype.hasOwnProperty.call(I,D)&&(Object.prototype.hasOwnProperty.call(x,D)?Qe(x[D],I[D])||(x[D].type==="geojson"&&I[D].type==="geojson"&&Ia(x,I,D)?$n(S,{command:"setGeoJSONSourceData",args:[D,I[D].data]}):ws(D,I,S,M)):fr(D,I,S))})(s.sources,r.sources,m,f);const v=[];s.layers&&s.layers.forEach(x=>{"source"in x&&f[x.source]?l.push({command:"removeLayer",args:[x.id]}):v.push(x)}),l=l.concat(m),function(x,I,S){I=I||[];const M=(x=x||[]).map(Ja),D=I.map(Ja),N=x.reduce(ts,{}),F=I.reduce(ts,{}),G=M.slice(),j=Object.create(null);let Y,it,at,bt,ct;for(let _t=0,Ot=0;_t@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(l,f,m,v)=>{const x=m||v;return r[f]=!x||x.toLowerCase(),""}),r["max-age"]){const l=parseInt(r["max-age"],10);isNaN(l)?delete r["max-age"]:r["max-age"]=l}return r},p.ab=function(s,r){const l=[];for(const f in s)f in r||l.push(f);return l},p.ac=ht,p.ad=function(s,r,l){var f=Math.sin(l),m=Math.cos(l),v=r[0],x=r[1],I=r[2],S=r[3],M=r[4],D=r[5],N=r[6],F=r[7];return r!==s&&(s[8]=r[8],s[9]=r[9],s[10]=r[10],s[11]=r[11],s[12]=r[12],s[13]=r[13],s[14]=r[14],s[15]=r[15]),s[0]=v*m+M*f,s[1]=x*m+D*f,s[2]=I*m+N*f,s[3]=S*m+F*f,s[4]=M*m-v*f,s[5]=D*m-x*f,s[6]=N*m-I*f,s[7]=F*m-S*f,s},p.ae=function(s){var r=new th(16);return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[8]=s[8],r[9]=s[9],r[10]=s[10],r[11]=s[11],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15],r},p.af=Gd,p.ag=function(s,r){let l=0,f=0;if(s.kind==="constant")f=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:m,minZoom:v,maxZoom:x}=s,I=m?ht(Ir.interpolationFactor(m,r,v,x),0,1):0;s.kind==="camera"?f=Ur.number(s.minSize,s.maxSize,I):l=I}return{uSizeT:l,uSize:f}},p.ai=function(s,{uSize:r,uSizeT:l},{lowerSize:f,upperSize:m}){return s.kind==="source"?f/Aa:s.kind==="composite"?Ur.number(f/Aa,m/Aa,l):r},p.aj=qg,p.ak=function(s,r,l,f){const m=r.y-s.y,v=r.x-s.x,x=f.y-l.y,I=f.x-l.x,S=x*v-I*m;if(S===0)return null;const M=(I*(s.y-l.y)-x*(s.x-l.x))/S;return new P(s.x+M*v,s.y+M*m)},p.al=T0,p.am=Np,p.an=wg,p.ao=ji,p.aq=Gg,p.ar=function(s,r){var l=r[0],f=r[1],m=r[2],v=r[3],x=r[4],I=r[5],S=r[6],M=r[7],D=r[8],N=r[9],F=r[10],G=r[11],j=r[12],Y=r[13],it=r[14],at=r[15],bt=l*I-f*x,ct=l*S-m*x,_t=l*M-v*x,Ot=f*S-m*I,Vt=f*M-v*I,ue=m*M-v*S,ve=D*Y-N*j,le=D*it-F*j,oe=D*at-G*j,Qt=N*it-F*Y,_e=N*at-G*Y,$t=F*at-G*it,jt=bt*$t-ct*_e+_t*Qt+Ot*oe-Vt*le+ue*ve;return jt?(s[0]=(I*$t-S*_e+M*Qt)*(jt=1/jt),s[1]=(m*_e-f*$t-v*Qt)*jt,s[2]=(Y*ue-it*Vt+at*Ot)*jt,s[3]=(F*Vt-N*ue-G*Ot)*jt,s[4]=(S*oe-x*$t-M*le)*jt,s[5]=(l*$t-m*oe+v*le)*jt,s[6]=(it*_t-j*ue-at*ct)*jt,s[7]=(D*ue-F*_t+G*ct)*jt,s[8]=(x*_e-I*oe+M*ve)*jt,s[9]=(f*oe-l*_e-v*ve)*jt,s[10]=(j*Vt-Y*_t+at*bt)*jt,s[11]=(N*_t-D*Vt-G*bt)*jt,s[12]=(I*le-x*Qt-S*ve)*jt,s[13]=(l*Qt-f*le+m*ve)*jt,s[14]=(Y*ct-j*Ot-it*bt)*jt,s[15]=(D*Ot-N*ct+F*bt)*jt,s):null},p.as=Jg,p.at=Ug,p.au=Qg,p.av=function(){const s={},r=Mt.$version;for(const l in Mt.$root){const f=Mt.$root[l];if(f.required){let m=null;m=l==="version"?r:f.type==="array"?[]:{},m!=null&&(s[l]=m)}}return s},p.aw=Gc,p.ax=Ue,p.ay=function(s){s=s.slice();const r=Object.create(null);for(let l=0;ljt*ji)}let le=x?"center":l.get("text-justify").evaluate(M,{},s.canonical);const oe=l.get("symbol-placement"),Qt=oe==="point"?l.get("text-max-width").evaluate(M,{},s.canonical)*ji:0,_e=()=>{s.bucket.allowVerticalPlacement&&qc(_t)&&(j.vertical=Yd(Y,s.glyphMap,s.glyphPositions,s.imagePositions,D,Qt,v,ue,"left",Vt,at,p.ah.vertical,!0,oe,F,N))};if(!x&&ve){const $t=new Set;if(le==="auto")for(let Le=0;Leu(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const r=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(r)}catch(l){throw new Error(`Could not load image because of ${l.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),p.e=gt,p.f=s=>new Promise((r,l)=>{const f=new Image;f.onload=()=>{r(f),URL.revokeObjectURL(f.src),f.onload=null,window.requestAnimationFrame(()=>{f.src=on})},f.onerror=()=>l(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 m=new Blob([new Uint8Array(s)],{type:"image/png"});f.src=s.byteLength?URL.createObjectURL(m):on}),p.g=Wn,p.h=(s,r)=>yn(gt(s,{type:"json"}),r),p.i=ge,p.j=Ie,p.k=Fe,p.l=(s,r)=>yn(gt(s,{type:"arrayBuffer"}),r),p.m=yn,p.n=function(s){return new Og(s).readFields(hw,[])},p.o=Fp,p.p=e0,p.q=qr,p.r=_p,p.s=br,p.t=Ld,p.u=ae,p.v=Mt,p.w=ie,p.x=Au,p.y=function([s,r,l]){return r+=90,r*=Math.PI/180,l*=Math.PI/180,{x:s*Math.cos(r)*Math.sin(l),y:s*Math.sin(r)*Math.sin(l),z:s*Math.cos(l)}},p.z=Ur}),a("worker",["./shared"],function(p){class u{constructor(O){this.keyCache={},O&&this.replace(O)}replace(O){this._layerConfigs={},this._layers={},this.update(O,[])}update(O,U){for(const $ of O){this._layerConfigs[$.id]=$;const ft=this._layers[$.id]=p.az($);ft._featureFilter=p.a6(ft.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of U)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const Z=p.bg(Object.values(this._layerConfigs),this.keyCache);for(const $ of Z){const ft=$.map(Rt=>this._layers[Rt.id]),H=ft[0];if(H.visibility==="none")continue;const dt=H.source||"";let lt=this.familiesBySource[dt];lt||(lt=this.familiesBySource[dt]={});const xt=H.sourceLayer||"_geojsonTileLayer";let At=lt[xt];At||(At=lt[xt]=[]),At.push(ft)}}}class b{constructor(O){const U={},Z=[];for(const dt in O){const lt=O[dt],xt=U[dt]={};for(const At in lt){const Rt=lt[+At];if(!Rt||Rt.bitmap.width===0||Rt.bitmap.height===0)continue;const Nt={x:0,y:0,w:Rt.bitmap.width+2,h:Rt.bitmap.height+2};Z.push(Nt),xt[At]={rect:Nt,metrics:Rt.metrics}}}const{w:$,h:ft}=p.p(Z),H=new p.o({width:$||1,height:ft||1});for(const dt in O){const lt=O[dt];for(const xt in lt){const At=lt[+xt];if(!At||At.bitmap.width===0||At.bitmap.height===0)continue;const Rt=U[dt][xt].rect;p.o.copy(At.bitmap,H,{x:0,y:0},{x:Rt.x+1,y:Rt.y+1},At.bitmap)}}this.image=H,this.positions=U}}p.bh("GlyphAtlas",b);class w{constructor(O){this.tileID=new p.Q(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.uid=O.uid,this.zoom=O.zoom,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=O.showCollisionBoxes,this.collectResourceTiming=!!O.collectResourceTiming,this.returnDependencies=!!O.returnDependencies,this.promoteId=O.promoteId,this.inFlightDependencies=[]}parse(O,U,Z,$){return p._(this,void 0,void 0,function*(){this.status="parsing",this.data=O,this.collisionBoxArray=new p.a4;const ft=new p.bi(Object.keys(O.layers).sort()),H=new p.bj(this.tileID,this.promoteId);H.bucketLayerIDs=[];const dt={},lt={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Z},xt=U.familiesBySource[this.source];for(const Ke in xt){const ui=O.layers[Ke];if(!ui)continue;ui.version===1&&p.w(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Vi=ft.encode(Ke),Vr=[];for(let no=0;no=nr.maxzoom||nr.visibility!=="none"&&(T(no,this.zoom,Z),(dt[nr.id]=nr.createBucket({index:H.bucketLayerIDs.length,layers:no,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Vi,sourceID:this.source})).populate(Vr,lt,this.tileID.canonical),H.bucketLayerIDs.push(no.map(Is=>Is.id)))}}const At=p.aE(lt.glyphDependencies,Ke=>Object.keys(Ke).map(Number));this.inFlightDependencies.forEach(Ke=>Ke==null?void 0:Ke.abort()),this.inFlightDependencies=[];let Rt=Promise.resolve({});if(Object.keys(At).length){const Ke=new AbortController;this.inFlightDependencies.push(Ke),Rt=$.sendAsync({type:"getGlyphs",data:{stacks:At,source:this.source,tileID:this.tileID,type:"glyphs"}},Ke)}const Nt=Object.keys(lt.iconDependencies);let xe=Promise.resolve({});if(Nt.length){const Ke=new AbortController;this.inFlightDependencies.push(Ke),xe=$.sendAsync({type:"getImages",data:{icons:Nt,source:this.source,tileID:this.tileID,type:"icons"}},Ke)}const Ee=Object.keys(lt.patternDependencies);let ze=Promise.resolve({});if(Ee.length){const Ke=new AbortController;this.inFlightDependencies.push(Ke),ze=$.sendAsync({type:"getImages",data:{icons:Ee,source:this.source,tileID:this.tileID,type:"patterns"}},Ke)}const[Be,fn,Nn]=yield Promise.all([Rt,xe,ze]),ti=new b(Be),zi=new p.bk(fn,Nn);for(const Ke in dt){const ui=dt[Ke];ui instanceof p.a5?(T(ui.layers,this.zoom,Z),p.bl({bucket:ui,glyphMap:Be,glyphPositions:ti.positions,imageMap:fn,imagePositions:zi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ui.hasPattern&&(ui instanceof p.bm||ui instanceof p.bn||ui instanceof p.bo)&&(T(ui.layers,this.zoom,Z),ui.addFeatures(lt,this.tileID.canonical,zi.patternPositions))}return this.status="done",{buckets:Object.values(dt).filter(Ke=>!Ke.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ti.image,imageAtlas:zi,glyphMap:this.returnDependencies?Be:null,iconMap:this.returnDependencies?fn:null,glyphPositions:this.returnDependencies?ti.positions:null}})}}function T(rt,O,U){const Z=new p.a8(O);for(const $ of rt)$.recalculate(Z,U)}class P{constructor(O,U,Z){this.actor=O,this.layerIndex=U,this.availableImages=Z,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(O,U){return p._(this,void 0,void 0,function*(){const Z=yield p.l(O.request,U);try{return{vectorTile:new p.bp.VectorTile(new p.bq(Z.data)),rawData:Z.data,cacheControl:Z.cacheControl,expires:Z.expires}}catch($){const ft=new Uint8Array(Z.data);let H=`Unable to parse the tile at ${O.request.url}, `;throw H+=ft[0]===31&&ft[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${$.messge}`,new Error(H)}})}loadTile(O){return p._(this,void 0,void 0,function*(){const U=O.uid,Z=!!(O&&O.request&&O.request.collectResourceTiming)&&new p.br(O.request),$=new w(O);this.loading[U]=$;const ft=new AbortController;$.abort=ft;try{const H=yield this.loadVectorTile(O,ft);if(delete this.loading[U],!H)return null;const dt=H.rawData,lt={};H.expires&&(lt.expires=H.expires),H.cacheControl&&(lt.cacheControl=H.cacheControl);const xt={};if(Z){const Rt=Z.finish();Rt&&(xt.resourceTiming=JSON.parse(JSON.stringify(Rt)))}$.vectorTile=H.vectorTile;const At=$.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[U]=$,this.fetching[U]={rawTileData:dt,cacheControl:lt,resourceTiming:xt};try{const Rt=yield At;return p.e({rawTileData:dt.slice(0)},Rt,lt,xt)}finally{delete this.fetching[U]}}catch(H){throw delete this.loading[U],$.status="done",this.loaded[U]=$,H}})}reloadTile(O){return p._(this,void 0,void 0,function*(){const U=O.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const Z=this.loaded[U];if(Z.showCollisionBoxes=O.showCollisionBoxes,Z.status==="parsing"){const $=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor);let ft;if(this.fetching[U]){const{rawTileData:H,cacheControl:dt,resourceTiming:lt}=this.fetching[U];delete this.fetching[U],ft=p.e({rawTileData:H.slice(0)},$,dt,lt)}else ft=$;return ft}if(Z.status==="done"&&Z.vectorTile)return Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(O){return p._(this,void 0,void 0,function*(){const U=this.loading,Z=O.uid;U&&U[Z]&&U[Z].abort&&(U[Z].abort.abort(),delete U[Z])})}removeTile(O){return p._(this,void 0,void 0,function*(){this.loaded&&this.loaded[O.uid]&&delete this.loaded[O.uid]})}}class k{constructor(){this.loaded={}}loadTile(O){return p._(this,void 0,void 0,function*(){const{uid:U,encoding:Z,rawImageData:$,redFactor:ft,greenFactor:H,blueFactor:dt,baseShift:lt}=O,xt=$.width+2,At=$.height+2,Rt=p.b($)?new p.R({width:xt,height:At},yield p.bs($,-1,-1,xt,At)):$,Nt=new p.bt(U,Rt,Z,ft,H,dt,lt);return this.loaded=this.loaded||{},this.loaded[U]=Nt,Nt})}removeTile(O){const U=this.loaded,Z=O.uid;U&&U[Z]&&delete U[Z]}}function B(rt,O){if(rt.length!==0){V(rt[0],O);for(var U=1;U=Math.abs(dt)?U-lt+dt:dt-lt+U,U=lt}U+Z>=0!=!!O&&rt.reverse()}var tt=p.bu(function rt(O,U){var Z,$=O&&O.type;if($==="FeatureCollection")for(Z=0;Z>31}function ee(rt,O){for(var U=rt.loadGeometry(),Z=rt.type,$=0,ft=0,H=U.length,dt=0;dtrt},on=Math.fround||(gn=new Float32Array(1),rt=>(gn[0]=+rt,gn[0]));var gn;const Re=3,Me=5,Rn=6;class qn{constructor(O){this.options=Object.assign(Object.create(Oe),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:U,minZoom:Z,maxZoom:$}=this.options;U&&console.time("total time");const ft=`prepare ${O.length} points`;U&&console.time(ft),this.points=O;const H=[];for(let lt=0;lt=Z;lt--){const xt=+Date.now();dt=this.trees[lt]=this._createTree(this._cluster(dt,lt)),U&&console.log("z%d: %d clusters in %dms",lt,dt.numItems,+Date.now()-xt)}return U&&console.timeEnd("total time"),this}getClusters(O,U){let Z=((O[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,O[1]));let ft=O[2]===180?180:((O[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,O[3]));if(O[2]-O[0]>=360)Z=-180,ft=180;else if(Z>ft){const Rt=this.getClusters([Z,$,180,H],U),Nt=this.getClusters([-180,$,ft,H],U);return Rt.concat(Nt)}const dt=this.trees[this._limitZoom(U)],lt=dt.range(ri(Z),Kt(H),ri(ft),Kt($)),xt=dt.data,At=[];for(const Rt of lt){const Nt=this.stride*Rt;At.push(xt[Nt+Me]>1?Zn(xt,Nt,this.clusterProps):this.points[xt[Nt+Re]])}return At}getChildren(O){const U=this._getOriginId(O),Z=this._getOriginZoom(O),$="No cluster with the specified id.",ft=this.trees[Z];if(!ft)throw new Error($);const H=ft.data;if(U*this.stride>=H.length)throw new Error($);const dt=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),lt=ft.within(H[U*this.stride],H[U*this.stride+1],dt),xt=[];for(const At of lt){const Rt=At*this.stride;H[Rt+4]===O&&xt.push(H[Rt+Me]>1?Zn(H,Rt,this.clusterProps):this.points[H[Rt+Re]])}if(xt.length===0)throw new Error($);return xt}getLeaves(O,U,Z){const $=[];return this._appendLeaves($,O,U=U||10,Z=Z||0,0),$}getTile(O,U,Z){const $=this.trees[this._limitZoom(O)],ft=Math.pow(2,O),{extent:H,radius:dt}=this.options,lt=dt/H,xt=(Z-lt)/ft,At=(Z+1+lt)/ft,Rt={features:[]};return this._addTileFeatures($.range((U-lt)/ft,xt,(U+1+lt)/ft,At),$.data,U,Z,ft,Rt),U===0&&this._addTileFeatures($.range(1-lt/ft,xt,1,At),$.data,ft,Z,ft,Rt),U===ft-1&&this._addTileFeatures($.range(0,xt,lt/ft,At),$.data,-1,Z,ft,Rt),Rt.features.length?Rt:null}getClusterExpansionZoom(O){let U=this._getOriginZoom(O)-1;for(;U<=this.options.maxZoom;){const Z=this.getChildren(O);if(U++,Z.length!==1)break;O=Z[0].properties.cluster_id}return U}_appendLeaves(O,U,Z,$,ft){const H=this.getChildren(U);for(const dt of H){const lt=dt.properties;if(lt&<.cluster?ft+lt.point_count<=$?ft+=lt.point_count:ft=this._appendLeaves(O,lt.cluster_id,Z,$,ft):ft<$?ft++:O.push(dt),O.length===Z)break}return ft}_createTree(O){const U=new p.au(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Z=0;Z1;let At,Rt,Nt;if(xt)At=Wn(U,lt,this.clusterProps),Rt=U[lt],Nt=U[lt+1];else{const ze=this.points[U[lt+Re]];At=ze.properties;const[Be,fn]=ze.geometry.coordinates;Rt=ri(Be),Nt=Kt(fn)}const xe={type:1,geometry:[[Math.round(this.options.extent*(Rt*ft-Z)),Math.round(this.options.extent*(Nt*ft-$))]],tags:At};let Ee;Ee=xt||this.options.generateId?U[lt+Re]:this.points[U[lt+Re]].id,Ee!==void 0&&(xe.id=Ee),H.features.push(xe)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,U){const{radius:Z,extent:$,reduce:ft,minPoints:H}=this.options,dt=Z/($*Math.pow(2,U)),lt=O.data,xt=[],At=this.stride;for(let Rt=0;RtU&&(Be+=lt[Nn+Me])}if(Be>ze&&Be>=H){let fn,Nn=Nt*ze,ti=xe*ze,zi=-1;const Ke=((Rt/At|0)<<5)+(U+1)+this.points.length;for(const ui of Ee){const Vi=ui*At;if(lt[Vi+2]<=U)continue;lt[Vi+2]=U;const Vr=lt[Vi+Me];Nn+=lt[Vi]*Vr,ti+=lt[Vi+1]*Vr,lt[Vi+4]=Ke,ft&&(fn||(fn=this._map(lt,Rt,!0),zi=this.clusterProps.length,this.clusterProps.push(fn)),ft(fn,this._map(lt,Vi)))}lt[Rt+4]=Ke,xt.push(Nn/Be,ti/Be,1/0,Ke,-1,Be),ft&&xt.push(zi)}else{for(let fn=0;fn1)for(const fn of Ee){const Nn=fn*At;if(!(lt[Nn+2]<=U)){lt[Nn+2]=U;for(let ti=0;ti>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,U,Z){if(O[U+Me]>1){const H=this.clusterProps[O[U+Rn]];return Z?Object.assign({},H):H}const $=this.points[O[U+Re]].properties,ft=this.options.map($);return Z&&ft===$?Object.assign({},ft):ft}}function Zn(rt,O,U){return{type:"Feature",id:rt[O+Re],properties:Wn(rt,O,U),geometry:{type:"Point",coordinates:[(Z=rt[O],360*(Z-.5)),Ue(rt[O+1])]}};var Z}function Wn(rt,O,U){const Z=rt[O+Me],$=Z>=1e4?`${Math.round(Z/1e3)}k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,ft=rt[O+Rn],H=ft===-1?{}:Object.assign({},U[ft]);return Object.assign(H,{cluster:!0,cluster_id:rt[O+Re],point_count:Z,point_count_abbreviated:$})}function ri(rt){return rt/360+.5}function Kt(rt){const O=Math.sin(rt*Math.PI/180),U=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return U<0?0:U>1?1:U}function Ue(rt){const O=(180-360*rt)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function yn(rt,O,U,Z){for(var $,ft=Z,H=U-O>>1,dt=U-O,lt=rt[O],xt=rt[O+1],At=rt[U],Rt=rt[U+1],Nt=O+3;Ntft)$=Nt,ft=xe;else if(xe===ft){var Ee=Math.abs(Nt-H);EeZ&&($-O>3&&yn(rt,O,$,Z),rt[$+2]=ft,U-$>3&&yn(rt,$,U,Z))}function br(rt,O,U,Z,$,ft){var H=$-U,dt=ft-Z;if(H!==0||dt!==0){var lt=((rt-U)*H+(O-Z)*dt)/(H*H+dt*dt);lt>1?(U=$,Z=ft):lt>0&&(U+=H*lt,Z+=dt*lt)}return(H=rt-U)*H+(dt=O-Z)*dt}function er(rt,O,U,Z){var $={id:rt===void 0?null:rt,type:O,geometry:U,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(ft){var H=ft.geometry,dt=ft.type;if(dt==="Point"||dt==="MultiPoint"||dt==="LineString")Gt(ft,H);else if(dt==="Polygon"||dt==="MultiLineString")for(var lt=0;lt0&&(H+=Z?($*xt-lt*ft)/2:Math.sqrt(Math.pow(lt-$,2)+Math.pow(xt-ft,2))),$=lt,ft=xt}var At=O.length-3;O[2]=1,yn(O,0,At,U),O[At+2]=1,O.size=Math.abs(H),O.start=0,O.end=O.size}function Mt(rt,O,U,Z){for(var $=0;$1?1:U}function Qe(rt,O,U,Z,$,ft,H,dt){if(Z/=O,ft>=(U/=O)&&H=Z)return null;for(var lt=[],xt=0;xt=U&&Ee=Z)){var ze=[];if(Nt==="Point"||Nt==="MultiPoint")$n(Rt,ze,U,Z,$);else if(Nt==="LineString")fr(Rt,ze,U,Z,$,!1,dt.lineMetrics);else if(Nt==="MultiLineString")ws(Rt,ze,U,Z,$,!1);else if(Nt==="Polygon")ws(Rt,ze,U,Z,$,!0);else if(Nt==="MultiPolygon")for(var Be=0;Be=U&&H<=Z&&(O.push(rt[ft]),O.push(rt[ft+1]),O.push(rt[ft+2]))}}function fr(rt,O,U,Z,$,ft,H){for(var dt,lt,xt=$o(rt),At=$===0?wr:Ja,Rt=rt.start,Nt=0;NtU&&(lt=At(xt,xe,Ee,Be,fn,U),H&&(xt.start=Rt+dt*lt)):Nn>Z?ti=U&&(lt=At(xt,xe,Ee,Be,fn,U),zi=!0),ti>Z&&Nn<=Z&&(lt=At(xt,xe,Ee,Be,fn,Z),zi=!0),!ft&&zi&&(H&&(xt.end=Rt+dt*lt),O.push(xt),xt=$o(rt)),H&&(Rt+=dt)}var Ke=rt.length-3;xe=rt[Ke],Ee=rt[Ke+1],ze=rt[Ke+2],(Nn=$===0?xe:Ee)>=U&&Nn<=Z&&Ia(xt,xe,Ee,ze),Ke=xt.length-3,ft&&Ke>=3&&(xt[Ke]!==xt[0]||xt[Ke+1]!==xt[1])&&Ia(xt,xt[0],xt[1],xt[2]),xt.length&&O.push(xt)}function $o(rt){var O=[];return O.size=rt.size,O.start=rt.start,O.end=rt.end,O}function ws(rt,O,U,Z,$,ft){for(var H=0;HH.maxX&&(H.maxX=At),Rt>H.maxY&&(H.maxY=Rt)}return H}function Ni(rt,O,U,Z){var $=O.geometry,ft=O.type,H=[];if(ft==="Point"||ft==="MultiPoint")for(var dt=0;dt<$.length;dt+=3)H.push($[dt]),H.push($[dt+1]),rt.numPoints++,rt.numSimplified++;else if(ft==="LineString")Jt(H,$,rt,U,!1,!1);else if(ft==="MultiLineString"||ft==="Polygon")for(dt=0;dt<$.length;dt++)Jt(H,$[dt],rt,U,ft==="Polygon",dt===0);else if(ft==="MultiPolygon")for(var lt=0;lt<$.length;lt++){var xt=$[lt];for(dt=0;dt0&&O.size<($?H:Z))U.numPoints+=O.length/3;else{for(var dt=[],lt=0;ltH)&&(U.numSimplified++,dt.push(O[lt]),dt.push(O[lt+1])),U.numPoints++;$&&function(xt,At){for(var Rt=0,Nt=0,xe=xt.length,Ee=xe-2;Nt0===At)for(Nt=0,xe=xt.length;Nt24)throw new Error("maxZoom should be in the 0-24 range");if(O.promoteId&&O.generateId)throw new Error("promoteId and generateId cannot be used together.");var Z=function($,ft){var H=[];if($.type==="FeatureCollection")for(var dt=0;dt<$.features.length;dt++)Fe(H,$.features[dt],ft,dt);else Fe(H,$.type==="Feature"?$:{geometry:$},ft);return H}(rt,O);this.tiles={},this.tileCoords=[],U&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",O.indexMaxZoom,O.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Z=function($,ft){var H=ft.buffer/ft.extent,dt=$,lt=Qe($,1,-1-H,H,0,-1,2,ft),xt=Qe($,1,1-H,2+H,0,-1,2,ft);return(lt||xt)&&(dt=Qe($,1,-H,1+H,0,-1,2,ft)||[],lt&&(dt=ts(lt,1).concat(dt)),xt&&(dt=dt.concat(ts(xt,-1)))),dt}(Z,O),Z.length&&this.splitTile(Z,0,0,0),U&&(Z.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function je(rt,O,U){return 32*((1<1&&console.time("creation"),Nt=this.tiles[Rt]=Qa(rt,O,U,Z,lt),this.tileCoords.push({z:O,x:U,y:Z}),xt)){xt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",O,U,Z,Nt.numFeatures,Nt.numPoints,Nt.numSimplified),console.timeEnd("creation"));var xe="z"+O;this.stats[xe]=(this.stats[xe]||0)+1,this.total++}if(Nt.source=rt,$){if(O===lt.maxZoom||O===$)continue;var Ee=1<<$-O;if(U!==Math.floor(ft/Ee)||Z!==Math.floor(H/Ee))continue}else if(O===lt.indexMaxZoom||Nt.numPoints<=lt.indexMaxPoints)continue;if(Nt.source=null,rt.length!==0){xt>1&&console.time("clipping");var ze,Be,fn,Nn,ti,zi,Ke=.5*lt.buffer/lt.extent,ui=.5-Ke,Vi=.5+Ke,Vr=1+Ke;ze=Be=fn=Nn=null,ti=Qe(rt,At,U-Ke,U+Vi,0,Nt.minX,Nt.maxX,lt),zi=Qe(rt,At,U+ui,U+Vr,0,Nt.minX,Nt.maxX,lt),rt=null,ti&&(ze=Qe(ti,At,Z-Ke,Z+Vi,1,Nt.minY,Nt.maxY,lt),Be=Qe(ti,At,Z+ui,Z+Vr,1,Nt.minY,Nt.maxY,lt),ti=null),zi&&(fn=Qe(zi,At,Z-Ke,Z+Vi,1,Nt.minY,Nt.maxY,lt),Nn=Qe(zi,At,Z+ui,Z+Vr,1,Nt.minY,Nt.maxY,lt),zi=null),xt>1&&console.timeEnd("clipping"),dt.push(ze||[],O+1,2*U,2*Z),dt.push(Be||[],O+1,2*U,2*Z+1),dt.push(fn||[],O+1,2*U+1,2*Z),dt.push(Nn||[],O+1,2*U+1,2*Z+1)}}},He.prototype.getTile=function(rt,O,U){var Z=this.options,$=Z.extent,ft=Z.debug;if(rt<0||rt>24)return null;var H=1<1&&console.log("drilling down to z%d-%d-%d",rt,O,U);for(var lt,xt=rt,At=O,Rt=U;!lt&&xt>0;)xt--,At=Math.floor(At/2),Rt=Math.floor(Rt/2),lt=this.tiles[je(xt,At,Rt)];return lt&<.source?(ft>1&&console.log("found parent tile z%d-%d-%d",xt,At,Rt),ft>1&&console.time("drilling down"),this.splitTile(lt.source,xt,At,Rt,rt,O,U),ft>1&&console.timeEnd("drilling down"),this.tiles[dt]?No(this.tiles[dt],$):null):null};class ea extends P{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(O,U){return p._(this,void 0,void 0,function*(){const Z=O.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const $=this._geoJSONIndex.getTile(Z.z,Z.x,Z.y);if(!$)return null;const ft=new class{constructor(dt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=p.W,this.length=dt.length,this._features=dt}feature(dt){return new class{constructor(lt){this._feature=lt,this.extent=p.W,this.type=lt.type,this.properties=lt.tags,"id"in lt&&!isNaN(lt.id)&&(this.id=parseInt(lt.id,10))}loadGeometry(){if(this._feature.type===1){const lt=[];for(const xt of this._feature.geometry)lt.push([new p.P(xt[0],xt[1])]);return lt}{const lt=[];for(const xt of this._feature.geometry){const At=[];for(const Rt of xt)At.push(new p.P(Rt[0],Rt[1]));lt.push(At)}return lt}}toGeoJSON(lt,xt,At){return ot.call(this,lt,xt,At)}}(this._features[dt])}}($.features);let H=Te(ft);return H.byteOffset===0&&H.byteLength===H.buffer.byteLength||(H=new Uint8Array(H)),{vectorTile:ft,rawData:H.buffer}})}loadData(O){var U;return p._(this,void 0,void 0,function*(){(U=this._pendingRequest)===null||U===void 0||U.abort();const Z=!!(O&&O.request&&O.request.collectResourceTiming)&&new p.br(O.request);this._pendingRequest=new AbortController;try{let $=yield this.loadGeoJSON(O,this._pendingRequest);if(delete this._pendingRequest,typeof $!="object")throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`);if(tt($,!0),O.filter){const H=p.bx(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(H.result==="error")throw new Error(H.value.map(lt=>`${lt.key}: ${lt.message}`).join(", "));$={type:"FeatureCollection",features:$.features.filter(lt=>H.value.evaluate({zoom:0},lt))}}this._geoJSONIndex=O.cluster?new qn(function({superclusterOptions:H,clusterProperties:dt}){if(!dt||!H)return H;const lt={},xt={},At={accumulated:null,zoom:0},Rt={properties:null},Nt=Object.keys(dt);for(const xe of Nt){const[Ee,ze]=dt[xe],Be=p.bx(ze),fn=p.bx(typeof Ee=="string"?[Ee,["accumulated"],["get",xe]]:Ee);lt[xe]=Be.value,xt[xe]=fn.value}return H.map=xe=>{Rt.properties=xe;const Ee={};for(const ze of Nt)Ee[ze]=lt[ze].evaluate(At,Rt);return Ee},H.reduce=(xe,Ee)=>{Rt.properties=Ee;for(const ze of Nt)At.accumulated=xe[ze],xe[ze]=xt[ze].evaluate(At,Rt)},H}(O)).load($.features):function(H,dt){return new He(H,dt)}($,O.geojsonVtOptions),this.loaded={};const ft={};if(Z){const H=Z.finish();H&&(ft.resourceTiming={},ft.resourceTiming[O.source]=JSON.parse(JSON.stringify(H)))}return ft}catch($){if(delete this._pendingRequest,p.by($))return{abandoned:!0};throw $}})}reloadTile(O){const U=this.loaded;return U&&U[O.uid]?super.reloadTile(O):this.loadTile(O)}loadGeoJSON(O,U){return p._(this,void 0,void 0,function*(){const{promoteId:Z}=O;if(O.request){const $=yield p.h(O.request,U);return this._dataUpdateable=zo($.data,Z)?Ge($.data,Z):void 0,$.data}if(typeof O.data=="string")try{const $=JSON.parse(O.data);return this._dataUpdateable=zo($,Z)?Ge($,Z):void 0,$}catch{throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`)}if(!O.dataDiff)throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${O.source}`);return function($,ft,H){var dt,lt,xt,At;if(ft.removeAll&&$.clear(),ft.remove)for(const Rt of ft.remove)$.delete(Rt);if(ft.add)for(const Rt of ft.add){const Nt=yi(Rt,H);Nt!=null&&$.set(Nt,Rt)}if(ft.update)for(const Rt of ft.update){let Nt=$.get(Rt.id);if(Nt==null)continue;const xe=!Rt.removeAllProperties&&(((dt=Rt.removeProperties)===null||dt===void 0?void 0:dt.length)>0||((lt=Rt.addOrUpdateProperties)===null||lt===void 0?void 0:lt.length)>0);if((Rt.newGeometry||Rt.removeAllProperties||xe)&&(Nt=Object.assign({},Nt),$.set(Rt.id,Nt),xe&&(Nt.properties=Object.assign({},Nt.properties))),Rt.newGeometry&&(Nt.geometry=Rt.newGeometry),Rt.removeAllProperties)Nt.properties={};else if(((xt=Rt.removeProperties)===null||xt===void 0?void 0:xt.length)>0)for(const Ee of Rt.removeProperties)Object.prototype.hasOwnProperty.call(Nt.properties,Ee)&&delete Nt.properties[Ee];if(((At=Rt.addOrUpdateProperties)===null||At===void 0?void 0:At.length)>0)for(const{key:Ee,value:ze}of Rt.addOrUpdateProperties)Nt.properties[Ee]=ze}}(this._dataUpdateable,O.dataDiff,Z),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(O){return p._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(O){return this._geoJSONIndex.getClusterExpansionZoom(O.clusterId)}getClusterChildren(O){return this._geoJSONIndex.getChildren(O.clusterId)}getClusterLeaves(O){return this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset)}}class Ii{constructor(O){this.self=O,this.actor=new p.C(O),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,Z)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=Z},this.self.addProtocol=p.be,this.self.removeProtocol=p.bf,this.self.registerRTLTextPlugin=U=>{if(p.bz.isParsed())throw new Error("RTL text plugin already registered.");p.bz.setMethods(U)},this.actor.registerMessageHandler("loadDEMTile",(U,Z)=>this._getDEMWorkerSource(U,Z.source).loadTile(Z)),this.actor.registerMessageHandler("removeDEMTile",(U,Z)=>p._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,Z.source).removeTile(Z)})),this.actor.registerMessageHandler("getClusterExpansionZoom",(U,Z)=>p._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterExpansionZoom(Z)})),this.actor.registerMessageHandler("getClusterChildren",(U,Z)=>p._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterChildren(Z)})),this.actor.registerMessageHandler("getClusterLeaves",(U,Z)=>p._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterLeaves(Z)})),this.actor.registerMessageHandler("loadData",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).loadData(Z)),this.actor.registerMessageHandler("loadTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).loadTile(Z)),this.actor.registerMessageHandler("reloadTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).reloadTile(Z)),this.actor.registerMessageHandler("abortTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).abortTile(Z)),this.actor.registerMessageHandler("removeTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).removeTile(Z)),this.actor.registerMessageHandler("removeSource",(U,Z)=>p._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][Z.type]||!this.workerSources[U][Z.type][Z.source])return;const $=this.workerSources[U][Z.type][Z.source];delete this.workerSources[U][Z.type][Z.source],$.removeSource!==void 0&&$.removeSource(Z)})),this.actor.registerMessageHandler("removeMap",U=>p._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("setReferrer",(U,Z)=>p._(this,void 0,void 0,function*(){this.referrer=Z})),this.actor.registerMessageHandler("syncRTLPluginState",(U,Z)=>this._syncRTLPluginState(U,Z)),this.actor.registerMessageHandler("importScript",(U,Z)=>p._(this,void 0,void 0,function*(){this.self.importScripts(Z)})),this.actor.registerMessageHandler("setImages",(U,Z)=>this._setImages(U,Z)),this.actor.registerMessageHandler("updateLayers",(U,Z)=>p._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(Z.layers,Z.removedIds)})),this.actor.registerMessageHandler("setLayers",(U,Z)=>p._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(Z)}))}_setImages(O,U){return p._(this,void 0,void 0,function*(){this.availableImages[O]=U;for(const Z in this.workerSources[O]){const $=this.workerSources[O][Z];for(const ft in $)$[ft].availableImages=U}})}_syncRTLPluginState(O,U){return p._(this,void 0,void 0,function*(){p.bz.setState(U);const Z=p.bz.getPluginURL();if(U.pluginStatus==="loaded"&&!p.bz.isParsed()&&Z!=null){this.self.importScripts(Z);const $=p.bz.isParsed();if($)return $;throw new Error(`RTL Text Plugin failed to import scripts from ${Z}`)}return!1})}_getAvailableImages(O){let U=this.availableImages[O];return U||(U=[]),U}_getLayerIndex(O){let U=this.layerIndexes[O];return U||(U=this.layerIndexes[O]=new u),U}_getWorkerSource(O,U,Z){if(this.workerSources[O]||(this.workerSources[O]={}),this.workerSources[O][U]||(this.workerSources[O][U]={}),!this.workerSources[O][U][Z]){const $={sendAsync:(ft,H)=>(ft.targetMapId=O,this.actor.sendAsync(ft,H))};switch(U){case"vector":this.workerSources[O][U][Z]=new P($,this._getLayerIndex(O),this._getAvailableImages(O));break;case"geojson":this.workerSources[O][U][Z]=new ea($,this._getLayerIndex(O),this._getAvailableImages(O));break;default:this.workerSources[O][U][Z]=new this.externalWorkerSourceTypes[U]($,this._getLayerIndex(O),this._getAvailableImages(O))}}return this.workerSources[O][U][Z]}_getDEMWorkerSource(O,U){return this.demWorkerSources[O]||(this.demWorkerSources[O]={}),this.demWorkerSources[O][U]||(this.demWorkerSources[O][U]=new k),this.demWorkerSources[O][U]}}return p.i(self)&&(self.worker=new Ii(self)),Ii}),a("index",["exports","./shared"],function(p,u){var b="4.1.0";let w,T;const P={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((o,h)=>{const d=requestAnimationFrame(o);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),h(u.c())})}),getImageData(_,o=0){return this.getImageCanvasContext(_).getImageData(-o,-o,_.width+2*o,_.height+2*o)},getImageCanvasContext(_){const o=window.document.createElement("canvas"),h=o.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return o.width=_.width,o.height=_.height,h.drawImage(_,0,0,_.width,_.height),h},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(T==null&&(T=matchMedia("(prefers-reduced-motion: reduce)")),T.matches)}};class k{static testProp(o){if(!k.docStyle)return o[0];for(let h=0;h{window.removeEventListener("click",k.suppressClickInternal,!0)},0)}static getScale(o){const h=o.getBoundingClientRect();return{x:h.width/o.offsetWidth||1,y:h.height/o.offsetHeight||1,boundingClientRect:h}}static getPoint(o,h,d){const g=h.boundingClientRect;return new u.P((d.clientX-g.left)/h.x-o.clientLeft,(d.clientY-g.top)/h.y-o.clientTop)}static mousePos(o,h){const d=k.getScale(o);return k.getPoint(o,d,h)}static touchPos(o,h){const d=[],g=k.getScale(o);for(let y=0;y{o=[],h=0,d=0,g={}},_.addThrottleControl=L=>{const A=d++;return g[A]=L,A},_.removeThrottleControl=L=>{delete g[L],E()},_.getImage=(L,A,R=!0)=>new Promise((z,q)=>{B.supported&&(L.headers||(L.headers={}),L.headers.accept="image/webp,*/*"),u.e(L,{type:"image"}),o.push({abortController:A,requestParameters:L,supportImageRefresh:R,state:"queued",onError:et=>{q(et)},onSuccess:et=>{z(et)}}),E()});const y=L=>u._(this,void 0,void 0,function*(){L.state="running";const{requestParameters:A,supportImageRefresh:R,onError:z,onSuccess:q,abortController:et}=L,Q=R===!1&&!u.i(self)&&!u.g(A.url)&&(!A.headers||Object.keys(A.headers).reduce((pt,Et)=>pt&&Et==="accept",!0));h++;const nt=Q?C(A,et):u.m(A,et);try{const pt=yield nt;delete L.abortController,L.state="completed",pt.data instanceof HTMLImageElement||u.b(pt.data)?q(pt):pt.data&&q({data:yield(K=pt.data,typeof createImageBitmap=="function"?u.d(K):u.f(K)),cacheControl:pt.cacheControl,expires:pt.expires})}catch(pt){delete L.abortController,z(pt)}finally{h--,E()}var K}),E=()=>{const L=(()=>{for(const A of Object.keys(g))if(g[A]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let A=h;A0;A++){const R=o.shift();R.abortController.signal.aborted?A--:y(R)}},C=(L,A)=>new Promise((R,z)=>{const q=new Image,et=L.url,Q=L.credentials;Q&&Q==="include"?q.crossOrigin="use-credentials":(Q&&Q==="same-origin"||!u.s(et))&&(q.crossOrigin="anonymous"),A.signal.addEventListener("abort",()=>{q.src="",z(u.c())}),q.fetchPriority="high",q.onload=()=>{q.onerror=q.onload=null,R({data:q})},q.onerror=()=>{q.onerror=q.onload=null,A.signal.aborted||z(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."))},q.src=et})}(X||(X={})),X.resetRequestQueue(),function(_){_.Glyphs="Glyphs",_.Image="Image",_.Source="Source",_.SpriteImage="SpriteImage",_.SpriteJSON="SpriteJSON",_.Style="Style",_.Tile="Tile",_.Unknown="Unknown"}(J||(J={}));class ht{constructor(o){this._transformRequestFn=o}transformRequest(o,h){return this._transformRequestFn&&this._transformRequestFn(o,h)||{url:o}}normalizeSpriteURL(o,h,d){const g=function(y){const E=y.match(vt);if(!E)throw new Error(`Unable to parse URL "${y}"`);return{protocol:E[1],authority:E[2],path:E[3]||"/",params:E[4]?E[4].split("&"):[]}}(o);return g.path+=`${h}${d}`,function(y){const E=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${E}`}(g)}setTransformRequest(o){this._transformRequestFn=o}}const vt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function gt(_){var o=new u.A(3);return o[0]=_[0],o[1]=_[1],o[2]=_[2],o}var St,It=function(_,o,h){return _[0]=o[0]-h[0],_[1]=o[1]-h[1],_[2]=o[2]-h[2],_};St=new u.A(3),u.A!=Float32Array&&(St[0]=0,St[1]=0,St[2]=0);var Ft=function(_){var o=_[0],h=_[1];return o*o+h*h};function mt(_){const o=[];if(typeof _=="string")o.push({id:"default",url:_});else if(_&&_.length>0){const h=[];for(const{id:d,url:g}of _){const y=`${d}${g}`;h.indexOf(y)===-1&&(h.push(y),o.push({id:d,url:g}))}}return o}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Ct{constructor(o,h,d,g){this.context=o,this.format=d,this.texture=o.gl.createTexture(),this.update(h,g)}update(o,h,d){const{width:g,height:y}=o,E=!(this.size&&this.size[0]===g&&this.size[1]===y||d),{context:C}=this,{gl:L}=C;if(this.useMipmap=!!(h&&h.useMipmap),L.bindTexture(L.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===L.RGBA&&(!h||h.premultiply!==!1)),E)this.size=[g,y],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||u.b(o)?L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,L.UNSIGNED_BYTE,o):L.texImage2D(L.TEXTURE_2D,0,this.format,g,y,0,this.format,L.UNSIGNED_BYTE,o.data);else{const{x:A,y:R}=d||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||u.b(o)?L.texSubImage2D(L.TEXTURE_2D,0,A,R,L.RGBA,L.UNSIGNED_BYTE,o):L.texSubImage2D(L.TEXTURE_2D,0,A,R,g,y,L.RGBA,L.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&L.generateMipmap(L.TEXTURE_2D)}bind(o,h,d){const{context:g}=this,{gl:y}=g;y.bindTexture(y.TEXTURE_2D,this.texture),d!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=y.LINEAR),o!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,o),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,d||o),this.filter=o),h!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,h),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,h),this.wrap=h)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function ie(_){const{userImage:o}=_;return!!(o&&o.render&&o.render())&&(_.data.replace(new Uint8Array(o.data.buffer)),!0)}class Tt 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(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:h,promiseResolve:d}of this.requestors)d(this._getImagesForIds(h));this.requestors=[]}}getImage(o){const h=this.images[o];if(h&&!h.data&&h.spriteData){const d=h.spriteData;h.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),h.spriteData=null}return h}addImage(o,h){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,h)&&(this.images[o]=h)}_validate(o,h){let d=!0;const g=h.data||h.spriteData;return this._validateStretch(h.stretchX,g&&g.width)||(this.fire(new u.j(new Error(`Image "${o}" has invalid "stretchX" value`))),d=!1),this._validateStretch(h.stretchY,g&&g.height)||(this.fire(new u.j(new Error(`Image "${o}" has invalid "stretchY" value`))),d=!1),this._validateContent(h.content,h)||(this.fire(new u.j(new Error(`Image "${o}" has invalid "content" value`))),d=!1),d}_validateStretch(o,h){if(!o)return!0;let d=0;for(const g of o){if(g[0]{let g=!0;if(!this.isLoaded())for(const y of o)this.images[y]||(g=!1);this.isLoaded()||g?h(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:h})})}_getImagesForIds(o){const h={};for(const d of o){let g=this.getImage(d);g||(this.fire(new u.k("styleimagemissing",{id:d})),g=this.getImage(d)),g?h[d]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}: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 h}getPixelSize(){const{width:o,height:h}=this.atlasImage;return{width:o,height:h}}getPattern(o){const h=this.patterns[o],d=this.getImage(o);if(!d)return null;if(h&&h.position.version===d.version)return h.position;if(h)h.position.version=d.version;else{const g={w:d.data.width+2,h:d.data.height+2,x:0,y:0},y=new u.I(g,d);this.patterns[o]={bin:g,position:y}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const h=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ct(o,this.atlasImage,h.RGBA),this.atlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const y in this.patterns)o.push(this.patterns[y].bin);const{w:h,h:d}=u.p(o),g=this.atlasImage;g.resize({width:h||1,height:d||1});for(const y in this.patterns){const{bin:E}=this.patterns[y],C=E.x+1,L=E.y+1,A=this.getImage(y).data,R=A.width,z=A.height;u.R.copy(A,g,{x:0,y:0},{x:C,y:L},{width:R,height:z}),u.R.copy(A,g,{x:0,y:z-1},{x:C,y:L-1},{width:R,height:1}),u.R.copy(A,g,{x:0,y:0},{x:C,y:L+z},{width:R,height:1}),u.R.copy(A,g,{x:R-1,y:0},{x:C-1,y:L},{width:1,height:z}),u.R.copy(A,g,{x:0,y:0},{x:C+R,y:L},{width:1,height:z})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const h of o){if(this.callbackDispatchedThisFrame[h])continue;this.callbackDispatchedThisFrame[h]=!0;const d=this.getImage(h);d||u.w(`Image with ID: "${h}" was not found`),ie(d)&&this.updateImage(h,d)}}}const ee=1e20;function ge(_,o,h,d,g,y,E,C,L){for(let A=o;A-1);L++,y[L]=C,E[L]=A,E[L+1]=ee}for(let C=0,L=0;C65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[y])return{stack:o,id:h,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[y]){const C=Oe.loadGlyphRange(o,y,this.url,this.requestManager);d.requests[y]=C}const E=yield d.requests[y];for(const C in E)this._doesCharSupportLocalGlyph(+C)||(d.glyphs[+C]=E[+C]);return d.ranges[y]=!0,{stack:o,id:h,glyph:E[h]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](o)||u.u["Hangul Syllables"](o)||u.u.Hiragana(o)||u.u.Katakana(o))}_tinySDF(o,h,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let y=o.tinySDF;if(!y){let C="400";/bold/i.test(h)?C="900":/medium/i.test(h)?C="500":/light/i.test(h)&&(C="200"),y=o.tinySDF=new Oe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:C})}const E=y.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:E.width||60,height:E.height||60},E.data),metrics:{width:E.glyphWidth/2||24,height:E.glyphHeight/2||24,left:E.glyphLeft/2+.5||0,top:E.glyphTop/2-27.5||-8,advance:E.glyphAdvance/2||24,isDoubleResolution:!0}}}}Oe.loadGlyphRange=function(_,o,h,d){return u._(this,void 0,void 0,function*(){const g=256*o,y=g+255,E=d.transformRequest(h.replace("{fontstack}",_).replace("{range}",`${g}-${y}`),J.Glyphs),C=yield u.l(E,new AbortController);if(!C||!C.data)throw new Error(`Could not load glyph range. range: ${o}, ${g}-${y}`);const L={};for(const A of u.n(C.data))L[A.id]=A;return L})},Oe.TinySDF=class{constructor({fontSize:_=24,buffer:o=3,radius:h=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:y="normal",fontStyle:E="normal"}={}){this.buffer=o,this.cutoff=d,this.radius=h;const C=this.size=_+4*o,L=this._createCanvas(C),A=this.ctx=L.getContext("2d",{willReadFrequently:!0});A.font=`${E} ${y} ${_}px ${g}`,A.textBaseline="alphabetic",A.textAlign="left",A.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(_){const o=document.createElement("canvas");return o.width=o.height=_,o}draw(_){const{width:o,actualBoundingBoxAscent:h,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:y}=this.ctx.measureText(_),E=Math.ceil(h),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(y-g))),L=Math.min(this.size-this.buffer,E+Math.ceil(d)),A=C+2*this.buffer,R=L+2*this.buffer,z=Math.max(A*R,0),q=new Uint8ClampedArray(z),et={data:q,width:A,height:R,glyphWidth:C,glyphHeight:L,glyphTop:E,glyphLeft:0,glyphAdvance:o};if(C===0||L===0)return et;const{ctx:Q,buffer:nt,gridInner:K,gridOuter:pt}=this;Q.clearRect(nt,nt,C,L),Q.fillText(_,nt,nt+E);const Et=Q.getImageData(nt,nt,C,L);pt.fill(ee,0,z),K.fill(0,0,z);for(let st=0;st0?Bt*Bt:0,K[Pt]=Bt<0?Bt*Bt:0}}ge(pt,0,0,A,R,A,this.f,this.v,this.z),ge(K,nt,nt,C,L,A,this.f,this.v,this.z);for(let st=0;st1&&(L=o[++C]);const R=Math.abs(A-L.left),z=Math.abs(A-L.right),q=Math.min(R,z);let et;const Q=y/d*(g+1);if(L.isDash){const nt=g-Math.abs(Q);et=Math.sqrt(q*q+nt*nt)}else et=g-Math.sqrt(q*q+Q*Q);this.data[E+A]=Math.max(0,Math.min(255,et+128))}}}addRegularDash(o){for(let C=o.length-1;C>=0;--C){const L=o[C],A=o[C+1];L.zeroLength?o.splice(C,1):A&&A.isDash===L.isDash&&(A.left=L.left,o.splice(C,1))}const h=o[0],d=o[o.length-1];h.isDash===d.isDash&&(h.left=d.left-this.width,d.right=h.right+this.width);const g=this.width*this.nextRow;let y=0,E=o[y];for(let C=0;C1&&(E=o[++y]);const L=Math.abs(C-E.left),A=Math.abs(C-E.right),R=Math.min(L,A);this.data[g+C]=Math.max(0,Math.min(255,(E.isDash?R:-R)+128))}}addDash(o,h){const d=h?7:0,g=2*d+1;if(this.nextRow+g>this.height)return u.w("LineAtlas out of space"),null;let y=0;for(let C=0;C{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Rn]}numActive(){return Object.keys(this.active).length}}const Zn=Math.floor(P.hardwareConcurrency/2);let Wn,ri;function Kt(){return Wn||(Wn=new qn),Wn}qn.workerCount=u.B(globalThis)?Math.max(Math.min(Zn,3),1):1;class Ue{constructor(o,h){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=h;const d=this.workerPool.acquire(h);for(let g=0;g{h.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,h){for(const d of this.actors)d.registerMessageHandler(o,h)}}function yn(){return ri||(ri=new Ue(Kt(),u.G),ri.registerMessageHandler("getResource",(_,o,h)=>u.m(o,h))),ri}function br(_,o){const h=u.F();return u.H(h,h,[1,1,0]),u.J(h,h,[.5*_.width,.5*_.height,1]),u.K(h,h,_.calculatePosMatrix(o.toUnwrapped()))}function er(_,o,h,d,g,y){const E=function(z,q,et){if(z)for(const Q of z){const nt=q[Q];if(nt&&nt.source===et&&nt.type==="fill-extrusion")return!0}else for(const Q in q){const nt=q[Q];if(nt.source===et&&nt.type==="fill-extrusion")return!0}return!1}(g&&g.layers,o,_.id),C=y.maxPitchScaleFactor(),L=_.tilesIn(d,C,E);L.sort(Gt);const A=[];for(const z of L)A.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(o,h,_._state,z.queryGeometry,z.cameraQueryGeometry,z.scale,g,y,C,br(_.transform,z.tileID))});const R=function(z){const q={},et={};for(const Q of z){const nt=Q.queryResults,K=Q.wrappedTileID,pt=et[K]=et[K]||{};for(const Et in nt){const st=nt[Et],yt=pt[Et]=pt[Et]||{},kt=q[Et]=q[Et]||[];for(const Pt of st)yt[Pt.featureIndex]||(yt[Pt.featureIndex]=!0,kt.push(Pt))}}return q}(A);for(const z in R)R[z].forEach(q=>{const et=q.feature,Q=_.getFeatureState(et.layer["source-layer"],et.id);et.source=et.layer.source,et.layer["source-layer"]&&(et.sourceLayer=et.layer["source-layer"]),et.state=Q});return R}function Gt(_,o){const h=_.tileID,d=o.tileID;return h.overscaledZ-d.overscaledZ||h.canonical.y-d.canonical.y||h.wrap-d.wrap||h.canonical.x-d.canonical.x}function Fe(_,o,h){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(o.transformRequest(_.url,J.Source),h)).data:yield P.frameAsync(h),!d)return null;const g=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(g.vectorLayerIds=d.vector_layers.map(y=>y.id)),g})}class Ie{constructor(o,h){o&&(h?this.setSouthWest(o).setNorthEast(h):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof u.M?new u.M(o.lng,o.lat):u.M.convert(o),this}setSouthWest(o){return this._sw=o instanceof u.M?new u.M(o.lng,o.lat):u.M.convert(o),this}extend(o){const h=this._sw,d=this._ne;let g,y;if(o instanceof u.M)g=o,y=o;else{if(!(o instanceof Ie))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(Ie.convert(o)):this.extend(u.M.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(u.M.convert(o)):this;if(g=o._sw,y=o._ne,!g||!y)return this}return h||d?(h.lng=Math.min(g.lng,h.lng),h.lat=Math.min(g.lat,h.lat),d.lng=Math.max(y.lng,d.lng),d.lat=Math.max(y.lat,d.lat)):(this._sw=new u.M(g.lng,g.lat),this._ne=new u.M(y.lng,y.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(o){const{lng:h,lat:d}=u.M.convert(o);let g=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(o){return o instanceof Ie?o:o&&new Ie(o)}static fromLngLat(o,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*o.lat);return new Ie(new u.M(o.lng-g,o.lat-d),new u.M(o.lng+g,o.lat+d))}}class Ri{constructor(o,h,d){this.bounds=Ie.convert(this.validateBounds(o)),this.minzoom=h||0,this.maxzoom=d||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const h=Math.pow(2,o.z),d=Math.floor(u.N(this.bounds.getWest())*h),g=Math.floor(u.O(this.bounds.getNorth())*h),y=Math.ceil(u.N(this.bounds.getEast())*h),E=Math.ceil(u.O(this.bounds.getSouth())*h);return o.x>=d&&o.x=g&&o.y{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(o){return u._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(h,J.Tile),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.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 g="reloadTile";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((y,E)=>{o.reloadPromise={resolve:y,reject:E}})}else o.actor=this.dispatcher.getActor(),g="loadTile";o.abortController=new AbortController;try{const y=yield o.actor.sendAsync({type:g,data:d},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,y)}catch(y){if(delete o.abortController,o.aborted)return;if(y&&y.status!==404)throw y;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,h){if(h&&h.resourceTiming&&(o.resourceTiming=h.resourceTiming),h&&this.map._refreshExpiredTiles&&o.setExpiryData(h),o.loadVectorData(h,this.map.painter),o.reloadPromise){const d=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(d.resolve).catch(d.reject)}}abortTile(o){return u._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"abortTile",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return u._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"removeTile",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class sn extends u.E{constructor(o,h,d,g){super(),this.id=o,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},h),u.e(this,u.L(h,["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 o=yield Fe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(u.e(this,o),o.bounds&&(this.tileBounds=new Ri(o.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(o){this._tileJSONRequest=null,this.fire(new u.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return u.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return u._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const d=yield X.getImage(this.map._requestManager.transformRequest(h,J.Tile),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&o.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const g=this.map.painter.context,y=g.gl,E=d.data;o.texture=this.map.painter.getTileTexture(E.width),o.texture?o.texture.update(E,{useMipmap:!0}):(o.texture=new Ct(g,E,y.RGBA,{useMipmap:!0}),o.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),o.state="loaded"}}catch(d){if(delete o.abortController,o.aborted)o.state="unloaded";else if(d)throw o.state="errored",d}})}abortTile(o){return u._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return u._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class Bi extends sn{constructor(o,h,d,g){super(o,h,d,g),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},h),this.encoding=h.encoding||"mapbox",this.redFactor=h.redFactor,this.greenFactor=h.greenFactor,this.blueFactor=h.blueFactor,this.baseShift=h.baseShift}loadTile(o){return u._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(h,J.Tile);o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const g=yield X.getImage(d,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(g&&g.data){const y=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&o.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const E=u.b(y)&&u.S()?y:yield this.readImageNow(y),C={type:this.type,uid:o.uid,source:this.id,rawImageData:E,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const L=yield o.actor.sendAsync({type:"loadDEMTile",data:C});o.dem=L,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(g){if(delete o.abortController,o.aborted)o.state="unloaded";else if(g)throw o.state="errored",g}})}readImageNow(o){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const h=o.width+2,d=o.height+2;try{return new u.R({width:h,height:d},yield u.V(o,-1,-1,h,d))}catch{}}return P.getImageData(o,1)})}_getNeighboringTiles(o){const h=o.canonical,d=Math.pow(2,h.z),g=(h.x-1+d)%d,y=h.x===0?o.wrap-1:o.wrap,E=(h.x+1+d)%d,C=h.x+1===d?o.wrap+1:o.wrap,L={};return L[new u.Q(o.overscaledZ,y,h.z,g,h.y).key]={backfilled:!1},L[new u.Q(o.overscaledZ,C,h.z,E,h.y).key]={backfilled:!1},h.y>0&&(L[new u.Q(o.overscaledZ,y,h.z,g,h.y-1).key]={backfilled:!1},L[new u.Q(o.overscaledZ,o.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},L[new u.Q(o.overscaledZ,C,h.z,E,h.y-1).key]={backfilled:!1}),h.y+10&&u.e(y,{resourceTiming:g}),this.fire(new u.k("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},y),{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(o){return u._(this,void 0,void 0,function*(){const h=o.actor?"reloadTile":"loadTile";o.actor=this.actor;const d={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const g=yield this.actor.sendAsync({type:h,data:d},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(g,this.map.painter,h==="reloadTile")})}abortTile(o){return u._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return u._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"removeTile",data:{uid:o.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"removeSource",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var $n=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fr extends u.E{constructor(o,h,d,g){super(),this.id=o,this.dispatcher=d,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=h}load(o){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 h=yield X.getImage(this.map._requestManager.transformRequest(this.url,J.Image),this._request);this._request=null,this._loaded=!0,h&&h.data&&(this.image=h.data,o&&(this.coordinates=o),this._finishLoading())}catch(h){this._request=null,this.fire(new u.j(h))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.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(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const h=o.map(u.Y.fromLngLat);this.tileID=function(g){let y=1/0,E=1/0,C=-1/0,L=-1/0;for(const q of g)y=Math.min(y,q.x),E=Math.min(E,q.y),C=Math.max(C,q.x),L=Math.max(L,q.y);const A=Math.max(C-y,L-E),R=Math.max(0,Math.floor(-Math.log(A)/Math.LN2)),z=Math.pow(2,R);return new u.a0(R,Math.floor((y+C)/2*z),Math.floor((E+L)/2*z))}(h),this.minzoom=this.maxzoom=this.tileID.z;const d=h.map(g=>this.tileID.getTilePoint(g)._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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,$n.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ct(o,this.image,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let d=!1;for(const g in this.tiles){const y=this.tiles[g];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class $o extends fr{constructor(o,h,d,g){super(o,h,d,g),this.roundZoom=!0,this.type="video",this.options=h}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const h of o.urls)this.urls.push(this.map._requestManager.transformRequest(h,J.Source).url);try{const h=yield u.a2(this.urls);if(this._loaded=!0,!h)return;this.video=h,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(h){this.fire(new u.j(h))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const h=this.video.seekable;oh.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${h.start(0)} and ${h.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,$n.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,this.video)):(this.texture=new Ct(o,this.video,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let d=!1;for(const g in this.tiles){const y=this.tiles[g];y.state!=="loaded"&&(y.state="loaded",y.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 ws extends fr{constructor(o,h,d,g){super(o,h,d,g),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(E=>typeof E!="number"))||this.fire(new u.j(new u.a1(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${o}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),h.canvas?typeof h.canvas=="string"||h.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${o}`,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.${o}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const h=this.map.painter.context,d=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,$n.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ct(h,this.canvas,d.RGBA,{premultiply:!0});let g=!1;for(const y in this.tiles){const E=this.tiles[y];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture,g=!0)}g&&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 o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Ia={},wr=_=>{switch(_){case"geojson":return Qe;case"image":return fr;case"raster":return sn;case"raster-dem":return Bi;case"vector":return Mt;case"video":return $o;case"canvas":return ws}return Ia[_]};class Ja extends u.E{constructor(){super(...arguments),this.pluginStatus="unavailable",this.pluginURL=null,this.dispatcher=yn(),this.queue=[]}_sendPluginStateToWorker(){return u._(this,void 0,void 0,function*(){yield this.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}),this.fire(new u.k("pluginStateChange",{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}))})}getRTLTextPluginStatus(){return this.pluginStatus}clearRTLTextPlugin(){this.pluginStatus="unavailable",this.pluginURL=null}setRTLTextPlugin(o,h=!1){return u._(this,void 0,void 0,function*(){if(this.pluginStatus==="deferred"||this.pluginStatus==="loading"||this.pluginStatus==="loaded")throw new Error("setRTLTextPlugin cannot be called multiple times.");this.pluginURL=P.resolveURL(o),this.pluginStatus="deferred",yield this._sendPluginStateToWorker(),h||(yield this._downloadRTLTextPlugin())})}_downloadRTLTextPlugin(){return u._(this,void 0,void 0,function*(){if(this.pluginStatus!=="deferred"||!this.pluginURL)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");try{this.pluginStatus="loading",yield this._sendPluginStateToWorker(),yield u.l({url:this.pluginURL},new AbortController),this.pluginStatus="loaded"}catch{this.pluginStatus="error"}yield this._sendPluginStateToWorker()})}lazyLoadRTLTextPlugin(){return u._(this,void 0,void 0,function*(){this.pluginStatus==="deferred"&&(yield this._downloadRTLTextPlugin())})}}let ts=null;function Wt(){return ts||(ts=new Ja),ts}class No{constructor(o,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=u.a3(),this.uses=0,this.tileSize=h,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(o){const h=o+this.timeAdded;hy.getLayer(A)).filter(Boolean);if(L.length!==0){C.layers=L,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(A=>L.filter(R=>R.id===A)[0]));for(const A of L)E[A.id]=C}}return E}(o.buckets,h.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const y=this.buckets[g];if(y instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const y=this.buckets[g];if(y instanceof u.a5&&y.hasRTLText){this.hasRTLText=!0,Wt().lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const g in this.buckets){const y=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(g).queryRadius(y))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}unloadVectorData(){for(const o in this.buckets)this.buckets[o].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(o){return this.buckets[o.id]}upload(o){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(o)}const h=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ct(o,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ct(o,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,h,d,g,y,E,C,L,A,R){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:y,scale:E,tileSize:this.tileSize,pixelPosMatrix:R,transform:L,params:C,queryPadding:this.queryPadding*A},o,h,d):{}}querySourceFeatures(o,h){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),y=h&&h.sourceLayer?h.sourceLayer:"",E=g._geojsonTileLayer||g[y];if(!E)return;const C=u.a6(h&&h.filter),{z:L,x:A,y:R}=this.tileID.canonical,z={z:L,x:A,y:R};for(let q=0;qd)g=!1;else if(h)if(this.expirationTime{this.remove(o,y)},d)),this.data[g].push(y),this.order.push(g),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const h=this.data[o].shift();return h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),h.value}getByKey(o){const h=this.data[o];return h?h[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,h){if(!this.has(o))return this;const d=o.wrapped().key,g=h===void 0?0:this.data[d].indexOf(h),y=this.data[d][g];return this.data[d].splice(g,1),y.timeout&&clearTimeout(y.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(y.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(o){const h=[];for(const d in this.data)for(const g of this.data[d])o(g.value)||h.push(g);for(const d of h)this.remove(d.value.tileID,d)}}class Qa{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,h,d){const g=String(h);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][g]=this.stateChanges[o][g]||{},u.e(this.stateChanges[o][g],d),this.deletedStates[o]===null){this.deletedStates[o]={};for(const y in this.state[o])y!==g&&(this.deletedStates[o][y]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][g]===null){this.deletedStates[o][g]={};for(const y in this.state[o][g])d[y]||(this.deletedStates[o][g][y]=null)}else for(const y in d)this.deletedStates[o]&&this.deletedStates[o][g]&&this.deletedStates[o][g][y]===null&&delete this.deletedStates[o][g][y]}removeFeatureState(o,h,d){if(this.deletedStates[o]===null)return;const g=String(h);if(this.deletedStates[o]=this.deletedStates[o]||{},d&&h!==void 0)this.deletedStates[o][g]!==null&&(this.deletedStates[o][g]=this.deletedStates[o][g]||{},this.deletedStates[o][g][d]=null);else if(h!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][g])for(d in this.deletedStates[o][g]={},this.stateChanges[o][g])this.deletedStates[o][g][d]=null;else this.deletedStates[o][g]=null;else this.deletedStates[o]=null}getState(o,h){const d=String(h),g=u.e({},(this.state[o]||{})[d],(this.stateChanges[o]||{})[d]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const y=this.deletedStates[o][h];if(y===null)return{};for(const E in y)delete g[E]}return g}initializeTileState(o,h){o.setFeatureState(this.state,h)}coalesceChanges(o,h){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const y={};for(const E in this.stateChanges[g])this.state[g][E]||(this.state[g][E]={}),u.e(this.state[g][E],this.stateChanges[g][E]),y[E]=this.state[g][E];d[g]=y}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const y={};if(this.deletedStates[g]===null)for(const E in this.state[g])y[E]={},this.state[g][E]={};else for(const E in this.deletedStates[g]){if(this.deletedStates[g][E]===null)this.state[g][E]={};else for(const C of Object.keys(this.deletedStates[g][E]))delete this.state[g][E][C];y[E]=this.state[g][E]}d[g]=d[g]||{},u.e(d[g],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in o)o[g].setFeatureState(d,h)}}class Ni extends u.E{constructor(o,h,d){super(),this.id=o,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,y,E,C)=>{const L=new(wr(y.type))(g,y,E,C);if(L.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${L.id}`);return L})(o,h,d,this),this._tiles={},this._cache=new Br(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Qa,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}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 o in this._tiles){const h=this._tiles[o];if(h.state!=="loaded"&&h.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,h,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,h,d)}catch(g){o.state="errored",g.status!==404?this._source.fire(new u.j(g,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new u.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const d=this._tiles[h];d.upload(o),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(Jt).map(o=>o.key)}getRenderableIds(o){const h=[];for(const d in this._tiles)this._isIdRenderable(d,o)&&h.push(this._tiles[d]);return o?h.sort((d,g)=>{const y=d.tileID,E=g.tileID,C=new u.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),L=new u.P(E.canonical.x,E.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-E.overscaledZ||L.y-C.y||L.x-C.x}).map(d=>d.tileID.key):h.map(d=>d.tileID).sort(Jt).map(d=>d.key)}hasRenderableParent(o){const h=this.findLoadedParent(o,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(o,h){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(h||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,h){return u._(this,void 0,void 0,function*(){const d=this._tiles[o];d&&(d.state!=="loading"&&(d.state=h),yield this._loadTile(d,o,h))})}_tileLoaded(o,h,d){o.timeAdded=P.now(),d==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(h,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new u.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const h=this.getRenderableIds();for(let g=0;g1||(Math.abs(E)>1&&(Math.abs(E+L)===1?E+=L:Math.abs(E-L)===1&&(E-=L)),y.dem&&g.dem&&(g.dem.backfillBorder(y.dem,E,C),g.neighboringTiles&&g.neighboringTiles[A]&&(g.neighboringTiles[A].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,h,d,g){for(const y in this._tiles){let E=this._tiles[y];if(g[y]||!E.hasData()||E.tileID.overscaledZ<=h||E.tileID.overscaledZ>d)continue;let C=E.tileID;for(;E&&E.tileID.overscaledZ>h+1;){const A=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[A.key],E&&E.hasData()&&(C=A)}let L=C;for(;L.overscaledZ>h;)if(L=L.scaledTo(L.overscaledZ-1),o[L.key]){g[C.key]=C;break}}}findLoadedParent(o,h){if(o.key in this._loadedParentTiles){const d=this._loadedParentTiles[o.key];return d&&d.tileID.overscaledZ>=h?d:null}for(let d=o.overscaledZ-1;d>=h;d--){const g=o.scaledTo(d),y=this._getLoadedTile(g);if(y)return y}}_getLoadedTile(o){const h=this._tiles[o.key];return h&&h.hasData()?h:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const h=Math.ceil(o.width/this._source.tileSize)+1,d=Math.ceil(o.height/this._source.tileSize)+1,g=Math.floor(h*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(y)}handleWrapJump(o){const h=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,h){const d={};for(const g in this._tiles){const y=this._tiles[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+h),d[y.tileID.key]=y}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(o,h){if(this.transform=o,this.terrain=h,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new u.Q(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y)):(d=o.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:h}),this._source.hasTile&&(d=d.filter(R=>this._source.hasTile(R)))):d=[];const g=o.coveringZoomLevel(this._source),y=Math.max(g-Ni.maxOverzooming,this._source.minzoom),E=Math.max(g+Ni.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const R={};for(const z of d)if(z.canonical.z>this._source.minzoom){const q=z.scaledTo(z.canonical.z-1);R[q.key]=q;const et=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));R[et.key]=et}d=d.concat(Object.values(R))}const C=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const L=this._updateRetainedTiles(d,g);if(He(this._source.type)){const R={},z={},q=Object.keys(L),et=P.now();for(const Q of q){const nt=L[Q],K=this._tiles[Q];if(!K||K.fadeEndTime!==0&&K.fadeEndTime<=et)continue;const pt=this.findLoadedParent(nt,y);pt&&(this._addTile(pt.tileID),R[pt.tileID.key]=pt.tileID),z[Q]=nt}this._retainLoadedChildren(z,g,E,L);for(const Q in R)L[Q]||(this._coveredTiles[Q]=!0,L[Q]=R[Q]);if(h){const Q={},nt={};for(const K of d)this._tiles[K.key].hasData()?Q[K.key]=K:nt[K.key]=K;for(const K in nt){const pt=nt[K].children(this._source.maxzoom);this._tiles[pt[0].key]&&this._tiles[pt[1].key]&&this._tiles[pt[2].key]&&this._tiles[pt[3].key]&&(Q[pt[0].key]=L[pt[0].key]=pt[0],Q[pt[1].key]=L[pt[1].key]=pt[1],Q[pt[2].key]=L[pt[2].key]=pt[2],Q[pt[3].key]=L[pt[3].key]=pt[3],delete nt[K])}for(const K in nt){const pt=this.findLoadedParent(nt[K],this._source.minzoom);if(pt){Q[pt.tileID.key]=L[pt.tileID.key]=pt.tileID;for(const Et in Q)Q[Et].isChildOf(pt.tileID)&&delete Q[Et]}}for(const K in this._tiles)Q[K]||(this._coveredTiles[K]=!0)}}for(const R in L)this._tiles[R].clearFadeHold();const A=u.ab(this._tiles,L);for(const R of A){const z=this._tiles[R];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(R)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,h){const d={},g={},y=Math.max(h-Ni.maxOverzooming,this._source.minzoom),E=Math.max(h+Ni.maxUnderzooming,this._source.minzoom),C={};for(const L of o){const A=this._addTile(L);d[L.key]=L,A.hasData()||hthis._source.maxzoom){const z=L.children(this._source.maxzoom)[0],q=this.getTile(z);if(q&&q.hasData()){d[z.key]=z;continue}}else{const z=L.children(this._source.maxzoom);if(d[z[0].key]&&d[z[1].key]&&d[z[2].key]&&d[z[3].key])continue}let R=A.wasRequested();for(let z=L.overscaledZ-1;z>=y;--z){const q=L.scaledTo(z);if(g[q.key])break;if(g[q.key]=!0,A=this.getTile(q),!A&&R&&(A=this._addTile(q)),A){const et=A.hasData();if((R||et)&&(d[q.key]=q),R=A.wasRequested(),et)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const h=[];let d,g=this._tiles[o].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}h.push(g.key);const y=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(y),d)break;g=y}for(const y of h)this._loadedParentTiles[y]=d}}_addTile(o){let h=this._tiles[o.key];if(h)return h;h=this._cache.getAndRemove(o),h&&(this._setTileReloadTimer(o.key,h),h.tileID=o,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,h)));const d=h;return h||(h=new No(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(h,o.key,h.state)),h.uses++,this._tiles[o.key]=h,d||this._source.fire(new u.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(o,h){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const d=h.getExpiryTimeout();d&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},d))}_removeTile(o){const h=this._tiles[o];h&&(h.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),h.uses>0||(h.hasData()&&h.state!=="reloading"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,h,d){const g=[],y=this.transform;if(!y)return g;const E=d?y.getCameraQueryGeometry(o):o,C=o.map(Q=>y.pointCoordinate(Q,this.terrain)),L=E.map(Q=>y.pointCoordinate(Q,this.terrain)),A=this.getIds();let R=1/0,z=1/0,q=-1/0,et=-1/0;for(const Q of L)R=Math.min(R,Q.x),z=Math.min(z,Q.y),q=Math.max(q,Q.x),et=Math.max(et,Q.y);for(let Q=0;Q=0&&st[1].y+Et>=0){const yt=C.map(Pt=>K.getTilePoint(Pt)),kt=L.map(Pt=>K.getTilePoint(Pt));g.push({tile:nt,tileID:K,queryGeometry:yt,cameraQueryGeometry:kt,scale:pt})}}return g}getVisibleCoordinates(o){const h=this.getRenderableIds(o).map(d=>this._tiles[d].tileID);for(const d of h)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(He(this._source.type)){const o=P.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=o)return!0}return!1}setFeatureState(o,h,d){this._state.updateState(o=o||"_geojsonTileLayer",h,d)}removeFeatureState(o,h,d){this._state.removeFeatureState(o=o||"_geojsonTileLayer",h,d)}getFeatureState(o,h){return this._state.getState(o=o||"_geojsonTileLayer",h)}setDependencies(o,h,d){const g=this._tiles[o];g&&g.setDependencies(h,d)}reloadTilesForDependencies(o,h){for(const d in this._tiles)this._tiles[d].hasDependency(o,h)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(o,h))}}function Jt(_,o){const h=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*o.wrap)-+(o.wrap<0);return _.overscaledZ-o.overscaledZ||d-h||o.canonical.y-_.canonical.y||o.canonical.x-_.canonical.x}function He(_){return _==="raster"||_==="image"||_==="video"}Ni.maxOverzooming=10,Ni.maxUnderzooming=3;class je{constructor(o,h){this.reset(o,h)}reset(o,h){this.points=o||[],this._distances=[0];for(let d=1;d0?(g-E)/C:0;return this.points[y].mult(1-L).add(this.points[h].mult(L))}}function yi(_,o){let h=!0;return _==="always"||_!=="never"&&o!=="never"||(h=!1),h}class zo{constructor(o,h,d){const g=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(o/d),this.yCellCount=Math.ceil(h/d);for(let E=0;Ethis.width||g<0||h>this.height)return[];const L=[];if(o<=0&&h<=0&&this.width<=d&&this.height<=g){if(y)return[{key:null,x1:o,y1:h,x2:d,y2:g}];for(let A=0;A0}hitTestCircle(o,h,d,g,y){const E=o-d,C=o+d,L=h-d,A=h+d;if(C<0||E>this.width||A<0||L>this.height)return!1;const R=[];return this._forEachCell(E,L,C,A,this._queryCellCircle,R,{hitTest:!0,overlapMode:g,circle:{x:o,y:h,radius:d},seenUids:{box:{},circle:{}}},y),R.length>0}_queryCell(o,h,d,g,y,E,C,L){const{seenUids:A,hitTest:R,overlapMode:z}=C,q=this.boxCells[y];if(q!==null){const Q=this.bboxes;for(const nt of q)if(!A.box[nt]){A.box[nt]=!0;const K=4*nt,pt=this.boxKeys[nt];if(o<=Q[K+2]&&h<=Q[K+3]&&d>=Q[K+0]&&g>=Q[K+1]&&(!L||L(pt))&&(!R||!yi(z,pt.overlapMode))&&(E.push({key:pt,x1:Q[K],y1:Q[K+1],x2:Q[K+2],y2:Q[K+3]}),R))return!0}}const et=this.circleCells[y];if(et!==null){const Q=this.circles;for(const nt of et)if(!A.circle[nt]){A.circle[nt]=!0;const K=3*nt,pt=this.circleKeys[nt];if(this._circleAndRectCollide(Q[K],Q[K+1],Q[K+2],o,h,d,g)&&(!L||L(pt))&&(!R||!yi(z,pt.overlapMode))){const Et=Q[K],st=Q[K+1],yt=Q[K+2];if(E.push({key:pt,x1:Et-yt,y1:st-yt,x2:Et+yt,y2:st+yt}),R)return!0}}}return!1}_queryCellCircle(o,h,d,g,y,E,C,L){const{circle:A,seenUids:R,overlapMode:z}=C,q=this.boxCells[y];if(q!==null){const Q=this.bboxes;for(const nt of q)if(!R.box[nt]){R.box[nt]=!0;const K=4*nt,pt=this.boxKeys[nt];if(this._circleAndRectCollide(A.x,A.y,A.radius,Q[K+0],Q[K+1],Q[K+2],Q[K+3])&&(!L||L(pt))&&!yi(z,pt.overlapMode))return E.push(!0),!0}}const et=this.circleCells[y];if(et!==null){const Q=this.circles;for(const nt of et)if(!R.circle[nt]){R.circle[nt]=!0;const K=3*nt,pt=this.circleKeys[nt];if(this._circlesCollide(Q[K],Q[K+1],Q[K+2],A.x,A.y,A.radius)&&(!L||L(pt))&&!yi(z,pt.overlapMode))return E.push(!0),!0}}}_forEachCell(o,h,d,g,y,E,C,L){const A=this._convertToXCellCoord(o),R=this._convertToYCellCoord(h),z=this._convertToXCellCoord(d),q=this._convertToYCellCoord(g);for(let et=A;et<=z;et++)for(let Q=R;Q<=q;Q++)if(y.call(this,o,h,d,g,this.xCellCount*Q+et,E,C,L))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,h,d,g,y,E){const C=g-o,L=y-h,A=d+E;return A*A>C*C+L*L}_circleAndRectCollide(o,h,d,g,y,E,C){const L=(E-g)/2,A=Math.abs(o-(g+L));if(A>L+d)return!1;const R=(C-y)/2,z=Math.abs(h-(y+R));if(z>R+d)return!1;if(A<=L||z<=R)return!0;const q=A-L,et=z-R;return q*q+et*et<=d*d}}function Ge(_,o,h,d,g){const y=u.F();return o?(u.J(y,y,[1/g,1/g,1]),h||u.ad(y,y,d.angle)):u.K(y,d.labelPlaneMatrix,_),y}function ea(_,o,h,d,g){if(o){const y=u.ae(_);return u.J(y,y,[g,g,1]),h||u.ad(y,y,-d.angle),y}return d.glCoordMatrix}function Ii(_,o,h){let d;h?(d=[_.x,_.y,h(_.x,_.y),1],u.af(d,d,o)):(d=[_.x,_.y,0,1],xe(d,d,o));const g=d[3];return{point:new u.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function rt(_,o){return .5+_/o*.5}function O(_,o){const h=_[0]/_[3],d=_[1]/_[3];return h>=-o[0]&&h<=o[0]&&d>=-o[1]&&d<=o[1]}function U(_,o,h,d,g,y,E,C,L,A){const R=d?_.textSizeData:_.iconSizeData,z=u.ag(R,h.transform.zoom),q=[256/h.width*2+1,256/h.height*2+1],et=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;et.clear();const Q=_.lineVertexArray,nt=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,K=h.transform.width/h.transform.height;let pt=!1;for(let Et=0;EtMath.abs(h.x-o.x)*d?{useVertical:!0}:(_===u.ah.vertical?o.yh.x)?{needsFlipping:!0}:null}function ft(_,o,h,d,g,y,E,C,L,A,R,z,q,et,Q,nt){const K=o/24,pt=_.lineOffsetX*K,Et=_.lineOffsetY*K;let st;if(_.numGlyphs>1){const yt=_.glyphStartIndex+_.numGlyphs,kt=_.lineStartIndex,Pt=_.lineStartIndex+_.lineLength,Bt=Z(K,C,pt,Et,h,R,z,_,L,y,q,Q,nt);if(!Bt)return{notEnoughRoom:!0};const qt=Ii(Bt.first.point,E,nt).point,Ut=Ii(Bt.last.point,E,nt).point;if(d&&!h){const Ht=$(_.writingMode,qt,Ut,et);if(Ht)return Ht}st=[Bt.first];for(let Ht=_.glyphStartIndex+1;Ht0?qt.point:H(z,Bt,kt,1,g,nt),Ht=$(_.writingMode,kt,Ut,et);if(Ht)return Ht}const yt=At(K*C.getoffsetX(_.glyphStartIndex),pt,Et,h,R,z,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,L,y,q,Q,nt);if(!yt)return{notEnoughRoom:!0};st=[yt]}for(const yt of st)u.aj(A,yt.point,yt.angle);return{}}function H(_,o,h,d,g,y){const E=Ii(_.add(_.sub(o)._unit()),g,y).point,C=h.sub(E);return h.add(C._mult(d/C.mag()))}function dt(_,o){const{projectionCache:h,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:y,distanceFromAnchor:E,getElevation:C,previousVertex:L,direction:A,absOffsetX:R}=o;if(h.projections[_])return h.projections[_];const z=new u.P(d.getx(_),d.gety(_)),q=Ii(z,g,C);if(q.signedDistanceFromCamera>0)return h.projections[_]=q.point,q.point;const et=_-A;return H(E===0?y:new u.P(d.getx(et),d.gety(et)),z,L,R-E+1,g,C)}function lt(_,o,h){return _._unit()._perp()._mult(o*h)}function xt(_,o,h,d,g,y,E,C){const{projectionCache:L,direction:A}=C;if(L.offsets[_])return L.offsets[_];const R=h.add(o);if(_+A=g)return L.offsets[_]=R,R;const z=dt(_+A,C),q=lt(z.sub(h),E,A),et=h.add(q),Q=z.add(q);return L.offsets[_]=u.ak(y,R,et,Q)||R,L.offsets[_]}function At(_,o,h,d,g,y,E,C,L,A,R,z,q,et){const Q=d?_-o:_+o;let nt=Q>0?1:-1,K=0;d&&(nt*=-1,K=Math.PI),nt<0&&(K+=Math.PI);let pt,Et,st=nt>0?C+E:C+E+1,yt=g,kt=g,Pt=0,Bt=0;const qt=Math.abs(Q),Ut=[];let Ht;for(;Pt+Bt<=qt;){if(st+=nt,st=L)return null;Pt+=Bt,kt=yt,Et=pt;const re={projectionCache:z,lineVertexArray:A,labelPlaneMatrix:R,tileAnchorPoint:y,distanceFromAnchor:Pt,getElevation:et,previousVertex:kt,direction:nt,absOffsetX:qt};if(yt=dt(st,re),h===0)Ut.push(kt),Ht=yt.sub(kt);else{let Pe;const ye=yt.sub(kt);Pe=ye.mag()===0?lt(dt(st+nt,re).sub(yt),h,nt):lt(ye,h,nt),Et||(Et=kt.add(Pe)),pt=xt(st,Pe,yt,C,L,Et,h,re),Ut.push(Et),Ht=pt.sub(Et)}Bt=Ht.mag()}const me=Ht._mult((qt-Pt)/Bt)._add(Et||kt),Ae=K+Math.atan2(yt.y-kt.y,yt.x-kt.x);return Ut.push(me),{point:me,angle:q?Ae:0,path:Ut}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Nt(_,o){for(let h=0;h<_;h++){const d=o.length;o.resize(d+4),o.float32.set(Rt,3*d)}}function xe(_,o,h){const d=o[0],g=o[1];return _[0]=h[0]*d+h[4]*g+h[12],_[1]=h[1]*d+h[5]*g+h[13],_[3]=h[3]*d+h[7]*g+h[15],_}const Ee=100;class ze{constructor(o,h=new zo(o.width+200,o.height+200,25),d=new zo(o.width+200,o.height+200,25)){this.transform=o,this.grid=h,this.ignoredGrid=d,this.pitchfactor=Math.cos(o._pitch)*o.cameraToCenterDistance,this.screenRightBoundary=o.width+Ee,this.screenBottomBoundary=o.height+Ee,this.gridRightBoundary=o.width+200,this.gridBottomBoundary=o.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(o,h,d,g,y,E){const C=this.projectAndGetPerspectiveRatio(g,o.anchorPointX,o.anchorPointY,E),L=d*C.perspectiveRatio,A=o.x1*L+C.point.x,R=o.y1*L+C.point.y,z=o.x2*L+C.point.x,q=o.y2*L+C.point.y;return!this.isInsideGrid(A,R,z,q)||h!=="always"&&this.grid.hitTest(A,R,z,q,h,y)||C.perspectiveRatio=1;Je--)ye.push(re.path[Je]);for(let Je=1;JeIi(ln,L,Q));ye=Je.some(ln=>ln.signedDistanceFromCamera<=0)?[]:Je.map(ln=>ln.point)}let an=[];if(ye.length>0){const Je=ye[0].clone(),ln=ye[0].clone();for(let Ci=1;Ci=Ht.x&&ln.x<=me.x&&Je.y>=Ht.y&&ln.y<=me.y?[ye]:ln.xme.x||ln.yme.y?[]:u.al([ye],Ht.x,Ht.y,me.x,me.y)}for(const Je of an){Ae.reset(Je,.25*Ut);let ln=0;ln=Ae.length<=.5*Ut?1:Math.ceil(Ae.paddedLength/Yn)+1;for(let Ci=0;Ci=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(o,h,d,g){return d>=0&&o=0&&hd.collisionGroupID===h}}return this.collisionGroups[o]}}function Vi(_,o,h,d,g){const{horizontalAlign:y,verticalAlign:E}=u.at(_);return new u.P(-(y-.5)*o+d[0]*g,-(E-.5)*h+d[1]*g)}function Vr(_,o,h,d,g,y){const{x1:E,x2:C,y1:L,y2:A,anchorPointX:R,anchorPointY:z}=_,q=new u.P(o,h);return d&&q._rotate(g?y:-y),{x1:E+q.x,y1:L+q.y,x2:C+q.x,y2:A+q.y,anchorPointX:R,anchorPointY:z}}class no{constructor(o,h,d,g,y){this.transform=o.clone(),this.terrain=h,this.collisionIndex=new ze(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new ui(g),this.collisionCircleArrays={},this.prevPlacement=y,y&&(y.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(o,h,d,g){const y=d.getBucket(h),E=d.latestFeatureIndex;if(!y||!E||h.id!==y.layerIds[0])return;const C=d.collisionBoxArray,L=y.layers[0].layout,A=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),R=d.tileSize/u.W,z=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),q=L.get("text-pitch-alignment")==="map",et=L.get("text-rotation-alignment")==="map",Q=Be(d,1,this.transform.zoom),nt=Ge(z,q,et,this.transform,Q);let K=null;if(q){const Et=ea(z,q,et,this.transform,Q);K=u.K([],this.transform.labelPlaneMatrix,Et)}this.retainedQueryData[y.bucketInstanceId]=new Ke(y.bucketInstanceId,E,y.sourceLayerIndex,y.index,d.tileID);const pt={bucket:y,layout:L,posMatrix:z,textLabelPlaneMatrix:nt,labelToScreenMatrix:K,scale:A,textPixelRatio:R,holdingForFade:d.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:u.ag(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(g)for(const Et of y.sortKeyRanges){const{sortKey:st,symbolInstanceStart:yt,symbolInstanceEnd:kt}=Et;o.push({sortKey:st,symbolInstanceStart:yt,symbolInstanceEnd:kt,parameters:pt})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:pt})}attemptAnchorPlacement(o,h,d,g,y,E,C,L,A,R,z,q,et,Q,nt,K){const pt=u.ap[o.textAnchor],Et=[o.textOffset0,o.textOffset1],st=Vi(pt,d,g,Et,y),yt=this.collisionIndex.placeCollisionBox(Vr(h,st.x,st.y,E,C,this.transform.angle),z,L,A,R.predicate,K);if((!nt||this.collisionIndex.placeCollisionBox(Vr(nt,st.x,st.y,E,C,this.transform.angle),z,L,A,R.predicate,K).box.length!==0)&&yt.box.length>0){let kt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID].text&&(kt=this.prevPlacement.variableOffsets[q.crossTileID].anchor),q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[q.crossTileID]={textOffset:Et,width:d,height:g,anchor:pt,textBoxScale:y,prevAnchor:kt},this.markUsedJustification(et,pt,q,Q),et.allowVerticalPlacement&&(this.markUsedOrientation(et,Q,q),this.placedOrientations[q.crossTileID]=Q),{shift:st,placedGlyphBoxes:yt}}}placeLayerBucketPart(o,h,d){const{bucket:g,layout:y,posMatrix:E,textLabelPlaneMatrix:C,labelToScreenMatrix:L,textPixelRatio:A,holdingForFade:R,collisionBoxArray:z,partiallyEvaluatedTextSize:q,collisionGroup:et}=o.parameters,Q=y.get("text-optional"),nt=y.get("icon-optional"),K=u.aq(y,"text-overlap","text-allow-overlap"),pt=K==="always",Et=u.aq(y,"icon-overlap","icon-allow-overlap"),st=Et==="always",yt=y.get("text-rotation-alignment")==="map",kt=y.get("text-pitch-alignment")==="map",Pt=y.get("icon-text-fit")!=="none",Bt=y.get("symbol-z-order")==="viewport-y",qt=pt&&(st||!g.hasIconData()||nt),Ut=st&&(pt||!g.hasTextData()||Q);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const Ht=this.retainedQueryData[g.bucketInstanceId].tileID,me=this.terrain?(re,Pe)=>this.terrain.getElevation(Ht,re,Pe):null,Ae=(re,Pe)=>{var ye,Yn;if(h[re.crossTileID])return;if(R)return void(this.placements[re.crossTileID]=new ti(!1,!1,!1));let an=!1,Je=!1,ln=!0,Ci=null,zn={box:null,offscreen:null},jr={box:null,offscreen:null},ir=null,pi=null,Er=null,Sr=0,Vo=0,Pa=0;Pe.textFeatureIndex?Sr=Pe.textFeatureIndex:re.useRuntimeCollisionCircles&&(Sr=re.featureIndex),Pe.verticalTextFeatureIndex&&(Vo=Pe.verticalTextFeatureIndex);const Zl=Pe.textBox;if(Zl){const Ui=Kn=>{let Gi=u.ah.horizontal;if(g.allowVerticalPlacement&&!Kn&&this.prevPlacement){const rr=this.prevPlacement.placedOrientations[re.crossTileID];rr&&(this.placedOrientations[re.crossTileID]=rr,Gi=rr,this.markUsedOrientation(g,Gi,re))}return Gi},Ti=(Kn,Gi)=>{if(g.allowVerticalPlacement&&re.numVerticalGlyphVertices>0&&Pe.verticalTextBox){for(const rr of g.writingModes)if(rr===u.ah.vertical?(zn=Gi(),jr=zn):zn=Kn(),zn&&zn.box&&zn.box.length)break}else zn=Kn()},fi=re.textAnchorOffsetStartIndex,Zr=re.textAnchorOffsetEndIndex;if(Zr===fi){const Kn=(Gi,rr)=>{const qi=this.collisionIndex.placeCollisionBox(Gi,K,A,E,et.predicate,me);return qi&&qi.box&&qi.box.length&&(this.markUsedOrientation(g,rr,re),this.placedOrientations[re.crossTileID]=rr),qi};Ti(()=>Kn(Zl,u.ah.horizontal),()=>{const Gi=Pe.verticalTextBox;return g.allowVerticalPlacement&&re.numVerticalGlyphVertices>0&&Gi?Kn(Gi,u.ah.vertical):{box:null,offscreen:null}}),Ui(zn&&zn.box&&zn.box.length)}else{let Kn=u.ap[(Yn=(ye=this.prevPlacement)===null||ye===void 0?void 0:ye.variableOffsets[re.crossTileID])===null||Yn===void 0?void 0:Yn.anchor];const Gi=(qi,zd,vi)=>{const Rp=qi.x2-qi.x1,Od=qi.y2-qi.y1,cl=re.textBoxScale,hl=Pt&&Et==="never"?zd:null;let ra={box:[],offscreen:!1},Jc=K==="never"?1:2,Np="never";Kn&&Jc++;for(let Fd=0;FdGi(Zl,Pe.iconBox,u.ah.horizontal),()=>{const qi=Pe.verticalTextBox;return g.allowVerticalPlacement&&!(zn&&zn.box&&zn.box.length)&&re.numVerticalGlyphVertices>0&&qi?Gi(qi,Pe.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),zn&&(an=zn.box,ln=zn.offscreen);const rr=Ui(zn&&zn.box);if(!an&&this.prevPlacement){const qi=this.prevPlacement.variableOffsets[re.crossTileID];qi&&(this.variableOffsets[re.crossTileID]=qi,this.markUsedJustification(g,qi.anchor,re,rr))}}}if(ir=zn,an=ir&&ir.box&&ir.box.length>0,ln=ir&&ir.offscreen,re.useRuntimeCollisionCircles){const Ui=g.text.placedSymbolArray.get(re.centerJustifiedTextSymbolIndex),Ti=u.ai(g.textSizeData,q,Ui),fi=y.get("text-padding");pi=this.collisionIndex.placeCollisionCircles(K,Ui,g.lineVertexArray,g.glyphOffsetArray,Ti,E,C,L,d,kt,et.predicate,re.collisionCircleDiameter,fi,me),pi.circles.length&&pi.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),an=pt||pi.circles.length>0&&!pi.collisionDetected,ln=ln&&pi.offscreen}if(Pe.iconFeatureIndex&&(Pa=Pe.iconFeatureIndex),Pe.iconBox){const Ui=Ti=>{const fi=Pt&&Ci?Vr(Ti,Ci.x,Ci.y,yt,kt,this.transform.angle):Ti;return this.collisionIndex.placeCollisionBox(fi,Et,A,E,et.predicate,me)};jr&&jr.box&&jr.box.length&&Pe.verticalIconBox?(Er=Ui(Pe.verticalIconBox),Je=Er.box.length>0):(Er=Ui(Pe.iconBox),Je=Er.box.length>0),ln=ln&&Er.offscreen}const Wl=Q||re.numHorizontalGlyphVertices===0&&re.numVerticalGlyphVertices===0,Ma=nt||re.numIconVertices===0;if(Wl||Ma?Ma?Wl||(Je=Je&&an):an=Je&&an:Je=an=Je&&an,an&&ir&&ir.box&&this.collisionIndex.insertCollisionBox(ir.box,K,y.get("text-ignore-placement"),g.bucketInstanceId,jr&&jr.box&&Vo?Vo:Sr,et.ID),Je&&Er&&this.collisionIndex.insertCollisionBox(Er.box,Et,y.get("icon-ignore-placement"),g.bucketInstanceId,Pa,et.ID),pi&&(an&&this.collisionIndex.insertCollisionCircles(pi.circles,K,y.get("text-ignore-placement"),g.bucketInstanceId,Sr,et.ID),d)){const Ui=g.bucketInstanceId;let Ti=this.collisionCircleArrays[Ui];Ti===void 0&&(Ti=this.collisionCircleArrays[Ui]=new zi);for(let fi=0;fi=0;--Pe){const ye=re[Pe];Ae(g.symbolInstances.get(ye),g.collisionArrays[ye])}}else for(let re=o.symbolInstanceStart;re=0&&(o.text.placedSymbolArray.get(C).crossTileID=y>=0&&C!==y?0:d.crossTileID)}markUsedOrientation(o,h,d){const g=h===u.ah.horizontal||h===u.ah.horizontalOnly?h:0,y=h===u.ah.vertical?h:0,E=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const C of E)o.text.placedSymbolArray.get(C).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let d=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const g=h?h.symbolFadeChange(o):1,y=h?h.opacities:{},E=h?h.variableOffsets:{},C=h?h.placedOrientations:{};for(const L in this.placements){const A=this.placements[L],R=y[L];R?(this.opacities[L]=new Nn(R,g,A.text,A.icon),d=d||A.text!==R.text.placed||A.icon!==R.icon.placed):(this.opacities[L]=new Nn(null,g,A.text,A.icon,A.skipFade),d=d||A.text||A.icon)}for(const L in y){const A=y[L];if(!this.opacities[L]){const R=new Nn(A,g,!1,!1);R.isHidden()||(this.opacities[L]=R,d=d||A.text.placed||A.icon.placed)}}for(const L in E)this.variableOffsets[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.variableOffsets[L]=E[L]);for(const L in C)this.placedOrientations[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.placedOrientations[L]=C[L]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:o)}updateLayerOpacities(o,h){const d={};for(const g of h){const y=g.getBucket(o);y&&g.latestFeatureIndex&&o.id===y.layerIds[0]&&this.updateBucketOpacities(y,d,g.collisionBoxArray)}}updateBucketOpacities(o,h,d){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const g=o.layers[0],y=g.layout,E=new Nn(null,0,!1,!1,!0),C=y.get("text-allow-overlap"),L=y.get("icon-allow-overlap"),A=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),R=y.get("text-rotation-alignment")==="map",z=y.get("text-pitch-alignment")==="map",q=y.get("icon-text-fit")!=="none",et=new Nn(null,0,C&&(L||!o.hasIconData()||y.get("icon-optional")),L&&(C||!o.hasTextData()||y.get("text-optional")),!0);!o.collisionArrays&&d&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(d);const Q=(nt,K,pt)=>{for(let Et=0;Et0,Pt=this.placedOrientations[K.crossTileID],Bt=Pt===u.ah.vertical,qt=Pt===u.ah.horizontal||Pt===u.ah.horizontalOnly;if(pt>0||Et>0){const Ut=io(yt.text);Q(o.text,pt,Bt?yu:Ut),Q(o.text,Et,qt?yu:Ut);const Ht=yt.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(re=>{re>=0&&(o.text.placedSymbolArray.get(re).hidden=Ht||Bt?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Ht||qt?1:0);const me=this.variableOffsets[K.crossTileID];me&&this.markUsedJustification(o,me.anchor,K,Pt);const Ae=this.placedOrientations[K.crossTileID];Ae&&(this.markUsedJustification(o,"left",K,Ae),this.markUsedOrientation(o,Ae,K))}if(kt){const Ut=io(yt.icon),Ht=!(q&&K.verticalPlacedIconSymbolIndex&&Bt);K.placedIconSymbolIndex>=0&&(Q(o.icon,K.numIconVertices,Ht?Ut:yu),o.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=yt.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(Q(o.icon,K.numVerticalIconVertices,Ht?yu:Ut),o.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=yt.icon.isHidden())}if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const Ut=o.collisionArrays[nt];if(Ut){let Ht=new u.P(0,0);if(Ut.textBox||Ut.verticalTextBox){let Ae=!0;if(A){const re=this.variableOffsets[st];re?(Ht=Vi(re.anchor,re.width,re.height,re.textOffset,re.textBoxScale),R&&Ht._rotate(z?this.transform.angle:-this.transform.angle)):Ae=!1}Ut.textBox&&nr(o.textCollisionBox.collisionVertexArray,yt.text.placed,!Ae||Bt,Ht.x,Ht.y),Ut.verticalTextBox&&nr(o.textCollisionBox.collisionVertexArray,yt.text.placed,!Ae||qt,Ht.x,Ht.y)}const me=!!(!qt&&Ut.verticalIconBox);Ut.iconBox&&nr(o.iconCollisionBox.collisionVertexArray,yt.icon.placed,me,q?Ht.x:0,q?Ht.y:0),Ut.verticalIconBox&&nr(o.iconCollisionBox.collisionVertexArray,yt.icon.placed,!me,q?Ht.x:0,q?Ht.y:0)}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const nt=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=nt.invProjMatrix,o.placementViewportMatrix=nt.viewportMatrix,o.collisionCircleArray=nt.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTimeo}setStale(){this.stale=!0}}function nr(_,o,h,d,g){_.emplaceBack(o?1:0,h?1:0,d||0,g||0),_.emplaceBack(o?1:0,h?1:0,d||0,g||0),_.emplaceBack(o?1:0,h?1:0,d||0,g||0),_.emplaceBack(o?1:0,h?1:0,d||0,g||0)}const Is=Math.pow(2,25),td=Math.pow(2,24),ng=Math.pow(2,17),Pn=Math.pow(2,16),Qh=Math.pow(2,9),$h=Math.pow(2,8),vo=Math.pow(2,1);function io(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const o=_.placed?1:0,h=Math.floor(127*_.opacity);return h*Is+o*td+h*ng+o*Pn+h*Qh+o*$h+h*vo+o}const yu=0;class Oo{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,h,d,g,y){const E=this._bucketParts;for(;this._currentTileIndexC.sortKey-L.sortKey));this._currentPartIndex!this._forceFullPlacement&&P.now()-g>2;for(;this._currentPlacementIndex>=0;){const E=h[o[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(E.type==="symbol"&&(!E.minzoom||E.minzoom<=C)&&(!E.maxzoom||E.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new Oo(E)),this._inProgressLayer.continuePlacement(d[E.source],this.placement,this._showCollisionBoxes,E,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Rl=512/u.W/2;class mc{constructor(o,h,d){this.tileID=o,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let y=0;y({x:Math.floor(L.anchorX*Rl),y:Math.floor(L.anchorY*Rl)})),crossTileIDs:E.map(L=>L.crossTileID)};if(C.positions.length>128){const L=new u.au(C.positions.length,16,Uint16Array);for(const{x:A,y:R}of C.positions)L.add(A,R);L.finish(),delete C.positions,C.index=L}this._symbolsByKey[y]=C}}getScaledCoordinates(o,h){const{x:d,y:g,z:y}=this.tileID.canonical,{x:E,y:C,z:L}=h.canonical,A=Rl/Math.pow(2,L-y),R=(C*u.W+o.anchorY)*A,z=g*u.W*Rl;return{x:Math.floor((E*u.W+o.anchorX)*A-d*u.W*Rl),y:Math.floor(R-z)}}findMatches(o,h,d){const g=this.tileID.canonical.zo)}}class Oi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class vu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const h=Math.round((o-this.lng)/360);if(h!==0)for(const d in this.indexes){const g=this.indexes[d],y={};for(const E in g){const C=g[E];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+h),y[C.tileID.key]=C}this.indexes[d]=y}this.lng=o}addBucket(o,h,d){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let y=0;yo.overscaledZ)for(const C in E){const L=E[C];L.tileID.isChildOf(o)&&L.findMatches(h.symbolInstances,o,g)}else{const C=E[o.scaledTo(Number(y)).key];C&&C.findMatches(h.symbolInstances,o,g)}}for(let y=0;y{h[d]=!0});for(const d in this.layerIndexes)h[d]||delete this.layerIndexes[d]}}const oi=(_,o)=>u.t(_,o&&o.filter(h=>h.identifier!=="source.canvas")),gc=u.av();class xo extends u.E{constructor(o,h={}){super(),this._rtlTextPluginStateChange=()=>{for(const d in this.sourceCaches){const g=this.sourceCaches[d].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[d].reload()}},this.map=o,this.dispatcher=new Ue(Kt(),o._getMapId()),this.dispatcher.registerMessageHandler("getGlyphs",(d,g)=>this.getGlyphs(d,g)),this.dispatcher.registerMessageHandler("getImages",(d,g)=>this.getImages(d,g)),this.imageManager=new Tt,this.imageManager.setEventedParent(this),this.glyphManager=new Oe(o._requestManager,h.localIdeographFontFamily),this.lineAtlas=new Me(256,512),this.crossTileSymbolIndex=new Ea,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",u.ax()),Wt().on("pluginStateChange",this._rtlTextPluginStateChange),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const g=this.sourceCaches[d.sourceId];if(!g)return;const y=g.getSource();if(y&&y.vectorLayerIds)for(const E in this._layers){const C=this._layers[E];C.source===y.id&&this._validateLayer(C)}})}loadURL(o,h={},d){this.fire(new u.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const g=this.map._requestManager.transformRequest(o,J.Style);this._loadStyleRequest=new AbortController,u.h(g,this._loadStyleRequest).then(y=>{this._loadStyleRequest=null,this._load(y.data,h,d)}).catch(y=>{this._loadStyleRequest=null,y&&this.fire(new u.j(y))})}loadJSON(o,h={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,P.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,h.validate=h.validate!==!1,this._load(o,h,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(gc,{validate:!1})}_load(o,h,d){var g;const y=h.transformStyle?h.transformStyle(d,o):o;if(!h.validate||!oi(this,u.x(y))){this._loaded=!0,this.stylesheet=y;for(const E in y.sources)this.addSource(E,y.sources[E],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new Re(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const o=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",o),this._order=o.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of o){const d=u.az(h);d.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=d}}_loadSprite(o,h=!1,d=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(y,E,C,L){return u._(this,void 0,void 0,function*(){const A=mt(y),R=C>1?"@2x":"",z={},q={};for(const{id:et,url:Q}of A){const nt=E.transformRequest(E.normalizeSpriteURL(Q,R,".json"),J.SpriteJSON);z[et]=u.h(nt,L);const K=E.transformRequest(E.normalizeSpriteURL(Q,R,".png"),J.SpriteImage);q[et]=X.getImage(K,L)}return yield Promise.all([...Object.values(z),...Object.values(q)]),function(et,Q){return u._(this,void 0,void 0,function*(){const nt={};for(const K in et){nt[K]={};const pt=P.getImageCanvasContext((yield Q[K]).data),Et=(yield et[K]).data;for(const st in Et){const{width:yt,height:kt,x:Pt,y:Bt,sdf:qt,pixelRatio:Ut,stretchX:Ht,stretchY:me,content:Ae}=Et[st];nt[K][st]={data:null,pixelRatio:Ut,sdf:qt,stretchX:Ht,stretchY:me,content:Ae,spriteData:{width:yt,height:kt,x:Pt,y:Bt,context:pt}}}}return nt})}(z,q)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(y=>{if(this._spriteRequest=null,y)for(const E in y){this._spritesImagesIds[E]=[];const C=this._spritesImagesIds[E]?this._spritesImagesIds[E].filter(L=>!(L in y)):[];for(const L of C)this.imageManager.removeImage(L),this._changedImages[L]=!0;for(const L in y[E]){const A=E==="default"?L:`${E}:${L}`;this._spritesImagesIds[E].push(A),A in this.imageManager.images?this.imageManager.updateImage(A,y[E][L],!1):this.imageManager.addImage(A,y[E][L]),h&&(this._changedImages[A]=!0)}}}).catch(y=>{this._spriteRequest=null,g=y,this.fire(new u.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(o){const h=this.sourceCaches[o.source];if(!h)return;const d=o.sourceLayer;if(!d)return;const g=h.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o){const h=this._serializedAllLayers();if(!o||o.length===0)return Object.values(h);const d=[];for(const g of o)h[g]&&d.push(h[g]);return d}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const h=Object.keys(this._layers);for(const d of h){const g=this._layers[d];g.type!=="custom"&&(o[d]=g.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const h=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(g.length||y.length)&&this._updateWorkerLayers(g,y);for(const E in this._updatedSources){const C=this._updatedSources[E];if(C==="reload")this._reloadSource(E);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(E)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const E in this._updatedPaintProps)this._layers[E].updateTransitions(o);this.light.updateTransitions(o),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const y=this.sourceCaches[g];d[g]=y.used,y.used=!1}for(const g of this._order){const y=this._layers[g];y.recalculate(o,this._availableImages),!y.isHidden(o.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const g in d){const y=this.sourceCaches[g];d[g]!==y.used&&y.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(o),this.z=o.zoom,h&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(o),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,h={}){var d;this._checkLoaded();const g=this.serialize();if(o=h.transformStyle?h.transformStyle(g,o):o,((d=h.validate)===null||d===void 0||d)&&oi(this,u.x(o)))return!1;(o=u.aA(o)).layers=u.ay(o.layers);const y=u.aB(g,o),E=this._getOperationsToPerform(y);if(E.unimplemented.length>0)throw new Error(`Unimplemented: ${E.unimplemented.join(", ")}.`);if(E.operations.length===0)return!1;for(const C of E.operations)C();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const h=[],d=[];for(const g of o)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":h.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":h.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":h.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":h.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":h.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":h.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":h.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":h.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":h.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":h.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":h.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":h.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":h.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":h.push(()=>{});break;default:d.push(g.command)}return{operations:h,unimplemented:d}}addImage(o,h){if(this.getImage(o))return this.fire(new u.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,h),this._afterImageUpdated(o)}updateImage(o,h){this.imageManager.updateImage(o,h)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new u.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,h,d={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(u.x.source,`sources.${o}`,h,null,d))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const g=this.sourceCaches[o]=new Ni(o,h,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:o})),g.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===o)return this.fire(new u.j(new Error(`Source "${o}" cannot be removed while layer "${d}" is using it.`)));const h=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],h.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,h){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const d=this.sourceCaches[o].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(h),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,h,d={}){this._checkLoaded();const g=o.id;if(this.getLayer(g))return void this.fire(new u.j(new Error(`Layer "${g}" already exists on this map.`)));let y;if(o.type==="custom"){if(oi(this,u.aC(o)))return;y=u.az(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(g,o.source),o=u.aA(o),o=u.e(o,{source:g})),this._validate(u.x.layer,`layers.${g}`,o,{arrayIndex:-1},d))return;y=u.az(o),this._validateLayer(y),y.setEventedParent(this,{layer:{id:g}})}const E=h?this._order.indexOf(h):this._order.length;if(h&&E===-1)this.fire(new u.j(new Error(`Cannot add layer "${g}" before non-existing layer "${h}".`)));else{if(this._order.splice(E,0,g),this._layerOrderChanged=!0,this._layers[g]=y,this._removedLayers[g]&&y.source&&y.type!=="custom"){const C=this._removedLayers[g];delete this._removedLayers[g],C.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(o,h){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new u.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===h)return;const d=this._order.indexOf(o);this._order.splice(d,1);const g=h?this._order.indexOf(h):this._order.length;h&&g===-1?this.fire(new u.j(new Error(`Cannot move layer "${o}" before non-existing layer "${h}".`))):(this._order.splice(g,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const h=this._layers[o];if(!h)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${o}".`)));h.setEventedParent(null);const d=this._order.indexOf(o);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=h,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],h.onRemove&&h.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,h,d){this._checkLoaded();const g=this.getLayer(o);g?g.minzoom===h&&g.maxzoom===d||(h!=null&&(g.minzoom=h),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,h,d={}){this._checkLoaded();const g=this.getLayer(o);if(g){if(!u.aD(g.filter,h))return h==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(u.x.filter,`layers.${g.id}.filter`,h,null,d)||(g.filter=u.aA(h),this._updateLayer(g)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return u.aA(this.getLayer(o).filter)}setLayoutProperty(o,h,d,g={}){this._checkLoaded();const y=this.getLayer(o);y?u.aD(y.getLayoutProperty(h),d)||(y.setLayoutProperty(h,d,g),this._updateLayer(y)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,h){const d=this.getLayer(o);if(d)return d.getLayoutProperty(h);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,h,d,g={}){this._checkLoaded();const y=this.getLayer(o);y?u.aD(y.getPaintProperty(h),d)||(y.setPaintProperty(h,d,g)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[o]=!0):this.fire(new u.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,h){return this.getLayer(o).getPaintProperty(h)}setFeatureState(o,h){this._checkLoaded();const d=o.source,g=o.sourceLayer,y=this.sourceCaches[d];if(y===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const E=y.getSource().type;E==="geojson"&&g?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):E!=="vector"||g?(o.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),y.setFeatureState(g,o.id,h)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,h){this._checkLoaded();const d=o.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const y=g.getSource().type,E=y==="vector"?o.sourceLayer:void 0;y!=="vector"||E?h&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(E,o.id,h):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const h=o.source,d=o.sourceLayer,g=this.sourceCaches[h];if(g!==void 0)return g.getSource().type!=="vector"||d?(o.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,o.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 '${h}' 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 o=u.aE(this.sourceCaches,y=>y.serialize()),h=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return u.aF({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:o,layers:h,terrain:d},y=>y!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const h=E=>this._layers[E].type==="fill-extrusion",d={},g=[];for(let E=this._order.length-1;E>=0;E--){const C=this._order[E];if(h(C)){d[C]=E;for(const L of o){const A=L[C];if(A)for(const R of A)g.push(R)}}}g.sort((E,C)=>C.intersectionZ-E.intersectionZ);const y=[];for(let E=this._order.length-1;E>=0;E--){const C=this._order[E];if(h(C))for(let L=g.length-1;L>=0;L--){const A=g[L].feature;if(d[A.layer.id]{const qt=pt.featureSortOrder;if(qt){const Ut=qt.indexOf(Pt.featureIndex);return qt.indexOf(Bt.featureIndex)-Ut}return Bt.featureIndex-Pt.featureIndex});for(const Pt of kt)yt.push(Pt)}}for(const pt in Q)Q[pt].forEach(Et=>{const st=Et.feature,yt=A[C[pt].source].getFeatureState(st.layer["source-layer"],st.id);st.source=st.layer.source,st.layer["source-layer"]&&(st.sourceLayer=st.layer["source-layer"]),st.state=yt});return Q}(this._layers,E,this.sourceCaches,o,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(o,h){h&&h.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",h.filter,null,h);const d=this.sourceCaches[o];return d?function(g,y){const E=g.getRenderableIds().map(A=>g.getTileByID(A)),C=[],L={};for(let A=0;Aq.getTileByID(et)).sort((et,Q)=>Q.tileID.overscaledZ-et.tileID.overscaledZ||(et.tileID.isLessThan(Q.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(R,L[R.source],o.center.lng);E=E||z}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(P.now(),o.zoom))&&(this.pauseablePlacement=new Fo(o,this.map.terrain,this._order,y,h,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,L),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(P.now()),C=!0),E&&this.pauseablePlacement.placement.setStale()),C||E)for(const A of this._order){const R=this._layers[A];R.type==="symbol"&&this.placement.updateLayerOpacities(R,L[R.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(P.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,h){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(h.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[h.source];return g&&g.setDependencies(h.tileID.key,h.type,h.icons),d})}getGlyphs(o,h){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(h.stacks),g=this.sourceCaches[h.source];return g&&g.setDependencies(h.tileID.key,h.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,h={}){this._checkLoaded(),o&&this._validate(u.x.glyphs,"glyphs",o,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,h,d={},g){this._checkLoaded();const y=[{id:o,url:h}],E=[...mt(this.stylesheet.sprite),...y];this._validate(u.x.sprite,"sprite",E,null,d)||(this.stylesheet.sprite=E,this._loadSprite(y,!0,g))}removeSprite(o){this._checkLoaded();const h=mt(this.stylesheet.sprite);if(h.find(d=>d.id===o)){if(this._spritesImagesIds[o])for(const d of this._spritesImagesIds[o])this.imageManager.removeImage(d),this._changedImages[d]=!0;h.splice(h.findIndex(d=>d.id===o),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return mt(this.stylesheet.sprite)}setSprite(o,h={},d){this._checkLoaded(),o&&this._validate(u.x.sprite,"sprite",o,null,h)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,d):(this._unloadSprite(),d&&d(null)))}}var _c=u.X([{name:"a_pos",type:"Int16",components:2}]),Es="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 xu={prelude:Mn(`#ifdef GL_ES + */(function(t,e){(function(n,i){t.exports=i()})(L1,function(){var n={},i={};function a(p,u,b){if(i[p]=b,p==="index"){var w="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",T={};return i.shared(T),i.index(n,T),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([w],{type:"text/javascript"}))),n}}a("shared",["exports"],function(p){function u(s,r,l,f){return new(l||(l=Promise))(function(m,v){function x(M){try{S(f.next(M))}catch(D){v(D)}}function I(M){try{S(f.throw(M))}catch(D){v(D)}}function S(M){var D;M.done?m(M.value):(D=M.value,D instanceof l?D:new l(function(N){N(D)})).then(x,I)}S((f=f.apply(s,r||[])).next())})}function b(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var w=T;function T(s,r){this.x=s,this.y=r}T.prototype={clone:function(){return new T(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,r){return this.clone()._rotateAround(s,r)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var r=s.x-this.x,l=s.y-this.y;return r*r+l*l},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,r){return Math.atan2(this.x*r-this.y*s,this.x*s+this.y*r)},_matMult:function(s){var r=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=r,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var r=Math.cos(s),l=Math.sin(s),f=l*this.x+r*this.y;return this.x=r*this.x-l*this.y,this.y=f,this},_rotateAround:function(s,r){var l=Math.cos(s),f=Math.sin(s),m=r.y+f*(this.x-r.x)+l*(this.y-r.y);return this.x=r.x+l*(this.x-r.x)-f*(this.y-r.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},T.convert=function(s){return s instanceof T?s:Array.isArray(s)?new T(s[0],s[1]):s};var P=b(w),k=B;function B(s,r,l,f){this.cx=3*s,this.bx=3*(l-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(f-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=r,this.p2x=l,this.p2y=f}B.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,r){if(r===void 0&&(r=1e-6),s<0)return 0;if(s>1)return 1;for(var l=s,f=0;f<8;f++){var m=this.sampleCurveX(l)-s;if(Math.abs(m)m?x=l:I=l,l=.5*(I-x)+x;return l},solve:function(s,r){return this.sampleCurveY(this.solveCurveX(s,r))}};var V=b(k);let tt,ot;function ut(){return tt==null&&(tt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),tt}function W(){if(ot==null&&(ot=!1,ut())){const r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let f=0;f<5*5;f++){const m=4*f;r.fillStyle=`rgb(${m},${m+1},${m+2})`,r.fillRect(f%5,Math.floor(f/5),1,1)}const l=r.getImageData(0,0,5,5).data;for(let f=0;f<5*5*4;f++)if(f%4!=3&&l[f]!==f){ot=!0;break}}}return ot||!1}function X(s,r,l,f){const m=new V(s,r,l,f);return function(v){return m.solve(v)}}const J=X(.25,.1,.25,1);function ht(s,r,l){return Math.min(l,Math.max(r,s))}function vt(s,r,l){const f=l-r,m=((s-r)%f+f)%f+r;return m===r?l:m}function gt(s,...r){for(const l of r)for(const f in l)s[f]=l[f];return s}let St=1;function It(s,r,l){const f={};for(const m in s)f[m]=r.call(l||this,s[m],m,s);return f}function Ft(s,r,l){const f={};for(const m in s)r.call(l||this,s[m],m,s)&&(f[m]=s[m]);return f}function mt(s){return Array.isArray(s)?s.map(mt):typeof s=="object"&&s?It(s,mt):s}const Ct={};function ie(s){Ct[s]||(typeof console<"u"&&console.warn(s),Ct[s]=!0)}function Tt(s,r,l){return(l.y-s.y)*(r.x-s.x)>(r.y-s.y)*(l.x-s.x)}function ee(s){let r=0;for(let l,f,m=0,v=s.length,x=v-1;m"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(s,{timestamp:0});try{const x=v==null?void 0:v.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const I=x.startsWith("BGR"),S=new Uint8ClampedArray(f*m*4);if(yield v.copyTo(S,function(M,D,N,F,G){const j=4*Math.max(-D,0),Y=(Math.max(0,N)-N)*F*4+j,it=4*F,at=Math.max(0,D),bt=Math.max(0,N);return{rect:{x:at,y:bt,width:Math.min(M.width,D+F)-at,height:Math.min(M.height,N+G)-bt},layout:[{offset:Y,stride:it}]}}(s,r,l,f,m)),I)for(let M=0;Mge(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,yn=function(s,r){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const f=Wn(s.url);if(f)return f(s,r);if(ge(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:s,targetMapId:ri},r)}if(!(/^file:/.test(l=s.url)||/^file:/.test(Ue())&&!/^\w+:/.test(l))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(f,m){return u(this,void 0,void 0,function*(){const v=new Request(f.url,{method:f.method||"GET",body:f.body,credentials:f.credentials,headers:f.headers,cache:f.cache,referrer:Ue(),signal:m.signal});f.type==="json"&&v.headers.set("Accept","application/json");const x=yield fetch(v);if(!x.ok){const M=yield x.blob();throw new Kt(x.status,x.statusText,f.url,M)}const I=f.type==="arrayBuffer"||f.type==="image"?x.arrayBuffer():f.type==="json"?x.json():x.text(),S=yield I;if(m.signal.aborted)throw qn();return{data:S,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(s,r);if(ge(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"getResource",data:s,mustQueue:!0,targetMapId:ri},r)}var l;return function(f,m){return new Promise((v,x)=>{const I=new XMLHttpRequest;I.open(f.method||"GET",f.url,!0),f.type!=="arrayBuffer"&&f.type!=="image"||(I.responseType="arraybuffer");for(const S in f.headers)I.setRequestHeader(S,f.headers[S]);f.type==="json"&&(I.responseType="text",I.setRequestHeader("Accept","application/json")),I.withCredentials=f.credentials==="include",I.onerror=()=>{x(new Error(I.statusText))},I.onload=()=>{if(!m.signal.aborted)if((I.status>=200&&I.status<300||I.status===0)&&I.response!==null){let S=I.response;if(f.type==="json")try{S=JSON.parse(I.response)}catch(M){return void x(M)}v({data:S,cacheControl:I.getResponseHeader("Cache-Control"),expires:I.getResponseHeader("Expires")})}else{const S=new Blob([I.response],{type:I.getResponseHeader("Content-Type")});x(new Kt(I.status,I.statusText,f.url,S))}},m.signal.addEventListener("abort",()=>{I.abort(),x(qn())}),I.send(f.body)})}(s,r)};function br(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const r=new URL(s),l=window.location;return r.protocol===l.protocol&&r.host===l.host}function er(s,r,l){l[s]&&l[s].indexOf(r)!==-1||(l[s]=l[s]||[],l[s].push(r))}function Gt(s,r,l){if(l&&l[s]){const f=l[s].indexOf(r);f!==-1&&l[s].splice(f,1)}}class Fe{constructor(r,l={}){gt(this,l),this.type=r}}class Ie extends Fe{constructor(r,l={}){super("error",gt({error:r},l))}}class Ri{on(r,l){return this._listeners=this._listeners||{},er(r,l,this._listeners),this}off(r,l){return Gt(r,l,this._listeners),Gt(r,l,this._oneTimeListeners),this}once(r,l){return l?(this._oneTimeListeners=this._oneTimeListeners||{},er(r,l,this._oneTimeListeners),this):new Promise(f=>this.once(r,f))}fire(r,l){typeof r=="string"&&(r=new Fe(r,l||{}));const f=r.type;if(this.listens(f)){r.target=this;const m=this._listeners&&this._listeners[f]?this._listeners[f].slice():[];for(const I of m)I.call(this,r);const v=this._oneTimeListeners&&this._oneTimeListeners[f]?this._oneTimeListeners[f].slice():[];for(const I of v)Gt(f,I,this._oneTimeListeners),I.call(this,r);const x=this._eventedParent;x&&(gt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(r))}else r instanceof Ie&&console.error(r.error);return this}listens(r){return this._listeners&&this._listeners[r]&&this._listeners[r].length>0||this._oneTimeListeners&&this._oneTimeListeners[r]&&this._oneTimeListeners[r].length>0||this._eventedParent&&this._eventedParent.listens(r)}setEventedParent(r,l){return this._eventedParent=r,this._eventedParentData=l,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 sn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Bi(s,r){const l={};for(const f in s)f!=="ref"&&(l[f]=s[f]);return sn.forEach(f=>{f in r&&(l[f]=r[f])}),l}function Qe(s,r){if(Array.isArray(s)){if(!Array.isArray(r)||s.length!==r.length)return!1;for(let l=0;l`:s.itemType.kind==="value"?"array":`array<${r}>`}return s.kind}const ft=[Ni,Jt,He,je,yi,Ii,zo,Z(Ge),rt,O,U];function H(s,r){if(r.kind==="error")return null;if(s.kind==="array"){if(r.kind==="array"&&(r.N===0&&r.itemType.kind==="value"||!H(s.itemType,r.itemType))&&(typeof s.N!="number"||s.N===r.N))return null}else{if(s.kind===r.kind)return null;if(s.kind==="value"){for(const l of ft)if(!H(l,r))return null}}return`Expected ${$(s)} but found ${$(r)} instead.`}function dt(s,r){return r.some(l=>l.kind===s.kind)}function lt(s,r){return r.some(l=>l==="null"?s===null:l==="array"?Array.isArray(s):l==="object"?s&&!Array.isArray(s)&&typeof s=="object":l===typeof s)}function xt(s,r){return s.kind==="array"&&r.kind==="array"?s.itemType.kind===r.itemType.kind&&typeof s.N=="number":s.kind===r.kind}const At=.96422,Rt=.82521,Nt=4/29,xe=6/29,Ee=3*xe*xe,ze=xe*xe*xe,Be=Math.PI/180,fn=180/Math.PI;function Rn(s){return(s%=360)<0&&(s+=360),s}function ti([s,r,l,f]){let m,v;const x=Ke((.2225045*(s=zi(s))+.7168786*(r=zi(r))+.0606169*(l=zi(l)))/1);s===r&&r===l?m=v=x:(m=Ke((.4360747*s+.3850649*r+.1430804*l)/At),v=Ke((.0139322*s+.0971045*r+.7141733*l)/Rt));const I=116*x-16;return[I<0?0:I,500*(m-x),200*(x-v),f]}function zi(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Ke(s){return s>ze?Math.pow(s,1/3):s/Ee+Nt}function ui([s,r,l,f]){let m=(s+16)/116,v=isNaN(r)?m:m+r/500,x=isNaN(l)?m:m-l/200;return m=1*Vr(m),v=At*Vr(v),x=Rt*Vr(x),[Vi(3.1338561*v-1.6168667*m-.4906146*x),Vi(-.9787684*v+1.9161415*m+.033454*x),Vi(.0719453*v-.2289914*m+1.4052427*x),f]}function Vi(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Vr(s){return s>xe?s*s*s:Ee*(s-Nt)}function no(s){return parseInt(s.padEnd(2,s),16)/255}function nr(s,r){return Is(r?s/100:s,0,1)}function Is(s,r,l){return Math.min(Math.max(r,s),l)}function td(s){return!s.some(Number.isNaN)}const ng={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 Pn{constructor(r,l,f,m=1,v=!0){this.r=r,this.g=l,this.b=f,this.a=m,v||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[r,l,f,m]))}static parse(r){if(r instanceof Pn)return r;if(typeof r!="string")return;const l=function(f){if((f=f.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=ng[f];if(m){const[x,I,S]=m;return[x/255,I/255,S/255,1]}if(f.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(f)){const x=f.length<6?1:2;let I=1;return[no(f.slice(I,I+=x)),no(f.slice(I,I+=x)),no(f.slice(I,I+=x)),no(f.slice(I,I+x)||"ff")]}if(f.startsWith("rgb")){const x=f.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[I,S,M,D,N,F,G,j,Y,it,at,bt]=x,ct=[D||" ",G||" ",it].join("");if(ct===" "||ct===" /"||ct===",,"||ct===",,,"){const _t=[M,F,Y].join(""),Ot=_t==="%%%"?100:_t===""?255:0;if(Ot){const Vt=[Is(+S/Ot,0,1),Is(+N/Ot,0,1),Is(+j/Ot,0,1),at?nr(+at,bt):1];if(td(Vt))return Vt}}return}}const v=f.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[x,I,S,M,D,N,F,G,j]=v,Y=[S||" ",D||" ",F].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const it=[+I,Is(+M,0,100),Is(+N,0,100),G?nr(+G,j):1];if(td(it))return function([at,bt,ct,_t]){function Ot(Vt){const ue=(Vt+at/30)%12,ve=bt*Math.min(ct,1-ct);return ct-ve*Math.max(-1,Math.min(ue-3,9-ue,1))}return at=Rn(at),bt/=100,ct/=100,[Ot(0),Ot(8),Ot(4),_t]}(it)}}}(r);return l?new Pn(...l,!1):void 0}get rgb(){const{r,g:l,b:f,a:m}=this,v=m||1/0;return this.overwriteGetter("rgb",[r/v,l/v,f/v,m])}get hcl(){return this.overwriteGetter("hcl",function(r){const[l,f,m,v]=ti(r),x=Math.sqrt(f*f+m*m);return[Math.round(1e4*x)?Rn(Math.atan2(m,f)*fn):NaN,x,l,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ti(this.rgb))}overwriteGetter(r,l){return Object.defineProperty(this,r,{value:l}),l}toString(){const[r,l,f,m]=this.rgb;return`rgba(${[r,l,f].map(v=>Math.round(255*v)).join(",")},${m})`}}Pn.black=new Pn(0,0,0,1),Pn.white=new Pn(1,1,1,1),Pn.transparent=new Pn(0,0,0,0),Pn.red=new Pn(1,0,0,1);class Qh{constructor(r,l,f){this.sensitivity=r?l?"variant":"case":l?"accent":"base",this.locale=f,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(r,l){return this.collator.compare(r,l)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class $h{constructor(r,l,f,m,v){this.text=r,this.image=l,this.scale=f,this.fontStack=m,this.textColor=v}}class vo{constructor(r){this.sections=r}static fromString(r){return new vo([new $h(r,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(r=>r.text.length!==0||r.image&&r.image.name.length!==0)}static factory(r){return r instanceof vo?r:vo.fromString(r)}toString(){return this.sections.length===0?"":this.sections.map(r=>r.text).join("")}}class io{constructor(r){this.values=r.slice()}static parse(r){if(r instanceof io)return r;if(typeof r=="number")return new io([r,r,r,r]);if(Array.isArray(r)&&!(r.length<1||r.length>4)){for(const l of r)if(typeof l!="number")return;switch(r.length){case 1:r=[r[0],r[0],r[0],r[0]];break;case 2:r=[r[0],r[1],r[0],r[1]];break;case 3:r=[r[0],r[1],r[2],r[1]]}return new io(r)}}toString(){return JSON.stringify(this.values)}}const yu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Oo{constructor(r){this.values=r.slice()}static parse(r){if(r instanceof Oo)return r;if(Array.isArray(r)&&!(r.length<1)&&r.length%2==0){for(let l=0;l=0&&s<=255&&typeof r=="number"&&r>=0&&r<=255&&typeof l=="number"&&l>=0&&l<=255?f===void 0||typeof f=="number"&&f>=0&&f<=1?null:`Invalid rgba value [${[s,r,l,f].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof f=="number"?[s,r,l,f]:[s,r,l]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function mc(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Pn||s instanceof Qh||s instanceof vo||s instanceof io||s instanceof Oo||s instanceof Fo)return!0;if(Array.isArray(s)){for(const r of s)if(!mc(r))return!1;return!0}if(typeof s=="object"){for(const r in s)if(!mc(s[r]))return!1;return!0}return!1}function Oi(s){if(s===null)return Ni;if(typeof s=="string")return He;if(typeof s=="boolean")return je;if(typeof s=="number")return Jt;if(s instanceof Pn)return yi;if(s instanceof Qh)return ea;if(s instanceof vo)return Ii;if(s instanceof io)return rt;if(s instanceof Oo)return U;if(s instanceof Fo)return O;if(Array.isArray(s)){const r=s.length;let l;for(const f of s){const m=Oi(f);if(l){if(l===m)continue;l=Ge;break}l=m}return Z(l||Ge,r)}return zo}function vu(s){const r=typeof s;return s===null?"":r==="string"||r==="number"||r==="boolean"?String(s):s instanceof Pn||s instanceof vo||s instanceof io||s instanceof Oo||s instanceof Fo?s.toString():JSON.stringify(s)}class Ea{constructor(r,l){this.type=r,this.value=l}static parse(r,l){if(r.length!==2)return l.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!mc(r[1]))return l.error("invalid value");const f=r[1];let m=Oi(f);const v=l.expectedType;return m.kind!=="array"||m.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(m=v),new Ea(m,f)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class oi{constructor(r){this.name="ExpressionEvaluationError",this.message=r}toJSON(){return this.message}}const gc={string:He,number:Jt,boolean:je,object:zo};class xo{constructor(r,l){this.type=r,this.args=l}static parse(r,l){if(r.length<2)return l.error("Expected at least one argument.");let f,m=1;const v=r[0];if(v==="array"){let I,S;if(r.length>2){const M=r[1];if(typeof M!="string"||!(M in gc)||M==="object")return l.error('The item type argument of "array" must be one of string, number, boolean',1);I=gc[M],m++}else I=Ge;if(r.length>3){if(r[2]!==null&&(typeof r[2]!="number"||r[2]<0||r[2]!==Math.floor(r[2])))return l.error('The length argument to "array" must be a positive integer literal',2);S=r[2],m++}f=Z(I,S)}else{if(!gc[v])throw new Error(`Types doesn't contain name = ${v}`);f=gc[v]}const x=[];for(;mr.outputDefined())}}const _c={"to-boolean":je,"to-color":yi,"to-number":Jt,"to-string":He};class Es{constructor(r,l){this.type=r,this.args=l}static parse(r,l){if(r.length<2)return l.error("Expected at least one argument.");const f=r[0];if(!_c[f])throw new Error(`Can't parse ${f} as it is not part of the known types`);if((f==="to-boolean"||f==="to-string")&&r.length!==2)return l.error("Expected one argument.");const m=_c[f],v=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(l)}: expected an array containing either three or four numeric values.`:Rl(l[0],l[1],l[2],l[3]),!f))return new Pn(l[0]/255,l[1]/255,l[2]/255,l[3])}throw new oi(f||`Could not parse color from value '${typeof l=="string"?l:JSON.stringify(l)}'`)}case"padding":{let l;for(const f of this.args){l=f.evaluate(r);const m=io.parse(l);if(m)return m}throw new oi(`Could not parse padding from value '${typeof l=="string"?l:JSON.stringify(l)}'`)}case"variableAnchorOffsetCollection":{let l;for(const f of this.args){l=f.evaluate(r);const m=Oo.parse(l);if(m)return m}throw new oi(`Could not parse variableAnchorOffsetCollection from value '${typeof l=="string"?l:JSON.stringify(l)}'`)}case"number":{let l=null;for(const f of this.args){if(l=f.evaluate(r),l===null)return 0;const m=Number(l);if(!isNaN(m))return m}throw new oi(`Could not convert ${JSON.stringify(l)} to number.`)}case"formatted":return vo.fromString(vu(this.args[0].evaluate(r)));case"resolvedImage":return Fo.fromString(vu(this.args[0].evaluate(r)));default:return vu(this.args[0].evaluate(r))}}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}}const xu=["Unknown","Point","LineString","Polygon"];class Mn{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"?xu[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(r){let l=this._parseColorCache[r];return l||(l=this._parseColorCache[r]=Pn.parse(r)),l}}class yc{constructor(r,l,f=[],m,v=new Ja,x=[]){this.registry=r,this.path=f,this.key=f.map(I=>`[${I}]`).join(""),this.scope=v,this.errors=x,this.expectedType=m,this._isConstant=l}parse(r,l,f,m,v={}){return l?this.concat(l,f,m)._parse(r,v):this._parse(r,v)}_parse(r,l){function f(m,v,x){return x==="assert"?new xo(v,[m]):x==="coerce"?new Es(v,[m]):m}if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"||(r=["literal",r]),Array.isArray(r)){if(r.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=r[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[m];if(v){let x=v.parse(r,this);if(!x)return null;if(this.expectedType){const I=this.expectedType,S=x.type;if(I.kind!=="string"&&I.kind!=="number"&&I.kind!=="boolean"&&I.kind!=="object"&&I.kind!=="array"||S.kind!=="value")if(I.kind!=="color"&&I.kind!=="formatted"&&I.kind!=="resolvedImage"||S.kind!=="value"&&S.kind!=="string")if(I.kind!=="padding"||S.kind!=="value"&&S.kind!=="number"&&S.kind!=="array")if(I.kind!=="variableAnchorOffsetCollection"||S.kind!=="value"&&S.kind!=="array"){if(this.checkSubtype(I,S))return null}else x=f(x,I,l.typeAnnotation||"coerce");else x=f(x,I,l.typeAnnotation||"coerce");else x=f(x,I,l.typeAnnotation||"coerce");else x=f(x,I,l.typeAnnotation||"assert")}if(!(x instanceof Ea)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const I=new Mn;try{x=new Ea(x.type,x.evaluate(I))}catch(S){return this.error(S.message),null}}return x}return this.error(`Unknown expression "${m}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(r===void 0?"'undefined' value invalid. Use null instead.":typeof r=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof r} instead.`)}concat(r,l,f){const m=typeof r=="number"?this.path.concat(r):this.path,v=f?this.scope.concat(f):this.scope;return new yc(this.registry,this._isConstant,m,l||null,v,this.errors)}error(r,...l){const f=`${this.key}${l.map(m=>`[${m}]`).join("")}`;this.errors.push(new Br(f,r))}checkSubtype(r,l){const f=H(r,l);return f&&this.error(f),f}}class Nl{constructor(r,l,f){this.type=ea,this.locale=f,this.caseSensitive=r,this.diacriticSensitive=l}static parse(r,l){if(r.length!==2)return l.error("Expected one argument.");const f=r[1];if(typeof f!="object"||Array.isArray(f))return l.error("Collator options argument must be an object.");const m=l.parse(f["case-sensitive"]!==void 0&&f["case-sensitive"],1,je);if(!m)return null;const v=l.parse(f["diacritic-sensitive"]!==void 0&&f["diacritic-sensitive"],1,je);if(!v)return null;let x=null;return f.locale&&(x=l.parse(f.locale,1,He),!x)?null:new Nl(m,v,x)}evaluate(r){return new Qh(this.caseSensitive.evaluate(r),this.diacriticSensitive.evaluate(r),this.locale?this.locale.evaluate(r):null)}eachChild(r){r(this.caseSensitive),r(this.diacriticSensitive),this.locale&&r(this.locale)}outputDefined(){return!1}}const Sa=8192;function vc(s,r){s[0]=Math.min(s[0],r[0]),s[1]=Math.min(s[1],r[1]),s[2]=Math.max(s[2],r[0]),s[3]=Math.max(s[3],r[1])}function bu(s,r){return!(s[0]<=r[0]||s[2]>=r[2]||s[1]<=r[1]||s[3]>=r[3])}function ig(s,r){const l=(180+s[0])/360,f=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,m=Math.pow(2,r.z);return[Math.round(l*m*Sa),Math.round(f*m*Sa)]}function ed(s,r,l){const f=s[0]-r[0],m=s[1]-r[1],v=s[0]-l[0],x=s[1]-l[1];return f*x-v*m==0&&f*v<=0&&m*x<=0}function xc(s,r){let l=!1;for(let x=0,I=r.length;x(f=s)[1]!=(v=S[M+1])[1]>f[1]&&f[0]<(v[0]-m[0])*(f[1]-m[1])/(v[1]-m[1])+m[0]&&(l=!l)}}var f,m,v;return l}function rg(s,r){for(let l=0;l0&&I<0||x<0&&I>0}function og(s,r,l){for(const M of l)for(let D=0;Dl[2]){const m=.5*f;let v=s[0]-l[0]>m?-f:l[0]-s[0]>m?f:0;v===0&&(v=s[0]-l[2]>m?-f:l[2]-s[0]>m?f:0),s[0]+=v}vc(r,s)}function wc(s,r,l,f){const m=Math.pow(2,f.z)*Sa,v=[f.x*Sa,f.y*Sa],x=[];for(const I of s)for(const S of I){const M=[S.x+v[0],S.y+v[1]];sd(M,r,l,m),x.push(M)}return x}function ad(s,r,l,f){const m=Math.pow(2,f.z)*Sa,v=[f.x*Sa,f.y*Sa],x=[];for(const S of s){const M=[];for(const D of S){const N=[D.x+v[0],D.y+v[1]];vc(r,N),M.push(N)}x.push(M)}if(r[2]-r[0]<=m/2){(I=r)[0]=I[1]=1/0,I[2]=I[3]=-1/0;for(const S of x)for(const M of S)sd(M,r,l,m)}var I;return x}class Qa{constructor(r,l){this.type=je,this.geojson=r,this.geometries=l}static parse(r,l){if(r.length!==2)return l.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(mc(r[1])){const f=r[1];if(f.type==="FeatureCollection"){const m=[];for(const v of f.features){const{type:x,coordinates:I}=v.geometry;x==="Polygon"&&m.push(I),x==="MultiPolygon"&&m.push(...I)}if(m.length)return new Qa(f,{type:"MultiPolygon",coordinates:m})}else if(f.type==="Feature"){const m=f.geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new Qa(f,f.geometry)}else if(f.type==="Polygon"||f.type==="MultiPolygon")return new Qa(f,f)}return l.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(r){if(r.geometry()!=null&&r.canonicalID()!=null){if(r.geometryType()==="Point")return function(l,f){const m=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=l.canonicalID();if(f.type==="Polygon"){const I=bc(f.coordinates,v,x),S=wc(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!xc(M,I))return!1}if(f.type==="MultiPolygon"){const I=od(f.coordinates,v,x),S=wc(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!rg(M,I))return!1}return!0}(r,this.geometries);if(r.geometryType()==="LineString")return function(l,f){const m=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],x=l.canonicalID();if(f.type==="Polygon"){const I=bc(f.coordinates,v,x),S=ad(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!id(M,I))return!1}if(f.type==="MultiPolygon"){const I=od(f.coordinates,v,x),S=ad(l.geometry(),m,v,x);if(!bu(m,v))return!1;for(const M of S)if(!rd(M,I))return!1}return!0}(r,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ic{constructor(r,l){this.type=l.type,this.name=r,this.boundExpression=l}static parse(r,l){if(r.length!==2||typeof r[1]!="string")return l.error("'var' expression requires exactly one string literal argument.");const f=r[1];return l.scope.has(f)?new Ic(f,l.scope.get(f)):l.error(`Unknown variable "${f}". Make sure "${f}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(r){return this.boundExpression.evaluate(r)}eachChild(){}outputDefined(){return!1}}class bo{constructor(r,l,f,m){this.name=r,this.type=l,this._evaluate=f,this.args=m}evaluate(r){return this._evaluate(r,this.args)}eachChild(r){this.args.forEach(r)}outputDefined(){return!1}static parse(r,l){const f=r[0],m=bo.definitions[f];if(!m)return l.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(m)?m[0]:m.type,x=Array.isArray(m)?[[m[1],m[2]]]:m.overloads,I=x.filter(([M])=>!Array.isArray(M)||M.length===r.length-1);let S=null;for(const[M,D]of I){S=new yc(l.registry,wu,l.path,null,l.scope);const N=[];let F=!1;for(let G=1;G{return F=N,Array.isArray(F)?`(${F.map($).join(", ")})`:`(${$(F.type)}...)`;var F}).join(" | "),D=[];for(let N=1;N{l=r?l&&wu(f):l&&f instanceof Ea}),!!l&&Ec(s)&&Eu(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ec(s){if(s instanceof bo&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof Qa)return!1;let r=!0;return s.eachChild(l=>{r&&!Ec(l)&&(r=!1)}),r}function Iu(s){if(s instanceof bo&&s.name==="feature-state")return!1;let r=!0;return s.eachChild(l=>{r&&!Iu(l)&&(r=!1)}),r}function Eu(s,r){if(s instanceof bo&&r.indexOf(s.name)>=0)return!1;let l=!0;return s.eachChild(f=>{l&&!Eu(f,r)&&(l=!1)}),l}function Su(s,r){const l=s.length-1;let f,m,v=0,x=l,I=0;for(;v<=x;)if(I=Math.floor((v+x)/2),f=s[I],m=s[I+1],f<=r){if(I===l||rr))throw new oi("Input is not a number.");x=I-1}return 0}class Cu{constructor(r,l,f){this.type=r,this.input=l,this.labels=[],this.outputs=[];for(const[m,v]of f)this.labels.push(m),this.outputs.push(v)}static parse(r,l){if(r.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return l.error("Expected an even number of arguments.");const f=l.parse(r[1],1,Jt);if(!f)return null;const m=[];let v=null;l.expectedType&&l.expectedType.kind!=="value"&&(v=l.expectedType);for(let x=1;x=I)return l.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',M);const N=l.parse(S,D,v);if(!N)return null;v=v||N.type,m.push([I,N])}return new Cu(v,f,m)}evaluate(r){const l=this.labels,f=this.outputs;if(l.length===1)return f[0].evaluate(r);const m=this.input.evaluate(r);if(m<=l[0])return f[0].evaluate(r);const v=l.length;return m>=l[v-1]?f[v-1].evaluate(r):f[Su(l,m)].evaluate(r)}eachChild(r){r(this.input);for(const l of this.outputs)r(l)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}}function sg(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ag=ld;function ld(s,r,l,f){this.cx=3*s,this.bx=3*(l-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(f-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=r,this.p2x=l,this.p2y=f}ld.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,r){if(r===void 0&&(r=1e-6),s<0)return 0;if(s>1)return 1;for(var l=s,f=0;f<8;f++){var m=this.sampleCurveX(l)-s;if(Math.abs(m)m?x=l:I=l,l=.5*(I-x)+x;return l},solve:function(s,r){return this.sampleCurveY(this.solveCurveX(s,r))}};var lg=sg(ag);function $a(s,r,l){return s+l*(r-s)}function Sc(s,r,l){return s.map((f,m)=>$a(f,r[m],l))}const Ur={number:$a,color:function(s,r,l,f="rgb"){switch(f){case"rgb":{const[m,v,x,I]=Sc(s.rgb,r.rgb,l);return new Pn(m,v,x,I,!1)}case"hcl":{const[m,v,x,I]=s.hcl,[S,M,D,N]=r.hcl;let F,G;if(isNaN(m)||isNaN(S))isNaN(m)?isNaN(S)?F=NaN:(F=S,x!==1&&x!==0||(G=M)):(F=m,D!==1&&D!==0||(G=v));else{let bt=S-m;S>m&&bt>180?bt-=360:S180&&(bt+=360),F=m+l*bt}const[j,Y,it,at]=function([bt,ct,_t,Ot]){return bt=isNaN(bt)?0:bt*Be,ui([_t,Math.cos(bt)*ct,Math.sin(bt)*ct,Ot])}([F,G??$a(v,M,l),$a(x,D,l),$a(I,N,l)]);return new Pn(j,Y,it,at,!1)}case"lab":{const[m,v,x,I]=ui(Sc(s.lab,r.lab,l));return new Pn(m,v,x,I,!1)}}},array:Sc,padding:function(s,r,l){return new io(Sc(s.values,r.values,l))},variableAnchorOffsetCollection:function(s,r,l){const f=s.values,m=r.values;if(f.length!==m.length)throw new oi(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${r.toString()}`);const v=[];for(let x=0;xtypeof D!="number"||D<0||D>1))return l.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:M}}}if(r.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return l.error("Expected an even number of arguments.");if(v=l.parse(v,2,Jt),!v)return null;const I=[];let S=null;f==="interpolate-hcl"||f==="interpolate-lab"?S=yi:l.expectedType&&l.expectedType.kind!=="value"&&(S=l.expectedType);for(let M=0;M=D)return l.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',F);const j=l.parse(N,G,S);if(!j)return null;S=S||j.type,I.push([D,j])}return xt(S,Jt)||xt(S,yi)||xt(S,rt)||xt(S,U)||xt(S,Z(Jt))?new Ir(S,f,m,v,I):l.error(`Type ${$(S)} is not interpolatable.`)}evaluate(r){const l=this.labels,f=this.outputs;if(l.length===1)return f[0].evaluate(r);const m=this.input.evaluate(r);if(m<=l[0])return f[0].evaluate(r);const v=l.length;if(m>=l[v-1])return f[v-1].evaluate(r);const x=Su(l,m),I=Ir.interpolationFactor(this.interpolation,m,l[x],l[x+1]),S=f[x].evaluate(r),M=f[x+1].evaluate(r);switch(this.operator){case"interpolate":return Ur[this.type.kind](S,M,I);case"interpolate-hcl":return Ur.color(S,M,I,"hcl");case"interpolate-lab":return Ur.color(S,M,I,"lab")}}eachChild(r){r(this.input);for(const l of this.outputs)r(l)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}}function En(s,r,l,f){const m=f-l,v=s-l;return m===0?0:r===1?v/m:(Math.pow(r,v)-1)/(Math.pow(r,m)-1)}class Cc{constructor(r,l){this.type=r,this.args=l}static parse(r,l){if(r.length<2)return l.error("Expectected at least one argument.");let f=null;const m=l.expectedType;m&&m.kind!=="value"&&(f=m);const v=[];for(const I of r.slice(1)){const S=l.parse(I,1+v.length,f,void 0,{typeAnnotation:"omit"});if(!S)return null;f=f||S.type,v.push(S)}if(!f)throw new Error("No output type");const x=m&&v.some(I=>H(m,I.type));return new Cc(x?Ge:f,v)}evaluate(r){let l,f=null,m=0;for(const v of this.args)if(m++,f=v.evaluate(r),f&&f instanceof Fo&&!f.available&&(l||(l=f.name),f=null,m===this.args.length&&(f=l)),f!==null)break;return f}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}}class Tc{constructor(r,l){this.type=l.type,this.bindings=[].concat(r),this.result=l}evaluate(r){return this.result.evaluate(r)}eachChild(r){for(const l of this.bindings)r(l[1]);r(this.result)}static parse(r,l){if(r.length<4)return l.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);const f=[];for(let v=1;v=f.length)throw new oi(`Array index out of bounds: ${l} > ${f.length-1}.`);if(l!==Math.floor(l))throw new oi(`Array index must be an integer, but found ${l} instead.`);return f[l]}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}}class ep{constructor(r,l){this.type=je,this.needle=r,this.haystack=l}static parse(r,l){if(r.length!==3)return l.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const f=l.parse(r[1],1,Ge),m=l.parse(r[2],2,Ge);return f&&m?dt(f.type,[je,He,Jt,Ni,Ge])?new ep(f,m):l.error(`Expected first argument to be of type boolean, string, number or null, but found ${$(f.type)} instead`):null}evaluate(r){const l=this.needle.evaluate(r),f=this.haystack.evaluate(r);if(!f)return!1;if(!lt(l,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${$(Oi(l))} instead.`);if(!lt(f,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${$(Oi(f))} instead.`);return f.indexOf(l)>=0}eachChild(r){r(this.needle),r(this.haystack)}outputDefined(){return!0}}class Lc{constructor(r,l,f){this.type=Jt,this.needle=r,this.haystack=l,this.fromIndex=f}static parse(r,l){if(r.length<=2||r.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const f=l.parse(r[1],1,Ge),m=l.parse(r[2],2,Ge);if(!f||!m)return null;if(!dt(f.type,[je,He,Jt,Ni,Ge]))return l.error(`Expected first argument to be of type boolean, string, number or null, but found ${$(f.type)} instead`);if(r.length===4){const v=l.parse(r[3],3,Jt);return v?new Lc(f,m,v):null}return new Lc(f,m)}evaluate(r){const l=this.needle.evaluate(r),f=this.haystack.evaluate(r);if(!lt(l,["boolean","string","number","null"]))throw new oi(`Expected first argument to be of type boolean, string, number or null, but found ${$(Oi(l))} instead.`);if(!lt(f,["string","array"]))throw new oi(`Expected second argument to be of type array or string, but found ${$(Oi(f))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(r);return f.indexOf(l,m)}return f.indexOf(l)}eachChild(r){r(this.needle),r(this.haystack),this.fromIndex&&r(this.fromIndex)}outputDefined(){return!1}}class np{constructor(r,l,f,m,v,x){this.inputType=r,this.type=l,this.input=f,this.cases=m,this.outputs=v,this.otherwise=x}static parse(r,l){if(r.length<5)return l.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return l.error("Expected an even number of arguments.");let f,m;l.expectedType&&l.expectedType.kind!=="value"&&(m=l.expectedType);const v={},x=[];for(let M=2;MNumber.MAX_SAFE_INTEGER)return F.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof j=="number"&&Math.floor(j)!==j)return F.error("Numeric branch labels must be integer values.");if(f){if(F.checkSubtype(f,Oi(j)))return null}else f=Oi(j);if(v[String(j)]!==void 0)return F.error("Branch labels must be unique.");v[String(j)]=x.length}const G=l.parse(N,M,m);if(!G)return null;m=m||G.type,x.push(G)}const I=l.parse(r[1],1,Ge);if(!I)return null;const S=l.parse(r[r.length-1],r.length-1,m);return S?I.type.kind!=="value"&&l.concat(1).checkSubtype(f,I.type)?null:new np(f,m,I,v,x,S):null}evaluate(r){const l=this.input.evaluate(r);return(Oi(l)===this.inputType&&this.outputs[this.cases[l]]||this.otherwise).evaluate(r)}eachChild(r){r(this.input),this.outputs.forEach(r),r(this.otherwise)}outputDefined(){return this.outputs.every(r=>r.outputDefined())&&this.otherwise.outputDefined()}}class ip{constructor(r,l,f){this.type=r,this.branches=l,this.otherwise=f}static parse(r,l){if(r.length<4)return l.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return l.error("Expected an odd number of arguments.");let f;l.expectedType&&l.expectedType.kind!=="value"&&(f=l.expectedType);const m=[];for(let x=1;xl.outputDefined())&&this.otherwise.outputDefined()}}class Pc{constructor(r,l,f,m){this.type=r,this.input=l,this.beginIndex=f,this.endIndex=m}static parse(r,l){if(r.length<=2||r.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const f=l.parse(r[1],1,Ge),m=l.parse(r[2],2,Jt);if(!f||!m)return null;if(!dt(f.type,[Z(Ge),He,Ge]))return l.error(`Expected first argument to be of type array or string, but found ${$(f.type)} instead`);if(r.length===4){const v=l.parse(r[3],3,Jt);return v?new Pc(f.type,f,m,v):null}return new Pc(f.type,f,m)}evaluate(r){const l=this.input.evaluate(r),f=this.beginIndex.evaluate(r);if(!lt(l,["string","array"]))throw new oi(`Expected first argument to be of type array or string, but found ${$(Oi(l))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(r);return l.slice(f,m)}return l.slice(f)}eachChild(r){r(this.input),r(this.beginIndex),this.endIndex&&r(this.endIndex)}outputDefined(){return!1}}function ud(s,r){return s==="=="||s==="!="?r.kind==="boolean"||r.kind==="string"||r.kind==="number"||r.kind==="null"||r.kind==="value":r.kind==="string"||r.kind==="number"||r.kind==="value"}function cd(s,r,l,f){return f.compare(r,l)===0}function zl(s,r,l){const f=s!=="=="&&s!=="!=";return class A1{constructor(v,x,I){this.type=je,this.lhs=v,this.rhs=x,this.collator=I,this.hasUntypedArgument=v.type.kind==="value"||x.type.kind==="value"}static parse(v,x){if(v.length!==3&&v.length!==4)return x.error("Expected two or three arguments.");const I=v[0];let S=x.parse(v[1],1,Ge);if(!S)return null;if(!ud(I,S.type))return x.concat(1).error(`"${I}" comparisons are not supported for type '${$(S.type)}'.`);let M=x.parse(v[2],2,Ge);if(!M)return null;if(!ud(I,M.type))return x.concat(2).error(`"${I}" comparisons are not supported for type '${$(M.type)}'.`);if(S.type.kind!==M.type.kind&&S.type.kind!=="value"&&M.type.kind!=="value")return x.error(`Cannot compare types '${$(S.type)}' and '${$(M.type)}'.`);f&&(S.type.kind==="value"&&M.type.kind!=="value"?S=new xo(M.type,[S]):S.type.kind!=="value"&&M.type.kind==="value"&&(M=new xo(S.type,[M])));let D=null;if(v.length===4){if(S.type.kind!=="string"&&M.type.kind!=="string"&&S.type.kind!=="value"&&M.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(D=x.parse(v[3],3,ea),!D)return null}return new A1(S,M,D)}evaluate(v){const x=this.lhs.evaluate(v),I=this.rhs.evaluate(v);if(f&&this.hasUntypedArgument){const S=Oi(x),M=Oi(I);if(S.kind!==M.kind||S.kind!=="string"&&S.kind!=="number")throw new oi(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${S.kind}, ${M.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){const S=Oi(x),M=Oi(I);if(S.kind!=="string"||M.kind!=="string")return r(v,x,I)}return this.collator?l(v,x,I,this.collator.evaluate(v)):r(v,x,I)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const ug=zl("==",function(s,r,l){return r===l},cd),cg=zl("!=",function(s,r,l){return r!==l},function(s,r,l,f){return!cd(0,r,l,f)}),hg=zl("<",function(s,r,l){return r",function(s,r,l){return r>l},function(s,r,l,f){return f.compare(r,l)>0}),fg=zl("<=",function(s,r,l){return r<=l},function(s,r,l,f){return f.compare(r,l)<=0}),dg=zl(">=",function(s,r,l){return r>=l},function(s,r,l,f){return f.compare(r,l)>=0});class rp{constructor(r,l,f,m,v){this.type=He,this.number=r,this.locale=l,this.currency=f,this.minFractionDigits=m,this.maxFractionDigits=v}static parse(r,l){if(r.length!==3)return l.error("Expected two arguments.");const f=l.parse(r[1],1,Jt);if(!f)return null;const m=r[2];if(typeof m!="object"||Array.isArray(m))return l.error("NumberFormat options argument must be an object.");let v=null;if(m.locale&&(v=l.parse(m.locale,1,He),!v))return null;let x=null;if(m.currency&&(x=l.parse(m.currency,1,He),!x))return null;let I=null;if(m["min-fraction-digits"]&&(I=l.parse(m["min-fraction-digits"],1,Jt),!I))return null;let S=null;return m["max-fraction-digits"]&&(S=l.parse(m["max-fraction-digits"],1,Jt),!S)?null:new rp(f,v,x,I,S)}evaluate(r){return new Intl.NumberFormat(this.locale?this.locale.evaluate(r):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(r):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(r):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(r):void 0}).format(this.number.evaluate(r))}eachChild(r){r(this.number),this.locale&&r(this.locale),this.currency&&r(this.currency),this.minFractionDigits&&r(this.minFractionDigits),this.maxFractionDigits&&r(this.maxFractionDigits)}outputDefined(){return!1}}class Mc{constructor(r){this.type=Ii,this.sections=r}static parse(r,l){if(r.length<2)return l.error("Expected at least one argument.");const f=r[1];if(!Array.isArray(f)&&typeof f=="object")return l.error("First argument must be an image or text section.");const m=[];let v=!1;for(let x=1;x<=r.length-1;++x){const I=r[x];if(v&&typeof I=="object"&&!Array.isArray(I)){v=!1;let S=null;if(I["font-scale"]&&(S=l.parse(I["font-scale"],1,Jt),!S))return null;let M=null;if(I["text-font"]&&(M=l.parse(I["text-font"],1,Z(He)),!M))return null;let D=null;if(I["text-color"]&&(D=l.parse(I["text-color"],1,yi),!D))return null;const N=m[m.length-1];N.scale=S,N.font=M,N.textColor=D}else{const S=l.parse(r[x],1,Ge);if(!S)return null;const M=S.type.kind;if(M!=="string"&&M!=="value"&&M!=="null"&&M!=="resolvedImage")return l.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,m.push({content:S,scale:null,font:null,textColor:null})}}return new Mc(m)}evaluate(r){return new vo(this.sections.map(l=>{const f=l.content.evaluate(r);return Oi(f)===O?new $h("",f,null,null,null):new $h(vu(f),null,l.scale?l.scale.evaluate(r):null,l.font?l.font.evaluate(r).join(","):null,l.textColor?l.textColor.evaluate(r):null)}))}eachChild(r){for(const l of this.sections)r(l.content),l.scale&&r(l.scale),l.font&&r(l.font),l.textColor&&r(l.textColor)}outputDefined(){return!1}}class op{constructor(r){this.type=O,this.input=r}static parse(r,l){if(r.length!==2)return l.error("Expected two arguments.");const f=l.parse(r[1],1,He);return f?new op(f):l.error("No image name provided.")}evaluate(r){const l=this.input.evaluate(r),f=Fo.fromString(l);return f&&r.availableImages&&(f.available=r.availableImages.indexOf(l)>-1),f}eachChild(r){r(this.input)}outputDefined(){return!1}}class sp{constructor(r){this.type=Jt,this.input=r}static parse(r,l){if(r.length!==2)return l.error(`Expected 1 argument, but found ${r.length-1} instead.`);const f=l.parse(r[1],1);return f?f.type.kind!=="array"&&f.type.kind!=="string"&&f.type.kind!=="value"?l.error(`Expected argument of type string or array, but found ${$(f.type)} instead.`):new sp(f):null}evaluate(r){const l=this.input.evaluate(r);if(typeof l=="string"||Array.isArray(l))return l.length;throw new oi(`Expected value to be of type string or array, but found ${$(Oi(l))} instead.`)}eachChild(r){r(this.input)}outputDefined(){return!1}}const Ol={"==":ug,"!=":cg,">":pg,"<":hg,">=":dg,"<=":fg,array:xo,at:tp,boolean:xo,case:ip,coalesce:Cc,collator:Nl,format:Mc,image:op,in:ep,"index-of":Lc,interpolate:Ir,"interpolate-hcl":Ir,"interpolate-lab":Ir,length:sp,let:Tc,literal:Ea,match:np,number:xo,"number-format":rp,object:xo,slice:Pc,step:Cu,string:xo,"to-boolean":Es,"to-color":Es,"to-number":Es,"to-string":Es,var:Ic,within:Qa};function hd(s,[r,l,f,m]){r=r.evaluate(s),l=l.evaluate(s),f=f.evaluate(s);const v=m?m.evaluate(s):1,x=Rl(r,l,f,v);if(x)throw new oi(x);return new Pn(r/255,l/255,f/255,v,!1)}function pd(s,r){return s in r}function ap(s,r){const l=r[s];return l===void 0?null:l}function tl(s){return{type:s}}function fd(s){return{result:"success",value:s}}function Fl(s){return{result:"error",value:s}}function Bl(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function dd(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function lp(s){return!!s.expression&&s.expression.interpolated}function _n(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function Ac(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function mg(s){return s}function md(s,r){const l=r.type==="color",f=s.stops&&typeof s.stops[0][0]=="object",m=f||!(f||s.property!==void 0),v=s.type||(lp(r)?"exponential":"interval");if(l||r.type==="padding"){const D=l?Pn.parse:io.parse;(s=No({},s)).stops&&(s.stops=s.stops.map(N=>[N[0],D(N[1])])),s.default=D(s.default?s.default:r.default)}if(s.colorSpace&&(x=s.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var x;let I,S,M;if(v==="exponential")I=dn;else if(v==="interval")I=gg;else if(v==="categorical"){I=Ei,S=Object.create(null);for(const D of s.stops)S[D[0]]=D[1];M=typeof s.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);I=up}if(f){const D={},N=[];for(let j=0;jj[0]),evaluate:({zoom:j},Y)=>dn({stops:F,base:s.base},r,j).evaluate(j,Y)}}if(m){const D=v==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:Ir.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(N=>N[0]),evaluate:({zoom:N})=>I(s,r,N,S,M)}}return{kind:"source",evaluate(D,N){const F=N&&N.properties?N.properties[s.property]:void 0;return F===void 0?Tu(s.default,r.default):I(s,r,F,S,M)}}}function Tu(s,r,l){return s!==void 0?s:r!==void 0?r:l!==void 0?l:void 0}function Ei(s,r,l,f,m){return Tu(typeof l===m?f[l]:void 0,s.default,r.default)}function gg(s,r,l){if(_n(l)!=="number")return Tu(s.default,r.default);const f=s.stops.length;if(f===1||l<=s.stops[0][0])return s.stops[0][1];if(l>=s.stops[f-1][0])return s.stops[f-1][1];const m=Su(s.stops.map(v=>v[0]),l);return s.stops[m][1]}function dn(s,r,l){const f=s.base!==void 0?s.base:1;if(_n(l)!=="number")return Tu(s.default,r.default);const m=s.stops.length;if(m===1||l<=s.stops[0][0])return s.stops[0][1];if(l>=s.stops[m-1][0])return s.stops[m-1][1];const v=Su(s.stops.map(D=>D[0]),l),x=function(D,N,F,G){const j=G-F,Y=D-F;return j===0?0:N===1?Y/j:(Math.pow(N,Y)-1)/(Math.pow(N,j)-1)}(l,f,s.stops[v][0],s.stops[v+1][0]),I=s.stops[v][1],S=s.stops[v+1][1],M=Ur[r.type]||mg;return typeof I.evaluate=="function"?{evaluate(...D){const N=I.evaluate.apply(void 0,D),F=S.evaluate.apply(void 0,D);if(N!==void 0&&F!==void 0)return M(N,F,x,s.colorSpace)}}:M(I,S,x,s.colorSpace)}function up(s,r,l){switch(r.type){case"color":l=Pn.parse(l);break;case"formatted":l=vo.fromString(l.toString());break;case"resolvedImage":l=Fo.fromString(l.toString());break;case"padding":l=io.parse(l);break;default:_n(l)===r.type||r.type==="enum"&&r.values[l]||(l=void 0)}return Tu(l,s.default,r.default)}bo.register(Ol,{error:[{kind:"error"},[He],(s,[r])=>{throw new oi(r.evaluate(s))}],typeof:[He,[Ge],(s,[r])=>$(Oi(r.evaluate(s)))],"to-rgba":[Z(Jt,4),[yi],(s,[r])=>{const[l,f,m,v]=r.evaluate(s).rgb;return[255*l,255*f,255*m,v]}],rgb:[yi,[Jt,Jt,Jt],hd],rgba:[yi,[Jt,Jt,Jt,Jt],hd],has:{type:je,overloads:[[[He],(s,[r])=>pd(r.evaluate(s),s.properties())],[[He,zo],(s,[r,l])=>pd(r.evaluate(s),l.evaluate(s))]]},get:{type:Ge,overloads:[[[He],(s,[r])=>ap(r.evaluate(s),s.properties())],[[He,zo],(s,[r,l])=>ap(r.evaluate(s),l.evaluate(s))]]},"feature-state":[Ge,[He],(s,[r])=>ap(r.evaluate(s),s.featureState||{})],properties:[zo,[],s=>s.properties()],"geometry-type":[He,[],s=>s.geometryType()],id:[Ge,[],s=>s.id()],zoom:[Jt,[],s=>s.globals.zoom],"heatmap-density":[Jt,[],s=>s.globals.heatmapDensity||0],"line-progress":[Jt,[],s=>s.globals.lineProgress||0],accumulated:[Ge,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Jt,tl(Jt),(s,r)=>{let l=0;for(const f of r)l+=f.evaluate(s);return l}],"*":[Jt,tl(Jt),(s,r)=>{let l=1;for(const f of r)l*=f.evaluate(s);return l}],"-":{type:Jt,overloads:[[[Jt,Jt],(s,[r,l])=>r.evaluate(s)-l.evaluate(s)],[[Jt],(s,[r])=>-r.evaluate(s)]]},"/":[Jt,[Jt,Jt],(s,[r,l])=>r.evaluate(s)/l.evaluate(s)],"%":[Jt,[Jt,Jt],(s,[r,l])=>r.evaluate(s)%l.evaluate(s)],ln2:[Jt,[],()=>Math.LN2],pi:[Jt,[],()=>Math.PI],e:[Jt,[],()=>Math.E],"^":[Jt,[Jt,Jt],(s,[r,l])=>Math.pow(r.evaluate(s),l.evaluate(s))],sqrt:[Jt,[Jt],(s,[r])=>Math.sqrt(r.evaluate(s))],log10:[Jt,[Jt],(s,[r])=>Math.log(r.evaluate(s))/Math.LN10],ln:[Jt,[Jt],(s,[r])=>Math.log(r.evaluate(s))],log2:[Jt,[Jt],(s,[r])=>Math.log(r.evaluate(s))/Math.LN2],sin:[Jt,[Jt],(s,[r])=>Math.sin(r.evaluate(s))],cos:[Jt,[Jt],(s,[r])=>Math.cos(r.evaluate(s))],tan:[Jt,[Jt],(s,[r])=>Math.tan(r.evaluate(s))],asin:[Jt,[Jt],(s,[r])=>Math.asin(r.evaluate(s))],acos:[Jt,[Jt],(s,[r])=>Math.acos(r.evaluate(s))],atan:[Jt,[Jt],(s,[r])=>Math.atan(r.evaluate(s))],min:[Jt,tl(Jt),(s,r)=>Math.min(...r.map(l=>l.evaluate(s)))],max:[Jt,tl(Jt),(s,r)=>Math.max(...r.map(l=>l.evaluate(s)))],abs:[Jt,[Jt],(s,[r])=>Math.abs(r.evaluate(s))],round:[Jt,[Jt],(s,[r])=>{const l=r.evaluate(s);return l<0?-Math.round(-l):Math.round(l)}],floor:[Jt,[Jt],(s,[r])=>Math.floor(r.evaluate(s))],ceil:[Jt,[Jt],(s,[r])=>Math.ceil(r.evaluate(s))],"filter-==":[je,[He,Ge],(s,[r,l])=>s.properties()[r.value]===l.value],"filter-id-==":[je,[Ge],(s,[r])=>s.id()===r.value],"filter-type-==":[je,[He],(s,[r])=>s.geometryType()===r.value],"filter-<":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f{const l=s.id(),f=r.value;return typeof l==typeof f&&l":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f>m}],"filter-id->":[je,[Ge],(s,[r])=>{const l=s.id(),f=r.value;return typeof l==typeof f&&l>f}],"filter-<=":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f<=m}],"filter-id-<=":[je,[Ge],(s,[r])=>{const l=s.id(),f=r.value;return typeof l==typeof f&&l<=f}],"filter->=":[je,[He,Ge],(s,[r,l])=>{const f=s.properties()[r.value],m=l.value;return typeof f==typeof m&&f>=m}],"filter-id->=":[je,[Ge],(s,[r])=>{const l=s.id(),f=r.value;return typeof l==typeof f&&l>=f}],"filter-has":[je,[Ge],(s,[r])=>r.value in s.properties()],"filter-has-id":[je,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[je,[Z(He)],(s,[r])=>r.value.indexOf(s.geometryType())>=0],"filter-id-in":[je,[Z(Ge)],(s,[r])=>r.value.indexOf(s.id())>=0],"filter-in-small":[je,[He,Z(Ge)],(s,[r,l])=>l.value.indexOf(s.properties()[r.value])>=0],"filter-in-large":[je,[He,Z(Ge)],(s,[r,l])=>function(f,m,v,x){for(;v<=x;){const I=v+x>>1;if(m[I]===f)return!0;m[I]>f?x=I-1:v=I+1}return!1}(s.properties()[r.value],l.value,0,l.value.length-1)],all:{type:je,overloads:[[[je,je],(s,[r,l])=>r.evaluate(s)&&l.evaluate(s)],[tl(je),(s,r)=>{for(const l of r)if(!l.evaluate(s))return!1;return!0}]]},any:{type:je,overloads:[[[je,je],(s,[r,l])=>r.evaluate(s)||l.evaluate(s)],[tl(je),(s,r)=>{for(const l of r)if(l.evaluate(s))return!0;return!1}]]},"!":[je,[je],(s,[r])=>!r.evaluate(s)],"is-supported-script":[je,[He],(s,[r])=>{const l=s.globals&&s.globals.isSupportedScript;return!l||l(r.evaluate(s))}],upcase:[He,[He],(s,[r])=>r.evaluate(s).toUpperCase()],downcase:[He,[He],(s,[r])=>r.evaluate(s).toLowerCase()],concat:[He,tl(Ge),(s,r)=>r.map(l=>vu(l.evaluate(s))).join("")],"resolved-locale":[He,[ea],(s,[r])=>r.evaluate(s).resolvedLocale()]});class Hn{constructor(r,l){var f;this.expression=r,this._warningHistory={},this._evaluator=new Mn,this._defaultValue=l?(f=l).type==="color"&&Ac(f.default)?new Pn(0,0,0,0):f.type==="color"?Pn.parse(f.default)||null:f.type==="padding"?io.parse(f.default)||null:f.type==="variableAnchorOffsetCollection"?Oo.parse(f.default)||null:f.default===void 0?null:f.default:null,this._enumValues=l&&l.type==="enum"?l.values:null}evaluateWithoutErrorHandling(r,l,f,m,v,x){return this._evaluator.globals=r,this._evaluator.feature=l,this._evaluator.featureState=f,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(r,l,f,m,v,x){this._evaluator.globals=r,this._evaluator.feature=l||null,this._evaluator.featureState=f||null,this._evaluator.canonical=m,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=x||null;try{const I=this.expression.evaluate(this._evaluator);if(I==null||typeof I=="number"&&I!=I)return this._defaultValue;if(this._enumValues&&!(I in this._enumValues))throw new oi(`Expected value to be one of ${Object.keys(this._enumValues).map(S=>JSON.stringify(S)).join(", ")}, but found ${JSON.stringify(I)} instead.`);return I}catch(I){return this._warningHistory[I.message]||(this._warningHistory[I.message]=!0,typeof console<"u"&&console.warn(I.message)),this._defaultValue}}}function Vn(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Ol}function el(s,r){const l=new yc(Ol,wu,[],r?function(m){const v={color:yi,string:He,number:Jt,enum:He,boolean:je,formatted:Ii,padding:rt,resolvedImage:O,variableAnchorOffsetCollection:U};return m.type==="array"?Z(v[m.value]||Ge,m.length):v[m.type]}(r):void 0),f=l.parse(s,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return f?fd(new Hn(f,r)):Fl(l.errors)}class kc{constructor(r,l){this.kind=r,this._styleExpression=l,this.isStateDependent=r!=="constant"&&!Iu(l.expression)}evaluateWithoutErrorHandling(r,l,f,m,v,x){return this._styleExpression.evaluateWithoutErrorHandling(r,l,f,m,v,x)}evaluate(r,l,f,m,v,x){return this._styleExpression.evaluate(r,l,f,m,v,x)}}class cp{constructor(r,l,f,m){this.kind=r,this.zoomStops=f,this._styleExpression=l,this.isStateDependent=r!=="camera"&&!Iu(l.expression),this.interpolationType=m}evaluateWithoutErrorHandling(r,l,f,m,v,x){return this._styleExpression.evaluateWithoutErrorHandling(r,l,f,m,v,x)}evaluate(r,l,f,m,v,x){return this._styleExpression.evaluate(r,l,f,m,v,x)}interpolationFactor(r,l,f){return this.interpolationType?Ir.interpolationFactor(this.interpolationType,r,l,f):0}}function gd(s,r){const l=el(s,r);if(l.result==="error")return l;const f=l.value.expression,m=Ec(f);if(!m&&!Bl(r))return Fl([new Br("","data expressions not supported")]);const v=Eu(f,["zoom"]);if(!v&&!dd(r))return Fl([new Br("","zoom expressions not supported")]);const x=Rc(f);return x||v?x instanceof Br?Fl([x]):x instanceof Ir&&!lp(r)?Fl([new Br("",'"interpolate" expressions cannot be used with this property')]):fd(x?new cp(m?"camera":"composite",l.value,x.labels,x instanceof Ir?x.interpolation:void 0):new kc(m?"constant":"source",l.value)):Fl([new Br("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Dc{constructor(r,l){this._parameters=r,this._specification=l,No(this,md(this._parameters,this._specification))}static deserialize(r){return new Dc(r._parameters,r._specification)}static serialize(r){return{_parameters:r._parameters,_specification:r._specification}}}function Rc(s){let r=null;if(s instanceof Tc)r=Rc(s.result);else if(s instanceof Cc){for(const l of s.args)if(r=Rc(l),r)break}else(s instanceof Cu||s instanceof Ir)&&s.input instanceof bo&&s.input.name==="zoom"&&(r=s);return r instanceof Br||s.eachChild(l=>{const f=Rc(l);f instanceof Br?r=f:!r&&f?r=new Br("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&f&&r!==f&&(r=new Br("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}function Nc(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const r of s.slice(1))if(!Nc(r)&&typeof r!="boolean")return!1;return!0;default:return!0}}const _d={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zc(s){if(s==null)return{filter:()=>!0,needGeometry:!1};Nc(s)||(s=Fc(s));const r=el(s,_d);if(r.result==="error")throw new Error(r.value.map(l=>`${l.key}: ${l.message}`).join(", "));return{filter:(l,f,m)=>r.value.evaluate(l,f,{},m),needGeometry:Oc(s)}}function yd(s,r){return sr?1:0}function Oc(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let r=1;r"||r==="<="||r===">="?hp(s[1],s[2],r):r==="any"?(l=s.slice(1),["any"].concat(l.map(Fc))):r==="all"?["all"].concat(s.slice(1).map(Fc)):r==="none"?["all"].concat(s.slice(1).map(Fc).map(Bc)):r==="in"?vd(s[1],s.slice(2)):r==="!in"?Bc(vd(s[1],s.slice(2))):r==="has"?xd(s[1]):r==="!has"?Bc(xd(s[1])):r!=="within"||s;var l}function hp(s,r,l){switch(s){case"$type":return[`filter-type-${l}`,r];case"$id":return[`filter-id-${l}`,r];default:return[`filter-${l}`,s,r]}}function vd(s,r){if(r.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(l=>typeof l!=typeof r[0])?["filter-in-large",s,["literal",r.sort(yd)]]:["filter-in-small",s,["literal",r]]}}function xd(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Bc(s){return["!",s]}function pp(s){const r=typeof s;if(r==="number"||r==="boolean"||r==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let m="[";for(const v of s)m+=`${pp(v)},`;return`${m}]`}const l=Object.keys(s).sort();let f="{";for(let m=0;mf.maximum?[new Wt(r,l,`${l} is greater than the maximum value ${f.maximum}`)]:[]}function wd(s){const r=s.valueSpec,l=ci(s.value.type);let f,m,v,x={};const I=l!=="categorical"&&s.value.property===void 0,S=!I,M=_n(s.value.stops)==="array"&&_n(s.value.stops[0])==="array"&&_n(s.value.stops[0][0])==="object",D=Gr({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(G){if(l==="identity")return[new Wt(G.key,G.value,'identity function may not have a "stops" property')];let j=[];const Y=G.value;return j=j.concat(fp({key:G.key,value:Y,valueSpec:G.valueSpec,validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec,arrayElementValidator:N})),_n(Y)==="array"&&Y.length===0&&j.push(new Wt(G.key,Y,"array must have at least one stop")),j},default:function(G){return G.validateSpec({key:G.key,value:G.value,valueSpec:r,validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec})}}});return l==="identity"&&I&&D.push(new Wt(s.key,s.value,'missing required property "property"')),l==="identity"||s.value.stops||D.push(new Wt(s.key,s.value,'missing required property "stops"')),l==="exponential"&&s.valueSpec.expression&&!lp(s.valueSpec)&&D.push(new Wt(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(S&&!Bl(s.valueSpec)?D.push(new Wt(s.key,s.value,"property functions not supported")):I&&!dd(s.valueSpec)&&D.push(new Wt(s.key,s.value,"zoom functions not supported"))),l!=="categorical"&&!M||s.value.property!==void 0||D.push(new Wt(s.key,s.value,'"property" property is required')),D;function N(G){let j=[];const Y=G.value,it=G.key;if(_n(Y)!=="array")return[new Wt(it,Y,`array expected, ${_n(Y)} found`)];if(Y.length!==2)return[new Wt(it,Y,`array length 2 expected, length ${Y.length} found`)];if(M){if(_n(Y[0])!=="object")return[new Wt(it,Y,`object expected, ${_n(Y[0])} found`)];if(Y[0].zoom===void 0)return[new Wt(it,Y,"object stop key must have zoom")];if(Y[0].value===void 0)return[new Wt(it,Y,"object stop key must have value")];if(v&&v>ci(Y[0].zoom))return[new Wt(it,Y[0].zoom,"stop zoom values must appear in ascending order")];ci(Y[0].zoom)!==v&&(v=ci(Y[0].zoom),m=void 0,x={}),j=j.concat(Gr({key:`${it}[0]`,value:Y[0],valueSpec:{zoom:{}},validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec,objectElementValidators:{zoom:Vc,value:F}}))}else j=j.concat(F({key:`${it}[0]`,value:Y[0],valueSpec:{},validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec},Y));return Vn(Ca(Y[1]))?j.concat([new Wt(`${it}[1]`,Y[1],"expressions are not allowed in function stops.")]):j.concat(G.validateSpec({key:`${it}[1]`,value:Y[1],valueSpec:r,validateSpec:G.validateSpec,style:G.style,styleSpec:G.styleSpec}))}function F(G,j){const Y=_n(G.value),it=ci(G.value),at=G.value!==null?G.value:j;if(f){if(Y!==f)return[new Wt(G.key,at,`${Y} stop domain type must match previous stop domain type ${f}`)]}else f=Y;if(Y!=="number"&&Y!=="string"&&Y!=="boolean")return[new Wt(G.key,at,"stop domain value must be a number, string, or boolean")];if(Y!=="number"&&l!=="categorical"){let bt=`number expected, ${Y} found`;return Bl(r)&&l===void 0&&(bt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Wt(G.key,at,bt)]}return l!=="categorical"||Y!=="number"||isFinite(it)&&Math.floor(it)===it?l!=="categorical"&&Y==="number"&&m!==void 0&&itnew Wt(`${s.key}${f.key}`,s.value,f.message));const l=r.value.expression||r.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!l.outputDefined())return[new Wt(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Iu(l))return[new Wt(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Iu(l))return[new Wt(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!Eu(l,["zoom","feature-state"]))return[new Wt(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!Ec(l))return[new Wt(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function La(s){const r=s.key,l=s.value,f=s.valueSpec,m=[];return Array.isArray(f.values)?f.values.indexOf(ci(l))===-1&&m.push(new Wt(r,l,`expected one of [${f.values.join(", ")}], ${JSON.stringify(l)} found`)):Object.keys(f.values).indexOf(ci(l))===-1&&m.push(new Wt(r,l,`expected one of [${Object.keys(f.values).join(", ")}], ${JSON.stringify(l)} found`)),m}function Vl(s){return Nc(Ca(s.value))?Ta(No({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Uc(s)}function Uc(s){const r=s.value,l=s.key;if(_n(r)!=="array")return[new Wt(l,r,`array expected, ${_n(r)} found`)];const f=s.styleSpec;let m,v=[];if(r.length<1)return[new Wt(l,r,"filter array must have at least 1 element")];switch(v=v.concat(La({key:`${l}[0]`,value:r[0],valueSpec:f.filter_operator,style:s.style,styleSpec:s.styleSpec})),ci(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&ci(r[1])==="$type"&&v.push(new Wt(l,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&v.push(new Wt(l,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(m=_n(r[1]),m!=="string"&&v.push(new Wt(`${l}[1]`,r[1],`string expected, ${m} found`)));for(let x=2;x{M in l&&r.push(new Wt(f,l[M],`"${M}" is prohibited for ref layers`))}),m.layers.forEach(M=>{ci(M.id)===I&&(S=M)}),S?S.ref?r.push(new Wt(f,l.ref,"ref cannot reference another ref layer")):x=ci(S.type):r.push(new Wt(f,l.ref,`ref layer "${I}" not found`))}else if(x!=="background")if(l.source){const S=m.sources&&m.sources[l.source],M=S&&ci(S.type);S?M==="vector"&&x==="raster"?r.push(new Wt(f,l.source,`layer "${l.id}" requires a raster source`)):M!=="raster-dem"&&x==="hillshade"?r.push(new Wt(f,l.source,`layer "${l.id}" requires a raster-dem source`)):M==="raster"&&x!=="raster"?r.push(new Wt(f,l.source,`layer "${l.id}" requires a vector source`)):M!=="vector"||l["source-layer"]?M==="raster-dem"&&x!=="hillshade"?r.push(new Wt(f,l.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!l.paint||!l.paint["line-gradient"]||M==="geojson"&&S.lineMetrics||r.push(new Wt(f,l,`layer "${l.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new Wt(f,l,`layer "${l.id}" must specify a "source-layer"`)):r.push(new Wt(f,l.source,`source "${l.source}" not found`))}else r.push(new Wt(f,l,'missing required property "source"'));return r=r.concat(Gr({key:f,value:l,valueSpec:v.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${f}.type`,value:l.type,valueSpec:v.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:l,objectKey:"type"}),filter:Vl,layout:S=>Gr({layer:l,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":M=>Lu(No({layerType:x},M))}}),paint:S=>Gr({layer:l,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":M=>mp(No({layerType:x},M))}})}})),r}function nl(s){const r=s.value,l=s.key,f=_n(r);return f!=="string"?[new Wt(l,r,`string expected, ${f} found`)]:[]}const Ed={promoteId:function({key:s,value:r}){if(_n(r)==="string")return nl({key:s,value:r});{const l=[];for(const f in r)l.push(...nl({key:`${s}.${f}`,value:r[f]}));return l}}};function Sd(s){const r=s.value,l=s.key,f=s.styleSpec,m=s.style,v=s.validateSpec;if(!r.type)return[new Wt(l,r,'"type" is required')];const x=ci(r.type);let I;switch(x){case"vector":case"raster":return I=Gr({key:l,value:r,valueSpec:f[`source_${x.replace("-","_")}`],style:s.style,styleSpec:f,objectElementValidators:Ed,validateSpec:v}),I;case"raster-dem":return I=function(S){var M;const D=(M=S.sourceName)!==null&&M!==void 0?M:"",N=S.value,F=S.styleSpec,G=F.source_raster_dem,j=S.style;let Y=[];const it=_n(N);if(N===void 0)return Y;if(it!=="object")return Y.push(new Wt("source_raster_dem",N,`object expected, ${it} found`)),Y;const at=ci(N.encoding)==="custom",bt=["redFactor","greenFactor","blueFactor","baseShift"],ct=S.value.encoding?`"${S.value.encoding}"`:"Default";for(const _t in N)!at&&bt.includes(_t)?Y.push(new Wt(_t,N[_t],`In "${D}": "${_t}" is only valid when "encoding" is set to "custom". ${ct} encoding found`)):G[_t]?Y=Y.concat(S.validateSpec({key:_t,value:N[_t],valueSpec:G[_t],validateSpec:S.validateSpec,style:j,styleSpec:F})):Y.push(new Wt(_t,N[_t],`unknown property "${_t}"`));return Y}({sourceName:l,value:r,style:s.style,styleSpec:f,validateSpec:v}),I;case"geojson":if(I=Gr({key:l,value:r,valueSpec:f.source_geojson,style:m,styleSpec:f,validateSpec:v,objectElementValidators:Ed}),r.cluster)for(const S in r.clusterProperties){const[M,D]=r.clusterProperties[S],N=typeof M=="string"?[M,["accumulated"],["get",S]]:M;I.push(...Ta({key:`${l}.${S}.map`,value:D,validateSpec:v,expressionContext:"cluster-map"})),I.push(...Ta({key:`${l}.${S}.reduce`,value:N,validateSpec:v,expressionContext:"cluster-reduce"}))}return I;case"video":return Gr({key:l,value:r,valueSpec:f.source_video,style:m,validateSpec:v,styleSpec:f});case"image":return Gr({key:l,value:r,valueSpec:f.source_image,style:m,validateSpec:v,styleSpec:f});case"canvas":return[new Wt(l,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return La({key:`${l}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:v,styleSpec:f})}}function Cd(s){const r=s.value,l=s.styleSpec,f=l.light,m=s.style;let v=[];const x=_n(r);if(r===void 0)return v;if(x!=="object")return v=v.concat([new Wt("light",r,`object expected, ${x} found`)]),v;for(const I in r){const S=I.match(/^(.*)-transition$/);v=v.concat(S&&f[S[1]]&&f[S[1]].transition?s.validateSpec({key:I,value:r[I],valueSpec:l.transition,validateSpec:s.validateSpec,style:m,styleSpec:l}):f[I]?s.validateSpec({key:I,value:r[I],valueSpec:f[I],validateSpec:s.validateSpec,style:m,styleSpec:l}):[new Wt(I,r[I],`unknown property "${I}"`)])}return v}function Pu(s){const r=s.value,l=s.styleSpec,f=l.sky,m=s.style,v=_n(r);if(r===void 0)return[];if(v!=="object")return[new Wt("sky",r,`object expected, ${v} found`)];let x=[];for(const I in r)x=x.concat(f[I]?il({key:I,value:r[I],valueSpec:f[I],style:m,styleSpec:l}):[new Wt(I,r[I],`unknown property "${I}"`)]);return x}function Mu(s){const r=s.value,l=s.styleSpec,f=l.terrain,m=s.style;let v=[];const x=_n(r);if(r===void 0)return v;if(x!=="object")return v=v.concat([new Wt("terrain",r,`object expected, ${x} found`)]),v;for(const I in r)v=v.concat(f[I]?s.validateSpec({key:I,value:r[I],valueSpec:f[I],validateSpec:s.validateSpec,style:m,styleSpec:l}):[new Wt(I,r[I],`unknown property "${I}"`)]);return v}function ro(s){let r=[];const l=s.value,f=s.key;if(Array.isArray(l)){const m=[],v=[];for(const x in l)l[x].id&&m.includes(l[x].id)&&r.push(new Wt(f,l,`all the sprites' ids must be unique, but ${l[x].id} is duplicated`)),m.push(l[x].id),l[x].url&&v.includes(l[x].url)&&r.push(new Wt(f,l,`all the sprites' URLs must be unique, but ${l[x].url} is duplicated`)),v.push(l[x].url),r=r.concat(Gr({key:`${f}[${x}]`,value:l[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return r}return nl({key:f,value:l})}const Ul={"*":()=>[],array:fp,boolean:function(s){const r=s.value,l=s.key,f=_n(r);return f!=="boolean"?[new Wt(l,r,`boolean expected, ${f} found`)]:[]},number:Vc,color:function(s){const r=s.key,l=s.value,f=_n(l);return f!=="string"?[new Wt(r,l,`color expected, ${f} found`)]:Pn.parse(String(l))?[]:[new Wt(r,l,`color expected, "${l}" found`)]},constants:bd,enum:La,filter:Vl,function:wd,layer:Id,object:Gr,source:Sd,light:Cd,sky:Pu,terrain:Mu,string:nl,formatted:function(s){return nl(s).length===0?[]:Ta(s)},resolvedImage:function(s){return nl(s).length===0?[]:Ta(s)},padding:function(s){const r=s.key,l=s.value;if(_n(l)==="array"){if(l.length<1||l.length>4)return[new Wt(r,l,`padding requires 1 to 4 values; ${l.length} values found`)];const f={type:"number"};let m=[];for(let v=0;v[]}})),s.constants&&(l=l.concat(bd({key:"constants",value:s.constants,style:s,styleSpec:r,validateSpec:il}))),gp(l)}function oo(s){return function(r){return s({...r,validateSpec:il})}}function gp(s){return[].concat(s).sort((r,l)=>r.line-l.line)}function Bo(s){return function(...r){return gp(s.apply(this,r))}}es.source=Bo(oo(Sd)),es.sprite=Bo(oo(ro)),es.glyphs=Bo(oo(Td)),es.light=Bo(oo(Cd)),es.sky=Bo(oo(Pu)),es.terrain=Bo(oo(Mu)),es.layer=Bo(oo(Id)),es.filter=Bo(oo(Vl)),es.paintProperty=Bo(oo(mp)),es.layoutProperty=Bo(oo(Lu));const Au=es,_p=Au.light,yg=Au.paintProperty,ku=Au.layoutProperty;function Ld(s,r){let l=!1;if(r&&r.length)for(const f of r)s.fire(new Ie(new Error(f.message))),l=!0;return l}class rl{constructor(r,l,f){const m=this.cells=[];if(r instanceof ArrayBuffer){this.arrayBuffer=r;const x=new Int32Array(this.arrayBuffer);r=x[0],this.d=(l=x[1])+2*(f=x[2]);for(let S=0;S=N[j+0]&&m>=N[j+1])?(I[G]=!0,x.push(D[G])):I[G]=!1}}}}_forEachCell(r,l,f,m,v,x,I,S){const M=this._convertToCellCoord(r),D=this._convertToCellCoord(l),N=this._convertToCellCoord(f),F=this._convertToCellCoord(m);for(let G=M;G<=N;G++)for(let j=D;j<=F;j++){const Y=this.d*j+G;if((!S||S(this._convertFromCellCoord(G),this._convertFromCellCoord(j),this._convertFromCellCoord(G+1),this._convertFromCellCoord(j+1)))&&v.call(this,r,l,f,m,Y,x,I,S))return}}_convertFromCellCoord(r){return(r-this.padding)/this.scale}_convertToCellCoord(r){return Math.max(0,Math.min(this.d-1,Math.floor(r*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const r=this.cells,l=3+this.cells.length+1+1;let f=0;for(let x=0;x=0)continue;const x=s[v];m[v]=na[f].shallow.indexOf(v)>=0?x:Gl(x,r)}s instanceof Error&&(m.message=s.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(m.$name=f),m}throw new Error("can't serialize object of type "+typeof s)}function Du(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||s instanceof Blob||s instanceof Error||yp(s)||Oe(s)||ArrayBuffer.isView(s)||s instanceof ImageData)return s;if(Array.isArray(s))return s.map(Du);if(typeof s=="object"){const r=s.$name||"Object";if(!na[r])throw new Error(`can't deserialize unregistered class ${r}`);const{klass:l}=na[r];if(!l)throw new Error(`can't deserialize unregistered class ${r}`);if(l.deserialize)return l.deserialize(s);const f=Object.create(l.prototype);for(const m of Object.keys(s)){if(m==="$name")continue;const v=s[m];f[m]=na[r].shallow.indexOf(m)>=0?v:Du(v)}return f}throw new Error("can't deserialize object of type "+typeof s)}class Gc{constructor(){this.first=!0}update(r,l){const f=Math.floor(r);return this.first?(this.first=!1,this.lastIntegerZoom=f,this.lastIntegerZoomTime=0,this.lastZoom=r,this.lastFloorZoom=f,!0):(this.lastFloorZoom>f?(this.lastIntegerZoom=f+1,this.lastIntegerZoomTime=l):this.lastFloorZooms>=128&&s<=255,Arabic:s=>s>=1536&&s<=1791,"Arabic Supplement":s=>s>=1872&&s<=1919,"Arabic Extended-A":s=>s>=2208&&s<=2303,"Hangul Jamo":s=>s>=4352&&s<=4607,"Unified Canadian Aboriginal Syllabics":s=>s>=5120&&s<=5759,Khmer:s=>s>=6016&&s<=6143,"Unified Canadian Aboriginal Syllabics Extended":s=>s>=6320&&s<=6399,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"CJK Radicals Supplement":s=>s>=11904&&s<=12031,"Kangxi Radicals":s=>s>=12032&&s<=12255,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Hiragana:s=>s>=12352&&s<=12447,Katakana:s=>s>=12448&&s<=12543,Bopomofo:s=>s>=12544&&s<=12591,"Hangul Compatibility Jamo":s=>s>=12592&&s<=12687,Kanbun:s=>s>=12688&&s<=12703,"Bopomofo Extended":s=>s>=12704&&s<=12735,"CJK Strokes":s=>s>=12736&&s<=12783,"Katakana Phonetic Extensions":s=>s>=12784&&s<=12799,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"CJK Unified Ideographs Extension A":s=>s>=13312&&s<=19903,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"CJK Unified Ideographs":s=>s>=19968&&s<=40959,"Yi Syllables":s=>s>=40960&&s<=42127,"Yi Radicals":s=>s>=42128&&s<=42191,"Hangul Jamo Extended-A":s=>s>=43360&&s<=43391,"Hangul Syllables":s=>s>=44032&&s<=55215,"Hangul Jamo Extended-B":s=>s>=55216&&s<=55295,"Private Use Area":s=>s>=57344&&s<=63743,"CJK Compatibility Ideographs":s=>s>=63744&&s<=64255,"Arabic Presentation Forms-A":s=>s>=64336&&s<=65023,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Arabic Presentation Forms-B":s=>s>=65136&&s<=65279,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function qc(s){for(const r of s)if(jc(r.charCodeAt(0)))return!0;return!1}function Pd(s){for(const r of s)if(!Md(r.charCodeAt(0)))return!1;return!0}function Md(s){return!(ae.Arabic(s)||ae["Arabic Supplement"](s)||ae["Arabic Extended-A"](s)||ae["Arabic Presentation Forms-A"](s)||ae["Arabic Presentation Forms-B"](s))}function jc(s){return!(s!==746&&s!==747&&(s<4352||!(ae["Bopomofo Extended"](s)||ae.Bopomofo(s)||ae["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ae["CJK Compatibility Ideographs"](s)||ae["CJK Compatibility"](s)||ae["CJK Radicals Supplement"](s)||ae["CJK Strokes"](s)||!(!ae["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ae["CJK Unified Ideographs Extension A"](s)||ae["CJK Unified Ideographs"](s)||ae["Enclosed CJK Letters and Months"](s)||ae["Hangul Compatibility Jamo"](s)||ae["Hangul Jamo Extended-A"](s)||ae["Hangul Jamo Extended-B"](s)||ae["Hangul Jamo"](s)||ae["Hangul Syllables"](s)||ae.Hiragana(s)||ae["Ideographic Description Characters"](s)||ae.Kanbun(s)||ae["Kangxi Radicals"](s)||ae["Katakana Phonetic Extensions"](s)||ae.Katakana(s)&&s!==12540||!(!ae["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ae["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ae["Unified Canadian Aboriginal Syllabics"](s)||ae["Unified Canadian Aboriginal Syllabics Extended"](s)||ae["Vertical Forms"](s)||ae["Yijing Hexagram Symbols"](s)||ae["Yi Syllables"](s)||ae["Yi Radicals"](s))))}function Zc(s){return!(jc(s)||function(r){return!!(ae["Latin-1 Supplement"](r)&&(r===167||r===169||r===174||r===177||r===188||r===189||r===190||r===215||r===247)||ae["General Punctuation"](r)&&(r===8214||r===8224||r===8225||r===8240||r===8241||r===8251||r===8252||r===8258||r===8263||r===8264||r===8265||r===8273)||ae["Letterlike Symbols"](r)||ae["Number Forms"](r)||ae["Miscellaneous Technical"](r)&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||r===9003||r>=9085&&r<=9114||r>=9150&&r<=9165||r===9167||r>=9169&&r<=9179||r>=9186&&r<=9215)||ae["Control Pictures"](r)&&r!==9251||ae["Optical Character Recognition"](r)||ae["Enclosed Alphanumerics"](r)||ae["Geometric Shapes"](r)||ae["Miscellaneous Symbols"](r)&&!(r>=9754&&r<=9759)||ae["Miscellaneous Symbols and Arrows"](r)&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||ae["CJK Symbols and Punctuation"](r)||ae.Katakana(r)||ae["Private Use Area"](r)||ae["CJK Compatibility Forms"](r)||ae["Small Form Variants"](r)||ae["Halfwidth and Fullwidth Forms"](r)||r===8734||r===8756||r===8757||r>=9984&&r<=10087||r>=10102&&r<=10131||r===65532||r===65533)}(s))}function vp(s){return s>=1424&&s<=2303||ae["Arabic Presentation Forms-A"](s)||ae["Arabic Presentation Forms-B"](s)}function vg(s,r){return!(!r&&vp(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ae.Khmer(s))}function Ad(s){for(const r of s)if(vp(r.charCodeAt(0)))return!0;return!1}const ol=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Xn{constructor(r,l){this.zoom=r,l?(this.now=l.now,this.fadeDuration=l.fadeDuration,this.zoomHistory=l.zoomHistory,this.transition=l.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gc,this.transition={})}isSupportedScript(r){return function(l,f){for(const m of l)if(!vg(m.charCodeAt(0),f))return!1;return!0}(r,ol.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const r=this.zoom,l=r-Math.floor(r),f=this.crossFadingFactor();return r>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:l+(1-l)*f}:{fromScale:.5,toScale:1,t:1-(1-f)*l}}}class Ru{constructor(r,l){this.property=r,this.value=l,this.expression=function(f,m){if(Ac(f))return new Dc(f,m);if(Vn(f)){const v=gd(f,m);if(v.result==="error")throw new Error(v.value.map(x=>`${x.key}: ${x.message}`).join(", "));return v.value}{let v=f;return m.type==="color"&&typeof f=="string"?v=Pn.parse(f):m.type!=="padding"||typeof f!="number"&&!Array.isArray(f)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(f)&&(v=Oo.parse(f)):v=io.parse(f),{kind:"constant",evaluate:()=>v}}}(l===void 0?r.specification.default:l,r.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(r,l,f){return this.property.possiblyEvaluate(this,r,l,f)}}class Wc{constructor(r){this.property=r,this.value=new Ru(r,void 0)}transitioned(r,l){return new Dd(this.property,this.value,l,gt({},r.transition,this.transition),r.now)}untransitioned(){return new Dd(this.property,this.value,null,{},0)}}class kd{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitionablePropertyValues)}getValue(r){return mt(this._values[r].value.value)}setValue(r,l){Object.prototype.hasOwnProperty.call(this._values,r)||(this._values[r]=new Wc(this._values[r].property)),this._values[r].value=new Ru(this._values[r].property,l===null?void 0:mt(l))}getTransition(r){return mt(this._values[r].transition)}setTransition(r,l){Object.prototype.hasOwnProperty.call(this._values,r)||(this._values[r]=new Wc(this._values[r].property)),this._values[r].transition=mt(l)||void 0}serialize(){const r={};for(const l of Object.keys(this._values)){const f=this.getValue(l);f!==void 0&&(r[l]=f);const m=this.getTransition(l);m!==void 0&&(r[`${l}-transition`]=m)}return r}transitioned(r,l){const f=new xp(this._properties);for(const m of Object.keys(this._values))f._values[m]=this._values[m].transitioned(r,l._values[m]);return f}untransitioned(){const r=new xp(this._properties);for(const l of Object.keys(this._values))r._values[l]=this._values[l].untransitioned();return r}}class Dd{constructor(r,l,f,m,v){this.property=r,this.value=l,this.begin=v+m.delay||0,this.end=this.begin+m.duration||0,r.specification.transition&&(m.delay||m.duration)&&(this.prior=f)}possiblyEvaluate(r,l,f){const m=r.now||0,v=this.value.possiblyEvaluate(r,l,f),x=this.prior;if(x){if(m>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(m=1)return 1;const M=S*S,D=M*S;return 4*(S<.5?D:3*(S-M)+D-.75)}(I))}}return v}}class xp{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitioningPropertyValues)}possiblyEvaluate(r,l,f){const m=new Nu(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(r,l,f);return m}hasTransition(){for(const r of Object.keys(this._values))if(this._values[r].prior)return!0;return!1}}class Rd{constructor(r){this._properties=r,this._values=Object.create(r.defaultPropertyValues)}hasValue(r){return this._values[r].value!==void 0}getValue(r){return mt(this._values[r].value)}setValue(r,l){this._values[r]=new Ru(this._values[r].property,l===null?void 0:mt(l))}serialize(){const r={};for(const l of Object.keys(this._values)){const f=this.getValue(l);f!==void 0&&(r[l]=f)}return r}possiblyEvaluate(r,l,f){const m=new Nu(this._properties);for(const v of Object.keys(this._values))m._values[v]=this._values[v].possiblyEvaluate(r,l,f);return m}}class ns{constructor(r,l,f){this.property=r,this.value=l,this.parameters=f}isConstant(){return this.value.kind==="constant"}constantOr(r){return this.value.kind==="constant"?this.value.value:r}evaluate(r,l,f,m){return this.property.evaluate(this.value,this.parameters,r,l,f,m)}}class Nu{constructor(r){this._properties=r,this._values=Object.create(r.defaultPossiblyEvaluatedValues)}get(r){return this._values[r]}}class be{constructor(r){this.specification=r}possiblyEvaluate(r,l){if(r.isDataDriven())throw new Error("Value should not be data driven");return r.expression.evaluate(l)}interpolate(r,l,f){const m=Ur[this.specification.type];return m?m(r,l,f):r}}class ke{constructor(r,l){this.specification=r,this.overrides=l}possiblyEvaluate(r,l,f,m){return new ns(this,r.expression.kind==="constant"||r.expression.kind==="camera"?{kind:"constant",value:r.expression.evaluate(l,null,{},f,m)}:r.expression,l)}interpolate(r,l,f){if(r.value.kind!=="constant"||l.value.kind!=="constant")return r;if(r.value.value===void 0||l.value.value===void 0)return new ns(this,{kind:"constant",value:void 0},r.parameters);const m=Ur[this.specification.type];if(m){const v=m(r.value.value,l.value.value,f);return new ns(this,{kind:"constant",value:v},r.parameters)}return r}evaluate(r,l,f,m,v,x){return r.kind==="constant"?r.value:r.evaluate(l,f,m,v,x)}}class ql extends ke{possiblyEvaluate(r,l,f,m){if(r.value===void 0)return new ns(this,{kind:"constant",value:void 0},l);if(r.expression.kind==="constant"){const v=r.expression.evaluate(l,null,{},f,m),x=r.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,I=this._calculate(x,x,x,l);return new ns(this,{kind:"constant",value:I},l)}if(r.expression.kind==="camera"){const v=this._calculate(r.expression.evaluate({zoom:l.zoom-1}),r.expression.evaluate({zoom:l.zoom}),r.expression.evaluate({zoom:l.zoom+1}),l);return new ns(this,{kind:"constant",value:v},l)}return new ns(this,r.expression,l)}evaluate(r,l,f,m,v,x){if(r.kind==="source"){const I=r.evaluate(l,f,m,v,x);return this._calculate(I,I,I,l)}return r.kind==="composite"?this._calculate(r.evaluate({zoom:Math.floor(l.zoom)-1},f,m),r.evaluate({zoom:Math.floor(l.zoom)},f,m),r.evaluate({zoom:Math.floor(l.zoom)+1},f,m),l):r.value}_calculate(r,l,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:r,to:l}:{from:f,to:l}}interpolate(r){return r}}class bp{constructor(r){this.specification=r}possiblyEvaluate(r,l,f,m){if(r.value!==void 0){if(r.expression.kind==="constant"){const v=r.expression.evaluate(l,null,{},f,m);return this._calculate(v,v,v,l)}return this._calculate(r.expression.evaluate(new Xn(Math.floor(l.zoom-1),l)),r.expression.evaluate(new Xn(Math.floor(l.zoom),l)),r.expression.evaluate(new Xn(Math.floor(l.zoom+1),l)),l)}}_calculate(r,l,f,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:r,to:l}:{from:f,to:l}}interpolate(r){return r}}class wp{constructor(r){this.specification=r}possiblyEvaluate(r,l,f,m){return!!r.expression.evaluate(l,null,{},f,m)}interpolate(){return!1}}class qr{constructor(r){this.properties=r,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const l in r){const f=r[l];f.specification.overridable&&this.overridableProperties.push(l);const m=this.defaultPropertyValues[l]=new Ru(f,void 0),v=this.defaultTransitionablePropertyValues[l]=new Wc(f);this.defaultTransitioningPropertyValues[l]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[l]=m.possiblyEvaluate({})}}}de("DataDrivenProperty",ke),de("DataConstantProperty",be),de("CrossFadedDataDrivenProperty",ql),de("CrossFadedProperty",bp),de("ColorRampProperty",wp);const Ip="-transition";class is extends Ri{constructor(r,l){if(super(),this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1},r.type!=="custom"&&(this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),l.layout&&(this._unevaluatedLayout=new Rd(l.layout)),l.paint)){this._transitionablePaint=new kd(l.paint);for(const f in r.paint)this.setPaintProperty(f,r.paint[f],{validate:!1});for(const f in r.layout)this.setLayoutProperty(f,r.layout[f],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Nu(l.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,l,f={}){l!=null&&this._validate(ku,`layers.${this.id}.layout.${r}`,r,l,f)||(r!=="visibility"?this._unevaluatedLayout.setValue(r,l):this.visibility=l)}getPaintProperty(r){return r.endsWith(Ip)?this._transitionablePaint.getTransition(r.slice(0,-11)):this._transitionablePaint.getValue(r)}setPaintProperty(r,l,f={}){if(l!=null&&this._validate(yg,`layers.${this.id}.paint.${r}`,r,l,f))return!1;if(r.endsWith(Ip))return this._transitionablePaint.setTransition(r.slice(0,-11),l||void 0),!1;{const m=this._transitionablePaint._values[r],v=m.property.specification["property-type"]==="cross-faded-data-driven",x=m.value.isDataDriven(),I=m.value;this._transitionablePaint.setValue(r,l),this._handleSpecialPaintPropertyUpdate(r);const S=this._transitionablePaint._values[r].value;return S.isDataDriven()||x||v||this._handleOverridablePaintPropertyUpdate(r,I,S)}}_handleSpecialPaintPropertyUpdate(r){}_handleOverridablePaintPropertyUpdate(r,l,f){return!1}isHidden(r){return!!(this.minzoom&&r=this.maxzoom)||this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,l){r.getCrossfadeParameters&&(this._crossfadeParameters=r.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,l)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,l)}serialize(){const r={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&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),Ft(r,(l,f)=>!(l===void 0||f==="layout"&&!Object.keys(l).length||f==="paint"&&!Object.keys(l).length))}_validate(r,l,f,m,v={}){return(!v||v.validate!==!1)&&Ld(this,r.call(Au,{key:l,layerType:this.type,objectKey:f,value:m,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const r in this.paint._values){const l=this.paint.get(r);if(l instanceof ns&&Bl(l.property.specification)&&(l.value.kind==="source"||l.value.kind==="composite")&&l.value.isStateDependent)return!0}return!1}}const xg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class zu{constructor(r,l){this._structArray=r,this._pos1=l*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class hi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(r,l){return r._trim(),l&&(r.isTransferred=!0,l.push(r.arrayBuffer)),{length:r.length,arrayBuffer:r.arrayBuffer}}static deserialize(r){const l=Object.create(this.prototype);return l.arrayBuffer=r.arrayBuffer,l.length=r.length,l.capacity=r.arrayBuffer.byteLength/l.bytesPerElement,l._refreshViews(),l}_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(r){this.reserve(r),this.length=r}reserve(r){if(r>this.capacity){this.capacity=Math.max(r,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const l=this.uint8;this._refreshViews(),l&&this.uint8.set(l)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Si(s,r=1){let l=0,f=0;return{members:s.map(m=>{const v=xg[m.type].BYTES_PER_ELEMENT,x=l=Nd(l,Math.max(r,v)),I=m.components||1;return f=Math.max(f,v),l+=v*I,{name:m.name,type:m.type,components:I,offset:x}}),size:Nd(l,Math.max(f,r)),alignment:r}}function Nd(s,r){return Math.ceil(s/r)*r}class Ss extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l){const f=this.length;return this.resize(f+1),this.emplace(f,r,l)}emplace(r,l,f){const m=2*r;return this.int16[m+0]=l,this.int16[m+1]=f,r}}Ss.prototype.bytesPerElement=4,de("StructArrayLayout2i4",Ss);class Hc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.int16[v+0]=l,this.int16[v+1]=f,this.int16[v+2]=m,r}}Hc.prototype.bytesPerElement=6,de("StructArrayLayout3i6",Hc);class Ep extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,r,l,f,m)}emplace(r,l,f,m,v){const x=4*r;return this.int16[x+0]=l,this.int16[x+1]=f,this.int16[x+2]=m,this.int16[x+3]=v,r}}Ep.prototype.bytesPerElement=8,de("StructArrayLayout4i8",Ep);class Sp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x){const I=this.length;return this.resize(I+1),this.emplace(I,r,l,f,m,v,x)}emplace(r,l,f,m,v,x,I){const S=6*r;return this.int16[S+0]=l,this.int16[S+1]=f,this.int16[S+2]=m,this.int16[S+3]=v,this.int16[S+4]=x,this.int16[S+5]=I,r}}Sp.prototype.bytesPerElement=12,de("StructArrayLayout2i4i12",Sp);class Cp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x){const I=this.length;return this.resize(I+1),this.emplace(I,r,l,f,m,v,x)}emplace(r,l,f,m,v,x,I){const S=4*r,M=8*r;return this.int16[S+0]=l,this.int16[S+1]=f,this.uint8[M+4]=m,this.uint8[M+5]=v,this.uint8[M+6]=x,this.uint8[M+7]=I,r}}Cp.prototype.bytesPerElement=8,de("StructArrayLayout2i4ub8",Cp);class jl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l){const f=this.length;return this.resize(f+1),this.emplace(f,r,l)}emplace(r,l,f){const m=2*r;return this.float32[m+0]=l,this.float32[m+1]=f,r}}jl.prototype.bytesPerElement=8,de("StructArrayLayout2f8",jl);class Tp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x,I,S,M,D){const N=this.length;return this.resize(N+1),this.emplace(N,r,l,f,m,v,x,I,S,M,D)}emplace(r,l,f,m,v,x,I,S,M,D,N){const F=10*r;return this.uint16[F+0]=l,this.uint16[F+1]=f,this.uint16[F+2]=m,this.uint16[F+3]=v,this.uint16[F+4]=x,this.uint16[F+5]=I,this.uint16[F+6]=S,this.uint16[F+7]=M,this.uint16[F+8]=D,this.uint16[F+9]=N,r}}Tp.prototype.bytesPerElement=20,de("StructArrayLayout10ui20",Tp);class Lp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x,I,S,M,D,N,F){const G=this.length;return this.resize(G+1),this.emplace(G,r,l,f,m,v,x,I,S,M,D,N,F)}emplace(r,l,f,m,v,x,I,S,M,D,N,F,G){const j=12*r;return this.int16[j+0]=l,this.int16[j+1]=f,this.int16[j+2]=m,this.int16[j+3]=v,this.uint16[j+4]=x,this.uint16[j+5]=I,this.uint16[j+6]=S,this.uint16[j+7]=M,this.int16[j+8]=D,this.int16[j+9]=N,this.int16[j+10]=F,this.int16[j+11]=G,r}}Lp.prototype.bytesPerElement=24,de("StructArrayLayout4i4ui4i24",Lp);class ia extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.float32[v+0]=l,this.float32[v+1]=f,this.float32[v+2]=m,r}}ia.prototype.bytesPerElement=12,de("StructArrayLayout3f12",ia);class Xc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){const l=this.length;return this.resize(l+1),this.emplace(l,r)}emplace(r,l){return this.uint32[1*r+0]=l,r}}Xc.prototype.bytesPerElement=4,de("StructArrayLayout1ul4",Xc);class Ou extends hi{_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(r,l,f,m,v,x,I,S,M){const D=this.length;return this.resize(D+1),this.emplace(D,r,l,f,m,v,x,I,S,M)}emplace(r,l,f,m,v,x,I,S,M,D){const N=10*r,F=5*r;return this.int16[N+0]=l,this.int16[N+1]=f,this.int16[N+2]=m,this.int16[N+3]=v,this.int16[N+4]=x,this.int16[N+5]=I,this.uint32[F+3]=S,this.uint16[N+8]=M,this.uint16[N+9]=D,r}}Ou.prototype.bytesPerElement=20,de("StructArrayLayout6i1ul2ui20",Ou);class Yc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v,x){const I=this.length;return this.resize(I+1),this.emplace(I,r,l,f,m,v,x)}emplace(r,l,f,m,v,x,I){const S=6*r;return this.int16[S+0]=l,this.int16[S+1]=f,this.int16[S+2]=m,this.int16[S+3]=v,this.int16[S+4]=x,this.int16[S+5]=I,r}}Yc.prototype.bytesPerElement=12,de("StructArrayLayout2i2i2i12",Yc);class Fu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,l,f,m,v){const x=this.length;return this.resize(x+1),this.emplace(x,r,l,f,m,v)}emplace(r,l,f,m,v,x){const I=4*r,S=8*r;return this.float32[I+0]=l,this.float32[I+1]=f,this.float32[I+2]=m,this.int16[S+6]=v,this.int16[S+7]=x,r}}Fu.prototype.bytesPerElement=16,de("StructArrayLayout2f1f2i16",Fu);class Pp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,r,l,f,m)}emplace(r,l,f,m,v){const x=12*r,I=3*r;return this.uint8[x+0]=l,this.uint8[x+1]=f,this.float32[I+1]=m,this.float32[I+2]=v,r}}Pp.prototype.bytesPerElement=12,de("StructArrayLayout2ub2f12",Pp);class sl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.uint16[v+0]=l,this.uint16[v+1]=f,this.uint16[v+2]=m,r}}sl.prototype.bytesPerElement=6,de("StructArrayLayout3ui6",sl);class al extends hi{_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(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at){const bt=this.length;return this.resize(bt+1),this.emplace(bt,r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at)}emplace(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt){const ct=24*r,_t=12*r,Ot=48*r;return this.int16[ct+0]=l,this.int16[ct+1]=f,this.uint16[ct+2]=m,this.uint16[ct+3]=v,this.uint32[_t+2]=x,this.uint32[_t+3]=I,this.uint32[_t+4]=S,this.uint16[ct+10]=M,this.uint16[ct+11]=D,this.uint16[ct+12]=N,this.float32[_t+7]=F,this.float32[_t+8]=G,this.uint8[Ot+36]=j,this.uint8[Ot+37]=Y,this.uint8[Ot+38]=it,this.uint32[_t+10]=at,this.int16[ct+22]=bt,r}}al.prototype.bytesPerElement=48,de("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",al);class Mp extends hi{_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(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt,ct,_t,Ot,Vt,ue,ve,le,oe,Qt,_e){const $t=this.length;return this.resize($t+1),this.emplace($t,r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt,ct,_t,Ot,Vt,ue,ve,le,oe,Qt,_e)}emplace(r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y,it,at,bt,ct,_t,Ot,Vt,ue,ve,le,oe,Qt,_e,$t){const jt=32*r,Le=16*r;return this.int16[jt+0]=l,this.int16[jt+1]=f,this.int16[jt+2]=m,this.int16[jt+3]=v,this.int16[jt+4]=x,this.int16[jt+5]=I,this.int16[jt+6]=S,this.int16[jt+7]=M,this.uint16[jt+8]=D,this.uint16[jt+9]=N,this.uint16[jt+10]=F,this.uint16[jt+11]=G,this.uint16[jt+12]=j,this.uint16[jt+13]=Y,this.uint16[jt+14]=it,this.uint16[jt+15]=at,this.uint16[jt+16]=bt,this.uint16[jt+17]=ct,this.uint16[jt+18]=_t,this.uint16[jt+19]=Ot,this.uint16[jt+20]=Vt,this.uint16[jt+21]=ue,this.uint16[jt+22]=ve,this.uint32[Le+12]=le,this.float32[Le+13]=oe,this.float32[Le+14]=Qt,this.uint16[jt+30]=_e,this.uint16[jt+31]=$t,r}}Mp.prototype.bytesPerElement=64,de("StructArrayLayout8i15ui1ul2f2ui64",Mp);class Bu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){const l=this.length;return this.resize(l+1),this.emplace(l,r)}emplace(r,l){return this.float32[1*r+0]=l,r}}Bu.prototype.bytesPerElement=4,de("StructArrayLayout1f4",Bu);class ll extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=3*r;return this.uint16[6*r+0]=l,this.float32[v+1]=f,this.float32[v+2]=m,r}}ll.prototype.bytesPerElement=12,de("StructArrayLayout1ui2f12",ll);class Ap extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l,f){const m=this.length;return this.resize(m+1),this.emplace(m,r,l,f)}emplace(r,l,f,m){const v=4*r;return this.uint32[2*r+0]=l,this.uint16[v+2]=f,this.uint16[v+3]=m,r}}Ap.prototype.bytesPerElement=8,de("StructArrayLayout1ul2ui8",Ap);class kp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,l){const f=this.length;return this.resize(f+1),this.emplace(f,r,l)}emplace(r,l,f){const m=2*r;return this.uint16[m+0]=l,this.uint16[m+1]=f,r}}kp.prototype.bytesPerElement=4,de("StructArrayLayout2ui4",kp);class Kc extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){const l=this.length;return this.resize(l+1),this.emplace(l,r)}emplace(r,l){return this.uint16[1*r+0]=l,r}}Kc.prototype.bytesPerElement=2,de("StructArrayLayout1ui2",Kc);class Dp extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,l,f,m){const v=this.length;return this.resize(v+1),this.emplace(v,r,l,f,m)}emplace(r,l,f,m,v){const x=4*r;return this.float32[x+0]=l,this.float32[x+1]=f,this.float32[x+2]=m,this.float32[x+3]=v,r}}Dp.prototype.bytesPerElement=16,de("StructArrayLayout4f16",Dp);class _ extends zu{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 P(this.anchorPointX,this.anchorPointY)}}_.prototype.size=20;class o extends Ou{get(r){return new _(this,r)}}de("CollisionBoxArray",o);class h extends zu{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(r){this._structArray.uint8[this._pos1+37]=r}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(r){this._structArray.uint8[this._pos1+38]=r}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(r){this._structArray.uint32[this._pos4+10]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}h.prototype.size=48;class d extends al{get(r){return new h(this,r)}}de("PlacedSymbolArray",d);class g extends zu{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(r){this._structArray.uint32[this._pos4+12]=r}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]}}g.prototype.size=64;class y extends Mp{get(r){return new g(this,r)}}de("SymbolInstanceArray",y);class E extends Bu{getoffsetX(r){return this.float32[1*r+0]}}de("GlyphOffsetArray",E);class C extends Hc{getx(r){return this.int16[3*r+0]}gety(r){return this.int16[3*r+1]}gettileUnitDistanceFromAnchor(r){return this.int16[3*r+2]}}de("SymbolLineVertexArray",C);class L extends zu{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}L.prototype.size=12;class A extends ll{get(r){return new L(this,r)}}de("TextAnchorOffsetArray",A);class R extends zu{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]}}R.prototype.size=8;class z extends Ap{get(r){return new R(this,r)}}de("FeatureIndexArray",z);class q extends Ss{}class et extends Ss{}class Q extends Ss{}class nt extends Sp{}class K extends Cp{}class pt extends jl{}class Et extends Tp{}class st extends Lp{}class yt extends ia{}class kt extends Xc{}class Pt extends Yc{}class Bt extends Pp{}class qt extends sl{}class Ut extends kp{}const Ht=Si([{name:"a_pos",components:2,type:"Int16"}],4),{members:me}=Ht;class Ae{constructor(r=[]){this.segments=r}prepareSegment(r,l,f,m){let v=this.segments[this.segments.length-1];return r>Ae.MAX_VERTEX_ARRAY_LENGTH&&ie(`Max vertices per segment is ${Ae.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}`),(!v||v.vertexLength+r>Ae.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==m)&&(v={vertexOffset:l.length,primitiveOffset:f.length,vertexLength:0,primitiveLength:0},m!==void 0&&(v.sortKey=m),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const r of this.segments)for(const l in r.vaos)r.vaos[l].destroy()}static simpleSegment(r,l,f,m){return new Ae([{vertexOffset:r,primitiveOffset:l,vertexLength:f,primitiveLength:m,vaos:{},sortKey:0}])}}function re(s,r){return 256*(s=ht(Math.floor(s),0,255))+ht(Math.floor(r),0,255)}Ae.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,de("SegmentVector",Ae);const Pe=Si([{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 ye={exports:{}},Yn={exports:{}};Yn.exports=function(s,r){var l,f,m,v,x,I,S,M;for(f=s.length-(l=3&s.length),m=r,x=3432918353,I=461845907,M=0;M>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*I+(((S>>>16)*I&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(S=0,l){case 3:S^=(255&s.charCodeAt(M+2))<<16;case 2:S^=(255&s.charCodeAt(M+1))<<8;case 1:m^=S=(65535&(S=(S=(65535&(S^=255&s.charCodeAt(M)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*I+(((S>>>16)*I&65535)<<16)&4294967295}return m^=s.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var an=Yn.exports,Je={exports:{}};Je.exports=function(s,r){for(var l,f=s.length,m=r^f,v=0;f>=4;)l=1540483477*(65535&(l=255&s.charCodeAt(v)|(255&s.charCodeAt(++v))<<8|(255&s.charCodeAt(++v))<<16|(255&s.charCodeAt(++v))<<24))+((1540483477*(l>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),f-=4,++v;switch(f){case 3:m^=(255&s.charCodeAt(v+2))<<16;case 2:m^=(255&s.charCodeAt(v+1))<<8;case 1:m=1540483477*(65535&(m^=255&s.charCodeAt(v)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var ln=an,Ci=Je.exports;ye.exports=ln,ye.exports.murmur3=ln,ye.exports.murmur2=Ci;var Nn=b(ye.exports);class jr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(r,l,f,m){this.ids.push(ir(r)),this.positions.push(l,f,m)}getPositions(r){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const l=ir(r);let f=0,m=this.ids.length-1;for(;f>1;this.ids[x]>=l?m=x:f=x+1}const v=[];for(;this.ids[f]===l;)v.push({index:this.positions[3*f],start:this.positions[3*f+1],end:this.positions[3*f+2]}),f++;return v}static serialize(r,l){const f=new Float64Array(r.ids),m=new Uint32Array(r.positions);return pi(f,m,0,f.length-1),l&&l.push(f.buffer,m.buffer),{ids:f,positions:m}}static deserialize(r){const l=new jr;return l.ids=r.ids,l.positions=r.positions,l.indexed=!0,l}}function ir(s){const r=+s;return!isNaN(r)&&r<=Number.MAX_SAFE_INTEGER?r:Nn(String(s))}function pi(s,r,l,f){for(;l>1];let v=l-1,x=f+1;for(;;){do v++;while(s[v]m);if(v>=x)break;Er(s,v,x),Er(r,3*v,3*x),Er(r,3*v+1,3*x+1),Er(r,3*v+2,3*x+2)}x-l`u_${m}`),this.type=f}setUniform(r,l,f){r.set(f.constantOr(this.value))}getBinding(r,l,f){return this.type==="color"?new Zl(r,l):new Vo(r,l)}}class Ti{constructor(r,l){this.uniformNames=l.map(f=>`u_${f}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(r,l){this.pixelRatioFrom=l.pixelRatio,this.pixelRatioTo=r.pixelRatio,this.patternFrom=l.tlbr,this.patternTo=r.tlbr}setUniform(r,l,f,m){const v=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&r.set(v)}getBinding(r,l,f){return f.substr(0,9)==="u_pattern"?new Pa(r,l):new Vo(r,l)}}class fi{constructor(r,l,f,m){this.expression=r,this.type=f,this.maxValue=0,this.paintVertexAttributes=l.map(v=>({name:`a_${v}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(r,l,f,m,v){const x=this.paintVertexArray.length,I=this.expression.evaluate(new Xn(0),l,{},m,[],v);this.paintVertexArray.resize(r),this._setPaintValue(x,r,I)}updatePaintArray(r,l,f,m){const v=this.expression.evaluate({zoom:0},f,m);this._setPaintValue(r,l,v)}_setPaintValue(r,l,f){if(this.type==="color"){const m=Ma(f);for(let v=r;v`u_${I}_t`),this.type=f,this.useIntegerZoom=m,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=l.map(I=>({name:`a_${I}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(r,l,f,m,v){const x=this.expression.evaluate(new Xn(this.zoom),l,{},m,[],v),I=this.expression.evaluate(new Xn(this.zoom+1),l,{},m,[],v),S=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValue(S,r,x,I)}updatePaintArray(r,l,f,m){const v=this.expression.evaluate({zoom:this.zoom},f,m),x=this.expression.evaluate({zoom:this.zoom+1},f,m);this._setPaintValue(r,l,v,x)}_setPaintValue(r,l,f,m){if(this.type==="color"){const v=Ma(f),x=Ma(m);for(let I=r;I`#define HAS_UNIFORM_${m}`))}return r}getBinderAttributes(){const r=[];for(const l in this.binders){const f=this.binders[l];if(f instanceof fi||f instanceof Zr)for(let m=0;m!0){this.programConfigurations={};for(const m of r)this.programConfigurations[m.id]=new Gi(m,l,f);this.needsUpload=!1,this._featureMap=new jr,this._bufferOffset=0}populatePaintArrays(r,l,f,m,v,x){for(const I in this.programConfigurations)this.programConfigurations[I].populatePaintArrays(r,l,m,v,x);l.id!==void 0&&this._featureMap.add(l.id,f,this._bufferOffset,r),this._bufferOffset=r,this.needsUpload=!0}updatePaintArrays(r,l,f,m){for(const v of f)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(r,this._featureMap,l,v,m)||this.needsUpload}get(r){return this.programConfigurations[r]}upload(r){if(this.needsUpload){for(const l in this.programConfigurations)this.programConfigurations[l].upload(r);this.needsUpload=!1}}destroy(){for(const r in this.programConfigurations)this.programConfigurations[r].destroy()}}function qi(s,r){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"]}[s]||[s.replace(`${r}-`,"").replace(/-/g,"_")]}function zd(s,r,l){const f={color:{source:jl,composite:Dp},number:{source:Bu,composite:jl}},m=function(v){return{"line-pattern":{source:Et,composite:Et},"fill-pattern":{source:Et,composite:Et},"fill-extrusion-pattern":{source:Et,composite:Et}}[v]}(s);return m&&m[l]||f[r][l]}de("ConstantBinder",Ui),de("CrossFadedConstantBinder",Ti),de("SourceExpressionBinder",fi),de("CrossFadedCompositeBinder",Kn),de("CompositeExpressionBinder",Zr),de("ProgramConfiguration",Gi,{omit:["_buffers"]}),de("ProgramConfigurationSet",rr);const vi=8192,Rp=Math.pow(2,14)-1,Od=-Rp-1;function ul(s){const r=vi/s.extent,l=s.loadGeometry();for(let f=0;fx.x+1||Sx.y+1)&&ie("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return l}function cl(s,r){return{type:s.type,id:s.id,properties:s.properties,geometry:r?ul(s):[]}}function ra(s,r,l,f,m){s.emplaceBack(2*r+(f+1)/2,2*l+(m+1)/2)}class Jc{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(l=>l.id),this.index=r.index,this.hasPattern=!1,this.layoutVertexArray=new et,this.indexArray=new qt,this.segments=new Ae,this.programConfigurations=new rr(r.layers,r.zoom),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){const m=this.layers[0],v=[];let x=null,I=!1;m.type==="circle"&&(x=m.layout.get("circle-sort-key"),I=!x.isConstant());for(const{feature:S,id:M,index:D,sourceLayerIndex:N}of r){const F=this.layers[0]._featureFilter.needGeometry,G=cl(S,F);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),G,f))continue;const j=I?x.evaluate(G,{},f):void 0,Y={id:M,properties:S.properties,type:S.type,sourceLayerIndex:N,index:D,geometry:F?G.geometry:ul(S),patterns:{},sortKey:j};v.push(Y)}I&&v.sort((S,M)=>S.sortKey-M.sortKey);for(const S of v){const{geometry:M,index:D,sourceLayerIndex:N}=S,F=r[D].feature;this.addFeature(S,M,D,f),l.featureIndex.insert(F,M,D,N,this.index)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,me),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(r,l,f,m){for(const v of l)for(const x of v){const I=x.x,S=x.y;if(I<0||I>=vi||S<0||S>=vi)continue;const M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,r.sortKey),D=M.vertexLength;ra(this.layoutVertexArray,I,S,-1,-1),ra(this.layoutVertexArray,I,S,1,-1),ra(this.layoutVertexArray,I,S,1,1),ra(this.layoutVertexArray,I,S,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),M.vertexLength+=4,M.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,f,{},m)}}function Np(s,r){for(let l=0;l1){if(Vu(s,r))return!0;for(let f=0;f1?l:l.sub(r)._mult(m)._add(r))}function yy(s,r){let l,f,m,v=!1;for(let x=0;xr.y!=m.y>r.y&&r.x<(m.x-f.x)*(r.y-f.y)/(m.y-f.y)+f.x&&(v=!v)}return v}function $c(s,r){let l=!1;for(let f=0,m=s.length-1;fr.y!=x.y>r.y&&r.x<(x.x-v.x)*(r.y-v.y)/(x.y-v.y)+v.x&&(l=!l)}return l}function rb(s,r,l){const f=l[0],m=l[2];if(s.xm.x&&r.x>m.x||s.ym.y&&r.y>m.y)return!1;const v=Tt(s,r,l[0]);return v!==Tt(s,r,l[1])||v!==Tt(s,r,l[2])||v!==Tt(s,r,l[3])}function zp(s,r,l){const f=r.paint.get(s).value;return f.kind==="constant"?f.value:l.programConfigurations.get(r.id).getMaxValue(s)}function Vd(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function Ud(s,r,l,f,m){if(!r[0]&&!r[1])return s;const v=P.convert(r)._mult(m);l==="viewport"&&v._rotate(-f);const x=[];for(let I=0;Iwy(it,Y))}(M,S),G=N?D*I:D;for(const j of m)for(const Y of j){const it=N?Y:wy(Y,S);let at=G;const bt=Gd([],[Y.x,Y.y,0,1],S);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?at*=bt[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(at*=x.cameraToCenterDistance/bt[3]),Fd(F,it,at))return!0}return!1}}function wy(s,r){const l=Gd([],[s.x,s.y,0,1],r);return new P(l[0]/l[3],l[1]/l[3])}class Iy extends Jc{}let Ey;de("HeatmapBucket",Iy,{omit:["layers"]});var lb={get paint(){return Ey=Ey||new qr({"heatmap-radius":new ke(Mt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ke(Mt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new be(Mt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new wp(Mt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new be(Mt.paint_heatmap["heatmap-opacity"])})}};function Ig(s,{width:r,height:l},f,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==r*l*f)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${r*l*f}`)}else m=new Uint8Array(r*l*f);return s.width=r,s.height=l,s.data=m,s}function Sy(s,{width:r,height:l},f){if(r===s.width&&l===s.height)return;const m=Ig({},{width:r,height:l},f);Eg(s,m,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,r),height:Math.min(s.height,l)},f),s.width=r,s.height=l,s.data=m.data}function Eg(s,r,l,f,m,v){if(m.width===0||m.height===0)return r;if(m.width>s.width||m.height>s.height||l.x>s.width-m.width||l.y>s.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>r.width||m.height>r.height||f.x>r.width-m.width||f.y>r.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const x=s.data,I=r.data;if(x===I)throw new Error("srcData equals dstData, so image is already copied");for(let S=0;S{r[s.evaluationKey]=S;const M=s.expression.evaluate(r);m.data[x+I+0]=Math.floor(255*M.r/M.a),m.data[x+I+1]=Math.floor(255*M.g/M.a),m.data[x+I+2]=Math.floor(255*M.b/M.a),m.data[x+I+3]=Math.floor(255*M.a)};if(s.clips)for(let x=0,I=0;x80*l){f=v=s[0],m=x=s[1];for(var j=l;jv&&(v=I),S>x&&(x=S);M=(M=Math.max(v-f,x-m))!==0?32767/M:0}return Bp(F,G,l,f,m,M,0),G}function Ly(s,r,l,f,m){var v,x;if(m===Lg(s,r,l,f)>0)for(v=r;v=r;v-=f)x=Ay(v,s[v],s[v+1],x);return x&&jd(x,x.next)&&(Up(x),x=x.next),x}function Uu(s,r){if(!s)return s;r||(r=s);var l,f=s;do if(l=!1,f.steiner||!jd(f,f.next)&&Li(f.prev,f,f.next)!==0)f=f.next;else{if(Up(f),(f=r=f.prev)===f.next)break;l=!0}while(l||f!==r);return r}function Bp(s,r,l,f,m,v,x){if(s){!x&&v&&function(D,N,F,G){var j=D;do j.z===0&&(j.z=Cg(j.x,j.y,N,F,G)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==D);j.prevZ.nextZ=null,j.prevZ=null,function(Y){var it,at,bt,ct,_t,Ot,Vt,ue,ve=1;do{for(at=Y,Y=null,_t=null,Ot=0;at;){for(Ot++,bt=at,Vt=0,it=0;it0||ue>0&&bt;)Vt!==0&&(ue===0||!bt||at.z<=bt.z)?(ct=at,at=at.nextZ,Vt--):(ct=bt,bt=bt.nextZ,ue--),_t?_t.nextZ=ct:Y=ct,ct.prevZ=_t,_t=ct;at=bt}_t.nextZ=null,ve*=2}while(Ot>1)}(j)}(s,f,m,v);for(var I,S,M=s;s.prev!==s.next;)if(I=s.prev,S=s.next,v?mb(s,f,m,v):db(s))r.push(I.i/l|0),r.push(s.i/l|0),r.push(S.i/l|0),Up(s),s=S.next,M=S.next;else if((s=S)===M){x?x===1?Bp(s=gb(Uu(s),r,l),r,l,f,m,v,2):x===2&&_b(s,r,l,f,m,v):Bp(Uu(s),r,l,f,m,v,1);break}}}function db(s){var r=s.prev,l=s,f=s.next;if(Li(r,l,f)>=0)return!1;for(var m=r.x,v=l.x,x=f.x,I=r.y,S=l.y,M=f.y,D=mv?m>x?m:x:v>x?v:x,G=I>S?I>M?I:M:S>M?S:M,j=f.next;j!==r;){if(j.x>=D&&j.x<=F&&j.y>=N&&j.y<=G&&eh(m,I,v,S,x,M,j.x,j.y)&&Li(j.prev,j,j.next)>=0)return!1;j=j.next}return!0}function mb(s,r,l,f){var m=s.prev,v=s,x=s.next;if(Li(m,v,x)>=0)return!1;for(var I=m.x,S=v.x,M=x.x,D=m.y,N=v.y,F=x.y,G=IS?I>M?I:M:S>M?S:M,it=D>N?D>F?D:F:N>F?N:F,at=Cg(G,j,r,l,f),bt=Cg(Y,it,r,l,f),ct=s.prevZ,_t=s.nextZ;ct&&ct.z>=at&&_t&&_t.z<=bt;){if(ct.x>=G&&ct.x<=Y&&ct.y>=j&&ct.y<=it&&ct!==m&&ct!==x&&eh(I,D,S,N,M,F,ct.x,ct.y)&&Li(ct.prev,ct,ct.next)>=0||(ct=ct.prevZ,_t.x>=G&&_t.x<=Y&&_t.y>=j&&_t.y<=it&&_t!==m&&_t!==x&&eh(I,D,S,N,M,F,_t.x,_t.y)&&Li(_t.prev,_t,_t.next)>=0))return!1;_t=_t.nextZ}for(;ct&&ct.z>=at;){if(ct.x>=G&&ct.x<=Y&&ct.y>=j&&ct.y<=it&&ct!==m&&ct!==x&&eh(I,D,S,N,M,F,ct.x,ct.y)&&Li(ct.prev,ct,ct.next)>=0)return!1;ct=ct.prevZ}for(;_t&&_t.z<=bt;){if(_t.x>=G&&_t.x<=Y&&_t.y>=j&&_t.y<=it&&_t!==m&&_t!==x&&eh(I,D,S,N,M,F,_t.x,_t.y)&&Li(_t.prev,_t,_t.next)>=0)return!1;_t=_t.nextZ}return!0}function gb(s,r,l){var f=s;do{var m=f.prev,v=f.next.next;!jd(m,v)&&Py(m,f,f.next,v)&&Vp(m,v)&&Vp(v,m)&&(r.push(m.i/l|0),r.push(f.i/l|0),r.push(v.i/l|0),Up(f),Up(f.next),f=s=v),f=f.next}while(f!==s);return Uu(f)}function _b(s,r,l,f,m,v){var x=s;do{for(var I=x.next.next;I!==x.prev;){if(x.i!==I.i&&wb(x,I)){var S=My(x,I);return x=Uu(x,x.next),S=Uu(S,S.next),Bp(x,r,l,f,m,v,0),void Bp(S,r,l,f,m,v,0)}I=I.next}x=x.next}while(x!==s)}function yb(s,r){return s.x-r.x}function vb(s,r){var l=function(m,v){var x,I=v,S=m.x,M=m.y,D=-1/0;do{if(M<=I.y&&M>=I.next.y&&I.next.y!==I.y){var N=I.x+(M-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(N<=S&&N>D&&(D=N,x=I.x=I.x&&I.x>=j&&S!==I.x&&eh(Mx.x||I.x===x.x&&xb(x,I)))&&(x=I,it=F)),I=I.next;while(I!==G);return x}(s,r);if(!l)return r;var f=My(l,s);return Uu(f,f.next),Uu(l,l.next)}function xb(s,r){return Li(s.prev,s,r.prev)<0&&Li(r.next,s,s.next)<0}function Cg(s,r,l,f,m){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-l)*m|0)|s<<8))|s<<4))|s<<2))|s<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-f)*m|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function bb(s){var r=s,l=s;do(r.x=(s-x)*(v-I)&&(s-x)*(f-I)>=(l-x)*(r-I)&&(l-x)*(v-I)>=(m-x)*(f-I)}function wb(s,r){return s.next.i!==r.i&&s.prev.i!==r.i&&!function(l,f){var m=l;do{if(m.i!==l.i&&m.next.i!==l.i&&m.i!==f.i&&m.next.i!==f.i&&Py(m,m.next,l,f))return!0;m=m.next}while(m!==l);return!1}(s,r)&&(Vp(s,r)&&Vp(r,s)&&function(l,f){var m=l,v=!1,x=(l.x+f.x)/2,I=(l.y+f.y)/2;do m.y>I!=m.next.y>I&&m.next.y!==m.y&&x<(m.next.x-m.x)*(I-m.y)/(m.next.y-m.y)+m.x&&(v=!v),m=m.next;while(m!==l);return v}(s,r)&&(Li(s.prev,s,r.prev)||Li(s,r.prev,r))||jd(s,r)&&Li(s.prev,s,s.next)>0&&Li(r.prev,r,r.next)>0)}function Li(s,r,l){return(r.y-s.y)*(l.x-r.x)-(r.x-s.x)*(l.y-r.y)}function jd(s,r){return s.x===r.x&&s.y===r.y}function Py(s,r,l,f){var m=Wd(Li(s,r,l)),v=Wd(Li(s,r,f)),x=Wd(Li(l,f,s)),I=Wd(Li(l,f,r));return m!==v&&x!==I||!(m!==0||!Zd(s,l,r))||!(v!==0||!Zd(s,f,r))||!(x!==0||!Zd(l,s,f))||!(I!==0||!Zd(l,r,f))}function Zd(s,r,l){return r.x<=Math.max(s.x,l.x)&&r.x>=Math.min(s.x,l.x)&&r.y<=Math.max(s.y,l.y)&&r.y>=Math.min(s.y,l.y)}function Wd(s){return s>0?1:s<0?-1:0}function Vp(s,r){return Li(s.prev,s,s.next)<0?Li(s,r,s.next)>=0&&Li(s,s.prev,r)>=0:Li(s,r,s.prev)<0||Li(s,s.next,r)<0}function My(s,r){var l=new Tg(s.i,s.x,s.y),f=new Tg(r.i,r.x,r.y),m=s.next,v=r.prev;return s.next=r,r.prev=s,l.next=m,m.prev=l,f.next=l,l.prev=f,v.next=f,f.prev=v,f}function Ay(s,r,l,f){var m=new Tg(s,r,l);return f?(m.next=f.next,m.prev=f,f.next.prev=m,f.next=m):(m.prev=m,m.next=m),m}function Up(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Tg(s,r,l){this.i=s,this.x=r,this.y=l,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Lg(s,r,l,f){for(var m=0,v=r,x=l-f;v0&&l.holes.push(f+=s[m-1].length)}return l};var ky=b(Sg.exports);function Ib(s,r,l,f,m){Dy(s,r,l||0,f||s.length-1,m||Eb)}function Dy(s,r,l,f,m){for(;f>l;){if(f-l>600){var v=f-l+1,x=r-l+1,I=Math.log(v),S=.5*Math.exp(2*I/3),M=.5*Math.sqrt(I*S*(v-S)/v)*(x-v/2<0?-1:1);Dy(s,r,Math.max(l,Math.floor(r-x*S/v+M)),Math.min(f,Math.floor(r+(v-x)*S/v+M)),m)}var D=s[r],N=l,F=f;for(Gp(s,l,r),m(s[f],D)>0&&Gp(s,l,f);N0;)F--}m(s[l],D)===0?Gp(s,l,F):Gp(s,++F,f),F<=r&&(l=F+1),r<=F&&(f=F-1)}}function Gp(s,r,l){var f=s[r];s[r]=s[l],s[l]=f}function Eb(s,r){return sr?1:0}function Pg(s,r){const l=s.length;if(l<=1)return[s];const f=[];let m,v;for(let x=0;x1)for(let x=0;xl.id),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Q,this.indexArray=new qt,this.indexArray2=new Ut,this.programConfigurations=new rr(r.layers,r.zoom),this.segments=new Ae,this.segments2=new Ae,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){this.hasPattern=Mg("fill",this.layers,l);const m=this.layers[0].layout.get("fill-sort-key"),v=!m.isConstant(),x=[];for(const{feature:I,id:S,index:M,sourceLayerIndex:D}of r){const N=this.layers[0]._featureFilter.needGeometry,F=cl(I,N);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),F,f))continue;const G=v?m.evaluate(F,{},f,l.availableImages):void 0,j={id:S,properties:I.properties,type:I.type,sourceLayerIndex:D,index:M,geometry:N?F.geometry:ul(I),patterns:{},sortKey:G};x.push(j)}v&&x.sort((I,S)=>I.sortKey-S.sortKey);for(const I of x){const{geometry:S,index:M,sourceLayerIndex:D}=I;if(this.hasPattern){const N=Ag("fill",this.layers,I,this.zoom,l);this.patternFeatures.push(N)}else this.addFeature(I,S,M,f,{});l.featureIndex.insert(r[M].feature,S,M,D,this.index)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}addFeatures(r,l,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,l,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,fb),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.indexBuffer2=r.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(r),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(r,l,f,m,v){for(const x of Pg(l,500)){let I=0;for(const G of x)I+=G.length;const S=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray),M=S.vertexLength,D=[],N=[];for(const G of x){if(G.length===0)continue;G!==x[0]&&N.push(D.length/2);const j=this.segments2.prepareSegment(G.length,this.layoutVertexArray,this.indexArray2),Y=j.vertexLength;this.layoutVertexArray.emplaceBack(G[0].x,G[0].y),this.indexArray2.emplaceBack(Y+G.length-1,Y),D.push(G[0].x),D.push(G[0].y);for(let it=1;it>3}if(m--,f===1||f===2)v+=s.readSVarint(),x+=s.readSVarint(),f===1&&(r&&I.push(r),r=[]),r.push(new Ab(v,x));else{if(f!==7)throw new Error("unknown command "+f);r&&r.push(r[0].clone())}}return r&&I.push(r),I},nh.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var r=s.readVarint()+s.pos,l=1,f=0,m=0,v=0,x=1/0,I=-1/0,S=1/0,M=-1/0;s.pos>3}if(f--,l===1||l===2)(m+=s.readSVarint())I&&(I=m),(v+=s.readSVarint())M&&(M=v);else if(l!==7)throw new Error("unknown command "+l)}return[x,S,I,M]},nh.prototype.toGeoJSON=function(s,r,l){var f,m,v=this.extent*Math.pow(2,l),x=this.extent*s,I=this.extent*r,S=this.loadGeometry(),M=nh.types[this.type];function D(G){for(var j=0;j>3;m=x===1?f.readString():x===2?f.readFloat():x===3?f.readDouble():x===4?f.readVarint64():x===5?f.readVarint():x===6?f.readSVarint():x===7?f.readBoolean():null}return m}(l))}Fy.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var r=this._pbf.readVarint()+this._pbf.pos;return new Rb(this._pbf,r,this.extent,this._keys,this._values)};var zb=Oy;function Ob(s,r,l){if(s===3){var f=new zb(l,l.readVarint()+l.pos);f.length&&(r[f.name]=f)}}Hl.VectorTile=function(s,r){this.layers=s.readFields(Ob,{},r)},Hl.VectorTileFeature=zy,Hl.VectorTileLayer=Oy;const Fb=Hl.VectorTileFeature.types,Dg=Math.pow(2,13);function qp(s,r,l,f,m,v,x,I){s.emplaceBack(r,l,2*Math.floor(f*Dg)+x,m*Dg*2,v*Dg*2,Math.round(I))}class Rg{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(l=>l.id),this.index=r.index,this.hasPattern=!1,this.layoutVertexArray=new nt,this.centroidVertexArray=new q,this.indexArray=new qt,this.programConfigurations=new rr(r.layers,r.zoom),this.segments=new Ae,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){this.features=[],this.hasPattern=Mg("fill-extrusion",this.layers,l);for(const{feature:m,id:v,index:x,sourceLayerIndex:I}of r){const S=this.layers[0]._featureFilter.needGeometry,M=cl(m,S);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),M,f))continue;const D={id:v,sourceLayerIndex:I,index:x,geometry:S?M.geometry:ul(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push(Ag("fill-extrusion",this.layers,D,this.zoom,l)):this.addFeature(D,D.geometry,x,f,{}),l.featureIndex.insert(m,D.geometry,x,I,this.index,!0)}}addFeatures(r,l,f){for(const m of this.features){const{geometry:v}=m;this.addFeature(m,v,m.index,l,f)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,Mb),this.centroidVertexBuffer=r.createVertexBuffer(this.centroidVertexArray,Pb.members,!0),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(r,l,f,m,v){const x={x:0,y:0,vertexCount:0};for(const I of Pg(l,500)){let S=0;for(const j of I)S+=j.length;let M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const j of I){if(j.length===0||Vb(j))continue;let Y=0;for(let it=0;it=1){const bt=j[it-1];if(!Bb(at,bt)){M.vertexLength+4>Ae.MAX_VERTEX_ARRAY_LENGTH&&(M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ct=at.sub(bt)._perp()._unit(),_t=bt.dist(at);Y+_t>32768&&(Y=0),qp(this.layoutVertexArray,at.x,at.y,ct.x,ct.y,0,0,Y),qp(this.layoutVertexArray,at.x,at.y,ct.x,ct.y,0,1,Y),x.x+=2*at.x,x.y+=2*at.y,x.vertexCount+=2,Y+=_t,qp(this.layoutVertexArray,bt.x,bt.y,ct.x,ct.y,0,0,Y),qp(this.layoutVertexArray,bt.x,bt.y,ct.x,ct.y,0,1,Y),x.x+=2*bt.x,x.y+=2*bt.y,x.vertexCount+=2;const Ot=M.vertexLength;this.indexArray.emplaceBack(Ot,Ot+2,Ot+1),this.indexArray.emplaceBack(Ot+1,Ot+2,Ot+3),M.vertexLength+=4,M.primitiveLength+=2}}}}if(M.vertexLength+S>Ae.MAX_VERTEX_ARRAY_LENGTH&&(M=this.segments.prepareSegment(S,this.layoutVertexArray,this.indexArray)),Fb[r.type]!=="Polygon")continue;const D=[],N=[],F=M.vertexLength;for(const j of I)if(j.length!==0){j!==I[0]&&N.push(D.length/2);for(let Y=0;Yvi)||s.y===r.y&&(s.y<0||s.y>vi)}function Vb(s){return s.every(r=>r.x<0)||s.every(r=>r.x>vi)||s.every(r=>r.y<0)||s.every(r=>r.y>vi)}let By;de("FillExtrusionBucket",Rg,{omit:["layers","features"]});var Ub={get paint(){return By=By||new qr({"fill-extrusion-opacity":new be(Mt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ke(Mt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new be(Mt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new be(Mt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ql(Mt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ke(Mt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ke(Mt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new be(Mt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Gb extends is{constructor(r){super(r,Ub)}createBucket(r){return new Rg(r)}queryRadius(){return Vd(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(r,l,f,m,v,x,I,S){const M=Ud(r,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,I),D=this.paint.get("fill-extrusion-height").evaluate(l,f),N=this.paint.get("fill-extrusion-base").evaluate(l,f),F=function(j,Y,it,at){const bt=[];for(const ct of j){const _t=[ct.x,ct.y,0,1];Gd(_t,_t,Y),bt.push(new P(_t[0]/_t[3],_t[1]/_t[3]))}return bt}(M,S),G=function(j,Y,it,at){const bt=[],ct=[],_t=at[8]*Y,Ot=at[9]*Y,Vt=at[10]*Y,ue=at[11]*Y,ve=at[8]*it,le=at[9]*it,oe=at[10]*it,Qt=at[11]*it;for(const _e of j){const $t=[],jt=[];for(const Le of _e){const we=Le.x,$e=Le.y,Jn=at[0]*we+at[4]*$e+at[12],ei=at[1]*we+at[5]*$e+at[13],Zi=at[2]*we+at[6]*$e+at[14],Uo=at[3]*we+at[7]*$e+at[15],ao=Zi+Vt,Fi=Uo+ue,dr=Jn+ve,Tr=ei+le,lo=Zi+oe,uo=Uo+Qt,Wi=new P((Jn+_t)/Fi,(ei+Ot)/Fi);Wi.z=ao/Fi,$t.push(Wi);const Hi=new P(dr/uo,Tr/uo);Hi.z=lo/uo,jt.push(Hi)}bt.push($t),ct.push(jt)}return[bt,ct]}(m,N,D,S);return function(j,Y,it){let at=1/0;Qc(it,Y)&&(at=Vy(it,Y[0]));for(let bt=0;btl.id),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(l=>{this.gradients[l.id]={}}),this.layoutVertexArray=new K,this.layoutVertexArray2=new pt,this.indexArray=new qt,this.programConfigurations=new rr(r.layers,r.zoom),this.segments=new Ae,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id)}populate(r,l,f){this.hasPattern=Mg("line",this.layers,l);const m=this.layers[0].layout.get("line-sort-key"),v=!m.isConstant(),x=[];for(const{feature:I,id:S,index:M,sourceLayerIndex:D}of r){const N=this.layers[0]._featureFilter.needGeometry,F=cl(I,N);if(!this.layers[0]._featureFilter.filter(new Xn(this.zoom),F,f))continue;const G=v?m.evaluate(F,{},f):void 0,j={id:S,properties:I.properties,type:I.type,sourceLayerIndex:D,index:M,geometry:N?F.geometry:ul(I),patterns:{},sortKey:G};x.push(j)}v&&x.sort((I,S)=>I.sortKey-S.sortKey);for(const I of x){const{geometry:S,index:M,sourceLayerIndex:D}=I;if(this.hasPattern){const N=Ag("line",this.layers,I,this.zoom,l);this.patternFeatures.push(N)}else this.addFeature(I,S,M,f,{});l.featureIndex.insert(r[M].feature,S,M,D,this.index)}}update(r,l,f){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,l,this.stateDependentLayers,f)}addFeatures(r,l,f){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,l,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=r.createVertexBuffer(this.layoutVertexArray2,Wb)),this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,jb),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(r){if(r.properties&&Object.prototype.hasOwnProperty.call(r.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(r.properties,"mapbox_clip_end"))return{start:+r.properties.mapbox_clip_start,end:+r.properties.mapbox_clip_end}}addFeature(r,l,f,m,v){const x=this.layers[0].layout,I=x.get("line-join").evaluate(r,{}),S=x.get("line-cap"),M=x.get("line-miter-limit"),D=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(r);for(const N of l)this.addLine(N,r,I,S,M,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,f,v,m)}addLine(r,l,f,m,v,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let at=0;at=2&&r[S-1].equals(r[S-2]);)S--;let M=0;for(;M0;if(ue&&at>M){const Qt=F.dist(G);if(Qt>2*D){const _e=F.sub(F.sub(G)._mult(D/Qt)._round());this.updateDistance(G,_e),this.addCurrentVertex(_e,Y,0,0,N),G=_e}}const le=G&&j;let oe=le?f:I?"butt":m;if(le&&oe==="round"&&(Otv&&(oe="bevel"),oe==="bevel"&&(Ot>2&&(oe="flipbevel"),Ot100)bt=it.mult(-1);else{const Qt=Ot*Y.add(it).mag()/Y.sub(it).mag();bt._perp()._mult(Qt*(ve?-1:1))}this.addCurrentVertex(F,bt,0,0,N),this.addCurrentVertex(F,bt.mult(-1),0,0,N)}else if(oe==="bevel"||oe==="fakeround"){const Qt=-Math.sqrt(Ot*Ot-1),_e=ve?Qt:0,$t=ve?0:Qt;if(G&&this.addCurrentVertex(F,Y,_e,$t,N),oe==="fakeround"){const jt=Math.round(180*Vt/Math.PI/20);for(let Le=1;Le2*D){const _e=F.add(j.sub(F)._mult(D/Qt)._round());this.updateDistance(F,_e),this.addCurrentVertex(_e,it,0,0,N),F=_e}}}}addCurrentVertex(r,l,f,m,v,x=!1){const I=l.y*m-l.x,S=-l.y-l.x*m;this.addHalfVertex(r,l.x+l.y*f,l.y-l.x*f,x,!1,f,v),this.addHalfVertex(r,I,S,x,!0,-m,v),this.distance>Uy/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(r,l,f,m,v,x))}addHalfVertex({x:r,y:l},f,m,v,x,I,S){const M=.5*(this.lineClips?this.scaledDistance*(Uy-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((r<<1)+(v?1:0),(l<<1)+(x?1:0),Math.round(63*f)+128,Math.round(63*m)+128,1+(I===0?0:I<0?-1:1)|(63&M)<<2,M>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=S.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),S.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(r,l){this.distance+=r.dist(l),this.updateScaledDistance()}}let Gy,qy;de("LineBucket",Ng,{omit:["layers","patternFeatures"]});var jy={get paint(){return qy=qy||new qr({"line-opacity":new ke(Mt.paint_line["line-opacity"]),"line-color":new ke(Mt.paint_line["line-color"]),"line-translate":new be(Mt.paint_line["line-translate"]),"line-translate-anchor":new be(Mt.paint_line["line-translate-anchor"]),"line-width":new ke(Mt.paint_line["line-width"]),"line-gap-width":new ke(Mt.paint_line["line-gap-width"]),"line-offset":new ke(Mt.paint_line["line-offset"]),"line-blur":new ke(Mt.paint_line["line-blur"]),"line-dasharray":new bp(Mt.paint_line["line-dasharray"]),"line-pattern":new ql(Mt.paint_line["line-pattern"]),"line-gradient":new wp(Mt.paint_line["line-gradient"])})},get layout(){return Gy=Gy||new qr({"line-cap":new be(Mt.layout_line["line-cap"]),"line-join":new ke(Mt.layout_line["line-join"]),"line-miter-limit":new be(Mt.layout_line["line-miter-limit"]),"line-round-limit":new be(Mt.layout_line["line-round-limit"]),"line-sort-key":new ke(Mt.layout_line["line-sort-key"])})}};class Yb extends ke{possiblyEvaluate(r,l){return l=new Xn(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,zoomHistory:l.zoomHistory,transition:l.transition}),super.possiblyEvaluate(r,l)}evaluate(r,l,f,m){return l=gt({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(r,l,f,m)}}let Hd;class Kb extends is{constructor(r){super(r,jy),this.gradientVersion=0,Hd||(Hd=new Yb(jy.paint.properties["line-width"].specification),Hd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const l=this.gradientExpression();this.stepInterpolant=!!function(f){return f._styleExpression!==void 0}(l)&&l._styleExpression.expression instanceof Cu,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(r,l){super.recalculate(r,l),this.paint._values["line-floorwidth"]=Hd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Ng(r)}queryRadius(r){const l=r,f=Zy(zp("line-width",this,l),zp("line-gap-width",this,l)),m=zp("line-offset",this,l);return f/2+Math.abs(m)+Vd(this.paint.get("line-translate"))}queryIntersectsFeature(r,l,f,m,v,x,I){const S=Ud(r,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,I),M=I/2*Zy(this.paint.get("line-width").evaluate(l,f),this.paint.get("line-gap-width").evaluate(l,f)),D=this.paint.get("line-offset").evaluate(l,f);return D&&(m=function(N,F){const G=[];for(let j=0;j=3){for(let it=0;it0?r+2*s:s}const Jb=Si([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Qb=Si([{name:"a_projected_pos",components:3,type:"Float32"}],4);Si([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const $b=Si([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Si([{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 Wy=Si([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tw=Si([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ew(s,r,l){return s.sections.forEach(f=>{f.text=function(m,v,x){const I=v.layout.get("text-transform").evaluate(x,{});return I==="uppercase"?m=m.toLocaleUpperCase():I==="lowercase"&&(m=m.toLocaleLowerCase()),ol.applyArabicShaping&&(m=ol.applyArabicShaping(m)),m}(f.text,r,l)}),s}Si([{name:"triangle",components:3,type:"Uint16"}]),Si([{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"}]),Si([{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"}]),Si([{type:"Float32",name:"offsetX"}]),Si([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Si([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ji=24,Hy=zn,Xy=function(s,r,l,f,m){var v,x,I=8*m-f-1,S=(1<>1,D=-7,N=l?m-1:0,F=l?-1:1,G=s[r+N];for(N+=F,v=G&(1<<-D)-1,G>>=-D,D+=I;D>0;v=256*v+s[r+N],N+=F,D-=8);for(x=v&(1<<-D)-1,v>>=-D,D+=f;D>0;x=256*x+s[r+N],N+=F,D-=8);if(v===0)v=1-M;else{if(v===S)return x?NaN:1/0*(G?-1:1);x+=Math.pow(2,f),v-=M}return(G?-1:1)*x*Math.pow(2,v-f)},Yy=function(s,r,l,f,m,v){var x,I,S,M=8*v-m-1,D=(1<>1,F=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,G=f?0:v-1,j=f?1:-1,Y=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(I=isNaN(r)?1:0,x=D):(x=Math.floor(Math.log(r)/Math.LN2),r*(S=Math.pow(2,-x))<1&&(x--,S*=2),(r+=x+N>=1?F/S:F*Math.pow(2,1-N))*S>=2&&(x++,S/=2),x+N>=D?(I=0,x=D):x+N>=1?(I=(r*S-1)*Math.pow(2,m),x+=N):(I=r*Math.pow(2,N-1)*Math.pow(2,m),x=0));m>=8;s[l+G]=255&I,G+=j,I/=256,m-=8);for(x=x<0;s[l+G]=255&x,G+=j,x/=256,M-=8);s[l+G-j]|=128*Y};function zn(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}zn.Varint=0,zn.Fixed64=1,zn.Bytes=2,zn.Fixed32=5;var zg=4294967296,Ky=1/zg,Jy=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function hl(s){return s.type===zn.Bytes?s.readVarint()+s.pos:s.pos+1}function ih(s,r,l){return l?4294967296*r+(s>>>0):4294967296*(r>>>0)+(s>>>0)}function Qy(s,r,l){var f=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));l.realloc(f);for(var m=l.pos-1;m>=s;m--)l.buf[m+f]=l.buf[m]}function nw(s,r){for(var l=0;l>>8,s[l+2]=r>>>16,s[l+3]=r>>>24}function $y(s,r){return(s[r]|s[r+1]<<8|s[r+2]<<16)+(s[r+3]<<24)}zn.prototype={destroy:function(){this.buf=null},readFields:function(s,r,l){for(l=l||this.length;this.pos>3,v=this.pos;this.type=7&f,s(m,r,this),this.pos===v&&this.skip(f)}return r},readMessage:function(s,r){return this.readFields(s,r,this.readVarint()+this.pos)},readFixed32:function(){var s=Xd(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=$y(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=Xd(this.buf,this.pos)+Xd(this.buf,this.pos+4)*zg;return this.pos+=8,s},readSFixed64:function(){var s=Xd(this.buf,this.pos)+$y(this.buf,this.pos+4)*zg;return this.pos+=8,s},readFloat:function(){var s=Xy(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=Xy(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var r,l,f=this.buf;return r=127&(l=f[this.pos++]),l<128?r:(r|=(127&(l=f[this.pos++]))<<7,l<128?r:(r|=(127&(l=f[this.pos++]))<<14,l<128?r:(r|=(127&(l=f[this.pos++]))<<21,l<128?r:function(m,v,x){var I,S,M=x.buf;if(I=(112&(S=M[x.pos++]))>>4,S<128||(I|=(127&(S=M[x.pos++]))<<3,S<128)||(I|=(127&(S=M[x.pos++]))<<10,S<128)||(I|=(127&(S=M[x.pos++]))<<17,S<128)||(I|=(127&(S=M[x.pos++]))<<24,S<128)||(I|=(1&(S=M[x.pos++]))<<31,S<128))return ih(m,I,v);throw new Error("Expected varint not more than 10 bytes")}(r|=(15&(l=f[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,r=this.pos;return this.pos=s,s-r>=12&&Jy?function(l,f,m){return Jy.decode(l.subarray(f,m))}(this.buf,r,s):function(l,f,m){for(var v="",x=f;x239?4:D>223?3:D>191?2:1;if(x+F>m)break;F===1?D<128&&(N=D):F===2?(192&(I=l[x+1]))==128&&(N=(31&D)<<6|63&I)<=127&&(N=null):F===3?(S=l[x+2],(192&(I=l[x+1]))==128&&(192&S)==128&&((N=(15&D)<<12|(63&I)<<6|63&S)<=2047||N>=55296&&N<=57343)&&(N=null)):F===4&&(S=l[x+2],M=l[x+3],(192&(I=l[x+1]))==128&&(192&S)==128&&(192&M)==128&&((N=(15&D)<<18|(63&I)<<12|(63&S)<<6|63&M)<=65535||N>=1114112)&&(N=null)),N===null?(N=65533,F=1):N>65535&&(N-=65536,v+=String.fromCharCode(N>>>10&1023|55296),N=56320|1023&N),v+=String.fromCharCode(N),x+=F}return v}(this.buf,r,s)},readBytes:function(){var s=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,s);return this.pos=s,r},readPackedVarint:function(s,r){if(this.type!==zn.Bytes)return s.push(this.readVarint(r));var l=hl(this);for(s=s||[];this.pos127;);else if(r===zn.Bytes)this.pos=this.readVarint()+this.pos;else if(r===zn.Fixed32)this.pos+=4;else{if(r!==zn.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(s,r){this.writeVarint(s<<3|r)},realloc:function(s){for(var r=this.length||16;r268435455||s<0?function(r,l){var f,m;if(r>=0?(f=r%4294967296|0,m=r/4294967296|0):(m=~(-r/4294967296),4294967295^(f=~(-r%4294967296))?f=f+1|0:(f=0,m=m+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");l.realloc(10),function(v,x,I){I.buf[I.pos++]=127&v|128,v>>>=7,I.buf[I.pos++]=127&v|128,v>>>=7,I.buf[I.pos++]=127&v|128,v>>>=7,I.buf[I.pos++]=127&v|128,I.buf[I.pos]=127&(v>>>=7)}(f,0,l),function(v,x){var I=(7&v)<<4;x.buf[x.pos++]|=I|((v>>>=3)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v|((v>>>=7)?128:0),v&&(x.buf[x.pos++]=127&v)))))}(m,l)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var r=this.pos;this.pos=function(f,m,v){for(var x,I,S=0;S55295&&x<57344){if(!I){x>56319||S+1===m.length?(f[v++]=239,f[v++]=191,f[v++]=189):I=x;continue}if(x<56320){f[v++]=239,f[v++]=191,f[v++]=189,I=x;continue}x=I-55296<<10|x-56320|65536,I=null}else I&&(f[v++]=239,f[v++]=191,f[v++]=189,I=null);x<128?f[v++]=x:(x<2048?f[v++]=x>>6|192:(x<65536?f[v++]=x>>12|224:(f[v++]=x>>18|240,f[v++]=x>>12&63|128),f[v++]=x>>6&63|128),f[v++]=63&x|128)}return v}(this.buf,s,this.pos);var l=this.pos-r;l>=128&&Qy(r,l,this),this.pos=r-1,this.writeVarint(l),this.pos+=l},writeFloat:function(s){this.realloc(4),Yy(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),Yy(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var r=s.length;this.writeVarint(r),this.realloc(r);for(var l=0;l=128&&Qy(l,f,this),this.pos=l-1,this.writeVarint(f),this.pos+=f},writeMessage:function(s,r,l){this.writeTag(s,zn.Bytes),this.writeRawMessage(r,l)},writePackedVarint:function(s,r){r.length&&this.writeMessage(s,nw,r)},writePackedSVarint:function(s,r){r.length&&this.writeMessage(s,iw,r)},writePackedBoolean:function(s,r){r.length&&this.writeMessage(s,sw,r)},writePackedFloat:function(s,r){r.length&&this.writeMessage(s,rw,r)},writePackedDouble:function(s,r){r.length&&this.writeMessage(s,ow,r)},writePackedFixed32:function(s,r){r.length&&this.writeMessage(s,aw,r)},writePackedSFixed32:function(s,r){r.length&&this.writeMessage(s,lw,r)},writePackedFixed64:function(s,r){r.length&&this.writeMessage(s,uw,r)},writePackedSFixed64:function(s,r){r.length&&this.writeMessage(s,cw,r)},writeBytesField:function(s,r){this.writeTag(s,zn.Bytes),this.writeBytes(r)},writeFixed32Field:function(s,r){this.writeTag(s,zn.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(s,r){this.writeTag(s,zn.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(s,r){this.writeTag(s,zn.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(s,r){this.writeTag(s,zn.Fixed64),this.writeSFixed64(r)},writeVarintField:function(s,r){this.writeTag(s,zn.Varint),this.writeVarint(r)},writeSVarintField:function(s,r){this.writeTag(s,zn.Varint),this.writeSVarint(r)},writeStringField:function(s,r){this.writeTag(s,zn.Bytes),this.writeString(r)},writeFloatField:function(s,r){this.writeTag(s,zn.Fixed32),this.writeFloat(r)},writeDoubleField:function(s,r){this.writeTag(s,zn.Fixed64),this.writeDouble(r)},writeBooleanField:function(s,r){this.writeVarintField(s,!!r)}};var Og=b(Hy);const Fg=3;function hw(s,r,l){s===1&&l.readMessage(pw,r)}function pw(s,r,l){if(s===3){const{id:f,bitmap:m,width:v,height:x,left:I,top:S,advance:M}=l.readMessage(fw,{});r.push({id:f,bitmap:new Fp({width:v+2*Fg,height:x+2*Fg},m),metrics:{width:v,height:x,left:I,top:S,advance:M}})}}function fw(s,r,l){s===1?r.id=l.readVarint():s===2?r.bitmap=l.readBytes():s===3?r.width=l.readVarint():s===4?r.height=l.readVarint():s===5?r.left=l.readSVarint():s===6?r.top=l.readSVarint():s===7&&(r.advance=l.readVarint())}const t0=Fg;function e0(s){let r=0,l=0;for(const x of s)r+=x.w*x.h,l=Math.max(l,x.w);s.sort((x,I)=>I.h-x.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),l),h:1/0}];let m=0,v=0;for(const x of s)for(let I=f.length-1;I>=0;I--){const S=f[I];if(!(x.w>S.w||x.h>S.h)){if(x.x=S.x,x.y=S.y,v=Math.max(v,x.y+x.h),m=Math.max(m,x.x+x.w),x.w===S.w&&x.h===S.h){const M=f.pop();I=0&&f>=r&&Kd[this.text.charCodeAt(f)];f--)l--;this.text=this.text.substring(r,l),this.sectionIndex=this.sectionIndex.slice(r,l)}substring(r,l){const f=new oh;return f.text=this.text.substring(r,l),f.sectionIndex=this.sectionIndex.slice(r,l),f.sections=this.sections,f}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((r,l)=>Math.max(r,this.sections[l].scale),0)}addTextSection(r,l){this.text+=r.text,this.sections.push(Hp.forText(r.scale,r.fontStack||l));const f=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Yd(s,r,l,f,m,v,x,I,S,M,D,N,F,G,j,Y){const it=oh.fromFeature(s,m);let at;N===p.ah.vertical&&it.verticalizePunctuation();const{processBidirectionalText:bt,processStyledBidirectionalText:ct}=ol;if(bt&&it.sections.length===1){at=[];const Vt=bt(it.toString(),Vg(it,M,v,r,f,G,j));for(const ue of Vt){const ve=new oh;ve.text=ue,ve.sections=it.sections;for(let le=0;le0&&fl>Io&&(Io=fl)}else{const ss=ve[hn.fontStack],So=ss&&ss[Lr];if(So&&So.rect)oa=So.rect,Cs=So.metrics;else{const fl=ue[hn.fontStack],Qp=fl&&fl[Lr];if(!Qp)continue;Cs=Qp.metrics}Yi=(Hi-hn.scale)*ji}Ts?(Vt.verticalizable=!0,Hr.push({glyph:Lr,imageName:sa,x:Jn,y:ei+Yi,vertical:Ts,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Xr,metrics:Cs,rect:oa}),Jn+=pl*hn.scale+Le):(Hr.push({glyph:Lr,imageName:sa,x:Jn,y:ei+Yi,vertical:Ts,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Xr,metrics:Cs,rect:oa}),Jn+=Cs.advance*hn.scale+Le)}Hr.length!==0&&(Zi=Math.max(Jn-Le,Zi),gw(Hr,0,Hr.length-1,ao,Io)),Jn=0;const Eo=Qt*Hi+Io;co.lineOffset=Math.max(Io,Wr),ei+=Eo,Uo=Math.max(Eo,Uo),++Fi}var dr;const Tr=ei-Wp,{horizontalAlign:lo,verticalAlign:uo}=Ug(_e);(function(Wi,Hi,Wr,co,Hr,Io,Eo,Xi,hn){const Xr=(Hi-Wr)*Hr;let Lr=0;Lr=Io!==Eo?-Xi*co-Wp:(-co*hn+.5)*Eo;for(const Yi of Wi)for(const Cs of Yi.positionedGlyphs)Cs.x+=Xr,Cs.y+=Lr})(Vt.positionedLines,ao,lo,uo,Zi,Uo,Qt,Tr,oe.length),Vt.top+=-uo*Tr,Vt.bottom=Vt.top+Tr,Vt.left+=-lo*Zi,Vt.right=Vt.left+Zi}(Ot,r,l,f,at,x,I,S,N,M,F,Y),!function(Vt){for(const ue of Vt)if(ue.positionedGlyphs.length!==0)return!1;return!0}(_t)&&Ot}const Kd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},dw={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 i0(s,r,l,f,m,v){if(r.imageName){const x=f[r.imageName];return x?x.displaySize[0]*r.scale*ji/v+m:0}{const x=l[r.fontStack],I=x&&x[s];return I?I.metrics.advance*r.scale+m:0}}function r0(s,r,l,f){const m=Math.pow(s-r,2);return f?s=0;let D=0;for(let F=0;Fx.id),this.index=r.index,this.pixelRatio=r.pixelRatio,this.sourceLayerIndex=r.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=wg([]),this.placementViewportMatrix=wg([]);const l=this.layers[0]._unevaluatedLayout._values;this.textSizeData=l0(this.zoom,l["text-size"]),this.iconSizeData=l0(this.zoom,l["icon-size"]);const f=this.layers[0].layout,m=f.get("symbol-sort-key"),v=f.get("symbol-z-order");this.canOverlap=Gg(f,"text-overlap","text-allow-overlap")!=="never"||Gg(f,"icon-overlap","icon-allow-overlap")!=="never"||f.get("text-ignore-placement")||f.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,f.get("symbol-placement")==="point"&&(this.writingModes=f.get("text-writing-mode").map(x=>p.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=r.sourceID}createArrays(){this.text=new jg(new rr(this.layers,this.zoom,r=>/^text/.test(r))),this.icon=new jg(new rr(this.layers,this.zoom,r=>/^icon/.test(r))),this.glyphOffsetArray=new E,this.lineVertexArray=new C,this.symbolInstances=new y,this.textAnchorOffsets=new A}calculateGlyphDependencies(r,l,f,m,v){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),D=S.value.kind!=="constant"||!!S.value.value||Object.keys(S.parameters).length>0,N=v.get("symbol-sort-key");if(this.features=[],!M&&!D)return;const F=l.iconDependencies,G=l.glyphDependencies,j=l.availableImages,Y=new Xn(this.zoom);for(const{feature:it,id:at,index:bt,sourceLayerIndex:ct}of r){const _t=m._featureFilter.needGeometry,Ot=cl(it,_t);if(!m._featureFilter.filter(Y,Ot,f))continue;let Vt,ue;if(_t||(Ot.geometry=ul(it)),M){const le=m.getValueAndResolveTokens("text-field",Ot,f,j),oe=vo.factory(le);xw(oe)&&(this.hasRTLText=!0),(!this.hasRTLText||ol.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&ol.isParsed())&&(Vt=ew(oe,m,Ot))}if(D){const le=m.getValueAndResolveTokens("icon-image",Ot,f,j);ue=le instanceof Fo?le:Fo.fromString(le)}if(!Vt&&!ue)continue;const ve=this.sortFeaturesByKey?N.evaluate(Ot,{},f):void 0;if(this.features.push({id:at,text:Vt,icon:ue,index:bt,sourceLayerIndex:ct,geometry:Ot.geometry,properties:it.properties,type:yw[it.type],sortKey:ve}),ue&&(F[ue.name]=!0),Vt){const le=x.evaluate(Ot,{},f).join(","),oe=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(p.ah.vertical)>=0;for(const Qt of Vt.sections)if(Qt.image)F[Qt.image.name]=!0;else{const _e=qc(Vt.toString()),$t=Qt.fontStack||le,jt=G[$t]=G[$t]||{};this.calculateGlyphDependencies(Qt.text,jt,oe,this.allowVerticalPlacement,_e)}}}v.get("symbol-placement")==="line"&&(this.features=function(it){const at={},bt={},ct=[];let _t=0;function Ot(le){ct.push(it[le]),_t++}function Vt(le,oe,Qt){const _e=bt[le];return delete bt[le],bt[oe]=_e,ct[_e].geometry[0].pop(),ct[_e].geometry[0]=ct[_e].geometry[0].concat(Qt[0]),_e}function ue(le,oe,Qt){const _e=at[oe];return delete at[oe],at[le]=_e,ct[_e].geometry[0].shift(),ct[_e].geometry[0]=Qt[0].concat(ct[_e].geometry[0]),_e}function ve(le,oe,Qt){const _e=Qt?oe[0][oe[0].length-1]:oe[0][0];return`${le}:${_e.x}:${_e.y}`}for(let le=0;lele.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((it,at)=>it.sortKey-at.sortKey)}update(r,l,f){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(r,l,this.layers,f),this.icon.programConfigurations.updatePaintArrays(r,l,this.layers,f))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(r){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(r),this.iconCollisionBox.upload(r)),this.text.upload(r,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(r,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(r,l){const f=this.lineVertexArray.length;if(r.segment!==void 0){let m=r.dist(l[r.segment+1]),v=r.dist(l[r.segment]);const x={};for(let I=r.segment+1;I=0;I--)x[I]={x:l[I].x,y:l[I].y,tileUnitDistanceFromAnchor:v},I>0&&(v+=l[I-1].dist(l[I]));for(let I=0;I0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(r,l){const f=r.placedSymbolArray.get(l),m=f.vertexStartIndex+4*f.numGlyphs;for(let v=f.vertexStartIndex;vm[I]-m[S]||v[S]-v[I]),x}addToSortKeyRanges(r,l){const f=this.sortKeyRanges[this.sortKeyRanges.length-1];f&&f.sortKey===l?f.symbolInstanceEnd=r+1:this.sortKeyRanges.push({sortKey:l,symbolInstanceStart:r,symbolInstanceEnd:r+1})}sortFeatures(r){if(this.sortFeaturesByY&&this.sortedAngle!==r&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(r),this.sortedAngle=r,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const l of this.symbolInstanceIndexes){const f=this.symbolInstances.get(l);this.featureSortOrder.push(f.featureIndex),[f.rightJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.leftJustifiedTextSymbolIndex].forEach((m,v,x)=>{m>=0&&x.indexOf(m)===v&&this.addIndicesForPlacedSymbol(this.text,m)}),f.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,f.verticalPlacedTextSymbolIndex),f.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.placedIconSymbolIndex),f.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let u0,c0;de("SymbolBucket",sh,{omit:["layers","collisionBoxArray","features","compareText"]}),sh.MAX_GLYPHS=65535,sh.addDynamicAttributes=qg;var Wg={get paint(){return c0=c0||new qr({"icon-opacity":new ke(Mt.paint_symbol["icon-opacity"]),"icon-color":new ke(Mt.paint_symbol["icon-color"]),"icon-halo-color":new ke(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new ke(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ke(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new be(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new be(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new ke(Mt.paint_symbol["text-opacity"]),"text-color":new ke(Mt.paint_symbol["text-color"],{runtimeType:yi,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new ke(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new ke(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new ke(Mt.paint_symbol["text-halo-blur"]),"text-translate":new be(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new be(Mt.paint_symbol["text-translate-anchor"])})},get layout(){return u0=u0||new qr({"symbol-placement":new be(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new be(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new be(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ke(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new be(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new be(Mt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new be(Mt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new be(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new be(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new be(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new ke(Mt.layout_symbol["icon-size"]),"icon-text-fit":new be(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new be(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new ke(Mt.layout_symbol["icon-image"]),"icon-rotate":new ke(Mt.layout_symbol["icon-rotate"]),"icon-padding":new ke(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new be(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new ke(Mt.layout_symbol["icon-offset"]),"icon-anchor":new ke(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new be(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new be(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new be(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new ke(Mt.layout_symbol["text-field"]),"text-font":new ke(Mt.layout_symbol["text-font"]),"text-size":new ke(Mt.layout_symbol["text-size"]),"text-max-width":new ke(Mt.layout_symbol["text-max-width"]),"text-line-height":new be(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new ke(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new ke(Mt.layout_symbol["text-justify"]),"text-radial-offset":new ke(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new be(Mt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ke(Mt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ke(Mt.layout_symbol["text-anchor"]),"text-max-angle":new be(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new be(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new ke(Mt.layout_symbol["text-rotate"]),"text-padding":new be(Mt.layout_symbol["text-padding"]),"text-keep-upright":new be(Mt.layout_symbol["text-keep-upright"]),"text-transform":new ke(Mt.layout_symbol["text-transform"]),"text-offset":new ke(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new be(Mt.layout_symbol["text-allow-overlap"]),"text-overlap":new be(Mt.layout_symbol["text-overlap"]),"text-ignore-placement":new be(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new be(Mt.layout_symbol["text-optional"])})}};class h0{constructor(r){if(r.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=r.property.overrides?r.property.overrides.runtimeType:Ni,this.defaultValue=r}evaluate(r){if(r.formattedSection){const l=this.defaultValue.property.overrides;if(l&&l.hasOverride(r.formattedSection))return l.getOverride(r.formattedSection)}return r.feature&&r.featureState?this.defaultValue.evaluate(r.feature,r.featureState):this.defaultValue.property.specification.default}eachChild(r){this.defaultValue.isConstant()||r(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}de("FormatSectionOverride",h0,{omit:["defaultValue"]});class Qd extends is{constructor(r){super(r,Wg)}recalculate(r,l){if(super.recalculate(r,l),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 f=this.layout.get("text-writing-mode");if(f){const m=[];for(const v of f)m.indexOf(v)<0&&m.push(v);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(r,l,f,m){const v=this.layout.get(r).evaluate(l,{},f,m),x=this._unevaluatedLayout._values[r];return x.isDataDriven()||Vn(x.value)||!v?v:function(I,S){return S.replace(/{([^{}]+)}/g,(M,D)=>I&&D in I?String(I[D]):"")}(l.properties,v)}createBucket(r){return new sh(r)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const r of Wg.paint.overridableProperties){if(!Qd.hasPaintOverride(this.layout,r))continue;const l=this.paint.get(r),f=new h0(l),m=new Hn(f,l.property.specification);let v=null;v=l.value.kind==="constant"||l.value.kind==="source"?new kc("source",m):new cp("composite",m,l.value.zoomStops),this.paint._values[r]=new ns(l.property,v,l.parameters)}}_handleOverridablePaintPropertyUpdate(r,l,f){return!(!this.layout||l.isDataDriven()||f.isDataDriven())&&Qd.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,l){const f=r.get("text-field"),m=Wg.paint.properties[l];let v=!1;const x=I=>{for(const S of I)if(m.overrides&&m.overrides.hasOverride(S))return void(v=!0)};if(f.value.kind==="constant"&&f.value.value instanceof vo)x(f.value.value.sections);else if(f.value.kind==="source"){const I=M=>{v||(M instanceof Ea&&Oi(M.value)===Ii?x(M.value.sections):M instanceof Mc?x(M.sections):M.eachChild(I))},S=f.value;S._styleExpression&&I(S._styleExpression.expression)}return v}}let p0;var bw={get paint(){return p0=p0||new qr({"background-color":new be(Mt.paint_background["background-color"]),"background-pattern":new bp(Mt.paint_background["background-pattern"]),"background-opacity":new be(Mt.paint_background["background-opacity"])})}};class ww extends is{constructor(r){super(r,bw)}}let f0;var Iw={get paint(){return f0=f0||new qr({"raster-opacity":new be(Mt.paint_raster["raster-opacity"]),"raster-hue-rotate":new be(Mt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new be(Mt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new be(Mt.paint_raster["raster-brightness-max"]),"raster-saturation":new be(Mt.paint_raster["raster-saturation"]),"raster-contrast":new be(Mt.paint_raster["raster-contrast"]),"raster-resampling":new be(Mt.paint_raster["raster-resampling"]),"raster-fade-duration":new be(Mt.paint_raster["raster-fade-duration"])})}};class Ew extends is{constructor(r){super(r,Iw)}}class Sw extends is{constructor(r){super(r,{}),this.onAdd=l=>{this.implementation.onAdd&&this.implementation.onAdd(l,l.painter.context.gl)},this.onRemove=l=>{this.implementation.onRemove&&this.implementation.onRemove(l,l.painter.context.gl)},this.implementation=r}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 Cw{constructor(r){this._methodToThrottle=r,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 Hg=63710088e-1;class Kl{constructor(r,l){if(isNaN(r)||isNaN(l))throw new Error(`Invalid LngLat object: (${r}, ${l})`);if(this.lng=+r,this.lat=+l,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Kl(vt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(r){const l=Math.PI/180,f=this.lat*l,m=r.lat*l,v=Math.sin(f)*Math.sin(m)+Math.cos(f)*Math.cos(m)*Math.cos((r.lng-this.lng)*l);return Hg*Math.acos(Math.min(v,1))}static convert(r){if(r instanceof Kl)return r;if(Array.isArray(r)&&(r.length===2||r.length===3))return new Kl(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&typeof r=="object"&&r!==null)return new Kl(Number("lng"in r?r.lng:r.lon),Number(r.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 d0=2*Math.PI*Hg;function m0(s){return d0*Math.cos(s*Math.PI/180)}function g0(s){return(180+s)/360}function _0(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function y0(s,r){return s/m0(r)}function Xg(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class $d{constructor(r,l,f=0){this.x=+r,this.y=+l,this.z=+f}static fromLngLat(r,l=0){const f=Kl.convert(r);return new $d(g0(f.lng),_0(f.lat),y0(l,f.lat))}toLngLat(){return new Kl(360*this.x-180,Xg(this.y))}toAltitude(){return this.z*m0(Xg(this.y))}meterInMercatorCoordinateUnits(){return 1/d0*(r=Xg(this.y),1/Math.cos(r*Math.PI/180));var r}}function v0(s,r,l){var f=2*Math.PI*6378137/256/Math.pow(2,l);return[s*f-2*Math.PI*6378137/2,r*f-2*Math.PI*6378137/2]}class Yg{constructor(r,l,f){if(r<0||r>25||f<0||f>=Math.pow(2,r)||l<0||l>=Math.pow(2,r))throw new Error(`x=${l}, y=${f}, z=${r} outside of bounds. 0<=x<${Math.pow(2,r)}, 0<=y<${Math.pow(2,r)} 0<=z<=25 `);this.z=r,this.x=l,this.y=f,this.key=Yp(0,r,r,l,f)}equals(r){return this.z===r.z&&this.x===r.x&&this.y===r.y}url(r,l,f){const m=(x=this.y,I=this.z,S=v0(256*(v=this.x),256*(x=Math.pow(2,I)-x-1),I),M=v0(256*(v+1),256*(x+1),I),S[0]+","+S[1]+","+M[0]+","+M[1]);var v,x,I,S,M;const D=function(N,F,G){let j,Y="";for(let it=N;it>0;it--)j=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,m)}isChildOf(r){const l=this.z-r.z;return l>0&&r.x===this.x>>l&&r.y===this.y>>l}getTilePoint(r){const l=Math.pow(2,this.z);return new P((r.x*l-this.x)*vi,(r.y*l-this.y)*vi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class x0{constructor(r,l){this.wrap=r,this.canonical=l,this.key=Yp(r,l.z,l.z,l.x,l.y)}}class os{constructor(r,l,f,m,v){if(r= z; overscaledZ = ${r}; z = ${f}`);this.overscaledZ=r,this.wrap=l,this.canonical=new Yg(f,+m,+v),this.key=Yp(l,r,f,m,v)}clone(){return new os(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(r){return this.overscaledZ===r.overscaledZ&&this.wrap===r.wrap&&this.canonical.equals(r.canonical)}scaledTo(r){if(r>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${r}; overscaledZ = ${this.overscaledZ}`);const l=this.canonical.z-r;return r>this.canonical.z?new os(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new os(r,this.wrap,r,this.canonical.x>>l,this.canonical.y>>l)}calculateScaledKey(r,l){if(r>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${r}; overscaledZ = ${this.overscaledZ}`);const f=this.canonical.z-r;return r>this.canonical.z?Yp(this.wrap*+l,r,this.canonical.z,this.canonical.x,this.canonical.y):Yp(this.wrap*+l,r,r,this.canonical.x>>f,this.canonical.y>>f)}isChildOf(r){if(r.wrap!==this.wrap)return!1;const l=this.canonical.z-r.canonical.z;return r.overscaledZ===0||r.overscaledZ>l&&r.canonical.y===this.canonical.y>>l}children(r){if(this.overscaledZ>=r)return[new os(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const l=this.canonical.z+1,f=2*this.canonical.x,m=2*this.canonical.y;return[new os(l,this.wrap,l,f,m),new os(l,this.wrap,l,f+1,m),new os(l,this.wrap,l,f,m+1),new os(l,this.wrap,l,f+1,m+1)]}isLessThan(r){return this.wrapr.wrap)&&(this.overscaledZr.overscaledZ)&&(this.canonical.xr.canonical.x)&&this.canonical.ythis.max&&(this.max=N),N=this.dim+1||l<-1||l>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(l+1)*this.stride+(r+1)}unpack(r,l,f){return r*this.redFactor+l*this.greenFactor+f*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(r,l,f){if(this.dim!==r.dim)throw new Error("dem dimension mismatch");let m=l*this.dim,v=l*this.dim+this.dim,x=f*this.dim,I=f*this.dim+this.dim;switch(l){case-1:m=v-1;break;case 1:v=m+1}switch(f){case-1:x=I-1;break;case 1:I=x+1}const S=-l*this.dim,M=-f*this.dim;for(let D=x;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${r} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[r]}}class I0{constructor(r,l,f,m,v){this.type="Feature",this._vectorTileFeature=r,r._z=l,r._x=f,r._y=m,this.properties=r.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(r){this._geometry=r}toJSON(){const r={geometry:this.geometry};for(const l in this)l!=="_geometry"&&l!=="_vectorTileFeature"&&(r[l]=this[l]);return r}}class E0{constructor(r,l){this.tileID=r,this.x=r.canonical.x,this.y=r.canonical.y,this.z=r.canonical.z,this.grid=new rl(vi,16,0),this.grid3D=new rl(vi,16,0),this.featureIndexArray=new z,this.promoteId=l}insert(r,l,f,m,v,x){const I=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(f,m,v);const S=x?this.grid3D:this.grid;for(let M=0;M=0&&N[3]>=0&&S.insert(I,N[0],N[1],N[2],N[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Hl.VectorTile(new Og(this.rawTileData)).layers,this.sourceLayerCoder=new w0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(r,l,f,m){this.loadVTLayers();const v=r.params||{},x=vi/r.tileSize/r.scale,I=zc(v.filter),S=r.queryGeometry,M=r.queryPadding*x,D=C0(S),N=this.grid.query(D.minX-M,D.minY-M,D.maxX+M,D.maxY+M),F=C0(r.cameraQueryGeometry),G=this.grid3D.query(F.minX-M,F.minY-M,F.maxX+M,F.maxY+M,(it,at,bt,ct)=>function(_t,Ot,Vt,ue,ve){for(const oe of _t)if(Ot<=oe.x&&Vt<=oe.y&&ue>=oe.x&&ve>=oe.y)return!0;const le=[new P(Ot,Vt),new P(Ot,ve),new P(ue,ve),new P(ue,Vt)];if(_t.length>2){for(const oe of le)if($c(_t,oe))return!0}for(let oe=0;oe<_t.length-1;oe++)if(rb(_t[oe],_t[oe+1],le))return!0;return!1}(r.cameraQueryGeometry,it-M,at-M,bt+M,ct+M));for(const it of G)N.push(it);N.sort(Tw);const j={};let Y;for(let it=0;it(ct||(ct=ul(_t)),Ot.queryIntersectsFeature(S,_t,Vt,ct,this.z,r.transform,x,r.pixelPosMatrix)))}return j}loadMatchingFeature(r,l,f,m,v,x,I,S,M,D,N){const F=this.bucketLayerIDs[l];if(x&&!function(it,at){for(let bt=0;bt=0)return!0;return!1}(x,F))return;const G=this.sourceLayerCoder.decode(f),j=this.vtLayers[G].feature(m);if(v.needGeometry){const it=cl(j,!0);if(!v.filter(new Xn(this.tileID.overscaledZ),it,this.tileID.canonical))return}else if(!v.filter(new Xn(this.tileID.overscaledZ),j))return;const Y=this.getId(j,G);for(let it=0;it{const I=r instanceof Nu?r.get(x):null;return I&&I.evaluate?I.evaluate(l,f,m):I})}function C0(s){let r=1/0,l=1/0,f=-1/0,m=-1/0;for(const v of s)r=Math.min(r,v.x),l=Math.min(l,v.y),f=Math.max(f,v.x),m=Math.max(m,v.y);return{minX:r,minY:l,maxX:f,maxY:m}}function Tw(s,r){return r-s}function T0(s,r,l,f,m){const v=[];for(let x=0;x=f&&N.x>=f||(D.x>=f?D=new P(f,D.y+(f-D.x)/(N.x-D.x)*(N.y-D.y))._round():N.x>=f&&(N=new P(f,D.y+(f-D.x)/(N.x-D.x)*(N.y-D.y))._round()),D.y>=m&&N.y>=m||(D.y>=m?D=new P(D.x+(m-D.y)/(N.y-D.y)*(N.x-D.x),m)._round():N.y>=m&&(N=new P(D.x+(m-D.y)/(N.y-D.y)*(N.x-D.x),m)._round()),S&&D.equals(S[S.length-1])||(S=[D],v.push(S)),S.push(N)))))}}return v}de("FeatureIndex",E0,{omit:["rawTileData","sourceLayerCoder"]});class Jl extends P{constructor(r,l,f,m){super(r,l),this.angle=f,m!==void 0&&(this.segment=m)}clone(){return new Jl(this.x,this.y,this.angle,this.segment)}}function L0(s,r,l,f,m){if(r.segment===void 0||l===0)return!0;let v=r,x=r.segment+1,I=0;for(;I>-l/2;){if(x--,x<0)return!1;I-=s[x].dist(v),v=s[x]}I+=s[x].dist(s[x+1]),x++;const S=[];let M=0;for(;If;)M-=S.shift().angleDelta;if(M>m)return!1;x++,I+=D.dist(N)}return!0}function P0(s){let r=0;for(let l=0;lM){const j=(M-S)/G,Y=Ur.number(N.x,F.x,j),it=Ur.number(N.y,F.y,j),at=new Jl(Y,it,F.angleTo(N),D);return at._round(),!x||L0(s,at,I,x,r)?at:void 0}S+=G}}function Pw(s,r,l,f,m,v,x,I,S){const M=M0(f,v,x),D=A0(f,m),N=D*x,F=s[0].x===0||s[0].x===S||s[0].y===0||s[0].y===S;return r-N=0&&_t=0&&Ot=0&&F+M<=D){const Vt=new Jl(_t,Ot,bt,j);Vt._round(),f&&!L0(s,Vt,v,f,m)||G.push(Vt)}}N+=at}return I||G.length||x||(G=k0(s,N/2,l,f,m,v,x,!0,S)),G}de("Anchor",Jl);const ah=wo;function D0(s,r,l,f){const m=[],v=s.image,x=v.pixelRatio,I=v.paddedRect.w-2*ah,S=v.paddedRect.h-2*ah,M=s.right-s.left,D=s.bottom-s.top,N=v.stretchX||[[0,I]],F=v.stretchY||[[0,S]],G=(Qt,_e)=>Qt+_e[1]-_e[0],j=N.reduce(G,0),Y=F.reduce(G,0),it=I-j,at=S-Y;let bt=0,ct=j,_t=0,Ot=Y,Vt=0,ue=it,ve=0,le=at;if(v.content&&f){const Qt=v.content;bt=tm(N,0,Qt[0]),_t=tm(F,0,Qt[1]),ct=tm(N,Qt[0],Qt[2]),Ot=tm(F,Qt[1],Qt[3]),Vt=Qt[0]-bt,ve=Qt[1]-_t,ue=Qt[2]-Qt[0]-ct,le=Qt[3]-Qt[1]-Ot}const oe=(Qt,_e,$t,jt)=>{const Le=em(Qt.stretch-bt,ct,M,s.left),we=nm(Qt.fixed-Vt,ue,Qt.stretch,j),$e=em(_e.stretch-_t,Ot,D,s.top),Jn=nm(_e.fixed-ve,le,_e.stretch,Y),ei=em($t.stretch-bt,ct,M,s.left),Zi=nm($t.fixed-Vt,ue,$t.stretch,j),Uo=em(jt.stretch-_t,Ot,D,s.top),ao=nm(jt.fixed-ve,le,jt.stretch,Y),Fi=new P(Le,$e),dr=new P(ei,$e),Tr=new P(ei,Uo),lo=new P(Le,Uo),uo=new P(we/x,Jn/x),Wi=new P(Zi/x,ao/x),Hi=r*Math.PI/180;if(Hi){const Hr=Math.sin(Hi),Io=Math.cos(Hi),Eo=[Io,-Hr,Hr,Io];Fi._matMult(Eo),dr._matMult(Eo),lo._matMult(Eo),Tr._matMult(Eo)}const Wr=Qt.stretch+Qt.fixed,co=_e.stretch+_e.fixed;return{tl:Fi,tr:dr,bl:lo,br:Tr,tex:{x:v.paddedRect.x+ah+Wr,y:v.paddedRect.y+ah+co,w:$t.stretch+$t.fixed-Wr,h:jt.stretch+jt.fixed-co},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:uo,pixelOffsetBR:Wi,minFontScaleX:ue/x/M,minFontScaleY:le/x/D,isSDF:l}};if(f&&(v.stretchX||v.stretchY)){const Qt=R0(N,it,j),_e=R0(F,at,Y);for(let $t=0;$t0&&(j=Math.max(10,j),this.circleDiameter=j)}else{let N=x.top*I-S[0],F=x.bottom*I+S[2],G=x.left*I-S[3],j=x.right*I+S[1];const Y=x.collisionPadding;if(Y&&(G-=Y[0]*I,N-=Y[1]*I,j+=Y[2]*I,F+=Y[3]*I),D){const it=new P(G,N),at=new P(j,N),bt=new P(G,F),ct=new P(j,F),_t=D*Math.PI/180;it._rotate(_t),at._rotate(_t),bt._rotate(_t),ct._rotate(_t),G=Math.min(it.x,at.x,bt.x,ct.x),j=Math.max(it.x,at.x,bt.x,ct.x),N=Math.min(it.y,at.y,bt.y,ct.y),F=Math.max(it.y,at.y,bt.y,ct.y)}r.emplaceBack(l.x,l.y,G,N,j,F,f,m,v)}this.boxEndIndex=r.length}}class Mw{constructor(r=[],l=Aw){if(this.data=r,this.length=this.data.length,this.compare=l,this.length>0)for(let f=(this.length>>1)-1;f>=0;f--)this._down(f)}push(r){this.data.push(r),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const r=this.data[0],l=this.data.pop();return this.length--,this.length>0&&(this.data[0]=l,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:l,compare:f}=this,m=l[r];for(;r>0;){const v=r-1>>1,x=l[v];if(f(m,x)>=0)break;l[r]=x,r=v}l[r]=m}_down(r){const{data:l,compare:f}=this,m=this.length>>1,v=l[r];for(;r=0)break;l[r]=I,r=x}l[r]=v}}function Aw(s,r){return sr?1:0}function kw(s,r=1,l=!1){let f=1/0,m=1/0,v=-1/0,x=-1/0;const I=s[0];for(let G=0;Gv)&&(v=j.x),(!G||j.y>x)&&(x=j.y)}const S=Math.min(v-f,x-m);let M=S/2;const D=new Mw([],Dw);if(S===0)return new P(f,m);for(let G=f;GN.d||!N.d)&&(N=G,l&&console.log("found best %d after %d probes",Math.round(1e4*G.d)/1e4,F)),G.max-N.d<=r||(M=G.h/2,D.push(new lh(G.p.x-M,G.p.y-M,M,s)),D.push(new lh(G.p.x+M,G.p.y-M,M,s)),D.push(new lh(G.p.x-M,G.p.y+M,M,s)),D.push(new lh(G.p.x+M,G.p.y+M,M,s)),F+=4)}return l&&(console.log(`num probes: ${F}`),console.log(`best distance: ${N.d}`)),N.p}function Dw(s,r){return r.max-s.max}function lh(s,r,l,f){this.p=new P(s,r),this.h=l,this.d=function(m,v){let x=!1,I=1/0;for(let S=0;Sm.y!=j.y>m.y&&m.x<(j.x-G.x)*(m.y-G.y)/(j.y-G.y)+G.x&&(x=!x),I=Math.min(I,_y(m,G,j))}}return(x?1:-1)*Math.sqrt(I)}(this.p,f),this.max=this.d+this.h*Math.SQRT2}var Cr;p.ap=void 0,(Cr=p.ap||(p.ap={}))[Cr.center=1]="center",Cr[Cr.left=2]="left",Cr[Cr.right=3]="right",Cr[Cr.top=4]="top",Cr[Cr.bottom=5]="bottom",Cr[Cr["top-left"]=6]="top-left",Cr[Cr["top-right"]=7]="top-right",Cr[Cr["bottom-left"]=8]="bottom-left",Cr[Cr["bottom-right"]=9]="bottom-right";const Ql=7,Kg=Number.POSITIVE_INFINITY;function N0(s,r){return r[1]!==Kg?function(l,f,m){let v=0,x=0;switch(f=Math.abs(f),m=Math.abs(m),l){case"top-right":case"top-left":case"top":x=m-Ql;break;case"bottom-right":case"bottom-left":case"bottom":x=-m+Ql}switch(l){case"top-right":case"bottom-right":case"right":v=-f;break;case"top-left":case"bottom-left":case"left":v=f}return[v,x]}(s,r[0],r[1]):function(l,f){let m=0,v=0;f<0&&(f=0);const x=f/Math.SQRT2;switch(l){case"top-right":case"top-left":v=x-Ql;break;case"bottom-right":case"bottom-left":v=-x+Ql;break;case"bottom":v=-f+Ql;break;case"top":v=f-Ql}switch(l){case"top-right":case"bottom-right":m=-x;break;case"top-left":case"bottom-left":m=x;break;case"left":m=f;break;case"right":m=-f}return[m,v]}(s,r[0])}function z0(s,r,l){var f;const m=s.layout,v=(f=m.get("text-variable-anchor-offset"))===null||f===void 0?void 0:f.evaluate(r,{},l);if(v){const I=v.values,S=[];for(let M=0;MF*ji);D.startsWith("top")?N[1]-=Ql:D.startsWith("bottom")&&(N[1]+=Ql),S[M+1]=N}return new Oo(S)}const x=m.get("text-variable-anchor");if(x){let I;I=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(r,{},l)*ji,Kg]:m.get("text-offset").evaluate(r,{},l).map(M=>M*ji);const S=[];for(const M of x)S.push(M,N0(M,I));return new Oo(S)}return null}function Jg(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Rw(s,r,l,f,m,v,x,I,S,M,D){let N=v.textMaxSize.evaluate(r,{});N===void 0&&(N=x);const F=s.layers[0].layout,G=F.get("icon-offset").evaluate(r,{},D),j=F0(l.horizontal),Y=x/24,it=s.tilePixelRatio*Y,at=s.tilePixelRatio*N/24,bt=s.tilePixelRatio*I,ct=s.tilePixelRatio*F.get("symbol-spacing"),_t=F.get("text-padding")*s.tilePixelRatio,Ot=function(jt,Le,we,$e=1){const Jn=jt.get("icon-padding").evaluate(Le,{},we),ei=Jn&&Jn.values;return[ei[0]*$e,ei[1]*$e,ei[2]*$e,ei[3]*$e]}(F,r,D,s.tilePixelRatio),Vt=F.get("text-max-angle")/180*Math.PI,ue=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",ve=F.get("icon-rotation-alignment")==="map"&&F.get("symbol-placement")!=="point",le=F.get("symbol-placement"),oe=ct/2,Qt=F.get("icon-text-fit");let _e;f&&Qt!=="none"&&(s.allowVerticalPlacement&&l.vertical&&(_e=a0(f,l.vertical,Qt,F.get("icon-text-fit-padding"),G,Y)),j&&(f=a0(f,j,Qt,F.get("icon-text-fit-padding"),G,Y)));const $t=(jt,Le)=>{Le.x<0||Le.x>=vi||Le.y<0||Le.y>=vi||function(we,$e,Jn,ei,Zi,Uo,ao,Fi,dr,Tr,lo,uo,Wi,Hi,Wr,co,Hr,Io,Eo,Xi,hn,Xr,Lr,Yi,Cs){const oa=we.addToLineVertexArray($e,Jn);let sa,pl,Ts,ss,So=0,fl=0,Qp=0,G0=0,o_=-1,s_=-1;const dl={};let q0=Nn("");if(we.allowVerticalPlacement&&ei.vertical){const Yr=Fi.layout.get("text-rotate").evaluate(hn,{},Yi)+90;Ts=new im(dr,$e,Tr,lo,uo,ei.vertical,Wi,Hi,Wr,Yr),ao&&(ss=new im(dr,$e,Tr,lo,uo,ao,Hr,Io,Wr,Yr))}if(Zi){const Yr=Fi.layout.get("icon-rotate").evaluate(hn,{}),as=Fi.layout.get("icon-text-fit")!=="none",Gu=D0(Zi,Yr,Lr,as),la=ao?D0(ao,Yr,Lr,as):void 0;pl=new im(dr,$e,Tr,lo,uo,Zi,Hr,Io,!1,Yr),So=4*Gu.length;const qu=we.iconSizeData;let ka=null;qu.kind==="source"?(ka=[Aa*Fi.layout.get("icon-size").evaluate(hn,{})],ka[0]>Yl&&ie(`${we.layerIds[0]}: Value for "icon-size" is >= ${Xp}. Reduce your "icon-size".`)):qu.kind==="composite"&&(ka=[Aa*Xr.compositeIconSizes[0].evaluate(hn,{},Yi),Aa*Xr.compositeIconSizes[1].evaluate(hn,{},Yi)],(ka[0]>Yl||ka[1]>Yl)&&ie(`${we.layerIds[0]}: Value for "icon-size" is >= ${Xp}. Reduce your "icon-size".`)),we.addSymbols(we.icon,Gu,ka,Xi,Eo,hn,p.ah.none,$e,oa.lineStartIndex,oa.lineLength,-1,Yi),o_=we.icon.placedSymbolArray.length-1,la&&(fl=4*la.length,we.addSymbols(we.icon,la,ka,Xi,Eo,hn,p.ah.vertical,$e,oa.lineStartIndex,oa.lineLength,-1,Yi),s_=we.icon.placedSymbolArray.length-1)}const j0=Object.keys(ei.horizontal);for(const Yr of j0){const as=ei.horizontal[Yr];if(!sa){q0=Nn(as.text);const la=Fi.layout.get("text-rotate").evaluate(hn,{},Yi);sa=new im(dr,$e,Tr,lo,uo,as,Wi,Hi,Wr,la)}const Gu=as.positionedLines.length===1;if(Qp+=O0(we,$e,as,Uo,Fi,Wr,hn,co,oa,ei.vertical?p.ah.horizontal:p.ah.horizontalOnly,Gu?j0:[Yr],dl,o_,Xr,Yi),Gu)break}ei.vertical&&(G0+=O0(we,$e,ei.vertical,Uo,Fi,Wr,hn,co,oa,p.ah.vertical,["vertical"],dl,s_,Xr,Yi));const Ow=sa?sa.boxStartIndex:we.collisionBoxArray.length,Fw=sa?sa.boxEndIndex:we.collisionBoxArray.length,Bw=Ts?Ts.boxStartIndex:we.collisionBoxArray.length,Vw=Ts?Ts.boxEndIndex:we.collisionBoxArray.length,Uw=pl?pl.boxStartIndex:we.collisionBoxArray.length,Gw=pl?pl.boxEndIndex:we.collisionBoxArray.length,qw=ss?ss.boxStartIndex:we.collisionBoxArray.length,jw=ss?ss.boxEndIndex:we.collisionBoxArray.length;let aa=-1;const om=(Yr,as)=>Yr&&Yr.circleDiameter?Math.max(Yr.circleDiameter,as):as;aa=om(sa,aa),aa=om(Ts,aa),aa=om(pl,aa),aa=om(ss,aa);const Z0=aa>-1?1:0;Z0&&(aa*=Cs/ji),we.glyphOffsetArray.length>=sh.MAX_GLYPHS&&ie("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),hn.sortKey!==void 0&&we.addToSortKeyRanges(we.symbolInstances.length,hn.sortKey);const Zw=z0(Fi,hn,Yi),[Ww,Hw]=function(Yr,as){const Gu=Yr.length,la=as==null?void 0:as.values;if((la==null?void 0:la.length)>0)for(let qu=0;qu=0?dl.right:-1,dl.center>=0?dl.center:-1,dl.left>=0?dl.left:-1,dl.vertical||-1,o_,s_,q0,Ow,Fw,Bw,Vw,Uw,Gw,qw,jw,Tr,Qp,G0,So,fl,Z0,0,Wi,aa,Ww,Hw)}(s,Le,jt,l,f,m,_e,s.layers[0],s.collisionBoxArray,r.index,r.sourceLayerIndex,s.index,it,[_t,_t,_t,_t],ue,S,bt,Ot,ve,G,r,v,M,D,x)};if(le==="line")for(const jt of T0(r.geometry,0,0,vi,vi)){const Le=Pw(jt,ct,Vt,l.vertical||j,f,24,at,s.overscaling,vi);for(const we of Le)j&&Nw(s,j.text,oe,we)||$t(jt,we)}else if(le==="line-center"){for(const jt of r.geometry)if(jt.length>1){const Le=Lw(jt,Vt,l.vertical||j,f,24,at);Le&&$t(jt,Le)}}else if(r.type==="Polygon")for(const jt of Pg(r.geometry,0)){const Le=kw(jt,16);$t(jt[0],new Jl(Le.x,Le.y,0))}else if(r.type==="LineString")for(const jt of r.geometry)$t(jt,new Jl(jt[0].x,jt[0].y,0));else if(r.type==="Point")for(const jt of r.geometry)for(const Le of jt)$t([Le],new Jl(Le.x,Le.y,0))}function O0(s,r,l,f,m,v,x,I,S,M,D,N,F,G,j){const Y=function(bt,ct,_t,Ot,Vt,ue,ve,le){const oe=Ot.layout.get("text-rotate").evaluate(ue,{})*Math.PI/180,Qt=[];for(const _e of ct.positionedLines)for(const $t of _e.positionedGlyphs){if(!$t.rect)continue;const jt=$t.rect||{};let Le=t0+1,we=!0,$e=1,Jn=0;const ei=(Vt||le)&&$t.vertical,Zi=$t.metrics.advance*$t.scale/2;if(le&&ct.verticalizable&&(Jn=_e.lineOffset/2-($t.imageName?-(ji-$t.metrics.width*$t.scale)/2:($t.scale-1)*ji)),$t.imageName){const Xi=ve[$t.imageName];we=Xi.sdf,$e=Xi.pixelRatio,Le=wo/$e}const Uo=Vt?[$t.x+Zi,$t.y]:[0,0];let ao=Vt?[0,0]:[$t.x+Zi+_t[0],$t.y+_t[1]-Jn],Fi=[0,0];ei&&(Fi=ao,ao=[0,0]);const dr=$t.metrics.isDoubleResolution?2:1,Tr=($t.metrics.left-Le)*$t.scale-Zi+ao[0],lo=(-$t.metrics.top-Le)*$t.scale+ao[1],uo=Tr+jt.w/dr*$t.scale/$e,Wi=lo+jt.h/dr*$t.scale/$e,Hi=new P(Tr,lo),Wr=new P(uo,lo),co=new P(Tr,Wi),Hr=new P(uo,Wi);if(ei){const Xi=new P(-Zi,Zi-Wp),hn=-Math.PI/2,Xr=ji/2-Zi,Lr=new P(5-Wp-Xr,-($t.imageName?Xr:0)),Yi=new P(...Fi);Hi._rotateAround(hn,Xi)._add(Lr)._add(Yi),Wr._rotateAround(hn,Xi)._add(Lr)._add(Yi),co._rotateAround(hn,Xi)._add(Lr)._add(Yi),Hr._rotateAround(hn,Xi)._add(Lr)._add(Yi)}if(oe){const Xi=Math.sin(oe),hn=Math.cos(oe),Xr=[hn,-Xi,Xi,hn];Hi._matMult(Xr),Wr._matMult(Xr),co._matMult(Xr),Hr._matMult(Xr)}const Io=new P(0,0),Eo=new P(0,0);Qt.push({tl:Hi,tr:Wr,bl:co,br:Hr,tex:jt,writingMode:ct.writingMode,glyphOffset:Uo,sectionIndex:$t.sectionIndex,isSDF:we,pixelOffsetTL:Io,pixelOffsetBR:Eo,minFontScaleX:0,minFontScaleY:0})}return Qt}(0,l,I,m,v,x,f,s.allowVerticalPlacement),it=s.textSizeData;let at=null;it.kind==="source"?(at=[Aa*m.layout.get("text-size").evaluate(x,{})],at[0]>Yl&&ie(`${s.layerIds[0]}: Value for "text-size" is >= ${Xp}. Reduce your "text-size".`)):it.kind==="composite"&&(at=[Aa*G.compositeTextSizes[0].evaluate(x,{},j),Aa*G.compositeTextSizes[1].evaluate(x,{},j)],(at[0]>Yl||at[1]>Yl)&&ie(`${s.layerIds[0]}: Value for "text-size" is >= ${Xp}. Reduce your "text-size".`)),s.addSymbols(s.text,Y,at,I,v,x,M,r,S.lineStartIndex,S.lineLength,F,j);for(const bt of D)N[bt]=s.text.placedSymbolArray.length-1;return 4*Y.length}function F0(s){for(const r in s)return s[r];return null}function Nw(s,r,l,f){const m=s.compareText;if(r in m){const v=m[r];for(let x=v.length-1;x>=0;x--)if(f.dist(v[x])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const v=B0[15&f];if(!v)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(r,2,1),[I]=new Uint32Array(r,4,1);return new Qg(I,x,v,r)}constructor(r,l=64,f=Float64Array,m){if(isNaN(r)||r<0)throw new Error(`Unpexpected numItems value: ${r}.`);this.numItems=+r,this.nodeSize=Math.min(Math.max(+l,2),65535),this.ArrayType=f,this.IndexArrayType=r<65536?Uint16Array:Uint32Array;const v=B0.indexOf(this.ArrayType),x=2*r*this.ArrayType.BYTES_PER_ELEMENT,I=r*this.IndexArrayType.BYTES_PER_ELEMENT,S=(8-I%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${f}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+I+S,2*r),this._pos=2*r,this._finished=!0):(this.data=new ArrayBuffer(8+x+I+S),this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+I+S,2*r),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=l,new Uint32Array(this.data,4,1)[0]=r)}add(r,l){const f=this._pos>>1;return this.ids[f]=f,this.coords[this._pos++]=r,this.coords[this._pos++]=l,f}finish(){const r=this._pos>>1;if(r!==this.numItems)throw new Error(`Added ${r} items when expected ${this.numItems}.`);return $g(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(r,l,f,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:x,nodeSize:I}=this,S=[0,v.length-1,0],M=[];for(;S.length;){const D=S.pop()||0,N=S.pop()||0,F=S.pop()||0;if(N-F<=I){for(let it=F;it<=N;it++){const at=x[2*it],bt=x[2*it+1];at>=r&&at<=f&&bt>=l&&bt<=m&&M.push(v[it])}continue}const G=F+N>>1,j=x[2*G],Y=x[2*G+1];j>=r&&j<=f&&Y>=l&&Y<=m&&M.push(v[G]),(D===0?r<=j:l<=Y)&&(S.push(F),S.push(G-1),S.push(1-D)),(D===0?f>=j:m>=Y)&&(S.push(G+1),S.push(N),S.push(1-D))}return M}within(r,l,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:v,nodeSize:x}=this,I=[0,m.length-1,0],S=[],M=f*f;for(;I.length;){const D=I.pop()||0,N=I.pop()||0,F=I.pop()||0;if(N-F<=x){for(let it=F;it<=N;it++)U0(v[2*it],v[2*it+1],r,l)<=M&&S.push(m[it]);continue}const G=F+N>>1,j=v[2*G],Y=v[2*G+1];U0(j,Y,r,l)<=M&&S.push(m[G]),(D===0?r-f<=j:l-f<=Y)&&(I.push(F),I.push(G-1),I.push(1-D)),(D===0?r+f>=j:l+f>=Y)&&(I.push(G+1),I.push(N),I.push(1-D))}return S}}function $g(s,r,l,f,m,v){if(m-f<=l)return;const x=f+m>>1;V0(s,r,x,f,m,v),$g(s,r,l,f,x-1,1-v),$g(s,r,l,x+1,m,1-v)}function V0(s,r,l,f,m,v){for(;m>f;){if(m-f>600){const M=m-f+1,D=l-f+1,N=Math.log(M),F=.5*Math.exp(2*N/3),G=.5*Math.sqrt(N*F*(M-F)/M)*(D-M/2<0?-1:1);V0(s,r,l,Math.max(f,Math.floor(l-D*F/M+G)),Math.min(m,Math.floor(l+(M-D)*F/M+G)),v)}const x=r[2*l+v];let I=f,S=m;for(Kp(s,r,f,l),r[2*m+v]>x&&Kp(s,r,f,m);Ix;)S--}r[2*f+v]===x?Kp(s,r,f,S):(S++,Kp(s,r,S,m)),S<=l&&(f=S+1),l<=S&&(m=S-1)}}function Kp(s,r,l,f){t_(s,l,f),t_(r,2*l,2*f),t_(r,2*l+1,2*f+1)}function t_(s,r,l){const f=s[r];s[r]=s[l],s[l]=f}function U0(s,r,l,f){const m=s-l,v=r-f;return m*m+v*v}var e_;p.bc=void 0,(e_=p.bc||(p.bc={})).create="create",e_.load="load",e_.fullLoad="fullLoad";let rm=null,Jp=[];const n_=1e3/60,i_="loadTime",r_="fullLoadTime",zw={mark(s){performance.mark(s)},frame(s){const r=s;rm!=null&&Jp.push(r-rm),rm=r},clearMetrics(){rm=null,Jp=[],performance.clearMeasures(i_),performance.clearMeasures(r_);for(const s in p.bc)performance.clearMarks(p.bc[s])},getPerformanceMetrics(){performance.measure(i_,p.bc.create,p.bc.load),performance.measure(r_,p.bc.create,p.bc.fullLoad);const s=performance.getEntriesByName(i_)[0].duration,r=performance.getEntriesByName(r_)[0].duration,l=Jp.length,f=1/(Jp.reduce((v,x)=>v+x,0)/l/1e3),m=Jp.filter(v=>v>n_).reduce((v,x)=>v+(x-n_)/n_,0);return{loadTime:s,fullLoadTime:r,fps:f,percentDroppedFrames:m/(l+m)*100,totalFrames:l}}};p.$=Ae,p.A=th,p.B=function(s){if(Te==null){const r=s.navigator?s.navigator.userAgent:null;Te=!!s.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return Te},p.C=class{constructor(s,r){this.target=s,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Cw(()=>this.process()),this.subscription=function(l,f,m,v){return l.addEventListener(f,m,!1),{unsubscribe:()=>{l.removeEventListener(f,m,!1)}}}(this.target,"message",l=>this.receive(l)),this.globalScope=ge(self)?s:window}registerMessageHandler(s,r){this.messageHandlers[s]=r}sendAsync(s,r){return new Promise((l,f)=>{const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[m]={resolve:l,reject:f},r&&r.signal.addEventListener("abort",()=>{delete this.resolveRejects[m];const I={id:m,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(I)},{once:!0});const v=[],x=Object.assign(Object.assign({},s),{id:m,sourceMapId:this.mapId,origin:location.origin,data:Gl(s.data,v)});this.target.postMessage(x,{transfer:v})})}receive(s){const r=s.data,l=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!==location.origin||r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type===""){delete this.tasks[l];const f=this.abortControllers[l];return delete this.abortControllers[l],void(f&&f.abort())}if(ge(self)||r.mustQueue)return this.tasks[l]=r,this.taskQueue.push(l),void this.invoker.trigger();this.processTask(l,r)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),r=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(s,r)}processTask(s,r){return u(this,void 0,void 0,function*(){if(r.type===""){const m=this.resolveRejects[s];return delete this.resolveRejects[s],m?void(r.error?m.reject(Du(r.error)):m.resolve(Du(r.data))):void 0}if(!this.messageHandlers[r.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const l=Du(r.data),f=new AbortController;this.abortControllers[s]=f;try{const m=yield this.messageHandlers[r.type](r.sourceMapId,l,f);this.completeTask(s,null,m)}catch(m){this.completeTask(s,m)}})}completeTask(s,r,l){const f=[];delete this.abortControllers[s];const m={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:r?Gl(r):null,data:Gl(l,f)};this.target.postMessage(m,{transfer:f})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},p.D=be,p.E=Ri,p.F=function(){var s=new th(16);return th!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},p.G=ri,p.H=function(s,r,l){var f,m,v,x,I,S,M,D,N,F,G,j,Y=l[0],it=l[1],at=l[2];return r===s?(s[12]=r[0]*Y+r[4]*it+r[8]*at+r[12],s[13]=r[1]*Y+r[5]*it+r[9]*at+r[13],s[14]=r[2]*Y+r[6]*it+r[10]*at+r[14],s[15]=r[3]*Y+r[7]*it+r[11]*at+r[15]):(m=r[1],v=r[2],x=r[3],I=r[4],S=r[5],M=r[6],D=r[7],N=r[8],F=r[9],G=r[10],j=r[11],s[0]=f=r[0],s[1]=m,s[2]=v,s[3]=x,s[4]=I,s[5]=S,s[6]=M,s[7]=D,s[8]=N,s[9]=F,s[10]=G,s[11]=j,s[12]=f*Y+I*it+N*at+r[12],s[13]=m*Y+S*it+F*at+r[13],s[14]=v*Y+M*it+G*at+r[14],s[15]=x*Y+D*it+j*at+r[15]),s},p.I=Bg,p.J=function(s,r,l){var f=l[0],m=l[1],v=l[2];return s[0]=r[0]*f,s[1]=r[1]*f,s[2]=r[2]*f,s[3]=r[3]*f,s[4]=r[4]*m,s[5]=r[5]*m,s[6]=r[6]*m,s[7]=r[7]*m,s[8]=r[8]*v,s[9]=r[9]*v,s[10]=r[10]*v,s[11]=r[11]*v,s[12]=r[12],s[13]=r[13],s[14]=r[14],s[15]=r[15],s},p.K=by,p.L=function(s,r){const l={};for(let f=0;f{const r=window.document.createElement("video");return r.muted=!0,new Promise(l=>{r.onloadstart=()=>{l(r)};for(const f of s){const m=window.document.createElement("source");br(f)||(r.crossOrigin="Anonymous"),m.src=f,r.appendChild(m)}})},p.a3=function(){return St++},p.a4=o,p.a5=sh,p.a6=zc,p.a7=cl,p.a8=Xn,p.a9=I0,p.aA=mt,p.aB=function(s,r){if(!s)return[{command:"setStyle",args:[r]}];let l=[];try{if(!Qe(s.version,r.version))return[{command:"setStyle",args:[r]}];Qe(s.center,r.center)||l.push({command:"setCenter",args:[r.center]}),Qe(s.zoom,r.zoom)||l.push({command:"setZoom",args:[r.zoom]}),Qe(s.bearing,r.bearing)||l.push({command:"setBearing",args:[r.bearing]}),Qe(s.pitch,r.pitch)||l.push({command:"setPitch",args:[r.pitch]}),Qe(s.sprite,r.sprite)||l.push({command:"setSprite",args:[r.sprite]}),Qe(s.glyphs,r.glyphs)||l.push({command:"setGlyphs",args:[r.glyphs]}),Qe(s.transition,r.transition)||l.push({command:"setTransition",args:[r.transition]}),Qe(s.light,r.light)||l.push({command:"setLight",args:[r.light]}),Qe(s.terrain,r.terrain)||l.push({command:"setTerrain",args:[r.terrain]}),Qe(s.sky,r.sky)||l.push({command:"setSky",args:[r.sky]});const f={},m=[];(function(x,I,S,M){let D;for(D in I=I||{},x=x||{})Object.prototype.hasOwnProperty.call(x,D)&&(Object.prototype.hasOwnProperty.call(I,D)||$o(D,S,M));for(D in I)Object.prototype.hasOwnProperty.call(I,D)&&(Object.prototype.hasOwnProperty.call(x,D)?Qe(x[D],I[D])||(x[D].type==="geojson"&&I[D].type==="geojson"&&Ia(x,I,D)?$n(S,{command:"setGeoJSONSourceData",args:[D,I[D].data]}):ws(D,I,S,M)):fr(D,I,S))})(s.sources,r.sources,m,f);const v=[];s.layers&&s.layers.forEach(x=>{"source"in x&&f[x.source]?l.push({command:"removeLayer",args:[x.id]}):v.push(x)}),l=l.concat(m),function(x,I,S){I=I||[];const M=(x=x||[]).map(Ka),D=I.map(Ka),N=x.reduce(ts,{}),F=I.reduce(ts,{}),G=M.slice(),j=Object.create(null);let Y,it,at,bt,ct;for(let _t=0,Ot=0;_t@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(l,f,m,v)=>{const x=m||v;return r[f]=!x||x.toLowerCase(),""}),r["max-age"]){const l=parseInt(r["max-age"],10);isNaN(l)?delete r["max-age"]:r["max-age"]=l}return r},p.ab=function(s,r){const l=[];for(const f in s)f in r||l.push(f);return l},p.ac=ht,p.ad=function(s,r,l){var f=Math.sin(l),m=Math.cos(l),v=r[0],x=r[1],I=r[2],S=r[3],M=r[4],D=r[5],N=r[6],F=r[7];return r!==s&&(s[8]=r[8],s[9]=r[9],s[10]=r[10],s[11]=r[11],s[12]=r[12],s[13]=r[13],s[14]=r[14],s[15]=r[15]),s[0]=v*m+M*f,s[1]=x*m+D*f,s[2]=I*m+N*f,s[3]=S*m+F*f,s[4]=M*m-v*f,s[5]=D*m-x*f,s[6]=N*m-I*f,s[7]=F*m-S*f,s},p.ae=function(s){var r=new th(16);return r[0]=s[0],r[1]=s[1],r[2]=s[2],r[3]=s[3],r[4]=s[4],r[5]=s[5],r[6]=s[6],r[7]=s[7],r[8]=s[8],r[9]=s[9],r[10]=s[10],r[11]=s[11],r[12]=s[12],r[13]=s[13],r[14]=s[14],r[15]=s[15],r},p.af=Gd,p.ag=function(s,r){let l=0,f=0;if(s.kind==="constant")f=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:m,minZoom:v,maxZoom:x}=s,I=m?ht(Ir.interpolationFactor(m,r,v,x),0,1):0;s.kind==="camera"?f=Ur.number(s.minSize,s.maxSize,I):l=I}return{uSizeT:l,uSize:f}},p.ai=function(s,{uSize:r,uSizeT:l},{lowerSize:f,upperSize:m}){return s.kind==="source"?f/Aa:s.kind==="composite"?Ur.number(f/Aa,m/Aa,l):r},p.aj=qg,p.ak=function(s,r,l,f){const m=r.y-s.y,v=r.x-s.x,x=f.y-l.y,I=f.x-l.x,S=x*v-I*m;if(S===0)return null;const M=(I*(s.y-l.y)-x*(s.x-l.x))/S;return new P(s.x+M*v,s.y+M*m)},p.al=T0,p.am=Np,p.an=wg,p.ao=ji,p.aq=Gg,p.ar=function(s,r){var l=r[0],f=r[1],m=r[2],v=r[3],x=r[4],I=r[5],S=r[6],M=r[7],D=r[8],N=r[9],F=r[10],G=r[11],j=r[12],Y=r[13],it=r[14],at=r[15],bt=l*I-f*x,ct=l*S-m*x,_t=l*M-v*x,Ot=f*S-m*I,Vt=f*M-v*I,ue=m*M-v*S,ve=D*Y-N*j,le=D*it-F*j,oe=D*at-G*j,Qt=N*it-F*Y,_e=N*at-G*Y,$t=F*at-G*it,jt=bt*$t-ct*_e+_t*Qt+Ot*oe-Vt*le+ue*ve;return jt?(s[0]=(I*$t-S*_e+M*Qt)*(jt=1/jt),s[1]=(m*_e-f*$t-v*Qt)*jt,s[2]=(Y*ue-it*Vt+at*Ot)*jt,s[3]=(F*Vt-N*ue-G*Ot)*jt,s[4]=(S*oe-x*$t-M*le)*jt,s[5]=(l*$t-m*oe+v*le)*jt,s[6]=(it*_t-j*ue-at*ct)*jt,s[7]=(D*ue-F*_t+G*ct)*jt,s[8]=(x*_e-I*oe+M*ve)*jt,s[9]=(f*oe-l*_e-v*ve)*jt,s[10]=(j*Vt-Y*_t+at*bt)*jt,s[11]=(N*_t-D*Vt-G*bt)*jt,s[12]=(I*le-x*Qt-S*ve)*jt,s[13]=(l*Qt-f*le+m*ve)*jt,s[14]=(Y*ct-j*Ot-it*bt)*jt,s[15]=(D*Ot-N*ct+F*bt)*jt,s):null},p.as=Jg,p.at=Ug,p.au=Qg,p.av=function(){const s={},r=Mt.$version;for(const l in Mt.$root){const f=Mt.$root[l];if(f.required){let m=null;m=l==="version"?r:f.type==="array"?[]:{},m!=null&&(s[l]=m)}}return s},p.aw=Gc,p.ax=Ue,p.ay=function(s){s=s.slice();const r=Object.create(null);for(let l=0;ljt*ji)}let le=x?"center":l.get("text-justify").evaluate(M,{},s.canonical);const oe=l.get("symbol-placement"),Qt=oe==="point"?l.get("text-max-width").evaluate(M,{},s.canonical)*ji:0,_e=()=>{s.bucket.allowVerticalPlacement&&qc(_t)&&(j.vertical=Yd(Y,s.glyphMap,s.glyphPositions,s.imagePositions,D,Qt,v,ue,"left",Vt,at,p.ah.vertical,!0,oe,F,N))};if(!x&&ve){const $t=new Set;if(le==="auto")for(let Le=0;Leu(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const r=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(r)}catch(l){throw new Error(`Could not load image because of ${l.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),p.e=gt,p.f=s=>new Promise((r,l)=>{const f=new Image;f.onload=()=>{r(f),URL.revokeObjectURL(f.src),f.onload=null,window.requestAnimationFrame(()=>{f.src=on})},f.onerror=()=>l(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 m=new Blob([new Uint8Array(s)],{type:"image/png"});f.src=s.byteLength?URL.createObjectURL(m):on}),p.g=Wn,p.h=(s,r)=>yn(gt(s,{type:"json"}),r),p.i=ge,p.j=Ie,p.k=Fe,p.l=(s,r)=>yn(gt(s,{type:"arrayBuffer"}),r),p.m=yn,p.n=function(s){return new Og(s).readFields(hw,[])},p.o=Fp,p.p=e0,p.q=qr,p.r=_p,p.s=br,p.t=Ld,p.u=ae,p.v=Mt,p.w=ie,p.x=Au,p.y=function([s,r,l]){return r+=90,r*=Math.PI/180,l*=Math.PI/180,{x:s*Math.cos(r)*Math.sin(l),y:s*Math.sin(r)*Math.sin(l),z:s*Math.cos(l)}},p.z=Ur}),a("worker",["./shared"],function(p){class u{constructor(O){this.keyCache={},O&&this.replace(O)}replace(O){this._layerConfigs={},this._layers={},this.update(O,[])}update(O,U){for(const $ of O){this._layerConfigs[$.id]=$;const ft=this._layers[$.id]=p.az($);ft._featureFilter=p.a6(ft.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of U)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const Z=p.bg(Object.values(this._layerConfigs),this.keyCache);for(const $ of Z){const ft=$.map(Rt=>this._layers[Rt.id]),H=ft[0];if(H.visibility==="none")continue;const dt=H.source||"";let lt=this.familiesBySource[dt];lt||(lt=this.familiesBySource[dt]={});const xt=H.sourceLayer||"_geojsonTileLayer";let At=lt[xt];At||(At=lt[xt]=[]),At.push(ft)}}}class b{constructor(O){const U={},Z=[];for(const dt in O){const lt=O[dt],xt=U[dt]={};for(const At in lt){const Rt=lt[+At];if(!Rt||Rt.bitmap.width===0||Rt.bitmap.height===0)continue;const Nt={x:0,y:0,w:Rt.bitmap.width+2,h:Rt.bitmap.height+2};Z.push(Nt),xt[At]={rect:Nt,metrics:Rt.metrics}}}const{w:$,h:ft}=p.p(Z),H=new p.o({width:$||1,height:ft||1});for(const dt in O){const lt=O[dt];for(const xt in lt){const At=lt[+xt];if(!At||At.bitmap.width===0||At.bitmap.height===0)continue;const Rt=U[dt][xt].rect;p.o.copy(At.bitmap,H,{x:0,y:0},{x:Rt.x+1,y:Rt.y+1},At.bitmap)}}this.image=H,this.positions=U}}p.bh("GlyphAtlas",b);class w{constructor(O){this.tileID=new p.Q(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.uid=O.uid,this.zoom=O.zoom,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=O.showCollisionBoxes,this.collectResourceTiming=!!O.collectResourceTiming,this.returnDependencies=!!O.returnDependencies,this.promoteId=O.promoteId,this.inFlightDependencies=[]}parse(O,U,Z,$){return p._(this,void 0,void 0,function*(){this.status="parsing",this.data=O,this.collisionBoxArray=new p.a4;const ft=new p.bi(Object.keys(O.layers).sort()),H=new p.bj(this.tileID,this.promoteId);H.bucketLayerIDs=[];const dt={},lt={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Z},xt=U.familiesBySource[this.source];for(const Ke in xt){const ui=O.layers[Ke];if(!ui)continue;ui.version===1&&p.w(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Vi=ft.encode(Ke),Vr=[];for(let no=0;no=nr.maxzoom||nr.visibility!=="none"&&(T(no,this.zoom,Z),(dt[nr.id]=nr.createBucket({index:H.bucketLayerIDs.length,layers:no,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Vi,sourceID:this.source})).populate(Vr,lt,this.tileID.canonical),H.bucketLayerIDs.push(no.map(Is=>Is.id)))}}const At=p.aE(lt.glyphDependencies,Ke=>Object.keys(Ke).map(Number));this.inFlightDependencies.forEach(Ke=>Ke==null?void 0:Ke.abort()),this.inFlightDependencies=[];let Rt=Promise.resolve({});if(Object.keys(At).length){const Ke=new AbortController;this.inFlightDependencies.push(Ke),Rt=$.sendAsync({type:"getGlyphs",data:{stacks:At,source:this.source,tileID:this.tileID,type:"glyphs"}},Ke)}const Nt=Object.keys(lt.iconDependencies);let xe=Promise.resolve({});if(Nt.length){const Ke=new AbortController;this.inFlightDependencies.push(Ke),xe=$.sendAsync({type:"getImages",data:{icons:Nt,source:this.source,tileID:this.tileID,type:"icons"}},Ke)}const Ee=Object.keys(lt.patternDependencies);let ze=Promise.resolve({});if(Ee.length){const Ke=new AbortController;this.inFlightDependencies.push(Ke),ze=$.sendAsync({type:"getImages",data:{icons:Ee,source:this.source,tileID:this.tileID,type:"patterns"}},Ke)}const[Be,fn,Rn]=yield Promise.all([Rt,xe,ze]),ti=new b(Be),zi=new p.bk(fn,Rn);for(const Ke in dt){const ui=dt[Ke];ui instanceof p.a5?(T(ui.layers,this.zoom,Z),p.bl({bucket:ui,glyphMap:Be,glyphPositions:ti.positions,imageMap:fn,imagePositions:zi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ui.hasPattern&&(ui instanceof p.bm||ui instanceof p.bn||ui instanceof p.bo)&&(T(ui.layers,this.zoom,Z),ui.addFeatures(lt,this.tileID.canonical,zi.patternPositions))}return this.status="done",{buckets:Object.values(dt).filter(Ke=>!Ke.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ti.image,imageAtlas:zi,glyphMap:this.returnDependencies?Be:null,iconMap:this.returnDependencies?fn:null,glyphPositions:this.returnDependencies?ti.positions:null}})}}function T(rt,O,U){const Z=new p.a8(O);for(const $ of rt)$.recalculate(Z,U)}class P{constructor(O,U,Z){this.actor=O,this.layerIndex=U,this.availableImages=Z,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(O,U){return p._(this,void 0,void 0,function*(){const Z=yield p.l(O.request,U);try{return{vectorTile:new p.bp.VectorTile(new p.bq(Z.data)),rawData:Z.data,cacheControl:Z.cacheControl,expires:Z.expires}}catch($){const ft=new Uint8Array(Z.data);let H=`Unable to parse the tile at ${O.request.url}, `;throw H+=ft[0]===31&&ft[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${$.messge}`,new Error(H)}})}loadTile(O){return p._(this,void 0,void 0,function*(){const U=O.uid,Z=!!(O&&O.request&&O.request.collectResourceTiming)&&new p.br(O.request),$=new w(O);this.loading[U]=$;const ft=new AbortController;$.abort=ft;try{const H=yield this.loadVectorTile(O,ft);if(delete this.loading[U],!H)return null;const dt=H.rawData,lt={};H.expires&&(lt.expires=H.expires),H.cacheControl&&(lt.cacheControl=H.cacheControl);const xt={};if(Z){const Rt=Z.finish();Rt&&(xt.resourceTiming=JSON.parse(JSON.stringify(Rt)))}$.vectorTile=H.vectorTile;const At=$.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[U]=$,this.fetching[U]={rawTileData:dt,cacheControl:lt,resourceTiming:xt};try{const Rt=yield At;return p.e({rawTileData:dt.slice(0)},Rt,lt,xt)}finally{delete this.fetching[U]}}catch(H){throw delete this.loading[U],$.status="done",this.loaded[U]=$,H}})}reloadTile(O){return p._(this,void 0,void 0,function*(){const U=O.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const Z=this.loaded[U];if(Z.showCollisionBoxes=O.showCollisionBoxes,Z.status==="parsing"){const $=yield Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor);let ft;if(this.fetching[U]){const{rawTileData:H,cacheControl:dt,resourceTiming:lt}=this.fetching[U];delete this.fetching[U],ft=p.e({rawTileData:H.slice(0)},$,dt,lt)}else ft=$;return ft}if(Z.status==="done"&&Z.vectorTile)return Z.parse(Z.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(O){return p._(this,void 0,void 0,function*(){const U=this.loading,Z=O.uid;U&&U[Z]&&U[Z].abort&&(U[Z].abort.abort(),delete U[Z])})}removeTile(O){return p._(this,void 0,void 0,function*(){this.loaded&&this.loaded[O.uid]&&delete this.loaded[O.uid]})}}class k{constructor(){this.loaded={}}loadTile(O){return p._(this,void 0,void 0,function*(){const{uid:U,encoding:Z,rawImageData:$,redFactor:ft,greenFactor:H,blueFactor:dt,baseShift:lt}=O,xt=$.width+2,At=$.height+2,Rt=p.b($)?new p.R({width:xt,height:At},yield p.bs($,-1,-1,xt,At)):$,Nt=new p.bt(U,Rt,Z,ft,H,dt,lt);return this.loaded=this.loaded||{},this.loaded[U]=Nt,Nt})}removeTile(O){const U=this.loaded,Z=O.uid;U&&U[Z]&&delete U[Z]}}function B(rt,O){if(rt.length!==0){V(rt[0],O);for(var U=1;U=Math.abs(dt)?U-lt+dt:dt-lt+U,U=lt}U+Z>=0!=!!O&&rt.reverse()}var tt=p.bu(function rt(O,U){var Z,$=O&&O.type;if($==="FeatureCollection")for(Z=0;Z>31}function ee(rt,O){for(var U=rt.loadGeometry(),Z=rt.type,$=0,ft=0,H=U.length,dt=0;dtrt},on=Math.fround||(gn=new Float32Array(1),rt=>(gn[0]=+rt,gn[0]));var gn;const Re=3,Me=5,Dn=6;class qn{constructor(O){this.options=Object.assign(Object.create(Oe),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:U,minZoom:Z,maxZoom:$}=this.options;U&&console.time("total time");const ft=`prepare ${O.length} points`;U&&console.time(ft),this.points=O;const H=[];for(let lt=0;lt=Z;lt--){const xt=+Date.now();dt=this.trees[lt]=this._createTree(this._cluster(dt,lt)),U&&console.log("z%d: %d clusters in %dms",lt,dt.numItems,+Date.now()-xt)}return U&&console.timeEnd("total time"),this}getClusters(O,U){let Z=((O[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,O[1]));let ft=O[2]===180?180:((O[2]+180)%360+360)%360-180;const H=Math.max(-90,Math.min(90,O[3]));if(O[2]-O[0]>=360)Z=-180,ft=180;else if(Z>ft){const Rt=this.getClusters([Z,$,180,H],U),Nt=this.getClusters([-180,$,ft,H],U);return Rt.concat(Nt)}const dt=this.trees[this._limitZoom(U)],lt=dt.range(ri(Z),Kt(H),ri(ft),Kt($)),xt=dt.data,At=[];for(const Rt of lt){const Nt=this.stride*Rt;At.push(xt[Nt+Me]>1?Zn(xt,Nt,this.clusterProps):this.points[xt[Nt+Re]])}return At}getChildren(O){const U=this._getOriginId(O),Z=this._getOriginZoom(O),$="No cluster with the specified id.",ft=this.trees[Z];if(!ft)throw new Error($);const H=ft.data;if(U*this.stride>=H.length)throw new Error($);const dt=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),lt=ft.within(H[U*this.stride],H[U*this.stride+1],dt),xt=[];for(const At of lt){const Rt=At*this.stride;H[Rt+4]===O&&xt.push(H[Rt+Me]>1?Zn(H,Rt,this.clusterProps):this.points[H[Rt+Re]])}if(xt.length===0)throw new Error($);return xt}getLeaves(O,U,Z){const $=[];return this._appendLeaves($,O,U=U||10,Z=Z||0,0),$}getTile(O,U,Z){const $=this.trees[this._limitZoom(O)],ft=Math.pow(2,O),{extent:H,radius:dt}=this.options,lt=dt/H,xt=(Z-lt)/ft,At=(Z+1+lt)/ft,Rt={features:[]};return this._addTileFeatures($.range((U-lt)/ft,xt,(U+1+lt)/ft,At),$.data,U,Z,ft,Rt),U===0&&this._addTileFeatures($.range(1-lt/ft,xt,1,At),$.data,ft,Z,ft,Rt),U===ft-1&&this._addTileFeatures($.range(0,xt,lt/ft,At),$.data,-1,Z,ft,Rt),Rt.features.length?Rt:null}getClusterExpansionZoom(O){let U=this._getOriginZoom(O)-1;for(;U<=this.options.maxZoom;){const Z=this.getChildren(O);if(U++,Z.length!==1)break;O=Z[0].properties.cluster_id}return U}_appendLeaves(O,U,Z,$,ft){const H=this.getChildren(U);for(const dt of H){const lt=dt.properties;if(lt&<.cluster?ft+lt.point_count<=$?ft+=lt.point_count:ft=this._appendLeaves(O,lt.cluster_id,Z,$,ft):ft<$?ft++:O.push(dt),O.length===Z)break}return ft}_createTree(O){const U=new p.au(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Z=0;Z1;let At,Rt,Nt;if(xt)At=Wn(U,lt,this.clusterProps),Rt=U[lt],Nt=U[lt+1];else{const ze=this.points[U[lt+Re]];At=ze.properties;const[Be,fn]=ze.geometry.coordinates;Rt=ri(Be),Nt=Kt(fn)}const xe={type:1,geometry:[[Math.round(this.options.extent*(Rt*ft-Z)),Math.round(this.options.extent*(Nt*ft-$))]],tags:At};let Ee;Ee=xt||this.options.generateId?U[lt+Re]:this.points[U[lt+Re]].id,Ee!==void 0&&(xe.id=Ee),H.features.push(xe)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,U){const{radius:Z,extent:$,reduce:ft,minPoints:H}=this.options,dt=Z/($*Math.pow(2,U)),lt=O.data,xt=[],At=this.stride;for(let Rt=0;RtU&&(Be+=lt[Rn+Me])}if(Be>ze&&Be>=H){let fn,Rn=Nt*ze,ti=xe*ze,zi=-1;const Ke=((Rt/At|0)<<5)+(U+1)+this.points.length;for(const ui of Ee){const Vi=ui*At;if(lt[Vi+2]<=U)continue;lt[Vi+2]=U;const Vr=lt[Vi+Me];Rn+=lt[Vi]*Vr,ti+=lt[Vi+1]*Vr,lt[Vi+4]=Ke,ft&&(fn||(fn=this._map(lt,Rt,!0),zi=this.clusterProps.length,this.clusterProps.push(fn)),ft(fn,this._map(lt,Vi)))}lt[Rt+4]=Ke,xt.push(Rn/Be,ti/Be,1/0,Ke,-1,Be),ft&&xt.push(zi)}else{for(let fn=0;fn1)for(const fn of Ee){const Rn=fn*At;if(!(lt[Rn+2]<=U)){lt[Rn+2]=U;for(let ti=0;ti>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,U,Z){if(O[U+Me]>1){const H=this.clusterProps[O[U+Dn]];return Z?Object.assign({},H):H}const $=this.points[O[U+Re]].properties,ft=this.options.map($);return Z&&ft===$?Object.assign({},ft):ft}}function Zn(rt,O,U){return{type:"Feature",id:rt[O+Re],properties:Wn(rt,O,U),geometry:{type:"Point",coordinates:[(Z=rt[O],360*(Z-.5)),Ue(rt[O+1])]}};var Z}function Wn(rt,O,U){const Z=rt[O+Me],$=Z>=1e4?`${Math.round(Z/1e3)}k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,ft=rt[O+Dn],H=ft===-1?{}:Object.assign({},U[ft]);return Object.assign(H,{cluster:!0,cluster_id:rt[O+Re],point_count:Z,point_count_abbreviated:$})}function ri(rt){return rt/360+.5}function Kt(rt){const O=Math.sin(rt*Math.PI/180),U=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return U<0?0:U>1?1:U}function Ue(rt){const O=(180-360*rt)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function yn(rt,O,U,Z){for(var $,ft=Z,H=U-O>>1,dt=U-O,lt=rt[O],xt=rt[O+1],At=rt[U],Rt=rt[U+1],Nt=O+3;Ntft)$=Nt,ft=xe;else if(xe===ft){var Ee=Math.abs(Nt-H);EeZ&&($-O>3&&yn(rt,O,$,Z),rt[$+2]=ft,U-$>3&&yn(rt,$,U,Z))}function br(rt,O,U,Z,$,ft){var H=$-U,dt=ft-Z;if(H!==0||dt!==0){var lt=((rt-U)*H+(O-Z)*dt)/(H*H+dt*dt);lt>1?(U=$,Z=ft):lt>0&&(U+=H*lt,Z+=dt*lt)}return(H=rt-U)*H+(dt=O-Z)*dt}function er(rt,O,U,Z){var $={id:rt===void 0?null:rt,type:O,geometry:U,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(ft){var H=ft.geometry,dt=ft.type;if(dt==="Point"||dt==="MultiPoint"||dt==="LineString")Gt(ft,H);else if(dt==="Polygon"||dt==="MultiLineString")for(var lt=0;lt0&&(H+=Z?($*xt-lt*ft)/2:Math.sqrt(Math.pow(lt-$,2)+Math.pow(xt-ft,2))),$=lt,ft=xt}var At=O.length-3;O[2]=1,yn(O,0,At,U),O[At+2]=1,O.size=Math.abs(H),O.start=0,O.end=O.size}function Mt(rt,O,U,Z){for(var $=0;$1?1:U}function Qe(rt,O,U,Z,$,ft,H,dt){if(Z/=O,ft>=(U/=O)&&H=Z)return null;for(var lt=[],xt=0;xt=U&&Ee=Z)){var ze=[];if(Nt==="Point"||Nt==="MultiPoint")$n(Rt,ze,U,Z,$);else if(Nt==="LineString")fr(Rt,ze,U,Z,$,!1,dt.lineMetrics);else if(Nt==="MultiLineString")ws(Rt,ze,U,Z,$,!1);else if(Nt==="Polygon")ws(Rt,ze,U,Z,$,!0);else if(Nt==="MultiPolygon")for(var Be=0;Be=U&&H<=Z&&(O.push(rt[ft]),O.push(rt[ft+1]),O.push(rt[ft+2]))}}function fr(rt,O,U,Z,$,ft,H){for(var dt,lt,xt=$o(rt),At=$===0?wr:Ka,Rt=rt.start,Nt=0;NtU&&(lt=At(xt,xe,Ee,Be,fn,U),H&&(xt.start=Rt+dt*lt)):Rn>Z?ti=U&&(lt=At(xt,xe,Ee,Be,fn,U),zi=!0),ti>Z&&Rn<=Z&&(lt=At(xt,xe,Ee,Be,fn,Z),zi=!0),!ft&&zi&&(H&&(xt.end=Rt+dt*lt),O.push(xt),xt=$o(rt)),H&&(Rt+=dt)}var Ke=rt.length-3;xe=rt[Ke],Ee=rt[Ke+1],ze=rt[Ke+2],(Rn=$===0?xe:Ee)>=U&&Rn<=Z&&Ia(xt,xe,Ee,ze),Ke=xt.length-3,ft&&Ke>=3&&(xt[Ke]!==xt[0]||xt[Ke+1]!==xt[1])&&Ia(xt,xt[0],xt[1],xt[2]),xt.length&&O.push(xt)}function $o(rt){var O=[];return O.size=rt.size,O.start=rt.start,O.end=rt.end,O}function ws(rt,O,U,Z,$,ft){for(var H=0;HH.maxX&&(H.maxX=At),Rt>H.maxY&&(H.maxY=Rt)}return H}function Ni(rt,O,U,Z){var $=O.geometry,ft=O.type,H=[];if(ft==="Point"||ft==="MultiPoint")for(var dt=0;dt<$.length;dt+=3)H.push($[dt]),H.push($[dt+1]),rt.numPoints++,rt.numSimplified++;else if(ft==="LineString")Jt(H,$,rt,U,!1,!1);else if(ft==="MultiLineString"||ft==="Polygon")for(dt=0;dt<$.length;dt++)Jt(H,$[dt],rt,U,ft==="Polygon",dt===0);else if(ft==="MultiPolygon")for(var lt=0;lt<$.length;lt++){var xt=$[lt];for(dt=0;dt0&&O.size<($?H:Z))U.numPoints+=O.length/3;else{for(var dt=[],lt=0;ltH)&&(U.numSimplified++,dt.push(O[lt]),dt.push(O[lt+1])),U.numPoints++;$&&function(xt,At){for(var Rt=0,Nt=0,xe=xt.length,Ee=xe-2;Nt0===At)for(Nt=0,xe=xt.length;Nt24)throw new Error("maxZoom should be in the 0-24 range");if(O.promoteId&&O.generateId)throw new Error("promoteId and generateId cannot be used together.");var Z=function($,ft){var H=[];if($.type==="FeatureCollection")for(var dt=0;dt<$.features.length;dt++)Fe(H,$.features[dt],ft,dt);else Fe(H,$.type==="Feature"?$:{geometry:$},ft);return H}(rt,O);this.tiles={},this.tileCoords=[],U&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",O.indexMaxZoom,O.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Z=function($,ft){var H=ft.buffer/ft.extent,dt=$,lt=Qe($,1,-1-H,H,0,-1,2,ft),xt=Qe($,1,1-H,2+H,0,-1,2,ft);return(lt||xt)&&(dt=Qe($,1,-H,1+H,0,-1,2,ft)||[],lt&&(dt=ts(lt,1).concat(dt)),xt&&(dt=dt.concat(ts(xt,-1)))),dt}(Z,O),Z.length&&this.splitTile(Z,0,0,0),U&&(Z.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function je(rt,O,U){return 32*((1<1&&console.time("creation"),Nt=this.tiles[Rt]=Ja(rt,O,U,Z,lt),this.tileCoords.push({z:O,x:U,y:Z}),xt)){xt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",O,U,Z,Nt.numFeatures,Nt.numPoints,Nt.numSimplified),console.timeEnd("creation"));var xe="z"+O;this.stats[xe]=(this.stats[xe]||0)+1,this.total++}if(Nt.source=rt,$){if(O===lt.maxZoom||O===$)continue;var Ee=1<<$-O;if(U!==Math.floor(ft/Ee)||Z!==Math.floor(H/Ee))continue}else if(O===lt.indexMaxZoom||Nt.numPoints<=lt.indexMaxPoints)continue;if(Nt.source=null,rt.length!==0){xt>1&&console.time("clipping");var ze,Be,fn,Rn,ti,zi,Ke=.5*lt.buffer/lt.extent,ui=.5-Ke,Vi=.5+Ke,Vr=1+Ke;ze=Be=fn=Rn=null,ti=Qe(rt,At,U-Ke,U+Vi,0,Nt.minX,Nt.maxX,lt),zi=Qe(rt,At,U+ui,U+Vr,0,Nt.minX,Nt.maxX,lt),rt=null,ti&&(ze=Qe(ti,At,Z-Ke,Z+Vi,1,Nt.minY,Nt.maxY,lt),Be=Qe(ti,At,Z+ui,Z+Vr,1,Nt.minY,Nt.maxY,lt),ti=null),zi&&(fn=Qe(zi,At,Z-Ke,Z+Vi,1,Nt.minY,Nt.maxY,lt),Rn=Qe(zi,At,Z+ui,Z+Vr,1,Nt.minY,Nt.maxY,lt),zi=null),xt>1&&console.timeEnd("clipping"),dt.push(ze||[],O+1,2*U,2*Z),dt.push(Be||[],O+1,2*U,2*Z+1),dt.push(fn||[],O+1,2*U+1,2*Z),dt.push(Rn||[],O+1,2*U+1,2*Z+1)}}},He.prototype.getTile=function(rt,O,U){var Z=this.options,$=Z.extent,ft=Z.debug;if(rt<0||rt>24)return null;var H=1<1&&console.log("drilling down to z%d-%d-%d",rt,O,U);for(var lt,xt=rt,At=O,Rt=U;!lt&&xt>0;)xt--,At=Math.floor(At/2),Rt=Math.floor(Rt/2),lt=this.tiles[je(xt,At,Rt)];return lt&<.source?(ft>1&&console.log("found parent tile z%d-%d-%d",xt,At,Rt),ft>1&&console.time("drilling down"),this.splitTile(lt.source,xt,At,Rt,rt,O,U),ft>1&&console.timeEnd("drilling down"),this.tiles[dt]?No(this.tiles[dt],$):null):null};class ea extends P{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(O,U){return p._(this,void 0,void 0,function*(){const Z=O.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const $=this._geoJSONIndex.getTile(Z.z,Z.x,Z.y);if(!$)return null;const ft=new class{constructor(dt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=p.W,this.length=dt.length,this._features=dt}feature(dt){return new class{constructor(lt){this._feature=lt,this.extent=p.W,this.type=lt.type,this.properties=lt.tags,"id"in lt&&!isNaN(lt.id)&&(this.id=parseInt(lt.id,10))}loadGeometry(){if(this._feature.type===1){const lt=[];for(const xt of this._feature.geometry)lt.push([new p.P(xt[0],xt[1])]);return lt}{const lt=[];for(const xt of this._feature.geometry){const At=[];for(const Rt of xt)At.push(new p.P(Rt[0],Rt[1]));lt.push(At)}return lt}}toGeoJSON(lt,xt,At){return ot.call(this,lt,xt,At)}}(this._features[dt])}}($.features);let H=Te(ft);return H.byteOffset===0&&H.byteLength===H.buffer.byteLength||(H=new Uint8Array(H)),{vectorTile:ft,rawData:H.buffer}})}loadData(O){var U;return p._(this,void 0,void 0,function*(){(U=this._pendingRequest)===null||U===void 0||U.abort();const Z=!!(O&&O.request&&O.request.collectResourceTiming)&&new p.br(O.request);this._pendingRequest=new AbortController;try{let $=yield this.loadGeoJSON(O,this._pendingRequest);if(delete this._pendingRequest,typeof $!="object")throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`);if(tt($,!0),O.filter){const H=p.bx(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(H.result==="error")throw new Error(H.value.map(lt=>`${lt.key}: ${lt.message}`).join(", "));$={type:"FeatureCollection",features:$.features.filter(lt=>H.value.evaluate({zoom:0},lt))}}this._geoJSONIndex=O.cluster?new qn(function({superclusterOptions:H,clusterProperties:dt}){if(!dt||!H)return H;const lt={},xt={},At={accumulated:null,zoom:0},Rt={properties:null},Nt=Object.keys(dt);for(const xe of Nt){const[Ee,ze]=dt[xe],Be=p.bx(ze),fn=p.bx(typeof Ee=="string"?[Ee,["accumulated"],["get",xe]]:Ee);lt[xe]=Be.value,xt[xe]=fn.value}return H.map=xe=>{Rt.properties=xe;const Ee={};for(const ze of Nt)Ee[ze]=lt[ze].evaluate(At,Rt);return Ee},H.reduce=(xe,Ee)=>{Rt.properties=Ee;for(const ze of Nt)At.accumulated=xe[ze],xe[ze]=xt[ze].evaluate(At,Rt)},H}(O)).load($.features):function(H,dt){return new He(H,dt)}($,O.geojsonVtOptions),this.loaded={};const ft={};if(Z){const H=Z.finish();H&&(ft.resourceTiming={},ft.resourceTiming[O.source]=JSON.parse(JSON.stringify(H)))}return ft}catch($){if(delete this._pendingRequest,p.by($))return{abandoned:!0};throw $}})}reloadTile(O){const U=this.loaded;return U&&U[O.uid]?super.reloadTile(O):this.loadTile(O)}loadGeoJSON(O,U){return p._(this,void 0,void 0,function*(){const{promoteId:Z}=O;if(O.request){const $=yield p.h(O.request,U);return this._dataUpdateable=zo($.data,Z)?Ge($.data,Z):void 0,$.data}if(typeof O.data=="string")try{const $=JSON.parse(O.data);return this._dataUpdateable=zo($,Z)?Ge($,Z):void 0,$}catch{throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`)}if(!O.dataDiff)throw new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${O.source}`);return function($,ft,H){var dt,lt,xt,At;if(ft.removeAll&&$.clear(),ft.remove)for(const Rt of ft.remove)$.delete(Rt);if(ft.add)for(const Rt of ft.add){const Nt=yi(Rt,H);Nt!=null&&$.set(Nt,Rt)}if(ft.update)for(const Rt of ft.update){let Nt=$.get(Rt.id);if(Nt==null)continue;const xe=!Rt.removeAllProperties&&(((dt=Rt.removeProperties)===null||dt===void 0?void 0:dt.length)>0||((lt=Rt.addOrUpdateProperties)===null||lt===void 0?void 0:lt.length)>0);if((Rt.newGeometry||Rt.removeAllProperties||xe)&&(Nt=Object.assign({},Nt),$.set(Rt.id,Nt),xe&&(Nt.properties=Object.assign({},Nt.properties))),Rt.newGeometry&&(Nt.geometry=Rt.newGeometry),Rt.removeAllProperties)Nt.properties={};else if(((xt=Rt.removeProperties)===null||xt===void 0?void 0:xt.length)>0)for(const Ee of Rt.removeProperties)Object.prototype.hasOwnProperty.call(Nt.properties,Ee)&&delete Nt.properties[Ee];if(((At=Rt.addOrUpdateProperties)===null||At===void 0?void 0:At.length)>0)for(const{key:Ee,value:ze}of Rt.addOrUpdateProperties)Nt.properties[Ee]=ze}}(this._dataUpdateable,O.dataDiff,Z),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(O){return p._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(O){return this._geoJSONIndex.getClusterExpansionZoom(O.clusterId)}getClusterChildren(O){return this._geoJSONIndex.getChildren(O.clusterId)}getClusterLeaves(O){return this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset)}}class Ii{constructor(O){this.self=O,this.actor=new p.C(O),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,Z)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=Z},this.self.addProtocol=p.be,this.self.removeProtocol=p.bf,this.self.registerRTLTextPlugin=U=>{if(p.bz.isParsed())throw new Error("RTL text plugin already registered.");p.bz.setMethods(U)},this.actor.registerMessageHandler("loadDEMTile",(U,Z)=>this._getDEMWorkerSource(U,Z.source).loadTile(Z)),this.actor.registerMessageHandler("removeDEMTile",(U,Z)=>p._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,Z.source).removeTile(Z)})),this.actor.registerMessageHandler("getClusterExpansionZoom",(U,Z)=>p._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterExpansionZoom(Z)})),this.actor.registerMessageHandler("getClusterChildren",(U,Z)=>p._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterChildren(Z)})),this.actor.registerMessageHandler("getClusterLeaves",(U,Z)=>p._(this,void 0,void 0,function*(){return this._getWorkerSource(U,Z.type,Z.source).getClusterLeaves(Z)})),this.actor.registerMessageHandler("loadData",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).loadData(Z)),this.actor.registerMessageHandler("loadTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).loadTile(Z)),this.actor.registerMessageHandler("reloadTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).reloadTile(Z)),this.actor.registerMessageHandler("abortTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).abortTile(Z)),this.actor.registerMessageHandler("removeTile",(U,Z)=>this._getWorkerSource(U,Z.type,Z.source).removeTile(Z)),this.actor.registerMessageHandler("removeSource",(U,Z)=>p._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][Z.type]||!this.workerSources[U][Z.type][Z.source])return;const $=this.workerSources[U][Z.type][Z.source];delete this.workerSources[U][Z.type][Z.source],$.removeSource!==void 0&&$.removeSource(Z)})),this.actor.registerMessageHandler("removeMap",U=>p._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("setReferrer",(U,Z)=>p._(this,void 0,void 0,function*(){this.referrer=Z})),this.actor.registerMessageHandler("syncRTLPluginState",(U,Z)=>this._syncRTLPluginState(U,Z)),this.actor.registerMessageHandler("importScript",(U,Z)=>p._(this,void 0,void 0,function*(){this.self.importScripts(Z)})),this.actor.registerMessageHandler("setImages",(U,Z)=>this._setImages(U,Z)),this.actor.registerMessageHandler("updateLayers",(U,Z)=>p._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(Z.layers,Z.removedIds)})),this.actor.registerMessageHandler("setLayers",(U,Z)=>p._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(Z)}))}_setImages(O,U){return p._(this,void 0,void 0,function*(){this.availableImages[O]=U;for(const Z in this.workerSources[O]){const $=this.workerSources[O][Z];for(const ft in $)$[ft].availableImages=U}})}_syncRTLPluginState(O,U){return p._(this,void 0,void 0,function*(){p.bz.setState(U);const Z=p.bz.getPluginURL();if(U.pluginStatus==="loaded"&&!p.bz.isParsed()&&Z!=null){this.self.importScripts(Z);const $=p.bz.isParsed();if($)return $;throw new Error(`RTL Text Plugin failed to import scripts from ${Z}`)}return!1})}_getAvailableImages(O){let U=this.availableImages[O];return U||(U=[]),U}_getLayerIndex(O){let U=this.layerIndexes[O];return U||(U=this.layerIndexes[O]=new u),U}_getWorkerSource(O,U,Z){if(this.workerSources[O]||(this.workerSources[O]={}),this.workerSources[O][U]||(this.workerSources[O][U]={}),!this.workerSources[O][U][Z]){const $={sendAsync:(ft,H)=>(ft.targetMapId=O,this.actor.sendAsync(ft,H))};switch(U){case"vector":this.workerSources[O][U][Z]=new P($,this._getLayerIndex(O),this._getAvailableImages(O));break;case"geojson":this.workerSources[O][U][Z]=new ea($,this._getLayerIndex(O),this._getAvailableImages(O));break;default:this.workerSources[O][U][Z]=new this.externalWorkerSourceTypes[U]($,this._getLayerIndex(O),this._getAvailableImages(O))}}return this.workerSources[O][U][Z]}_getDEMWorkerSource(O,U){return this.demWorkerSources[O]||(this.demWorkerSources[O]={}),this.demWorkerSources[O][U]||(this.demWorkerSources[O][U]=new k),this.demWorkerSources[O][U]}}return p.i(self)&&(self.worker=new Ii(self)),Ii}),a("index",["exports","./shared"],function(p,u){var b="4.1.0";let w,T;const P={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:_=>new Promise((o,h)=>{const d=requestAnimationFrame(o);_.signal.addEventListener("abort",()=>{cancelAnimationFrame(d),h(u.c())})}),getImageData(_,o=0){return this.getImageCanvasContext(_).getImageData(-o,-o,_.width+2*o,_.height+2*o)},getImageCanvasContext(_){const o=window.document.createElement("canvas"),h=o.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return o.width=_.width,o.height=_.height,h.drawImage(_,0,0,_.width,_.height),h},resolveURL:_=>(w||(w=document.createElement("a")),w.href=_,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(T==null&&(T=matchMedia("(prefers-reduced-motion: reduce)")),T.matches)}};class k{static testProp(o){if(!k.docStyle)return o[0];for(let h=0;h{window.removeEventListener("click",k.suppressClickInternal,!0)},0)}static getScale(o){const h=o.getBoundingClientRect();return{x:h.width/o.offsetWidth||1,y:h.height/o.offsetHeight||1,boundingClientRect:h}}static getPoint(o,h,d){const g=h.boundingClientRect;return new u.P((d.clientX-g.left)/h.x-o.clientLeft,(d.clientY-g.top)/h.y-o.clientTop)}static mousePos(o,h){const d=k.getScale(o);return k.getPoint(o,d,h)}static touchPos(o,h){const d=[],g=k.getScale(o);for(let y=0;y{o=[],h=0,d=0,g={}},_.addThrottleControl=L=>{const A=d++;return g[A]=L,A},_.removeThrottleControl=L=>{delete g[L],E()},_.getImage=(L,A,R=!0)=>new Promise((z,q)=>{B.supported&&(L.headers||(L.headers={}),L.headers.accept="image/webp,*/*"),u.e(L,{type:"image"}),o.push({abortController:A,requestParameters:L,supportImageRefresh:R,state:"queued",onError:et=>{q(et)},onSuccess:et=>{z(et)}}),E()});const y=L=>u._(this,void 0,void 0,function*(){L.state="running";const{requestParameters:A,supportImageRefresh:R,onError:z,onSuccess:q,abortController:et}=L,Q=R===!1&&!u.i(self)&&!u.g(A.url)&&(!A.headers||Object.keys(A.headers).reduce((pt,Et)=>pt&&Et==="accept",!0));h++;const nt=Q?C(A,et):u.m(A,et);try{const pt=yield nt;delete L.abortController,L.state="completed",pt.data instanceof HTMLImageElement||u.b(pt.data)?q(pt):pt.data&&q({data:yield(K=pt.data,typeof createImageBitmap=="function"?u.d(K):u.f(K)),cacheControl:pt.cacheControl,expires:pt.expires})}catch(pt){delete L.abortController,z(pt)}finally{h--,E()}var K}),E=()=>{const L=(()=>{for(const A of Object.keys(g))if(g[A]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let A=h;A0;A++){const R=o.shift();R.abortController.signal.aborted?A--:y(R)}},C=(L,A)=>new Promise((R,z)=>{const q=new Image,et=L.url,Q=L.credentials;Q&&Q==="include"?q.crossOrigin="use-credentials":(Q&&Q==="same-origin"||!u.s(et))&&(q.crossOrigin="anonymous"),A.signal.addEventListener("abort",()=>{q.src="",z(u.c())}),q.fetchPriority="high",q.onload=()=>{q.onerror=q.onload=null,R({data:q})},q.onerror=()=>{q.onerror=q.onload=null,A.signal.aborted||z(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."))},q.src=et})}(X||(X={})),X.resetRequestQueue(),function(_){_.Glyphs="Glyphs",_.Image="Image",_.Source="Source",_.SpriteImage="SpriteImage",_.SpriteJSON="SpriteJSON",_.Style="Style",_.Tile="Tile",_.Unknown="Unknown"}(J||(J={}));class ht{constructor(o){this._transformRequestFn=o}transformRequest(o,h){return this._transformRequestFn&&this._transformRequestFn(o,h)||{url:o}}normalizeSpriteURL(o,h,d){const g=function(y){const E=y.match(vt);if(!E)throw new Error(`Unable to parse URL "${y}"`);return{protocol:E[1],authority:E[2],path:E[3]||"/",params:E[4]?E[4].split("&"):[]}}(o);return g.path+=`${h}${d}`,function(y){const E=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${E}`}(g)}setTransformRequest(o){this._transformRequestFn=o}}const vt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function gt(_){var o=new u.A(3);return o[0]=_[0],o[1]=_[1],o[2]=_[2],o}var St,It=function(_,o,h){return _[0]=o[0]-h[0],_[1]=o[1]-h[1],_[2]=o[2]-h[2],_};St=new u.A(3),u.A!=Float32Array&&(St[0]=0,St[1]=0,St[2]=0);var Ft=function(_){var o=_[0],h=_[1];return o*o+h*h};function mt(_){const o=[];if(typeof _=="string")o.push({id:"default",url:_});else if(_&&_.length>0){const h=[];for(const{id:d,url:g}of _){const y=`${d}${g}`;h.indexOf(y)===-1&&(h.push(y),o.push({id:d,url:g}))}}return o}(function(){var _=new u.A(2);u.A!=Float32Array&&(_[0]=0,_[1]=0)})();class Ct{constructor(o,h,d,g){this.context=o,this.format=d,this.texture=o.gl.createTexture(),this.update(h,g)}update(o,h,d){const{width:g,height:y}=o,E=!(this.size&&this.size[0]===g&&this.size[1]===y||d),{context:C}=this,{gl:L}=C;if(this.useMipmap=!!(h&&h.useMipmap),L.bindTexture(L.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===L.RGBA&&(!h||h.premultiply!==!1)),E)this.size=[g,y],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||u.b(o)?L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,L.UNSIGNED_BYTE,o):L.texImage2D(L.TEXTURE_2D,0,this.format,g,y,0,this.format,L.UNSIGNED_BYTE,o.data);else{const{x:A,y:R}=d||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||u.b(o)?L.texSubImage2D(L.TEXTURE_2D,0,A,R,L.RGBA,L.UNSIGNED_BYTE,o):L.texSubImage2D(L.TEXTURE_2D,0,A,R,g,y,L.RGBA,L.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&L.generateMipmap(L.TEXTURE_2D)}bind(o,h,d){const{context:g}=this,{gl:y}=g;y.bindTexture(y.TEXTURE_2D,this.texture),d!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=y.LINEAR),o!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,o),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,d||o),this.filter=o),h!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,h),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,h),this.wrap=h)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function ie(_){const{userImage:o}=_;return!!(o&&o.render&&o.render())&&(_.data.replace(new Uint8Array(o.data.buffer)),!0)}class Tt 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(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:h,promiseResolve:d}of this.requestors)d(this._getImagesForIds(h));this.requestors=[]}}getImage(o){const h=this.images[o];if(h&&!h.data&&h.spriteData){const d=h.spriteData;h.data=new u.R({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),h.spriteData=null}return h}addImage(o,h){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,h)&&(this.images[o]=h)}_validate(o,h){let d=!0;const g=h.data||h.spriteData;return this._validateStretch(h.stretchX,g&&g.width)||(this.fire(new u.j(new Error(`Image "${o}" has invalid "stretchX" value`))),d=!1),this._validateStretch(h.stretchY,g&&g.height)||(this.fire(new u.j(new Error(`Image "${o}" has invalid "stretchY" value`))),d=!1),this._validateContent(h.content,h)||(this.fire(new u.j(new Error(`Image "${o}" has invalid "content" value`))),d=!1),d}_validateStretch(o,h){if(!o)return!0;let d=0;for(const g of o){if(g[0]{let g=!0;if(!this.isLoaded())for(const y of o)this.images[y]||(g=!1);this.isLoaded()||g?h(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:h})})}_getImagesForIds(o){const h={};for(const d of o){let g=this.getImage(d);g||(this.fire(new u.k("styleimagemissing",{id:d})),g=this.getImage(d)),g?h[d]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}: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 h}getPixelSize(){const{width:o,height:h}=this.atlasImage;return{width:o,height:h}}getPattern(o){const h=this.patterns[o],d=this.getImage(o);if(!d)return null;if(h&&h.position.version===d.version)return h.position;if(h)h.position.version=d.version;else{const g={w:d.data.width+2,h:d.data.height+2,x:0,y:0},y=new u.I(g,d);this.patterns[o]={bin:g,position:y}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const h=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ct(o,this.atlasImage,h.RGBA),this.atlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const y in this.patterns)o.push(this.patterns[y].bin);const{w:h,h:d}=u.p(o),g=this.atlasImage;g.resize({width:h||1,height:d||1});for(const y in this.patterns){const{bin:E}=this.patterns[y],C=E.x+1,L=E.y+1,A=this.getImage(y).data,R=A.width,z=A.height;u.R.copy(A,g,{x:0,y:0},{x:C,y:L},{width:R,height:z}),u.R.copy(A,g,{x:0,y:z-1},{x:C,y:L-1},{width:R,height:1}),u.R.copy(A,g,{x:0,y:0},{x:C,y:L+z},{width:R,height:1}),u.R.copy(A,g,{x:R-1,y:0},{x:C-1,y:L},{width:1,height:z}),u.R.copy(A,g,{x:0,y:0},{x:C+R,y:L},{width:1,height:z})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const h of o){if(this.callbackDispatchedThisFrame[h])continue;this.callbackDispatchedThisFrame[h]=!0;const d=this.getImage(h);d||u.w(`Image with ID: "${h}" was not found`),ie(d)&&this.updateImage(h,d)}}}const ee=1e20;function ge(_,o,h,d,g,y,E,C,L){for(let A=o;A-1);L++,y[L]=C,E[L]=A,E[L+1]=ee}for(let C=0,L=0;C65535)throw new Error("glyphs > 65535 not supported");if(d.ranges[y])return{stack:o,id:h,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!d.requests[y]){const C=Oe.loadGlyphRange(o,y,this.url,this.requestManager);d.requests[y]=C}const E=yield d.requests[y];for(const C in E)this._doesCharSupportLocalGlyph(+C)||(d.glyphs[+C]=E[+C]);return d.ranges[y]=!0,{stack:o,id:h,glyph:E[h]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&(u.u["CJK Unified Ideographs"](o)||u.u["Hangul Syllables"](o)||u.u.Hiragana(o)||u.u.Katakana(o))}_tinySDF(o,h,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let y=o.tinySDF;if(!y){let C="400";/bold/i.test(h)?C="900":/medium/i.test(h)?C="500":/light/i.test(h)&&(C="200"),y=o.tinySDF=new Oe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:C})}const E=y.draw(String.fromCharCode(d));return{id:d,bitmap:new u.o({width:E.width||60,height:E.height||60},E.data),metrics:{width:E.glyphWidth/2||24,height:E.glyphHeight/2||24,left:E.glyphLeft/2+.5||0,top:E.glyphTop/2-27.5||-8,advance:E.glyphAdvance/2||24,isDoubleResolution:!0}}}}Oe.loadGlyphRange=function(_,o,h,d){return u._(this,void 0,void 0,function*(){const g=256*o,y=g+255,E=d.transformRequest(h.replace("{fontstack}",_).replace("{range}",`${g}-${y}`),J.Glyphs),C=yield u.l(E,new AbortController);if(!C||!C.data)throw new Error(`Could not load glyph range. range: ${o}, ${g}-${y}`);const L={};for(const A of u.n(C.data))L[A.id]=A;return L})},Oe.TinySDF=class{constructor({fontSize:_=24,buffer:o=3,radius:h=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:y="normal",fontStyle:E="normal"}={}){this.buffer=o,this.cutoff=d,this.radius=h;const C=this.size=_+4*o,L=this._createCanvas(C),A=this.ctx=L.getContext("2d",{willReadFrequently:!0});A.font=`${E} ${y} ${_}px ${g}`,A.textBaseline="alphabetic",A.textAlign="left",A.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(_){const o=document.createElement("canvas");return o.width=o.height=_,o}draw(_){const{width:o,actualBoundingBoxAscent:h,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:y}=this.ctx.measureText(_),E=Math.ceil(h),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(y-g))),L=Math.min(this.size-this.buffer,E+Math.ceil(d)),A=C+2*this.buffer,R=L+2*this.buffer,z=Math.max(A*R,0),q=new Uint8ClampedArray(z),et={data:q,width:A,height:R,glyphWidth:C,glyphHeight:L,glyphTop:E,glyphLeft:0,glyphAdvance:o};if(C===0||L===0)return et;const{ctx:Q,buffer:nt,gridInner:K,gridOuter:pt}=this;Q.clearRect(nt,nt,C,L),Q.fillText(_,nt,nt+E);const Et=Q.getImageData(nt,nt,C,L);pt.fill(ee,0,z),K.fill(0,0,z);for(let st=0;st0?Bt*Bt:0,K[Pt]=Bt<0?Bt*Bt:0}}ge(pt,0,0,A,R,A,this.f,this.v,this.z),ge(K,nt,nt,C,L,A,this.f,this.v,this.z);for(let st=0;st1&&(L=o[++C]);const R=Math.abs(A-L.left),z=Math.abs(A-L.right),q=Math.min(R,z);let et;const Q=y/d*(g+1);if(L.isDash){const nt=g-Math.abs(Q);et=Math.sqrt(q*q+nt*nt)}else et=g-Math.sqrt(q*q+Q*Q);this.data[E+A]=Math.max(0,Math.min(255,et+128))}}}addRegularDash(o){for(let C=o.length-1;C>=0;--C){const L=o[C],A=o[C+1];L.zeroLength?o.splice(C,1):A&&A.isDash===L.isDash&&(A.left=L.left,o.splice(C,1))}const h=o[0],d=o[o.length-1];h.isDash===d.isDash&&(h.left=d.left-this.width,d.right=h.right+this.width);const g=this.width*this.nextRow;let y=0,E=o[y];for(let C=0;C1&&(E=o[++y]);const L=Math.abs(C-E.left),A=Math.abs(C-E.right),R=Math.min(L,A);this.data[g+C]=Math.max(0,Math.min(255,(E.isDash?R:-R)+128))}}addDash(o,h){const d=h?7:0,g=2*d+1;if(this.nextRow+g>this.height)return u.w("LineAtlas out of space"),null;let y=0;for(let C=0;C{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Dn]}numActive(){return Object.keys(this.active).length}}const Zn=Math.floor(P.hardwareConcurrency/2);let Wn,ri;function Kt(){return Wn||(Wn=new qn),Wn}qn.workerCount=u.B(globalThis)?Math.max(Math.min(Zn,3),1):1;class Ue{constructor(o,h){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=h;const d=this.workerPool.acquire(h);for(let g=0;g{h.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,h){for(const d of this.actors)d.registerMessageHandler(o,h)}}function yn(){return ri||(ri=new Ue(Kt(),u.G),ri.registerMessageHandler("getResource",(_,o,h)=>u.m(o,h))),ri}function br(_,o){const h=u.F();return u.H(h,h,[1,1,0]),u.J(h,h,[.5*_.width,.5*_.height,1]),u.K(h,h,_.calculatePosMatrix(o.toUnwrapped()))}function er(_,o,h,d,g,y){const E=function(z,q,et){if(z)for(const Q of z){const nt=q[Q];if(nt&&nt.source===et&&nt.type==="fill-extrusion")return!0}else for(const Q in q){const nt=q[Q];if(nt.source===et&&nt.type==="fill-extrusion")return!0}return!1}(g&&g.layers,o,_.id),C=y.maxPitchScaleFactor(),L=_.tilesIn(d,C,E);L.sort(Gt);const A=[];for(const z of L)A.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(o,h,_._state,z.queryGeometry,z.cameraQueryGeometry,z.scale,g,y,C,br(_.transform,z.tileID))});const R=function(z){const q={},et={};for(const Q of z){const nt=Q.queryResults,K=Q.wrappedTileID,pt=et[K]=et[K]||{};for(const Et in nt){const st=nt[Et],yt=pt[Et]=pt[Et]||{},kt=q[Et]=q[Et]||[];for(const Pt of st)yt[Pt.featureIndex]||(yt[Pt.featureIndex]=!0,kt.push(Pt))}}return q}(A);for(const z in R)R[z].forEach(q=>{const et=q.feature,Q=_.getFeatureState(et.layer["source-layer"],et.id);et.source=et.layer.source,et.layer["source-layer"]&&(et.sourceLayer=et.layer["source-layer"]),et.state=Q});return R}function Gt(_,o){const h=_.tileID,d=o.tileID;return h.overscaledZ-d.overscaledZ||h.canonical.y-d.canonical.y||h.wrap-d.wrap||h.canonical.x-d.canonical.x}function Fe(_,o,h){return u._(this,void 0,void 0,function*(){let d=_;if(_.url?d=(yield u.h(o.transformRequest(_.url,J.Source),h)).data:yield P.frameAsync(h),!d)return null;const g=u.L(u.e(d,_),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in d&&d.vector_layers&&(g.vectorLayerIds=d.vector_layers.map(y=>y.id)),g})}class Ie{constructor(o,h){o&&(h?this.setSouthWest(o).setNorthEast(h):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof u.M?new u.M(o.lng,o.lat):u.M.convert(o),this}setSouthWest(o){return this._sw=o instanceof u.M?new u.M(o.lng,o.lat):u.M.convert(o),this}extend(o){const h=this._sw,d=this._ne;let g,y;if(o instanceof u.M)g=o,y=o;else{if(!(o instanceof Ie))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(Ie.convert(o)):this.extend(u.M.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(u.M.convert(o)):this;if(g=o._sw,y=o._ne,!g||!y)return this}return h||d?(h.lng=Math.min(g.lng,h.lng),h.lat=Math.min(g.lat,h.lat),d.lng=Math.max(y.lng,d.lng),d.lat=Math.max(y.lat,d.lat)):(this._sw=new u.M(g.lng,g.lat),this._ne=new u.M(y.lng,y.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(o){const{lng:h,lat:d}=u.M.convert(o);let g=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(o){return o instanceof Ie?o:o&&new Ie(o)}static fromLngLat(o,h=0){const d=360*h/40075017,g=d/Math.cos(Math.PI/180*o.lat);return new Ie(new u.M(o.lng-g,o.lat-d),new u.M(o.lng+g,o.lat+d))}}class Ri{constructor(o,h,d){this.bounds=Ie.convert(this.validateBounds(o)),this.minzoom=h||0,this.maxzoom=d||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const h=Math.pow(2,o.z),d=Math.floor(u.N(this.bounds.getWest())*h),g=Math.floor(u.O(this.bounds.getNorth())*h),y=Math.ceil(u.N(this.bounds.getEast())*h),E=Math.ceil(u.O(this.bounds.getSouth())*h);return o.x>=d&&o.x=g&&o.y{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return u.e({},this._options)}loadTile(o){return u._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(h,J.Tile),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.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 g="reloadTile";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((y,E)=>{o.reloadPromise={resolve:y,reject:E}})}else o.actor=this.dispatcher.getActor(),g="loadTile";o.abortController=new AbortController;try{const y=yield o.actor.sendAsync({type:g,data:d},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,y)}catch(y){if(delete o.abortController,o.aborted)return;if(y&&y.status!==404)throw y;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,h){if(h&&h.resourceTiming&&(o.resourceTiming=h.resourceTiming),h&&this.map._refreshExpiredTiles&&o.setExpiryData(h),o.loadVectorData(h,this.map.painter),o.reloadPromise){const d=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(d.resolve).catch(d.reject)}}abortTile(o){return u._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"abortTile",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return u._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"removeTile",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class sn extends u.E{constructor(o,h,d,g){super(),this.id=o,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},h),u.e(this,u.L(h,["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 o=yield Fe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(u.e(this,o),o.bounds&&(this.tileBounds=new Ri(o.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(o){this._tileJSONRequest=null,this.fire(new u.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return u.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return u._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const d=yield X.getImage(this.map._requestManager.transformRequest(h,J.Tile),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(d&&d.data){this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&o.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const g=this.map.painter.context,y=g.gl,E=d.data;o.texture=this.map.painter.getTileTexture(E.width),o.texture?o.texture.update(E,{useMipmap:!0}):(o.texture=new Ct(g,E,y.RGBA,{useMipmap:!0}),o.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),o.state="loaded"}}catch(d){if(delete o.abortController,o.aborted)o.state="unloaded";else if(d)throw o.state="errored",d}})}abortTile(o){return u._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return u._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class Bi extends sn{constructor(o,h,d,g){super(o,h,d,g),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},h),this.encoding=h.encoding||"mapbox",this.redFactor=h.redFactor,this.greenFactor=h.greenFactor,this.blueFactor=h.blueFactor,this.baseShift=h.baseShift}loadTile(o){return u._(this,void 0,void 0,function*(){const h=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d=this.map._requestManager.transformRequest(h,J.Tile);o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const g=yield X.getImage(d,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(g&&g.data){const y=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&o.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const E=u.b(y)&&u.S()?y:yield this.readImageNow(y),C={type:this.type,uid:o.uid,source:this.id,rawImageData:E,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const L=yield o.actor.sendAsync({type:"loadDEMTile",data:C});o.dem=L,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(g){if(delete o.abortController,o.aborted)o.state="unloaded";else if(g)throw o.state="errored",g}})}readImageNow(o){return u._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&u.U()){const h=o.width+2,d=o.height+2;try{return new u.R({width:h,height:d},yield u.V(o,-1,-1,h,d))}catch{}}return P.getImageData(o,1)})}_getNeighboringTiles(o){const h=o.canonical,d=Math.pow(2,h.z),g=(h.x-1+d)%d,y=h.x===0?o.wrap-1:o.wrap,E=(h.x+1+d)%d,C=h.x+1===d?o.wrap+1:o.wrap,L={};return L[new u.Q(o.overscaledZ,y,h.z,g,h.y).key]={backfilled:!1},L[new u.Q(o.overscaledZ,C,h.z,E,h.y).key]={backfilled:!1},h.y>0&&(L[new u.Q(o.overscaledZ,y,h.z,g,h.y-1).key]={backfilled:!1},L[new u.Q(o.overscaledZ,o.wrap,h.z,h.x,h.y-1).key]={backfilled:!1},L[new u.Q(o.overscaledZ,C,h.z,E,h.y-1).key]={backfilled:!1}),h.y+10&&u.e(y,{resourceTiming:g}),this.fire(new u.k("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new u.k("data",Object.assign(Object.assign({},y),{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(o){return u._(this,void 0,void 0,function*(){const h=o.actor?"reloadTile":"loadTile";o.actor=this.actor;const d={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const g=yield this.actor.sendAsync({type:h,data:d},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(g,this.map.painter,h==="reloadTile")})}abortTile(o){return u._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return u._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"removeTile",data:{uid:o.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"removeSource",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var $n=u.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fr extends u.E{constructor(o,h,d,g){super(),this.id=o,this.dispatcher=d,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=h}load(o){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 h=yield X.getImage(this.map._requestManager.transformRequest(this.url,J.Image),this._request);this._request=null,this._loaded=!0,h&&h.data&&(this.image=h.data,o&&(this.coordinates=o),this._finishLoading())}catch(h){this._request=null,this.fire(new u.j(h))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.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(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const h=o.map(u.Y.fromLngLat);this.tileID=function(g){let y=1/0,E=1/0,C=-1/0,L=-1/0;for(const q of g)y=Math.min(y,q.x),E=Math.min(E,q.y),C=Math.max(C,q.x),L=Math.max(L,q.y);const A=Math.max(C-y,L-E),R=Math.max(0,Math.floor(-Math.log(A)/Math.LN2)),z=Math.pow(2,R);return new u.a0(R,Math.floor((y+C)/2*z),Math.floor((E+L)/2*z))}(h),this.minzoom=this.maxzoom=this.tileID.z;const d=h.map(g=>this.tileID.getTilePoint(g)._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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,$n.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ct(o,this.image,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let d=!1;for(const g in this.tiles){const y=this.tiles[g];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new u.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return u._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class $o extends fr{constructor(o,h,d,g){super(o,h,d,g),this.roundZoom=!0,this.type="video",this.options=h}load(){return u._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const h of o.urls)this.urls.push(this.map._requestManager.transformRequest(h,J.Source).url);try{const h=yield u.a2(this.urls);if(this._loaded=!0,!h)return;this.video=h,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(h){this.fire(new u.j(h))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const h=this.video.seekable;oh.end(0)?this.fire(new u.j(new u.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${h.start(0)} and ${h.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,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 o=this.map.painter.context,h=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,$n.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,this.video)):(this.texture=new Ct(o,this.video,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let d=!1;for(const g in this.tiles){const y=this.tiles[g];y.state!=="loaded"&&(y.state="loaded",y.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 ws extends fr{constructor(o,h,d,g){super(o,h,d,g),h.coordinates?Array.isArray(h.coordinates)&&h.coordinates.length===4&&!h.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(E=>typeof E!="number"))||this.fire(new u.j(new u.a1(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.j(new u.a1(`sources.${o}`,null,'missing required property "coordinates"'))),h.animate&&typeof h.animate!="boolean"&&this.fire(new u.j(new u.a1(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),h.canvas?typeof h.canvas=="string"||h.canvas instanceof HTMLCanvasElement||this.fire(new u.j(new u.a1(`sources.${o}`,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.${o}`,null,'missing required property "canvas"'))),this.options=h,this.animate=h.animate===void 0||h.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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const h=this.map.painter.context,d=h.gl;this.boundsBuffer||(this.boundsBuffer=h.createVertexBuffer(this._boundsArray,$n.members)),this.boundsSegments||(this.boundsSegments=u.$.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ct(h,this.canvas,d.RGBA,{premultiply:!0});let g=!1;for(const y in this.tiles){const E=this.tiles[y];E.state!=="loaded"&&(E.state="loaded",E.texture=this.texture,g=!0)}g&&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 o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Ia={},wr=_=>{switch(_){case"geojson":return Qe;case"image":return fr;case"raster":return sn;case"raster-dem":return Bi;case"vector":return Mt;case"video":return $o;case"canvas":return ws}return Ia[_]};class Ka extends u.E{constructor(){super(...arguments),this.pluginStatus="unavailable",this.pluginURL=null,this.dispatcher=yn(),this.queue=[]}_sendPluginStateToWorker(){return u._(this,void 0,void 0,function*(){yield this.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}),this.fire(new u.k("pluginStateChange",{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}))})}getRTLTextPluginStatus(){return this.pluginStatus}clearRTLTextPlugin(){this.pluginStatus="unavailable",this.pluginURL=null}setRTLTextPlugin(o,h=!1){return u._(this,void 0,void 0,function*(){if(this.pluginStatus==="deferred"||this.pluginStatus==="loading"||this.pluginStatus==="loaded")throw new Error("setRTLTextPlugin cannot be called multiple times.");this.pluginURL=P.resolveURL(o),this.pluginStatus="deferred",yield this._sendPluginStateToWorker(),h||(yield this._downloadRTLTextPlugin())})}_downloadRTLTextPlugin(){return u._(this,void 0,void 0,function*(){if(this.pluginStatus!=="deferred"||!this.pluginURL)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");try{this.pluginStatus="loading",yield this._sendPluginStateToWorker(),yield u.l({url:this.pluginURL},new AbortController),this.pluginStatus="loaded"}catch{this.pluginStatus="error"}yield this._sendPluginStateToWorker()})}lazyLoadRTLTextPlugin(){return u._(this,void 0,void 0,function*(){this.pluginStatus==="deferred"&&(yield this._downloadRTLTextPlugin())})}}let ts=null;function Wt(){return ts||(ts=new Ka),ts}class No{constructor(o,h){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=u.a3(),this.uses=0,this.tileSize=h,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(o){const h=o+this.timeAdded;hy.getLayer(A)).filter(Boolean);if(L.length!==0){C.layers=L,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map(A=>L.filter(R=>R.id===A)[0]));for(const A of L)E[A.id]=C}}return E}(o.buckets,h.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const y=this.buckets[g];if(y instanceof u.a5){if(this.hasSymbolBuckets=!0,!d)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const y=this.buckets[g];if(y instanceof u.a5&&y.hasRTLText){this.hasRTLText=!0,Wt().lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const g in this.buckets){const y=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,h.style.getLayer(g).queryRadius(y))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new u.a4}unloadVectorData(){for(const o in this.buckets)this.buckets[o].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(o){return this.buckets[o.id]}upload(o){for(const d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(o)}const h=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ct(o,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ct(o,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,h,d,g,y,E,C,L,A,R){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:y,scale:E,tileSize:this.tileSize,pixelPosMatrix:R,transform:L,params:C,queryPadding:this.queryPadding*A},o,h,d):{}}querySourceFeatures(o,h){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),y=h&&h.sourceLayer?h.sourceLayer:"",E=g._geojsonTileLayer||g[y];if(!E)return;const C=u.a6(h&&h.filter),{z:L,x:A,y:R}=this.tileID.canonical,z={z:L,x:A,y:R};for(let q=0;qd)g=!1;else if(h)if(this.expirationTime{this.remove(o,y)},d)),this.data[g].push(y),this.order.push(g),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const h=this.data[o].shift();return h.timeout&&clearTimeout(h.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),h.value}getByKey(o){const h=this.data[o];return h?h[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,h){if(!this.has(o))return this;const d=o.wrapped().key,g=h===void 0?0:this.data[d].indexOf(h),y=this.data[d][g];return this.data[d].splice(g,1),y.timeout&&clearTimeout(y.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(y.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(o){const h=[];for(const d in this.data)for(const g of this.data[d])o(g.value)||h.push(g);for(const d of h)this.remove(d.value.tileID,d)}}class Ja{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,h,d){const g=String(h);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][g]=this.stateChanges[o][g]||{},u.e(this.stateChanges[o][g],d),this.deletedStates[o]===null){this.deletedStates[o]={};for(const y in this.state[o])y!==g&&(this.deletedStates[o][y]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][g]===null){this.deletedStates[o][g]={};for(const y in this.state[o][g])d[y]||(this.deletedStates[o][g][y]=null)}else for(const y in d)this.deletedStates[o]&&this.deletedStates[o][g]&&this.deletedStates[o][g][y]===null&&delete this.deletedStates[o][g][y]}removeFeatureState(o,h,d){if(this.deletedStates[o]===null)return;const g=String(h);if(this.deletedStates[o]=this.deletedStates[o]||{},d&&h!==void 0)this.deletedStates[o][g]!==null&&(this.deletedStates[o][g]=this.deletedStates[o][g]||{},this.deletedStates[o][g][d]=null);else if(h!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][g])for(d in this.deletedStates[o][g]={},this.stateChanges[o][g])this.deletedStates[o][g][d]=null;else this.deletedStates[o][g]=null;else this.deletedStates[o]=null}getState(o,h){const d=String(h),g=u.e({},(this.state[o]||{})[d],(this.stateChanges[o]||{})[d]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const y=this.deletedStates[o][h];if(y===null)return{};for(const E in y)delete g[E]}return g}initializeTileState(o,h){o.setFeatureState(this.state,h)}coalesceChanges(o,h){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const y={};for(const E in this.stateChanges[g])this.state[g][E]||(this.state[g][E]={}),u.e(this.state[g][E],this.stateChanges[g][E]),y[E]=this.state[g][E];d[g]=y}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const y={};if(this.deletedStates[g]===null)for(const E in this.state[g])y[E]={},this.state[g][E]={};else for(const E in this.deletedStates[g]){if(this.deletedStates[g][E]===null)this.state[g][E]={};else for(const C of Object.keys(this.deletedStates[g][E]))delete this.state[g][E][C];y[E]=this.state[g][E]}d[g]=d[g]||{},u.e(d[g],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in o)o[g].setFeatureState(d,h)}}class Ni extends u.E{constructor(o,h,d){super(),this.id=o,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,y,E,C)=>{const L=new(wr(y.type))(g,y,E,C);if(L.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${L.id}`);return L})(o,h,d,this),this._tiles={},this._cache=new Br(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ja,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}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 o in this._tiles){const h=this._tiles[o];if(h.state!=="loaded"&&h.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,h,d){return u._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,h,d)}catch(g){o.state="errored",g.status!==404?this._source.fire(new u.j(g,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new u.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const d=this._tiles[h];d.upload(o),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(Jt).map(o=>o.key)}getRenderableIds(o){const h=[];for(const d in this._tiles)this._isIdRenderable(d,o)&&h.push(this._tiles[d]);return o?h.sort((d,g)=>{const y=d.tileID,E=g.tileID,C=new u.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),L=new u.P(E.canonical.x,E.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-E.overscaledZ||L.y-C.y||L.x-C.x}).map(d=>d.tileID.key):h.map(d=>d.tileID).sort(Jt).map(d=>d.key)}hasRenderableParent(o){const h=this.findLoadedParent(o,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(o,h){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(h||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,h){return u._(this,void 0,void 0,function*(){const d=this._tiles[o];d&&(d.state!=="loading"&&(d.state=h),yield this._loadTile(d,o,h))})}_tileLoaded(o,h,d){o.timeAdded=P.now(),d==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(h,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new u.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const h=this.getRenderableIds();for(let g=0;g1||(Math.abs(E)>1&&(Math.abs(E+L)===1?E+=L:Math.abs(E-L)===1&&(E-=L)),y.dem&&g.dem&&(g.dem.backfillBorder(y.dem,E,C),g.neighboringTiles&&g.neighboringTiles[A]&&(g.neighboringTiles[A].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,h,d,g){for(const y in this._tiles){let E=this._tiles[y];if(g[y]||!E.hasData()||E.tileID.overscaledZ<=h||E.tileID.overscaledZ>d)continue;let C=E.tileID;for(;E&&E.tileID.overscaledZ>h+1;){const A=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[A.key],E&&E.hasData()&&(C=A)}let L=C;for(;L.overscaledZ>h;)if(L=L.scaledTo(L.overscaledZ-1),o[L.key]){g[C.key]=C;break}}}findLoadedParent(o,h){if(o.key in this._loadedParentTiles){const d=this._loadedParentTiles[o.key];return d&&d.tileID.overscaledZ>=h?d:null}for(let d=o.overscaledZ-1;d>=h;d--){const g=o.scaledTo(d),y=this._getLoadedTile(g);if(y)return y}}_getLoadedTile(o){const h=this._tiles[o.key];return h&&h.hasData()?h:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const h=Math.ceil(o.width/this._source.tileSize)+1,d=Math.ceil(o.height/this._source.tileSize)+1,g=Math.floor(h*d*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(y)}handleWrapJump(o){const h=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,h){const d={};for(const g in this._tiles){const y=this._tiles[g];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+h),d[y.tileID.key]=y}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(o,h){if(this.transform=o,this.terrain=h,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new u.Q(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y)):(d=o.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:h}),this._source.hasTile&&(d=d.filter(R=>this._source.hasTile(R)))):d=[];const g=o.coveringZoomLevel(this._source),y=Math.max(g-Ni.maxOverzooming,this._source.minzoom),E=Math.max(g+Ni.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const R={};for(const z of d)if(z.canonical.z>this._source.minzoom){const q=z.scaledTo(z.canonical.z-1);R[q.key]=q;const et=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));R[et.key]=et}d=d.concat(Object.values(R))}const C=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,C&&this.fire(new u.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const L=this._updateRetainedTiles(d,g);if(He(this._source.type)){const R={},z={},q=Object.keys(L),et=P.now();for(const Q of q){const nt=L[Q],K=this._tiles[Q];if(!K||K.fadeEndTime!==0&&K.fadeEndTime<=et)continue;const pt=this.findLoadedParent(nt,y);pt&&(this._addTile(pt.tileID),R[pt.tileID.key]=pt.tileID),z[Q]=nt}this._retainLoadedChildren(z,g,E,L);for(const Q in R)L[Q]||(this._coveredTiles[Q]=!0,L[Q]=R[Q]);if(h){const Q={},nt={};for(const K of d)this._tiles[K.key].hasData()?Q[K.key]=K:nt[K.key]=K;for(const K in nt){const pt=nt[K].children(this._source.maxzoom);this._tiles[pt[0].key]&&this._tiles[pt[1].key]&&this._tiles[pt[2].key]&&this._tiles[pt[3].key]&&(Q[pt[0].key]=L[pt[0].key]=pt[0],Q[pt[1].key]=L[pt[1].key]=pt[1],Q[pt[2].key]=L[pt[2].key]=pt[2],Q[pt[3].key]=L[pt[3].key]=pt[3],delete nt[K])}for(const K in nt){const pt=this.findLoadedParent(nt[K],this._source.minzoom);if(pt){Q[pt.tileID.key]=L[pt.tileID.key]=pt.tileID;for(const Et in Q)Q[Et].isChildOf(pt.tileID)&&delete Q[Et]}}for(const K in this._tiles)Q[K]||(this._coveredTiles[K]=!0)}}for(const R in L)this._tiles[R].clearFadeHold();const A=u.ab(this._tiles,L);for(const R of A){const z=this._tiles[R];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(R)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,h){const d={},g={},y=Math.max(h-Ni.maxOverzooming,this._source.minzoom),E=Math.max(h+Ni.maxUnderzooming,this._source.minzoom),C={};for(const L of o){const A=this._addTile(L);d[L.key]=L,A.hasData()||hthis._source.maxzoom){const z=L.children(this._source.maxzoom)[0],q=this.getTile(z);if(q&&q.hasData()){d[z.key]=z;continue}}else{const z=L.children(this._source.maxzoom);if(d[z[0].key]&&d[z[1].key]&&d[z[2].key]&&d[z[3].key])continue}let R=A.wasRequested();for(let z=L.overscaledZ-1;z>=y;--z){const q=L.scaledTo(z);if(g[q.key])break;if(g[q.key]=!0,A=this.getTile(q),!A&&R&&(A=this._addTile(q)),A){const et=A.hasData();if((R||et)&&(d[q.key]=q),R=A.wasRequested(),et)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const h=[];let d,g=this._tiles[o].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}h.push(g.key);const y=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(y),d)break;g=y}for(const y of h)this._loadedParentTiles[y]=d}}_addTile(o){let h=this._tiles[o.key];if(h)return h;h=this._cache.getAndRemove(o),h&&(this._setTileReloadTimer(o.key,h),h.tileID=o,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,h)));const d=h;return h||(h=new No(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(h,o.key,h.state)),h.uses++,this._tiles[o.key]=h,d||this._source.fire(new u.k("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(o,h){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const d=h.getExpiryTimeout();d&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},d))}_removeTile(o){const h=this._tiles[o];h&&(h.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),h.uses>0||(h.hasData()&&h.state!=="reloading"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,h,d){const g=[],y=this.transform;if(!y)return g;const E=d?y.getCameraQueryGeometry(o):o,C=o.map(Q=>y.pointCoordinate(Q,this.terrain)),L=E.map(Q=>y.pointCoordinate(Q,this.terrain)),A=this.getIds();let R=1/0,z=1/0,q=-1/0,et=-1/0;for(const Q of L)R=Math.min(R,Q.x),z=Math.min(z,Q.y),q=Math.max(q,Q.x),et=Math.max(et,Q.y);for(let Q=0;Q=0&&st[1].y+Et>=0){const yt=C.map(Pt=>K.getTilePoint(Pt)),kt=L.map(Pt=>K.getTilePoint(Pt));g.push({tile:nt,tileID:K,queryGeometry:yt,cameraQueryGeometry:kt,scale:pt})}}return g}getVisibleCoordinates(o){const h=this.getRenderableIds(o).map(d=>this._tiles[d].tileID);for(const d of h)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return h}hasTransition(){if(this._source.hasTransition())return!0;if(He(this._source.type)){const o=P.now();for(const h in this._tiles)if(this._tiles[h].fadeEndTime>=o)return!0}return!1}setFeatureState(o,h,d){this._state.updateState(o=o||"_geojsonTileLayer",h,d)}removeFeatureState(o,h,d){this._state.removeFeatureState(o=o||"_geojsonTileLayer",h,d)}getFeatureState(o,h){return this._state.getState(o=o||"_geojsonTileLayer",h)}setDependencies(o,h,d){const g=this._tiles[o];g&&g.setDependencies(h,d)}reloadTilesForDependencies(o,h){for(const d in this._tiles)this._tiles[d].hasDependency(o,h)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(o,h))}}function Jt(_,o){const h=Math.abs(2*_.wrap)-+(_.wrap<0),d=Math.abs(2*o.wrap)-+(o.wrap<0);return _.overscaledZ-o.overscaledZ||d-h||o.canonical.y-_.canonical.y||o.canonical.x-_.canonical.x}function He(_){return _==="raster"||_==="image"||_==="video"}Ni.maxOverzooming=10,Ni.maxUnderzooming=3;class je{constructor(o,h){this.reset(o,h)}reset(o,h){this.points=o||[],this._distances=[0];for(let d=1;d0?(g-E)/C:0;return this.points[y].mult(1-L).add(this.points[h].mult(L))}}function yi(_,o){let h=!0;return _==="always"||_!=="never"&&o!=="never"||(h=!1),h}class zo{constructor(o,h,d){const g=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(o/d),this.yCellCount=Math.ceil(h/d);for(let E=0;Ethis.width||g<0||h>this.height)return[];const L=[];if(o<=0&&h<=0&&this.width<=d&&this.height<=g){if(y)return[{key:null,x1:o,y1:h,x2:d,y2:g}];for(let A=0;A0}hitTestCircle(o,h,d,g,y){const E=o-d,C=o+d,L=h-d,A=h+d;if(C<0||E>this.width||A<0||L>this.height)return!1;const R=[];return this._forEachCell(E,L,C,A,this._queryCellCircle,R,{hitTest:!0,overlapMode:g,circle:{x:o,y:h,radius:d},seenUids:{box:{},circle:{}}},y),R.length>0}_queryCell(o,h,d,g,y,E,C,L){const{seenUids:A,hitTest:R,overlapMode:z}=C,q=this.boxCells[y];if(q!==null){const Q=this.bboxes;for(const nt of q)if(!A.box[nt]){A.box[nt]=!0;const K=4*nt,pt=this.boxKeys[nt];if(o<=Q[K+2]&&h<=Q[K+3]&&d>=Q[K+0]&&g>=Q[K+1]&&(!L||L(pt))&&(!R||!yi(z,pt.overlapMode))&&(E.push({key:pt,x1:Q[K],y1:Q[K+1],x2:Q[K+2],y2:Q[K+3]}),R))return!0}}const et=this.circleCells[y];if(et!==null){const Q=this.circles;for(const nt of et)if(!A.circle[nt]){A.circle[nt]=!0;const K=3*nt,pt=this.circleKeys[nt];if(this._circleAndRectCollide(Q[K],Q[K+1],Q[K+2],o,h,d,g)&&(!L||L(pt))&&(!R||!yi(z,pt.overlapMode))){const Et=Q[K],st=Q[K+1],yt=Q[K+2];if(E.push({key:pt,x1:Et-yt,y1:st-yt,x2:Et+yt,y2:st+yt}),R)return!0}}}return!1}_queryCellCircle(o,h,d,g,y,E,C,L){const{circle:A,seenUids:R,overlapMode:z}=C,q=this.boxCells[y];if(q!==null){const Q=this.bboxes;for(const nt of q)if(!R.box[nt]){R.box[nt]=!0;const K=4*nt,pt=this.boxKeys[nt];if(this._circleAndRectCollide(A.x,A.y,A.radius,Q[K+0],Q[K+1],Q[K+2],Q[K+3])&&(!L||L(pt))&&!yi(z,pt.overlapMode))return E.push(!0),!0}}const et=this.circleCells[y];if(et!==null){const Q=this.circles;for(const nt of et)if(!R.circle[nt]){R.circle[nt]=!0;const K=3*nt,pt=this.circleKeys[nt];if(this._circlesCollide(Q[K],Q[K+1],Q[K+2],A.x,A.y,A.radius)&&(!L||L(pt))&&!yi(z,pt.overlapMode))return E.push(!0),!0}}}_forEachCell(o,h,d,g,y,E,C,L){const A=this._convertToXCellCoord(o),R=this._convertToYCellCoord(h),z=this._convertToXCellCoord(d),q=this._convertToYCellCoord(g);for(let et=A;et<=z;et++)for(let Q=R;Q<=q;Q++)if(y.call(this,o,h,d,g,this.xCellCount*Q+et,E,C,L))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,h,d,g,y,E){const C=g-o,L=y-h,A=d+E;return A*A>C*C+L*L}_circleAndRectCollide(o,h,d,g,y,E,C){const L=(E-g)/2,A=Math.abs(o-(g+L));if(A>L+d)return!1;const R=(C-y)/2,z=Math.abs(h-(y+R));if(z>R+d)return!1;if(A<=L||z<=R)return!0;const q=A-L,et=z-R;return q*q+et*et<=d*d}}function Ge(_,o,h,d,g){const y=u.F();return o?(u.J(y,y,[1/g,1/g,1]),h||u.ad(y,y,d.angle)):u.K(y,d.labelPlaneMatrix,_),y}function ea(_,o,h,d,g){if(o){const y=u.ae(_);return u.J(y,y,[g,g,1]),h||u.ad(y,y,-d.angle),y}return d.glCoordMatrix}function Ii(_,o,h){let d;h?(d=[_.x,_.y,h(_.x,_.y),1],u.af(d,d,o)):(d=[_.x,_.y,0,1],xe(d,d,o));const g=d[3];return{point:new u.P(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function rt(_,o){return .5+_/o*.5}function O(_,o){const h=_[0]/_[3],d=_[1]/_[3];return h>=-o[0]&&h<=o[0]&&d>=-o[1]&&d<=o[1]}function U(_,o,h,d,g,y,E,C,L,A){const R=d?_.textSizeData:_.iconSizeData,z=u.ag(R,h.transform.zoom),q=[256/h.width*2+1,256/h.height*2+1],et=d?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;et.clear();const Q=_.lineVertexArray,nt=d?_.text.placedSymbolArray:_.icon.placedSymbolArray,K=h.transform.width/h.transform.height;let pt=!1;for(let Et=0;EtMath.abs(h.x-o.x)*d?{useVertical:!0}:(_===u.ah.vertical?o.yh.x)?{needsFlipping:!0}:null}function ft(_,o,h,d,g,y,E,C,L,A,R,z,q,et,Q,nt){const K=o/24,pt=_.lineOffsetX*K,Et=_.lineOffsetY*K;let st;if(_.numGlyphs>1){const yt=_.glyphStartIndex+_.numGlyphs,kt=_.lineStartIndex,Pt=_.lineStartIndex+_.lineLength,Bt=Z(K,C,pt,Et,h,R,z,_,L,y,q,Q,nt);if(!Bt)return{notEnoughRoom:!0};const qt=Ii(Bt.first.point,E,nt).point,Ut=Ii(Bt.last.point,E,nt).point;if(d&&!h){const Ht=$(_.writingMode,qt,Ut,et);if(Ht)return Ht}st=[Bt.first];for(let Ht=_.glyphStartIndex+1;Ht0?qt.point:H(z,Bt,kt,1,g,nt),Ht=$(_.writingMode,kt,Ut,et);if(Ht)return Ht}const yt=At(K*C.getoffsetX(_.glyphStartIndex),pt,Et,h,R,z,_.segment,_.lineStartIndex,_.lineStartIndex+_.lineLength,L,y,q,Q,nt);if(!yt)return{notEnoughRoom:!0};st=[yt]}for(const yt of st)u.aj(A,yt.point,yt.angle);return{}}function H(_,o,h,d,g,y){const E=Ii(_.add(_.sub(o)._unit()),g,y).point,C=h.sub(E);return h.add(C._mult(d/C.mag()))}function dt(_,o){const{projectionCache:h,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:y,distanceFromAnchor:E,getElevation:C,previousVertex:L,direction:A,absOffsetX:R}=o;if(h.projections[_])return h.projections[_];const z=new u.P(d.getx(_),d.gety(_)),q=Ii(z,g,C);if(q.signedDistanceFromCamera>0)return h.projections[_]=q.point,q.point;const et=_-A;return H(E===0?y:new u.P(d.getx(et),d.gety(et)),z,L,R-E+1,g,C)}function lt(_,o,h){return _._unit()._perp()._mult(o*h)}function xt(_,o,h,d,g,y,E,C){const{projectionCache:L,direction:A}=C;if(L.offsets[_])return L.offsets[_];const R=h.add(o);if(_+A=g)return L.offsets[_]=R,R;const z=dt(_+A,C),q=lt(z.sub(h),E,A),et=h.add(q),Q=z.add(q);return L.offsets[_]=u.ak(y,R,et,Q)||R,L.offsets[_]}function At(_,o,h,d,g,y,E,C,L,A,R,z,q,et){const Q=d?_-o:_+o;let nt=Q>0?1:-1,K=0;d&&(nt*=-1,K=Math.PI),nt<0&&(K+=Math.PI);let pt,Et,st=nt>0?C+E:C+E+1,yt=g,kt=g,Pt=0,Bt=0;const qt=Math.abs(Q),Ut=[];let Ht;for(;Pt+Bt<=qt;){if(st+=nt,st=L)return null;Pt+=Bt,kt=yt,Et=pt;const re={projectionCache:z,lineVertexArray:A,labelPlaneMatrix:R,tileAnchorPoint:y,distanceFromAnchor:Pt,getElevation:et,previousVertex:kt,direction:nt,absOffsetX:qt};if(yt=dt(st,re),h===0)Ut.push(kt),Ht=yt.sub(kt);else{let Pe;const ye=yt.sub(kt);Pe=ye.mag()===0?lt(dt(st+nt,re).sub(yt),h,nt):lt(ye,h,nt),Et||(Et=kt.add(Pe)),pt=xt(st,Pe,yt,C,L,Et,h,re),Ut.push(Et),Ht=pt.sub(Et)}Bt=Ht.mag()}const me=Ht._mult((qt-Pt)/Bt)._add(Et||kt),Ae=K+Math.atan2(yt.y-kt.y,yt.x-kt.x);return Ut.push(me),{point:me,angle:q?Ae:0,path:Ut}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Nt(_,o){for(let h=0;h<_;h++){const d=o.length;o.resize(d+4),o.float32.set(Rt,3*d)}}function xe(_,o,h){const d=o[0],g=o[1];return _[0]=h[0]*d+h[4]*g+h[12],_[1]=h[1]*d+h[5]*g+h[13],_[3]=h[3]*d+h[7]*g+h[15],_}const Ee=100;class ze{constructor(o,h=new zo(o.width+200,o.height+200,25),d=new zo(o.width+200,o.height+200,25)){this.transform=o,this.grid=h,this.ignoredGrid=d,this.pitchfactor=Math.cos(o._pitch)*o.cameraToCenterDistance,this.screenRightBoundary=o.width+Ee,this.screenBottomBoundary=o.height+Ee,this.gridRightBoundary=o.width+200,this.gridBottomBoundary=o.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(o,h,d,g,y,E){const C=this.projectAndGetPerspectiveRatio(g,o.anchorPointX,o.anchorPointY,E),L=d*C.perspectiveRatio,A=o.x1*L+C.point.x,R=o.y1*L+C.point.y,z=o.x2*L+C.point.x,q=o.y2*L+C.point.y;return!this.isInsideGrid(A,R,z,q)||h!=="always"&&this.grid.hitTest(A,R,z,q,h,y)||C.perspectiveRatio=1;Je--)ye.push(re.path[Je]);for(let Je=1;JeIi(ln,L,Q));ye=Je.some(ln=>ln.signedDistanceFromCamera<=0)?[]:Je.map(ln=>ln.point)}let an=[];if(ye.length>0){const Je=ye[0].clone(),ln=ye[0].clone();for(let Ci=1;Ci=Ht.x&&ln.x<=me.x&&Je.y>=Ht.y&&ln.y<=me.y?[ye]:ln.xme.x||ln.yme.y?[]:u.al([ye],Ht.x,Ht.y,me.x,me.y)}for(const Je of an){Ae.reset(Je,.25*Ut);let ln=0;ln=Ae.length<=.5*Ut?1:Math.ceil(Ae.paddedLength/Yn)+1;for(let Ci=0;Ci=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(o,h,d,g){return d>=0&&o=0&&hd.collisionGroupID===h}}return this.collisionGroups[o]}}function Vi(_,o,h,d,g){const{horizontalAlign:y,verticalAlign:E}=u.at(_);return new u.P(-(y-.5)*o+d[0]*g,-(E-.5)*h+d[1]*g)}function Vr(_,o,h,d,g,y){const{x1:E,x2:C,y1:L,y2:A,anchorPointX:R,anchorPointY:z}=_,q=new u.P(o,h);return d&&q._rotate(g?y:-y),{x1:E+q.x,y1:L+q.y,x2:C+q.x,y2:A+q.y,anchorPointX:R,anchorPointY:z}}class no{constructor(o,h,d,g,y){this.transform=o.clone(),this.terrain=h,this.collisionIndex=new ze(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new ui(g),this.collisionCircleArrays={},this.prevPlacement=y,y&&(y.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(o,h,d,g){const y=d.getBucket(h),E=d.latestFeatureIndex;if(!y||!E||h.id!==y.layerIds[0])return;const C=d.collisionBoxArray,L=y.layers[0].layout,A=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),R=d.tileSize/u.W,z=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),q=L.get("text-pitch-alignment")==="map",et=L.get("text-rotation-alignment")==="map",Q=Be(d,1,this.transform.zoom),nt=Ge(z,q,et,this.transform,Q);let K=null;if(q){const Et=ea(z,q,et,this.transform,Q);K=u.K([],this.transform.labelPlaneMatrix,Et)}this.retainedQueryData[y.bucketInstanceId]=new Ke(y.bucketInstanceId,E,y.sourceLayerIndex,y.index,d.tileID);const pt={bucket:y,layout:L,posMatrix:z,textLabelPlaneMatrix:nt,labelToScreenMatrix:K,scale:A,textPixelRatio:R,holdingForFade:d.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:u.ag(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(g)for(const Et of y.sortKeyRanges){const{sortKey:st,symbolInstanceStart:yt,symbolInstanceEnd:kt}=Et;o.push({sortKey:st,symbolInstanceStart:yt,symbolInstanceEnd:kt,parameters:pt})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:pt})}attemptAnchorPlacement(o,h,d,g,y,E,C,L,A,R,z,q,et,Q,nt,K){const pt=u.ap[o.textAnchor],Et=[o.textOffset0,o.textOffset1],st=Vi(pt,d,g,Et,y),yt=this.collisionIndex.placeCollisionBox(Vr(h,st.x,st.y,E,C,this.transform.angle),z,L,A,R.predicate,K);if((!nt||this.collisionIndex.placeCollisionBox(Vr(nt,st.x,st.y,E,C,this.transform.angle),z,L,A,R.predicate,K).box.length!==0)&&yt.box.length>0){let kt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID].text&&(kt=this.prevPlacement.variableOffsets[q.crossTileID].anchor),q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[q.crossTileID]={textOffset:Et,width:d,height:g,anchor:pt,textBoxScale:y,prevAnchor:kt},this.markUsedJustification(et,pt,q,Q),et.allowVerticalPlacement&&(this.markUsedOrientation(et,Q,q),this.placedOrientations[q.crossTileID]=Q),{shift:st,placedGlyphBoxes:yt}}}placeLayerBucketPart(o,h,d){const{bucket:g,layout:y,posMatrix:E,textLabelPlaneMatrix:C,labelToScreenMatrix:L,textPixelRatio:A,holdingForFade:R,collisionBoxArray:z,partiallyEvaluatedTextSize:q,collisionGroup:et}=o.parameters,Q=y.get("text-optional"),nt=y.get("icon-optional"),K=u.aq(y,"text-overlap","text-allow-overlap"),pt=K==="always",Et=u.aq(y,"icon-overlap","icon-allow-overlap"),st=Et==="always",yt=y.get("text-rotation-alignment")==="map",kt=y.get("text-pitch-alignment")==="map",Pt=y.get("icon-text-fit")!=="none",Bt=y.get("symbol-z-order")==="viewport-y",qt=pt&&(st||!g.hasIconData()||nt),Ut=st&&(pt||!g.hasTextData()||Q);!g.collisionArrays&&z&&g.deserializeCollisionBoxes(z);const Ht=this.retainedQueryData[g.bucketInstanceId].tileID,me=this.terrain?(re,Pe)=>this.terrain.getElevation(Ht,re,Pe):null,Ae=(re,Pe)=>{var ye,Yn;if(h[re.crossTileID])return;if(R)return void(this.placements[re.crossTileID]=new ti(!1,!1,!1));let an=!1,Je=!1,ln=!0,Ci=null,Nn={box:null,offscreen:null},jr={box:null,offscreen:null},ir=null,pi=null,Er=null,Sr=0,Vo=0,Pa=0;Pe.textFeatureIndex?Sr=Pe.textFeatureIndex:re.useRuntimeCollisionCircles&&(Sr=re.featureIndex),Pe.verticalTextFeatureIndex&&(Vo=Pe.verticalTextFeatureIndex);const Zl=Pe.textBox;if(Zl){const Ui=Kn=>{let Gi=u.ah.horizontal;if(g.allowVerticalPlacement&&!Kn&&this.prevPlacement){const rr=this.prevPlacement.placedOrientations[re.crossTileID];rr&&(this.placedOrientations[re.crossTileID]=rr,Gi=rr,this.markUsedOrientation(g,Gi,re))}return Gi},Ti=(Kn,Gi)=>{if(g.allowVerticalPlacement&&re.numVerticalGlyphVertices>0&&Pe.verticalTextBox){for(const rr of g.writingModes)if(rr===u.ah.vertical?(Nn=Gi(),jr=Nn):Nn=Kn(),Nn&&Nn.box&&Nn.box.length)break}else Nn=Kn()},fi=re.textAnchorOffsetStartIndex,Zr=re.textAnchorOffsetEndIndex;if(Zr===fi){const Kn=(Gi,rr)=>{const qi=this.collisionIndex.placeCollisionBox(Gi,K,A,E,et.predicate,me);return qi&&qi.box&&qi.box.length&&(this.markUsedOrientation(g,rr,re),this.placedOrientations[re.crossTileID]=rr),qi};Ti(()=>Kn(Zl,u.ah.horizontal),()=>{const Gi=Pe.verticalTextBox;return g.allowVerticalPlacement&&re.numVerticalGlyphVertices>0&&Gi?Kn(Gi,u.ah.vertical):{box:null,offscreen:null}}),Ui(Nn&&Nn.box&&Nn.box.length)}else{let Kn=u.ap[(Yn=(ye=this.prevPlacement)===null||ye===void 0?void 0:ye.variableOffsets[re.crossTileID])===null||Yn===void 0?void 0:Yn.anchor];const Gi=(qi,zd,vi)=>{const Rp=qi.x2-qi.x1,Od=qi.y2-qi.y1,ul=re.textBoxScale,cl=Pt&&Et==="never"?zd:null;let ra={box:[],offscreen:!1},Jc=K==="never"?1:2,Np="never";Kn&&Jc++;for(let Fd=0;FdGi(Zl,Pe.iconBox,u.ah.horizontal),()=>{const qi=Pe.verticalTextBox;return g.allowVerticalPlacement&&!(Nn&&Nn.box&&Nn.box.length)&&re.numVerticalGlyphVertices>0&&qi?Gi(qi,Pe.verticalIconBox,u.ah.vertical):{box:null,offscreen:null}}),Nn&&(an=Nn.box,ln=Nn.offscreen);const rr=Ui(Nn&&Nn.box);if(!an&&this.prevPlacement){const qi=this.prevPlacement.variableOffsets[re.crossTileID];qi&&(this.variableOffsets[re.crossTileID]=qi,this.markUsedJustification(g,qi.anchor,re,rr))}}}if(ir=Nn,an=ir&&ir.box&&ir.box.length>0,ln=ir&&ir.offscreen,re.useRuntimeCollisionCircles){const Ui=g.text.placedSymbolArray.get(re.centerJustifiedTextSymbolIndex),Ti=u.ai(g.textSizeData,q,Ui),fi=y.get("text-padding");pi=this.collisionIndex.placeCollisionCircles(K,Ui,g.lineVertexArray,g.glyphOffsetArray,Ti,E,C,L,d,kt,et.predicate,re.collisionCircleDiameter,fi,me),pi.circles.length&&pi.collisionDetected&&!d&&u.w("Collisions detected, but collision boxes are not shown"),an=pt||pi.circles.length>0&&!pi.collisionDetected,ln=ln&&pi.offscreen}if(Pe.iconFeatureIndex&&(Pa=Pe.iconFeatureIndex),Pe.iconBox){const Ui=Ti=>{const fi=Pt&&Ci?Vr(Ti,Ci.x,Ci.y,yt,kt,this.transform.angle):Ti;return this.collisionIndex.placeCollisionBox(fi,Et,A,E,et.predicate,me)};jr&&jr.box&&jr.box.length&&Pe.verticalIconBox?(Er=Ui(Pe.verticalIconBox),Je=Er.box.length>0):(Er=Ui(Pe.iconBox),Je=Er.box.length>0),ln=ln&&Er.offscreen}const Wl=Q||re.numHorizontalGlyphVertices===0&&re.numVerticalGlyphVertices===0,Ma=nt||re.numIconVertices===0;if(Wl||Ma?Ma?Wl||(Je=Je&&an):an=Je&&an:Je=an=Je&&an,an&&ir&&ir.box&&this.collisionIndex.insertCollisionBox(ir.box,K,y.get("text-ignore-placement"),g.bucketInstanceId,jr&&jr.box&&Vo?Vo:Sr,et.ID),Je&&Er&&this.collisionIndex.insertCollisionBox(Er.box,Et,y.get("icon-ignore-placement"),g.bucketInstanceId,Pa,et.ID),pi&&(an&&this.collisionIndex.insertCollisionCircles(pi.circles,K,y.get("text-ignore-placement"),g.bucketInstanceId,Sr,et.ID),d)){const Ui=g.bucketInstanceId;let Ti=this.collisionCircleArrays[Ui];Ti===void 0&&(Ti=this.collisionCircleArrays[Ui]=new zi);for(let fi=0;fi=0;--Pe){const ye=re[Pe];Ae(g.symbolInstances.get(ye),g.collisionArrays[ye])}}else for(let re=o.symbolInstanceStart;re=0&&(o.text.placedSymbolArray.get(C).crossTileID=y>=0&&C!==y?0:d.crossTileID)}markUsedOrientation(o,h,d){const g=h===u.ah.horizontal||h===u.ah.horizontalOnly?h:0,y=h===u.ah.vertical?h:0,E=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const C of E)o.text.placedSymbolArray.get(C).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let d=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const g=h?h.symbolFadeChange(o):1,y=h?h.opacities:{},E=h?h.variableOffsets:{},C=h?h.placedOrientations:{};for(const L in this.placements){const A=this.placements[L],R=y[L];R?(this.opacities[L]=new Rn(R,g,A.text,A.icon),d=d||A.text!==R.text.placed||A.icon!==R.icon.placed):(this.opacities[L]=new Rn(null,g,A.text,A.icon,A.skipFade),d=d||A.text||A.icon)}for(const L in y){const A=y[L];if(!this.opacities[L]){const R=new Rn(A,g,!1,!1);R.isHidden()||(this.opacities[L]=R,d=d||A.text.placed||A.icon.placed)}}for(const L in E)this.variableOffsets[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.variableOffsets[L]=E[L]);for(const L in C)this.placedOrientations[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.placedOrientations[L]=C[L]);if(h&&h.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:o)}updateLayerOpacities(o,h){const d={};for(const g of h){const y=g.getBucket(o);y&&g.latestFeatureIndex&&o.id===y.layerIds[0]&&this.updateBucketOpacities(y,d,g.collisionBoxArray)}}updateBucketOpacities(o,h,d){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const g=o.layers[0],y=g.layout,E=new Rn(null,0,!1,!1,!0),C=y.get("text-allow-overlap"),L=y.get("icon-allow-overlap"),A=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),R=y.get("text-rotation-alignment")==="map",z=y.get("text-pitch-alignment")==="map",q=y.get("icon-text-fit")!=="none",et=new Rn(null,0,C&&(L||!o.hasIconData()||y.get("icon-optional")),L&&(C||!o.hasTextData()||y.get("text-optional")),!0);!o.collisionArrays&&d&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(d);const Q=(nt,K,pt)=>{for(let Et=0;Et0,Pt=this.placedOrientations[K.crossTileID],Bt=Pt===u.ah.vertical,qt=Pt===u.ah.horizontal||Pt===u.ah.horizontalOnly;if(pt>0||Et>0){const Ut=io(yt.text);Q(o.text,pt,Bt?yu:Ut),Q(o.text,Et,qt?yu:Ut);const Ht=yt.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(re=>{re>=0&&(o.text.placedSymbolArray.get(re).hidden=Ht||Bt?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Ht||qt?1:0);const me=this.variableOffsets[K.crossTileID];me&&this.markUsedJustification(o,me.anchor,K,Pt);const Ae=this.placedOrientations[K.crossTileID];Ae&&(this.markUsedJustification(o,"left",K,Ae),this.markUsedOrientation(o,Ae,K))}if(kt){const Ut=io(yt.icon),Ht=!(q&&K.verticalPlacedIconSymbolIndex&&Bt);K.placedIconSymbolIndex>=0&&(Q(o.icon,K.numIconVertices,Ht?Ut:yu),o.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=yt.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(Q(o.icon,K.numVerticalIconVertices,Ht?yu:Ut),o.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=yt.icon.isHidden())}if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const Ut=o.collisionArrays[nt];if(Ut){let Ht=new u.P(0,0);if(Ut.textBox||Ut.verticalTextBox){let Ae=!0;if(A){const re=this.variableOffsets[st];re?(Ht=Vi(re.anchor,re.width,re.height,re.textOffset,re.textBoxScale),R&&Ht._rotate(z?this.transform.angle:-this.transform.angle)):Ae=!1}Ut.textBox&&nr(o.textCollisionBox.collisionVertexArray,yt.text.placed,!Ae||Bt,Ht.x,Ht.y),Ut.verticalTextBox&&nr(o.textCollisionBox.collisionVertexArray,yt.text.placed,!Ae||qt,Ht.x,Ht.y)}const me=!!(!qt&&Ut.verticalIconBox);Ut.iconBox&&nr(o.iconCollisionBox.collisionVertexArray,yt.icon.placed,me,q?Ht.x:0,q?Ht.y:0),Ut.verticalIconBox&&nr(o.iconCollisionBox.collisionVertexArray,yt.icon.placed,!me,q?Ht.x:0,q?Ht.y:0)}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const nt=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=nt.invProjMatrix,o.placementViewportMatrix=nt.viewportMatrix,o.collisionCircleArray=nt.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTimeo}setStale(){this.stale=!0}}function nr(_,o,h,d,g){_.emplaceBack(o?1:0,h?1:0,d||0,g||0),_.emplaceBack(o?1:0,h?1:0,d||0,g||0),_.emplaceBack(o?1:0,h?1:0,d||0,g||0),_.emplaceBack(o?1:0,h?1:0,d||0,g||0)}const Is=Math.pow(2,25),td=Math.pow(2,24),ng=Math.pow(2,17),Pn=Math.pow(2,16),Qh=Math.pow(2,9),$h=Math.pow(2,8),vo=Math.pow(2,1);function io(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const o=_.placed?1:0,h=Math.floor(127*_.opacity);return h*Is+o*td+h*ng+o*Pn+h*Qh+o*$h+h*vo+o}const yu=0;class Oo{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,h,d,g,y){const E=this._bucketParts;for(;this._currentTileIndexC.sortKey-L.sortKey));this._currentPartIndex!this._forceFullPlacement&&P.now()-g>2;for(;this._currentPlacementIndex>=0;){const E=h[o[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(E.type==="symbol"&&(!E.minzoom||E.minzoom<=C)&&(!E.maxzoom||E.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new Oo(E)),this._inProgressLayer.continuePlacement(d[E.source],this.placement,this._showCollisionBoxes,E,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Rl=512/u.W/2;class mc{constructor(o,h,d){this.tileID=o,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let y=0;y({x:Math.floor(L.anchorX*Rl),y:Math.floor(L.anchorY*Rl)})),crossTileIDs:E.map(L=>L.crossTileID)};if(C.positions.length>128){const L=new u.au(C.positions.length,16,Uint16Array);for(const{x:A,y:R}of C.positions)L.add(A,R);L.finish(),delete C.positions,C.index=L}this._symbolsByKey[y]=C}}getScaledCoordinates(o,h){const{x:d,y:g,z:y}=this.tileID.canonical,{x:E,y:C,z:L}=h.canonical,A=Rl/Math.pow(2,L-y),R=(C*u.W+o.anchorY)*A,z=g*u.W*Rl;return{x:Math.floor((E*u.W+o.anchorX)*A-d*u.W*Rl),y:Math.floor(R-z)}}findMatches(o,h,d){const g=this.tileID.canonical.zo)}}class Oi{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class vu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const h=Math.round((o-this.lng)/360);if(h!==0)for(const d in this.indexes){const g=this.indexes[d],y={};for(const E in g){const C=g[E];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+h),y[C.tileID.key]=C}this.indexes[d]=y}this.lng=o}addBucket(o,h,d){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let y=0;yo.overscaledZ)for(const C in E){const L=E[C];L.tileID.isChildOf(o)&&L.findMatches(h.symbolInstances,o,g)}else{const C=E[o.scaledTo(Number(y)).key];C&&C.findMatches(h.symbolInstances,o,g)}}for(let y=0;y{h[d]=!0});for(const d in this.layerIndexes)h[d]||delete this.layerIndexes[d]}}const oi=(_,o)=>u.t(_,o&&o.filter(h=>h.identifier!=="source.canvas")),gc=u.av();class xo extends u.E{constructor(o,h={}){super(),this._rtlTextPluginStateChange=()=>{for(const d in this.sourceCaches){const g=this.sourceCaches[d].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[d].reload()}},this.map=o,this.dispatcher=new Ue(Kt(),o._getMapId()),this.dispatcher.registerMessageHandler("getGlyphs",(d,g)=>this.getGlyphs(d,g)),this.dispatcher.registerMessageHandler("getImages",(d,g)=>this.getImages(d,g)),this.imageManager=new Tt,this.imageManager.setEventedParent(this),this.glyphManager=new Oe(o._requestManager,h.localIdeographFontFamily),this.lineAtlas=new Me(256,512),this.crossTileSymbolIndex=new Ea,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",u.ax()),Wt().on("pluginStateChange",this._rtlTextPluginStateChange),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const g=this.sourceCaches[d.sourceId];if(!g)return;const y=g.getSource();if(y&&y.vectorLayerIds)for(const E in this._layers){const C=this._layers[E];C.source===y.id&&this._validateLayer(C)}})}loadURL(o,h={},d){this.fire(new u.k("dataloading",{dataType:"style"})),h.validate=typeof h.validate!="boolean"||h.validate;const g=this.map._requestManager.transformRequest(o,J.Style);this._loadStyleRequest=new AbortController,u.h(g,this._loadStyleRequest).then(y=>{this._loadStyleRequest=null,this._load(y.data,h,d)}).catch(y=>{this._loadStyleRequest=null,y&&this.fire(new u.j(y))})}loadJSON(o,h={},d){this.fire(new u.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,P.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,h.validate=h.validate!==!1,this._load(o,h,d)}).catch(()=>{})}loadEmpty(){this.fire(new u.k("dataloading",{dataType:"style"})),this._load(gc,{validate:!1})}_load(o,h,d){var g;const y=h.transformStyle?h.transformStyle(d,o):o;if(!h.validate||!oi(this,u.x(y))){this._loaded=!0,this.stylesheet=y;for(const E in y.sources)this.addSource(E,y.sources[E],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new Re(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new u.k("data",{dataType:"style"})),this.fire(new u.k("style.load"))}}_createLayers(){const o=u.ay(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",o),this._order=o.map(h=>h.id),this._layers={},this._serializedLayers=null;for(const h of o){const d=u.az(h);d.setEventedParent(this,{layer:{id:h.id}}),this._layers[h.id]=d}}_loadSprite(o,h=!1,d=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(y,E,C,L){return u._(this,void 0,void 0,function*(){const A=mt(y),R=C>1?"@2x":"",z={},q={};for(const{id:et,url:Q}of A){const nt=E.transformRequest(E.normalizeSpriteURL(Q,R,".json"),J.SpriteJSON);z[et]=u.h(nt,L);const K=E.transformRequest(E.normalizeSpriteURL(Q,R,".png"),J.SpriteImage);q[et]=X.getImage(K,L)}return yield Promise.all([...Object.values(z),...Object.values(q)]),function(et,Q){return u._(this,void 0,void 0,function*(){const nt={};for(const K in et){nt[K]={};const pt=P.getImageCanvasContext((yield Q[K]).data),Et=(yield et[K]).data;for(const st in Et){const{width:yt,height:kt,x:Pt,y:Bt,sdf:qt,pixelRatio:Ut,stretchX:Ht,stretchY:me,content:Ae}=Et[st];nt[K][st]={data:null,pixelRatio:Ut,sdf:qt,stretchX:Ht,stretchY:me,content:Ae,spriteData:{width:yt,height:kt,x:Pt,y:Bt,context:pt}}}}return nt})}(z,q)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(y=>{if(this._spriteRequest=null,y)for(const E in y){this._spritesImagesIds[E]=[];const C=this._spritesImagesIds[E]?this._spritesImagesIds[E].filter(L=>!(L in y)):[];for(const L of C)this.imageManager.removeImage(L),this._changedImages[L]=!0;for(const L in y[E]){const A=E==="default"?L:`${E}:${L}`;this._spritesImagesIds[E].push(A),A in this.imageManager.images?this.imageManager.updateImage(A,y[E][L],!1):this.imageManager.addImage(A,y[E][L]),h&&(this._changedImages[A]=!0)}}}).catch(y=>{this._spriteRequest=null,g=y,this.fire(new u.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),h&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"})),d&&d(g)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}_validateLayer(o){const h=this.sourceCaches[o.source];if(!h)return;const d=o.sourceLayer;if(!d)return;const g=h.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new u.j(new Error(`Source layer "${d}" does not exist on source "${g.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o){const h=this._serializedAllLayers();if(!o||o.length===0)return Object.values(h);const d=[];for(const g of o)h[g]&&d.push(h[g]);return d}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const h=Object.keys(this._layers);for(const d of h){const g=this._layers[d];g.type!=="custom"&&(o[d]=g.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const h=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(g.length||y.length)&&this._updateWorkerLayers(g,y);for(const E in this._updatedSources){const C=this._updatedSources[E];if(C==="reload")this._reloadSource(E);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(E)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const E in this._updatedPaintProps)this._layers[E].updateTransitions(o);this.light.updateTransitions(o),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const y=this.sourceCaches[g];d[g]=y.used,y.used=!1}for(const g of this._order){const y=this._layers[g];y.recalculate(o,this._availableImages),!y.isHidden(o.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const g in d){const y=this.sourceCaches[g];d[g]!==y.used&&y.fire(new u.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(o),this.z=o.zoom,h&&this.fire(new u.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const h in this.sourceCaches)this.sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(o),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,h={}){var d;this._checkLoaded();const g=this.serialize();if(o=h.transformStyle?h.transformStyle(g,o):o,((d=h.validate)===null||d===void 0||d)&&oi(this,u.x(o)))return!1;(o=u.aA(o)).layers=u.ay(o.layers);const y=u.aB(g,o),E=this._getOperationsToPerform(y);if(E.unimplemented.length>0)throw new Error(`Unimplemented: ${E.unimplemented.join(", ")}.`);if(E.operations.length===0)return!1;for(const C of E.operations)C();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const h=[],d=[];for(const g of o)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":h.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":h.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":h.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":h.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":h.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":h.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":h.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":h.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":h.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":h.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":h.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":h.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":h.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":h.push(()=>{});break;default:d.push(g.command)}return{operations:h,unimplemented:d}}addImage(o,h){if(this.getImage(o))return this.fire(new u.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,h),this._afterImageUpdated(o)}updateImage(o,h){this.imageManager.updateImage(o,h)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new u.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,h,d={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(u.x.source,`sources.${o}`,h,null,d))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const g=this.sourceCaches[o]=new Ni(o,h,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:o})),g.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===o)return this.fire(new u.j(new Error(`Source "${o}" cannot be removed while layer "${d}" is using it.`)));const h=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],h.fire(new u.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),h.setEventedParent(null),h.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,h){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const d=this.sourceCaches[o].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(h),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,h,d={}){this._checkLoaded();const g=o.id;if(this.getLayer(g))return void this.fire(new u.j(new Error(`Layer "${g}" already exists on this map.`)));let y;if(o.type==="custom"){if(oi(this,u.aC(o)))return;y=u.az(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(g,o.source),o=u.aA(o),o=u.e(o,{source:g})),this._validate(u.x.layer,`layers.${g}`,o,{arrayIndex:-1},d))return;y=u.az(o),this._validateLayer(y),y.setEventedParent(this,{layer:{id:g}})}const E=h?this._order.indexOf(h):this._order.length;if(h&&E===-1)this.fire(new u.j(new Error(`Cannot add layer "${g}" before non-existing layer "${h}".`)));else{if(this._order.splice(E,0,g),this._layerOrderChanged=!0,this._layers[g]=y,this._removedLayers[g]&&y.source&&y.type!=="custom"){const C=this._removedLayers[g];delete this._removedLayers[g],C.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(o,h){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new u.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===h)return;const d=this._order.indexOf(o);this._order.splice(d,1);const g=h?this._order.indexOf(h):this._order.length;h&&g===-1?this.fire(new u.j(new Error(`Cannot move layer "${o}" before non-existing layer "${h}".`))):(this._order.splice(g,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const h=this._layers[o];if(!h)return void this.fire(new u.j(new Error(`Cannot remove non-existing layer "${o}".`)));h.setEventedParent(null);const d=this._order.indexOf(o);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=h,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],h.onRemove&&h.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,h,d){this._checkLoaded();const g=this.getLayer(o);g?g.minzoom===h&&g.maxzoom===d||(h!=null&&(g.minzoom=h),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new u.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,h,d={}){this._checkLoaded();const g=this.getLayer(o);if(g){if(!u.aD(g.filter,h))return h==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(u.x.filter,`layers.${g.id}.filter`,h,null,d)||(g.filter=u.aA(h),this._updateLayer(g)))}else this.fire(new u.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return u.aA(this.getLayer(o).filter)}setLayoutProperty(o,h,d,g={}){this._checkLoaded();const y=this.getLayer(o);y?u.aD(y.getLayoutProperty(h),d)||(y.setLayoutProperty(h,d,g),this._updateLayer(y)):this.fire(new u.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,h){const d=this.getLayer(o);if(d)return d.getLayoutProperty(h);this.fire(new u.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,h,d,g={}){this._checkLoaded();const y=this.getLayer(o);y?u.aD(y.getPaintProperty(h),d)||(y.setPaintProperty(h,d,g)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[o]=!0):this.fire(new u.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,h){return this.getLayer(o).getPaintProperty(h)}setFeatureState(o,h){this._checkLoaded();const d=o.source,g=o.sourceLayer,y=this.sourceCaches[d];if(y===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const E=y.getSource().type;E==="geojson"&&g?this.fire(new u.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):E!=="vector"||g?(o.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),y.setFeatureState(g,o.id,h)):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,h){this._checkLoaded();const d=o.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new u.j(new Error(`The source '${d}' does not exist in the map's style.`)));const y=g.getSource().type,E=y==="vector"?o.sourceLayer:void 0;y!=="vector"||E?h&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new u.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(E,o.id,h):this.fire(new u.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const h=o.source,d=o.sourceLayer,g=this.sourceCaches[h];if(g!==void 0)return g.getSource().type!=="vector"||d?(o.id===void 0&&this.fire(new u.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,o.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 '${h}' 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 o=u.aE(this.sourceCaches,y=>y.serialize()),h=this._serializeByIds(this._order),d=this.map.getTerrain()||void 0,g=this.stylesheet;return u.aF({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:o,layers:h,terrain:d},y=>y!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const h=E=>this._layers[E].type==="fill-extrusion",d={},g=[];for(let E=this._order.length-1;E>=0;E--){const C=this._order[E];if(h(C)){d[C]=E;for(const L of o){const A=L[C];if(A)for(const R of A)g.push(R)}}}g.sort((E,C)=>C.intersectionZ-E.intersectionZ);const y=[];for(let E=this._order.length-1;E>=0;E--){const C=this._order[E];if(h(C))for(let L=g.length-1;L>=0;L--){const A=g[L].feature;if(d[A.layer.id]{const qt=pt.featureSortOrder;if(qt){const Ut=qt.indexOf(Pt.featureIndex);return qt.indexOf(Bt.featureIndex)-Ut}return Bt.featureIndex-Pt.featureIndex});for(const Pt of kt)yt.push(Pt)}}for(const pt in Q)Q[pt].forEach(Et=>{const st=Et.feature,yt=A[C[pt].source].getFeatureState(st.layer["source-layer"],st.id);st.source=st.layer.source,st.layer["source-layer"]&&(st.sourceLayer=st.layer["source-layer"]),st.state=yt});return Q}(this._layers,E,this.sourceCaches,o,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(o,h){h&&h.filter&&this._validate(u.x.filter,"querySourceFeatures.filter",h.filter,null,h);const d=this.sourceCaches[o];return d?function(g,y){const E=g.getRenderableIds().map(A=>g.getTileByID(A)),C=[],L={};for(let A=0;Aq.getTileByID(et)).sort((et,Q)=>Q.tileID.overscaledZ-et.tileID.overscaledZ||(et.tileID.isLessThan(Q.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(R,L[R.source],o.center.lng);E=E||z}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(P.now(),o.zoom))&&(this.pauseablePlacement=new Fo(o,this.map.terrain,this._order,y,h,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,L),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(P.now()),C=!0),E&&this.pauseablePlacement.placement.setStale()),C||E)for(const A of this._order){const R=this._layers[A];R.type==="symbol"&&this.placement.updateLayerOpacities(R,L[R.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(P.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,h){return u._(this,void 0,void 0,function*(){const d=yield this.imageManager.getImages(h.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[h.source];return g&&g.setDependencies(h.tileID.key,h.type,h.icons),d})}getGlyphs(o,h){return u._(this,void 0,void 0,function*(){const d=yield this.glyphManager.getGlyphs(h.stacks),g=this.sourceCaches[h.source];return g&&g.setDependencies(h.tileID.key,h.type,[""]),d})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,h={}){this._checkLoaded(),o&&this._validate(u.x.glyphs,"glyphs",o,null,h)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,h,d={},g){this._checkLoaded();const y=[{id:o,url:h}],E=[...mt(this.stylesheet.sprite),...y];this._validate(u.x.sprite,"sprite",E,null,d)||(this.stylesheet.sprite=E,this._loadSprite(y,!0,g))}removeSprite(o){this._checkLoaded();const h=mt(this.stylesheet.sprite);if(h.find(d=>d.id===o)){if(this._spritesImagesIds[o])for(const d of this._spritesImagesIds[o])this.imageManager.removeImage(d),this._changedImages[d]=!0;h.splice(h.findIndex(d=>d.id===o),1),this.stylesheet.sprite=h.length>0?h:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new u.k("data",{dataType:"style"}))}else this.fire(new u.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return mt(this.stylesheet.sprite)}setSprite(o,h={},d){this._checkLoaded(),o&&this._validate(u.x.sprite,"sprite",o,null,h)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,d):(this._unloadSprite(),d&&d(null)))}}var _c=u.X([{name:"a_pos",type:"Int16",components:2}]),Es="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 xu={prelude:Mn(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -577,9 +577,9 @@ uniform ${R} ${z} u_${q}; #endif `}),staticAttributes:d,staticUniforms:E}}class yc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(o,h,d,g,y,E,C,L,A){this.context=o;let R=this.boundPaintVertexBuffers.length!==g.length;for(let z=0;!R&&z({u_depth:new u.aG(Pt,Bt.u_depth),u_terrain:new u.aG(Pt,Bt.u_terrain),u_terrain_dim:new u.aH(Pt,Bt.u_terrain_dim),u_terrain_matrix:new u.aI(Pt,Bt.u_terrain_matrix),u_terrain_unpack:new u.aJ(Pt,Bt.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Pt,Bt.u_terrain_exaggeration)}))(o,kt),this.binderUniforms=d?d.getUniforms(o,kt):[]}draw(o,h,d,g,y,E,C,L,A,R,z,q,et,Q,nt,K,pt,Et){const st=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(d),o.setStencilMode(g),o.setColorMode(y),o.setCullFace(E),L){o.activeTexture.set(st.TEXTURE2),st.bindTexture(st.TEXTURE_2D,L.depthTexture),o.activeTexture.set(st.TEXTURE3),st.bindTexture(st.TEXTURE_2D,L.texture);for(const kt in this.terrainUniforms)this.terrainUniforms[kt].set(L[kt])}for(const kt in this.fixedUniforms)this.fixedUniforms[kt].set(C[kt]);nt&&nt.setUniforms(o,this.binderUniforms,et,{zoom:Q});let yt=0;switch(h){case st.LINES:yt=2;break;case st.TRIANGLES:yt=3;break;case st.LINE_STRIP:yt=1}for(const kt of q.get()){const Pt=kt.vaos||(kt.vaos={});(Pt[A]||(Pt[A]=new yc)).bind(o,this,R,nt?nt.getPaintVertexBuffers():[],z,kt.vertexOffset,K,pt,Et),st.drawElements(h,kt.primitiveLength*yt,st.UNSIGNED_SHORT,kt.primitiveOffset*yt*2)}}}function vc(_,o,h){const d=1/Be(h,1,o.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),y=h.tileSize*Math.pow(2,o.transform.tileZoom)/g,E=y*(h.tileID.canonical.x+h.tileID.wrap*g),C=y*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[E>>16,C>>16],u_pixel_coord_lower:[65535&E,65535&C]}}const bu=(_,o,h,d)=>{const g=o.style.light,y=g.properties.get("position"),E=[y.x,y.y,y.z],C=function(){var A=new u.A(9);return u.A!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[5]=0,A[6]=0,A[7]=0),A[0]=1,A[4]=1,A[8]=1,A}();g.properties.get("anchor")==="viewport"&&function(A,R){var z=Math.sin(R),q=Math.cos(R);A[0]=q,A[1]=z,A[2]=0,A[3]=-z,A[4]=q,A[5]=0,A[6]=0,A[7]=0,A[8]=1}(C,-o.transform.angle),function(A,R,z){var q=R[0],et=R[1],Q=R[2];A[0]=q*z[0]+et*z[3]+Q*z[6],A[1]=q*z[1]+et*z[4]+Q*z[7],A[2]=q*z[2]+et*z[5]+Q*z[8]}(E,E,C);const L=g.properties.get("color");return{u_matrix:_,u_lightpos:E,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[L.r,L.g,L.b],u_vertical_gradient:+h,u_opacity:d}},ig=(_,o,h,d,g,y,E)=>u.e(bu(_,o,h,d),vc(y,o,E),{u_height_factor:-Math.pow(2,g.overscaledZ)/E.tileSize/8}),ed=_=>({u_matrix:_}),xc=(_,o,h,d)=>u.e(ed(_),vc(h,o,d)),rg=(_,o)=>({u_matrix:_,u_world:o}),nd=(_,o,h,d,g)=>u.e(xc(_,o,h,d),{u_world:g}),og=(_,o,h,d)=>{const g=_.transform;let y,E;if(d.paint.get("circle-pitch-alignment")==="map"){const C=Be(h,1,g.zoom);y=!0,E=[C,C]}else y=!1,E=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(o.posMatrix,h,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:E}},id=(_,o,h)=>{const d=Be(h,1,o.zoom),g=Math.pow(2,o.zoom-h.tileID.overscaledZ),y=h.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:o.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[o.pixelsToGLUnits[0]/(d*g),o.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:y}},rd=(_,o,h=1)=>({u_matrix:_,u_color:o,u_overlay:0,u_overlay_scale:h}),bc=_=>({u_matrix:_}),od=(_,o,h,d)=>({u_matrix:_,u_extrude_scale:Be(o,1,h),u_intensity:d});function sd(_,o){const h=Math.pow(2,o.canonical.z),d=o.canonical.y;return[new u.Y(0,d/h).toLngLat().lat,new u.Y(0,(d+1)/h).toLngLat().lat]}const wc=(_,o,h,d)=>{const g=_.transform;return{u_matrix:wu(_,o,h,d),u_ratio:1/Be(o,1,g.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},ad=(_,o,h,d,g)=>u.e(wc(_,o,h,g),{u_image:0,u_image_height:d}),$a=(_,o,h,d,g)=>{const y=_.transform,E=bo(o,y);return{u_matrix:wu(_,o,h,g),u_texsize:o.imageAtlasTexture.size,u_ratio:1/Be(o,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[E,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Ic=(_,o,h,d,g,y)=>{const E=_.lineAtlas,C=bo(o,_.transform),L=h.layout.get("line-cap")==="round",A=E.getDash(d.from,L),R=E.getDash(d.to,L),z=A.width*g.fromScale,q=R.width*g.toScale;return u.e(wc(_,o,h,y),{u_patternscale_a:[C/z,-A.height/2],u_patternscale_b:[C/q,-R.height/2],u_sdfgamma:E.width/(256*Math.min(z,q)*_.pixelRatio)/2,u_image:0,u_tex_y_a:A.y,u_tex_y_b:R.y,u_mix:g.t})};function bo(_,o){return 1/Be(_,1,o.tileZoom)}function wu(_,o,h,d){return _.translatePosMatrix(d?d.posMatrix:o.tileID.posMatrix,o,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Ec=(_,o,h,d,g)=>{return{u_matrix:_,u_tl_parent:o,u_scale_parent:h,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(E=g.paint.get("raster-saturation"),E>0?1-1/(1.001-E):-E),u_contrast_factor:(y=g.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Iu(g.paint.get("raster-hue-rotate"))};var y,E};function Iu(_){_*=Math.PI/180;const o=Math.sin(_),h=Math.cos(_);return[(2*h+1)/3,(-Math.sqrt(3)*o-h+1)/3,(Math.sqrt(3)*o-h+1)/3]}const Eu=(_,o,h,d,g,y,E,C,L,A)=>{const R=g.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:R.width/R.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:E,u_coord_matrix:C,u_is_text:+L,u_pitch_with_map:+d,u_texsize:A,u_texture:0}},Su=(_,o,h,d,g,y,E,C,L,A,R)=>{const z=g.transform;return u.e(Eu(_,o,h,d,g,y,E,C,L,A),{u_gamma_scale:d?Math.cos(z._pitch)*z.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+R})},Cu=(_,o,h,d,g,y,E,C,L,A)=>u.e(Su(_,o,h,d,g,y,E,C,!0,L,!0),{u_texsize_icon:A,u_texture_icon:1}),sg=(_,o,h)=>({u_matrix:_,u_opacity:o,u_color:h}),ag=(_,o,h,d,g,y)=>u.e(function(E,C,L,A){const R=L.imageManager.getPattern(E.from.toString()),z=L.imageManager.getPattern(E.to.toString()),{width:q,height:et}=L.imageManager.getPixelSize(),Q=Math.pow(2,A.tileID.overscaledZ),nt=A.tileSize*Math.pow(2,L.transform.tileZoom)/Q,K=nt*(A.tileID.canonical.x+A.tileID.wrap*Q),pt=nt*A.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:R.tl,u_pattern_br_a:R.br,u_pattern_tl_b:z.tl,u_pattern_br_b:z.br,u_texsize:[q,et],u_mix:C.t,u_pattern_size_a:R.displaySize,u_pattern_size_b:z.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/Be(A,1,L.transform.tileZoom),u_pixel_coord_upper:[K>>16,pt>>16],u_pixel_coord_lower:[65535&K,65535&pt]}}(d,y,h,g),{u_matrix:_,u_opacity:o}),ld={fillExtrusion:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_lightpos:new u.aK(_,o.u_lightpos),u_lightintensity:new u.aH(_,o.u_lightintensity),u_lightcolor:new u.aK(_,o.u_lightcolor),u_vertical_gradient:new u.aH(_,o.u_vertical_gradient),u_opacity:new u.aH(_,o.u_opacity)}),fillExtrusionPattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_lightpos:new u.aK(_,o.u_lightpos),u_lightintensity:new u.aH(_,o.u_lightintensity),u_lightcolor:new u.aK(_,o.u_lightcolor),u_vertical_gradient:new u.aH(_,o.u_vertical_gradient),u_height_factor:new u.aH(_,o.u_height_factor),u_image:new u.aG(_,o.u_image),u_texsize:new u.aL(_,o.u_texsize),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade),u_opacity:new u.aH(_,o.u_opacity)}),fill:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix)}),fillPattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_image:new u.aG(_,o.u_image),u_texsize:new u.aL(_,o.u_texsize),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade)}),fillOutline:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_world:new u.aL(_,o.u_world)}),fillOutlinePattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_world:new u.aL(_,o.u_world),u_image:new u.aG(_,o.u_image),u_texsize:new u.aL(_,o.u_texsize),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade)}),circle:(_,o)=>({u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,o.u_scale_with_map),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_extrude_scale:new u.aL(_,o.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_matrix:new u.aI(_,o.u_matrix)}),collisionBox:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,o.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,o.u_extrude_scale),u_overscale_factor:new u.aH(_,o.u_overscale_factor)}),collisionCircle:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_inv_matrix:new u.aI(_,o.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_viewport_size:new u.aL(_,o.u_viewport_size)}),debug:(_,o)=>({u_color:new u.aM(_,o.u_color),u_matrix:new u.aI(_,o.u_matrix),u_overlay:new u.aG(_,o.u_overlay),u_overlay_scale:new u.aH(_,o.u_overlay_scale)}),clippingMask:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix)}),heatmap:(_,o)=>({u_extrude_scale:new u.aH(_,o.u_extrude_scale),u_intensity:new u.aH(_,o.u_intensity),u_matrix:new u.aI(_,o.u_matrix)}),heatmapTexture:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_world:new u.aL(_,o.u_world),u_image:new u.aG(_,o.u_image),u_color_ramp:new u.aG(_,o.u_color_ramp),u_opacity:new u.aH(_,o.u_opacity)}),hillshade:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_image:new u.aG(_,o.u_image),u_latrange:new u.aL(_,o.u_latrange),u_light:new u.aL(_,o.u_light),u_shadow:new u.aM(_,o.u_shadow),u_highlight:new u.aM(_,o.u_highlight),u_accent:new u.aM(_,o.u_accent)}),hillshadePrepare:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_image:new u.aG(_,o.u_image),u_dimension:new u.aL(_,o.u_dimension),u_zoom:new u.aH(_,o.u_zoom),u_unpack:new u.aJ(_,o.u_unpack)}),line:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels)}),lineGradient:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels),u_image:new u.aG(_,o.u_image),u_image_height:new u.aH(_,o.u_image_height)}),linePattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_texsize:new u.aL(_,o.u_texsize),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_image:new u.aG(_,o.u_image),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade)}),lineSDF:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels),u_patternscale_a:new u.aL(_,o.u_patternscale_a),u_patternscale_b:new u.aL(_,o.u_patternscale_b),u_sdfgamma:new u.aH(_,o.u_sdfgamma),u_image:new u.aG(_,o.u_image),u_tex_y_a:new u.aH(_,o.u_tex_y_a),u_tex_y_b:new u.aH(_,o.u_tex_y_b),u_mix:new u.aH(_,o.u_mix)}),raster:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_tl_parent:new u.aL(_,o.u_tl_parent),u_scale_parent:new u.aH(_,o.u_scale_parent),u_buffer_scale:new u.aH(_,o.u_buffer_scale),u_fade_t:new u.aH(_,o.u_fade_t),u_opacity:new u.aH(_,o.u_opacity),u_image0:new u.aG(_,o.u_image0),u_image1:new u.aG(_,o.u_image1),u_brightness_low:new u.aH(_,o.u_brightness_low),u_brightness_high:new u.aH(_,o.u_brightness_high),u_saturation_factor:new u.aH(_,o.u_saturation_factor),u_contrast_factor:new u.aH(_,o.u_contrast_factor),u_spin_weights:new u.aK(_,o.u_spin_weights)}),symbolIcon:(_,o)=>({u_is_size_zoom_constant:new u.aG(_,o.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,o.u_is_size_feature_constant),u_size_t:new u.aH(_,o.u_size_t),u_size:new u.aH(_,o.u_size),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pitch:new u.aH(_,o.u_pitch),u_rotate_symbol:new u.aG(_,o.u_rotate_symbol),u_aspect_ratio:new u.aH(_,o.u_aspect_ratio),u_fade_change:new u.aH(_,o.u_fade_change),u_matrix:new u.aI(_,o.u_matrix),u_label_plane_matrix:new u.aI(_,o.u_label_plane_matrix),u_coord_matrix:new u.aI(_,o.u_coord_matrix),u_is_text:new u.aG(_,o.u_is_text),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_texsize:new u.aL(_,o.u_texsize),u_texture:new u.aG(_,o.u_texture)}),symbolSDF:(_,o)=>({u_is_size_zoom_constant:new u.aG(_,o.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,o.u_is_size_feature_constant),u_size_t:new u.aH(_,o.u_size_t),u_size:new u.aH(_,o.u_size),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pitch:new u.aH(_,o.u_pitch),u_rotate_symbol:new u.aG(_,o.u_rotate_symbol),u_aspect_ratio:new u.aH(_,o.u_aspect_ratio),u_fade_change:new u.aH(_,o.u_fade_change),u_matrix:new u.aI(_,o.u_matrix),u_label_plane_matrix:new u.aI(_,o.u_label_plane_matrix),u_coord_matrix:new u.aI(_,o.u_coord_matrix),u_is_text:new u.aG(_,o.u_is_text),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_texsize:new u.aL(_,o.u_texsize),u_texture:new u.aG(_,o.u_texture),u_gamma_scale:new u.aH(_,o.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_is_halo:new u.aG(_,o.u_is_halo)}),symbolTextAndIcon:(_,o)=>({u_is_size_zoom_constant:new u.aG(_,o.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,o.u_is_size_feature_constant),u_size_t:new u.aH(_,o.u_size_t),u_size:new u.aH(_,o.u_size),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pitch:new u.aH(_,o.u_pitch),u_rotate_symbol:new u.aG(_,o.u_rotate_symbol),u_aspect_ratio:new u.aH(_,o.u_aspect_ratio),u_fade_change:new u.aH(_,o.u_fade_change),u_matrix:new u.aI(_,o.u_matrix),u_label_plane_matrix:new u.aI(_,o.u_label_plane_matrix),u_coord_matrix:new u.aI(_,o.u_coord_matrix),u_is_text:new u.aG(_,o.u_is_text),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_texsize:new u.aL(_,o.u_texsize),u_texsize_icon:new u.aL(_,o.u_texsize_icon),u_texture:new u.aG(_,o.u_texture),u_texture_icon:new u.aG(_,o.u_texture_icon),u_gamma_scale:new u.aH(_,o.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_is_halo:new u.aG(_,o.u_is_halo)}),background:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_opacity:new u.aH(_,o.u_opacity),u_color:new u.aM(_,o.u_color)}),backgroundPattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_opacity:new u.aH(_,o.u_opacity),u_image:new u.aG(_,o.u_image),u_pattern_tl_a:new u.aL(_,o.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,o.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,o.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,o.u_pattern_br_b),u_texsize:new u.aL(_,o.u_texsize),u_mix:new u.aH(_,o.u_mix),u_pattern_size_a:new u.aL(_,o.u_pattern_size_a),u_pattern_size_b:new u.aL(_,o.u_pattern_size_b),u_scale_a:new u.aH(_,o.u_scale_a),u_scale_b:new u.aH(_,o.u_scale_b),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,o.u_tile_units_to_pixels)}),terrain:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_texture:new u.aG(_,o.u_texture),u_ele_delta:new u.aH(_,o.u_ele_delta)}),terrainDepth:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ele_delta:new u.aH(_,o.u_ele_delta)}),terrainCoords:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_texture:new u.aG(_,o.u_texture),u_terrain_coords_id:new u.aH(_,o.u_terrain_coords_id),u_ele_delta:new u.aH(_,o.u_ele_delta)})};class lg{constructor(o,h,d){this.context=o;const g=o.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),o.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(o){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const tl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sc{constructor(o,h,d,g){this.length=h.length,this.attributes=d,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=o;const y=o.gl;this.buffer=y.createBuffer(),o.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,h){for(let d=0;d0){const Ht=u.F(),me=Bt;u.aP(Ht,Pt.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(Ht,Ht,Pt.placementViewportMatrix),R.push({circleArray:Ut,circleOffset:q,transform:me,invTransform:Ht,coord:yt}),z+=Ut.length/4,q=z}qt&&A.draw(C,L.LINES,dn.disabled,Hn.disabled,_.colorModeForRenderPass(),Un.disabled,id(Bt,_.transform,kt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(yt),h.id,qt.layoutVertexBuffer,qt.indexBuffer,qt.segments,null,_.transform.zoom,null,null,qt.collisionVertexBuffer)}if(!E||!R.length)return;const et=_.useProgram("collisionCircle"),Q=new u.aQ;Q.resize(4*z),Q._trim();let nt=0;for(const st of R)for(let yt=0;yt=0&&(Q[K.associatedIconIndex]={shiftedAnchor:Ae,angle:re})}else Nt(K.numGlyphs,q)}if(A){et.clear();const nt=_.icon.placedSymbolArray;for(let K=0;K_.style.map.terrain.getElevation(qt,rr,qi):null,Gi=h.layout.get("text-rotation-alignment")==="map";U(Ht,qt.posMatrix,_,g,Sr,Vo,K,A,Gi,Kn)}const Wl=_.translatePosMatrix(qt.posMatrix,Ut,y,E),Ma=pt||g&&Pt||Zl?cp:Sr,Ui=_.translatePosMatrix(Vo,Ut,y,E,!0),Ti=re&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let fi;fi=re?Ht.iconsInText?Cu(Pe.kind,an,Et,K,_,Wl,Ma,Ui,ln,ir):Su(Pe.kind,an,Et,K,_,Wl,Ma,Ui,g,ln,!0):Eu(Pe.kind,an,Et,K,_,Wl,Ma,Ui,g,ln);const Zr={program:Yn,buffers:me,uniformValues:fi,atlasTexture:Ci,atlasTextureIcon:pi,atlasInterpolation:zn,atlasInterpolationIcon:jr,isSDF:re,hasHalo:Ti};if(st&&Ht.canOverlap){yt=!0;const Kn=me.segments.get();for(const Gi of Kn)Bt.push({segments:new u.$([Gi]),sortKey:Gi.sortKey,state:Zr,terrainData:Je})}else Bt.push({segments:me.segments,sortKey:0,state:Zr,terrainData:Je})}yt&&Bt.sort((qt,Ut)=>qt.sortKey-Ut.sortKey);for(const qt of Bt){const Ut=qt.state;if(q.activeTexture.set(et.TEXTURE0),Ut.atlasTexture.bind(Ut.atlasInterpolation,et.CLAMP_TO_EDGE),Ut.atlasTextureIcon&&(q.activeTexture.set(et.TEXTURE1),Ut.atlasTextureIcon&&Ut.atlasTextureIcon.bind(Ut.atlasInterpolationIcon,et.CLAMP_TO_EDGE)),Ut.isSDF){const Ht=Ut.uniformValues;Ut.hasHalo&&(Ht.u_is_halo=1,_d(Ut.buffers,qt.segments,h,_,Ut.program,kt,R,z,Ht,qt.terrainData)),Ht.u_is_halo=0}_d(Ut.buffers,qt.segments,h,_,Ut.program,kt,R,z,Ut.uniformValues,qt.terrainData)}}function _d(_,o,h,d,g,y,E,C,L,A){const R=d.context;g.draw(R,R.gl.TRIANGLES,y,E,C,Un.disabled,L,A,h.id,_.layoutVertexBuffer,_.indexBuffer,o,h.paint,d.transform.zoom,_.programConfigurations.get(h.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function zc(_,o,h,d,g){if(!h||!d||!d.imageAtlas)return;const y=d.imageAtlas.patternPositions;let E=y[h.to.toString()],C=y[h.from.toString()];if(!E&&C&&(E=C),!C&&E&&(C=E),!E||!C){const L=g.getPaintProperty(o);E=y[L],C=y[L]}E&&C&&_.setConstantPatternPositions(E,C)}function yd(_,o,h,d,g,y,E){const C=_.context.gl,L="fill-pattern",A=h.paint.get(L),R=A&&A.constantOr(1),z=h.getCrossfadeParameters();let q,et,Q,nt,K;E?(et=R&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",q=C.LINES):(et=R?"fillPattern":"fill",q=C.TRIANGLES);const pt=A.constantOr(null);for(const Et of d){const st=o.getTile(Et);if(R&&!st.patternsLoaded())continue;const yt=st.getBucket(h);if(!yt)continue;const kt=yt.programConfigurations.get(h.id),Pt=_.useProgram(et,kt),Bt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Et);R&&(_.context.activeTexture.set(C.TEXTURE0),st.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),kt.updatePaintBuffers(z)),zc(kt,L,pt,st,h);const qt=Bt?Et:null,Ut=_.translatePosMatrix(qt?qt.posMatrix:Et.posMatrix,st,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(E){nt=yt.indexBuffer2,K=yt.segments2;const Ht=[C.drawingBufferWidth,C.drawingBufferHeight];Q=et==="fillOutlinePattern"&&R?nd(Ut,_,z,st,Ht):rg(Ut,Ht)}else nt=yt.indexBuffer,K=yt.segments,Q=R?xc(Ut,_,z,st):ed(Ut);Pt.draw(_.context,q,g,_.stencilModeForClipping(Et),y,Un.disabled,Q,Bt,h.id,yt.layoutVertexBuffer,nt,K,h.paint,_.transform.zoom,kt)}}function Oc(_,o,h,d,g,y,E){const C=_.context,L=C.gl,A="fill-extrusion-pattern",R=h.paint.get(A),z=R.constantOr(1),q=h.getCrossfadeParameters(),et=h.paint.get("fill-extrusion-opacity"),Q=R.constantOr(null);for(const nt of d){const K=o.getTile(nt),pt=K.getBucket(h);if(!pt)continue;const Et=_.style.map.terrain&&_.style.map.terrain.getTerrainData(nt),st=pt.programConfigurations.get(h.id),yt=_.useProgram(z?"fillExtrusionPattern":"fillExtrusion",st);z&&(_.context.activeTexture.set(L.TEXTURE0),K.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),st.updatePaintBuffers(q)),zc(st,A,Q,K,h);const kt=_.translatePosMatrix(nt.posMatrix,K,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Pt=h.paint.get("fill-extrusion-vertical-gradient"),Bt=z?ig(kt,_,Pt,et,nt,q,K):bu(kt,_,Pt,et);yt.draw(C,C.gl.TRIANGLES,g,y,E,Un.backCCW,Bt,Et,h.id,pt.layoutVertexBuffer,pt.indexBuffer,pt.segments,h.paint,_.transform.zoom,st,_.style.map.terrain&&pt.centroidVertexBuffer)}}function Fc(_,o,h,d,g,y,E){const C=_.context,L=C.gl,A=h.fbo;if(!A)return;const R=_.useProgram("hillshade"),z=_.style.map.terrain&&_.style.map.terrain.getTerrainData(o);C.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,A.colorAttachment.get()),R.draw(C,L.TRIANGLES,g,y,E,Un.disabled,((q,et,Q,nt)=>{const K=Q.paint.get("hillshade-shadow-color"),pt=Q.paint.get("hillshade-highlight-color"),Et=Q.paint.get("hillshade-accent-color");let st=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(st-=q.transform.angle);const yt=!q.options.moving;return{u_matrix:nt?nt.posMatrix:q.transform.calculatePosMatrix(et.tileID.toUnwrapped(),yt),u_image:0,u_latrange:sd(0,et.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),st],u_shadow:K,u_highlight:pt,u_accent:Et}})(_,h,d,z?o:null),z,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function hp(_,o,h,d,g,y){const E=_.context,C=E.gl,L=o.dem;if(L&&L.data){const A=L.dim,R=L.stride,z=L.getPixels();if(E.activeTexture.set(C.TEXTURE1),E.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||_.getTileTexture(R),o.demTexture){const et=o.demTexture;et.update(z,{premultiply:!1}),et.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else o.demTexture=new Ct(E,z,C.RGBA,{premultiply:!1}),o.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);E.activeTexture.set(C.TEXTURE0);let q=o.fbo;if(!q){const et=new Ct(E,{width:A,height:A,data:null},C.RGBA);et.bind(C.LINEAR,C.CLAMP_TO_EDGE),q=o.fbo=E.createFramebuffer(A,A,!0,!1),q.colorAttachment.set(et.texture)}E.bindFramebuffer.set(q.framebuffer),E.viewport.set([0,0,A,A]),_.useProgram("hillshadePrepare").draw(E,C.TRIANGLES,d,g,y,Un.disabled,((et,Q)=>{const nt=Q.stride,K=u.F();return u.aN(K,0,u.W,-u.W,0,0,1),u.H(K,K,[0,-u.W,0]),{u_matrix:K,u_image:1,u_dimension:[nt,nt],u_zoom:et.overscaledZ,u_unpack:Q.getUnpackVector()}})(o.tileID,L),null,h.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function vd(_,o,h,d,g,y){const E=d.paint.get("raster-fade-duration");if(!y&&E>0){const C=P.now(),L=(C-_.timeAdded)/E,A=o?(C-o.timeAdded)/E:-1,R=h.getSource(),z=g.coveringZoomLevel({tileSize:R.tileSize,roundZoom:R.roundZoom}),q=!o||Math.abs(o.tileID.overscaledZ-z)>Math.abs(_.tileID.overscaledZ-z),et=q&&_.refreshedUponExpiration?1:u.ac(q?L:1-A,0,1);return _.refreshedUponExpiration&&L>=1&&(_.refreshedUponExpiration=!1),o?{opacity:1,mix:1-et}:{opacity:et,mix:0}}return{opacity:1,mix:0}}const xd=new u.aO(1,0,0,1),Bc=new u.aO(0,1,0,1),pp=new u.aO(0,0,1,1),_g=new u.aO(1,0,1,1),bd=new u.aO(0,1,1,1);function ci(_,o,h,d){Gr(_,0,o+h/2,_.transform.width,h,d)}function Ca(_,o,h,d){Gr(_,o-h/2,0,h,_.transform.height,d)}function Gr(_,o,h,d,g,y){const E=_.context,C=E.gl;C.enable(C.SCISSOR_TEST),C.scissor(o*_.pixelRatio,h*_.pixelRatio,d*_.pixelRatio,g*_.pixelRatio),E.clear({color:y}),C.disable(C.SCISSOR_TEST)}function fp(_,o,h){const d=_.context,g=d.gl,y=h.posMatrix,E=_.useProgram("debug"),C=dn.disabled,L=Hn.disabled,A=_.colorModeForRenderPass(),R="$debug",z=_.style.map.terrain&&_.style.map.terrain.getTerrainData(h);d.activeTexture.set(g.TEXTURE0);const q=o.getTileByID(h.key).latestRawTileData,et=Math.floor((q&&q.byteLength||0)/1024),Q=o.getTile(h).tileSize,nt=512/Math.min(Q,512)*(h.overscaledZ/_.transform.zoom)*.5;let K=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(K+=` => ${h.overscaledZ}`),function(pt,Et){pt.initDebugOverlayCanvas();const st=pt.debugOverlayCanvas,yt=pt.context.gl,kt=pt.debugOverlayCanvas.getContext("2d");kt.clearRect(0,0,st.width,st.height),kt.shadowColor="white",kt.shadowBlur=2,kt.lineWidth=1.5,kt.strokeStyle="white",kt.textBaseline="top",kt.font="bold 36px Open Sans, sans-serif",kt.fillText(Et,5,5),kt.strokeText(Et,5,5),pt.debugOverlayTexture.update(st),pt.debugOverlayTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE)}(_,`${K} ${et}kB`),E.draw(d,g.TRIANGLES,C,L,Ei.alphaBlended,Un.disabled,rd(y,u.aO.transparent,nt),null,R,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),E.draw(d,g.LINE_STRIP,C,L,A,Un.disabled,rd(y,u.aO.red),z,R,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function Vc(_,o,h){const d=_.context,g=d.gl,y=_.colorModeForRenderPass(),E=new dn(g.LEQUAL,dn.ReadWrite,_.depthRangeFor3D),C=_.useProgram("terrain"),L=o.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const A of h){const R=_.renderToTexture.getTexture(A),z=o.getTerrainData(A.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,R.texture);const q={u_matrix:_.transform.calculatePosMatrix(A.tileID.toUnwrapped()),u_texture:0,u_ele_delta:o.getMeshFrameDelta(_.transform.zoom)};C.draw(d,g.TRIANGLES,E,Hn.disabled,y,Un.backCCW,q,z,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}class wd{constructor(o,h){this.context=new gg(o),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.F(),renderTime:0},this.setup(),this.numSublayers=Ni.maxUnderzooming+Ni.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ea}resize(o,h,d){if(this.width=Math.floor(o*d),this.height=Math.floor(h*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const o=this.context,h=new u.aV;h.emplaceBack(0,0),h.emplaceBack(u.W,0),h.emplaceBack(0,u.W),h.emplaceBack(u.W,u.W),this.tileExtentBuffer=o.createVertexBuffer(h,_c.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=o.createVertexBuffer(d,_c.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const g=new u.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(u.W,0,u.W,0),g.emplaceBack(0,u.W,0,u.W),g.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=o.createVertexBuffer(g,$n.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const y=new u.aV;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=o.createVertexBuffer(y,_c.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const E=new u.aW;E.emplaceBack(0),E.emplaceBack(1),E.emplaceBack(3),E.emplaceBack(2),E.emplaceBack(0),this.tileBorderIndexBuffer=o.createIndexBuffer(E);const C=new u.aX;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(C);const L=this.context.gl;this.stencilClearMode=new Hn({func:L.ALWAYS,mask:0},0,255,L.ZERO,L.ZERO,L.ZERO)}clearStencil(){const o=this.context,h=o.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,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(o,h.TRIANGLES,dn.disabled,this.stencilClearMode,Ei.disabled,Un.disabled,bc(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,h){if(this.currentStencilSource===o.source||!o.isTileClipped()||!h||!h.length)return;this.currentStencilSource=o.source;const d=this.context,g=d.gl;this.nextStencilID+h.length>256&&this.clearStencil(),d.setColorMode(Ei.disabled),d.setDepthMode(dn.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const E of h){const C=this._tileClippingMaskIDs[E.key]=this.nextStencilID++,L=this.style.map.terrain&&this.style.map.terrain.getTerrainData(E);y.draw(d,g.TRIANGLES,dn.disabled,new Hn({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),Ei.disabled,Un.disabled,bc(E.posMatrix),L,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const o=this.nextStencilID++,h=this.context.gl;return new Hn({func:h.NOTEQUAL,mask:255},o,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(o){const h=this.context.gl;return new Hn({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(o){const h=this.context.gl,d=o.sort((E,C)=>C.overscaledZ-E.overscaledZ),g=d[d.length-1].overscaledZ,y=d[0].overscaledZ-g+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const E={};for(let C=0;C=0;this.currentLayer--){const L=this.style._layers[d[this.currentLayer]],A=g[L.source],R=y[L.source];this._renderTileClippingMasks(L,R),this.renderLayer(this,A,L,R)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerK.source&&!K.isHidden(R)?[A.sourceCaches[K.source]]:[]),et=q.filter(K=>K.getSource().type==="vector"),Q=q.filter(K=>K.getSource().type!=="vector"),nt=K=>{(!z||z.getSource().maxzoomnt(K)),z||Q.forEach(K=>nt(K)),z}(this.style,this.transform.zoom);L&&function(A,R,z){for(let q=0;qet.style.map.terrain.getElevation(Pt,Pe,ye):null)}}}(L,y,C,E,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),A),C.paint.get("icon-opacity").constantOr(1)!==0&&Nc(y,E,C,L,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),R,z),C.paint.get("text-opacity").constantOr(1)!==0&&Nc(y,E,C,L,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),R,z),E.map.showCollisionBoxes&&(kc(y,E,C,L,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),!0),kc(y,E,C,L,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),!1))})(o,h,d,g,this.style.placement.variableOffsets);break;case"circle":(function(y,E,C,L){if(y.renderPass!=="translucent")return;const A=C.paint.get("circle-opacity"),R=C.paint.get("circle-stroke-width"),z=C.paint.get("circle-stroke-opacity"),q=!C.layout.get("circle-sort-key").isConstant();if(A.constantOr(1)===0&&(R.constantOr(1)===0||z.constantOr(1)===0))return;const et=y.context,Q=et.gl,nt=y.depthModeForSublayer(0,dn.ReadOnly),K=Hn.disabled,pt=y.colorModeForRenderPass(),Et=[];for(let st=0;stst.sortKey-yt.sortKey);for(const st of Et){const{programConfiguration:yt,program:kt,layoutVertexBuffer:Pt,indexBuffer:Bt,uniformValues:qt,terrainData:Ut}=st.state;kt.draw(et,Q.TRIANGLES,nt,K,pt,Un.disabled,qt,Ut,C.id,Pt,Bt,st.segments,C.paint,y.transform.zoom,yt)}})(o,h,d,g);break;case"heatmap":(function(y,E,C,L){if(C.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const A=y.context,R=A.gl,z=Hn.disabled,q=new Ei([R.ONE,R.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(et,Q,nt){const K=et.gl;et.activeTexture.set(K.TEXTURE1),et.viewport.set([0,0,Q.width/4,Q.height/4]);let pt=nt.heatmapFbo;if(pt)K.bindTexture(K.TEXTURE_2D,pt.colorAttachment.get()),et.bindFramebuffer.set(pt.framebuffer);else{const Et=K.createTexture();K.bindTexture(K.TEXTURE_2D,Et),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_S,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_T,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MIN_FILTER,K.LINEAR),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MAG_FILTER,K.LINEAR),pt=nt.heatmapFbo=et.createFramebuffer(Q.width/4,Q.height/4,!1,!1),function(st,yt,kt,Pt){var Bt,qt;const Ut=st.gl,Ht=(Bt=st.HALF_FLOAT)!==null&&Bt!==void 0?Bt:Ut.UNSIGNED_BYTE,me=(qt=st.RGBA16F)!==null&&qt!==void 0?qt:Ut.RGBA;Ut.texImage2D(Ut.TEXTURE_2D,0,me,yt.width/4,yt.height/4,0,Ut.RGBA,Ht,null),Pt.colorAttachment.set(kt)}(et,Q,Et,pt)}})(A,y,C),A.clear({color:u.aO.transparent});for(let et=0;et{const st=u.F();u.aN(st,0,nt.width,nt.height,0,0,1);const yt=nt.context.gl;return{u_matrix:st,u_world:[yt.drawingBufferWidth,yt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:K.paint.get("heatmap-opacity")}})(A,R),null,R.id,A.viewportBuffer,A.quadTriangleIndexBuffer,A.viewportSegments,R.paint,A.transform.zoom)}(y,C))})(o,h,d,g);break;case"line":(function(y,E,C,L){if(y.renderPass!=="translucent")return;const A=C.paint.get("line-opacity"),R=C.paint.get("line-width");if(A.constantOr(1)===0||R.constantOr(1)===0)return;const z=y.depthModeForSublayer(0,dn.ReadOnly),q=y.colorModeForRenderPass(),et=C.paint.get("line-dasharray"),Q=C.paint.get("line-pattern"),nt=Q.constantOr(1),K=C.paint.get("line-gradient"),pt=C.getCrossfadeParameters(),Et=nt?"linePattern":et?"lineSDF":K?"lineGradient":"line",st=y.context,yt=st.gl;let kt=!0;for(const Pt of L){const Bt=E.getTile(Pt);if(nt&&!Bt.patternsLoaded())continue;const qt=Bt.getBucket(C);if(!qt)continue;const Ut=qt.programConfigurations.get(C.id),Ht=y.context.program.get(),me=y.useProgram(Et,Ut),Ae=kt||me.program!==Ht,re=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pt),Pe=Q.constantOr(null);if(Pe&&Bt.imageAtlas){const an=Bt.imageAtlas,Je=an.patternPositions[Pe.to.toString()],ln=an.patternPositions[Pe.from.toString()];Je&&ln&&Ut.setConstantPatternPositions(Je,ln)}const ye=re?Pt:null,Yn=nt?$a(y,Bt,C,pt,ye):et?Ic(y,Bt,C,et,pt,ye):K?ad(y,Bt,C,qt.lineClipsArray.length,ye):wc(y,Bt,C,ye);if(nt)st.activeTexture.set(yt.TEXTURE0),Bt.imageAtlasTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE),Ut.updatePaintBuffers(pt);else if(et&&(Ae||y.lineAtlas.dirty))st.activeTexture.set(yt.TEXTURE0),y.lineAtlas.bind(st);else if(K){const an=qt.gradients[C.id];let Je=an.texture;if(C.gradientVersion!==an.version){let ln=256;if(C.stepInterpolant){const Ci=E.getSource().maxzoom,zn=Pt.canonical.z===Ci?Math.ceil(1<0?h.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const h=this.imageManager.getPattern(o.from.toString()),d=this.imageManager.getPattern(o.to.toString());return!h||!d}useProgram(o,h){this.cache=this.cache||{};const d=o+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Sa(this.context,xu[o],h,ld[o],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 o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ct(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:h}=this.context.gl;return this.width!==o||this.height!==h}}class Ta{constructor(o,h){this.points=o,this.planes=h}static fromInvProjectionMatrix(o,h,d){const g=Math.pow(2,d),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(C=>{const L=1/(C=u.af([],C,o))[3]/h*g;return u.a_(C,C,[L,L,1/C[3],L])}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const L=function(q,et){var Q=et[0],nt=et[1],K=et[2],pt=Q*Q+nt*nt+K*K;return pt>0&&(pt=1/Math.sqrt(pt)),q[0]=et[0]*pt,q[1]=et[1]*pt,q[2]=et[2]*pt,q}([],function(q,et,Q){var nt=et[0],K=et[1],pt=et[2],Et=Q[0],st=Q[1],yt=Q[2];return q[0]=K*yt-pt*st,q[1]=pt*Et-nt*yt,q[2]=nt*st-K*Et,q}([],It([],y[C[0]],y[C[1]]),It([],y[C[2]],y[C[1]]))),A=-((R=L)[0]*(z=y[C[1]])[0]+R[1]*z[1]+R[2]*z[2]);var R,z;return L.concat(A)});return new Ta(y,E)}}class La{constructor(o,h){this.min=o,this.max=h,this.center=function(d,g,y){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,y){return d[0]=g[0]+y[0],d[1]=g[1]+y[1],d[2]=g[2]+y[2],d}([],this.min,this.max))}quadrant(o){const h=[o%2==0,o<2],d=gt(this.min),g=gt(this.max);for(let y=0;y=0&&E++;if(E===0)return 0;E!==h.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let y=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let C=0;Cthis.max[g]-this.min[g])return 0}return 1}}class Vl{constructor(o=0,h=0,d=0,g=0){if(isNaN(o)||o<0||isNaN(h)||h<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=o,this.bottom=h,this.left=d,this.right=g}interpolate(o,h,d){return h.top!=null&&o.top!=null&&(this.top=u.z.number(o.top,h.top,d)),h.bottom!=null&&o.bottom!=null&&(this.bottom=u.z.number(o.bottom,h.bottom,d)),h.left!=null&&o.left!=null&&(this.left=u.z.number(o.left,h.left,d)),h.right!=null&&o.right!=null&&(this.right=u.z.number(o.right,h.right,d)),this}getCenter(o,h){const d=u.ac((this.left+o-this.right)/2,0,o),g=u.ac((this.top+h-this.bottom)/2,0,h);return new u.P(d,g)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.right}clone(){return new Vl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Uc{constructor(o,h,d,g,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||!!y,this._minZoom=o||0,this._maxZoom=h||22,this._minPitch=d??0,this._maxPitch=g??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 Vl,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const o=new Uc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}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(o){const h=-u.b0(o,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,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,g,y){var E=g[0],C=g[1],L=g[2],A=g[3],R=Math.sin(y),z=Math.cos(y);d[0]=E*z+L*R,d[1]=C*z+A*R,d[2]=E*-R+L*z,d[3]=C*-R+A*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const h=u.ac(o,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const h=Math.min(Math.max(o,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,h,d){this._unmodified=!1,this._edgeInsets.interpolate(o,h,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const h=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(o){const h=[new u.b1(0,o)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),g=this.pointCoordinate(new u.P(this.width,0)),y=this.pointCoordinate(new u.P(this.width,this.height)),E=this.pointCoordinate(new u.P(0,this.height)),C=Math.floor(Math.min(d.x,g.x,y.x,E.x)),L=Math.floor(Math.max(d.x,g.x,y.x,E.x)),A=1;for(let R=C-A;R<=L+A;R++)R!==0&&h.push(new u.b1(R,o))}return h}coveringTiles(o){var h,d;let g=this.coveringZoomLevel(o);const y=g;if(o.minzoom!==void 0&&go.maxzoom&&(g=o.maxzoom);const E=this.pointCoordinate(this.getCameraPoint()),C=u.Y.fromLngLat(this.center),L=Math.pow(2,g),A=[L*E.x,L*E.y,0],R=[L*C.x,L*C.y,0],z=Ta.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let q=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(q=g);const et=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,Q=st=>({aabb:new La([st*L,0,0],[(st+1)*L,L,0]),zoom:0,x:0,y:0,wrap:st,fullyVisible:!1}),nt=[],K=[],pt=g,Et=o.reparseOverscaled?y:g;if(this._renderWorldCopies)for(let st=1;st<=3;st++)nt.push(Q(-st)),nt.push(Q(st));for(nt.push(Q(0));nt.length>0;){const st=nt.pop(),yt=st.x,kt=st.y;let Pt=st.fullyVisible;if(!Pt){const me=st.aabb.intersects(z);if(me===0)continue;Pt=me===2}const Bt=o.terrain?A:R,qt=st.aabb.distanceX(Bt),Ut=st.aabb.distanceY(Bt),Ht=Math.max(Math.abs(qt),Math.abs(Ut));if(st.zoom===pt||Ht>et+(1<=q){const me=pt-st.zoom,Ae=A[0]-.5-(yt<>1),Pe=st.zoom+1;let ye=st.aabb.quadrant(me);if(o.terrain){const Yn=new u.Q(Pe,st.wrap,Pe,Ae,re),an=o.terrain.getMinMaxElevation(Yn),Je=(h=an.minElevation)!==null&&h!==void 0?h:this.elevation,ln=(d=an.maxElevation)!==null&&d!==void 0?d:this.elevation;ye=new La([ye.min[0],ye.min[1],Je],[ye.max[0],ye.max[1],ln])}nt.push({aabb:ye,zoom:Pe,x:Ae,y:re,wrap:st.wrap,fullyVisible:Pt})}}return K.sort((st,yt)=>st.distanceSq-yt.distanceSq).map(st=>st.tileID)}resize(o,h){this.width=o,this.height=h,this.pixelsToGLUnits=[2/o,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const h=u.ac(o.lat,-this.maxValidLatitude,this.maxValidLatitude);return new u.P(u.N(o.lng)*this.worldSize,u.O(h)*this.worldSize)}unproject(o){return new u.Y(o.x/this.worldSize,o.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(o){const h=this.pointLocation(this.centerPoint,o),d=o.getElevationForLngLatZoom(h,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),y=u.Y.fromLngLat(g.lngLat,g.altitude),E=u.Y.fromLngLat(h,d),C=y.x-E.x,L=y.y-E.y,A=y.z-E.z,R=Math.sqrt(C*C+L*L+A*A),z=this.scaleZoom(this.cameraToCenterDistance/R/this.tileSize);this._elevation=d,this._center=h,this.zoom=z}setLocationAtPoint(o,h){const d=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(o),E=new u.Y(y.x-(d.x-g.x),y.y-(d.y-g.y));this.center=this.coordinateLocation(E),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(o,h){return h?this.coordinatePoint(this.locationCoordinate(o),h.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,h){return this.coordinateLocation(this.pointCoordinate(o,h))}locationCoordinate(o){return u.Y.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,h){if(h){const q=h.pointCoordinate(o);if(q!=null)return q}const d=[o.x,o.y,0,1],g=[o.x,o.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(g,g,this.pixelMatrixInverse);const y=d[3],E=g[3],C=d[1]/y,L=g[1]/E,A=d[2]/y,R=g[2]/E,z=A===R?0:(0-A)/(R-A);return new u.Y(u.z.number(d[0]/y,g[0]/E,z)/this.worldSize,u.z.number(C,L,z)/this.worldSize)}coordinatePoint(o,h=0,d=this.pixelMatrix){const g=[o.x*this.worldSize,o.y*this.worldSize,h,1];return u.af(g,g,d),new u.P(g[0]/g[3],g[1]/g[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new Ie().extend(this.pointLocation(new u.P(0,o))).extend(this.pointLocation(new u.P(this.width,o))).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 Ie([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(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(o,h=!1){const d=o.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const y=o.canonical,E=this.worldSize/this.zoomScale(y.z),C=y.x+Math.pow(2,y.z)*o.wrap,L=u.an(new Float64Array(16));return u.H(L,L,[C*E,y.y*E,0]),u.J(L,L,[E/u.W,E/u.W,1]),u.K(L,h?this.alignedProjMatrix:this.projMatrix,L),g[d]=new Float32Array(L),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const Q=179.9999999999;o=[-Q,Q]}this._constraining=!0;let h,d,g,y,E=-90,C=90,L=-180,A=180;const R=this.size,z=this._unmodified;if(this.latRange){const Q=this.latRange;E=u.O(Q[1])*this.worldSize,C=u.O(Q[0])*this.worldSize,h=C-EC&&(y=C-nt)}if(o){const Q=(L+A)/2;let nt=q.x;this._renderWorldCopies&&(nt=u.b0(q.x,Q-this.worldSize/2,Q+this.worldSize/2));const K=R.x/2;nt-KA&&(g=A-K)}g===void 0&&y===void 0||(this.center=this.unproject(new u.P(g!==void 0?g:q.x,y!==void 0?y:q.y)).wrap()),this._unmodified=z,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=this.centerOffset,h=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b2(1,this.center.lat)*this.worldSize;let g=u.an(new Float64Array(16));u.J(g,g,[this.width/2,-this.height/2,1]),u.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=u.an(new Float64Array(16)),u.J(g,g,[1,-1,1]),u.H(g,g,[-1,-1,0]),u.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),E=Math.min(this.elevation,this.minElevationForCurrentTile),C=y-E*this._pixelPerMeter/Math.cos(this._pitch),L=E<0?C:y,A=Math.PI/2+this._pitch,R=this._fov*(.5+o.y/this.height),z=Math.sin(R)*L/Math.sin(u.ac(Math.PI-A-R,.01,Math.PI-.01)),q=this.getHorizon(),et=2*Math.atan(q/this.cameraToCenterDistance)*(.5+o.y/(2*q)),Q=Math.sin(et)*L/Math.sin(u.ac(Math.PI-A-et,.01,Math.PI-.01)),nt=Math.min(z,Q),K=1.01*(Math.cos(Math.PI/2-this._pitch)*nt+L),pt=this.height/50;g=new Float64Array(16),u.b3(g,this._fov,this.width/this.height,pt,K),g[8]=2*-o.x/this.width,g[9]=2*o.y/this.height,u.J(g,g,[1,-1,1]),u.H(g,g,[0,0,-this.cameraToCenterDistance]),u.b4(g,g,this._pitch),u.ad(g,g,this.angle),u.H(g,g,[-h,-d,0]),this.mercatorMatrix=u.J([],g,[this.worldSize,this.worldSize,this.worldSize]),u.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,g),u.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=u.ar([],g),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,g);const Et=this.width%2/2,st=this.height%2/2,yt=Math.cos(this.angle),kt=Math.sin(this.angle),Pt=h-Math.round(h)+yt*Et+kt*st,Bt=d-Math.round(d)+yt*st+kt*Et,qt=new Float64Array(g);if(u.H(qt,qt,[Pt>.5?Pt-1:Pt,Bt>.5?Bt-1:Bt,0]),this.alignedProjMatrix=qt,g=u.ar(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const o=this.pointCoordinate(new u.P(0,0)),h=[o.x*this.worldSize,o.y*this.worldSize,0,1];return u.af(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,o))}getCameraQueryGeometry(o){const h=this.getCameraPoint();if(o.length===1)return[o[0],h];{let d=h.x,g=h.y,y=h.x,E=h.y;for(const C of o)d=Math.min(d,C.x),g=Math.min(g,C.y),y=Math.max(y,C.x),E=Math.max(E,C.y);return[new u.P(d,g),new u.P(y,g),new u.P(y,E),new u.P(d,E),new u.P(d,g)]}}lngLatToCameraDepth(o,h){const d=this.locationCoordinate(o),g=[d.x*this.worldSize,d.y*this.worldSize,h,1];return u.af(g,g,this.projMatrix),g[2]/g[3]}}function dp(_,o){let h,d=!1,g=null,y=null;const E=()=>{g=null,d&&(_.apply(y,h),g=setTimeout(E,o),d=!1)};return(...C)=>(d=!0,y=this,h=C,g||E(),g)}class mp{constructor(o){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let d;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:d,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}},this._updateHash=dp(this._updateHashUnthrottled,300),this._hashName=o&&encodeURIComponent(o)}addTo(o){return this._map=o,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(o){const h=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,g),E=Math.round(h.lng*y)/y,C=Math.round(h.lat*y)/y,L=this._map.getBearing(),A=this._map.getPitch();let R="";if(R+=o?`/${E}/${C}/${d}`:`${d}/${C}/${E}`,(L||A)&&(R+="/"+Math.round(10*L)/10),A&&(R+=`/${Math.round(A)}`),this._hashName){const z=this._hashName;let q=!1;const et=window.location.hash.slice(1).split("&").map(Q=>{const nt=Q.split("=")[0];return nt===z?(q=!0,`${nt}=${R}`):Q}).filter(Q=>Q);return q||et.push(`${z}=${R}`),`#${et.join("&")}`}return`#${R}`}}const Lu={linearity:.3,easing:u.b5(0,0,.3,1)},Id=u.e({deceleration:2500,maxSpeed:1400},Lu),il=u.e({deceleration:20,maxSpeed:1400},Lu),Ed=u.e({deceleration:1e3,maxSpeed:360},Lu),Sd=u.e({deceleration:1e3,maxSpeed:90},Lu);class Cd{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:P.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,h=P.now();for(;o.length>0&&h-o[0].time>160;)o.shift()}_onMoveEnd(o){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)h.zoom+=y.zoomDelta||0,h.bearing+=y.bearingDelta||0,h.pitch+=y.pitchDelta||0,y.panDelta&&h.pan._add(y.panDelta),y.around&&(h.around=y.around),y.pinchAround&&(h.pinchAround=y.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const y=Mu(h.pan.mag(),d,u.e({},Id,o||{}));g.offset=h.pan.mult(y.amount/h.pan.mag()),g.center=this._map.transform.center,Pu(g,y)}if(h.zoom){const y=Mu(h.zoom,d,il);g.zoom=this._map.transform.zoom+y.amount,Pu(g,y)}if(h.bearing){const y=Mu(h.bearing,d,Ed);g.bearing=this._map.transform.bearing+u.ac(y.amount,-179,179),Pu(g,y)}if(h.pitch){const y=Mu(h.pitch,d,Sd);g.pitch=this._map.transform.pitch+y.amount,Pu(g,y)}if(g.zoom||g.bearing){const y=h.pinchAround===void 0?h.around:h.pinchAround;g.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),u.e(g,{noMoveStart:!0})}}function Pu(_,o){(!_.duration||_.durationh.unproject(L)),C=y.reduce((L,A,R,z)=>L.add(A.div(z.length)),new u.P(0,0));super(o,{points:y,point:C,lngLats:E,lngLat:h.unproject(C),originalEvent:d}),this._defaultPrevented=!1}}class rl extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,h,d){super(o,{originalEvent:d}),this._defaultPrevented=!1}}class Td{constructor(o,h){this._map=o,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new rl(o.type,this._map,o))}mousedown(o,h){return this._mousedownPos=h,this._firePreventable(new ro(o.type,this._map,o))}mouseup(o){this._map.fire(new ro(o.type,this._map,o))}click(o,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new ro(o.type,this._map,o))}dblclick(o){return this._firePreventable(new ro(o.type,this._map,o))}mouseover(o){this._map.fire(new ro(o.type,this._map,o))}mouseout(o){this._map.fire(new ro(o.type,this._map,o))}touchstart(o){return this._firePreventable(new Ul(o.type,this._map,o))}touchmove(o){this._map.fire(new Ul(o.type,this._map,o))}touchend(o){this._map.fire(new Ul(o.type,this._map,o))}touchcancel(o){this._map.fire(new Ul(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class es{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new ro(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ro("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new ro(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class oo{constructor(o){this._map=o}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(o){return this.transform.pointLocation(u.P.convert(o),this._map.terrain)}}class gp{constructor(o,h){this._map=o,this._tr=new oo(o),this._el=o.getCanvasContainer(),this._container=o.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(o,h){this.isEnabled()&&o.shiftKey&&o.button===0&&(k.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(o,h){if(!this._active)return;const d=h;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)y.fitScreenCoordinates(d,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(k.remove(this._box),this._box=null),k.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(o,h){return this._map.fire(new u.k(o,{originalEvent:h}))}}function Bo(_,o){if(_.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${o.length}`);const h={};for(let d=0;d<_.length;d++)h[_[d].identifier]=o[d];return h}class Au{constructor(o){this.reset(),this.numTouches=o.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(o,h,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const y=new u.P(0,0);for(const E of g)y._add(E);return y.div(g.length)}(h),this.touches=Bo(d,h)))}touchmove(o,h,d){if(this.aborted||!this.centroid)return;const g=Bo(d,h);for(const y in this.touches){const E=g[y];(!E||E.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(o,h,d){if((!this.centroid||o.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class _p{constructor(o){this.singleTap=new Au(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,h,d){this.singleTap.touchstart(o,h,d)}touchmove(o,h,d){this.singleTap.touchmove(o,h,d)}touchend(o,h,d){const g=this.singleTap.touchend(o,h,d);if(g){const y=o.timeStamp-this.lastTime<500,E=!this.lastTap||this.lastTap.dist(g)<30;if(y&&E||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class yg{constructor(o){this._tr=new oo(o),this._zoomIn=new _p({numTouches:1,numTaps:2}),this._zoomOut=new _p({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(o,h,d){this._zoomIn.touchstart(o,h,d),this._zoomOut.touchstart(o,h,d)}touchmove(o,h,d){this._zoomIn.touchmove(o,h,d),this._zoomOut.touchmove(o,h,d)}touchend(o,h,d){const g=this._zoomIn.touchend(o,h,d),y=this._zoomOut.touchend(o,h,d),E=this._tr;return g?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:E.zoom+1,around:E.unproject(g)},{originalEvent:o})}):y?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:E.zoom-1,around:E.unproject(y)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ku{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const h=this._moveFunction(...o);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(o,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,h){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);const g=h.length?h[0]:h;return!this._moved&&g.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(o){o.preventDefault()}},yp=({enable:_,clickTolerance:o,bearingDegreesPerPixelMoved:h=.8})=>{const d=new ol({checkCorrectEvent:g=>k.mouseButton(g)===0&&g.ctrlKey||k.mouseButton(g)===2});return new ku({clickTolerance:o,move:(g,y)=>({bearingDelta:(y.x-g.x)*h}),moveStateManager:d,enable:_,assignEvents:de})},Gl=({enable:_,clickTolerance:o,pitchDegreesPerPixelMoved:h=-.5})=>{const d=new ol({checkCorrectEvent:g=>k.mouseButton(g)===0&&g.ctrlKey||k.mouseButton(g)===2});return new ku({clickTolerance:o,move:(g,y)=>({pitchDelta:(y.y-g.y)*h}),moveStateManager:d,enable:_,assignEvents:de})};class Du{constructor(o,h){this._clickTolerance=o.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(o,h,d){return this._calculateTransform(o,h,d)}touchmove(o,h,d){if(this._active&&!(d.length0&&(this._active=!0);const g=Bo(d,h),y=new u.P(0,0),E=new u.P(0,0);let C=0;for(const A in g){const R=g[A],z=this._touches[A];z&&(y._add(R),E._add(R.sub(z)),C++,g[A]=R)}if(this._touches=g,CMath.abs(_.x)}class vp extends Gc{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,h,d){super.touchstart(o,h,d),this._currentTouchCount=d.length}_start(o){this._lastPoints=o,Zc(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,h,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=o[0].sub(this._lastPoints[0]),y=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,y,d.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(g.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(o,h,d){if(this._valid!==void 0)return this._valid;const g=o.mag()>=2,y=h.mag()>=2;if(!g&&!y)return;if(!g||!y)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const E=o.y>0==h.y>0;return Zc(o)&&Zc(h)&&E}}const vg={panStep:100,bearingStep:15,pitchStep:10};class Ad{constructor(o){this._tr=new oo(o);const h=vg;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let h=0,d=0,g=0,y=0,E=0;switch(o.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:o.shiftKey?d=-1:(o.preventDefault(),y=-1);break;case 39:o.shiftKey?d=1:(o.preventDefault(),y=1);break;case 38:o.shiftKey?g=1:(o.preventDefault(),E=-1);break;case 40:o.shiftKey?g=-1:(o.preventDefault(),E=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:C=>{const L=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:sl,zoom:h?Math.round(L.zoom)+h*(o.shiftKey?2:1):L.zoom,bearing:L.bearing+d*this._bearingStep,pitch:L.pitch+g*this._pitchStep,offset:[-y*this._panStep,-E*this._panStep],center:L.center},{originalEvent:o})}}}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 sl(_){return _*(2-_)}const Xn=4.000244140625;class Ru{constructor(o,h){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=o,this._tr=new oo(o),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(o){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!o[this._map.cooperativeGestures._bypassKey])return;let h=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.deltaY;const d=P.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,h!==0&&h%Xn==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,o)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),o.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=o,this._delta-=h,this._active||this._start(o)),o.preventDefault()}_start(o){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const h=k.mousePos(this._map.getCanvas(),o),d=this._tr;this._around=h.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(h)):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 o=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Xn?this._wheelZoomRate:this._defaultZoomRate;let L=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&L!==0&&(L=1/L);const A=typeof this._targetZoom=="number"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(A*L))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,d=this._startZoom,g=this._easing;let y,E=!1;if(this._type==="wheel"&&d&&g){const C=Math.min((P.now()-this._lastWheelEventTime)/200,1),L=g(C);y=u.z.number(d,h,L),C<1?this._frameId||(this._frameId=!0):E=!0}else y=h,E=!0;return this._active=!0,E&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!E,zoomDelta:y-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){let h=u.b6;if(this._prevEase){const d=this._prevEase,g=(P.now()-d.start)/d.duration,y=d.easing(g+.01)-d.easing(g),E=.27/Math.sqrt(y*y+1e-4)*.01,C=Math.sqrt(.0729-E*E);h=u.b5(E,C,.25,1)}return this._prevEase={start:P.now(),duration:o,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Wc{constructor(o,h){this._clickZoom=o,this._tapZoom=h}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class kd{constructor(o){this._tr=new oo(o),this.reset()}reset(){this._active=!1}dblclick(o,h){return o.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dd{constructor(){this._tap=new _p({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(o,h,d){if(!this._swipePoint)if(this._tapTime){const g=h[0],y=o.timeStamp-this._tapTime<500,E=this._tapPoint.dist(g)<30;y&&E?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(o,h,d)}touchmove(o,h,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=h[0],y=g.y-this._swipePoint.y;return this._swipePoint=g,o.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(o,h,d)}touchend(o,h,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(o,h,d);g&&(this._tapTime=o.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xp{constructor(o,h,d){this._el=o,this._mousePan=h,this._touchPan=d}enable(o){this._inertiaOptions=o||{},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 Rd{constructor(o,h,d){this._pitchWithRotate=o.pitchWithRotate,this._mouseRotate=h,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ns{constructor(o,h,d,g){this._el=o,this._touchZoom=h,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),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 Nu{constructor(o,h){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=h,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=k.create("div","maplibregl-cooperative-gesture-screen",o);let h=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(h=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=h,this._container.appendChild(g);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=d,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(k.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(o){this._onCooperativeGesture(o.touches.length===1)}wheel(o){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!o[this._bypassKey])}_onCooperativeGesture(o){this._enabled&&o&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const be=_=>_.zoom||_.drag||_.pitch||_.rotate;class ke extends u.k{}function ql(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class bp{constructor(o,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,y)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const E=g.type==="renderFrame"?void 0:g,C={needsRenderFrame:!1},L={},A={},R=g.touches,z=R?this._getMapTouches(R):void 0,q=z?k.touchPos(this._map.getCanvas(),z):k.mousePos(this._map.getCanvas(),g);for(const{handlerName:nt,handler:K,allowed:pt}of this._handlers){if(!K.isEnabled())continue;let Et;this._blockedByActive(A,pt,nt)?K.reset():K[y||g.type]&&(Et=K[y||g.type](g,q,z),this.mergeHandlerResult(C,L,Et,nt,E),Et&&Et.needsRenderFrame&&this._triggerRenderFrame()),(Et||K.isActive())&&(A[nt]=K)}const et={};for(const nt in this._previousActiveHandlers)A[nt]||(et[nt]=E);this._previousActiveHandlers=A,(Object.keys(et).length||ql(C))&&(this._changes.push([C,L,et]),this._triggerRenderFrame()),(Object.keys(A).length||ql(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Q}=C;Q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Q(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Cd(o),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,y,E]of this._listeners)k.addEventListener(g,y,g===document?this.handleWindowEvent:this.handleEvent,E)}destroy(){for(const[o,h,d]of this._listeners)k.removeEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(o){const h=this._map,d=h.getCanvasContainer();this._add("mapEvent",new Td(h,o));const g=h.boxZoom=new gp(h,o);this._add("boxZoom",g),o.interactive&&o.boxZoom&&g.enable();const y=h.cooperativeGestures=new Nu(h,o.cooperativeGestures);this._add("cooperativeGestures",y),o.cooperativeGestures&&y.enable();const E=new yg(h),C=new kd(h);h.doubleClickZoom=new Wc(C,E),this._add("tapZoom",E),this._add("clickZoom",C),o.interactive&&o.doubleClickZoom&&h.doubleClickZoom.enable();const L=new Dd;this._add("tapDragZoom",L);const A=h.touchPitch=new vp(h);this._add("touchPitch",A),o.interactive&&o.touchPitch&&h.touchPitch.enable(o.touchPitch);const R=yp(o),z=Gl(o);h.dragRotate=new Rd(o,R,z),this._add("mouseRotate",R,["mousePitch"]),this._add("mousePitch",z,["mouseRotate"]),o.interactive&&o.dragRotate&&h.dragRotate.enable();const q=(({enable:Et,clickTolerance:st})=>{const yt=new ol({checkCorrectEvent:kt=>k.mouseButton(kt)===0&&!kt.ctrlKey});return new ku({clickTolerance:st,move:(kt,Pt)=>({around:Pt,panDelta:Pt.sub(kt)}),activateOnStart:!0,moveStateManager:yt,enable:Et,assignEvents:de})})(o),et=new Du(o,h);h.dragPan=new xp(d,q,et),this._add("mousePan",q),this._add("touchPan",et,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&h.dragPan.enable(o.dragPan);const Q=new jc,nt=new Pd;h.touchZoomRotate=new ns(d,nt,Q,L),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",nt,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&h.touchZoomRotate.enable(o.touchZoomRotate);const K=h.scrollZoom=new Ru(h,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),o.interactive&&o.scrollZoom&&h.scrollZoom.enable(o.scrollZoom);const pt=h.keyboard=new Ad(h);this._add("keyboard",pt),o.interactive&&o.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new es(h))}_add(o,h,d){this._handlers.push({handlerName:o,handler:h,allowed:d}),this._handlersById[o]=h}stop(o){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!be(this._eventsInProgress)||this.isZooming()}_blockedByActive(o,h,d){for(const g in o)if(g!==d&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(o){const h=[];for(const d of o)this._el.contains(d.target)&&h.push(d);return h}mergeHandlerResult(o,h,d,g,y){if(!d)return;u.e(o,d);const E={handlerName:g,originalEvent:d.originalEvent||y};d.zoomDelta!==void 0&&(h.zoom=E),d.panDelta!==void 0&&(h.drag=E),d.pitchDelta!==void 0&&(h.pitch=E),d.bearingDelta!==void 0&&(h.rotate=E)}_applyChanges(){const o={},h={},d={};for(const[g,y,E]of this._changes)g.panDelta&&(o.panDelta=(o.panDelta||new u.P(0,0))._add(g.panDelta)),g.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(o.around=g.around),g.pinchAround!==void 0&&(o.pinchAround=g.pinchAround),g.noInertia&&(o.noInertia=g.noInertia),u.e(h,y),u.e(d,E);this._updateMapTransform(o,h,d),this._changes=[]}_updateMapTransform(o,h,d){const g=this._map,y=g._getTransformForUpdate(),E=g.terrain;if(!(ql(o)||E&&this._terrainMovement))return this._fireEvents(h,d,!0);let{panDelta:C,zoomDelta:L,bearingDelta:A,pitchDelta:R,around:z,pinchAround:q}=o;q!==void 0&&(z=q),g._stop(!0),z=z||g.transform.centerPoint;const et=y.pointLocation(C?z.sub(C):z);A&&(y.bearing+=A),R&&(y.pitch+=R),L&&(y.zoom+=L),E?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(C)):y.setLocationAtPoint(et,z):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(et,z),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(g.terrain)})):y.setLocationAtPoint(et,z),g._applyUpdatedTransform(y),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(h,d,!0)}_fireEvents(o,h,d){const g=be(this._eventsInProgress),y=be(o),E={};for(const R in o){const{originalEvent:z}=o[R];this._eventsInProgress[R]||(E[`${R}start`]=z),this._eventsInProgress[R]=o[R]}!g&&y&&this._fireEvent("movestart",y.originalEvent);for(const R in E)this._fireEvent(R,E[R]);y&&this._fireEvent("move",y.originalEvent);for(const R in o){const{originalEvent:z}=o[R];this._fireEvent(R,z)}const C={};let L;for(const R in this._eventsInProgress){const{handlerName:z,originalEvent:q}=this._eventsInProgress[R];this._handlersById[z].isActive()||(delete this._eventsInProgress[R],L=h[z]||q,C[`${R}end`]=L)}for(const R in C)this._fireEvent(R,C[R]);const A=be(this._eventsInProgress);if(d&&(g||y)&&!A){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=q=>q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new ke("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class wp extends u.E{constructor(o,h){super(),this._renderFrameCallback=()=>{const d=Math.min((P.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=o,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(o,h){return this.jumpTo({center:o},h)}panBy(o,h,d){return o=u.P.convert(o).mult(-1),this.panTo(this.transform.center,u.e({offset:o},h),d)}panTo(o,h,d){return this.easeTo(u.e({center:o},h),d)}getZoom(){return this.transform.zoom}setZoom(o,h){return this.jumpTo({zoom:o},h),this}zoomTo(o,h,d){return this.easeTo(u.e({zoom:o},h),d)}zoomIn(o,h){return this.zoomTo(this.getZoom()+1,o,h),this}zoomOut(o,h){return this.zoomTo(this.getZoom()-1,o,h),this}getBearing(){return this.transform.bearing}setBearing(o,h){return this.jumpTo({bearing:o},h),this}getPadding(){return this.transform.padding}setPadding(o,h){return this.jumpTo({padding:o},h),this}rotateTo(o,h,d){return this.easeTo(u.e({bearing:o},h),d)}resetNorth(o,h){return this.rotateTo(0,u.e({duration:1e3},o),h),this}resetNorthPitch(o,h){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},o),h),this}snapToNorth(o,h){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=u.z.number(g,L,Pt)),this._rotating&&(d.bearing=u.z.number(y,A,Pt)),this._pitching&&(d.pitch=u.z.number(E,R,Pt)),this._padding&&(d.interpolatePadding(C,z,Pt),et=d.centerPoint.add(q)),this.terrain&&!o.freezeElevation&&this._updateElevation(Pt),st)d.setLocationAtPoint(st,yt);else{const Bt=d.zoomScale(d.zoom-g),qt=L>g?Math.min(2,Et):Math.max(.5,Et),Ut=Math.pow(qt,1-Pt),Ht=d.unproject(K.add(pt.mult(Pt*Ut)).mult(Bt));d.setLocationAtPoint(d.renderWorldCopies?Ht.wrap():Ht,et)}this._applyUpdatedTransform(d),this._fireMoveEvents(h)},Pt=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,Pt)},o),this}_prepareEase(o,h,d={}){this._moving=!0,h||d.moving||this.fire(new u.k("movestart",o)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",o)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",o)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&h!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(d-(h-(d*o+this._elevationStart))/(1-o)),this._elevationTarget=h}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,o)}_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(o){if(!this.transformCameraUpdate)return;const h=o.clone(),{center:d,zoom:g,pitch:y,bearing:E,elevation:C}=this.transformCameraUpdate(h);d&&(h.center=d),g!==void 0&&(h.zoom=g),y!==void 0&&(h.pitch=y),E!==void 0&&(h.bearing=E),C!==void 0&&(h.elevation=C),this.transform.apply(h)}_fireMoveEvents(o){this.fire(new u.k("move",o)),this._zooming&&this.fire(new u.k("zoom",o)),this._rotating&&this.fire(new u.k("rotate",o)),this._pitching&&this.fire(new u.k("pitch",o))}_afterEase(o,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const d=this._zooming,g=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",o)),g&&this.fire(new u.k("rotateend",o)),y&&this.fire(new u.k("pitchend",o)),this.fire(new u.k("moveend",o))}flyTo(o,h){if(!o.essential&&P.prefersReducedMotion){const ye=u.L(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ye,h)}this.stop(),o=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b6},o);const d=this._getTransformForUpdate(),g=this.getZoom(),y=this.getBearing(),E=this.getPitch(),C=this.getPadding(),L="zoom"in o?u.ac(+o.zoom,d.minZoom,d.maxZoom):g,A="bearing"in o?this._normalizeBearing(o.bearing,y):y,R="pitch"in o?+o.pitch:E,z="padding"in o?o.padding:d.padding,q=d.zoomScale(L-g),et=u.P.convert(o.offset);let Q=d.centerPoint.add(et);const nt=d.pointLocation(Q),K=u.M.convert(o.center||nt);this._normalizeCenter(K);const pt=d.project(nt),Et=d.project(K).sub(pt);let st=o.curve;const yt=Math.max(d.width,d.height),kt=yt/q,Pt=Et.mag();if("minZoom"in o){const ye=u.ac(Math.min(o.minZoom,g,L),d.minZoom,d.maxZoom),Yn=yt/d.zoomScale(ye-g);st=Math.sqrt(Yn/Pt*2)}const Bt=st*st;function qt(ye){const Yn=(kt*kt-yt*yt+(ye?-1:1)*Bt*Bt*Pt*Pt)/(2*(ye?kt:yt)*Bt*Pt);return Math.log(Math.sqrt(Yn*Yn+1)-Yn)}function Ut(ye){return(Math.exp(ye)-Math.exp(-ye))/2}function Ht(ye){return(Math.exp(ye)+Math.exp(-ye))/2}const me=qt(!1);let Ae=function(ye){return Ht(me)/Ht(me+st*ye)},re=function(ye){return yt*((Ht(me)*(Ut(Yn=me+st*ye)/Ht(Yn))-Ut(me))/Bt)/Pt;var Yn},Pe=(qt(!0)-me)/st;if(Math.abs(Pt)<1e-6||!isFinite(Pe)){if(Math.abs(yt-kt)<1e-6)return this.easeTo(o,h);const ye=kto.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=y!==A,this._pitching=R!==E,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(K),this._ease(ye=>{const Yn=ye*Pe,an=1/Ae(Yn);d.zoom=ye===1?L:g+d.scaleZoom(an),this._rotating&&(d.bearing=u.z.number(y,A,ye)),this._pitching&&(d.pitch=u.z.number(E,R,ye)),this._padding&&(d.interpolatePadding(C,z,ye),Q=d.centerPoint.add(et)),this.terrain&&!o.freezeElevation&&this._updateElevation(ye);const Je=ye===1?K:d.unproject(pt.add(Et.mult(re(Yn))).mult(an));d.setLocationAtPoint(d.renderWorldCopies?Je.wrap():Je,Q),this._applyUpdatedTransform(d),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,h)}if(!o){const d=this.handlers;d&&d.stop(!1)}return this}_ease(o,h,d){d.animate===!1||d.duration===0?(o(1),h()):(this._easeStart=P.now(),this._easeOptions=d,this._onEaseFrame=o,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,h){o=u.b0(o,-180,180);const d=Math.abs(o-h);return Math.abs(o-360-h)180?-360:d<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const qr={compact:!0,customAttribution:'MapLibre'};class Ip{constructor(o=qr){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,this._compact=this.options.compact,this._container=k.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=k.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=k.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(){k.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(o,h){const d=this._map._getUIString(`AttributionControl.${h}`);o.title=d,o.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&o.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const y=h[g];if(y.used||y.usedForTerrain){const E=y.getSource();E.attribution&&o.indexOf(E.attribution)<0&&o.push(E.attribution)}}o=o.filter(g=>String(g).trim()),o.sort((g,y)=>g.length-y.length),o=o.filter((g,y)=>{for(let E=y+1;E=0)return!1;return!0});const d=o.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,o.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 is{constructor(o={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const d=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,this._compact=this.options&&this.options.compact,this._container=k.create("div","maplibregl-ctrl");const h=k.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){k.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class xg{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const h=++this._id;return this._queue.push({callback:o,id:h,cancelled:!1}),h}remove(o){const h=this._currentlyRunning,d=h?this._queue.concat(h):this._queue;for(const g of d)if(g.id===o)return void(g.cancelled=!0)}run(o=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const d of h)if(!d.cancelled&&(d.callback(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var zu=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class hi extends u.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,h){this.sourceCache.update(o,h),this._renderableTilesKeys=[];const d={};for(const g of o.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),u.aN(g.posMatrix,0,u.W,0,u.W,0,1),this._tiles[g.key]=new No(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(o){for(const h in this._tiles){const d=this._tiles[h];(!o||d.tileID.equals(o)||d.tileID.isChildOf(o)||o.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const h={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(o.canonical)){const y=o.clone();y.posMatrix=new Float64Array(16),u.aN(y.posMatrix,0,u.W,0,u.W,0,1),h[d]=y}else if(g.canonical.isChildOf(o.canonical)){const y=o.clone();y.posMatrix=new Float64Array(16);const E=g.canonical.z-o.canonical.z,C=g.canonical.x-(g.canonical.x>>E<>E<>E;u.aN(y.posMatrix,0,A,0,A,0,1),u.H(y.posMatrix,y.posMatrix,[-C*A,-L*A,0]),h[d]=y}else if(o.canonical.isChildOf(g.canonical)){const y=o.clone();y.posMatrix=new Float64Array(16);const E=o.canonical.z-g.canonical.z,C=o.canonical.x-(o.canonical.x>>E<>E<>E;u.aN(y.posMatrix,0,u.W,0,u.W,0,1),u.H(y.posMatrix,y.posMatrix,[C*A,L*A,0]),u.J(y.posMatrix,y.posMatrix,[1/2**E,1/2**E,0]),h[d]=y}}return h}getSourceTile(o,h){const d=this.sourceCache._source;let g=o.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(o.scaledTo(g--).key);return y}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=o)}}class Si{constructor(o,h,d){this.painter=o,this.sourceCache=new hi(h),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(o,h,d,g=u.W){var y;if(!(h>=0&&h=0&&do.canonical.z&&(o.canonical.z>=g?y=o.canonical.z-g:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const E=o.canonical.x-(o.canonical.x>>y<>y<>8<<4|y>>8,h[E+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new Ct(o,d,o.gl.RGBA,{premultiply:!1});return g.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(o){const h=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(o.x,this.painter.height/devicePixelRatio-o.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),d.bindFramebuffer.set(null);const y=h[0]+(h[2]>>4<<8),E=h[1]+((15&h[2])<<8),C=this.coordsIndex[255-h[3]],L=C&&this.sourceCache.getTileByID(C);if(!L)return null;const A=this._coordsTextureSize,R=(1<o.id!==h),this._recentlyUsed.push(o.id)}stampObject(o){o.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length!o.inUse)===!1}}const Ss={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hc{constructor(o,h){this.painter=o,this.terrain=h,this.pool=new Nd(o.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(d=>!o._layers[d].isHidden(h)),this._coordsDescendingInv={};for(const d in o.sourceCaches){this._coordsDescendingInv[d]={};const g=o.sourceCaches[d].getVisibleCoordinates();for(const y of g){const E=this.terrain.sourceCache.getTerrainCoords(y);for(const C in E)this._coordsDescendingInv[d][C]||(this._coordsDescendingInv[d][C]=[]),this._coordsDescendingInv[d][C].push(E[C])}}this._coordsDescendingInvStr={};for(const d of o._order){const g=o._layers[d],y=g.source;if(Ss[g.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const E in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][E]=this._coordsDescendingInv[y][E].map(C=>C.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[g][d.tileID.key];y&&y!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(o){if(o.isHidden(this.painter.transform.zoom))return!1;const h=o.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Ss[h]&&(this._prevType&&Ss[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(o.id),!g))return!0;if(Ss[this._prevType]||Ss[h]&&g){this._prevType=h;const y=this._stacks.length-1,E=this._stacks[y]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Vc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[y]){const A=this.pool.getObjectForId(C.rtt[y].id);if(A.stamp===C.rtt[y].stamp){this.pool.useObject(A);continue}}const L=this.pool.getOrCreateFreeObject();this.pool.useObject(L),this.pool.stampObject(L),C.rtt[y]={id:L.id,stamp:L.stamp},d.context.bindFramebuffer.set(L.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let A=0;A{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Tp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Lp{constructor(o,h,d=!1){this.mousedown=E=>{this.startMouse(u.e({},E,{ctrlKey:!0,preventDefault:()=>E.preventDefault()}),k.mousePos(this.element,E)),k.addEventListener(window,"mousemove",this.mousemove),k.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=E=>{this.moveMouse(E,k.mousePos(this.element,E))},this.mouseup=E=>{this.mouseRotate.dragEnd(E),this.mousePitch&&this.mousePitch.dragEnd(E),this.offTemp()},this.touchstart=E=>{E.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=k.touchPos(this.element,E.targetTouches)[0],this.startTouch(E,this._startPos),k.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.addEventListener(window,"touchend",this.touchend))},this.touchmove=E=>{E.targetTouches.length!==1?this.reset():(this._lastPos=k.touchPos(this.element,E.targetTouches)[0],this.moveTouch(E,this._lastPos))},this.touchend=E=>{E.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=o.dragRotate._mouseRotate.getClickTolerance(),y=o.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=yp({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:E,clickTolerance:C,bearingDegreesPerPixelMoved:L=.8})=>{const A=new na;return new ku({clickTolerance:C,move:(R,z)=>({bearingDelta:(z.x-R.x)*L}),moveStateManager:A,enable:E,assignEvents:jl})})({clickTolerance:g,enable:!0}),this.map=o,d&&(this.mousePitch=Gl({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:E,clickTolerance:C,pitchDegreesPerPixelMoved:L=-.5})=>{const A=new na;return new ku({clickTolerance:C,move:(R,z)=>({pitchDelta:(z.y-R.y)*L}),moveStateManager:A,enable:E,assignEvents:jl})})({clickTolerance:y,enable:!0})),k.addEventListener(h,"mousedown",this.mousedown),k.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),k.addEventListener(h,"touchcancel",this.reset)}startMouse(o,h){this.mouseRotate.dragStart(o,h),this.mousePitch&&this.mousePitch.dragStart(o,h),k.disableDrag()}startTouch(o,h){this.touchRotate.dragStart(o,h),this.touchPitch&&this.touchPitch.dragStart(o,h),k.disableDrag()}moveMouse(o,h){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(o,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(o,h)||{};y&&d.setPitch(d.getPitch()+y)}}moveTouch(o,h){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(o,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(o,h)||{};y&&d.setPitch(d.getPitch()+y)}}off(){const o=this.element;k.removeEventListener(o,"mousedown",this.mousedown),k.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend),k.removeEventListener(o,"touchcancel",this.reset),this.offTemp()}offTemp(){k.enableDrag(),k.removeEventListener(window,"mousemove",this.mousemove),k.removeEventListener(window,"mouseup",this.mouseup),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend)}}let ia;function Xc(_,o,h){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),o){const g=new u.M(_.lng-360,_.lat),y=new u.M(_.lng+360,_.lat),E=h.locationPoint(_).distSqr(o);h.locationPoint(g).distSqr(o)180;){const g=h.locationPoint(_);if(g.x>=0&&g.y>=0&&g.x<=h.width&&g.y<=h.height)break;_.lng>h.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&h.locationPoint(_).y>h.height/2-h.getHorizon()?_:d}const Ou={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 Yc(_,o,h){const d=_.classList;for(const g in Ou)d.remove(`maplibregl-${h}-anchor-${g}`);d.add(`maplibregl-${h}-anchor-${o}`)}class Fu extends u.E{constructor(o){if(super(),this._onKeyPress=h=>{const d=h.code,g=h.charCode||h.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const d=h.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=h=>{var d;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Xc(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 y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let E="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?E="rotateX(0deg)":this._pitchAlignment==="map"&&(E=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),k.setTransform(this._element,`${Ou[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${E} ${y}`),P.frameAsync(new AbortController).then(()=>{this._updateOpacity(h&&h.type==="moveend")}).catch(()=>{})},this._onMove=h=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=h.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new 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=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=u.P.convert(o&&o.offset||[0,0]);else{this._defaultMarker=!0,this._element=k.create("div"),this._element.setAttribute("aria-label","Map marker");const h=k.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const y=k.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const E=k.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill-rule","nonzero");const C=k.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const L=[{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 pt of L){const Et=k.createNS("http://www.w3.org/2000/svg","ellipse");Et.setAttributeNS(null,"opacity","0.04"),Et.setAttributeNS(null,"cx","10.5"),Et.setAttributeNS(null,"cy","5.80029008"),Et.setAttributeNS(null,"rx",pt.rx),Et.setAttributeNS(null,"ry",pt.ry),C.appendChild(Et)}const A=k.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"fill",this._color);const R=k.createNS("http://www.w3.org/2000/svg","path");R.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),A.appendChild(R);const z=k.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const q=k.createNS("http://www.w3.org/2000/svg","path");q.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),z.appendChild(q);const et=k.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"transform","translate(6.0, 7.0)"),et.setAttributeNS(null,"fill","#FFFFFF");const Q=k.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const nt=k.createNS("http://www.w3.org/2000/svg","circle");nt.setAttributeNS(null,"fill","#000000"),nt.setAttributeNS(null,"opacity","0.25"),nt.setAttributeNS(null,"cx","5.5"),nt.setAttributeNS(null,"cy","5.5"),nt.setAttributeNS(null,"r","5.4999962");const K=k.createNS("http://www.w3.org/2000/svg","circle");K.setAttributeNS(null,"fill","#FFFFFF"),K.setAttributeNS(null,"cx","5.5"),K.setAttributeNS(null,"cy","5.5"),K.setAttributeNS(null,"r","5.4999962"),Q.appendChild(nt),Q.appendChild(K),E.appendChild(C),E.appendChild(A),E.appendChild(z),E.appendChild(et),E.appendChild(Q),h.appendChild(E),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=u.P.convert(o&&o.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),Yc(this._element,this._anchor,"marker"),o&&o.className)for(const h of o.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(o){return this.remove(),this._map=o,o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.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),k.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=u.M.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const g=Math.abs(13.5)/Math.SQRT2;o.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=o,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 o=this._popup;return o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!1){var h;if(!(!((h=this._map)===null||h===void 0)&&h.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(o)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const d=this._map,g=d.terrain.depthAtPoint(this._pos),y=d.terrain.getElevationForLngLatZoom(this._lngLat,d.transform.tileZoom);if(d.transform.lngLatToCameraDepth(this._lngLat,y)-g<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/d.transform._pixelPerMeter,C=Math.sin(d.getPitch()*Math.PI/180)*E,L=d.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),A=d.transform.lngLatToCameraDepth(this._lngLat,y+C);this._element.style.opacity=A-L>.006?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(o){return this._offset=u.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(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(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,h){return o===void 0&&h===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),h!==void 0&&(this._opacityWhenCovered=h),this._map&&this._updateOpacity(!0),this}}const Pp={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let al=0,ll=!1;const Mp={maxWidth:100,unit:"metric"};function Bu(_,o,h){const d=h&&h.maxWidth||100,g=_._container.clientHeight/2,y=_.unproject([0,g]),E=_.unproject([d,g]),C=y.distanceTo(E);if(h&&h.unit==="imperial"){const L=3.2808*C;L>5280?ul(o,d,L/5280,_._getUIString("ScaleControl.Miles")):ul(o,d,L,_._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?ul(o,d,C/1852,_._getUIString("ScaleControl.NauticalMiles")):C>=1e3?ul(o,d,C/1e3,_._getUIString("ScaleControl.Kilometers")):ul(o,d,C,_._getUIString("ScaleControl.Meters"))}function ul(_,o,h,d){const g=function(y){const E=Math.pow(10,`${Math.floor(y)}`.length-1);let C=y/E;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(L){const A=Math.pow(10,Math.ceil(-Math.log(L)/Math.LN10));return Math.round(L*A)/A}(C),E*C}(h);_.style.width=o*(g/h)+"px",_.innerHTML=`${g} ${d}`}const Ap={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},kp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Kc(_){if(_){if(typeof _=="number"){const o=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(o,o),"top-right":new u.P(-o,o),bottom:new u.P(0,-_),"bottom-left":new u.P(o,-o),"bottom-right":new u.P(-o,-o),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const o=u.P.convert(_);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}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 Kc(new u.P(0,0))}const Dp=b;p.AJAXError=u.bd,p.Evented=u.E,p.LngLat=u.M,p.MercatorCoordinate=u.Y,p.Point=u.P,p.addProtocol=u.be,p.config=u.a,p.removeProtocol=u.bf,p.AttributionControl=Ip,p.BoxZoomHandler=gp,p.CanvasSource=ws,p.CooperativeGesturesHandler=Nu,p.DoubleClickZoomHandler=Wc,p.DragPanHandler=xp,p.DragRotateHandler=Rd,p.EdgeInsets=Vl,p.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var o;let h=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=h==null?void 0:h.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===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=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){k.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=k.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);k.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()}},p.GeoJSONSource=Qe,p.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const h=new u.M(o.coords.longitude,o.coords.latitude),d=o.coords.accuracy,g=this._map.getBearing(),y=u.e({bearing:g},this.options.fitBoundsOptions),E=Ie.fromLngLat(h,d);this._map.fitBounds(E,y,{geolocateSource:!0})},this._updateMarker=o=>{if(o){const h=new u.M(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=o.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=o=>{if(this._map){if(this.options.trackUserLocation)if(o.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&ll)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=o=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=k.create("button","maplibregl-ctrl-geolocate",this._container),k.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=k.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Fu({element:this._dotElement}),this._circleElement=k.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fu({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",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},Pp,_)}onAdd(_){return this._map=_,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(o=!1){return u._(this,void 0,void 0,function*(){if(ia!==void 0&&!o)return ia;if(window.navigator.permissions===void 0)return ia=!!window.navigator.geolocation,ia;try{ia=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ia=!!window.navigator.geolocation}return ia})}().then(o=>this._setupUI(o)),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(),k.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,al=0,ll=!1}_isOutOfMapMaxBounds(_){const o=this._map.getMaxBounds(),h=_.coords;return o&&(h.longitudeo.getEast()||h.latitudeo.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(),o=_.getSouthEast(),h=_.getNorthEast(),d=o.distanceTo(h),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return 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":al--,ll=!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"),al++,al>1?(_={maximumAge:6e5,timeout:0},ll=!0):(_=this.options.positionOptions,ll=!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)}},p.Hash=mp,p.ImageSource=fr,p.KeyboardHandler=Ad,p.LngLatBounds=Ie,p.LogoControl=is,p.Map=class extends wp{constructor(_){if(u.bb.mark(u.bc.create),(_=u.e({},Cp,_)).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 Uc(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=o=>{o.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.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 xg,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},Ep,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=X.addThrottleControl(()=>this.isMoving()),this._requestManager=new ht(_.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 o=!1;const h=dp(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{o?h(d):o=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bp(this,_),this._hash=_.hash&&new mp(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 Ip(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new is,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new u.k(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new u.k(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new u.k("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(_,o){if(o===void 0&&(o=_.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 h=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[o];return o.indexOf("bottom")!==-1?d.insertBefore(h,d.firstChild):d.appendChild(h),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 o=this._controls.indexOf(_);return o>-1&&this._controls.splice(o,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,o,h,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,o,h,d)}resize(_){var o;const h=this._containerDimensions(),d=h[0],g=h[1],y=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,y),this.painter.resize(d,g,y),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const L=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,L),this.painter.resize(d,g,L)}this.transform.resize(d,g),(o=this._requestedCameraState)===null||o===void 0||o.resize(d,g);const E=!this._moving;return E&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),E&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,o){const{0:h,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),y=_*g,E=o*g;return Math.min(y>h?h/y:1,E>d?d/E:1)*g}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(Ie.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(_,o,h){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:o,listener:h,delegates:{mousemove:y=>{const E=this.getLayer(o)?this.queryRenderedFeatures(y.point,{layers:[o]}):[];E.length?d||(d=!0,h.call(this,new ro(_,this,y.originalEvent,{features:E}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:o,listener:h,delegates:{mousemove:E=>{(this.getLayer(o)?this.queryRenderedFeatures(E.point,{layers:[o]}):[]).length?d=!0:d&&(d=!1,h.call(this,new ro(_,this,E.originalEvent)))},mouseout:E=>{d&&(d=!1,h.call(this,new ro(_,this,E.originalEvent)))}}}}{const d=g=>{const y=this.getLayer(o)?this.queryRenderedFeatures(g.point,{layers:[o]}):[];y.length&&(g.features=y,h.call(this,g),delete g.features)};return{layer:o,listener:h,delegates:{[_]:d}}}}on(_,o,h){if(h===void 0)return super.on(_,o);const d=this._createDelegatedListener(_,o,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(_,o,h){if(h===void 0)return super.once(_,o);const d=this._createDelegatedListener(_,o,h);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(_,o,h){return h===void 0?super.off(_,o):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const g=this._delegatedListeners[_];for(let y=0;ythis._updateStyle(_,o));const h=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new xo(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,o,h):this.style.loadJSON(_,o,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new xo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,o){if(typeof _=="string"){const h=this._requestManager.transformRequest(_,J.Style);u.h(h,new AbortController).then(d=>{this._updateDiff(d.data,o)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,o)}_updateDiff(_,o){try{this.style.setState(_,o)&&this._update(!0)}catch(h){u.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(_,o)}}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(_,o){return this._lazyInitEmptyStyle(),this.style.addSource(_,o),this._update(!0)}isSourceLoaded(_){const o=this.style&&this.style.sourceCaches[_];if(o!==void 0)return o.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 o=this.style.sourceCaches[_.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&o.reload();for(const h in this.style._layers){const d=this.style._layers[h];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 Si(this.painter,o,_),this.painter.renderToTexture=new Hc(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=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.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(h.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,o;return(o=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const o in _){const h=_[o]._tiles;for(const d in h){const g=h[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,o,h={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:y,stretchY:E,content:C}=h;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||u.b(o))){if(o.width===void 0||o.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:L,height:A,data:R}=o,z=o;return this.style.addImage(_,{data:new u.R({width:L,height:A},new Uint8Array(R)),pixelRatio:d,stretchX:y,stretchY:E,content:C,sdf:g,version:0,userImage:z}),z.onAdd&&z.onAdd(this,_),this}}{const{width:L,height:A,data:R}=P.getImageData(o);this.style.addImage(_,{data:new u.R({width:L,height:A},R),pixelRatio:d,stretchX:y,stretchY:E,content:C,sdf:g,version:0})}}updateImage(_,o){const h=this.style.getImage(_);if(!h)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=o instanceof HTMLImageElement||u.b(o)?P.getImageData(o):o,{width:g,height:y,data:E}=d;if(g===void 0||y===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(g!==h.data.width||y!==h.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 C=!(o instanceof HTMLImageElement||u.b(o));return h.data.replace(E,C),this.style.updateImage(_,h),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 X.getImage(this._requestManager.transformRequest(_,J.Image),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,o){return this._lazyInitEmptyStyle(),this.style.addLayer(_,o),this._update(!0)}moveLayer(_,o){return this.style.moveLayer(_,o),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,o,h){return this.style.setLayerZoomRange(_,o,h),this._update(!0)}setFilter(_,o,h={}){return this.style.setFilter(_,o,h),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,o,h,d={}){return this.style.setPaintProperty(_,o,h,d),this._update(!0)}getPaintProperty(_,o){return this.style.getPaintProperty(_,o)}setLayoutProperty(_,o,h,d={}){return this.style.setLayoutProperty(_,o,h,d),this._update(!0)}getLayoutProperty(_,o){return this.style.getLayoutProperty(_,o)}setGlyphs(_,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,o,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,o,h,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,o,h=>{h||this._update(!0)}),this}setLight(_,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,o),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,o){return this.style.setFeatureState(_,o),this._update()}removeFeatureState(_,o){return this.style.removeFeatureState(_,o),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,o=0;return this._container&&(_=this._container.clientWidth||400,o=this._container.clientHeight||300),[_,o]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const o=this._canvasContainer=k.create("div","maplibregl-canvas-container",_);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=k.create("canvas","maplibregl-canvas",o),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const h=this._containerDimensions(),d=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],d);const g=this._controlContainer=k.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(E=>{y[E]=k.create("div",`maplibregl-ctrl-${E} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,o,h){this._canvas.width=Math.floor(h*_),this._canvas.height=Math.floor(h*o),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{o={requestedAttributes:_},d&&(o.statusMessage=d.statusMessage,o.type=d.type)},{once:!0});const h=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!h){const d="Failed to initialize WebGL";throw o?(o.message=d,new Error(JSON.stringify(o))):new Error(d)}this.painter=new wd(h,this.transform),B.testSupport(h)}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 o=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,y=P.now();this.style.zoomHistory.update(g,y);const E=new u.a8(g,{now:y,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=E.crossFadingFactor();C===1&&C===this._crossFadingFactor||(h=!0,this._crossFadingFactor=C),this.style.update(E)}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,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bb.mark(u.bc.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bb.mark(u.bc.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 h of this._controls)h.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),X.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),k.remove(this._canvasContainer),k.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bb.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,P.frameAsync(this._frameRequest).then(_=>{u.bb.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 Sp}getCameraTargetElevation(){return this.transform.elevation}},p.MapMouseEvent=ro,p.MapTouchEvent=Ul,p.MapWheelEvent=rl,p.Marker=Fu,p.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const o=this._map.getZoom(),h=o===this._map.getMaxZoom(),d=o===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const o=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=o},this._setButtonTitle=(o,h)=>{const d=this._map._getUIString(`NavigationControl.${h}`);o.title=d,o.setAttribute("aria-label",d)},this.options=u.e({},Tp,_),this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),k.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),k.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),this._compassIcon=k.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 Lp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){k.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(_,o){const h=k.create("button",_,this._container);return h.type="button",h.addEventListener("click",o),h}},p.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&k.remove(this._content),this._container&&(k.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=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{var h;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=k.create("div","maplibregl-popup",this._map.getContainer()),this._tip=k.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const C of this.options.className.split(" "))this._container.classList.add(C);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?Xc(this._lngLat,this._flatPos,this._map.transform):(h=this._lngLat)===null||h===void 0?void 0:h.wrap(),this._trackPointer&&!o)return;const d=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const y=Kc(this.options.offset);if(!g){const C=this._container.offsetWidth,L=this._container.offsetHeight;let A;A=d.y+y.bottom.ythis._map.transform.height-L?["bottom"]:[],d.xthis._map.transform.width-C/2&&A.push("right"),g=A.length===0?"bottom":A.join("-")}let E=d.add(y[g]);this.options.subpixelPositioning||(E=E.round()),k.setTransform(this._container,`${Ou[g]} translate(${E.x}px,${E.y}px)`),Yc(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Ap),_)}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 o=document.createDocumentFragment(),h=document.createElement("body");let d;for(h.innerHTML=_;d=h.firstChild,d;)o.appendChild(d);return this.setDOMContent(o)}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=k.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=k.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(kp);_&&_.focus()}},p.RasterDEMTileSource=Bi,p.RasterTileSource=sn,p.ScaleControl=class{constructor(_){this._onMove=()=>{Bu(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,Bu(this._map,this._container,this.options)},this.options=u.e({},Mp,_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){k.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},p.ScrollZoomHandler=Ru,p.Style=xo,p.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=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=k.create("button","maplibregl-ctrl-terrain",this._container),k.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(){k.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},p.TwoFingersTouchPitchHandler=vp,p.TwoFingersTouchRotateHandler=jc,p.TwoFingersTouchZoomHandler=Pd,p.TwoFingersTouchZoomRotateHandler=ns,p.VectorTileSource=Mt,p.VideoSource=$o,p.addSourceType=(_,o)=>u._(void 0,void 0,void 0,function*(){if(wr(_))throw new Error(`A source type called "${_}" already exists.`);((h,d)=>{Ia[h]=d})(_,o)}),p.clearPrewarmedResources=function(){const _=Wn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Rn),Wn=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()"))},p.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},p.getRTLTextPluginStatus=function(){return Wt().getRTLTextPluginStatus()},p.getVersion=function(){return Dp},p.getWorkerCount=function(){return qn.workerCount},p.getWorkerUrl=function(){return u.a.WORKER_URL},p.importScriptInWorkers=function(_){return yn().broadcast("importScript",_)},p.prewarm=function(){Kt().acquire(Rn)},p.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},p.setRTLTextPlugin=function(_,o){return Wt().setRTLTextPlugin(_,o)},p.setWorkerCount=function(_){qn.workerCount=_},p.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var c=n;return c})})(M1);var m2=M1.exports;const qh=P1(m2);function X0(t){let e;return n=>{if(n)for(let i in n){let a=e==null?void 0:e[i],c=n[i];a!==c&&t(i,c,a)}else if(e)for(let i in e)t(i,void 0,e[i]);e=n}}function g2(t,...e){let n=[t];for(let i of e)if(i)Array.isArray(i)&&i[0]===t?n.push(...i.slice(1)):n.push(i);else continue;if(n.length!==1)return n.length===2?n[1]:n}function _2(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function y_(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var wm=y2;function y2(t){var e,n,i;if(t){if(Array.isArray(t)){for(e=[],n=t.length,i=0;i{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function x2(t,e,n){let i,a,c,p,u,b,w,T,P,k,B,V,{$$slots:tt={},$$scope:ot}=e,{id:ut=Vf("layer")}=e,{source:W=void 0}=e,{sourceLayer:X=void 0}=e,{beforeId:J=void 0}=e,{beforeLayerType:ht=void 0}=e,{type:vt}=e,{paint:gt=void 0}=e,{layout:St=void 0}=e,{filter:It=void 0}=e,{applyToClusters:Ft=void 0}=e,{minzoom:mt=void 0}=e,{maxzoom:Ct=void 0}=e,{manageHoverState:ie=!1}=e,{hovered:Tt=null}=e,{interactive:ee=!0}=e,{hoverCursor:ge=void 0}=e,{eventsIfTopMost:Te=!1}=e;const Oe=Ff(),{map:on,source:gn,self:Re,minzoom:Me,maxzoom:Rn,eventTopMost:qn,layerInfo:Zn}=d2();Gn(t,on,Gt=>n(31,P=Gt)),Gn(t,gn,Gt=>n(32,k=Gt)),Gn(t,Re,Gt=>n(0,T=Gt)),Gn(t,Me,Gt=>n(34,V=Gt)),Gn(t,Rn,Gt=>n(33,B=Gt)),Il(()=>{T&&P&&(Zn.delete(T),P==null||P.removeLayer(T))});let Wn;function ri(Gt){var Mt,sn;if(!ee||!T||!P||Te&&qn(Gt)!==T)return;let Fe=Gt.features??[],Ie=(sn=(Mt=Fe[0])==null?void 0:Mt.properties)==null?void 0:sn.cluster_id,Ri={event:Gt,map:P,clusterId:Ie,layer:T,source:u,features:Fe};Oe(Gt.type,Ri)}function Kt(Gt){var Mt,sn;if(!ee||!T||!P||Te&&qn(Gt)!==T)return;ge&&(P.getCanvas().style.cursor=ge);let Fe=Gt.features??[];n(6,Tt=Fe[0]??null);let Ie=(sn=(Mt=Fe[0])==null?void 0:Mt.properties)==null?void 0:sn.cluster_id;Oe("mouseenter",{event:Gt,map:P,clusterId:Ie,layer:T,source:u,features:Fe})}function Ue(Gt){var Mt,sn,Bi;if(!ee||!P)return;if(Te&&qn(Gt)!==T){n(6,Tt=null),ie&&Wn!==void 0&&(P==null||P.setFeatureState({source:u,sourceLayer:X,id:Wn},{hover:!1}),Wn=void 0);return}P.getCanvas().style.cursor=ge;let Fe=Gt.features??[],Ie=(sn=(Mt=Fe[0])==null?void 0:Mt.properties)==null?void 0:sn.cluster_id,Ri=(Bi=Fe[0])==null?void 0:Bi.id;Ri!==Wn&&(ie&&(Wn!==void 0&&(P==null||P.setFeatureState({source:u,id:Wn,sourceLayer:X},{hover:!1})),P==null||P.setFeatureState({source:u,id:Ri,sourceLayer:X},{hover:!0})),Wn=Ri,n(6,Tt=Fe[0]??null)),Oe("mousemove",{event:Gt,map:P,clusterId:Ie,layer:T,source:u,features:Fe})}function yn(Gt){if(!(!ee||!T||!P)){if(ge&&(P.getCanvas().style.cursor=""),n(6,Tt=null),ie&&Wn!==void 0){const Fe={source:u,id:Wn,sourceLayer:X};P==null||P.setFeatureState(Fe,{hover:!1}),Wn=void 0}Oe("mouseleave",{map:P,layer:T,source:u})}}let br=!0;function er(Gt){P&&(P.off("click",Gt,ri),P.off("dblclick",Gt,ri),P.off("contextmenu",Gt,ri),P.off("mouseenter",Gt,Kt),P.off("mousemove",Gt,Ue),P.off("mouseleave",Gt,yn))}return Il(()=>{P&&T&&er(T)}),t.$$set=Gt=>{"id"in Gt&&n(7,ut=Gt.id),"source"in Gt&&n(8,W=Gt.source),"sourceLayer"in Gt&&n(9,X=Gt.sourceLayer),"beforeId"in Gt&&n(10,J=Gt.beforeId),"beforeLayerType"in Gt&&n(11,ht=Gt.beforeLayerType),"type"in Gt&&n(12,vt=Gt.type),"paint"in Gt&&n(13,gt=Gt.paint),"layout"in Gt&&n(14,St=Gt.layout),"filter"in Gt&&n(15,It=Gt.filter),"applyToClusters"in Gt&&n(16,Ft=Gt.applyToClusters),"minzoom"in Gt&&n(17,mt=Gt.minzoom),"maxzoom"in Gt&&n(18,Ct=Gt.maxzoom),"manageHoverState"in Gt&&n(19,ie=Gt.manageHoverState),"hovered"in Gt&&n(6,Tt=Gt.hovered),"interactive"in Gt&&n(20,ee=Gt.interactive),"hoverCursor"in Gt&&n(21,ge=Gt.hoverCursor),"eventsIfTopMost"in Gt&&n(22,Te=Gt.eventsIfTopMost),"$$scope"in Gt&&n(35,ot=Gt.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,i=_2(Ft)),t.$$.dirty[0]&1073774592&&n(24,a=g2("all",i,It)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,c=mt??V),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,p=Ct??B),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,u=W||k),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&P&&T!==ut&&u){T&&(er(T),Zn.delete(T));let Gt=J;if(!J&&ht){let Fe=P.getStyle().layers,Ie=typeof ht=="function"?ht:Mt=>Mt.type===ht,Ri=Fe==null?void 0:Fe.find(Ie);Ri&&(Gt=Ri.id)}Hu(Re,T=ut,T),P.addLayer(wm({id:T,type:vt,source:u,"source-layer":X,filter:a,paint:gt,layout:St,minzoom:c,maxzoom:p}),Gt),n(23,br=!0),P.on("click",T,ri),P.on("dblclick",T,ri),P.on("contextmenu",T,ri),P.on("mouseenter",T,Kt),P.on("mousemove",T,Ue),P.on("mouseleave",T,yn)}t.$$.dirty[0]&1048577&&T&&Zn.set(T,{interactive:ee}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,b=T?X0((Gt,Fe)=>P==null?void 0:P.setPaintProperty(T,Gt,Fe)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=T?X0((Gt,Fe)=>P==null?void 0:P.setLayoutProperty(T,Gt,Fe)):void 0),t.$$.dirty[0]&268443648&&(b==null||b(gt)),t.$$.dirty[0]&134234112&&(w==null||w(St)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&T&&(P==null||P.setLayerZoomRange(T,c,p)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&T&&(br?n(23,br=!1):P==null||P.setFilter(T,a))},[T,on,gn,Re,Me,Rn,Tt,ut,W,X,J,ht,vt,gt,St,It,Ft,mt,Ct,ie,ee,ge,Te,br,a,p,c,w,b,u,i,P,k,B,V,ot,tt]}class q_ extends Tn{constructor(e){super(),Cn(this,e,x2,v2,In,{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 b2(t){let e;const n=t[16].default,i=Os(n,t,t[24],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&16777216)&&Bs(i,n,a,a[24],e?Fs(n,a[24],c,null):Vs(a[24]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function w2(t){let e,n,i;function a(p){t[17](p)}let c={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[b2]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.hovered=t[0]),e=new q_({props:c}),Rr.push(()=>Ho(e,"hovered",a)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){cn(e.$$.fragment)},m(p,u){en(e,p,u),i=!0},p(p,[u]){const b={};u&2&&(b.id=p[1]),u&4&&(b.source=p[2]),u&8&&(b.sourceLayer=p[3]),u&16&&(b.beforeId=p[4]),u&32&&(b.beforeLayerType=p[5]),u&64&&(b.paint=p[6]),u&128&&(b.layout=p[7]),u&256&&(b.filter=p[8]),u&512&&(b.applyToClusters=p[9]),u&1024&&(b.minzoom=p[10]),u&2048&&(b.maxzoom=p[11]),u&4096&&(b.hoverCursor=p[12]),u&8192&&(b.manageHoverState=p[13]),u&16384&&(b.eventsIfTopMost=p[14]),u&32768&&(b.interactive=p[15]),u&16777216&&(b.$$scope={dirty:u,ctx:p}),!n&&u&1&&(n=!0,b.hovered=p[0],Wo(()=>n=!1)),e.$set(b)},i(p){i||(ne(e.$$.fragment,p),i=!0)},o(p){he(e.$$.fragment,p),i=!1},d(p){nn(e,p)}}}function I2(t,e,n){let{$$slots:i={},$$scope:a}=e,{id:c=Vf("circle")}=e,{source:p=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:T}=e,{layout:P=void 0}=e,{filter:k=void 0}=e,{applyToClusters:B=void 0}=e,{minzoom:V=void 0}=e,{maxzoom:tt=void 0}=e,{hoverCursor:ot=void 0}=e,{manageHoverState:ut=!1}=e,{hovered:W=null}=e,{eventsIfTopMost:X=!1}=e,{interactive:J=!0}=e;function ht(Ct){W=Ct,n(0,W)}function vt(Ct){Ji.call(this,t,Ct)}function gt(Ct){Ji.call(this,t,Ct)}function St(Ct){Ji.call(this,t,Ct)}function It(Ct){Ji.call(this,t,Ct)}function Ft(Ct){Ji.call(this,t,Ct)}function mt(Ct){Ji.call(this,t,Ct)}return t.$$set=Ct=>{"id"in Ct&&n(1,c=Ct.id),"source"in Ct&&n(2,p=Ct.source),"sourceLayer"in Ct&&n(3,u=Ct.sourceLayer),"beforeId"in Ct&&n(4,b=Ct.beforeId),"beforeLayerType"in Ct&&n(5,w=Ct.beforeLayerType),"paint"in Ct&&n(6,T=Ct.paint),"layout"in Ct&&n(7,P=Ct.layout),"filter"in Ct&&n(8,k=Ct.filter),"applyToClusters"in Ct&&n(9,B=Ct.applyToClusters),"minzoom"in Ct&&n(10,V=Ct.minzoom),"maxzoom"in Ct&&n(11,tt=Ct.maxzoom),"hoverCursor"in Ct&&n(12,ot=Ct.hoverCursor),"manageHoverState"in Ct&&n(13,ut=Ct.manageHoverState),"hovered"in Ct&&n(0,W=Ct.hovered),"eventsIfTopMost"in Ct&&n(14,X=Ct.eventsIfTopMost),"interactive"in Ct&&n(15,J=Ct.interactive),"$$scope"in Ct&&n(24,a=Ct.$$scope)},[W,c,p,u,b,w,T,P,k,B,V,tt,ot,ut,X,J,i,ht,vt,gt,St,It,Ft,mt,a]}class E2 extends Tn{constructor(e){super(),Cn(this,e,I2,w2,In,{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 S2(t){let e;const n=t[15].default,i=Os(n,t,t[23],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&8388608)&&Bs(i,n,a,a[23],e?Fs(n,a[23],c,null):Vs(a[23]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function C2(t){let e,n,i;function a(p){t[16](p)}let c={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[S2]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.hovered=t[0]),e=new q_({props:c}),Rr.push(()=>Ho(e,"hovered",a)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){cn(e.$$.fragment)},m(p,u){en(e,p,u),i=!0},p(p,[u]){const b={};u&2&&(b.id=p[1]),u&4&&(b.source=p[2]),u&8&&(b.sourceLayer=p[3]),u&16&&(b.beforeId=p[4]),u&32&&(b.beforeLayerType=p[5]),u&64&&(b.paint=p[6]),u&128&&(b.layout=p[7]),u&256&&(b.filter=p[8]),u&512&&(b.minzoom=p[9]),u&1024&&(b.maxzoom=p[10]),u&2048&&(b.hoverCursor=p[11]),u&4096&&(b.manageHoverState=p[12]),u&8192&&(b.eventsIfTopMost=p[13]),u&16384&&(b.interactive=p[14]),u&8388608&&(b.$$scope={dirty:u,ctx:p}),!n&&u&1&&(n=!0,b.hovered=p[0],Wo(()=>n=!1)),e.$set(b)},i(p){i||(ne(e.$$.fragment,p),i=!0)},o(p){he(e.$$.fragment,p),i=!1},d(p){nn(e,p)}}}function T2(t,e,n){let{$$slots:i={},$$scope:a}=e,{id:c=Vf("fill")}=e,{source:p=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:T}=e,{layout:P=void 0}=e,{filter:k=void 0}=e,{minzoom:B=void 0}=e,{maxzoom:V=void 0}=e,{hoverCursor:tt=void 0}=e,{manageHoverState:ot=!1}=e,{hovered:ut=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function J(mt){ut=mt,n(0,ut)}function ht(mt){Ji.call(this,t,mt)}function vt(mt){Ji.call(this,t,mt)}function gt(mt){Ji.call(this,t,mt)}function St(mt){Ji.call(this,t,mt)}function It(mt){Ji.call(this,t,mt)}function Ft(mt){Ji.call(this,t,mt)}return t.$$set=mt=>{"id"in mt&&n(1,c=mt.id),"source"in mt&&n(2,p=mt.source),"sourceLayer"in mt&&n(3,u=mt.sourceLayer),"beforeId"in mt&&n(4,b=mt.beforeId),"beforeLayerType"in mt&&n(5,w=mt.beforeLayerType),"paint"in mt&&n(6,T=mt.paint),"layout"in mt&&n(7,P=mt.layout),"filter"in mt&&n(8,k=mt.filter),"minzoom"in mt&&n(9,B=mt.minzoom),"maxzoom"in mt&&n(10,V=mt.maxzoom),"hoverCursor"in mt&&n(11,tt=mt.hoverCursor),"manageHoverState"in mt&&n(12,ot=mt.manageHoverState),"hovered"in mt&&n(0,ut=mt.hovered),"eventsIfTopMost"in mt&&n(13,W=mt.eventsIfTopMost),"interactive"in mt&&n(14,X=mt.interactive),"$$scope"in mt&&n(23,a=mt.$$scope)},[ut,c,p,u,b,w,T,P,k,B,V,tt,ot,W,X,i,J,ht,vt,gt,St,It,Ft,a]}class Gf extends Tn{constructor(e){super(),Cn(this,e,T2,C2,In,{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 L2(t,e,n){let i;const{map:a}=Uf();Gn(t,a,b=>n(4,i=b));let{position:c="top-left"}=e,{container:p=void 0}=e,u=null;return Il(()=>{i!=null&&i.loaded()&&u&&i.removeControl(u)}),t.$$set=b=>{"position"in b&&n(1,c=b.position),"container"in b&&n(2,p=b.container)},t.$$.update=()=>{if(t.$$.dirty&30&&i&&!u){let b;typeof p=="string"?b=document.querySelector(p)??void 0:b=p,n(3,u=new qh.FullscreenControl({container:b})),i.addControl(u,c)}},[a,c,p,u,i]}class P2 extends Tn{constructor(e){super(),Cn(this,e,L2,null,In,{position:1,container:2})}}function M2(t,e,n,i,a){let c=!1;t.getSource(e)&&(c=!0,t.removeSource(e));const p=()=>{i(e)&&(t.addSource(e,n),a())};if(c){const u=()=>{e&&(t.getSource(e)?setTimeout(u,1):p())};u()}else p()}function A2(t,e,n){i2().then(()=>{let i=_1(t);if(!i)return;i.getSource(e)===n&&i.removeSource(e)})}function J0(t){let e=t[0],n,i,a=Q0(t);return{c(){a.c(),n=Dl()},m(c,p){a.m(c,p),fe(c,n,p),i=!0},p(c,p){p&1&&In(e,e=c[0])?(us(),he(a,1,1,Ye),cs(),a=Q0(c),a.c(),ne(a,1),a.m(n.parentNode,n)):a.p(c,p)},i(c){i||(ne(a),i=!0)},o(c){he(a),i=!1},d(c){c&&pe(n),a.d(c)}}}function Q0(t){let e;const n=t[15].default,i=Os(n,t,t[14],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&16384)&&Bs(i,n,a,a[14],e?Fs(n,a[14],c,null):Vs(a[14]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function k2(t){let e,n,i=t[0]&&J0(t);return{c(){i&&i.c(),e=Dl()},m(a,c){i&&i.m(a,c),fe(a,e,c),n=!0},p(a,[c]){a[0]?i?(i.p(a,c),c&1&&ne(i,1)):(i=J0(a),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function D2(t,e,n){let i,a,c,{$$slots:p={},$$scope:u}=e,{id:b=Vf("geojson")}=e,{data:w}=e,{generateId:T=!1}=e,{promoteId:P=void 0}=e,{filter:k=void 0}=e,{lineMetrics:B=void 0}=e,{cluster:V=void 0}=e;const{map:tt,cluster:ot,self:ut}=f2();Gn(t,tt,J=>n(13,a=J)),Gn(t,ot,J=>n(16,c=J)),Gn(t,ut,J=>n(0,i=J));let W,X=!0;return Il(()=>{i&&W&&a&&(A2(tt,i,W),Hu(ut,i=null,i),n(11,W=void 0))}),t.$$set=J=>{"id"in J&&n(4,b=J.id),"data"in J&&n(5,w=J.data),"generateId"in J&&n(6,T=J.generateId),"promoteId"in J&&n(7,P=J.promoteId),"filter"in J&&n(8,k=J.filter),"lineMetrics"in J&&n(9,B=J.lineMetrics),"cluster"in J&&n(10,V=J.cluster),"$$scope"in J&&n(14,u=J.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Hu(ot,c=V,c),t.$$.dirty&12273&&a&&i!==b&&(Hu(ut,i=b,i),M2(a,i,wm({type:"geojson",data:w,filter:k,lineMetrics:B,generateId:T,promoteId:P,cluster:!!V,clusterMinPoints:V==null?void 0:V.minPoints,clusterMaxZoom:V==null?void 0:V.maxZoom,clusterRadius:V==null?void 0:V.radius,clusterProperties:V==null?void 0:V.properties}),J=>a&&J===i,()=>{i&&(n(11,W=a==null?void 0:a.getSource(i)),n(12,X=!0))})),t.$$.dirty&8208&&(a==null||a.on("style.load",()=>{n(11,W=a==null?void 0:a.getSource(b))})),t.$$.dirty&6176&&W&&(X?n(12,X=!1):W.setData(w)),t.$$.dirty&3072&&(W==null||W.setClusterOptions(wm({cluster:!!V,clusterMaxZoom:V==null?void 0:V.maxZoom,clusterRadius:V==null?void 0:V.radius})))},[i,tt,ot,ut,b,w,T,P,k,B,V,W,X,a,u,p]}class jh extends Tn{constructor(e){super(),Cn(this,e,D2,k2,In,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function R2(t,e,n){let i;const{map:a}=Uf();Gn(t,a,k=>n(8,i=k));let{position:c="top-left"}=e,{positionOptions:p=void 0}=e,{fitBoundsOptions:u=void 0}=e,{trackUserLocation:b=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:T=!0}=e,P=null;return Il(()=>{i!=null&&i.loaded()&&P&&i.removeControl(P)}),t.$$set=k=>{"position"in k&&n(1,c=k.position),"positionOptions"in k&&n(2,p=k.positionOptions),"fitBoundsOptions"in k&&n(3,u=k.fitBoundsOptions),"trackUserLocation"in k&&n(4,b=k.trackUserLocation),"showAccuracyCircle"in k&&n(5,w=k.showAccuracyCircle),"showUserLocation"in k&&n(6,T=k.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&i&&!P&&(n(7,P=new qh.GeolocateControl({positionOptions:p,fitBoundsOptions:u,trackUserLocation:b,showAccuracyCircle:w,showUserLocation:T})),i.addControl(P,c))},[a,c,p,u,b,w,T,P,i]}class N2 extends Tn{constructor(e){super(),Cn(this,e,R2,null,In,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function z2(t){let e;const n=t[15].default,i=Os(n,t,t[23],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&8388608)&&Bs(i,n,a,a[23],e?Fs(n,a[23],c,null):Vs(a[23]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function O2(t){let e,n,i;function a(p){t[16](p)}let c={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[z2]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.hovered=t[0]),e=new q_({props:c}),Rr.push(()=>Ho(e,"hovered",a)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){cn(e.$$.fragment)},m(p,u){en(e,p,u),i=!0},p(p,[u]){const b={};u&2&&(b.id=p[1]),u&4&&(b.source=p[2]),u&8&&(b.sourceLayer=p[3]),u&16&&(b.beforeId=p[4]),u&32&&(b.beforeLayerType=p[5]),u&64&&(b.paint=p[6]),u&128&&(b.layout=p[7]),u&256&&(b.filter=p[8]),u&512&&(b.minzoom=p[9]),u&1024&&(b.maxzoom=p[10]),u&2048&&(b.hoverCursor=p[11]),u&4096&&(b.manageHoverState=p[12]),u&8192&&(b.eventsIfTopMost=p[13]),u&16384&&(b.interactive=p[14]),u&8388608&&(b.$$scope={dirty:u,ctx:p}),!n&&u&1&&(n=!0,b.hovered=p[0],Wo(()=>n=!1)),e.$set(b)},i(p){i||(ne(e.$$.fragment,p),i=!0)},o(p){he(e.$$.fragment,p),i=!1},d(p){nn(e,p)}}}function F2(t,e,n){let{$$slots:i={},$$scope:a}=e,{id:c=Vf("line")}=e,{source:p=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:T}=e,{layout:P=void 0}=e,{filter:k=void 0}=e,{minzoom:B=void 0}=e,{maxzoom:V=void 0}=e,{hoverCursor:tt=void 0}=e,{manageHoverState:ot=!1}=e,{hovered:ut=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function J(mt){ut=mt,n(0,ut)}function ht(mt){Ji.call(this,t,mt)}function vt(mt){Ji.call(this,t,mt)}function gt(mt){Ji.call(this,t,mt)}function St(mt){Ji.call(this,t,mt)}function It(mt){Ji.call(this,t,mt)}function Ft(mt){Ji.call(this,t,mt)}return t.$$set=mt=>{"id"in mt&&n(1,c=mt.id),"source"in mt&&n(2,p=mt.source),"sourceLayer"in mt&&n(3,u=mt.sourceLayer),"beforeId"in mt&&n(4,b=mt.beforeId),"beforeLayerType"in mt&&n(5,w=mt.beforeLayerType),"paint"in mt&&n(6,T=mt.paint),"layout"in mt&&n(7,P=mt.layout),"filter"in mt&&n(8,k=mt.filter),"minzoom"in mt&&n(9,B=mt.minzoom),"maxzoom"in mt&&n(10,V=mt.maxzoom),"hoverCursor"in mt&&n(11,tt=mt.hoverCursor),"manageHoverState"in mt&&n(12,ot=mt.manageHoverState),"hovered"in mt&&n(0,ut=mt.hovered),"eventsIfTopMost"in mt&&n(13,W=mt.eventsIfTopMost),"interactive"in mt&&n(14,X=mt.interactive),"$$scope"in mt&&n(23,a=mt.$$scope)},[ut,c,p,u,b,w,T,P,k,B,V,tt,ot,W,X,i,J,ht,vt,gt,St,It,Ft,a]}class k1 extends Tn{constructor(e){super(),Cn(this,e,F2,O2,In,{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 B2(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,i),c=Math.round(e.lat*a)/a,p=Math.round(e.lng*a)/a,u=`${n}/${c}/${p}`,b=t.getBearing(),w=t.getPitch();return(b||w)&&(u+=`/${Math.round(b*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function V2(t){return t.replace("#","").split("/").map(parseFloat)}var am=j_;function j_(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?$0(t,e):{}.toString.call(t)=="[object Set]"?$0(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?G2(t,e):U2(t,e)}function U2(t,e){return t.toString()===e.toString()}function $0(t,e){var n=t.length;if(n!=e.length)return!1;for(var i=0;in(6,i=T));let{position:c="top-left"}=e,{showCompass:p=!0}=e,{showZoom:u=!0}=e,{visualizePitch:b=!1}=e,w=null;return Il(()=>{i!=null&&i.loaded()&&w&&i.removeControl(w)}),t.$$set=T=>{"position"in T&&n(1,c=T.position),"showCompass"in T&&n(2,p=T.showCompass),"showZoom"in T&&n(3,u=T.showZoom),"visualizePitch"in T&&n(4,b=T.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&i&&!w&&(n(5,w=new qh.NavigationControl({showCompass:p,showZoom:u,visualizePitch:b})),i.addControl(w,c))},[a,c,p,u,b,w,i]}class D1 extends Tn{constructor(e){super(),Cn(this,e,q2,null,In,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function j2(t,e,n){let i;const{map:a}=Uf();Gn(t,a,w=>n(5,i=w));let{position:c="bottom-left"}=e,{maxWidth:p=void 0}=e,{unit:u="metric"}=e,b=null;return Il(()=>{i!=null&&i.loaded()&&b&&i.removeControl(b)}),t.$$set=w=>{"position"in w&&n(1,c=w.position),"maxWidth"in w&&n(2,p=w.maxWidth),"unit"in w&&n(3,u=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&i&&!b&&(n(4,b=new qh.ScaleControl({maxWidth:p,unit:u})),i.addControl(b,c))},[a,c,p,u,b,i]}class R1 extends Tn{constructor(e){super(),Cn(this,e,j2,null,In,{position:1,maxWidth:2,unit:3})}}const Z2=t=>({map:t[0]&8,loadedImages:t[0]&16,allImagesLoaded:t[0]&32}),tv=t=>({map:t[3],loadedImages:t[4],allImagesLoaded:t[5]});function ev(t){let e,n,i=t[2]&&nv(t);const a=t[36].default,c=Os(a,t,t[35],tv);return{c(){i&&i.c(),e=qe(),c&&c.c()},m(p,u){i&&i.m(p,u),fe(p,e,u),c&&c.m(p,u),n=!0},p(p,u){p[2]?i?(i.p(p,u),u[0]&4&&ne(i,1)):(i=nv(p),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs()),c&&c.p&&(!n||u[0]&56|u[1]&16)&&Bs(c,a,p,p[35],n?Fs(a,p[35],u,Z2):Vs(p[35]),tv)},i(p){n||(ne(i),ne(c,p),n=!0)},o(p){he(i),he(c,p),n=!1},d(p){p&&pe(e),i&&i.d(p),c&&c.d(p)}}}function nv(t){let e,n,i,a,c,p,u,b;return e=new D1({props:{position:t[6]}}),i=new N2({props:{position:t[6],fitBoundsOptions:{maxZoom:12}}}),c=new P2({props:{position:t[6]}}),u=new R1({props:{position:t[6]}}),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment),a=qe(),cn(c.$$.fragment),p=qe(),cn(u.$$.fragment)},m(w,T){en(e,w,T),fe(w,n,T),en(i,w,T),fe(w,a,T),en(c,w,T),fe(w,p,T),en(u,w,T),b=!0},p(w,T){const P={};T[0]&64&&(P.position=w[6]),e.$set(P);const k={};T[0]&64&&(k.position=w[6]),i.$set(k);const B={};T[0]&64&&(B.position=w[6]),c.$set(B);const V={};T[0]&64&&(V.position=w[6]),u.$set(V)},i(w){b||(ne(e.$$.fragment,w),ne(i.$$.fragment,w),ne(c.$$.fragment,w),ne(u.$$.fragment,w),b=!0)},o(w){he(e.$$.fragment,w),he(i.$$.fragment,w),he(c.$$.fragment,w),he(u.$$.fragment,w),b=!1},d(w){w&&(pe(n),pe(a),pe(p)),nn(e,w),nn(i,w),nn(c,w),nn(u,w)}}}function W2(t){let e,n,i,a,c,p=t[3]&&t[0]&&ev(t);return{c(){e=se("div"),p&&p.c(),zt(e,"class",n=vm(t[1])+" svelte-p00lfq"),Ba(e,"expand-map",!t[1])},m(u,b){fe(u,e,b),p&&p.m(e,null),i=!0,a||(c=Jw(t[9].call(null,e)),a=!0)},p(u,b){u[3]&&u[0]?p?(p.p(u,b),b[0]&9&&ne(p,1)):(p=ev(u),p.c(),ne(p,1),p.m(e,null)):p&&(us(),he(p,1,1,()=>{p=null}),cs()),(!i||b[0]&2&&n!==(n=vm(u[1])+" svelte-p00lfq"))&&zt(e,"class",n),(!i||b[0]&2)&&Ba(e,"expand-map",!u[1])},i(u){i||(ne(p),i=!0)},o(u){he(p),i=!1},d(u){u&&pe(e),p&&p.d(),a=!1,c()}}}function H2(t,e,n){let i,a,c,p,{$$slots:u={},$$scope:b}=e,{map:w=null}=e,{class:T=void 0}=e,{style:P}=e,{diffStyleUpdates:k=!1}=e,{center:B=void 0}=e,{zoom:V=void 0}=e,{pitch:tt=0}=e,{bearing:ot=0}=e,{bounds:ut=void 0}=e,{hash:W=!1}=e,{loaded:X=!1}=e,{minZoom:J=0}=e,{maxZoom:ht=22}=e,{zoomOnDoubleClick:vt=!0}=e,{locale:gt=void 0}=e,{interactive:St=!0}=e,{attributionControl:It=!0}=e,{cooperativeGestures:Ft=!1}=e,{preserveDrawingBuffer:mt=!1}=e,{maxBounds:Ct=void 0}=e,{images:ie=[]}=e,{standardControls:Tt=!1}=e,{filterLayers:ee=void 0}=e,{transformRequest:ge=void 0}=e;const Te=Ff(),{map:Oe,loadedImages:on}=p2();Gn(t,Oe,Kt=>n(3,c=Kt)),Gn(t,on,Kt=>n(4,p=Kt));let gn=new Set;async function Re(Kt,Ue=!1){if(c&&!(!c.loaded()&&!Ue))if("url"in Kt){gn.add(Kt.id);try{let yn=await c.loadImage(Kt.url);c==null||c.addImage(Kt.id,yn.data,Kt.options),p.add(Kt.id),on.set(p)}catch(yn){Te("error",yn)}finally{gn.delete(Kt.id)}}else c.addImage(Kt.id,Kt.data,Kt.options),p.add(Kt.id),on.set(p)}let Me,Rn,qn,Zn;function Wn(Kt){if(W){let Ue=V2(window.location.hash);Ue.length>=3&&(n(11,V=Ue[0]),n(10,B=[Ue[2],Ue[1]])),Ue.length==5&&(n(15,ot=Ue[3]),n(14,tt=Ue[4]))}return Hu(Oe,c=new qh.Map(wm({container:Kt,style:P,locale:gt,center:B,zoom:V,pitch:tt,bearing:ot,minZoom:J,maxZoom:ht,interactive:St,preserveDrawingBuffer:mt,maxBounds:Ct,bounds:ut,attributionControl:It,transformRequest:ge,cooperativeGestures:Ft})),c),c.on("load",Ue=>{n(0,X=!0),Te("load",c)}),c.on("error",Ue=>Te("error",{...Ue,map:c})),c.on("movestart",Ue=>Te("movestart",{...Ue,map:c})),c.on("moveend",Ue=>{if(n(10,B=Ue.target.getCenter()),n(11,V=Ue.target.getZoom()),n(12,ut=Ue.target.getBounds()),Te("moveend",{...Ue,map:c}),W){let yn=window.location.href.replace(/(#.+)?$/,B2(c));window.history.replaceState(window.history.state,"",yn)}}),c.on("zoomstart",Ue=>Te("zoomstart",{...Ue,map:c})),c.on("zoom",Ue=>{n(11,V=Ue.target.getZoom()),Te("zoom",{...Ue,map:c})}),c.on("zoomend",Ue=>{n(11,V=Ue.target.getZoom()),Te("zoomend",{...Ue,map:c})}),c.on("style.load",()=>{if(c){const Ue=c.getStyle();if(n(32,Me=Ue.layers.map(yn=>yn.id)),n(33,Rn=Object.keys(Ue.sources)),Zn)for(const[yn,br]of Object.entries(Zn))c.addSource(yn,br);if(qn)for(const yn of qn)c.addLayer(yn);for(const yn of ie)Re(yn,!0)}}),c.on("styledata",Ue=>{if(c&&ee){const yn=c.getStyle().layers;if(yn)for(let br of yn)ee(br)||c.setLayoutProperty(br.id,"visibility","none")}Te("styledata",{...Ue,map:c})}),{destroy(){n(0,X=!1),c==null||c.remove(),Hu(Oe,c=null,c)}}}let ri=P;return t.$$set=Kt=>{"map"in Kt&&n(13,w=Kt.map),"class"in Kt&&n(1,T=Kt.class),"style"in Kt&&n(16,P=Kt.style),"diffStyleUpdates"in Kt&&n(17,k=Kt.diffStyleUpdates),"center"in Kt&&n(10,B=Kt.center),"zoom"in Kt&&n(11,V=Kt.zoom),"pitch"in Kt&&n(14,tt=Kt.pitch),"bearing"in Kt&&n(15,ot=Kt.bearing),"bounds"in Kt&&n(12,ut=Kt.bounds),"hash"in Kt&&n(18,W=Kt.hash),"loaded"in Kt&&n(0,X=Kt.loaded),"minZoom"in Kt&&n(19,J=Kt.minZoom),"maxZoom"in Kt&&n(20,ht=Kt.maxZoom),"zoomOnDoubleClick"in Kt&&n(21,vt=Kt.zoomOnDoubleClick),"locale"in Kt&&n(22,gt=Kt.locale),"interactive"in Kt&&n(23,St=Kt.interactive),"attributionControl"in Kt&&n(24,It=Kt.attributionControl),"cooperativeGestures"in Kt&&n(25,Ft=Kt.cooperativeGestures),"preserveDrawingBuffer"in Kt&&n(26,mt=Kt.preserveDrawingBuffer),"maxBounds"in Kt&&n(27,Ct=Kt.maxBounds),"images"in Kt&&n(28,ie=Kt.images),"standardControls"in Kt&&n(2,Tt=Kt.standardControls),"filterLayers"in Kt&&n(29,ee=Kt.filterLayers),"transformRequest"in Kt&&n(30,ge=Kt.transformRequest),"$$scope"in Kt&&n(35,b=Kt.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&4&&n(6,i=typeof Tt=="boolean"?void 0:Tt),t.$$.dirty[0]&8&&n(13,w=c),t.$$.dirty[0]&196616|t.$$.dirty[1]&14&&c&&!am(P,ri)){const Kt=c.getStyle();if(Me&&(qn=Kt.layers.filter(Ue=>!Me.includes(Ue.id))),Rn){const Ue=Object.keys(Kt.sources).filter(yn=>!Rn.includes(yn));Zn={};for(const yn of Ue)Zn[yn]=Kt.sources[yn]}n(34,ri=P),c.setStyle(P,{diff:k}),Hu(on,p=new Set,p),n(31,gn=new Set)}if(t.$$.dirty[0]&268435481|t.$$.dirty[1]&1&&X&&c!=null&&c.loaded())for(let Kt of ie)!p.has(Kt.id)&&!gn.has(Kt.id)&&!c.hasImage(Kt.id)&&Re(Kt);t.$$.dirty[0]&268435472&&n(5,a=ie.every(Kt=>p.has(Kt.id))),t.$$.dirty[0]&1032&&B&&!am(B,c==null?void 0:c.getCenter())&&(c==null||c.panTo(B)),t.$$.dirty[0]&2056&&V&&!am(V,c==null?void 0:c.getZoom())&&(c==null||c.zoomTo(V)),t.$$.dirty[0]&4104&&ut&&!am(ut,c==null?void 0:c.getBounds())&&(c==null||c.fitBounds(ut)),t.$$.dirty[0]&2097160&&(vt?c==null||c.doubleClickZoom.enable():c==null||c.doubleClickZoom.disable())},[X,T,Tt,c,p,a,i,Oe,on,Wn,B,V,ut,w,tt,ot,P,k,W,J,ht,vt,gt,St,It,Ft,mt,Ct,ie,ee,ge,gn,Me,Rn,ri,b,u]}class X2 extends Tn{constructor(e){super(),Cn(this,e,H2,W2,In,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,locale:22,interactive:23,attributionControl:24,cooperativeGestures:25,preserveDrawingBuffer:26,maxBounds:27,images:28,standardControls:2,filterLayers:29,transformRequest:30},null,[-1,-1])}}var qf=Uint8Array,N1=Uint16Array,Y2=Int32Array,K2=new qf([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]),J2=new qf([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]),z1=function(t,e){for(var n=new N1(31),i=0;i<31;++i)n[i]=e+=1<>1|(Vn&21845)<<1,gl=(gl&52428)>>2|(gl&13107)<<2,gl=(gl&61680)>>4|(gl&3855)<<4,tI[Vn]=((gl&65280)>>8|(gl&255)<<8)>>1;var gl,Vn,Bm=new qf(288);for(Vn=0;Vn<144;++Vn)Bm[Vn]=8;var Vn;for(Vn=144;Vn<256;++Vn)Bm[Vn]=9;var Vn;for(Vn=256;Vn<280;++Vn)Bm[Vn]=7;var Vn;for(Vn=280;Vn<288;++Vn)Bm[Vn]=8;var Vn,eI=new qf(32);for(Vn=0;Vn<32;++Vn)eI[Vn]=5;var Vn,nI=new qf(0),iI=typeof TextDecoder<"u"&&new TextDecoder,rI=0;try{iI.decode(nI,{stream:!0}),rI=1}catch{}let Yt;const F1=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&F1.decode();let of=null;function pf(){return(of===null||of.byteLength===0)&&(of=new Uint8Array(Yt.memory.buffer)),of}function Ki(t,e){return t=t>>>0,F1.decode(pf().subarray(t,t+e))}const _l=new Array(128).fill(void 0);_l.push(void 0,null,!0,!1);let ff=_l.length;function mr(t){ff===_l.length&&_l.push(_l.length+1);const e=ff;return ff=_l[e],_l[e]=t,e}function An(t){return _l[t]}let xl=0;const gm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},oI=typeof gm.encodeInto=="function"?function(t,e){return gm.encodeInto(t,e)}:function(t,e){const n=gm.encode(t);return e.set(n),{read:t.length,written:n.length}};function df(t,e,n){if(n===void 0){const u=gm.encode(t),b=e(u.length,1)>>>0;return pf().subarray(b,b+u.length).set(u),xl=u.length,b}let i=t.length,a=e(i,1)>>>0;const c=pf();let p=0;for(;p127)break;c[a+p]=u}if(p!==i){p!==0&&(t=t.slice(p)),a=n(a,i,i=p+t.length*3,1)>>>0;const u=pf().subarray(a+p,a+i),b=oI(t,u);p+=b.written}return xl=p,a}function u_(t){return t==null}let sf=null;function Ze(){return(sf===null||sf.byteLength===0)&&(sf=new Int32Array(Yt.memory.buffer)),sf}function sI(t){t<132||(_l[t]=ff,ff=t)}function Wu(t){const e=An(t);return sI(t),e}let af=null;function aI(){return(af===null||af.byteLength===0)&&(af=new Float64Array(Yt.memory.buffer)),af}function v_(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const a=t.description;return a==null?"Symbol":`Symbol(${a})`}if(e=="function"){const a=t.name;return typeof a=="string"&&a.length>0?`Function(${a})`:"Function"}if(Array.isArray(t)){const a=t.length;let c="[";a>0&&(c+=v_(t[0]));for(let p=1;p1)i=n[1];else return toString.call(t);if(i=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:i}function lI(t,e){const n=e(t.length*1,1)>>>0;return pf().set(t,n/1),xl=t.length,n}let lf=null;function uI(){return(lf===null||lf.byteLength===0)&&(lf=new Uint32Array(Yt.memory.buffer)),lf}function cI(t,e){t=t>>>0;const i=uI().subarray(t/4,t/4+e),a=[];for(let c=0;c>>0;const n=Object.create(Z_.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();Yt.__wbg_jsdebugstreets_free(e)}getLabel(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsdebugstreets_getLabel(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}getNetwork(){const e=Yt.jsdebugstreets_getNetwork(this.__wbg_ptr);return Wu(e)}toDebugGeojson(){try{const i=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsdebugstreets_toDebugGeojson(i,this.__wbg_ptr);var e=Ze()[i/4+0],n=Ze()[i/4+1];let a;return e!==0&&(a=Ki(e,n).slice(),Yt.__wbindgen_free(e,n*1,1)),a}finally{Yt.__wbindgen_add_to_stack_pointer(16)}}}class Vm{static __wrap(e){e=e>>>0;const n=Object.create(Vm.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();Yt.__wbg_jsstreetnetwork_free(e)}constructor(e,n,i){try{const u=Yt.__wbindgen_add_to_stack_pointer(-16),b=lI(e,Yt.__wbindgen_malloc),w=xl,T=df(n,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),P=xl;Yt.jsstreetnetwork_new(u,b,w,T,P,mr(i));var a=Ze()[u/4+0],c=Ze()[u/4+1],p=Ze()[u/4+2];if(p)throw Wu(c);return this.__wbg_ptr=a>>>0,this}finally{Yt.__wbindgen_add_to_stack_pointer(16)}}toGeojsonPlain(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toGeojsonPlain(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}toLanePolygonsGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toLanePolygonsGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}toLaneMarkingsGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toLaneMarkingsGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}toIntersectionMarkingsGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toIntersectionMarkingsGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}getDebugSteps(){try{const a=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_getDebugSteps(a,this.__wbg_ptr);var e=Ze()[a/4+0],n=Ze()[a/4+1],i=cI(e,n).slice();return Yt.__wbindgen_free(e,n*4,4),i}finally{Yt.__wbindgen_add_to_stack_pointer(16)}}debugClockwiseOrderingGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugClockwiseOrderingGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}debugClockwiseOrderingForIntersectionGeojson(e){let n,i;try{const p=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugClockwiseOrderingForIntersectionGeojson(p,this.__wbg_ptr,e);var a=Ze()[p/4+0],c=Ze()[p/4+1];return n=a,i=c,Ki(a,c)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}debugMovementsFromLaneGeojson(e,n){let i,a;try{const u=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugMovementsFromLaneGeojson(u,this.__wbg_ptr,e,n);var c=Ze()[u/4+0],p=Ze()[u/4+1];return i=c,a=p,Ki(c,p)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(i,a,1)}}debugRoadsConnectedToIntersectionGeojson(e){let n,i;try{const p=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugRoadsConnectedToIntersectionGeojson(p,this.__wbg_ptr,e);var a=Ze()[p/4+0],c=Ze()[p/4+1];return n=a,i=c,Ki(a,c)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}getOsmTagsForWay(e){let n,i;try{const T=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_getOsmTagsForWay(T,this.__wbg_ptr,e);var a=Ze()[T/4+0],c=Ze()[T/4+1],p=Ze()[T/4+2],u=Ze()[T/4+3],b=a,w=c;if(u)throw b=0,w=0,Wu(p);return n=b,i=w,Ki(b,w)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}toJson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toJson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}getGeometryForWay(e){let n,i;try{const p=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_getGeometryForWay(p,this.__wbg_ptr,e);var a=Ze()[p/4+0],c=Ze()[p/4+1];return n=a,i=c,Ki(a,c)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}wayToXml(e){let n,i;try{const T=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_wayToXml(T,this.__wbg_ptr,e);var a=Ze()[T/4+0],c=Ze()[T/4+1],p=Ze()[T/4+2],u=Ze()[T/4+3],b=a,w=c;if(u)throw b=0,w=0,Wu(p);return n=b,i=w,Ki(b,w)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}findBlock(e,n,i){let a,c;try{const k=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_findBlock(k,this.__wbg_ptr,e,n,i);var p=Ze()[k/4+0],u=Ze()[k/4+1],b=Ze()[k/4+2],w=Ze()[k/4+3],T=p,P=u;if(w)throw T=0,P=0,Wu(b);return a=T,c=P,Ki(T,P)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(a,c,1)}}findAllBlocks(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_findAllBlocks(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}overwriteOsmTagsForWay(e,n){const i=df(n,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),a=xl;Yt.jsstreetnetwork_overwriteOsmTagsForWay(this.__wbg_ptr,e,i,a)}collapseShortRoad(e){Yt.jsstreetnetwork_collapseShortRoad(this.__wbg_ptr,e)}collapseIntersection(e){Yt.jsstreetnetwork_collapseIntersection(this.__wbg_ptr,e)}zipSidepath(e){Yt.jsstreetnetwork_zipSidepath(this.__wbg_ptr,e)}}async function hI(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(i){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function pI(){const t={};return t.wbg={},t.wbg.__wbg_jsdebugstreets_new=function(e){const n=Z_.__wrap(e);return mr(n)},t.wbg.__wbindgen_string_new=function(e,n){const i=Ki(e,n);return mr(i)},t.wbg.__wbg_jsstreetnetwork_new=function(e){const n=Vm.__wrap(e);return mr(n)},t.wbg.__wbindgen_string_get=function(e,n){const i=An(n),a=typeof i=="string"?i:void 0;var c=u_(a)?0:df(a,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),p=xl;Ze()[e/4+1]=p,Ze()[e/4+0]=c},t.wbg.__wbindgen_object_drop_ref=function(e){Wu(e)},t.wbg.__wbindgen_boolean_get=function(e){const n=An(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_object=function(e){const n=An(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return An(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return An(e)in An(n)},t.wbg.__wbindgen_error_new=function(e,n){const i=new Error(Ki(e,n));return mr(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return An(e)==An(n)},t.wbg.__wbindgen_number_get=function(e,n){const i=An(n),a=typeof i=="number"?i:void 0;aI()[e/8+1]=u_(a)?0:a,Ze()[e/4+0]=!u_(a)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=An(e);return mr(n)},t.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(e,n){const i=An(e)[An(n)];return mr(i)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return mr(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const i=An(n).stack,a=df(i,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),c=xl;Ze()[e/4+1]=c,Ze()[e/4+0]=a},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let i,a;try{i=e,a=n,console.error(Ki(e,n))}finally{Yt.__wbindgen_free(i,a,1)}},t.wbg.__wbg_debug_2ef5d777cf4811fa=function(e){console.debug(An(e))},t.wbg.__wbg_error_f0a6627f4b23c19d=function(e){console.error(An(e))},t.wbg.__wbg_info_3ca7870690403fee=function(e){console.info(An(e))},t.wbg.__wbg_log_7811587c4c6d2844=function(e){console.log(An(e))},t.wbg.__wbg_warn_4affe1093892a4ef=function(e){console.warn(An(e))},t.wbg.__wbg_now_0669e62508913829=function(e){return An(e).now()},t.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(e,n){const i=new Function(Ki(e,n));return mr(i)},t.wbg.__wbg_get_7b48513de5dc5ea4=function(){return hh(function(e,n){const i=Reflect.get(An(e),An(n));return mr(i)},arguments)},t.wbg.__wbg_call_90c26b09837aba1c=function(){return hh(function(e,n){const i=An(e).call(An(n));return mr(i)},arguments)},t.wbg.__wbg_self_f0e34d89f33b99fd=function(){return hh(function(){const e=self.self;return mr(e)},arguments)},t.wbg.__wbg_window_d3b084224f4774d7=function(){return hh(function(){const e=window.window;return mr(e)},arguments)},t.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return hh(function(){const e=globalThis.globalThis;return mr(e)},arguments)},t.wbg.__wbg_global_35dfdd59a4da3e74=function(){return hh(function(){const e=global.global;return mr(e)},arguments)},t.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(e){let n;try{n=An(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_buffer_a448f833075b71ba=function(e){const n=An(e).buffer;return mr(n)},t.wbg.__wbg_new_8f67e318f15d7254=function(e){const n=new Uint8Array(An(e));return mr(n)},t.wbg.__wbg_set_2357bf09366ee480=function(e,n,i){An(e).set(An(n),i>>>0)},t.wbg.__wbg_length_1d25fa9e4ac21ce7=function(e){return An(e).length},t.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(e){let n;try{n=An(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const i=v_(An(n)),a=df(i,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),c=xl;Ze()[e/4+1]=c,Ze()[e/4+0]=a},t.wbg.__wbindgen_throw=function(e,n){throw new Error(Ki(e,n))},t.wbg.__wbindgen_memory=function(){const e=Yt.memory;return mr(e)},t}function fI(t,e){return Yt=t.exports,dI.__wbindgen_wasm_module=e,af=null,sf=null,lf=null,of=null,Yt}async function dI(t){if(Yt!==void 0)return Yt;typeof t>"u"&&(t="/osm2streets/assets/osm2streets_js_bg.wasm");const e=pI();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:i}=await hI(await t,e);return fI(n,i)}function mI(t){let e,n,i,a,c,p,u;return{c(){e=se("div"),n=Dn(`App: - `),i=se("select"),a=se("option"),a.textContent="Street Explorer",c=se("option"),c.textContent="Lane editor",a.__value="index.html",ls(a,a.__value),c.__value="lane_editor.html",ls(c,c.__value),t[0]===void 0&&yf(()=>t[2].call(i))},m(b,w){fe(b,e,w),Zt(e,n),Zt(e,i),Zt(i,a),Zt(i,c),xm(i,t[0],!0),p||(u=[un(i,"change",t[2]),un(i,"change",t[1])],p=!0)},p(b,[w]){w&1&&xm(i,b[0])},i:Ye,o:Ye,d(b){b&&pe(e),p=!1,eo(u)}}}function gI(t,e,n){let i=window.location.pathname.split("/").pop()||"index.html",a=i;function c(){a!=i&&(window.location.href=a)}function p(){a=b1(this),n(0,a)}return[a,c,p]}class JT extends Tn{constructor(e){super(),Cn(this,e,gI,mI,In,{})}}var ho=63710088e-1,W_={centimeters:ho*100,centimetres:ho*100,degrees:ho/111325,feet:ho*3.28084,inches:ho*39.37,kilometers:ho/1e3,kilometres:ho/1e3,meters:ho,metres:ho,miles:ho/1609.344,millimeters:ho*1e3,millimetres:ho*1e3,nauticalmiles:ho/1852,radians:1,yards:ho*1.0936},_I={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ho,yards:1.0936133},x_={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Us(t,e,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=e||{},i.geometry=t,i}function yI(t,e,n){switch(t){case"Point":return Go(e).geometry;case"LineString":return Ds(e).geometry;case"Polygon":return H_(e).geometry;case"MultiPoint":return V1(e).geometry;case"MultiLineString":return B1(e).geometry;case"MultiPolygon":return U1(e).geometry;default:throw new Error(t+" is invalid")}}function Go(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Im(t[0])||!Im(t[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:t};return Us(i,e,n)}function vI(t,e,n){return n===void 0&&(n={}),Xu(t.map(function(i){return Go(i,e)}),n)}function H_(t,e,n){n===void 0&&(n={});for(var i=0,a=t;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function X_(t,e){e===void 0&&(e="kilometers");var n=W_[e];if(!n)throw new Error(e+" units is invalid");return t*n}function Um(t,e){e===void 0&&(e="kilometers");var n=W_[e];if(!n)throw new Error(e+" units is invalid");return t/n}function EI(t,e){return vf(Um(t,e))}function SI(t){var e=t%360;return e<0&&(e+=360),e}function vf(t){var e=t%(2*Math.PI);return e*180/Math.PI}function Rs(t){var e=t%360;return e*Math.PI/180}function CI(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return X_(Um(t,e),n)}function TI(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=x_[e];if(!i)throw new Error("invalid original units");var a=x_[n];if(!a)throw new Error("invalid final units");return t/i*a}function Im(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Y_(t){return!!t&&t.constructor===Object}function LI(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!Im(e))throw new Error("bbox must only contain numbers")})}function PI(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const MI=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:x_,bearingToAzimuth:SI,convertArea:TI,convertLength:CI,degreesToRadians:Rs,earthRadius:ho,factors:W_,feature:Us,featureCollection:Xu,geometry:yI,geometryCollection:wI,isNumber:Im,isObject:Y_,lengthToDegrees:EI,lengthToRadians:Um,lineString:Ds,lineStrings:bI,multiLineString:B1,multiPoint:V1,multiPolygon:U1,point:Go,points:vI,polygon:H_,polygons:xI,radiansToDegrees:vf,radiansToLength:X_,round:II,unitsFactors:_I,validateBBox:LI,validateId:PI},Symbol.toStringTag,{value:"Module"}));function Zh(t,e,n){if(t!==null)for(var i,a,c,p,u,b,w,T=0,P=0,k,B=t.type,V=B==="FeatureCollection",tt=B==="Feature",ot=V?t.features.length:1,ut=0;utb||V>w||tt>T){u=P,b=i,w=V,T=tt,c=0;return}var ot=Ds([u,P],n.properties);if(e(ot,i,a,tt,c)===!1)return!1;c++,u=P})===!1)return!1}}})}function OI(t,e,n){var i=n,a=!1;return q1(t,function(c,p,u,b,w){a===!1&&n===void 0?i=c:i=e(i,c,p,u,b,w),a=!0}),i}function j1(t,e){if(!t)throw new Error("geojson is required");Wh(t,function(n,i,a){if(n.geometry!==null){var c=n.geometry.type,p=n.geometry.coordinates;switch(c){case"LineString":if(e(n,i,a,0,0)===!1)return!1;break;case"Polygon":for(var u=0;un[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]{w_.set(null),I_.set(null)});function W1(t,e){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function vh(t,e,n){let i=["case"];for(let[a,c]of Object.entries(e))i.push(["==",["get",t],a]),i.push(c);return i.push(n),i}function jf(){return{type:"FeatureCollection",features:[]}}function H1(t){return Sm(t)}function Zf(t){return{id:t,beforeId:ZI(t)}}function ZI(t){let e=_1(Yu),n,i=!1;for(let a=iv.length-1;a>=0;a--){let c=iv[a];if(c==t){i=!0;break}e.getLayer(c)&&(n=c)}if(!i)throw new Error(`Layer ID ${t} not defined in layerZorder`);return n}const iv=["boundary","lane-polygons","intersection-polygons","lane-markings","intersection-markings","movements","connected-roads","block","debug-ids","current-way","road_label","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"];var WI=Object.defineProperty,HI=(t,e,n)=>e in t?WI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rv=(t,e,n)=>(HI(t,typeof e!="symbol"?e+"":e,n),n);function xf(){}function X1(t){return t()}function ov(){return Object.create(null)}function Gm(t){t.forEach(X1)}function Y1(t){return typeof t=="function"}function XI(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function YI(t){return Object.keys(t).length===0}function KI(t,e){t.appendChild(e)}function JI(t,e,n){t.insertBefore(e,n||null)}function K1(t){t.parentNode&&t.parentNode.removeChild(t)}function sv(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function $l(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function QI(t){return Array.from(t.childNodes)}function lm(t,e,n){t.classList.toggle(e,!!n)}let J_;function mf(t){J_=t}const mh=[],av=[];let yh=[];const lv=[],$I=Promise.resolve();let E_=!1;function tE(){E_||(E_=!0,$I.then(J1))}function S_(t){yh.push(t)}const c_=new Set;let ph=0;function J1(){if(ph!==0)return;const t=J_;do{try{for(;pht.indexOf(i)===-1?e.push(i):n.push(i)),n.forEach(i=>i()),yh=e}const iE=new Set;function rE(t,e){t&&t.i&&(iE.delete(t),t.i(e))}function oE(t,e,n){const{fragment:i,after_update:a}=t.$$;i&&i.m(e,n),S_(()=>{const c=t.$$.on_mount.map(X1).filter(Y1);t.$$.on_destroy?t.$$.on_destroy.push(...c):Gm(c),t.$$.on_mount=[]}),a.forEach(S_)}function sE(t,e){const n=t.$$;n.fragment!==null&&(nE(n.after_update),Gm(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function aE(t,e){t.$$.dirty[0]===-1&&(mh.push(t),tE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const V=B.length?B[0]:k;return w.ctx&&a(w.ctx[P],w.ctx[P]=V)&&(!w.skip_bound&&w.bound[P]&&w.bound[P](V),T&&aE(t,P)),k}):[],w.update(),T=!0,Gm(w.before_update),w.fragment=i?i(w.ctx):!1,e.target){if(e.hydrate){const P=QI(e.target);w.fragment&&w.fragment.l(P),P.forEach(K1)}else w.fragment&&w.fragment.c();e.intro&&rE(t.$$.fragment),oE(t,e.target,e.anchor),J1()}mf(b)}class uE{constructor(){rv(this,"$$"),rv(this,"$$set")}$destroy(){sE(this,1),this.$destroy=xf}$on(e,n){if(!Y1(n))return xf;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const a=i.indexOf(n);a!==-1&&i.splice(a,1)}}$set(e){this.$$set&&!YI(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const cE="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(cE);function hE(t){let e,n,i;return{c(){e=sv("svg"),n=sv("path"),$l(n,"stroke-width","4"),$l(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"),$l(n,"class","svelte-gzo3ar"),$l(e,"width",i=t[0]==="list"?20:void 0),$l(e,"viewBox","0 0 70 85"),$l(e,"fill","none"),$l(e,"class","svelte-gzo3ar"),lm(e,"in-map",t[0]!=="list"),lm(e,"list-icon",t[0]==="list")},m(a,c){JI(a,e,c),KI(e,n)},p(a,[c]){c&1&&i!==(i=a[0]==="list"?20:void 0)&&$l(e,"width",i),c&1&&lm(e,"in-map",a[0]!=="list"),c&1&&lm(e,"list-icon",a[0]==="list")},i:xf,o:xf,d(a){a&&K1(e)}}}function pE(t,e,n){let{displayIn:i}=e;return t.$$set=a=>{"displayIn"in a&&n(0,i=a.displayIn)},[i]}class fE extends uE{constructor(e){super(),lE(this,e,pE,hE,XI,{displayIn:0})}}const dE=[{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"}],mE={decimalLatitude:40.123,decimalLongitude:-74.123},gE=[{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}],_E=[{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 yE(){const t=[];return dE.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...mE})}),[...t,...gE,..._E]}const vE=yE();vE.map(t=>t.verbatimCoordinates);/** +`),st=C.createShader(C.FRAGMENT_SHADER);if(C.isContextLost())return void(this.failedToCreate=!0);if(C.shaderSource(st,pt),C.compileShader(st),!C.getShaderParameter(st,C.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${C.getShaderInfoLog(st)}`);C.attachShader(this.program,st);const yt=C.createShader(C.VERTEX_SHADER);if(C.isContextLost())return void(this.failedToCreate=!0);if(C.shaderSource(yt,Et),C.compileShader(yt),!C.getShaderParameter(yt,C.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${C.getShaderInfoLog(yt)}`);C.attachShader(this.program,yt),this.attributes={};const kt={};this.numAttributes=R.length;for(let Pt=0;Pt({u_depth:new u.aG(Pt,Bt.u_depth),u_terrain:new u.aG(Pt,Bt.u_terrain),u_terrain_dim:new u.aH(Pt,Bt.u_terrain_dim),u_terrain_matrix:new u.aI(Pt,Bt.u_terrain_matrix),u_terrain_unpack:new u.aJ(Pt,Bt.u_terrain_unpack),u_terrain_exaggeration:new u.aH(Pt,Bt.u_terrain_exaggeration)}))(o,kt),this.binderUniforms=d?d.getUniforms(o,kt):[]}draw(o,h,d,g,y,E,C,L,A,R,z,q,et,Q,nt,K,pt,Et){const st=o.gl;if(this.failedToCreate)return;if(o.program.set(this.program),o.setDepthMode(d),o.setStencilMode(g),o.setColorMode(y),o.setCullFace(E),L){o.activeTexture.set(st.TEXTURE2),st.bindTexture(st.TEXTURE_2D,L.depthTexture),o.activeTexture.set(st.TEXTURE3),st.bindTexture(st.TEXTURE_2D,L.texture);for(const kt in this.terrainUniforms)this.terrainUniforms[kt].set(L[kt])}for(const kt in this.fixedUniforms)this.fixedUniforms[kt].set(C[kt]);nt&&nt.setUniforms(o,this.binderUniforms,et,{zoom:Q});let yt=0;switch(h){case st.LINES:yt=2;break;case st.TRIANGLES:yt=3;break;case st.LINE_STRIP:yt=1}for(const kt of q.get()){const Pt=kt.vaos||(kt.vaos={});(Pt[A]||(Pt[A]=new yc)).bind(o,this,R,nt?nt.getPaintVertexBuffers():[],z,kt.vertexOffset,K,pt,Et),st.drawElements(h,kt.primitiveLength*yt,st.UNSIGNED_SHORT,kt.primitiveOffset*yt*2)}}}function vc(_,o,h){const d=1/Be(h,1,o.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),y=h.tileSize*Math.pow(2,o.transform.tileZoom)/g,E=y*(h.tileID.canonical.x+h.tileID.wrap*g),C=y*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[d,_.fromScale,_.toScale],u_fade:_.t,u_pixel_coord_upper:[E>>16,C>>16],u_pixel_coord_lower:[65535&E,65535&C]}}const bu=(_,o,h,d)=>{const g=o.style.light,y=g.properties.get("position"),E=[y.x,y.y,y.z],C=function(){var A=new u.A(9);return u.A!=Float32Array&&(A[1]=0,A[2]=0,A[3]=0,A[5]=0,A[6]=0,A[7]=0),A[0]=1,A[4]=1,A[8]=1,A}();g.properties.get("anchor")==="viewport"&&function(A,R){var z=Math.sin(R),q=Math.cos(R);A[0]=q,A[1]=z,A[2]=0,A[3]=-z,A[4]=q,A[5]=0,A[6]=0,A[7]=0,A[8]=1}(C,-o.transform.angle),function(A,R,z){var q=R[0],et=R[1],Q=R[2];A[0]=q*z[0]+et*z[3]+Q*z[6],A[1]=q*z[1]+et*z[4]+Q*z[7],A[2]=q*z[2]+et*z[5]+Q*z[8]}(E,E,C);const L=g.properties.get("color");return{u_matrix:_,u_lightpos:E,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[L.r,L.g,L.b],u_vertical_gradient:+h,u_opacity:d}},ig=(_,o,h,d,g,y,E)=>u.e(bu(_,o,h,d),vc(y,o,E),{u_height_factor:-Math.pow(2,g.overscaledZ)/E.tileSize/8}),ed=_=>({u_matrix:_}),xc=(_,o,h,d)=>u.e(ed(_),vc(h,o,d)),rg=(_,o)=>({u_matrix:_,u_world:o}),nd=(_,o,h,d,g)=>u.e(xc(_,o,h,d),{u_world:g}),og=(_,o,h,d)=>{const g=_.transform;let y,E;if(d.paint.get("circle-pitch-alignment")==="map"){const C=Be(h,1,g.zoom);y=!0,E=[C,C]}else y=!1,E=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:_.translatePosMatrix(o.posMatrix,h,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:_.pixelRatio,u_extrude_scale:E}},id=(_,o,h)=>{const d=Be(h,1,o.zoom),g=Math.pow(2,o.zoom-h.tileID.overscaledZ),y=h.tileID.overscaleFactor();return{u_matrix:_,u_camera_to_center_distance:o.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[o.pixelsToGLUnits[0]/(d*g),o.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:y}},rd=(_,o,h=1)=>({u_matrix:_,u_color:o,u_overlay:0,u_overlay_scale:h}),bc=_=>({u_matrix:_}),od=(_,o,h,d)=>({u_matrix:_,u_extrude_scale:Be(o,1,h),u_intensity:d});function sd(_,o){const h=Math.pow(2,o.canonical.z),d=o.canonical.y;return[new u.Y(0,d/h).toLngLat().lat,new u.Y(0,(d+1)/h).toLngLat().lat]}const wc=(_,o,h,d)=>{const g=_.transform;return{u_matrix:wu(_,o,h,d),u_ratio:1/Be(o,1,g.zoom),u_device_pixel_ratio:_.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},ad=(_,o,h,d,g)=>u.e(wc(_,o,h,g),{u_image:0,u_image_height:d}),Qa=(_,o,h,d,g)=>{const y=_.transform,E=bo(o,y);return{u_matrix:wu(_,o,h,g),u_texsize:o.imageAtlasTexture.size,u_ratio:1/Be(o,1,y.zoom),u_device_pixel_ratio:_.pixelRatio,u_image:0,u_scale:[E,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Ic=(_,o,h,d,g,y)=>{const E=_.lineAtlas,C=bo(o,_.transform),L=h.layout.get("line-cap")==="round",A=E.getDash(d.from,L),R=E.getDash(d.to,L),z=A.width*g.fromScale,q=R.width*g.toScale;return u.e(wc(_,o,h,y),{u_patternscale_a:[C/z,-A.height/2],u_patternscale_b:[C/q,-R.height/2],u_sdfgamma:E.width/(256*Math.min(z,q)*_.pixelRatio)/2,u_image:0,u_tex_y_a:A.y,u_tex_y_b:R.y,u_mix:g.t})};function bo(_,o){return 1/Be(_,1,o.tileZoom)}function wu(_,o,h,d){return _.translatePosMatrix(d?d.posMatrix:o.tileID.posMatrix,o,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const Ec=(_,o,h,d,g)=>{return{u_matrix:_,u_tl_parent:o,u_scale_parent:h,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(E=g.paint.get("raster-saturation"),E>0?1-1/(1.001-E):-E),u_contrast_factor:(y=g.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:Iu(g.paint.get("raster-hue-rotate"))};var y,E};function Iu(_){_*=Math.PI/180;const o=Math.sin(_),h=Math.cos(_);return[(2*h+1)/3,(-Math.sqrt(3)*o-h+1)/3,(Math.sqrt(3)*o-h+1)/3]}const Eu=(_,o,h,d,g,y,E,C,L,A)=>{const R=g.transform;return{u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:o?o.uSizeT:0,u_size:o?o.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:R.width/R.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:E,u_coord_matrix:C,u_is_text:+L,u_pitch_with_map:+d,u_texsize:A,u_texture:0}},Su=(_,o,h,d,g,y,E,C,L,A,R)=>{const z=g.transform;return u.e(Eu(_,o,h,d,g,y,E,C,L,A),{u_gamma_scale:d?Math.cos(z._pitch)*z.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+R})},Cu=(_,o,h,d,g,y,E,C,L,A)=>u.e(Su(_,o,h,d,g,y,E,C,!0,L,!0),{u_texsize_icon:A,u_texture_icon:1}),sg=(_,o,h)=>({u_matrix:_,u_opacity:o,u_color:h}),ag=(_,o,h,d,g,y)=>u.e(function(E,C,L,A){const R=L.imageManager.getPattern(E.from.toString()),z=L.imageManager.getPattern(E.to.toString()),{width:q,height:et}=L.imageManager.getPixelSize(),Q=Math.pow(2,A.tileID.overscaledZ),nt=A.tileSize*Math.pow(2,L.transform.tileZoom)/Q,K=nt*(A.tileID.canonical.x+A.tileID.wrap*Q),pt=nt*A.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:R.tl,u_pattern_br_a:R.br,u_pattern_tl_b:z.tl,u_pattern_br_b:z.br,u_texsize:[q,et],u_mix:C.t,u_pattern_size_a:R.displaySize,u_pattern_size_b:z.displaySize,u_scale_a:C.fromScale,u_scale_b:C.toScale,u_tile_units_to_pixels:1/Be(A,1,L.transform.tileZoom),u_pixel_coord_upper:[K>>16,pt>>16],u_pixel_coord_lower:[65535&K,65535&pt]}}(d,y,h,g),{u_matrix:_,u_opacity:o}),ld={fillExtrusion:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_lightpos:new u.aK(_,o.u_lightpos),u_lightintensity:new u.aH(_,o.u_lightintensity),u_lightcolor:new u.aK(_,o.u_lightcolor),u_vertical_gradient:new u.aH(_,o.u_vertical_gradient),u_opacity:new u.aH(_,o.u_opacity)}),fillExtrusionPattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_lightpos:new u.aK(_,o.u_lightpos),u_lightintensity:new u.aH(_,o.u_lightintensity),u_lightcolor:new u.aK(_,o.u_lightcolor),u_vertical_gradient:new u.aH(_,o.u_vertical_gradient),u_height_factor:new u.aH(_,o.u_height_factor),u_image:new u.aG(_,o.u_image),u_texsize:new u.aL(_,o.u_texsize),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade),u_opacity:new u.aH(_,o.u_opacity)}),fill:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix)}),fillPattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_image:new u.aG(_,o.u_image),u_texsize:new u.aL(_,o.u_texsize),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade)}),fillOutline:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_world:new u.aL(_,o.u_world)}),fillOutlinePattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_world:new u.aL(_,o.u_world),u_image:new u.aG(_,o.u_image),u_texsize:new u.aL(_,o.u_texsize),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade)}),circle:(_,o)=>({u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_scale_with_map:new u.aG(_,o.u_scale_with_map),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_extrude_scale:new u.aL(_,o.u_extrude_scale),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_matrix:new u.aI(_,o.u_matrix)}),collisionBox:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pixels_to_tile_units:new u.aH(_,o.u_pixels_to_tile_units),u_extrude_scale:new u.aL(_,o.u_extrude_scale),u_overscale_factor:new u.aH(_,o.u_overscale_factor)}),collisionCircle:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_inv_matrix:new u.aI(_,o.u_inv_matrix),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_viewport_size:new u.aL(_,o.u_viewport_size)}),debug:(_,o)=>({u_color:new u.aM(_,o.u_color),u_matrix:new u.aI(_,o.u_matrix),u_overlay:new u.aG(_,o.u_overlay),u_overlay_scale:new u.aH(_,o.u_overlay_scale)}),clippingMask:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix)}),heatmap:(_,o)=>({u_extrude_scale:new u.aH(_,o.u_extrude_scale),u_intensity:new u.aH(_,o.u_intensity),u_matrix:new u.aI(_,o.u_matrix)}),heatmapTexture:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_world:new u.aL(_,o.u_world),u_image:new u.aG(_,o.u_image),u_color_ramp:new u.aG(_,o.u_color_ramp),u_opacity:new u.aH(_,o.u_opacity)}),hillshade:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_image:new u.aG(_,o.u_image),u_latrange:new u.aL(_,o.u_latrange),u_light:new u.aL(_,o.u_light),u_shadow:new u.aM(_,o.u_shadow),u_highlight:new u.aM(_,o.u_highlight),u_accent:new u.aM(_,o.u_accent)}),hillshadePrepare:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_image:new u.aG(_,o.u_image),u_dimension:new u.aL(_,o.u_dimension),u_zoom:new u.aH(_,o.u_zoom),u_unpack:new u.aJ(_,o.u_unpack)}),line:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels)}),lineGradient:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels),u_image:new u.aG(_,o.u_image),u_image_height:new u.aH(_,o.u_image_height)}),linePattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_texsize:new u.aL(_,o.u_texsize),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_image:new u.aG(_,o.u_image),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels),u_scale:new u.aK(_,o.u_scale),u_fade:new u.aH(_,o.u_fade)}),lineSDF:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ratio:new u.aH(_,o.u_ratio),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_units_to_pixels:new u.aL(_,o.u_units_to_pixels),u_patternscale_a:new u.aL(_,o.u_patternscale_a),u_patternscale_b:new u.aL(_,o.u_patternscale_b),u_sdfgamma:new u.aH(_,o.u_sdfgamma),u_image:new u.aG(_,o.u_image),u_tex_y_a:new u.aH(_,o.u_tex_y_a),u_tex_y_b:new u.aH(_,o.u_tex_y_b),u_mix:new u.aH(_,o.u_mix)}),raster:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_tl_parent:new u.aL(_,o.u_tl_parent),u_scale_parent:new u.aH(_,o.u_scale_parent),u_buffer_scale:new u.aH(_,o.u_buffer_scale),u_fade_t:new u.aH(_,o.u_fade_t),u_opacity:new u.aH(_,o.u_opacity),u_image0:new u.aG(_,o.u_image0),u_image1:new u.aG(_,o.u_image1),u_brightness_low:new u.aH(_,o.u_brightness_low),u_brightness_high:new u.aH(_,o.u_brightness_high),u_saturation_factor:new u.aH(_,o.u_saturation_factor),u_contrast_factor:new u.aH(_,o.u_contrast_factor),u_spin_weights:new u.aK(_,o.u_spin_weights)}),symbolIcon:(_,o)=>({u_is_size_zoom_constant:new u.aG(_,o.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,o.u_is_size_feature_constant),u_size_t:new u.aH(_,o.u_size_t),u_size:new u.aH(_,o.u_size),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pitch:new u.aH(_,o.u_pitch),u_rotate_symbol:new u.aG(_,o.u_rotate_symbol),u_aspect_ratio:new u.aH(_,o.u_aspect_ratio),u_fade_change:new u.aH(_,o.u_fade_change),u_matrix:new u.aI(_,o.u_matrix),u_label_plane_matrix:new u.aI(_,o.u_label_plane_matrix),u_coord_matrix:new u.aI(_,o.u_coord_matrix),u_is_text:new u.aG(_,o.u_is_text),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_texsize:new u.aL(_,o.u_texsize),u_texture:new u.aG(_,o.u_texture)}),symbolSDF:(_,o)=>({u_is_size_zoom_constant:new u.aG(_,o.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,o.u_is_size_feature_constant),u_size_t:new u.aH(_,o.u_size_t),u_size:new u.aH(_,o.u_size),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pitch:new u.aH(_,o.u_pitch),u_rotate_symbol:new u.aG(_,o.u_rotate_symbol),u_aspect_ratio:new u.aH(_,o.u_aspect_ratio),u_fade_change:new u.aH(_,o.u_fade_change),u_matrix:new u.aI(_,o.u_matrix),u_label_plane_matrix:new u.aI(_,o.u_label_plane_matrix),u_coord_matrix:new u.aI(_,o.u_coord_matrix),u_is_text:new u.aG(_,o.u_is_text),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_texsize:new u.aL(_,o.u_texsize),u_texture:new u.aG(_,o.u_texture),u_gamma_scale:new u.aH(_,o.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_is_halo:new u.aG(_,o.u_is_halo)}),symbolTextAndIcon:(_,o)=>({u_is_size_zoom_constant:new u.aG(_,o.u_is_size_zoom_constant),u_is_size_feature_constant:new u.aG(_,o.u_is_size_feature_constant),u_size_t:new u.aH(_,o.u_size_t),u_size:new u.aH(_,o.u_size),u_camera_to_center_distance:new u.aH(_,o.u_camera_to_center_distance),u_pitch:new u.aH(_,o.u_pitch),u_rotate_symbol:new u.aG(_,o.u_rotate_symbol),u_aspect_ratio:new u.aH(_,o.u_aspect_ratio),u_fade_change:new u.aH(_,o.u_fade_change),u_matrix:new u.aI(_,o.u_matrix),u_label_plane_matrix:new u.aI(_,o.u_label_plane_matrix),u_coord_matrix:new u.aI(_,o.u_coord_matrix),u_is_text:new u.aG(_,o.u_is_text),u_pitch_with_map:new u.aG(_,o.u_pitch_with_map),u_texsize:new u.aL(_,o.u_texsize),u_texsize_icon:new u.aL(_,o.u_texsize_icon),u_texture:new u.aG(_,o.u_texture),u_texture_icon:new u.aG(_,o.u_texture_icon),u_gamma_scale:new u.aH(_,o.u_gamma_scale),u_device_pixel_ratio:new u.aH(_,o.u_device_pixel_ratio),u_is_halo:new u.aG(_,o.u_is_halo)}),background:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_opacity:new u.aH(_,o.u_opacity),u_color:new u.aM(_,o.u_color)}),backgroundPattern:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_opacity:new u.aH(_,o.u_opacity),u_image:new u.aG(_,o.u_image),u_pattern_tl_a:new u.aL(_,o.u_pattern_tl_a),u_pattern_br_a:new u.aL(_,o.u_pattern_br_a),u_pattern_tl_b:new u.aL(_,o.u_pattern_tl_b),u_pattern_br_b:new u.aL(_,o.u_pattern_br_b),u_texsize:new u.aL(_,o.u_texsize),u_mix:new u.aH(_,o.u_mix),u_pattern_size_a:new u.aL(_,o.u_pattern_size_a),u_pattern_size_b:new u.aL(_,o.u_pattern_size_b),u_scale_a:new u.aH(_,o.u_scale_a),u_scale_b:new u.aH(_,o.u_scale_b),u_pixel_coord_upper:new u.aL(_,o.u_pixel_coord_upper),u_pixel_coord_lower:new u.aL(_,o.u_pixel_coord_lower),u_tile_units_to_pixels:new u.aH(_,o.u_tile_units_to_pixels)}),terrain:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_texture:new u.aG(_,o.u_texture),u_ele_delta:new u.aH(_,o.u_ele_delta)}),terrainDepth:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_ele_delta:new u.aH(_,o.u_ele_delta)}),terrainCoords:(_,o)=>({u_matrix:new u.aI(_,o.u_matrix),u_texture:new u.aG(_,o.u_texture),u_terrain_coords_id:new u.aH(_,o.u_terrain_coords_id),u_ele_delta:new u.aH(_,o.u_ele_delta)})};class lg{constructor(o,h,d){this.context=o;const g=o.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),o.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(o){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,o.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const $a={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sc{constructor(o,h,d,g){this.length=h.length,this.attributes=d,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=o;const y=o.gl;this.buffer=y.createBuffer(),o.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(o){if(o.length!==this.length)throw new Error(`Length of new data is ${o.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,o.arrayBuffer)}enableAttributes(o,h){for(let d=0;d0){const Ht=u.F(),me=Bt;u.aP(Ht,Pt.placementInvProjMatrix,_.transform.glCoordMatrix),u.aP(Ht,Ht,Pt.placementViewportMatrix),R.push({circleArray:Ut,circleOffset:q,transform:me,invTransform:Ht,coord:yt}),z+=Ut.length/4,q=z}qt&&A.draw(C,L.LINES,dn.disabled,Hn.disabled,_.colorModeForRenderPass(),Vn.disabled,id(Bt,_.transform,kt),_.style.map.terrain&&_.style.map.terrain.getTerrainData(yt),h.id,qt.layoutVertexBuffer,qt.indexBuffer,qt.segments,null,_.transform.zoom,null,null,qt.collisionVertexBuffer)}if(!E||!R.length)return;const et=_.useProgram("collisionCircle"),Q=new u.aQ;Q.resize(4*z),Q._trim();let nt=0;for(const st of R)for(let yt=0;yt=0&&(Q[K.associatedIconIndex]={shiftedAnchor:Ae,angle:re})}else Nt(K.numGlyphs,q)}if(A){et.clear();const nt=_.icon.placedSymbolArray;for(let K=0;K_.style.map.terrain.getElevation(qt,rr,qi):null,Gi=h.layout.get("text-rotation-alignment")==="map";U(Ht,qt.posMatrix,_,g,Sr,Vo,K,A,Gi,Kn)}const Wl=_.translatePosMatrix(qt.posMatrix,Ut,y,E),Ma=pt||g&&Pt||Zl?cp:Sr,Ui=_.translatePosMatrix(Vo,Ut,y,E,!0),Ti=re&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let fi;fi=re?Ht.iconsInText?Cu(Pe.kind,an,Et,K,_,Wl,Ma,Ui,ln,ir):Su(Pe.kind,an,Et,K,_,Wl,Ma,Ui,g,ln,!0):Eu(Pe.kind,an,Et,K,_,Wl,Ma,Ui,g,ln);const Zr={program:Yn,buffers:me,uniformValues:fi,atlasTexture:Ci,atlasTextureIcon:pi,atlasInterpolation:Nn,atlasInterpolationIcon:jr,isSDF:re,hasHalo:Ti};if(st&&Ht.canOverlap){yt=!0;const Kn=me.segments.get();for(const Gi of Kn)Bt.push({segments:new u.$([Gi]),sortKey:Gi.sortKey,state:Zr,terrainData:Je})}else Bt.push({segments:me.segments,sortKey:0,state:Zr,terrainData:Je})}yt&&Bt.sort((qt,Ut)=>qt.sortKey-Ut.sortKey);for(const qt of Bt){const Ut=qt.state;if(q.activeTexture.set(et.TEXTURE0),Ut.atlasTexture.bind(Ut.atlasInterpolation,et.CLAMP_TO_EDGE),Ut.atlasTextureIcon&&(q.activeTexture.set(et.TEXTURE1),Ut.atlasTextureIcon&&Ut.atlasTextureIcon.bind(Ut.atlasInterpolationIcon,et.CLAMP_TO_EDGE)),Ut.isSDF){const Ht=Ut.uniformValues;Ut.hasHalo&&(Ht.u_is_halo=1,_d(Ut.buffers,qt.segments,h,_,Ut.program,kt,R,z,Ht,qt.terrainData)),Ht.u_is_halo=0}_d(Ut.buffers,qt.segments,h,_,Ut.program,kt,R,z,Ut.uniformValues,qt.terrainData)}}function _d(_,o,h,d,g,y,E,C,L,A){const R=d.context;g.draw(R,R.gl.TRIANGLES,y,E,C,Vn.disabled,L,A,h.id,_.layoutVertexBuffer,_.indexBuffer,o,h.paint,d.transform.zoom,_.programConfigurations.get(h.id),_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer)}function zc(_,o,h,d,g){if(!h||!d||!d.imageAtlas)return;const y=d.imageAtlas.patternPositions;let E=y[h.to.toString()],C=y[h.from.toString()];if(!E&&C&&(E=C),!C&&E&&(C=E),!E||!C){const L=g.getPaintProperty(o);E=y[L],C=y[L]}E&&C&&_.setConstantPatternPositions(E,C)}function yd(_,o,h,d,g,y,E){const C=_.context.gl,L="fill-pattern",A=h.paint.get(L),R=A&&A.constantOr(1),z=h.getCrossfadeParameters();let q,et,Q,nt,K;E?(et=R&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",q=C.LINES):(et=R?"fillPattern":"fill",q=C.TRIANGLES);const pt=A.constantOr(null);for(const Et of d){const st=o.getTile(Et);if(R&&!st.patternsLoaded())continue;const yt=st.getBucket(h);if(!yt)continue;const kt=yt.programConfigurations.get(h.id),Pt=_.useProgram(et,kt),Bt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Et);R&&(_.context.activeTexture.set(C.TEXTURE0),st.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),kt.updatePaintBuffers(z)),zc(kt,L,pt,st,h);const qt=Bt?Et:null,Ut=_.translatePosMatrix(qt?qt.posMatrix:Et.posMatrix,st,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(E){nt=yt.indexBuffer2,K=yt.segments2;const Ht=[C.drawingBufferWidth,C.drawingBufferHeight];Q=et==="fillOutlinePattern"&&R?nd(Ut,_,z,st,Ht):rg(Ut,Ht)}else nt=yt.indexBuffer,K=yt.segments,Q=R?xc(Ut,_,z,st):ed(Ut);Pt.draw(_.context,q,g,_.stencilModeForClipping(Et),y,Vn.disabled,Q,Bt,h.id,yt.layoutVertexBuffer,nt,K,h.paint,_.transform.zoom,kt)}}function Oc(_,o,h,d,g,y,E){const C=_.context,L=C.gl,A="fill-extrusion-pattern",R=h.paint.get(A),z=R.constantOr(1),q=h.getCrossfadeParameters(),et=h.paint.get("fill-extrusion-opacity"),Q=R.constantOr(null);for(const nt of d){const K=o.getTile(nt),pt=K.getBucket(h);if(!pt)continue;const Et=_.style.map.terrain&&_.style.map.terrain.getTerrainData(nt),st=pt.programConfigurations.get(h.id),yt=_.useProgram(z?"fillExtrusionPattern":"fillExtrusion",st);z&&(_.context.activeTexture.set(L.TEXTURE0),K.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),st.updatePaintBuffers(q)),zc(st,A,Q,K,h);const kt=_.translatePosMatrix(nt.posMatrix,K,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Pt=h.paint.get("fill-extrusion-vertical-gradient"),Bt=z?ig(kt,_,Pt,et,nt,q,K):bu(kt,_,Pt,et);yt.draw(C,C.gl.TRIANGLES,g,y,E,Vn.backCCW,Bt,Et,h.id,pt.layoutVertexBuffer,pt.indexBuffer,pt.segments,h.paint,_.transform.zoom,st,_.style.map.terrain&&pt.centroidVertexBuffer)}}function Fc(_,o,h,d,g,y,E){const C=_.context,L=C.gl,A=h.fbo;if(!A)return;const R=_.useProgram("hillshade"),z=_.style.map.terrain&&_.style.map.terrain.getTerrainData(o);C.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,A.colorAttachment.get()),R.draw(C,L.TRIANGLES,g,y,E,Vn.disabled,((q,et,Q,nt)=>{const K=Q.paint.get("hillshade-shadow-color"),pt=Q.paint.get("hillshade-highlight-color"),Et=Q.paint.get("hillshade-accent-color");let st=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(st-=q.transform.angle);const yt=!q.options.moving;return{u_matrix:nt?nt.posMatrix:q.transform.calculatePosMatrix(et.tileID.toUnwrapped(),yt),u_image:0,u_latrange:sd(0,et.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),st],u_shadow:K,u_highlight:pt,u_accent:Et}})(_,h,d,z?o:null),z,d.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}function hp(_,o,h,d,g,y){const E=_.context,C=E.gl,L=o.dem;if(L&&L.data){const A=L.dim,R=L.stride,z=L.getPixels();if(E.activeTexture.set(C.TEXTURE1),E.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||_.getTileTexture(R),o.demTexture){const et=o.demTexture;et.update(z,{premultiply:!1}),et.bind(C.NEAREST,C.CLAMP_TO_EDGE)}else o.demTexture=new Ct(E,z,C.RGBA,{premultiply:!1}),o.demTexture.bind(C.NEAREST,C.CLAMP_TO_EDGE);E.activeTexture.set(C.TEXTURE0);let q=o.fbo;if(!q){const et=new Ct(E,{width:A,height:A,data:null},C.RGBA);et.bind(C.LINEAR,C.CLAMP_TO_EDGE),q=o.fbo=E.createFramebuffer(A,A,!0,!1),q.colorAttachment.set(et.texture)}E.bindFramebuffer.set(q.framebuffer),E.viewport.set([0,0,A,A]),_.useProgram("hillshadePrepare").draw(E,C.TRIANGLES,d,g,y,Vn.disabled,((et,Q)=>{const nt=Q.stride,K=u.F();return u.aN(K,0,u.W,-u.W,0,0,1),u.H(K,K,[0,-u.W,0]),{u_matrix:K,u_image:1,u_dimension:[nt,nt],u_zoom:et.overscaledZ,u_unpack:Q.getUnpackVector()}})(o.tileID,L),null,h.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments),o.needsHillshadePrepare=!1}}function vd(_,o,h,d,g,y){const E=d.paint.get("raster-fade-duration");if(!y&&E>0){const C=P.now(),L=(C-_.timeAdded)/E,A=o?(C-o.timeAdded)/E:-1,R=h.getSource(),z=g.coveringZoomLevel({tileSize:R.tileSize,roundZoom:R.roundZoom}),q=!o||Math.abs(o.tileID.overscaledZ-z)>Math.abs(_.tileID.overscaledZ-z),et=q&&_.refreshedUponExpiration?1:u.ac(q?L:1-A,0,1);return _.refreshedUponExpiration&&L>=1&&(_.refreshedUponExpiration=!1),o?{opacity:1,mix:1-et}:{opacity:et,mix:0}}return{opacity:1,mix:0}}const xd=new u.aO(1,0,0,1),Bc=new u.aO(0,1,0,1),pp=new u.aO(0,0,1,1),_g=new u.aO(1,0,1,1),bd=new u.aO(0,1,1,1);function ci(_,o,h,d){Gr(_,0,o+h/2,_.transform.width,h,d)}function Ca(_,o,h,d){Gr(_,o-h/2,0,h,_.transform.height,d)}function Gr(_,o,h,d,g,y){const E=_.context,C=E.gl;C.enable(C.SCISSOR_TEST),C.scissor(o*_.pixelRatio,h*_.pixelRatio,d*_.pixelRatio,g*_.pixelRatio),E.clear({color:y}),C.disable(C.SCISSOR_TEST)}function fp(_,o,h){const d=_.context,g=d.gl,y=h.posMatrix,E=_.useProgram("debug"),C=dn.disabled,L=Hn.disabled,A=_.colorModeForRenderPass(),R="$debug",z=_.style.map.terrain&&_.style.map.terrain.getTerrainData(h);d.activeTexture.set(g.TEXTURE0);const q=o.getTileByID(h.key).latestRawTileData,et=Math.floor((q&&q.byteLength||0)/1024),Q=o.getTile(h).tileSize,nt=512/Math.min(Q,512)*(h.overscaledZ/_.transform.zoom)*.5;let K=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(K+=` => ${h.overscaledZ}`),function(pt,Et){pt.initDebugOverlayCanvas();const st=pt.debugOverlayCanvas,yt=pt.context.gl,kt=pt.debugOverlayCanvas.getContext("2d");kt.clearRect(0,0,st.width,st.height),kt.shadowColor="white",kt.shadowBlur=2,kt.lineWidth=1.5,kt.strokeStyle="white",kt.textBaseline="top",kt.font="bold 36px Open Sans, sans-serif",kt.fillText(Et,5,5),kt.strokeText(Et,5,5),pt.debugOverlayTexture.update(st),pt.debugOverlayTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE)}(_,`${K} ${et}kB`),E.draw(d,g.TRIANGLES,C,L,Ei.alphaBlended,Vn.disabled,rd(y,u.aO.transparent,nt),null,R,_.debugBuffer,_.quadTriangleIndexBuffer,_.debugSegments),E.draw(d,g.LINE_STRIP,C,L,A,Vn.disabled,rd(y,u.aO.red),z,R,_.debugBuffer,_.tileBorderIndexBuffer,_.debugSegments)}function Vc(_,o,h){const d=_.context,g=d.gl,y=_.colorModeForRenderPass(),E=new dn(g.LEQUAL,dn.ReadWrite,_.depthRangeFor3D),C=_.useProgram("terrain"),L=o.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,_.width,_.height]);for(const A of h){const R=_.renderToTexture.getTexture(A),z=o.getTerrainData(A.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,R.texture);const q={u_matrix:_.transform.calculatePosMatrix(A.tileID.toUnwrapped()),u_texture:0,u_ele_delta:o.getMeshFrameDelta(_.transform.zoom)};C.draw(d,g.TRIANGLES,E,Hn.disabled,y,Vn.backCCW,q,z,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}class wd{constructor(o,h){this.context=new gg(o),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.F(),renderTime:0},this.setup(),this.numSublayers=Ni.maxUnderzooming+Ni.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ea}resize(o,h,d){if(this.width=Math.floor(o*d),this.height=Math.floor(h*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const o=this.context,h=new u.aV;h.emplaceBack(0,0),h.emplaceBack(u.W,0),h.emplaceBack(0,u.W),h.emplaceBack(u.W,u.W),this.tileExtentBuffer=o.createVertexBuffer(h,_c.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=o.createVertexBuffer(d,_c.members),this.debugSegments=u.$.simpleSegment(0,0,4,5);const g=new u.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(u.W,0,u.W,0),g.emplaceBack(0,u.W,0,u.W),g.emplaceBack(u.W,u.W,u.W,u.W),this.rasterBoundsBuffer=o.createVertexBuffer(g,$n.members),this.rasterBoundsSegments=u.$.simpleSegment(0,0,4,2);const y=new u.aV;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=o.createVertexBuffer(y,_c.members),this.viewportSegments=u.$.simpleSegment(0,0,4,2);const E=new u.aW;E.emplaceBack(0),E.emplaceBack(1),E.emplaceBack(3),E.emplaceBack(2),E.emplaceBack(0),this.tileBorderIndexBuffer=o.createIndexBuffer(E);const C=new u.aX;C.emplaceBack(0,1,2),C.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=o.createIndexBuffer(C);const L=this.context.gl;this.stencilClearMode=new Hn({func:L.ALWAYS,mask:0},0,255,L.ZERO,L.ZERO,L.ZERO)}clearStencil(){const o=this.context,h=o.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,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(o,h.TRIANGLES,dn.disabled,this.stencilClearMode,Ei.disabled,Vn.disabled,bc(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(o,h){if(this.currentStencilSource===o.source||!o.isTileClipped()||!h||!h.length)return;this.currentStencilSource=o.source;const d=this.context,g=d.gl;this.nextStencilID+h.length>256&&this.clearStencil(),d.setColorMode(Ei.disabled),d.setDepthMode(dn.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const E of h){const C=this._tileClippingMaskIDs[E.key]=this.nextStencilID++,L=this.style.map.terrain&&this.style.map.terrain.getTerrainData(E);y.draw(d,g.TRIANGLES,dn.disabled,new Hn({func:g.ALWAYS,mask:0},C,255,g.KEEP,g.KEEP,g.REPLACE),Ei.disabled,Vn.disabled,bc(E.posMatrix),L,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const o=this.nextStencilID++,h=this.context.gl;return new Hn({func:h.NOTEQUAL,mask:255},o,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(o){const h=this.context.gl;return new Hn({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[o.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(o){const h=this.context.gl,d=o.sort((E,C)=>C.overscaledZ-E.overscaledZ),g=d[d.length-1].overscaledZ,y=d[0].overscaledZ-g+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const E={};for(let C=0;C=0;this.currentLayer--){const L=this.style._layers[d[this.currentLayer]],A=g[L.source],R=y[L.source];this._renderTileClippingMasks(L,R),this.renderLayer(this,A,L,R)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerK.source&&!K.isHidden(R)?[A.sourceCaches[K.source]]:[]),et=q.filter(K=>K.getSource().type==="vector"),Q=q.filter(K=>K.getSource().type!=="vector"),nt=K=>{(!z||z.getSource().maxzoomnt(K)),z||Q.forEach(K=>nt(K)),z}(this.style,this.transform.zoom);L&&function(A,R,z){for(let q=0;qet.style.map.terrain.getElevation(Pt,Pe,ye):null)}}}(L,y,C,E,C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),A),C.paint.get("icon-opacity").constantOr(1)!==0&&Nc(y,E,C,L,!1,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),C.layout.get("icon-rotation-alignment"),C.layout.get("icon-pitch-alignment"),C.layout.get("icon-keep-upright"),R,z),C.paint.get("text-opacity").constantOr(1)!==0&&Nc(y,E,C,L,!0,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),C.layout.get("text-rotation-alignment"),C.layout.get("text-pitch-alignment"),C.layout.get("text-keep-upright"),R,z),E.map.showCollisionBoxes&&(kc(y,E,C,L,C.paint.get("text-translate"),C.paint.get("text-translate-anchor"),!0),kc(y,E,C,L,C.paint.get("icon-translate"),C.paint.get("icon-translate-anchor"),!1))})(o,h,d,g,this.style.placement.variableOffsets);break;case"circle":(function(y,E,C,L){if(y.renderPass!=="translucent")return;const A=C.paint.get("circle-opacity"),R=C.paint.get("circle-stroke-width"),z=C.paint.get("circle-stroke-opacity"),q=!C.layout.get("circle-sort-key").isConstant();if(A.constantOr(1)===0&&(R.constantOr(1)===0||z.constantOr(1)===0))return;const et=y.context,Q=et.gl,nt=y.depthModeForSublayer(0,dn.ReadOnly),K=Hn.disabled,pt=y.colorModeForRenderPass(),Et=[];for(let st=0;stst.sortKey-yt.sortKey);for(const st of Et){const{programConfiguration:yt,program:kt,layoutVertexBuffer:Pt,indexBuffer:Bt,uniformValues:qt,terrainData:Ut}=st.state;kt.draw(et,Q.TRIANGLES,nt,K,pt,Vn.disabled,qt,Ut,C.id,Pt,Bt,st.segments,C.paint,y.transform.zoom,yt)}})(o,h,d,g);break;case"heatmap":(function(y,E,C,L){if(C.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const A=y.context,R=A.gl,z=Hn.disabled,q=new Ei([R.ONE,R.ONE],u.aO.transparent,[!0,!0,!0,!0]);(function(et,Q,nt){const K=et.gl;et.activeTexture.set(K.TEXTURE1),et.viewport.set([0,0,Q.width/4,Q.height/4]);let pt=nt.heatmapFbo;if(pt)K.bindTexture(K.TEXTURE_2D,pt.colorAttachment.get()),et.bindFramebuffer.set(pt.framebuffer);else{const Et=K.createTexture();K.bindTexture(K.TEXTURE_2D,Et),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_S,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_T,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MIN_FILTER,K.LINEAR),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MAG_FILTER,K.LINEAR),pt=nt.heatmapFbo=et.createFramebuffer(Q.width/4,Q.height/4,!1,!1),function(st,yt,kt,Pt){var Bt,qt;const Ut=st.gl,Ht=(Bt=st.HALF_FLOAT)!==null&&Bt!==void 0?Bt:Ut.UNSIGNED_BYTE,me=(qt=st.RGBA16F)!==null&&qt!==void 0?qt:Ut.RGBA;Ut.texImage2D(Ut.TEXTURE_2D,0,me,yt.width/4,yt.height/4,0,Ut.RGBA,Ht,null),Pt.colorAttachment.set(kt)}(et,Q,Et,pt)}})(A,y,C),A.clear({color:u.aO.transparent});for(let et=0;et{const st=u.F();u.aN(st,0,nt.width,nt.height,0,0,1);const yt=nt.context.gl;return{u_matrix:st,u_world:[yt.drawingBufferWidth,yt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:K.paint.get("heatmap-opacity")}})(A,R),null,R.id,A.viewportBuffer,A.quadTriangleIndexBuffer,A.viewportSegments,R.paint,A.transform.zoom)}(y,C))})(o,h,d,g);break;case"line":(function(y,E,C,L){if(y.renderPass!=="translucent")return;const A=C.paint.get("line-opacity"),R=C.paint.get("line-width");if(A.constantOr(1)===0||R.constantOr(1)===0)return;const z=y.depthModeForSublayer(0,dn.ReadOnly),q=y.colorModeForRenderPass(),et=C.paint.get("line-dasharray"),Q=C.paint.get("line-pattern"),nt=Q.constantOr(1),K=C.paint.get("line-gradient"),pt=C.getCrossfadeParameters(),Et=nt?"linePattern":et?"lineSDF":K?"lineGradient":"line",st=y.context,yt=st.gl;let kt=!0;for(const Pt of L){const Bt=E.getTile(Pt);if(nt&&!Bt.patternsLoaded())continue;const qt=Bt.getBucket(C);if(!qt)continue;const Ut=qt.programConfigurations.get(C.id),Ht=y.context.program.get(),me=y.useProgram(Et,Ut),Ae=kt||me.program!==Ht,re=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pt),Pe=Q.constantOr(null);if(Pe&&Bt.imageAtlas){const an=Bt.imageAtlas,Je=an.patternPositions[Pe.to.toString()],ln=an.patternPositions[Pe.from.toString()];Je&&ln&&Ut.setConstantPatternPositions(Je,ln)}const ye=re?Pt:null,Yn=nt?Qa(y,Bt,C,pt,ye):et?Ic(y,Bt,C,et,pt,ye):K?ad(y,Bt,C,qt.lineClipsArray.length,ye):wc(y,Bt,C,ye);if(nt)st.activeTexture.set(yt.TEXTURE0),Bt.imageAtlasTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE),Ut.updatePaintBuffers(pt);else if(et&&(Ae||y.lineAtlas.dirty))st.activeTexture.set(yt.TEXTURE0),y.lineAtlas.bind(st);else if(K){const an=qt.gradients[C.id];let Je=an.texture;if(C.gradientVersion!==an.version){let ln=256;if(C.stepInterpolant){const Ci=E.getSource().maxzoom,Nn=Pt.canonical.z===Ci?Math.ceil(1<0?h.pop():null}isPatternMissing(o){if(!o)return!1;if(!o.from||!o.to)return!0;const h=this.imageManager.getPattern(o.from.toString()),d=this.imageManager.getPattern(o.to.toString());return!h||!d}useProgram(o,h){this.cache=this.cache||{};const d=o+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new Sa(this.context,xu[o],h,ld[o],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 o=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(o.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ct(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:o,drawingBufferHeight:h}=this.context.gl;return this.width!==o||this.height!==h}}class Ta{constructor(o,h){this.points=o,this.planes=h}static fromInvProjectionMatrix(o,h,d){const g=Math.pow(2,d),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(C=>{const L=1/(C=u.af([],C,o))[3]/h*g;return u.a_(C,C,[L,L,1/C[3],L])}),E=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(C=>{const L=function(q,et){var Q=et[0],nt=et[1],K=et[2],pt=Q*Q+nt*nt+K*K;return pt>0&&(pt=1/Math.sqrt(pt)),q[0]=et[0]*pt,q[1]=et[1]*pt,q[2]=et[2]*pt,q}([],function(q,et,Q){var nt=et[0],K=et[1],pt=et[2],Et=Q[0],st=Q[1],yt=Q[2];return q[0]=K*yt-pt*st,q[1]=pt*Et-nt*yt,q[2]=nt*st-K*Et,q}([],It([],y[C[0]],y[C[1]]),It([],y[C[2]],y[C[1]]))),A=-((R=L)[0]*(z=y[C[1]])[0]+R[1]*z[1]+R[2]*z[2]);var R,z;return L.concat(A)});return new Ta(y,E)}}class La{constructor(o,h){this.min=o,this.max=h,this.center=function(d,g,y){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,y){return d[0]=g[0]+y[0],d[1]=g[1]+y[1],d[2]=g[2]+y[2],d}([],this.min,this.max))}quadrant(o){const h=[o%2==0,o<2],d=gt(this.min),g=gt(this.max);for(let y=0;y=0&&E++;if(E===0)return 0;E!==h.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let y=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(let C=0;Cthis.max[g]-this.min[g])return 0}return 1}}class Vl{constructor(o=0,h=0,d=0,g=0){if(isNaN(o)||o<0||isNaN(h)||h<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=o,this.bottom=h,this.left=d,this.right=g}interpolate(o,h,d){return h.top!=null&&o.top!=null&&(this.top=u.z.number(o.top,h.top,d)),h.bottom!=null&&o.bottom!=null&&(this.bottom=u.z.number(o.bottom,h.bottom,d)),h.left!=null&&o.left!=null&&(this.left=u.z.number(o.left,h.left,d)),h.right!=null&&o.right!=null&&(this.right=u.z.number(o.right,h.right,d)),this}getCenter(o,h){const d=u.ac((this.left+o-this.right)/2,0,o),g=u.ac((this.top+h-this.bottom)/2,0,h);return new u.P(d,g)}equals(o){return this.top===o.top&&this.bottom===o.bottom&&this.left===o.left&&this.right===o.right}clone(){return new Vl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Uc{constructor(o,h,d,g,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||!!y,this._minZoom=o||0,this._maxZoom=h||22,this._minPitch=d??0,this._maxPitch=g??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 Vl,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const o=new Uc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return o.apply(this),o}apply(o){this.tileSize=o.tileSize,this.latRange=o.latRange,this.width=o.width,this.height=o.height,this._center=o._center,this._elevation=o._elevation,this.minElevationForCurrentTile=o.minElevationForCurrentTile,this.zoom=o.zoom,this.angle=o.angle,this._fov=o._fov,this._pitch=o._pitch,this._unmodified=o._unmodified,this._edgeInsets=o._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(o){this._minZoom!==o&&(this._minZoom=o,this.zoom=Math.max(this.zoom,o))}get maxZoom(){return this._maxZoom}set maxZoom(o){this._maxZoom!==o&&(this._maxZoom=o,this.zoom=Math.min(this.zoom,o))}get minPitch(){return this._minPitch}set minPitch(o){this._minPitch!==o&&(this._minPitch=o,this.pitch=Math.max(this.pitch,o))}get maxPitch(){return this._maxPitch}set maxPitch(o){this._maxPitch!==o&&(this._maxPitch=o,this.pitch=Math.min(this.pitch,o))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(o){o===void 0?o=!0:o===null&&(o=!1),this._renderWorldCopies=o}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(o){const h=-u.b0(o,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,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,g,y){var E=g[0],C=g[1],L=g[2],A=g[3],R=Math.sin(y),z=Math.cos(y);d[0]=E*z+L*R,d[1]=C*z+A*R,d[2]=E*-R+L*z,d[3]=C*-R+A*z}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(o){const h=u.ac(o,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(o){o=Math.max(.01,Math.min(60,o)),this._fov!==o&&(this._unmodified=!1,this._fov=o/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(o){const h=Math.min(Math.max(o,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(o){o.lat===this._center.lat&&o.lng===this._center.lng||(this._unmodified=!1,this._center=o,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(o){o!==this._elevation&&(this._elevation=o,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(o){this._edgeInsets.equals(o)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,o,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(o){return this._edgeInsets.equals(o)}interpolatePadding(o,h,d){this._unmodified=!1,this._edgeInsets.interpolate(o,h,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(o){const h=(o.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/o.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(o){const h=[new u.b1(0,o)];if(this._renderWorldCopies){const d=this.pointCoordinate(new u.P(0,0)),g=this.pointCoordinate(new u.P(this.width,0)),y=this.pointCoordinate(new u.P(this.width,this.height)),E=this.pointCoordinate(new u.P(0,this.height)),C=Math.floor(Math.min(d.x,g.x,y.x,E.x)),L=Math.floor(Math.max(d.x,g.x,y.x,E.x)),A=1;for(let R=C-A;R<=L+A;R++)R!==0&&h.push(new u.b1(R,o))}return h}coveringTiles(o){var h,d;let g=this.coveringZoomLevel(o);const y=g;if(o.minzoom!==void 0&&go.maxzoom&&(g=o.maxzoom);const E=this.pointCoordinate(this.getCameraPoint()),C=u.Y.fromLngLat(this.center),L=Math.pow(2,g),A=[L*E.x,L*E.y,0],R=[L*C.x,L*C.y,0],z=Ta.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let q=o.minzoom||0;!o.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(q=g);const et=o.terrain?2/Math.min(this.tileSize,o.tileSize)*this.tileSize:3,Q=st=>({aabb:new La([st*L,0,0],[(st+1)*L,L,0]),zoom:0,x:0,y:0,wrap:st,fullyVisible:!1}),nt=[],K=[],pt=g,Et=o.reparseOverscaled?y:g;if(this._renderWorldCopies)for(let st=1;st<=3;st++)nt.push(Q(-st)),nt.push(Q(st));for(nt.push(Q(0));nt.length>0;){const st=nt.pop(),yt=st.x,kt=st.y;let Pt=st.fullyVisible;if(!Pt){const me=st.aabb.intersects(z);if(me===0)continue;Pt=me===2}const Bt=o.terrain?A:R,qt=st.aabb.distanceX(Bt),Ut=st.aabb.distanceY(Bt),Ht=Math.max(Math.abs(qt),Math.abs(Ut));if(st.zoom===pt||Ht>et+(1<=q){const me=pt-st.zoom,Ae=A[0]-.5-(yt<>1),Pe=st.zoom+1;let ye=st.aabb.quadrant(me);if(o.terrain){const Yn=new u.Q(Pe,st.wrap,Pe,Ae,re),an=o.terrain.getMinMaxElevation(Yn),Je=(h=an.minElevation)!==null&&h!==void 0?h:this.elevation,ln=(d=an.maxElevation)!==null&&d!==void 0?d:this.elevation;ye=new La([ye.min[0],ye.min[1],Je],[ye.max[0],ye.max[1],ln])}nt.push({aabb:ye,zoom:Pe,x:Ae,y:re,wrap:st.wrap,fullyVisible:Pt})}}return K.sort((st,yt)=>st.distanceSq-yt.distanceSq).map(st=>st.tileID)}resize(o,h){this.width=o,this.height=h,this.pixelsToGLUnits=[2/o,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(o){return Math.pow(2,o)}scaleZoom(o){return Math.log(o)/Math.LN2}project(o){const h=u.ac(o.lat,-this.maxValidLatitude,this.maxValidLatitude);return new u.P(u.N(o.lng)*this.worldSize,u.O(h)*this.worldSize)}unproject(o){return new u.Y(o.x/this.worldSize,o.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(o){const h=this.pointLocation(this.centerPoint,o),d=o.getElevationForLngLatZoom(h,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),y=u.Y.fromLngLat(g.lngLat,g.altitude),E=u.Y.fromLngLat(h,d),C=y.x-E.x,L=y.y-E.y,A=y.z-E.z,R=Math.sqrt(C*C+L*L+A*A),z=this.scaleZoom(this.cameraToCenterDistance/R/this.tileSize);this._elevation=d,this._center=h,this.zoom=z}setLocationAtPoint(o,h){const d=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(o),E=new u.Y(y.x-(d.x-g.x),y.y-(d.y-g.y));this.center=this.coordinateLocation(E),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(o,h){return h?this.coordinatePoint(this.locationCoordinate(o),h.getElevationForLngLatZoom(o,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(o))}pointLocation(o,h){return this.coordinateLocation(this.pointCoordinate(o,h))}locationCoordinate(o){return u.Y.fromLngLat(o)}coordinateLocation(o){return o&&o.toLngLat()}pointCoordinate(o,h){if(h){const q=h.pointCoordinate(o);if(q!=null)return q}const d=[o.x,o.y,0,1],g=[o.x,o.y,1,1];u.af(d,d,this.pixelMatrixInverse),u.af(g,g,this.pixelMatrixInverse);const y=d[3],E=g[3],C=d[1]/y,L=g[1]/E,A=d[2]/y,R=g[2]/E,z=A===R?0:(0-A)/(R-A);return new u.Y(u.z.number(d[0]/y,g[0]/E,z)/this.worldSize,u.z.number(C,L,z)/this.worldSize)}coordinatePoint(o,h=0,d=this.pixelMatrix){const g=[o.x*this.worldSize,o.y*this.worldSize,h,1];return u.af(g,g,d),new u.P(g[0]/g[3],g[1]/g[3])}getBounds(){const o=Math.max(0,this.height/2-this.getHorizon());return new Ie().extend(this.pointLocation(new u.P(0,o))).extend(this.pointLocation(new u.P(this.width,o))).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 Ie([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(o){o?(this.lngRange=[o.getWest(),o.getEast()],this.latRange=[o.getSouth(),o.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(o,h=!1){const d=o.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const y=o.canonical,E=this.worldSize/this.zoomScale(y.z),C=y.x+Math.pow(2,y.z)*o.wrap,L=u.an(new Float64Array(16));return u.H(L,L,[C*E,y.y*E,0]),u.J(L,L,[E/u.W,E/u.W,1]),u.K(L,h?this.alignedProjMatrix:this.projMatrix,L),g[d]=new Float32Array(L),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;let o=this.lngRange;if(!this._renderWorldCopies&&o===null){const Q=179.9999999999;o=[-Q,Q]}this._constraining=!0;let h,d,g,y,E=-90,C=90,L=-180,A=180;const R=this.size,z=this._unmodified;if(this.latRange){const Q=this.latRange;E=u.O(Q[1])*this.worldSize,C=u.O(Q[0])*this.worldSize,h=C-EC&&(y=C-nt)}if(o){const Q=(L+A)/2;let nt=q.x;this._renderWorldCopies&&(nt=u.b0(q.x,Q-this.worldSize/2,Q+this.worldSize/2));const K=R.x/2;nt-KA&&(g=A-K)}g===void 0&&y===void 0||(this.center=this.unproject(new u.P(g!==void 0?g:q.x,y!==void 0?y:q.y)).wrap()),this._unmodified=z,this._constraining=!1}_calcMatrices(){if(!this.height)return;const o=this.centerOffset,h=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=u.b2(1,this.center.lat)*this.worldSize;let g=u.an(new Float64Array(16));u.J(g,g,[this.width/2,-this.height/2,1]),u.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=u.an(new Float64Array(16)),u.J(g,g,[1,-1,1]),u.H(g,g,[-1,-1,0]),u.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),E=Math.min(this.elevation,this.minElevationForCurrentTile),C=y-E*this._pixelPerMeter/Math.cos(this._pitch),L=E<0?C:y,A=Math.PI/2+this._pitch,R=this._fov*(.5+o.y/this.height),z=Math.sin(R)*L/Math.sin(u.ac(Math.PI-A-R,.01,Math.PI-.01)),q=this.getHorizon(),et=2*Math.atan(q/this.cameraToCenterDistance)*(.5+o.y/(2*q)),Q=Math.sin(et)*L/Math.sin(u.ac(Math.PI-A-et,.01,Math.PI-.01)),nt=Math.min(z,Q),K=1.01*(Math.cos(Math.PI/2-this._pitch)*nt+L),pt=this.height/50;g=new Float64Array(16),u.b3(g,this._fov,this.width/this.height,pt,K),g[8]=2*-o.x/this.width,g[9]=2*o.y/this.height,u.J(g,g,[1,-1,1]),u.H(g,g,[0,0,-this.cameraToCenterDistance]),u.b4(g,g,this._pitch),u.ad(g,g,this.angle),u.H(g,g,[-h,-d,0]),this.mercatorMatrix=u.J([],g,[this.worldSize,this.worldSize,this.worldSize]),u.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=u.K(new Float64Array(16),this.labelPlaneMatrix,g),u.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=u.ar([],g),this.pixelMatrix3D=u.K(new Float64Array(16),this.labelPlaneMatrix,g);const Et=this.width%2/2,st=this.height%2/2,yt=Math.cos(this.angle),kt=Math.sin(this.angle),Pt=h-Math.round(h)+yt*Et+kt*st,Bt=d-Math.round(d)+yt*st+kt*Et,qt=new Float64Array(g);if(u.H(qt,qt,[Pt>.5?Pt-1:Pt,Bt>.5?Bt-1:Bt,0]),this.alignedProjMatrix=qt,g=u.ar(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const o=this.pointCoordinate(new u.P(0,0)),h=[o.x*this.worldSize,o.y*this.worldSize,0,1];return u.af(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const o=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,o))}getCameraQueryGeometry(o){const h=this.getCameraPoint();if(o.length===1)return[o[0],h];{let d=h.x,g=h.y,y=h.x,E=h.y;for(const C of o)d=Math.min(d,C.x),g=Math.min(g,C.y),y=Math.max(y,C.x),E=Math.max(E,C.y);return[new u.P(d,g),new u.P(y,g),new u.P(y,E),new u.P(d,E),new u.P(d,g)]}}lngLatToCameraDepth(o,h){const d=this.locationCoordinate(o),g=[d.x*this.worldSize,d.y*this.worldSize,h,1];return u.af(g,g,this.projMatrix),g[2]/g[3]}}function dp(_,o){let h,d=!1,g=null,y=null;const E=()=>{g=null,d&&(_.apply(y,h),g=setTimeout(E,o),d=!1)};return(...C)=>(d=!0,y=this,h=C,g||E(),g)}class mp{constructor(o){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let d;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:d,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,h)}catch{}},this._updateHash=dp(this._updateHashUnthrottled,300),this._hashName=o&&encodeURIComponent(o)}addTo(o){return this._map=o,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(o){const h=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,g),E=Math.round(h.lng*y)/y,C=Math.round(h.lat*y)/y,L=this._map.getBearing(),A=this._map.getPitch();let R="";if(R+=o?`/${E}/${C}/${d}`:`${d}/${C}/${E}`,(L||A)&&(R+="/"+Math.round(10*L)/10),A&&(R+=`/${Math.round(A)}`),this._hashName){const z=this._hashName;let q=!1;const et=window.location.hash.slice(1).split("&").map(Q=>{const nt=Q.split("=")[0];return nt===z?(q=!0,`${nt}=${R}`):Q}).filter(Q=>Q);return q||et.push(`${z}=${R}`),`#${et.join("&")}`}return`#${R}`}}const Lu={linearity:.3,easing:u.b5(0,0,.3,1)},Id=u.e({deceleration:2500,maxSpeed:1400},Lu),nl=u.e({deceleration:20,maxSpeed:1400},Lu),Ed=u.e({deceleration:1e3,maxSpeed:360},Lu),Sd=u.e({deceleration:1e3,maxSpeed:90},Lu);class Cd{constructor(o){this._map=o,this.clear()}clear(){this._inertiaBuffer=[]}record(o){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:P.now(),settings:o})}_drainInertiaBuffer(){const o=this._inertiaBuffer,h=P.now();for(;o.length>0&&h-o[0].time>160;)o.shift()}_onMoveEnd(o){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)h.zoom+=y.zoomDelta||0,h.bearing+=y.bearingDelta||0,h.pitch+=y.pitchDelta||0,y.panDelta&&h.pan._add(y.panDelta),y.around&&(h.around=y.around),y.pinchAround&&(h.pinchAround=y.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const y=Mu(h.pan.mag(),d,u.e({},Id,o||{}));g.offset=h.pan.mult(y.amount/h.pan.mag()),g.center=this._map.transform.center,Pu(g,y)}if(h.zoom){const y=Mu(h.zoom,d,nl);g.zoom=this._map.transform.zoom+y.amount,Pu(g,y)}if(h.bearing){const y=Mu(h.bearing,d,Ed);g.bearing=this._map.transform.bearing+u.ac(y.amount,-179,179),Pu(g,y)}if(h.pitch){const y=Mu(h.pitch,d,Sd);g.pitch=this._map.transform.pitch+y.amount,Pu(g,y)}if(g.zoom||g.bearing){const y=h.pinchAround===void 0?h.around:h.pinchAround;g.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),u.e(g,{noMoveStart:!0})}}function Pu(_,o){(!_.duration||_.durationh.unproject(L)),C=y.reduce((L,A,R,z)=>L.add(A.div(z.length)),new u.P(0,0));super(o,{points:y,point:C,lngLats:E,lngLat:h.unproject(C),originalEvent:d}),this._defaultPrevented=!1}}class il extends u.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(o,h,d){super(o,{originalEvent:d}),this._defaultPrevented=!1}}class Td{constructor(o,h){this._map=o,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(o){return this._firePreventable(new il(o.type,this._map,o))}mousedown(o,h){return this._mousedownPos=h,this._firePreventable(new ro(o.type,this._map,o))}mouseup(o){this._map.fire(new ro(o.type,this._map,o))}click(o,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new ro(o.type,this._map,o))}dblclick(o){return this._firePreventable(new ro(o.type,this._map,o))}mouseover(o){this._map.fire(new ro(o.type,this._map,o))}mouseout(o){this._map.fire(new ro(o.type,this._map,o))}touchstart(o){return this._firePreventable(new Ul(o.type,this._map,o))}touchmove(o){this._map.fire(new Ul(o.type,this._map,o))}touchend(o){this._map.fire(new Ul(o.type,this._map,o))}touchcancel(o){this._map.fire(new Ul(o.type,this._map,o))}_firePreventable(o){if(this._map.fire(o),o.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class es{constructor(o){this._map=o}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(o){this._map.fire(new ro(o.type,this._map,o))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ro("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(o){this._delayContextMenu?this._contextMenuEvent=o:this._ignoreContextMenu||this._map.fire(new ro(o.type,this._map,o)),this._map.listens("contextmenu")&&o.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class oo{constructor(o){this._map=o}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(o){return this.transform.pointLocation(u.P.convert(o),this._map.terrain)}}class gp{constructor(o,h){this._map=o,this._tr=new oo(o),this._el=o.getCanvasContainer(),this._container=o.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(o,h){this.isEnabled()&&o.shiftKey&&o.button===0&&(k.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(o,h){if(!this._active)return;const d=h;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)y.fitScreenCoordinates(d,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",o)}keydown(o){this._active&&o.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",o))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(k.remove(this._box),this._box=null),k.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(o,h){return this._map.fire(new u.k(o,{originalEvent:h}))}}function Bo(_,o){if(_.length!==o.length)throw new Error(`The number of touches and points are not equal - touches ${_.length}, points ${o.length}`);const h={};for(let d=0;d<_.length;d++)h[_[d].identifier]=o[d];return h}class Au{constructor(o){this.reset(),this.numTouches=o.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(o,h,d){(this.centroid||d.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=o.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const y=new u.P(0,0);for(const E of g)y._add(E);return y.div(g.length)}(h),this.touches=Bo(d,h)))}touchmove(o,h,d){if(this.aborted||!this.centroid)return;const g=Bo(d,h);for(const y in this.touches){const E=g[y];(!E||E.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(o,h,d){if((!this.centroid||o.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class _p{constructor(o){this.singleTap=new Au(o),this.numTaps=o.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(o,h,d){this.singleTap.touchstart(o,h,d)}touchmove(o,h,d){this.singleTap.touchmove(o,h,d)}touchend(o,h,d){const g=this.singleTap.touchend(o,h,d);if(g){const y=o.timeStamp-this.lastTime<500,E=!this.lastTap||this.lastTap.dist(g)<30;if(y&&E||this.reset(),this.count++,this.lastTime=o.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class yg{constructor(o){this._tr=new oo(o),this._zoomIn=new _p({numTouches:1,numTaps:2}),this._zoomOut=new _p({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(o,h,d){this._zoomIn.touchstart(o,h,d),this._zoomOut.touchstart(o,h,d)}touchmove(o,h,d){this._zoomIn.touchmove(o,h,d),this._zoomOut.touchmove(o,h,d)}touchend(o,h,d){const g=this._zoomIn.touchend(o,h,d),y=this._zoomOut.touchend(o,h,d),E=this._tr;return g?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:E.zoom+1,around:E.unproject(g)},{originalEvent:o})}):y?(this._active=!0,o.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:E.zoom-1,around:E.unproject(y)},{originalEvent:o})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ku{constructor(o){this._enabled=!!o.enable,this._moveStateManager=o.moveStateManager,this._clickTolerance=o.clickTolerance||1,this._moveFunction=o.move,this._activateOnStart=!!o.activateOnStart,o.assignEvents(this),this.reset()}reset(o){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(o)}_move(...o){const h=this._moveFunction(...o);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(o,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(o)&&(this._moveStateManager.startMove(o),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(o,h){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(o.preventDefault(),!this._moveStateManager.isValidMoveEvent(o))return void this.reset(o);const g=h.length?h[0]:h;return!this._moved&&g.dist(d){_.mousedown=_.dragStart,_.mousemoveWindow=_.dragMove,_.mouseup=_.dragEnd,_.contextmenu=function(o){o.preventDefault()}},yp=({enable:_,clickTolerance:o,bearingDegreesPerPixelMoved:h=.8})=>{const d=new rl({checkCorrectEvent:g=>k.mouseButton(g)===0&&g.ctrlKey||k.mouseButton(g)===2});return new ku({clickTolerance:o,move:(g,y)=>({bearingDelta:(y.x-g.x)*h}),moveStateManager:d,enable:_,assignEvents:de})},Gl=({enable:_,clickTolerance:o,pitchDegreesPerPixelMoved:h=-.5})=>{const d=new rl({checkCorrectEvent:g=>k.mouseButton(g)===0&&g.ctrlKey||k.mouseButton(g)===2});return new ku({clickTolerance:o,move:(g,y)=>({pitchDelta:(y.y-g.y)*h}),moveStateManager:d,enable:_,assignEvents:de})};class Du{constructor(o,h){this._clickTolerance=o.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(o,h,d){return this._calculateTransform(o,h,d)}touchmove(o,h,d){if(this._active&&!(d.length0&&(this._active=!0);const g=Bo(d,h),y=new u.P(0,0),E=new u.P(0,0);let C=0;for(const A in g){const R=g[A],z=this._touches[A];z&&(y._add(R),E._add(R.sub(z)),C++,g[A]=R)}if(this._touches=g,CMath.abs(_.x)}class vp extends Gc{constructor(o){super(),this._currentTouchCount=0,this._map=o}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(o,h,d){super.touchstart(o,h,d),this._currentTouchCount=d.length}_start(o){this._lastPoints=o,Zc(o[0].sub(o[1]))&&(this._valid=!1)}_move(o,h,d){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=o[0].sub(this._lastPoints[0]),y=o[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,y,d.timeStamp),this._valid?(this._lastPoints=o,this._active=!0,{pitchDelta:(g.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(o,h,d){if(this._valid!==void 0)return this._valid;const g=o.mag()>=2,y=h.mag()>=2;if(!g&&!y)return;if(!g||!y)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const E=o.y>0==h.y>0;return Zc(o)&&Zc(h)&&E}}const vg={panStep:100,bearingStep:15,pitchStep:10};class Ad{constructor(o){this._tr=new oo(o);const h=vg;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(o){if(o.altKey||o.ctrlKey||o.metaKey)return;let h=0,d=0,g=0,y=0,E=0;switch(o.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:o.shiftKey?d=-1:(o.preventDefault(),y=-1);break;case 39:o.shiftKey?d=1:(o.preventDefault(),y=1);break;case 38:o.shiftKey?g=1:(o.preventDefault(),E=-1);break;case 40:o.shiftKey?g=-1:(o.preventDefault(),E=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:C=>{const L=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:ol,zoom:h?Math.round(L.zoom)+h*(o.shiftKey?2:1):L.zoom,bearing:L.bearing+d*this._bearingStep,pitch:L.pitch+g*this._pitchStep,offset:[-y*this._panStep,-E*this._panStep],center:L.center},{originalEvent:o})}}}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 ol(_){return _*(2-_)}const Xn=4.000244140625;class Ru{constructor(o,h){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=o,this._tr=new oo(o),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(o){this._defaultZoomRate=o}setWheelZoomRate(o){this._wheelZoomRate=o}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(o){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!o&&o.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(o){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!o[this._map.cooperativeGestures._bypassKey])return;let h=o.deltaMode===WheelEvent.DOM_DELTA_LINE?40*o.deltaY:o.deltaY;const d=P.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,h!==0&&h%Xn==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,o)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),o.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=o,this._delta-=h,this._active||this._start(o)),o.preventDefault()}_start(o){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const h=k.mousePos(this._map.getCanvas(),o),d=this._tr;this._around=h.y>d.transform.height/2-d.transform.getHorizon()?u.M.convert(this._aroundCenter?d.center:d.unproject(h)):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 o=this._tr.transform;if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>Xn?this._wheelZoomRate:this._defaultZoomRate;let L=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&L!==0&&(L=1/L);const A=typeof this._targetZoom=="number"?o.zoomScale(this._targetZoom):o.scale;this._targetZoom=Math.min(o.maxZoom,Math.max(o.minZoom,o.scaleZoom(A*L))),this._type==="wheel"&&(this._startZoom=o.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:o.zoom,d=this._startZoom,g=this._easing;let y,E=!1;if(this._type==="wheel"&&d&&g){const C=Math.min((P.now()-this._lastWheelEventTime)/200,1),L=g(C);y=u.z.number(d,h,L),C<1?this._frameId||(this._frameId=!0):E=!0}else y=h,E=!0;return this._active=!0,E&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!E,zoomDelta:y-o.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(o){let h=u.b6;if(this._prevEase){const d=this._prevEase,g=(P.now()-d.start)/d.duration,y=d.easing(g+.01)-d.easing(g),E=.27/Math.sqrt(y*y+1e-4)*.01,C=Math.sqrt(.0729-E*E);h=u.b5(E,C,.25,1)}return this._prevEase={start:P.now(),duration:o,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Wc{constructor(o,h){this._clickZoom=o,this._tapZoom=h}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class kd{constructor(o){this._tr=new oo(o),this.reset()}reset(){this._active=!1}dblclick(o,h){return o.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(o.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:o})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Dd{constructor(){this._tap=new _p({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(o,h,d){if(!this._swipePoint)if(this._tapTime){const g=h[0],y=o.timeStamp-this._tapTime<500,E=this._tapPoint.dist(g)<30;y&&E?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(o,h,d)}touchmove(o,h,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=h[0],y=g.y-this._swipePoint.y;return this._swipePoint=g,o.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(o,h,d)}touchend(o,h,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(o,h,d);g&&(this._tapTime=o.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xp{constructor(o,h,d){this._el=o,this._mousePan=h,this._touchPan=d}enable(o){this._inertiaOptions=o||{},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 Rd{constructor(o,h,d){this._pitchWithRotate=o.pitchWithRotate,this._mouseRotate=h,this._mousePitch=d}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ns{constructor(o,h,d,g){this._el=o,this._touchZoom=h,this._touchRotate=d,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(o){this._touchZoom.enable(o),this._rotationDisabled||this._touchRotate.enable(o),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 Nu{constructor(o,h){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=o,this._options=h,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const o=this._map.getCanvasContainer();o.classList.add("maplibregl-cooperative-gestures"),this._container=k.create("div","maplibregl-cooperative-gesture-screen",o);let h=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(h=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const d=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=h,this._container.appendChild(g);const y=document.createElement("div");y.className="maplibregl-mobile-message",y.textContent=d,this._container.appendChild(y),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(k.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(o){this._onCooperativeGesture(o.touches.length===1)}wheel(o){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!o[this._bypassKey])}_onCooperativeGesture(o){this._enabled&&o&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const be=_=>_.zoom||_.drag||_.pitch||_.rotate;class ke extends u.k{}function ql(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class bp{constructor(o,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,y)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const E=g.type==="renderFrame"?void 0:g,C={needsRenderFrame:!1},L={},A={},R=g.touches,z=R?this._getMapTouches(R):void 0,q=z?k.touchPos(this._map.getCanvas(),z):k.mousePos(this._map.getCanvas(),g);for(const{handlerName:nt,handler:K,allowed:pt}of this._handlers){if(!K.isEnabled())continue;let Et;this._blockedByActive(A,pt,nt)?K.reset():K[y||g.type]&&(Et=K[y||g.type](g,q,z),this.mergeHandlerResult(C,L,Et,nt,E),Et&&Et.needsRenderFrame&&this._triggerRenderFrame()),(Et||K.isActive())&&(A[nt]=K)}const et={};for(const nt in this._previousActiveHandlers)A[nt]||(et[nt]=E);this._previousActiveHandlers=A,(Object.keys(et).length||ql(C))&&(this._changes.push([C,L,et]),this._triggerRenderFrame()),(Object.keys(A).length||ql(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:Q}=C;Q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Q(this._map))},this._map=o,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Cd(o),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,y,E]of this._listeners)k.addEventListener(g,y,g===document?this.handleWindowEvent:this.handleEvent,E)}destroy(){for(const[o,h,d]of this._listeners)k.removeEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(o){const h=this._map,d=h.getCanvasContainer();this._add("mapEvent",new Td(h,o));const g=h.boxZoom=new gp(h,o);this._add("boxZoom",g),o.interactive&&o.boxZoom&&g.enable();const y=h.cooperativeGestures=new Nu(h,o.cooperativeGestures);this._add("cooperativeGestures",y),o.cooperativeGestures&&y.enable();const E=new yg(h),C=new kd(h);h.doubleClickZoom=new Wc(C,E),this._add("tapZoom",E),this._add("clickZoom",C),o.interactive&&o.doubleClickZoom&&h.doubleClickZoom.enable();const L=new Dd;this._add("tapDragZoom",L);const A=h.touchPitch=new vp(h);this._add("touchPitch",A),o.interactive&&o.touchPitch&&h.touchPitch.enable(o.touchPitch);const R=yp(o),z=Gl(o);h.dragRotate=new Rd(o,R,z),this._add("mouseRotate",R,["mousePitch"]),this._add("mousePitch",z,["mouseRotate"]),o.interactive&&o.dragRotate&&h.dragRotate.enable();const q=(({enable:Et,clickTolerance:st})=>{const yt=new rl({checkCorrectEvent:kt=>k.mouseButton(kt)===0&&!kt.ctrlKey});return new ku({clickTolerance:st,move:(kt,Pt)=>({around:Pt,panDelta:Pt.sub(kt)}),activateOnStart:!0,moveStateManager:yt,enable:Et,assignEvents:de})})(o),et=new Du(o,h);h.dragPan=new xp(d,q,et),this._add("mousePan",q),this._add("touchPan",et,["touchZoom","touchRotate"]),o.interactive&&o.dragPan&&h.dragPan.enable(o.dragPan);const Q=new jc,nt=new Pd;h.touchZoomRotate=new ns(d,nt,Q,L),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",nt,["touchPan","touchRotate"]),o.interactive&&o.touchZoomRotate&&h.touchZoomRotate.enable(o.touchZoomRotate);const K=h.scrollZoom=new Ru(h,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),o.interactive&&o.scrollZoom&&h.scrollZoom.enable(o.scrollZoom);const pt=h.keyboard=new Ad(h);this._add("keyboard",pt),o.interactive&&o.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new es(h))}_add(o,h,d){this._handlers.push({handlerName:o,handler:h,allowed:d}),this._handlersById[o]=h}stop(o){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},o),this._changes=[]}}isActive(){for(const{handler:o}of this._handlers)if(o.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!be(this._eventsInProgress)||this.isZooming()}_blockedByActive(o,h,d){for(const g in o)if(g!==d&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(o){const h=[];for(const d of o)this._el.contains(d.target)&&h.push(d);return h}mergeHandlerResult(o,h,d,g,y){if(!d)return;u.e(o,d);const E={handlerName:g,originalEvent:d.originalEvent||y};d.zoomDelta!==void 0&&(h.zoom=E),d.panDelta!==void 0&&(h.drag=E),d.pitchDelta!==void 0&&(h.pitch=E),d.bearingDelta!==void 0&&(h.rotate=E)}_applyChanges(){const o={},h={},d={};for(const[g,y,E]of this._changes)g.panDelta&&(o.panDelta=(o.panDelta||new u.P(0,0))._add(g.panDelta)),g.zoomDelta&&(o.zoomDelta=(o.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(o.bearingDelta=(o.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(o.pitchDelta=(o.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(o.around=g.around),g.pinchAround!==void 0&&(o.pinchAround=g.pinchAround),g.noInertia&&(o.noInertia=g.noInertia),u.e(h,y),u.e(d,E);this._updateMapTransform(o,h,d),this._changes=[]}_updateMapTransform(o,h,d){const g=this._map,y=g._getTransformForUpdate(),E=g.terrain;if(!(ql(o)||E&&this._terrainMovement))return this._fireEvents(h,d,!0);let{panDelta:C,zoomDelta:L,bearingDelta:A,pitchDelta:R,around:z,pinchAround:q}=o;q!==void 0&&(z=q),g._stop(!0),z=z||g.transform.centerPoint;const et=y.pointLocation(C?z.sub(C):z);A&&(y.bearing+=A),R&&(y.pitch+=R),L&&(y.zoom+=L),E?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(C)):y.setLocationAtPoint(et,z):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(et,z),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(g.terrain)})):y.setLocationAtPoint(et,z),g._applyUpdatedTransform(y),this._map._update(),o.noInertia||this._inertia.record(o),this._fireEvents(h,d,!0)}_fireEvents(o,h,d){const g=be(this._eventsInProgress),y=be(o),E={};for(const R in o){const{originalEvent:z}=o[R];this._eventsInProgress[R]||(E[`${R}start`]=z),this._eventsInProgress[R]=o[R]}!g&&y&&this._fireEvent("movestart",y.originalEvent);for(const R in E)this._fireEvent(R,E[R]);y&&this._fireEvent("move",y.originalEvent);for(const R in o){const{originalEvent:z}=o[R];this._fireEvent(R,z)}const C={};let L;for(const R in this._eventsInProgress){const{handlerName:z,originalEvent:q}=this._eventsInProgress[R];this._handlersById[z].isActive()||(delete this._eventsInProgress[R],L=h[z]||q,C[`${R}end`]=L)}for(const R in C)this._fireEvent(R,C[R]);const A=be(this._eventsInProgress);if(d&&(g||y)&&!A){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=q=>q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new ke("renderFrame",{timeStamp:o})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class wp extends u.E{constructor(o,h){super(),this._renderFrameCallback=()=>{const d=Math.min((P.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=o,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new u.M(this.transform.center.lng,this.transform.center.lat)}setCenter(o,h){return this.jumpTo({center:o},h)}panBy(o,h,d){return o=u.P.convert(o).mult(-1),this.panTo(this.transform.center,u.e({offset:o},h),d)}panTo(o,h,d){return this.easeTo(u.e({center:o},h),d)}getZoom(){return this.transform.zoom}setZoom(o,h){return this.jumpTo({zoom:o},h),this}zoomTo(o,h,d){return this.easeTo(u.e({zoom:o},h),d)}zoomIn(o,h){return this.zoomTo(this.getZoom()+1,o,h),this}zoomOut(o,h){return this.zoomTo(this.getZoom()-1,o,h),this}getBearing(){return this.transform.bearing}setBearing(o,h){return this.jumpTo({bearing:o},h),this}getPadding(){return this.transform.padding}setPadding(o,h){return this.jumpTo({padding:o},h),this}rotateTo(o,h,d){return this.easeTo(u.e({bearing:o},h),d)}resetNorth(o,h){return this.rotateTo(0,u.e({duration:1e3},o),h),this}resetNorthPitch(o,h){return this.easeTo(u.e({bearing:0,pitch:0,duration:1e3},o),h),this}snapToNorth(o,h){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=u.z.number(g,L,Pt)),this._rotating&&(d.bearing=u.z.number(y,A,Pt)),this._pitching&&(d.pitch=u.z.number(E,R,Pt)),this._padding&&(d.interpolatePadding(C,z,Pt),et=d.centerPoint.add(q)),this.terrain&&!o.freezeElevation&&this._updateElevation(Pt),st)d.setLocationAtPoint(st,yt);else{const Bt=d.zoomScale(d.zoom-g),qt=L>g?Math.min(2,Et):Math.max(.5,Et),Ut=Math.pow(qt,1-Pt),Ht=d.unproject(K.add(pt.mult(Pt*Ut)).mult(Bt));d.setLocationAtPoint(d.renderWorldCopies?Ht.wrap():Ht,et)}this._applyUpdatedTransform(d),this._fireMoveEvents(h)},Pt=>{this.terrain&&this._finalizeElevation(),this._afterEase(h,Pt)},o),this}_prepareEase(o,h,d={}){this._moving=!0,h||d.moving||this.fire(new u.k("movestart",o)),this._zooming&&!d.zooming&&this.fire(new u.k("zoomstart",o)),this._rotating&&!d.rotating&&this.fire(new u.k("rotatestart",o)),this._pitching&&!d.pitching&&this.fire(new u.k("pitchstart",o))}_prepareElevation(o){this._elevationCenter=o,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(o){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(o<1&&h!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=o*(d-(h-(d*o+this._elevationStart))/(1-o)),this._elevationTarget=h}this.transform.elevation=u.z.number(this._elevationStart,this._elevationTarget,o)}_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(o){if(!this.transformCameraUpdate)return;const h=o.clone(),{center:d,zoom:g,pitch:y,bearing:E,elevation:C}=this.transformCameraUpdate(h);d&&(h.center=d),g!==void 0&&(h.zoom=g),y!==void 0&&(h.pitch=y),E!==void 0&&(h.bearing=E),C!==void 0&&(h.elevation=C),this.transform.apply(h)}_fireMoveEvents(o){this.fire(new u.k("move",o)),this._zooming&&this.fire(new u.k("zoom",o)),this._rotating&&this.fire(new u.k("rotate",o)),this._pitching&&this.fire(new u.k("pitch",o))}_afterEase(o,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const d=this._zooming,g=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new u.k("zoomend",o)),g&&this.fire(new u.k("rotateend",o)),y&&this.fire(new u.k("pitchend",o)),this.fire(new u.k("moveend",o))}flyTo(o,h){if(!o.essential&&P.prefersReducedMotion){const ye=u.L(o,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ye,h)}this.stop(),o=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.b6},o);const d=this._getTransformForUpdate(),g=this.getZoom(),y=this.getBearing(),E=this.getPitch(),C=this.getPadding(),L="zoom"in o?u.ac(+o.zoom,d.minZoom,d.maxZoom):g,A="bearing"in o?this._normalizeBearing(o.bearing,y):y,R="pitch"in o?+o.pitch:E,z="padding"in o?o.padding:d.padding,q=d.zoomScale(L-g),et=u.P.convert(o.offset);let Q=d.centerPoint.add(et);const nt=d.pointLocation(Q),K=u.M.convert(o.center||nt);this._normalizeCenter(K);const pt=d.project(nt),Et=d.project(K).sub(pt);let st=o.curve;const yt=Math.max(d.width,d.height),kt=yt/q,Pt=Et.mag();if("minZoom"in o){const ye=u.ac(Math.min(o.minZoom,g,L),d.minZoom,d.maxZoom),Yn=yt/d.zoomScale(ye-g);st=Math.sqrt(Yn/Pt*2)}const Bt=st*st;function qt(ye){const Yn=(kt*kt-yt*yt+(ye?-1:1)*Bt*Bt*Pt*Pt)/(2*(ye?kt:yt)*Bt*Pt);return Math.log(Math.sqrt(Yn*Yn+1)-Yn)}function Ut(ye){return(Math.exp(ye)-Math.exp(-ye))/2}function Ht(ye){return(Math.exp(ye)+Math.exp(-ye))/2}const me=qt(!1);let Ae=function(ye){return Ht(me)/Ht(me+st*ye)},re=function(ye){return yt*((Ht(me)*(Ut(Yn=me+st*ye)/Ht(Yn))-Ut(me))/Bt)/Pt;var Yn},Pe=(qt(!0)-me)/st;if(Math.abs(Pt)<1e-6||!isFinite(Pe)){if(Math.abs(yt-kt)<1e-6)return this.easeTo(o,h);const ye=kto.maxDuration&&(o.duration=0),this._zooming=!0,this._rotating=y!==A,this._pitching=R!==E,this._padding=!d.isPaddingEqual(z),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(K),this._ease(ye=>{const Yn=ye*Pe,an=1/Ae(Yn);d.zoom=ye===1?L:g+d.scaleZoom(an),this._rotating&&(d.bearing=u.z.number(y,A,ye)),this._pitching&&(d.pitch=u.z.number(E,R,ye)),this._padding&&(d.interpolatePadding(C,z,ye),Q=d.centerPoint.add(et)),this.terrain&&!o.freezeElevation&&this._updateElevation(ye);const Je=ye===1?K:d.unproject(pt.add(Et.mult(re(Yn))).mult(an));d.setLocationAtPoint(d.renderWorldCopies?Je.wrap():Je,Q),this._applyUpdatedTransform(d),this._fireMoveEvents(h)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(h)},o),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(o,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,h)}if(!o){const d=this.handlers;d&&d.stop(!1)}return this}_ease(o,h,d){d.animate===!1||d.duration===0?(o(1),h()):(this._easeStart=P.now(),this._easeOptions=d,this._onEaseFrame=o,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(o,h){o=u.b0(o,-180,180);const d=Math.abs(o-h);return Math.abs(o-360-h)180?-360:d<-180?360:0}queryTerrainElevation(o){return this.terrain?this.terrain.getElevationForLngLatZoom(u.M.convert(o),this.transform.tileZoom)-this.transform.elevation:null}}const qr={compact:!0,customAttribution:'MapLibre'};class Ip{constructor(o=qr){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=o}getDefaultPosition(){return"bottom-right"}onAdd(o){return this._map=o,this._compact=this.options.compact,this._container=k.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=k.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=k.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(){k.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(o,h){const d=this._map._getUIString(`AttributionControl.${h}`);o.title=d,o.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let o=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?o=o.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&o.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const y=h[g];if(y.used||y.usedForTerrain){const E=y.getSource();E.attribution&&o.indexOf(E.attribution)<0&&o.push(E.attribution)}}o=o.filter(g=>String(g).trim()),o.sort((g,y)=>g.length-y.length),o=o.filter((g,y)=>{for(let E=y+1;E=0)return!1;return!0});const d=o.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,o.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 is{constructor(o={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const d=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=o}getDefaultPosition(){return"bottom-left"}onAdd(o){this._map=o,this._compact=this.options&&this.options.compact,this._container=k.create("div","maplibregl-ctrl");const h=k.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){k.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class xg{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(o){const h=++this._id;return this._queue.push({callback:o,id:h,cancelled:!1}),h}remove(o){const h=this._currentlyRunning,d=h?this._queue.concat(h):this._queue;for(const g of d)if(g.id===o)return void(g.cancelled=!0)}run(o=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const d of h)if(!d.cancelled&&(d.callback(o),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var zu=u.X([{name:"a_pos3d",type:"Int16",components:3}]);class hi extends u.E{constructor(o){super(),this.sourceCache=o,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,o.usedForTerrain=!0,o.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(o,h){this.sourceCache.update(o,h),this._renderableTilesKeys=[];const d={};for(const g of o.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),u.aN(g.posMatrix,0,u.W,0,u.W,0,1),this._tiles[g.key]=new No(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(o){for(const h in this._tiles){const d=this._tiles[h];(!o||d.tileID.equals(o)||d.tileID.isChildOf(o)||o.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(o=>this.getTileByID(o))}getTileByID(o){return this._tiles[o]}getTerrainCoords(o){const h={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(o.canonical)){const y=o.clone();y.posMatrix=new Float64Array(16),u.aN(y.posMatrix,0,u.W,0,u.W,0,1),h[d]=y}else if(g.canonical.isChildOf(o.canonical)){const y=o.clone();y.posMatrix=new Float64Array(16);const E=g.canonical.z-o.canonical.z,C=g.canonical.x-(g.canonical.x>>E<>E<>E;u.aN(y.posMatrix,0,A,0,A,0,1),u.H(y.posMatrix,y.posMatrix,[-C*A,-L*A,0]),h[d]=y}else if(o.canonical.isChildOf(g.canonical)){const y=o.clone();y.posMatrix=new Float64Array(16);const E=o.canonical.z-g.canonical.z,C=o.canonical.x-(o.canonical.x>>E<>E<>E;u.aN(y.posMatrix,0,u.W,0,u.W,0,1),u.H(y.posMatrix,y.posMatrix,[C*A,L*A,0]),u.J(y.posMatrix,y.posMatrix,[1/2**E,1/2**E,0]),h[d]=y}}return h}getSourceTile(o,h){const d=this.sourceCache._source;let g=o.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(o.scaledTo(g--).key);return y}tilesAfterTime(o=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=o)}}class Si{constructor(o,h,d){this.painter=o,this.sourceCache=new hi(h),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(o,h,d,g=u.W){var y;if(!(h>=0&&h=0&&do.canonical.z&&(o.canonical.z>=g?y=o.canonical.z-g:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const E=o.canonical.x-(o.canonical.x>>y<>y<>8<<4|y>>8,h[E+3]=0;const d=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new Ct(o,d,o.gl.RGBA,{premultiply:!1});return g.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(o){const h=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(o.x,this.painter.height/devicePixelRatio-o.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),d.bindFramebuffer.set(null);const y=h[0]+(h[2]>>4<<8),E=h[1]+((15&h[2])<<8),C=this.coordsIndex[255-h[3]],L=C&&this.sourceCache.getTileByID(C);if(!L)return null;const A=this._coordsTextureSize,R=(1<o.id!==h),this._recentlyUsed.push(o.id)}stampObject(o){o.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const o=this._createObject(this._objects.length);return this._objects.push(o),o}freeObject(o){o.inUse=!1}freeAllObjects(){for(const o of this._objects)this.freeObject(o)}isFull(){return!(this._objects.length!o.inUse)===!1}}const Ss={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Hc{constructor(o,h){this.painter=o,this.terrain=h,this.pool=new Nd(o.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(o){return this.pool.getObjectForId(o.rtt[this._stacks.length-1].id).texture}prepareForRender(o,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=o._order.filter(d=>!o._layers[d].isHidden(h)),this._coordsDescendingInv={};for(const d in o.sourceCaches){this._coordsDescendingInv[d]={};const g=o.sourceCaches[d].getVisibleCoordinates();for(const y of g){const E=this.terrain.sourceCache.getTerrainCoords(y);for(const C in E)this._coordsDescendingInv[d][C]||(this._coordsDescendingInv[d][C]=[]),this._coordsDescendingInv[d][C].push(E[C])}}this._coordsDescendingInvStr={};for(const d of o._order){const g=o._layers[d],y=g.source;if(Ss[g.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const E in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][E]=this._coordsDescendingInv[y][E].map(C=>C.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[g][d.tileID.key];y&&y!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(o){if(o.isHidden(this.painter.transform.zoom))return!1;const h=o.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===o.id;if(Ss[h]&&(this._prevType&&Ss[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(o.id),!g))return!0;if(Ss[this._prevType]||Ss[h]&&g){this._prevType=h;const y=this._stacks.length-1,E=this._stacks[y]||[];for(const C of this._renderableTiles){if(this.pool.isFull()&&(Vc(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(C),C.rtt[y]){const A=this.pool.getObjectForId(C.rtt[y].id);if(A.stamp===C.rtt[y].stamp){this.pool.useObject(A);continue}}const L=this.pool.getOrCreateFreeObject();this.pool.useObject(L),this.pool.stampObject(L),C.rtt[y]={id:L.id,stamp:L.stamp},d.context.bindFramebuffer.set(L.fbo.framebuffer),d.context.clear({color:u.aO.transparent,stencil:0}),d.currentStencilSource=void 0;for(let A=0;A{_.touchstart=_.dragStart,_.touchmoveWindow=_.dragMove,_.touchend=_.dragEnd},Tp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Lp{constructor(o,h,d=!1){this.mousedown=E=>{this.startMouse(u.e({},E,{ctrlKey:!0,preventDefault:()=>E.preventDefault()}),k.mousePos(this.element,E)),k.addEventListener(window,"mousemove",this.mousemove),k.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=E=>{this.moveMouse(E,k.mousePos(this.element,E))},this.mouseup=E=>{this.mouseRotate.dragEnd(E),this.mousePitch&&this.mousePitch.dragEnd(E),this.offTemp()},this.touchstart=E=>{E.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=k.touchPos(this.element,E.targetTouches)[0],this.startTouch(E,this._startPos),k.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.addEventListener(window,"touchend",this.touchend))},this.touchmove=E=>{E.targetTouches.length!==1?this.reset():(this._lastPos=k.touchPos(this.element,E.targetTouches)[0],this.moveTouch(E,this._lastPos))},this.touchend=E=>{E.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=o.dragRotate._mouseRotate.getClickTolerance(),y=o.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=yp({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:E,clickTolerance:C,bearingDegreesPerPixelMoved:L=.8})=>{const A=new na;return new ku({clickTolerance:C,move:(R,z)=>({bearingDelta:(z.x-R.x)*L}),moveStateManager:A,enable:E,assignEvents:jl})})({clickTolerance:g,enable:!0}),this.map=o,d&&(this.mousePitch=Gl({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:E,clickTolerance:C,pitchDegreesPerPixelMoved:L=-.5})=>{const A=new na;return new ku({clickTolerance:C,move:(R,z)=>({pitchDelta:(z.y-R.y)*L}),moveStateManager:A,enable:E,assignEvents:jl})})({clickTolerance:y,enable:!0})),k.addEventListener(h,"mousedown",this.mousedown),k.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),k.addEventListener(h,"touchcancel",this.reset)}startMouse(o,h){this.mouseRotate.dragStart(o,h),this.mousePitch&&this.mousePitch.dragStart(o,h),k.disableDrag()}startTouch(o,h){this.touchRotate.dragStart(o,h),this.touchPitch&&this.touchPitch.dragStart(o,h),k.disableDrag()}moveMouse(o,h){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(o,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(o,h)||{};y&&d.setPitch(d.getPitch()+y)}}moveTouch(o,h){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(o,h)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(o,h)||{};y&&d.setPitch(d.getPitch()+y)}}off(){const o=this.element;k.removeEventListener(o,"mousedown",this.mousedown),k.removeEventListener(o,"touchstart",this.touchstart,{passive:!1}),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend),k.removeEventListener(o,"touchcancel",this.reset),this.offTemp()}offTemp(){k.enableDrag(),k.removeEventListener(window,"mousemove",this.mousemove),k.removeEventListener(window,"mouseup",this.mouseup),k.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),k.removeEventListener(window,"touchend",this.touchend)}}let ia;function Xc(_,o,h){const d=new u.M(_.lng,_.lat);if(_=new u.M(_.lng,_.lat),o){const g=new u.M(_.lng-360,_.lat),y=new u.M(_.lng+360,_.lat),E=h.locationPoint(_).distSqr(o);h.locationPoint(g).distSqr(o)180;){const g=h.locationPoint(_);if(g.x>=0&&g.y>=0&&g.x<=h.width&&g.y<=h.height)break;_.lng>h.center.lng?_.lng-=360:_.lng+=360}return _.lng!==d.lng&&h.locationPoint(_).y>h.height/2-h.getHorizon()?_:d}const Ou={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 Yc(_,o,h){const d=_.classList;for(const g in Ou)d.remove(`maplibregl-${h}-anchor-${g}`);d.add(`maplibregl-${h}-anchor-${o}`)}class Fu extends u.E{constructor(o){if(super(),this._onKeyPress=h=>{const d=h.code,g=h.charCode||h.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const d=h.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=h=>{var d;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Xc(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 y="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?y=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(y=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let E="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?E="rotateX(0deg)":this._pitchAlignment==="map"&&(E=`rotateX(${this._map.getPitch()}deg)`),h&&h.type!=="moveend"||(this._pos=this._pos.round()),k.setTransform(this._element,`${Ou[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${E} ${y}`),P.frameAsync(new AbortController).then(()=>{this._updateOpacity(h&&h.type==="moveend")}).catch(()=>{})},this._onMove=h=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=h.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new 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=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=o&&o.anchor||"center",this._color=o&&o.color||"#3FB1CE",this._scale=o&&o.scale||1,this._draggable=o&&o.draggable||!1,this._clickTolerance=o&&o.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=o&&o.rotation||0,this._rotationAlignment=o&&o.rotationAlignment||"auto",this._pitchAlignment=o&&o.pitchAlignment&&o.pitchAlignment!=="auto"?o.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(o==null?void 0:o.opacity,o==null?void 0:o.opacityWhenCovered),o&&o.element)this._element=o.element,this._offset=u.P.convert(o&&o.offset||[0,0]);else{this._defaultMarker=!0,this._element=k.create("div"),this._element.setAttribute("aria-label","Map marker");const h=k.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const y=k.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const E=k.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill-rule","nonzero");const C=k.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const L=[{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 pt of L){const Et=k.createNS("http://www.w3.org/2000/svg","ellipse");Et.setAttributeNS(null,"opacity","0.04"),Et.setAttributeNS(null,"cx","10.5"),Et.setAttributeNS(null,"cy","5.80029008"),Et.setAttributeNS(null,"rx",pt.rx),Et.setAttributeNS(null,"ry",pt.ry),C.appendChild(Et)}const A=k.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"fill",this._color);const R=k.createNS("http://www.w3.org/2000/svg","path");R.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),A.appendChild(R);const z=k.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const q=k.createNS("http://www.w3.org/2000/svg","path");q.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),z.appendChild(q);const et=k.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"transform","translate(6.0, 7.0)"),et.setAttributeNS(null,"fill","#FFFFFF");const Q=k.createNS("http://www.w3.org/2000/svg","g");Q.setAttributeNS(null,"transform","translate(8.0, 8.0)");const nt=k.createNS("http://www.w3.org/2000/svg","circle");nt.setAttributeNS(null,"fill","#000000"),nt.setAttributeNS(null,"opacity","0.25"),nt.setAttributeNS(null,"cx","5.5"),nt.setAttributeNS(null,"cy","5.5"),nt.setAttributeNS(null,"r","5.4999962");const K=k.createNS("http://www.w3.org/2000/svg","circle");K.setAttributeNS(null,"fill","#FFFFFF"),K.setAttributeNS(null,"cx","5.5"),K.setAttributeNS(null,"cy","5.5"),K.setAttributeNS(null,"r","5.4999962"),Q.appendChild(nt),Q.appendChild(K),E.appendChild(C),E.appendChild(A),E.appendChild(z),E.appendChild(et),E.appendChild(Q),h.appendChild(E),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=u.P.convert(o&&o.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),Yc(this._element,this._anchor,"marker"),o&&o.className)for(const h of o.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(o){return this.remove(),this._map=o,o.getCanvasContainer().appendChild(this._element),o.on("move",this._update),o.on("moveend",this._update),o.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),k.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=u.M.convert(o),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(o){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),o){if(!("offset"in o.options)){const g=Math.abs(13.5)/Math.SQRT2;o.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=o,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 o=this._popup;return o?(o.isOpen()?o.remove():(o.setLngLat(this._lngLat),o.addTo(this._map)),this):this}_updateOpacity(o=!1){var h;if(!(!((h=this._map)===null||h===void 0)&&h.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(o)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const d=this._map,g=d.terrain.depthAtPoint(this._pos),y=d.terrain.getElevationForLngLatZoom(this._lngLat,d.transform.tileZoom);if(d.transform.lngLatToCameraDepth(this._lngLat,y)-g<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/d.transform._pixelPerMeter,C=Math.sin(d.getPitch()*Math.PI/180)*E,L=d.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),A=d.transform.lngLatToCameraDepth(this._lngLat,y+C);this._element.style.opacity=A-L>.006?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(o){return this._offset=u.P.convert(o),this._update(),this}addClassName(o){this._element.classList.add(o)}removeClassName(o){this._element.classList.remove(o)}toggleClassName(o){return this._element.classList.toggle(o)}setDraggable(o){return this._draggable=!!o,this._map&&(o?(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(o){return this._rotation=o||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(o){return this._rotationAlignment=o||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(o){return this._pitchAlignment=o&&o!=="auto"?o:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(o,h){return o===void 0&&h===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),o!==void 0&&(this._opacity=o),h!==void 0&&(this._opacityWhenCovered=h),this._map&&this._updateOpacity(!0),this}}const Pp={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let sl=0,al=!1;const Mp={maxWidth:100,unit:"metric"};function Bu(_,o,h){const d=h&&h.maxWidth||100,g=_._container.clientHeight/2,y=_.unproject([0,g]),E=_.unproject([d,g]),C=y.distanceTo(E);if(h&&h.unit==="imperial"){const L=3.2808*C;L>5280?ll(o,d,L/5280,_._getUIString("ScaleControl.Miles")):ll(o,d,L,_._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?ll(o,d,C/1852,_._getUIString("ScaleControl.NauticalMiles")):C>=1e3?ll(o,d,C/1e3,_._getUIString("ScaleControl.Kilometers")):ll(o,d,C,_._getUIString("ScaleControl.Meters"))}function ll(_,o,h,d){const g=function(y){const E=Math.pow(10,`${Math.floor(y)}`.length-1);let C=y/E;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:function(L){const A=Math.pow(10,Math.ceil(-Math.log(L)/Math.LN10));return Math.round(L*A)/A}(C),E*C}(h);_.style.width=o*(g/h)+"px",_.innerHTML=`${g} ${d}`}const Ap={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},kp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Kc(_){if(_){if(typeof _=="number"){const o=Math.round(Math.abs(_)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,_),"top-left":new u.P(o,o),"top-right":new u.P(-o,o),bottom:new u.P(0,-_),"bottom-left":new u.P(o,-o),"bottom-right":new u.P(-o,-o),left:new u.P(_,0),right:new u.P(-_,0)}}if(_ instanceof u.P||Array.isArray(_)){const o=u.P.convert(_);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}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 Kc(new u.P(0,0))}const Dp=b;p.AJAXError=u.bd,p.Evented=u.E,p.LngLat=u.M,p.MercatorCoordinate=u.Y,p.Point=u.P,p.addProtocol=u.be,p.config=u.a,p.removeProtocol=u.bf,p.AttributionControl=Ip,p.BoxZoomHandler=gp,p.CanvasSource=ws,p.CooperativeGesturesHandler=Nu,p.DoubleClickZoomHandler=Wc,p.DragPanHandler=xp,p.DragRotateHandler=Rd,p.EdgeInsets=Vl,p.FullscreenControl=class extends u.E{constructor(_={}){super(),this._onFullscreenChange=()=>{var o;let h=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((o=h==null?void 0:h.shadowRoot)===null||o===void 0)&&o.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===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=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){k.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const _=this._fullscreenButton=k.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);k.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()}},p.GeoJSONSource=Qe,p.GeolocateControl=class extends u.E{constructor(_){super(),this._onSuccess=o=>{if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new u.k("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.k("geolocate",o)),this._finish()}},this._updateCamera=o=>{const h=new u.M(o.coords.longitude,o.coords.latitude),d=o.coords.accuracy,g=this._map.getBearing(),y=u.e({bearing:g},this.options.fitBoundsOptions),E=Ie.fromLngLat(h,d);this._map.fitBounds(E,y,{geolocateSource:!0})},this._updateMarker=o=>{if(o){const h=new u.M(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=o.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=o=>{if(this._map){if(this.options.trackUserLocation)if(o.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&al)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.k("error",o)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=o=>{if(this._map){if(this._container.addEventListener("contextmenu",h=>h.preventDefault()),this._geolocateButton=k.create("button","maplibregl-ctrl-geolocate",this._container),k.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=k.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Fu({element:this._dotElement}),this._circleElement=k.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Fu({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",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new u.k("trackuserlocationend")))})}},this.options=u.e({},Pp,_)}onAdd(_){return this._map=_,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(o=!1){return u._(this,void 0,void 0,function*(){if(ia!==void 0&&!o)return ia;if(window.navigator.permissions===void 0)return ia=!!window.navigator.geolocation,ia;try{ia=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ia=!!window.navigator.geolocation}return ia})}().then(o=>this._setupUI(o)),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(),k.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,sl=0,al=!1}_isOutOfMapMaxBounds(_){const o=this._map.getMaxBounds(),h=_.coords;return o&&(h.longitudeo.getEast()||h.latitudeo.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(),o=_.getSouthEast(),h=_.getNorthEast(),d=o.distanceTo(h),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return 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":sl--,al=!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"),sl++,sl>1?(_={maximumAge:6e5,timeout:0},al=!0):(_=this.options.positionOptions,al=!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)}},p.Hash=mp,p.ImageSource=fr,p.KeyboardHandler=Ad,p.LngLatBounds=Ie,p.LogoControl=is,p.Map=class extends wp{constructor(_){if(u.bb.mark(u.bc.create),(_=u.e({},Cp,_)).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 Uc(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies),{bearingSnap:_.bearingSnap}),this._contextLost=o=>{o.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.k("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.k("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.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 xg,this._controls=[],this._mapId=u.a3(),this._locale=u.e({},Ep,_.locale),this._clickTolerance=_.clickTolerance,this._overridePixelRatio=_.pixelRatio,this._maxCanvasSize=_.maxCanvasSize,this.transformCameraUpdate=_.transformCameraUpdate,this._imageQueueHandle=X.addThrottleControl(()=>this.isMoving()),this._requestManager=new ht(_.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 o=!1;const h=dp(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{o?h(d):o=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bp(this,_),this._hash=_.hash&&new mp(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 Ip(typeof _.attributionControl=="boolean"?void 0:_.attributionControl)),_.maplibreLogo&&this.addControl(new is,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new u.k(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new u.k(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new u.k("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(_,o){if(o===void 0&&(o=_.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 h=_.onAdd(this);this._controls.push(_);const d=this._controlPositions[o];return o.indexOf("bottom")!==-1?d.insertBefore(h,d.firstChild):d.appendChild(h),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 o=this._controls.indexOf(_);return o>-1&&this._controls.splice(o,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}calculateCameraOptionsFromTo(_,o,h,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(_,o,h,d)}resize(_){var o;const h=this._containerDimensions(),d=h[0],g=h[1],y=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,y),this.painter.resize(d,g,y),this.painter.overLimit()){const C=this.painter.context.gl;this._maxCanvasSize=[C.drawingBufferWidth,C.drawingBufferHeight];const L=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,L),this.painter.resize(d,g,L)}this.transform.resize(d,g),(o=this._requestedCameraState)===null||o===void 0||o.resize(d,g);const E=!this._moving;return E&&(this.stop(),this.fire(new u.k("movestart",_)).fire(new u.k("move",_))),this.fire(new u.k("resize",_)),E&&this.fire(new u.k("moveend",_)),this}_getClampedPixelRatio(_,o){const{0:h,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),y=_*g,E=o*g;return Math.min(y>h?h/y:1,E>d?d/E:1)*g}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(Ie.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(_,o,h){if(_==="mouseenter"||_==="mouseover"){let d=!1;return{layer:o,listener:h,delegates:{mousemove:y=>{const E=this.getLayer(o)?this.queryRenderedFeatures(y.point,{layers:[o]}):[];E.length?d||(d=!0,h.call(this,new ro(_,this,y.originalEvent,{features:E}))):d=!1},mouseout:()=>{d=!1}}}}if(_==="mouseleave"||_==="mouseout"){let d=!1;return{layer:o,listener:h,delegates:{mousemove:E=>{(this.getLayer(o)?this.queryRenderedFeatures(E.point,{layers:[o]}):[]).length?d=!0:d&&(d=!1,h.call(this,new ro(_,this,E.originalEvent)))},mouseout:E=>{d&&(d=!1,h.call(this,new ro(_,this,E.originalEvent)))}}}}{const d=g=>{const y=this.getLayer(o)?this.queryRenderedFeatures(g.point,{layers:[o]}):[];y.length&&(g.features=y,h.call(this,g),delete g.features)};return{layer:o,listener:h,delegates:{[_]:d}}}}on(_,o,h){if(h===void 0)return super.on(_,o);const d=this._createDelegatedListener(_,o,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(_,o,h){if(h===void 0)return super.once(_,o);const d=this._createDelegatedListener(_,o,h);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(_,o,h){return h===void 0?super.off(_,o):(this._delegatedListeners&&this._delegatedListeners[_]&&(d=>{const g=this._delegatedListeners[_];for(let y=0;ythis._updateStyle(_,o));const h=this.style&&o.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!_)),_?(this.style=new xo(this,o||{}),this.style.setEventedParent(this,{style:this.style}),typeof _=="string"?this.style.loadURL(_,o,h):this.style.loadJSON(_,o,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new xo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(_,o){if(typeof _=="string"){const h=this._requestManager.transformRequest(_,J.Style);u.h(h,new AbortController).then(d=>{this._updateDiff(d.data,o)}).catch(d=>{d&&this.fire(new u.j(d))})}else typeof _=="object"&&this._updateDiff(_,o)}_updateDiff(_,o){try{this.style.setState(_,o)&&this._update(!0)}catch(h){u.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(_,o)}}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(_,o){return this._lazyInitEmptyStyle(),this.style.addSource(_,o),this._update(!0)}isSourceLoaded(_){const o=this.style&&this.style.sourceCaches[_];if(o!==void 0)return o.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 o=this.style.sourceCaches[_.source];if(!o)throw new Error(`cannot load terrain, because there exists no source with ID: ${_.source}`);this.terrain===null&&o.reload();for(const h in this.style._layers){const d=this.style._layers[h];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 Si(this.painter,o,_),this.painter.renderToTexture=new Hc(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=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.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(h.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new u.k("terrain",{terrain:_})),this}getTerrain(){var _,o;return(o=(_=this.terrain)===null||_===void 0?void 0:_.options)!==null&&o!==void 0?o:null}areTilesLoaded(){const _=this.style&&this.style.sourceCaches;for(const o in _){const h=_[o]._tiles;for(const d in h){const g=h[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(_){return this.style.removeSource(_),this._update(!0)}getSource(_){return this.style.getSource(_)}addImage(_,o,h={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:y,stretchY:E,content:C}=h;if(this._lazyInitEmptyStyle(),!(o instanceof HTMLImageElement||u.b(o))){if(o.width===void 0||o.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:L,height:A,data:R}=o,z=o;return this.style.addImage(_,{data:new u.R({width:L,height:A},new Uint8Array(R)),pixelRatio:d,stretchX:y,stretchY:E,content:C,sdf:g,version:0,userImage:z}),z.onAdd&&z.onAdd(this,_),this}}{const{width:L,height:A,data:R}=P.getImageData(o);this.style.addImage(_,{data:new u.R({width:L,height:A},R),pixelRatio:d,stretchX:y,stretchY:E,content:C,sdf:g,version:0})}}updateImage(_,o){const h=this.style.getImage(_);if(!h)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=o instanceof HTMLImageElement||u.b(o)?P.getImageData(o):o,{width:g,height:y,data:E}=d;if(g===void 0||y===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(g!==h.data.width||y!==h.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 C=!(o instanceof HTMLImageElement||u.b(o));return h.data.replace(E,C),this.style.updateImage(_,h),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 X.getImage(this._requestManager.transformRequest(_,J.Image),new AbortController)}listImages(){return this.style.listImages()}addLayer(_,o){return this._lazyInitEmptyStyle(),this.style.addLayer(_,o),this._update(!0)}moveLayer(_,o){return this.style.moveLayer(_,o),this._update(!0)}removeLayer(_){return this.style.removeLayer(_),this._update(!0)}getLayer(_){return this.style.getLayer(_)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(_,o,h){return this.style.setLayerZoomRange(_,o,h),this._update(!0)}setFilter(_,o,h={}){return this.style.setFilter(_,o,h),this._update(!0)}getFilter(_){return this.style.getFilter(_)}setPaintProperty(_,o,h,d={}){return this.style.setPaintProperty(_,o,h,d),this._update(!0)}getPaintProperty(_,o){return this.style.getPaintProperty(_,o)}setLayoutProperty(_,o,h,d={}){return this.style.setLayoutProperty(_,o,h,d),this._update(!0)}getLayoutProperty(_,o){return this.style.getLayoutProperty(_,o)}setGlyphs(_,o={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(_,o),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(_,o,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(_,o,h,d=>{d||this._update(!0)}),this}removeSprite(_){return this._lazyInitEmptyStyle(),this.style.removeSprite(_),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(_,o={}){return this._lazyInitEmptyStyle(),this.style.setSprite(_,o,h=>{h||this._update(!0)}),this}setLight(_,o={}){return this._lazyInitEmptyStyle(),this.style.setLight(_,o),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(_,o){return this.style.setFeatureState(_,o),this._update()}removeFeatureState(_,o){return this.style.removeFeatureState(_,o),this._update()}getFeatureState(_){return this.style.getFeatureState(_)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let _=0,o=0;return this._container&&(_=this._container.clientWidth||400,o=this._container.clientHeight||300),[_,o]}_setupContainer(){const _=this._container;_.classList.add("maplibregl-map");const o=this._canvasContainer=k.create("div","maplibregl-canvas-container",_);this._interactive&&o.classList.add("maplibregl-interactive"),this._canvas=k.create("canvas","maplibregl-canvas",o),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const h=this._containerDimensions(),d=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],d);const g=this._controlContainer=k.create("div","maplibregl-control-container",_),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(E=>{y[E]=k.create("div",`maplibregl-ctrl-${E} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,o,h){this._canvas.width=Math.floor(h*_),this._canvas.height=Math.floor(h*o),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${o}px`}_setupPainter(){const _={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let o=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{o={requestedAttributes:_},d&&(o.statusMessage=d.statusMessage,o.type=d.type)},{once:!0});const h=this._canvas.getContext("webgl2",_)||this._canvas.getContext("webgl",_);if(!h){const d="Failed to initialize WebGL";throw o?(o.message=d,new Error(JSON.stringify(o))):new Error(d)}this.painter=new wd(h,this.transform),B.testSupport(h)}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 o=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(_),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,y=P.now();this.style.zoomHistory.update(g,y);const E=new u.a8(g,{now:y,fadeDuration:o,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=E.crossFadingFactor();C===1&&C===this._crossFadingFactor||(h=!0,this._crossFadingFactor=C),this.style.update(E)}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,o,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,showPadding:this.showPadding}),this.fire(new u.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.bb.mark(u.bc.load),this.fire(new u.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.k("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,u.bb.mark(u.bc.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 h of this._controls)h.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),X.removeThrottleControl(this._imageQueueHandle),(_=this._resizeObserver)===null||_===void 0||_.disconnect();const o=this.painter.context.gl.getExtension("WEBGL_lose_context");o&&o.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),k.remove(this._canvasContainer),k.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),u.bb.clearMetrics(),this._removed=!0,this.fire(new u.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,P.frameAsync(this._frameRequest).then(_=>{u.bb.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 Sp}getCameraTargetElevation(){return this.transform.elevation}},p.MapMouseEvent=ro,p.MapTouchEvent=Ul,p.MapWheelEvent=il,p.Marker=Fu,p.NavigationControl=class{constructor(_){this._updateZoomButtons=()=>{const o=this._map.getZoom(),h=o===this._map.getMaxZoom(),d=o===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const o=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=o},this._setButtonTitle=(o,h)=>{const d=this._map._getUIString(`NavigationControl.${h}`);o.title=d,o.setAttribute("aria-label",d)},this.options=u.e({},Tp,_),this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",o=>o.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",o=>this._map.zoomIn({},{originalEvent:o})),k.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",o=>this._map.zoomOut({},{originalEvent:o})),k.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",o=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:o}):this._map.resetNorth({},{originalEvent:o})}),this._compassIcon=k.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 Lp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){k.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(_,o){const h=k.create("button",_,this._container);return h.type="button",h.addEventListener("click",o),h}},p.Popup=class extends u.E{constructor(_){super(),this.remove=()=>(this._content&&k.remove(this._content),this._container&&(k.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=o=>{this._update(o.point)},this._onMouseMove=o=>{this._update(o.point)},this._onDrag=o=>{this._update(o.point)},this._update=o=>{var h;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=k.create("div","maplibregl-popup",this._map.getContainer()),this._tip=k.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const C of this.options.className.split(" "))this._container.classList.add(C);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?Xc(this._lngLat,this._flatPos,this._map.transform):(h=this._lngLat)===null||h===void 0?void 0:h.wrap(),this._trackPointer&&!o)return;const d=this._flatPos=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&o?o:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const y=Kc(this.options.offset);if(!g){const C=this._container.offsetWidth,L=this._container.offsetHeight;let A;A=d.y+y.bottom.ythis._map.transform.height-L?["bottom"]:[],d.xthis._map.transform.width-C/2&&A.push("right"),g=A.length===0?"bottom":A.join("-")}let E=d.add(y[g]);this.options.subpixelPositioning||(E=E.round()),k.setTransform(this._container,`${Ou[g]} translate(${E.x}px,${E.y}px)`),Yc(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Ap),_)}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 o=document.createDocumentFragment(),h=document.createElement("body");let d;for(h.innerHTML=_;d=h.firstChild,d;)o.appendChild(d);return this.setDOMContent(o)}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=k.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=k.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(kp);_&&_.focus()}},p.RasterDEMTileSource=Bi,p.RasterTileSource=sn,p.ScaleControl=class{constructor(_){this._onMove=()=>{Bu(this._map,this._container,this.options)},this.setUnit=o=>{this.options.unit=o,Bu(this._map,this._container,this.options)},this.options=u.e({},Mp,_)}getDefaultPosition(){return"bottom-left"}onAdd(_){return this._map=_,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-scale",_.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){k.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},p.ScrollZoomHandler=Ru,p.Style=xo,p.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=k.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=k.create("button","maplibregl-ctrl-terrain",this._container),k.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(){k.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},p.TwoFingersTouchPitchHandler=vp,p.TwoFingersTouchRotateHandler=jc,p.TwoFingersTouchZoomHandler=Pd,p.TwoFingersTouchZoomRotateHandler=ns,p.VectorTileSource=Mt,p.VideoSource=$o,p.addSourceType=(_,o)=>u._(void 0,void 0,void 0,function*(){if(wr(_))throw new Error(`A source type called "${_}" already exists.`);((h,d)=>{Ia[h]=d})(_,o)}),p.clearPrewarmedResources=function(){const _=Wn;_&&(_.isPreloaded()&&_.numActive()===1?(_.release(Dn),Wn=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()"))},p.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},p.getRTLTextPluginStatus=function(){return Wt().getRTLTextPluginStatus()},p.getVersion=function(){return Dp},p.getWorkerCount=function(){return qn.workerCount},p.getWorkerUrl=function(){return u.a.WORKER_URL},p.importScriptInWorkers=function(_){return yn().broadcast("importScript",_)},p.prewarm=function(){Kt().acquire(Dn)},p.setMaxParallelImageRequests=function(_){u.a.MAX_PARALLEL_IMAGE_REQUESTS=_},p.setRTLTextPlugin=function(_,o){return Wt().setRTLTextPlugin(_,o)},p.setWorkerCount=function(_){qn.workerCount=_},p.setWorkerUrl=function(_){u.a.WORKER_URL=_}});var c=n;return c})})(M1);var m2=M1.exports;const qh=P1(m2);function X0(t){let e;return n=>{if(n)for(let i in n){let a=e==null?void 0:e[i],c=n[i];a!==c&&t(i,c,a)}else if(e)for(let i in e)t(i,void 0,e[i]);e=n}}function g2(t,...e){let n=[t];for(let i of e)if(i)Array.isArray(i)&&i[0]===t?n.push(...i.slice(1)):n.push(i);else continue;if(n.length!==1)return n.length===2?n[1]:n}function _2(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function y_(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}var wm=y2;function y2(t){var e,n,i;if(t){if(Array.isArray(t)){for(e=[],n=t.length,i=0;i{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function x2(t,e,n){let i,a,c,p,u,b,w,T,P,k,B,V,{$$slots:tt={},$$scope:ot}=e,{id:ut=Vf("layer")}=e,{source:W=void 0}=e,{sourceLayer:X=void 0}=e,{beforeId:J=void 0}=e,{beforeLayerType:ht=void 0}=e,{type:vt}=e,{paint:gt=void 0}=e,{layout:St=void 0}=e,{filter:It=void 0}=e,{applyToClusters:Ft=void 0}=e,{minzoom:mt=void 0}=e,{maxzoom:Ct=void 0}=e,{manageHoverState:ie=!1}=e,{hovered:Tt=null}=e,{interactive:ee=!0}=e,{hoverCursor:ge=void 0}=e,{eventsIfTopMost:Te=!1}=e;const Oe=Ff(),{map:on,source:gn,self:Re,minzoom:Me,maxzoom:Dn,eventTopMost:qn,layerInfo:Zn}=d2();Gn(t,on,Gt=>n(31,P=Gt)),Gn(t,gn,Gt=>n(32,k=Gt)),Gn(t,Re,Gt=>n(0,T=Gt)),Gn(t,Me,Gt=>n(34,V=Gt)),Gn(t,Dn,Gt=>n(33,B=Gt)),Il(()=>{T&&P&&(Zn.delete(T),P==null||P.removeLayer(T))});let Wn;function ri(Gt){var Mt,sn;if(!ee||!T||!P||Te&&qn(Gt)!==T)return;let Fe=Gt.features??[],Ie=(sn=(Mt=Fe[0])==null?void 0:Mt.properties)==null?void 0:sn.cluster_id,Ri={event:Gt,map:P,clusterId:Ie,layer:T,source:u,features:Fe};Oe(Gt.type,Ri)}function Kt(Gt){var Mt,sn;if(!ee||!T||!P||Te&&qn(Gt)!==T)return;ge&&(P.getCanvas().style.cursor=ge);let Fe=Gt.features??[];n(6,Tt=Fe[0]??null);let Ie=(sn=(Mt=Fe[0])==null?void 0:Mt.properties)==null?void 0:sn.cluster_id;Oe("mouseenter",{event:Gt,map:P,clusterId:Ie,layer:T,source:u,features:Fe})}function Ue(Gt){var Mt,sn,Bi;if(!ee||!P)return;if(Te&&qn(Gt)!==T){n(6,Tt=null),ie&&Wn!==void 0&&(P==null||P.setFeatureState({source:u,sourceLayer:X,id:Wn},{hover:!1}),Wn=void 0);return}P.getCanvas().style.cursor=ge;let Fe=Gt.features??[],Ie=(sn=(Mt=Fe[0])==null?void 0:Mt.properties)==null?void 0:sn.cluster_id,Ri=(Bi=Fe[0])==null?void 0:Bi.id;Ri!==Wn&&(ie&&(Wn!==void 0&&(P==null||P.setFeatureState({source:u,id:Wn,sourceLayer:X},{hover:!1})),P==null||P.setFeatureState({source:u,id:Ri,sourceLayer:X},{hover:!0})),Wn=Ri,n(6,Tt=Fe[0]??null)),Oe("mousemove",{event:Gt,map:P,clusterId:Ie,layer:T,source:u,features:Fe})}function yn(Gt){if(!(!ee||!T||!P)){if(ge&&(P.getCanvas().style.cursor=""),n(6,Tt=null),ie&&Wn!==void 0){const Fe={source:u,id:Wn,sourceLayer:X};P==null||P.setFeatureState(Fe,{hover:!1}),Wn=void 0}Oe("mouseleave",{map:P,layer:T,source:u})}}let br=!0;function er(Gt){P&&(P.off("click",Gt,ri),P.off("dblclick",Gt,ri),P.off("contextmenu",Gt,ri),P.off("mouseenter",Gt,Kt),P.off("mousemove",Gt,Ue),P.off("mouseleave",Gt,yn))}return Il(()=>{P&&T&&er(T)}),t.$$set=Gt=>{"id"in Gt&&n(7,ut=Gt.id),"source"in Gt&&n(8,W=Gt.source),"sourceLayer"in Gt&&n(9,X=Gt.sourceLayer),"beforeId"in Gt&&n(10,J=Gt.beforeId),"beforeLayerType"in Gt&&n(11,ht=Gt.beforeLayerType),"type"in Gt&&n(12,vt=Gt.type),"paint"in Gt&&n(13,gt=Gt.paint),"layout"in Gt&&n(14,St=Gt.layout),"filter"in Gt&&n(15,It=Gt.filter),"applyToClusters"in Gt&&n(16,Ft=Gt.applyToClusters),"minzoom"in Gt&&n(17,mt=Gt.minzoom),"maxzoom"in Gt&&n(18,Ct=Gt.maxzoom),"manageHoverState"in Gt&&n(19,ie=Gt.manageHoverState),"hovered"in Gt&&n(6,Tt=Gt.hovered),"interactive"in Gt&&n(20,ee=Gt.interactive),"hoverCursor"in Gt&&n(21,ge=Gt.hoverCursor),"eventsIfTopMost"in Gt&&n(22,Te=Gt.eventsIfTopMost),"$$scope"in Gt&&n(35,ot=Gt.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,i=_2(Ft)),t.$$.dirty[0]&1073774592&&n(24,a=g2("all",i,It)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,c=mt??V),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,p=Ct??B),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,u=W||k),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&P&&T!==ut&&u){T&&(er(T),Zn.delete(T));let Gt=J;if(!J&&ht){let Fe=P.getStyle().layers,Ie=typeof ht=="function"?ht:Mt=>Mt.type===ht,Ri=Fe==null?void 0:Fe.find(Ie);Ri&&(Gt=Ri.id)}Hu(Re,T=ut,T),P.addLayer(wm({id:T,type:vt,source:u,"source-layer":X,filter:a,paint:gt,layout:St,minzoom:c,maxzoom:p}),Gt),n(23,br=!0),P.on("click",T,ri),P.on("dblclick",T,ri),P.on("contextmenu",T,ri),P.on("mouseenter",T,Kt),P.on("mousemove",T,Ue),P.on("mouseleave",T,yn)}t.$$.dirty[0]&1048577&&T&&Zn.set(T,{interactive:ee}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,b=T?X0((Gt,Fe)=>P==null?void 0:P.setPaintProperty(T,Gt,Fe)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=T?X0((Gt,Fe)=>P==null?void 0:P.setLayoutProperty(T,Gt,Fe)):void 0),t.$$.dirty[0]&268443648&&(b==null||b(gt)),t.$$.dirty[0]&134234112&&(w==null||w(St)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&T&&(P==null||P.setLayerZoomRange(T,c,p)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&T&&(br?n(23,br=!1):P==null||P.setFilter(T,a))},[T,on,gn,Re,Me,Dn,Tt,ut,W,X,J,ht,vt,gt,St,It,Ft,mt,Ct,ie,ee,ge,Te,br,a,p,c,w,b,u,i,P,k,B,V,ot,tt]}class q_ extends Tn{constructor(e){super(),Cn(this,e,x2,v2,In,{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 b2(t){let e;const n=t[16].default,i=Os(n,t,t[24],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&16777216)&&Bs(i,n,a,a[24],e?Fs(n,a[24],c,null):Vs(a[24]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function w2(t){let e,n,i;function a(p){t[17](p)}let c={id:t[1],type:"circle",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[b2]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.hovered=t[0]),e=new q_({props:c}),Rr.push(()=>Ho(e,"hovered",a)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){cn(e.$$.fragment)},m(p,u){en(e,p,u),i=!0},p(p,[u]){const b={};u&2&&(b.id=p[1]),u&4&&(b.source=p[2]),u&8&&(b.sourceLayer=p[3]),u&16&&(b.beforeId=p[4]),u&32&&(b.beforeLayerType=p[5]),u&64&&(b.paint=p[6]),u&128&&(b.layout=p[7]),u&256&&(b.filter=p[8]),u&512&&(b.applyToClusters=p[9]),u&1024&&(b.minzoom=p[10]),u&2048&&(b.maxzoom=p[11]),u&4096&&(b.hoverCursor=p[12]),u&8192&&(b.manageHoverState=p[13]),u&16384&&(b.eventsIfTopMost=p[14]),u&32768&&(b.interactive=p[15]),u&16777216&&(b.$$scope={dirty:u,ctx:p}),!n&&u&1&&(n=!0,b.hovered=p[0],Wo(()=>n=!1)),e.$set(b)},i(p){i||(ne(e.$$.fragment,p),i=!0)},o(p){he(e.$$.fragment,p),i=!1},d(p){nn(e,p)}}}function I2(t,e,n){let{$$slots:i={},$$scope:a}=e,{id:c=Vf("circle")}=e,{source:p=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:T}=e,{layout:P=void 0}=e,{filter:k=void 0}=e,{applyToClusters:B=void 0}=e,{minzoom:V=void 0}=e,{maxzoom:tt=void 0}=e,{hoverCursor:ot=void 0}=e,{manageHoverState:ut=!1}=e,{hovered:W=null}=e,{eventsIfTopMost:X=!1}=e,{interactive:J=!0}=e;function ht(Ct){W=Ct,n(0,W)}function vt(Ct){Ji.call(this,t,Ct)}function gt(Ct){Ji.call(this,t,Ct)}function St(Ct){Ji.call(this,t,Ct)}function It(Ct){Ji.call(this,t,Ct)}function Ft(Ct){Ji.call(this,t,Ct)}function mt(Ct){Ji.call(this,t,Ct)}return t.$$set=Ct=>{"id"in Ct&&n(1,c=Ct.id),"source"in Ct&&n(2,p=Ct.source),"sourceLayer"in Ct&&n(3,u=Ct.sourceLayer),"beforeId"in Ct&&n(4,b=Ct.beforeId),"beforeLayerType"in Ct&&n(5,w=Ct.beforeLayerType),"paint"in Ct&&n(6,T=Ct.paint),"layout"in Ct&&n(7,P=Ct.layout),"filter"in Ct&&n(8,k=Ct.filter),"applyToClusters"in Ct&&n(9,B=Ct.applyToClusters),"minzoom"in Ct&&n(10,V=Ct.minzoom),"maxzoom"in Ct&&n(11,tt=Ct.maxzoom),"hoverCursor"in Ct&&n(12,ot=Ct.hoverCursor),"manageHoverState"in Ct&&n(13,ut=Ct.manageHoverState),"hovered"in Ct&&n(0,W=Ct.hovered),"eventsIfTopMost"in Ct&&n(14,X=Ct.eventsIfTopMost),"interactive"in Ct&&n(15,J=Ct.interactive),"$$scope"in Ct&&n(24,a=Ct.$$scope)},[W,c,p,u,b,w,T,P,k,B,V,tt,ot,ut,X,J,i,ht,vt,gt,St,It,Ft,mt,a]}class E2 extends Tn{constructor(e){super(),Cn(this,e,I2,w2,In,{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 S2(t){let e;const n=t[15].default,i=Os(n,t,t[23],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&8388608)&&Bs(i,n,a,a[23],e?Fs(n,a[23],c,null):Vs(a[23]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function C2(t){let e,n,i;function a(p){t[16](p)}let c={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[S2]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.hovered=t[0]),e=new q_({props:c}),Rr.push(()=>Ho(e,"hovered",a)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){cn(e.$$.fragment)},m(p,u){en(e,p,u),i=!0},p(p,[u]){const b={};u&2&&(b.id=p[1]),u&4&&(b.source=p[2]),u&8&&(b.sourceLayer=p[3]),u&16&&(b.beforeId=p[4]),u&32&&(b.beforeLayerType=p[5]),u&64&&(b.paint=p[6]),u&128&&(b.layout=p[7]),u&256&&(b.filter=p[8]),u&512&&(b.minzoom=p[9]),u&1024&&(b.maxzoom=p[10]),u&2048&&(b.hoverCursor=p[11]),u&4096&&(b.manageHoverState=p[12]),u&8192&&(b.eventsIfTopMost=p[13]),u&16384&&(b.interactive=p[14]),u&8388608&&(b.$$scope={dirty:u,ctx:p}),!n&&u&1&&(n=!0,b.hovered=p[0],Wo(()=>n=!1)),e.$set(b)},i(p){i||(ne(e.$$.fragment,p),i=!0)},o(p){he(e.$$.fragment,p),i=!1},d(p){nn(e,p)}}}function T2(t,e,n){let{$$slots:i={},$$scope:a}=e,{id:c=Vf("fill")}=e,{source:p=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:T}=e,{layout:P=void 0}=e,{filter:k=void 0}=e,{minzoom:B=void 0}=e,{maxzoom:V=void 0}=e,{hoverCursor:tt=void 0}=e,{manageHoverState:ot=!1}=e,{hovered:ut=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function J(mt){ut=mt,n(0,ut)}function ht(mt){Ji.call(this,t,mt)}function vt(mt){Ji.call(this,t,mt)}function gt(mt){Ji.call(this,t,mt)}function St(mt){Ji.call(this,t,mt)}function It(mt){Ji.call(this,t,mt)}function Ft(mt){Ji.call(this,t,mt)}return t.$$set=mt=>{"id"in mt&&n(1,c=mt.id),"source"in mt&&n(2,p=mt.source),"sourceLayer"in mt&&n(3,u=mt.sourceLayer),"beforeId"in mt&&n(4,b=mt.beforeId),"beforeLayerType"in mt&&n(5,w=mt.beforeLayerType),"paint"in mt&&n(6,T=mt.paint),"layout"in mt&&n(7,P=mt.layout),"filter"in mt&&n(8,k=mt.filter),"minzoom"in mt&&n(9,B=mt.minzoom),"maxzoom"in mt&&n(10,V=mt.maxzoom),"hoverCursor"in mt&&n(11,tt=mt.hoverCursor),"manageHoverState"in mt&&n(12,ot=mt.manageHoverState),"hovered"in mt&&n(0,ut=mt.hovered),"eventsIfTopMost"in mt&&n(13,W=mt.eventsIfTopMost),"interactive"in mt&&n(14,X=mt.interactive),"$$scope"in mt&&n(23,a=mt.$$scope)},[ut,c,p,u,b,w,T,P,k,B,V,tt,ot,W,X,i,J,ht,vt,gt,St,It,Ft,a]}class Gf extends Tn{constructor(e){super(),Cn(this,e,T2,C2,In,{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 L2(t,e,n){let i;const{map:a}=Uf();Gn(t,a,b=>n(4,i=b));let{position:c="top-left"}=e,{container:p=void 0}=e,u=null;return Il(()=>{i!=null&&i.loaded()&&u&&i.removeControl(u)}),t.$$set=b=>{"position"in b&&n(1,c=b.position),"container"in b&&n(2,p=b.container)},t.$$.update=()=>{if(t.$$.dirty&30&&i&&!u){let b;typeof p=="string"?b=document.querySelector(p)??void 0:b=p,n(3,u=new qh.FullscreenControl({container:b})),i.addControl(u,c)}},[a,c,p,u,i]}class P2 extends Tn{constructor(e){super(),Cn(this,e,L2,null,In,{position:1,container:2})}}function M2(t,e,n,i,a){let c=!1;t.getSource(e)&&(c=!0,t.removeSource(e));const p=()=>{i(e)&&(t.addSource(e,n),a())};if(c){const u=()=>{e&&(t.getSource(e)?setTimeout(u,1):p())};u()}else p()}function A2(t,e,n){i2().then(()=>{let i=_1(t);if(!i)return;i.getSource(e)===n&&i.removeSource(e)})}function J0(t){let e=t[0],n,i,a=Q0(t);return{c(){a.c(),n=Dl()},m(c,p){a.m(c,p),fe(c,n,p),i=!0},p(c,p){p&1&&In(e,e=c[0])?(us(),he(a,1,1,Ye),cs(),a=Q0(c),a.c(),ne(a,1),a.m(n.parentNode,n)):a.p(c,p)},i(c){i||(ne(a),i=!0)},o(c){he(a),i=!1},d(c){c&&pe(n),a.d(c)}}}function Q0(t){let e;const n=t[15].default,i=Os(n,t,t[14],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&16384)&&Bs(i,n,a,a[14],e?Fs(n,a[14],c,null):Vs(a[14]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function k2(t){let e,n,i=t[0]&&J0(t);return{c(){i&&i.c(),e=Dl()},m(a,c){i&&i.m(a,c),fe(a,e,c),n=!0},p(a,[c]){a[0]?i?(i.p(a,c),c&1&&ne(i,1)):(i=J0(a),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function D2(t,e,n){let i,a,c,{$$slots:p={},$$scope:u}=e,{id:b=Vf("geojson")}=e,{data:w}=e,{generateId:T=!1}=e,{promoteId:P=void 0}=e,{filter:k=void 0}=e,{lineMetrics:B=void 0}=e,{cluster:V=void 0}=e;const{map:tt,cluster:ot,self:ut}=f2();Gn(t,tt,J=>n(13,a=J)),Gn(t,ot,J=>n(16,c=J)),Gn(t,ut,J=>n(0,i=J));let W,X=!0;return Il(()=>{i&&W&&a&&(A2(tt,i,W),Hu(ut,i=null,i),n(11,W=void 0))}),t.$$set=J=>{"id"in J&&n(4,b=J.id),"data"in J&&n(5,w=J.data),"generateId"in J&&n(6,T=J.generateId),"promoteId"in J&&n(7,P=J.promoteId),"filter"in J&&n(8,k=J.filter),"lineMetrics"in J&&n(9,B=J.lineMetrics),"cluster"in J&&n(10,V=J.cluster),"$$scope"in J&&n(14,u=J.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Hu(ot,c=V,c),t.$$.dirty&12273&&a&&i!==b&&(Hu(ut,i=b,i),M2(a,i,wm({type:"geojson",data:w,filter:k,lineMetrics:B,generateId:T,promoteId:P,cluster:!!V,clusterMinPoints:V==null?void 0:V.minPoints,clusterMaxZoom:V==null?void 0:V.maxZoom,clusterRadius:V==null?void 0:V.radius,clusterProperties:V==null?void 0:V.properties}),J=>a&&J===i,()=>{i&&(n(11,W=a==null?void 0:a.getSource(i)),n(12,X=!0))})),t.$$.dirty&8208&&(a==null||a.on("style.load",()=>{n(11,W=a==null?void 0:a.getSource(b))})),t.$$.dirty&6176&&W&&(X?n(12,X=!1):W.setData(w)),t.$$.dirty&3072&&(W==null||W.setClusterOptions(wm({cluster:!!V,clusterMaxZoom:V==null?void 0:V.maxZoom,clusterRadius:V==null?void 0:V.radius})))},[i,tt,ot,ut,b,w,T,P,k,B,V,W,X,a,u,p]}class jh extends Tn{constructor(e){super(),Cn(this,e,D2,k2,In,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function R2(t,e,n){let i;const{map:a}=Uf();Gn(t,a,k=>n(8,i=k));let{position:c="top-left"}=e,{positionOptions:p=void 0}=e,{fitBoundsOptions:u=void 0}=e,{trackUserLocation:b=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:T=!0}=e,P=null;return Il(()=>{i!=null&&i.loaded()&&P&&i.removeControl(P)}),t.$$set=k=>{"position"in k&&n(1,c=k.position),"positionOptions"in k&&n(2,p=k.positionOptions),"fitBoundsOptions"in k&&n(3,u=k.fitBoundsOptions),"trackUserLocation"in k&&n(4,b=k.trackUserLocation),"showAccuracyCircle"in k&&n(5,w=k.showAccuracyCircle),"showUserLocation"in k&&n(6,T=k.showUserLocation)},t.$$.update=()=>{t.$$.dirty&510&&i&&!P&&(n(7,P=new qh.GeolocateControl({positionOptions:p,fitBoundsOptions:u,trackUserLocation:b,showAccuracyCircle:w,showUserLocation:T})),i.addControl(P,c))},[a,c,p,u,b,w,T,P,i]}class N2 extends Tn{constructor(e){super(),Cn(this,e,R2,null,In,{position:1,positionOptions:2,fitBoundsOptions:3,trackUserLocation:4,showAccuracyCircle:5,showUserLocation:6})}}function z2(t){let e;const n=t[15].default,i=Os(n,t,t[23],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&8388608)&&Bs(i,n,a,a[23],e?Fs(n,a[23],c,null):Vs(a[23]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function O2(t){let e,n,i;function a(p){t[16](p)}let c={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[z2]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.hovered=t[0]),e=new q_({props:c}),Rr.push(()=>Ho(e,"hovered",a)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){cn(e.$$.fragment)},m(p,u){en(e,p,u),i=!0},p(p,[u]){const b={};u&2&&(b.id=p[1]),u&4&&(b.source=p[2]),u&8&&(b.sourceLayer=p[3]),u&16&&(b.beforeId=p[4]),u&32&&(b.beforeLayerType=p[5]),u&64&&(b.paint=p[6]),u&128&&(b.layout=p[7]),u&256&&(b.filter=p[8]),u&512&&(b.minzoom=p[9]),u&1024&&(b.maxzoom=p[10]),u&2048&&(b.hoverCursor=p[11]),u&4096&&(b.manageHoverState=p[12]),u&8192&&(b.eventsIfTopMost=p[13]),u&16384&&(b.interactive=p[14]),u&8388608&&(b.$$scope={dirty:u,ctx:p}),!n&&u&1&&(n=!0,b.hovered=p[0],Wo(()=>n=!1)),e.$set(b)},i(p){i||(ne(e.$$.fragment,p),i=!0)},o(p){he(e.$$.fragment,p),i=!1},d(p){nn(e,p)}}}function F2(t,e,n){let{$$slots:i={},$$scope:a}=e,{id:c=Vf("line")}=e,{source:p=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:b=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:T}=e,{layout:P=void 0}=e,{filter:k=void 0}=e,{minzoom:B=void 0}=e,{maxzoom:V=void 0}=e,{hoverCursor:tt=void 0}=e,{manageHoverState:ot=!1}=e,{hovered:ut=null}=e,{eventsIfTopMost:W=!1}=e,{interactive:X=!0}=e;function J(mt){ut=mt,n(0,ut)}function ht(mt){Ji.call(this,t,mt)}function vt(mt){Ji.call(this,t,mt)}function gt(mt){Ji.call(this,t,mt)}function St(mt){Ji.call(this,t,mt)}function It(mt){Ji.call(this,t,mt)}function Ft(mt){Ji.call(this,t,mt)}return t.$$set=mt=>{"id"in mt&&n(1,c=mt.id),"source"in mt&&n(2,p=mt.source),"sourceLayer"in mt&&n(3,u=mt.sourceLayer),"beforeId"in mt&&n(4,b=mt.beforeId),"beforeLayerType"in mt&&n(5,w=mt.beforeLayerType),"paint"in mt&&n(6,T=mt.paint),"layout"in mt&&n(7,P=mt.layout),"filter"in mt&&n(8,k=mt.filter),"minzoom"in mt&&n(9,B=mt.minzoom),"maxzoom"in mt&&n(10,V=mt.maxzoom),"hoverCursor"in mt&&n(11,tt=mt.hoverCursor),"manageHoverState"in mt&&n(12,ot=mt.manageHoverState),"hovered"in mt&&n(0,ut=mt.hovered),"eventsIfTopMost"in mt&&n(13,W=mt.eventsIfTopMost),"interactive"in mt&&n(14,X=mt.interactive),"$$scope"in mt&&n(23,a=mt.$$scope)},[ut,c,p,u,b,w,T,P,k,B,V,tt,ot,W,X,i,J,ht,vt,gt,St,It,Ft,a]}class k1 extends Tn{constructor(e){super(),Cn(this,e,F2,O2,In,{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 B2(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,i),c=Math.round(e.lat*a)/a,p=Math.round(e.lng*a)/a,u=`${n}/${c}/${p}`,b=t.getBearing(),w=t.getPitch();return(b||w)&&(u+=`/${Math.round(b*10)/10}`),w&&(u+=`/${Math.round(w)}`),`#${u}`}function V2(t){return t.replace("#","").split("/").map(parseFloat)}var am=j_;function j_(t,e){return t===e||t!==t&&e!==e?!0:typeof t!=typeof e||{}.toString.call(t)!={}.toString.call(e)||t!==Object(t)||!t?!1:Array.isArray(t)?$0(t,e):{}.toString.call(t)=="[object Set]"?$0(Array.from(t),Array.from(e)):{}.toString.call(t)=="[object Object]"?G2(t,e):U2(t,e)}function U2(t,e){return t.toString()===e.toString()}function $0(t,e){var n=t.length;if(n!=e.length)return!1;for(var i=0;in(6,i=T));let{position:c="top-left"}=e,{showCompass:p=!0}=e,{showZoom:u=!0}=e,{visualizePitch:b=!1}=e,w=null;return Il(()=>{i!=null&&i.loaded()&&w&&i.removeControl(w)}),t.$$set=T=>{"position"in T&&n(1,c=T.position),"showCompass"in T&&n(2,p=T.showCompass),"showZoom"in T&&n(3,u=T.showZoom),"visualizePitch"in T&&n(4,b=T.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&i&&!w&&(n(5,w=new qh.NavigationControl({showCompass:p,showZoom:u,visualizePitch:b})),i.addControl(w,c))},[a,c,p,u,b,w,i]}class D1 extends Tn{constructor(e){super(),Cn(this,e,q2,null,In,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function j2(t,e,n){let i;const{map:a}=Uf();Gn(t,a,w=>n(5,i=w));let{position:c="bottom-left"}=e,{maxWidth:p=void 0}=e,{unit:u="metric"}=e,b=null;return Il(()=>{i!=null&&i.loaded()&&b&&i.removeControl(b)}),t.$$set=w=>{"position"in w&&n(1,c=w.position),"maxWidth"in w&&n(2,p=w.maxWidth),"unit"in w&&n(3,u=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&i&&!b&&(n(4,b=new qh.ScaleControl({maxWidth:p,unit:u})),i.addControl(b,c))},[a,c,p,u,b,i]}class R1 extends Tn{constructor(e){super(),Cn(this,e,j2,null,In,{position:1,maxWidth:2,unit:3})}}const Z2=t=>({map:t[0]&8,loadedImages:t[0]&16,allImagesLoaded:t[0]&32}),tv=t=>({map:t[3],loadedImages:t[4],allImagesLoaded:t[5]});function ev(t){let e,n,i=t[2]&&nv(t);const a=t[36].default,c=Os(a,t,t[35],tv);return{c(){i&&i.c(),e=qe(),c&&c.c()},m(p,u){i&&i.m(p,u),fe(p,e,u),c&&c.m(p,u),n=!0},p(p,u){p[2]?i?(i.p(p,u),u[0]&4&&ne(i,1)):(i=nv(p),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs()),c&&c.p&&(!n||u[0]&56|u[1]&16)&&Bs(c,a,p,p[35],n?Fs(a,p[35],u,Z2):Vs(p[35]),tv)},i(p){n||(ne(i),ne(c,p),n=!0)},o(p){he(i),he(c,p),n=!1},d(p){p&&pe(e),i&&i.d(p),c&&c.d(p)}}}function nv(t){let e,n,i,a,c,p,u,b;return e=new D1({props:{position:t[6]}}),i=new N2({props:{position:t[6],fitBoundsOptions:{maxZoom:12}}}),c=new P2({props:{position:t[6]}}),u=new R1({props:{position:t[6]}}),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment),a=qe(),cn(c.$$.fragment),p=qe(),cn(u.$$.fragment)},m(w,T){en(e,w,T),fe(w,n,T),en(i,w,T),fe(w,a,T),en(c,w,T),fe(w,p,T),en(u,w,T),b=!0},p(w,T){const P={};T[0]&64&&(P.position=w[6]),e.$set(P);const k={};T[0]&64&&(k.position=w[6]),i.$set(k);const B={};T[0]&64&&(B.position=w[6]),c.$set(B);const V={};T[0]&64&&(V.position=w[6]),u.$set(V)},i(w){b||(ne(e.$$.fragment,w),ne(i.$$.fragment,w),ne(c.$$.fragment,w),ne(u.$$.fragment,w),b=!0)},o(w){he(e.$$.fragment,w),he(i.$$.fragment,w),he(c.$$.fragment,w),he(u.$$.fragment,w),b=!1},d(w){w&&(pe(n),pe(a),pe(p)),nn(e,w),nn(i,w),nn(c,w),nn(u,w)}}}function W2(t){let e,n,i,a,c,p=t[3]&&t[0]&&ev(t);return{c(){e=se("div"),p&&p.c(),zt(e,"class",n=vm(t[1])+" svelte-p00lfq"),Ba(e,"expand-map",!t[1])},m(u,b){fe(u,e,b),p&&p.m(e,null),i=!0,a||(c=Jw(t[9].call(null,e)),a=!0)},p(u,b){u[3]&&u[0]?p?(p.p(u,b),b[0]&9&&ne(p,1)):(p=ev(u),p.c(),ne(p,1),p.m(e,null)):p&&(us(),he(p,1,1,()=>{p=null}),cs()),(!i||b[0]&2&&n!==(n=vm(u[1])+" svelte-p00lfq"))&&zt(e,"class",n),(!i||b[0]&2)&&Ba(e,"expand-map",!u[1])},i(u){i||(ne(p),i=!0)},o(u){he(p),i=!1},d(u){u&&pe(e),p&&p.d(),a=!1,c()}}}function H2(t,e,n){let i,a,c,p,{$$slots:u={},$$scope:b}=e,{map:w=null}=e,{class:T=void 0}=e,{style:P}=e,{diffStyleUpdates:k=!1}=e,{center:B=void 0}=e,{zoom:V=void 0}=e,{pitch:tt=0}=e,{bearing:ot=0}=e,{bounds:ut=void 0}=e,{hash:W=!1}=e,{loaded:X=!1}=e,{minZoom:J=0}=e,{maxZoom:ht=22}=e,{zoomOnDoubleClick:vt=!0}=e,{locale:gt=void 0}=e,{interactive:St=!0}=e,{attributionControl:It=!0}=e,{cooperativeGestures:Ft=!1}=e,{preserveDrawingBuffer:mt=!1}=e,{maxBounds:Ct=void 0}=e,{images:ie=[]}=e,{standardControls:Tt=!1}=e,{filterLayers:ee=void 0}=e,{transformRequest:ge=void 0}=e;const Te=Ff(),{map:Oe,loadedImages:on}=p2();Gn(t,Oe,Kt=>n(3,c=Kt)),Gn(t,on,Kt=>n(4,p=Kt));let gn=new Set;async function Re(Kt,Ue=!1){if(c&&!(!c.loaded()&&!Ue))if("url"in Kt){gn.add(Kt.id);try{let yn=await c.loadImage(Kt.url);c==null||c.addImage(Kt.id,yn.data,Kt.options),p.add(Kt.id),on.set(p)}catch(yn){Te("error",yn)}finally{gn.delete(Kt.id)}}else c.addImage(Kt.id,Kt.data,Kt.options),p.add(Kt.id),on.set(p)}let Me,Dn,qn,Zn;function Wn(Kt){if(W){let Ue=V2(window.location.hash);Ue.length>=3&&(n(11,V=Ue[0]),n(10,B=[Ue[2],Ue[1]])),Ue.length==5&&(n(15,ot=Ue[3]),n(14,tt=Ue[4]))}return Hu(Oe,c=new qh.Map(wm({container:Kt,style:P,locale:gt,center:B,zoom:V,pitch:tt,bearing:ot,minZoom:J,maxZoom:ht,interactive:St,preserveDrawingBuffer:mt,maxBounds:Ct,bounds:ut,attributionControl:It,transformRequest:ge,cooperativeGestures:Ft})),c),c.on("load",Ue=>{n(0,X=!0),Te("load",c)}),c.on("error",Ue=>Te("error",{...Ue,map:c})),c.on("movestart",Ue=>Te("movestart",{...Ue,map:c})),c.on("moveend",Ue=>{if(n(10,B=Ue.target.getCenter()),n(11,V=Ue.target.getZoom()),n(12,ut=Ue.target.getBounds()),Te("moveend",{...Ue,map:c}),W){let yn=window.location.href.replace(/(#.+)?$/,B2(c));window.history.replaceState(window.history.state,"",yn)}}),c.on("zoomstart",Ue=>Te("zoomstart",{...Ue,map:c})),c.on("zoom",Ue=>{n(11,V=Ue.target.getZoom()),Te("zoom",{...Ue,map:c})}),c.on("zoomend",Ue=>{n(11,V=Ue.target.getZoom()),Te("zoomend",{...Ue,map:c})}),c.on("style.load",()=>{if(c){const Ue=c.getStyle();if(n(32,Me=Ue.layers.map(yn=>yn.id)),n(33,Dn=Object.keys(Ue.sources)),Zn)for(const[yn,br]of Object.entries(Zn))c.addSource(yn,br);if(qn)for(const yn of qn)c.addLayer(yn);for(const yn of ie)Re(yn,!0)}}),c.on("styledata",Ue=>{if(c&&ee){const yn=c.getStyle().layers;if(yn)for(let br of yn)ee(br)||c.setLayoutProperty(br.id,"visibility","none")}Te("styledata",{...Ue,map:c})}),{destroy(){n(0,X=!1),c==null||c.remove(),Hu(Oe,c=null,c)}}}let ri=P;return t.$$set=Kt=>{"map"in Kt&&n(13,w=Kt.map),"class"in Kt&&n(1,T=Kt.class),"style"in Kt&&n(16,P=Kt.style),"diffStyleUpdates"in Kt&&n(17,k=Kt.diffStyleUpdates),"center"in Kt&&n(10,B=Kt.center),"zoom"in Kt&&n(11,V=Kt.zoom),"pitch"in Kt&&n(14,tt=Kt.pitch),"bearing"in Kt&&n(15,ot=Kt.bearing),"bounds"in Kt&&n(12,ut=Kt.bounds),"hash"in Kt&&n(18,W=Kt.hash),"loaded"in Kt&&n(0,X=Kt.loaded),"minZoom"in Kt&&n(19,J=Kt.minZoom),"maxZoom"in Kt&&n(20,ht=Kt.maxZoom),"zoomOnDoubleClick"in Kt&&n(21,vt=Kt.zoomOnDoubleClick),"locale"in Kt&&n(22,gt=Kt.locale),"interactive"in Kt&&n(23,St=Kt.interactive),"attributionControl"in Kt&&n(24,It=Kt.attributionControl),"cooperativeGestures"in Kt&&n(25,Ft=Kt.cooperativeGestures),"preserveDrawingBuffer"in Kt&&n(26,mt=Kt.preserveDrawingBuffer),"maxBounds"in Kt&&n(27,Ct=Kt.maxBounds),"images"in Kt&&n(28,ie=Kt.images),"standardControls"in Kt&&n(2,Tt=Kt.standardControls),"filterLayers"in Kt&&n(29,ee=Kt.filterLayers),"transformRequest"in Kt&&n(30,ge=Kt.transformRequest),"$$scope"in Kt&&n(35,b=Kt.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&4&&n(6,i=typeof Tt=="boolean"?void 0:Tt),t.$$.dirty[0]&8&&n(13,w=c),t.$$.dirty[0]&196616|t.$$.dirty[1]&14&&c&&!am(P,ri)){const Kt=c.getStyle();if(Me&&(qn=Kt.layers.filter(Ue=>!Me.includes(Ue.id))),Dn){const Ue=Object.keys(Kt.sources).filter(yn=>!Dn.includes(yn));Zn={};for(const yn of Ue)Zn[yn]=Kt.sources[yn]}n(34,ri=P),c.setStyle(P,{diff:k}),Hu(on,p=new Set,p),n(31,gn=new Set)}if(t.$$.dirty[0]&268435481|t.$$.dirty[1]&1&&X&&c!=null&&c.loaded())for(let Kt of ie)!p.has(Kt.id)&&!gn.has(Kt.id)&&!c.hasImage(Kt.id)&&Re(Kt);t.$$.dirty[0]&268435472&&n(5,a=ie.every(Kt=>p.has(Kt.id))),t.$$.dirty[0]&1032&&B&&!am(B,c==null?void 0:c.getCenter())&&(c==null||c.panTo(B)),t.$$.dirty[0]&2056&&V&&!am(V,c==null?void 0:c.getZoom())&&(c==null||c.zoomTo(V)),t.$$.dirty[0]&4104&&ut&&!am(ut,c==null?void 0:c.getBounds())&&(c==null||c.fitBounds(ut)),t.$$.dirty[0]&2097160&&(vt?c==null||c.doubleClickZoom.enable():c==null||c.doubleClickZoom.disable())},[X,T,Tt,c,p,a,i,Oe,on,Wn,B,V,ut,w,tt,ot,P,k,W,J,ht,vt,gt,St,It,Ft,mt,Ct,ie,ee,ge,gn,Me,Dn,ri,b,u]}class X2 extends Tn{constructor(e){super(),Cn(this,e,H2,W2,In,{map:13,class:1,style:16,diffStyleUpdates:17,center:10,zoom:11,pitch:14,bearing:15,bounds:12,hash:18,loaded:0,minZoom:19,maxZoom:20,zoomOnDoubleClick:21,locale:22,interactive:23,attributionControl:24,cooperativeGestures:25,preserveDrawingBuffer:26,maxBounds:27,images:28,standardControls:2,filterLayers:29,transformRequest:30},null,[-1,-1])}}var qf=Uint8Array,N1=Uint16Array,Y2=Int32Array,K2=new qf([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]),J2=new qf([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]),z1=function(t,e){for(var n=new N1(31),i=0;i<31;++i)n[i]=e+=1<>1|(Bn&21845)<<1,ml=(ml&52428)>>2|(ml&13107)<<2,ml=(ml&61680)>>4|(ml&3855)<<4,tI[Bn]=((ml&65280)>>8|(ml&255)<<8)>>1;var ml,Bn,Bm=new qf(288);for(Bn=0;Bn<144;++Bn)Bm[Bn]=8;var Bn;for(Bn=144;Bn<256;++Bn)Bm[Bn]=9;var Bn;for(Bn=256;Bn<280;++Bn)Bm[Bn]=7;var Bn;for(Bn=280;Bn<288;++Bn)Bm[Bn]=8;var Bn,eI=new qf(32);for(Bn=0;Bn<32;++Bn)eI[Bn]=5;var Bn,nI=new qf(0),iI=typeof TextDecoder<"u"&&new TextDecoder,rI=0;try{iI.decode(nI,{stream:!0}),rI=1}catch{}let Yt;const F1=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&F1.decode();let of=null;function pf(){return(of===null||of.byteLength===0)&&(of=new Uint8Array(Yt.memory.buffer)),of}function Ki(t,e){return t=t>>>0,F1.decode(pf().subarray(t,t+e))}const gl=new Array(128).fill(void 0);gl.push(void 0,null,!0,!1);let ff=gl.length;function mr(t){ff===gl.length&&gl.push(gl.length+1);const e=ff;return ff=gl[e],gl[e]=t,e}function An(t){return gl[t]}let vl=0;const gm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},oI=typeof gm.encodeInto=="function"?function(t,e){return gm.encodeInto(t,e)}:function(t,e){const n=gm.encode(t);return e.set(n),{read:t.length,written:n.length}};function df(t,e,n){if(n===void 0){const u=gm.encode(t),b=e(u.length,1)>>>0;return pf().subarray(b,b+u.length).set(u),vl=u.length,b}let i=t.length,a=e(i,1)>>>0;const c=pf();let p=0;for(;p127)break;c[a+p]=u}if(p!==i){p!==0&&(t=t.slice(p)),a=n(a,i,i=p+t.length*3,1)>>>0;const u=pf().subarray(a+p,a+i),b=oI(t,u);p+=b.written}return vl=p,a}function u_(t){return t==null}let sf=null;function Ze(){return(sf===null||sf.byteLength===0)&&(sf=new Int32Array(Yt.memory.buffer)),sf}function sI(t){t<132||(gl[t]=ff,ff=t)}function Wu(t){const e=An(t);return sI(t),e}let af=null;function aI(){return(af===null||af.byteLength===0)&&(af=new Float64Array(Yt.memory.buffer)),af}function v_(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const a=t.description;return a==null?"Symbol":`Symbol(${a})`}if(e=="function"){const a=t.name;return typeof a=="string"&&a.length>0?`Function(${a})`:"Function"}if(Array.isArray(t)){const a=t.length;let c="[";a>0&&(c+=v_(t[0]));for(let p=1;p1)i=n[1];else return toString.call(t);if(i=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:i}function lI(t,e){const n=e(t.length*1,1)>>>0;return pf().set(t,n/1),vl=t.length,n}let lf=null;function uI(){return(lf===null||lf.byteLength===0)&&(lf=new Uint32Array(Yt.memory.buffer)),lf}function cI(t,e){t=t>>>0;const i=uI().subarray(t/4,t/4+e),a=[];for(let c=0;c>>0;const n=Object.create(Z_.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();Yt.__wbg_jsdebugstreets_free(e)}getLabel(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsdebugstreets_getLabel(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}getNetwork(){const e=Yt.jsdebugstreets_getNetwork(this.__wbg_ptr);return Wu(e)}toDebugGeojson(){try{const i=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsdebugstreets_toDebugGeojson(i,this.__wbg_ptr);var e=Ze()[i/4+0],n=Ze()[i/4+1];let a;return e!==0&&(a=Ki(e,n).slice(),Yt.__wbindgen_free(e,n*1,1)),a}finally{Yt.__wbindgen_add_to_stack_pointer(16)}}}class Vm{static __wrap(e){e=e>>>0;const n=Object.create(Vm.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();Yt.__wbg_jsstreetnetwork_free(e)}constructor(e,n,i){try{const u=Yt.__wbindgen_add_to_stack_pointer(-16),b=lI(e,Yt.__wbindgen_malloc),w=vl,T=df(n,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),P=vl;Yt.jsstreetnetwork_new(u,b,w,T,P,mr(i));var a=Ze()[u/4+0],c=Ze()[u/4+1],p=Ze()[u/4+2];if(p)throw Wu(c);return this.__wbg_ptr=a>>>0,this}finally{Yt.__wbindgen_add_to_stack_pointer(16)}}toGeojsonPlain(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toGeojsonPlain(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}toLanePolygonsGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toLanePolygonsGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}toLaneMarkingsGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toLaneMarkingsGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}toIntersectionMarkingsGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toIntersectionMarkingsGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}getDebugSteps(){try{const a=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_getDebugSteps(a,this.__wbg_ptr);var e=Ze()[a/4+0],n=Ze()[a/4+1],i=cI(e,n).slice();return Yt.__wbindgen_free(e,n*4,4),i}finally{Yt.__wbindgen_add_to_stack_pointer(16)}}debugClockwiseOrderingGeojson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugClockwiseOrderingGeojson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}debugClockwiseOrderingForIntersectionGeojson(e){let n,i;try{const p=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugClockwiseOrderingForIntersectionGeojson(p,this.__wbg_ptr,e);var a=Ze()[p/4+0],c=Ze()[p/4+1];return n=a,i=c,Ki(a,c)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}debugMovementsFromLaneGeojson(e,n){let i,a;try{const u=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugMovementsFromLaneGeojson(u,this.__wbg_ptr,e,n);var c=Ze()[u/4+0],p=Ze()[u/4+1];return i=c,a=p,Ki(c,p)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(i,a,1)}}debugRoadsConnectedToIntersectionGeojson(e){let n,i;try{const p=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_debugRoadsConnectedToIntersectionGeojson(p,this.__wbg_ptr,e);var a=Ze()[p/4+0],c=Ze()[p/4+1];return n=a,i=c,Ki(a,c)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}getOsmTagsForWay(e){let n,i;try{const T=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_getOsmTagsForWay(T,this.__wbg_ptr,e);var a=Ze()[T/4+0],c=Ze()[T/4+1],p=Ze()[T/4+2],u=Ze()[T/4+3],b=a,w=c;if(u)throw b=0,w=0,Wu(p);return n=b,i=w,Ki(b,w)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}toJson(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_toJson(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}getGeometryForWay(e){let n,i;try{const p=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_getGeometryForWay(p,this.__wbg_ptr,e);var a=Ze()[p/4+0],c=Ze()[p/4+1];return n=a,i=c,Ki(a,c)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}wayToXml(e){let n,i;try{const T=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_wayToXml(T,this.__wbg_ptr,e);var a=Ze()[T/4+0],c=Ze()[T/4+1],p=Ze()[T/4+2],u=Ze()[T/4+3],b=a,w=c;if(u)throw b=0,w=0,Wu(p);return n=b,i=w,Ki(b,w)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(n,i,1)}}findBlock(e,n,i){let a,c;try{const k=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_findBlock(k,this.__wbg_ptr,e,n,i);var p=Ze()[k/4+0],u=Ze()[k/4+1],b=Ze()[k/4+2],w=Ze()[k/4+3],T=p,P=u;if(w)throw T=0,P=0,Wu(b);return a=T,c=P,Ki(T,P)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(a,c,1)}}findAllBlocks(){let e,n;try{const c=Yt.__wbindgen_add_to_stack_pointer(-16);Yt.jsstreetnetwork_findAllBlocks(c,this.__wbg_ptr);var i=Ze()[c/4+0],a=Ze()[c/4+1];return e=i,n=a,Ki(i,a)}finally{Yt.__wbindgen_add_to_stack_pointer(16),Yt.__wbindgen_free(e,n,1)}}overwriteOsmTagsForWay(e,n){const i=df(n,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),a=vl;Yt.jsstreetnetwork_overwriteOsmTagsForWay(this.__wbg_ptr,e,i,a)}collapseShortRoad(e){Yt.jsstreetnetwork_collapseShortRoad(this.__wbg_ptr,e)}collapseIntersection(e){Yt.jsstreetnetwork_collapseIntersection(this.__wbg_ptr,e)}zipSidepath(e){Yt.jsstreetnetwork_zipSidepath(this.__wbg_ptr,e)}}async function hI(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(i){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i);else throw i}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function pI(){const t={};return t.wbg={},t.wbg.__wbg_jsdebugstreets_new=function(e){const n=Z_.__wrap(e);return mr(n)},t.wbg.__wbindgen_string_new=function(e,n){const i=Ki(e,n);return mr(i)},t.wbg.__wbg_jsstreetnetwork_new=function(e){const n=Vm.__wrap(e);return mr(n)},t.wbg.__wbindgen_string_get=function(e,n){const i=An(n),a=typeof i=="string"?i:void 0;var c=u_(a)?0:df(a,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),p=vl;Ze()[e/4+1]=p,Ze()[e/4+0]=c},t.wbg.__wbindgen_object_drop_ref=function(e){Wu(e)},t.wbg.__wbindgen_boolean_get=function(e){const n=An(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_object=function(e){const n=An(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return An(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return An(e)in An(n)},t.wbg.__wbindgen_error_new=function(e,n){const i=new Error(Ki(e,n));return mr(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return An(e)==An(n)},t.wbg.__wbindgen_number_get=function(e,n){const i=An(n),a=typeof i=="number"?i:void 0;aI()[e/8+1]=u_(a)?0:a,Ze()[e/4+0]=!u_(a)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=An(e);return mr(n)},t.wbg.__wbg_getwithrefkey_5e6d9547403deab8=function(e,n){const i=An(e)[An(n)];return mr(i)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return mr(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const i=An(n).stack,a=df(i,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),c=vl;Ze()[e/4+1]=c,Ze()[e/4+0]=a},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let i,a;try{i=e,a=n,console.error(Ki(e,n))}finally{Yt.__wbindgen_free(i,a,1)}},t.wbg.__wbg_debug_2ef5d777cf4811fa=function(e){console.debug(An(e))},t.wbg.__wbg_error_f0a6627f4b23c19d=function(e){console.error(An(e))},t.wbg.__wbg_info_3ca7870690403fee=function(e){console.info(An(e))},t.wbg.__wbg_log_7811587c4c6d2844=function(e){console.log(An(e))},t.wbg.__wbg_warn_4affe1093892a4ef=function(e){console.warn(An(e))},t.wbg.__wbg_now_0669e62508913829=function(e){return An(e).now()},t.wbg.__wbg_newnoargs_c62ea9419c21fbac=function(e,n){const i=new Function(Ki(e,n));return mr(i)},t.wbg.__wbg_get_7b48513de5dc5ea4=function(){return hh(function(e,n){const i=Reflect.get(An(e),An(n));return mr(i)},arguments)},t.wbg.__wbg_call_90c26b09837aba1c=function(){return hh(function(e,n){const i=An(e).call(An(n));return mr(i)},arguments)},t.wbg.__wbg_self_f0e34d89f33b99fd=function(){return hh(function(){const e=self.self;return mr(e)},arguments)},t.wbg.__wbg_window_d3b084224f4774d7=function(){return hh(function(){const e=window.window;return mr(e)},arguments)},t.wbg.__wbg_globalThis_9caa27ff917c6860=function(){return hh(function(){const e=globalThis.globalThis;return mr(e)},arguments)},t.wbg.__wbg_global_35dfdd59a4da3e74=function(){return hh(function(){const e=global.global;return mr(e)},arguments)},t.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2=function(e){let n;try{n=An(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_buffer_a448f833075b71ba=function(e){const n=An(e).buffer;return mr(n)},t.wbg.__wbg_new_8f67e318f15d7254=function(e){const n=new Uint8Array(An(e));return mr(n)},t.wbg.__wbg_set_2357bf09366ee480=function(e,n,i){An(e).set(An(n),i>>>0)},t.wbg.__wbg_length_1d25fa9e4ac21ce7=function(e){return An(e).length},t.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa=function(e){let n;try{n=An(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbindgen_debug_string=function(e,n){const i=v_(An(n)),a=df(i,Yt.__wbindgen_malloc,Yt.__wbindgen_realloc),c=vl;Ze()[e/4+1]=c,Ze()[e/4+0]=a},t.wbg.__wbindgen_throw=function(e,n){throw new Error(Ki(e,n))},t.wbg.__wbindgen_memory=function(){const e=Yt.memory;return mr(e)},t}function fI(t,e){return Yt=t.exports,dI.__wbindgen_wasm_module=e,af=null,sf=null,lf=null,of=null,Yt}async function dI(t){if(Yt!==void 0)return Yt;typeof t>"u"&&(t="/osm2streets/assets/osm2streets_js_bg.wasm");const e=pI();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:i}=await hI(await t,e);return fI(n,i)}function mI(t){let e,n,i,a,c,p,u;return{c(){e=se("div"),n=Un(`App: + `),i=se("select"),a=se("option"),a.textContent="Street Explorer",c=se("option"),c.textContent="Lane editor",a.__value="index.html",ls(a,a.__value),c.__value="lane_editor.html",ls(c,c.__value),t[0]===void 0&&yf(()=>t[2].call(i))},m(b,w){fe(b,e,w),Zt(e,n),Zt(e,i),Zt(i,a),Zt(i,c),xm(i,t[0],!0),p||(u=[un(i,"change",t[2]),un(i,"change",t[1])],p=!0)},p(b,[w]){w&1&&xm(i,b[0])},i:Ye,o:Ye,d(b){b&&pe(e),p=!1,eo(u)}}}function gI(t,e,n){let i=window.location.pathname.split("/").pop()||"index.html",a=i;function c(){a!=i&&(window.location.href=a)}function p(){a=b1(this),n(0,a)}return[a,c,p]}class KT extends Tn{constructor(e){super(),Cn(this,e,gI,mI,In,{})}}var ho=63710088e-1,W_={centimeters:ho*100,centimetres:ho*100,degrees:ho/111325,feet:ho*3.28084,inches:ho*39.37,kilometers:ho/1e3,kilometres:ho/1e3,meters:ho,metres:ho,miles:ho/1609.344,millimeters:ho*1e3,millimetres:ho*1e3,nauticalmiles:ho/1852,radians:1,yards:ho*1.0936},_I={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ho,yards:1.0936133},x_={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Us(t,e,n){n===void 0&&(n={});var i={type:"Feature"};return(n.id===0||n.id)&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.properties=e||{},i.geometry=t,i}function yI(t,e,n){switch(t){case"Point":return Go(e).geometry;case"LineString":return Ds(e).geometry;case"Polygon":return H_(e).geometry;case"MultiPoint":return V1(e).geometry;case"MultiLineString":return B1(e).geometry;case"MultiPolygon":return U1(e).geometry;default:throw new Error(t+" is invalid")}}function Go(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Im(t[0])||!Im(t[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:t};return Us(i,e,n)}function vI(t,e,n){return n===void 0&&(n={}),Xu(t.map(function(i){return Go(i,e)}),n)}function H_(t,e,n){n===void 0&&(n={});for(var i=0,a=t;i=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function X_(t,e){e===void 0&&(e="kilometers");var n=W_[e];if(!n)throw new Error(e+" units is invalid");return t*n}function Um(t,e){e===void 0&&(e="kilometers");var n=W_[e];if(!n)throw new Error(e+" units is invalid");return t/n}function EI(t,e){return vf(Um(t,e))}function SI(t){var e=t%360;return e<0&&(e+=360),e}function vf(t){var e=t%(2*Math.PI);return e*180/Math.PI}function Rs(t){var e=t%360;return e*Math.PI/180}function CI(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return X_(Um(t,e),n)}function TI(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=x_[e];if(!i)throw new Error("invalid original units");var a=x_[n];if(!a)throw new Error("invalid final units");return t/i*a}function Im(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Y_(t){return!!t&&t.constructor===Object}function LI(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!Im(e))throw new Error("bbox must only contain numbers")})}function PI(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const MI=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:x_,bearingToAzimuth:SI,convertArea:TI,convertLength:CI,degreesToRadians:Rs,earthRadius:ho,factors:W_,feature:Us,featureCollection:Xu,geometry:yI,geometryCollection:wI,isNumber:Im,isObject:Y_,lengthToDegrees:EI,lengthToRadians:Um,lineString:Ds,lineStrings:bI,multiLineString:B1,multiPoint:V1,multiPolygon:U1,point:Go,points:vI,polygon:H_,polygons:xI,radiansToDegrees:vf,radiansToLength:X_,round:II,unitsFactors:_I,validateBBox:LI,validateId:PI},Symbol.toStringTag,{value:"Module"}));function Zh(t,e,n){if(t!==null)for(var i,a,c,p,u,b,w,T=0,P=0,k,B=t.type,V=B==="FeatureCollection",tt=B==="Feature",ot=V?t.features.length:1,ut=0;utb||V>w||tt>T){u=P,b=i,w=V,T=tt,c=0;return}var ot=Ds([u,P],n.properties);if(e(ot,i,a,tt,c)===!1)return!1;c++,u=P})===!1)return!1}}})}function OI(t,e,n){var i=n,a=!1;return q1(t,function(c,p,u,b,w){a===!1&&n===void 0?i=c:i=e(i,c,p,u,b,w),a=!0}),i}function j1(t,e){if(!t)throw new Error("geojson is required");Wh(t,function(n,i,a){if(n.geometry!==null){var c=n.geometry.type,p=n.geometry.coordinates;switch(c){case"LineString":if(e(n,i,a,0,0)===!1)return!1;break;case"Polygon":for(var u=0;un[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]{w_.set(null),I_.set(null)});function W1(t,e){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function vh(t,e,n){let i=["case"];for(let[a,c]of Object.entries(e))i.push(["==",["get",t],a]),i.push(c);return i.push(n),i}function jf(){return{type:"FeatureCollection",features:[]}}function H1(t){return Sm(t)}function Zf(t){return{id:t,beforeId:ZI(t)}}function ZI(t){let e=_1(Yu),n,i=!1;for(let a=iv.length-1;a>=0;a--){let c=iv[a];if(c==t){i=!0;break}e.getLayer(c)&&(n=c)}if(!i)throw new Error(`Layer ID ${t} not defined in layerZorder`);return n}const iv=["boundary","lane-polygons","intersection-polygons","lane-markings","intersection-markings","movements","connected-roads","block","debug-ids","current-way","road_label","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices"];var WI=Object.defineProperty,HI=(t,e,n)=>e in t?WI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rv=(t,e,n)=>(HI(t,typeof e!="symbol"?e+"":e,n),n);function xf(){}function X1(t){return t()}function ov(){return Object.create(null)}function Gm(t){t.forEach(X1)}function Y1(t){return typeof t=="function"}function XI(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function YI(t){return Object.keys(t).length===0}function KI(t,e){t.appendChild(e)}function JI(t,e,n){t.insertBefore(e,n||null)}function K1(t){t.parentNode&&t.parentNode.removeChild(t)}function sv(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function $l(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function QI(t){return Array.from(t.childNodes)}function lm(t,e,n){t.classList.toggle(e,!!n)}let J_;function mf(t){J_=t}const mh=[],av=[];let yh=[];const lv=[],$I=Promise.resolve();let E_=!1;function tE(){E_||(E_=!0,$I.then(J1))}function S_(t){yh.push(t)}const c_=new Set;let ph=0;function J1(){if(ph!==0)return;const t=J_;do{try{for(;pht.indexOf(i)===-1?e.push(i):n.push(i)),n.forEach(i=>i()),yh=e}const iE=new Set;function rE(t,e){t&&t.i&&(iE.delete(t),t.i(e))}function oE(t,e,n){const{fragment:i,after_update:a}=t.$$;i&&i.m(e,n),S_(()=>{const c=t.$$.on_mount.map(X1).filter(Y1);t.$$.on_destroy?t.$$.on_destroy.push(...c):Gm(c),t.$$.on_mount=[]}),a.forEach(S_)}function sE(t,e){const n=t.$$;n.fragment!==null&&(nE(n.after_update),Gm(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function aE(t,e){t.$$.dirty[0]===-1&&(mh.push(t),tE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const V=B.length?B[0]:k;return w.ctx&&a(w.ctx[P],w.ctx[P]=V)&&(!w.skip_bound&&w.bound[P]&&w.bound[P](V),T&&aE(t,P)),k}):[],w.update(),T=!0,Gm(w.before_update),w.fragment=i?i(w.ctx):!1,e.target){if(e.hydrate){const P=QI(e.target);w.fragment&&w.fragment.l(P),P.forEach(K1)}else w.fragment&&w.fragment.c();e.intro&&rE(t.$$.fragment),oE(t,e.target,e.anchor),J1()}mf(b)}class uE{constructor(){rv(this,"$$"),rv(this,"$$set")}$destroy(){sE(this,1),this.$destroy=xf}$on(e,n){if(!Y1(n))return xf;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const a=i.indexOf(n);a!==-1&&i.splice(a,1)}}$set(e){this.$$set&&!YI(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const cE="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(cE);function hE(t){let e,n,i;return{c(){e=sv("svg"),n=sv("path"),$l(n,"stroke-width","4"),$l(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"),$l(n,"class","svelte-gzo3ar"),$l(e,"width",i=t[0]==="list"?20:void 0),$l(e,"viewBox","0 0 70 85"),$l(e,"fill","none"),$l(e,"class","svelte-gzo3ar"),lm(e,"in-map",t[0]!=="list"),lm(e,"list-icon",t[0]==="list")},m(a,c){JI(a,e,c),KI(e,n)},p(a,[c]){c&1&&i!==(i=a[0]==="list"?20:void 0)&&$l(e,"width",i),c&1&&lm(e,"in-map",a[0]!=="list"),c&1&&lm(e,"list-icon",a[0]==="list")},i:xf,o:xf,d(a){a&&K1(e)}}}function pE(t,e,n){let{displayIn:i}=e;return t.$$set=a=>{"displayIn"in a&&n(0,i=a.displayIn)},[i]}class fE extends uE{constructor(e){super(),lE(this,e,pE,hE,XI,{displayIn:0})}}const dE=[{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"}],mE={decimalLatitude:40.123,decimalLongitude:-74.123},gE=[{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}],_E=[{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 yE(){const t=[];return dE.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...mE})}),[...t,...gE,..._E]}const vE=yE();vE.map(t=>t.verbatimCoordinates);/** * splaytree v3.1.2 * Fast Splay tree for Node and browser * @@ -600,10 +600,10 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function xE(t,e){var n={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},i,a,c,p;return p={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function u(w){return function(T){return b([w,T])}}function b(w){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,a&&(c=w[0]&2?a.return:w[0]?a.throw||((c=a.return)&&c.call(a),0):a.next)&&!(c=c.call(a,w[1])).done)return c;switch(a=0,c&&(w=[w[0]&2,c.value]),w[0]){case 0:case 1:c=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,a=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(c=n.trys,!(c=c.length>0&&c[c.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!c||w[1]>c[0]&&w[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var u=e.right;if(e.right=u.left,u.left=e,e=u,e.right===null)break}a.right=e,a=e,e=e.right}else break}return a.right=e.left,c.left=e.right,e.left=i.right,e.right=i.left,e}function h_(t,e,n,i){var a=new su(t,e);if(n===null)return a.left=a.right=null,a;n=nu(t,n,i);var c=i(t,n.key);return c<0?(a.left=n.left,a.right=n,n.left=null):c>=0&&(a.right=n.right,a.left=n,n.right=null),a}function uv(t,e,n){var i=null,a=null;if(e){e=nu(t,e,n);var c=n(e.key,t);c===0?(i=e.left,a=e.right):c<0?(a=e.right,e.right=null,i=e):(i=e.left,e.left=null,a=e)}return{left:i,right:a}}function wE(t,e,n){return e===null?t:(t===null||(e=nu(t.key,e,n),e.left=t),e)}function C_(t,e,n,i,a){if(t){i(""+e+(n?"└── ":"├── ")+a(t)+` -`);var c=e+(n?" ":"│ ");t.left&&C_(t.left,c,!1,i,a),t.right&&C_(t.right,c,!0,i,a)}}var Q_=function(){function t(e){e===void 0&&(e=bE),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=h_(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var i=new su(e,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var a=this._comparator,c=nu(e,this._root,a),p=a(e,c.key);return p===0?this._root=c:(p<0?(i.left=c.left,i.right=c,c.left=null):p>0&&(i.right=c.right,i.left=c,c.right=null),this._size++,this._root=i),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,i){var a;if(n===null)return null;n=nu(e,n,i);var c=i(e,n.key);return c===0?(n.left===null?a=n.right:(a=nu(e,n.left,i),a.right=n.right),this._size--,a):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=nu(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,i=this._comparator;n;){var a=i(e,n.key);if(a===0)return n;a<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=nu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,i=this._comparator;n;){var a=i(e,n.key);if(a===0)return!0;a<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var i=this._root,a=[],c=!1;!c;)i!==null?(a.push(i),i=i.left):a.length!==0?(i=a.pop(),e.call(n,i),i=i.right):c=!0;return this},t.prototype.range=function(e,n,i,a){for(var c=[],p=this._comparator,u=this._root,b;c.length!==0||u;)if(u)c.push(u),u=u.left;else{if(u=c.pop(),b=p(u.key,n),b>0)break;if(p(u.key,e)>=0&&i.call(a,u))return this;u=u.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var i=n.key;return e.push(i)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var i=n.data;return e.push(i)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,i=!1,a=0,c=[];!i;)if(n)c.push(n),n=n.left;else if(c.length>0){if(n=c.pop(),a===e)return n;a++,n=n.right}else i=!0;return null},t.prototype.next=function(e){var n=this._root,i=null;if(e.right){for(i=e.right;i.left;)i=i.left;return i}for(var a=this._comparator;n;){var c=a(e.key,n.key);if(c===0)break;c<0?(i=n,n=n.left):n=n.right}return i},t.prototype.prev=function(e){var n=this._root,i=null;if(e.left!==null){for(i=e.left;i.right;)i=i.right;return i}for(var a=this._comparator;n;){var c=a(e.key,n.key);if(c===0)break;c<0?n=n.left:(i=n,n=n.right)}return i},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return EE(this._root)},t.prototype.load=function(e,n,i){n===void 0&&(n=[]),i===void 0&&(i=!1);var a=e.length,c=this._comparator;if(i&&P_(e,n,0,a-1,c),this._root===null)this._root=T_(e,n,0,a),this._size=a;else{var p=SE(this.toList(),IE(e,n),c);a=this._size+a,this._root=L_({head:p},0,a)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(i){return String(i.key)});var n=[];return C_(this._root,"",!0,function(i){return n.push(i)},e),n.join("")},t.prototype.update=function(e,n,i){var a=this._comparator,c=uv(e,this._root,a),p=c.left,u=c.right;a(e,n)<0?u=h_(n,i,u,a):p=h_(n,i,p,a),this._root=wE(p,u,a)},t.prototype.split=function(e){return uv(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,i;return xE(this,function(a){switch(a.label){case 0:e=this._root,n=[],i=!1,a.label=1;case 1:return i?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return a.sent(),e=e.right,[3,5];case 4:i=!0,a.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function T_(t,e,n,i){var a=i-n;if(a>0){var c=n+Math.floor(a/2),p=t[c],u=e[c],b=new su(p,u);return b.left=T_(t,e,n,c),b.right=T_(t,e,c+1,i),b}return null}function IE(t,e){for(var n=new su(null,null),i=n,a=0;a0?(e=c=c.next=n.pop(),e=e.right):i=!0;return c.next=null,a.next}function L_(t,e,n){var i=n-e;if(i>0){var a=e+Math.floor(i/2),c=L_(t,e,a),p=t.head;return p.left=c,t.head=t.head.next,p.right=L_(t,a+1,n),p}return null}function SE(t,e,n){for(var i=new su(null,null),a=i,c=t,p=e;c!==null&&p!==null;)n(c.key,p.key)<0?(a.next=c,c=c.next):(a.next=p,p=p.next),a=a.next;return c!==null?a.next=c:p!==null&&(a.next=p),i.next}function P_(t,e,n,i,a){if(!(n>=i)){for(var c=t[n+i>>1],p=n-1,u=i+1;;){do p++;while(a(t[p],c)<0);do u--;while(a(t[u],c)>0);if(p>=u)break;var b=t[p];t[p]=t[u],t[u]=b,b=e[p],e[p]=e[u],e[u]=b}P_(t,e,n,u,a),P_(t,e,u+1,i,a)}}function Qs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cv(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){Qs(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Po(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,i=0,a=n.length;i=0&&P>=0?wk?-1:0:b<0&&P<0?wk?1:0:Pb?1:0}}}]),t}(),AE=0,Tm=function(){Po(t,null,[{key:"compare",value:function(e,n){var i=e.leftSE.point.x,a=n.leftSE.point.x,c=e.rightSE.point.x,p=n.rightSE.point.x;if(pu&&b>w)return-1;var P=e.comparePoint(n.leftSE.point);if(P<0)return 1;if(P>0)return-1;var k=n.comparePoint(e.rightSE.point);return k!==0?k:-1}if(i>a){if(ub&&u>T)return 1;var B=n.comparePoint(e.leftSE.point);if(B!==0)return B;var V=e.comparePoint(n.rightSE.point);return V<0?1:V>0?-1:1}if(ub)return 1;if(cp){var ot=e.comparePoint(n.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(c!==p){var ut=w-u,W=c-i,X=T-b,J=p-a;if(ut>W&&XJ)return-1}return c>p?1:cT?1:e.idn.id?1:0}}]);function t(e,n,i,a){Qs(this,t),this.id=++AE,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=i,this.windings=a}return Po(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,i=this.rightSE.point,a=this.vector();if(n.x===i.x)return e.x===n.x?0:e.x0&&u.swapEvents(),Oa.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(a.checkForConsuming(),c.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n0){var c=n;n=i,i=c}if(n.prev===i){var p=n;n=i,i=p}for(var u=0,b=i.rings.length;u0)a=n,c=e,p=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var b=new Oa(a,!0),w=new Oa(c,!1);return new t(b,w,[i],[p])}}]),t}(),mv=function(){function t(e,n,i){if(Qs(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var a=bf.round(e[0][0],e[0][1]);this.bbox={ll:{x:a.x,y:a.y},ur:{x:a.x,y:a.y}};for(var c=a,p=1,u=e.length;pthis.bbox.ur.x&&(this.bbox.ur.x=b.x),b.y>this.bbox.ur.y&&(this.bbox.ur.y=b.y),c=b)}(a.x!==c.x||a.y!==c.y)&&this.segments.push(Tm.fromRing(c,a,this))}return Po(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,i=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=c.bbox.ur.x),c.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=c.bbox.ur.y),this.interiorRings.push(c)}this.multiPoly=n}return Po(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=c.bbox.ur.x),c.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=c.bbox.ur.y),this.polys.push(c)}this.isSubject=n}return Po(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,i=this.polys.length;n0&&(e=a)}for(var c=e.segment.prevInResult(),p=c?c.prevInResult():null;;){if(!c)return null;if(!p)return c.ringOut;if(p.ringOut!==c.ringOut)return p.ringOut.enclosingRing()!==c.ringOut?c.ringOut:c.ringOut.enclosingRing();c=p.prevInResult(),p=c?c.prevInResult():null}}}]),t}(),_v=function(){function t(e){Qs(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Po(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,i=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Tm.compare;Qs(this,t),this.queue=e,this.tree=new Q_(n),this.segments=[]}return Po(t,[{key:"process",value:function(e){var n=e.segment,i=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),i;var a=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!a)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 c=a,p=a,u=void 0,b=void 0;u===void 0;)c=this.tree.prev(c),c===null?u=null:c.key.consumedBy===void 0&&(u=c.key);for(;b===void 0;)p=this.tree.next(p),p===null?b=null:p.key.consumedBy===void 0&&(b=p.key);if(e.isLeft){var w=null;if(u){var T=u.getIntersection(n);if(T!==null&&(n.isAnEndpoint(T)||(w=T),!u.isAnEndpoint(T)))for(var P=this._splitSafely(u,T),k=0,B=P.length;k0?(this.tree.remove(n),i.push(e)):(this.segments.push(n),n.prev=u)}else{if(u&&b){var St=u.getIntersection(b);if(St!==null){if(!u.isAnEndpoint(St))for(var It=this._splitSafely(u,St),Ft=0,mt=It.length;Ftyv)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var J=new NE(V),ht=V.size,vt=V.pop();vt;){var gt=vt.key;if(V.size===ht){var St=gt.segment;throw new Error("Unable to pop() ".concat(gt.isLeft?"left":"right"," SweepEvent ")+"[".concat(gt.point.x,", ").concat(gt.point.y,"] from segment #").concat(St.id," ")+"[".concat(St.leftSE.point.x,", ").concat(St.leftSE.point.y,"] -> ")+"[".concat(St.rightSE.point.x,", ").concat(St.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(V.size>yv)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(J.segments.length>zE)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var It=J.process(gt),Ft=0,mt=It.length;Ft1?e-1:0),i=1;i1?e-1:0),i=1;i1?e-1:0),i=1;i1?e-1:0),i=1;in[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};wt.prototype.clone=function(){};wt.prototype.copy=function(){return new wt(this)};wt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};wt.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)};wt.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};wt.prototype.hashCode=function(){var t=17;return t=37*t+wt.hashCode(this.x),t=37*t+wt.hashCode(this.y),t};wt.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};wt.prototype.interfaces_=function(){return[Jo,jm,Qo]};wt.prototype.getClass=function(){return wt};wt.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=Ve.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};cc.DimensionalComparator.get=function(){return yl};cc.serialVersionUID.get=function(){return 6683108902428367e3};cc.NULL_ORDINATE.get=function(){return Ve.NaN};cc.X.get=function(){return 0};cc.Y.get=function(){return 1};cc.Z.get=function(){return 2};Object.defineProperties(wt,cc);var yl=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new Qn("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};yl.prototype.compare=function(t,e){var n=t,i=e,a=yl.compare(n.x,i.x);if(a!==0)return a;var c=yl.compare(n.y,i.y);if(c!==0)return c;if(this._dimensionsToTest<=2)return 0;var p=yl.compare(n.z,i.z);return p};yl.prototype.interfaces_=function(){return[xh]};yl.prototype.getClass=function(){return yl};yl.compare=function(t,e){return te?1:Ve.isNaN(t)?Ve.isNaN(e)?0:-1:Ve.isNaN(e)?1:0};var bh=function(){};bh.prototype.create=function(){};bh.prototype.interfaces_=function(){return[]};bh.prototype.getClass=function(){return bh};var Lt=function(){},Wf={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Lt.prototype.interfaces_=function(){return[]};Lt.prototype.getClass=function(){return Lt};Lt.toLocationSymbol=function(t){switch(t){case Lt.EXTERIOR:return"e";case Lt.BOUNDARY:return"b";case Lt.INTERIOR:return"i";case Lt.NONE:return"-"}throw new Qn("Unknown location value: "+t)};Wf.INTERIOR.get=function(){return 0};Wf.BOUNDARY.get=function(){return 1};Wf.EXTERIOR.get=function(){return 2};Wf.NONE.get=function(){return-1};Object.defineProperties(Lt,Wf);var Ne=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Mo=function(){},sx={LOG_10:{configurable:!0}};Mo.prototype.interfaces_=function(){return[]};Mo.prototype.getClass=function(){return Mo};Mo.log10=function(t){var e=Math.log(t);return Ve.isInfinite(e)||Ve.isNaN(e)?e:e/Mo.LOG_10};Mo.min=function(t,e,n,i){var a=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],a=arguments[1],c=arguments[2];return ic?c:i}};Mo.wrap=function(t,e){return t<0?e- -t%e:t%e};Mo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],p=arguments[2],u=arguments[3],b=a;return c>b&&(b=c),p>b&&(b=p),u>b&&(b=u),b}};Mo.average=function(t,e){return(t+e)/2};sx.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Mo,sx);var $s=function(t){this.str=t};$s.prototype.append=function(t){this.str+=t};$s.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};$s.prototype.toString=function(t){return this.str};var Gs=function(t){this.value=t};Gs.prototype.intValue=function(){return this.value};Gs.prototype.compareTo=function(t){return this.valuet?1:0};Gs.isNaN=function(t){return Number.isNaN(t)};var wf=function(){};wf.isWhitespace=function(t){return t<=32&&t>=0||t===127};wf.toUpperCase=function(t){return t.toUpperCase()};var Dt=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var i=arguments[0];t.call(this,t.parse(i))}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this.init(a,c)}},xs={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}};Dt.prototype.le=function(t){return(this._hi9?(T=!0,P="9"):P="0"+w,p.append(P),n=n.subtract(Dt.valueOf(w)).multiply(Dt.TEN),T&&n.selfAdd(Dt.TEN);var k=!0,B=Dt.magnitude(n._hi);if(B<0&&Math.abs(B)>=u-b&&(k=!1),!k)break}return e[0]=i,p.toString()};Dt.prototype.sqr=function(){return this.multiply(this)};Dt.prototype.doubleValue=function(){return this._hi+this._lo};Dt.prototype.subtract=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};Dt.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};Dt.prototype.isZero=function(){return this._hi===0&&this._lo===0};Dt.prototype.selfSubtract=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};Dt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Dt.prototype.min=function(t){return this.le(t)?this:t};Dt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=null,c=null,p=null,u=null,b=null,w=null,T=null,P=null;return b=this._hi/n,w=Dt.SPLIT*b,a=w-b,P=Dt.SPLIT*n,a=w-a,c=b-a,p=P-n,T=b*n,p=P-p,u=n-p,P=a*p-T+a*u+c*p+c*u,w=(this._hi-T-P+this._lo-b*i)/n,P=b+w,this._hi=P,this._lo=b-P+w,this}};Dt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Dt.prototype.divide=function(){if(arguments[0]instanceof Dt){var t=arguments[0],e=null,n=null,i=null,a=null,c=null,p=null,u=null,b=null;c=this._hi/t._hi,p=Dt.SPLIT*c,e=p-c,b=Dt.SPLIT*t._hi,e=p-e,n=c-e,i=b-t._hi,u=c*t._hi,i=b-i,a=t._hi-i,b=e*i-u+e*a+n*i+n*a,p=(this._hi-u-b+this._lo-c*t._lo)/t._hi,b=c+p;var w=b,T=c-b+p;return new Dt(w,T)}else if(typeof arguments[0]=="number"){var P=arguments[0];return Ve.isNaN(P)?Dt.createNaN():Dt.copy(this).selfDivide(P,0)}};Dt.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};Dt.prototype.pow=function(t){if(t===0)return Dt.valueOf(1);var e=new Dt(this),n=Dt.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(e),i/=2,i>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};Dt.prototype.ceil=function(){if(this.isNaN())return Dt.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Dt(t,e)};Dt.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};Dt.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};Dt.prototype.setValue=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};Dt.prototype.max=function(t){return this.ge(t)?this:t};Dt.prototype.sqrt=function(){if(this.isZero())return Dt.valueOf(0);if(this.isNegative())return Dt.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=Dt.valueOf(e),i=this.subtract(n.sqr()),a=i._hi*(t*.5);return n.add(a)};Dt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,i=null,a=null,c=null,p=null,u=null;return a=this._hi+e,p=a-this._hi,c=a-p,c=e-p+(this._hi-c),u=c+this._lo,n=a+u,i=u+(a-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var b=arguments[0],w=arguments[1],T=null,P=null,k=null,B=null,V=null,tt=null,ot=null,ut=null;V=this._hi+b,k=this._lo+w,ot=V-this._hi,ut=k-this._lo,tt=V-ot,B=k-ut,tt=b-ot+(this._hi-tt),B=w-ut+(this._lo-B),ot=tt+k,T=V+ot,P=ot+(V-T),ot=B+P;var W=T+ot,X=ot+(T-W);return this._hi=W,this._lo=X,this}};Dt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=null,c=null,p=null,u=null,b=null,w=null;b=Dt.SPLIT*this._hi,a=b-this._hi,w=Dt.SPLIT*n,a=b-a,c=this._hi-a,p=w-n,b=this._hi*n,p=w-p,u=n-p,w=a*p-b+a*u+c*p+c*u+(this._hi*i+this._lo*n);var T=b+w;a=b-T;var P=w+a;return this._hi=T,this._lo=P,this}};Dt.prototype.selfSqr=function(){return this.selfMultiply(this)};Dt.prototype.floor=function(){if(this.isNaN())return Dt.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Dt(t,e)};Dt.prototype.negate=function(){return this.isNaN()?this:new Dt(-this._hi,-this._lo)};Dt.prototype.clone=function(){};Dt.prototype.multiply=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return t.isNaN()?Dt.createNaN():Dt.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return Ve.isNaN(e)?Dt.createNaN():Dt.copy(this).selfMultiply(e,0)}};Dt.prototype.isNaN=function(){return Ve.isNaN(this._hi)};Dt.prototype.intValue=function(){return Math.trunc(this._hi)};Dt.prototype.toString=function(){var t=Dt.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};Dt.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,a=n;if(n.charAt(0)===".")a="0"+n;else if(i<0)a="0."+Dt.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var c=i-n.length,p=Dt.stringOfChar("0",c);a=n+p+".0"}return this.isNegative()?"-"+a:a};Dt.prototype.reciprocal=function(){var t=null,e=null,n=null,i=null,a=null,c=null,p=null,u=null;a=1/this._hi,c=Dt.SPLIT*a,t=c-a,u=Dt.SPLIT*this._hi,t=c-t,e=a-t,n=u-this._hi,p=a*this._hi,n=u-n,i=this._hi-n,u=t*n-p+t*i+e*n+e*i,c=(1-p-u-a*this._lo)/this._hi;var b=a+c,w=a-b+c;return new Dt(b,w)};Dt.prototype.toSciNotation=function(){if(this.isZero())return Dt.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=Dt.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var a="";n.length>1&&(a=n.substring(1));var c=n.charAt(0)+"."+a;return this.isNegative()?"-"+c+i:c+i};Dt.prototype.abs=function(){return this.isNaN()?Dt.NaN:this.isNegative()?this.negate():new Dt(this)};Dt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Dt.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};Dt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Dt.prototype.trunc=function(){return this.isNaN()?Dt.NaN:this.isPositive()?this.floor():this.ceil()};Dt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Dt.prototype.interfaces_=function(){return[Qo,Jo,jm]};Dt.prototype.getClass=function(){return Dt};Dt.sqr=function(t){return Dt.valueOf(t).selfMultiply(t)};Dt.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return Dt.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new Dt(e)}};Dt.sqrt=function(t){return Dt.valueOf(t).sqrt()};Dt.parse=function(t){for(var e=0,n=t.length;wf.isWhitespace(t.charAt(e));)e++;var i=!1;if(e=n);){var w=t.charAt(e);if(e++,wf.isDigit(w)){var T=w-"0";c.selfMultiply(Dt.TEN),c.selfAdd(T),p++;continue}if(w==="."){u=p;continue}if(w==="e"||w==="E"){var P=t.substring(e);try{b=Gs.parseInt(P)}catch(ot){throw ot instanceof Error?new Error("Invalid exponent "+P+" in string "+t):ot}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var k=c,B=p-u-b;if(B===0)k=c;else if(B>0){var V=Dt.TEN.pow(B);k=c.divide(V)}else if(B<0){var tt=Dt.TEN.pow(-B);k=c.multiply(tt)}return i?k.negate():k};Dt.createNaN=function(){return new Dt(Ve.NaN,Ve.NaN)};Dt.copy=function(t){return new Dt(t)};Dt.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n)),a=Math.pow(10,i);return a*10<=e&&(i+=1),i};Dt.stringOfChar=function(t,e){for(var n=new $s,i=0;i0){if(c<=0)return Jr.signum(p);i=a+c}else if(a<0){if(c>=0)return Jr.signum(p);i=-a-c}else return Jr.signum(p);var u=Jr.DP_SAFE_EPSILON*i;return p>=u||-p>=u?Jr.signum(p):2};Jr.signum=function(t){return t>0?1:t<0?-1:0};ax.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(Jr,ax);var mn=function(){},Hf={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Hf.X.get=function(){return 0};Hf.Y.get=function(){return 1};Hf.Z.get=function(){return 2};Hf.M.get=function(){return 3};mn.prototype.setOrdinate=function(t,e,n){};mn.prototype.size=function(){};mn.prototype.getOrdinate=function(t,e){};mn.prototype.getCoordinate=function(){};mn.prototype.getCoordinateCopy=function(t){};mn.prototype.getDimension=function(){};mn.prototype.getX=function(t){};mn.prototype.clone=function(){};mn.prototype.expandEnvelope=function(t){};mn.prototype.copy=function(){};mn.prototype.getY=function(t){};mn.prototype.toCoordinateArray=function(){};mn.prototype.interfaces_=function(){return[jm]};mn.prototype.getClass=function(){return mn};Object.defineProperties(mn,Hf);var lx=function(){},Hh=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lx),ur=function(){};ur.arraycopy=function(t,e,n,i,a){for(var c=0,p=e;pt._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}};Se.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Se){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}};Se.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};Se.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Se.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Se.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Se.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Se.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Se.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Se.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Se){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof wt){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}};Se.prototype.centre=function(){return this.isNull()?null:new wt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Se.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof wt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Se){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var a=arguments[0],c=arguments[1],p=arguments[2],u=arguments[3];at._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Se.prototype.hashCode=function(){var t=17;return t=37*t+wt.hashCode(this._minx),t=37*t+wt.hashCode(this._maxx),t=37*t+wt.hashCode(this._miny),t=37*t+wt.hashCode(this._maxy),t};Se.prototype.interfaces_=function(){return[Jo,Qo]};Se.prototype.getClass=function(){return Se};Se.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],p=arguments[3],u=Math.min(c.x,p.x),b=Math.max(c.x,p.x),w=Math.min(i.x,a.x),T=Math.max(i.x,a.x);return!(w>b||Tb)||Tn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};ni.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};ni.prototype.setPrecisionModel=function(t){this._precisionModel=t};ni.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;na?c=i:c=a;else{var p=Math.abs(t.x-e.x),u=Math.abs(t.y-e.y);i>a?c=p:c=u,c===0&&!t.equals(e)&&(c=Math.max(p,u))}return Xe.isTrue(!(c===0&&!t.equals(e)),"Bad distance calculation"),c};ni.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,c=Math.sqrt(i*i+a*a);return Xe.isTrue(!(c===0&&!t.equals(e)),"Invalid distance calculation"),c};hc.DONT_INTERSECT.get=function(){return 0};hc.DO_INTERSECT.get=function(){return 1};hc.COLLINEAR.get=function(){return 2};hc.NO_INTERSECTION.get=function(){return 0};hc.POINT_INTERSECTION.get=function(){return 1};hc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(ni,hc);var gu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var i=new Se(this._inputLines[0][0],this._inputLines[0][1]),a=new Se(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&a.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],a=arguments[2];if(this._isProper=!1,Se.intersects(i,a,n)&&ce.orientationIndex(i,a,n)===0&&ce.orientationIndex(a,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(a))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,i,a,c,p){p.x=this.smallestInAbsValue(n.x,i.x,a.x,c.x),p.y=this.smallestInAbsValue(n.y,i.y,a.y,c.y),n.x-=p.x,n.y-=p.y,i.x-=p.x,i.y-=p.y,a.x-=p.x,a.y-=p.y,c.x-=p.x,c.y-=p.y},e.prototype.safeHCoordinateIntersection=function(n,i,a,c){var p=null;try{p=hs.intersection(n,i,a,c)}catch(u){if(u instanceof Hh)p=e.nearestEndpoint(n,i,a,c);else throw u}finally{}return p},e.prototype.intersection=function(n,i,a,c){var p=this.intersectionWithNormalization(n,i,a,c);return this.isInSegmentEnvelopes(p)||(p=new wt(e.nearestEndpoint(n,i,a,c))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p},e.prototype.smallestInAbsValue=function(n,i,a,c){var p=n,u=Math.abs(p);return Math.abs(i)1e-4&&ur.out.println("Distance = "+p.distance(u))},e.prototype.intersectionWithNormalization=function(n,i,a,c){var p=new wt(n),u=new wt(i),b=new wt(a),w=new wt(c),T=new wt;this.normalizeToEnvCentre(p,u,b,w,T);var P=this.safeHCoordinateIntersection(p,u,b,w);return P.x+=T.x,P.y+=T.y,P},e.prototype.computeCollinearIntersection=function(n,i,a,c){var p=Se.intersects(n,i,a),u=Se.intersects(n,i,c),b=Se.intersects(a,c,n),w=Se.intersects(a,c,i);return p&&u?(this._intPt[0]=a,this._intPt[1]=c,t.COLLINEAR_INTERSECTION):b&&w?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):p&&b?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!u&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):p&&w?(this._intPt[0]=a,this._intPt[1]=i,a.equals(i)&&!u&&!b?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&b?(this._intPt[0]=c,this._intPt[1]=n,c.equals(n)&&!p&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=c,this._intPt[1]=i,c.equals(i)&&!p&&!b?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,i,a,c,p){var u=n.xi.x?n.x:i.x,T=n.y>i.y?n.y:i.y,P=a.xc.x?a.x:c.x,V=a.y>c.y?a.y:c.y,tt=u>P?u:P,ot=wk?b:k,W=T0&&u>0||p<0&&u<0)return t.NO_INTERSECTION;var b=ce.orientationIndex(a,c,n),w=ce.orientationIndex(a,c,i);if(b>0&&w>0||b<0&&w<0)return t.NO_INTERSECTION;var T=p===0&&u===0&&b===0&&w===0;return T?this.computeCollinearIntersection(n,i,a,c):(p===0||u===0||b===0||w===0?(this._isProper=!1,n.equals2D(a)||n.equals2D(c)?this._intPt[0]=n:i.equals2D(a)||i.equals2D(c)?this._intPt[0]=i:p===0?this._intPt[0]=new wt(a):u===0?this._intPt[0]=new wt(c):b===0?this._intPt[0]=new wt(n):w===0&&(this._intPt[0]=new wt(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,a,c)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,i,a,c){var p=n,u=ce.distancePointLine(n,a,c),b=ce.distancePointLine(i,a,c);return b0?n>0?-a:a:n>0?a:-a;if(e===0||n===0)return i>0?t>0?a:-a:t>0?-a:a;if(e>0?i>0?e<=i||(a=-a,c=t,t=n,n=c,c=e,e=i,i=c):e<=-i?(a=-a,n=-n,i=-i):(c=t,t=-n,n=c,c=e,e=-i,i=c):i>0?-e<=i?(a=-a,t=-t,e=-e):(c=-t,t=n,n=c,c=-e,e=i,i=c):e>=i?(t=-t,e=-e,n=-n,i=-i):(a=-a,c=-t,t=-n,n=c,c=-e,e=-i,i=c),t>0)if(n>0){if(!(t<=n))return a}else return a;else{if(n>0)return-a;if(t>=n)a=-a,t=-t,n=-n;else return-a}for(;;){if(p=Math.floor(n/t),n=n-p*t,i=i-p*e,i<0)return-a;if(i>e)return a;if(t>n+n){if(ei+i)return-a;n=t-n,i=e-i,a=-a}if(i===0)return n===0?0:-a;if(n===0||(p=Math.floor(t/n),t=t-p*n,e=e-p*i,e<0))return a;if(e>i)return-a;if(n>t+t){if(ie+e)return a;t=n-t,e=i-e,a=-a}if(e===0)return t===0?0:a;if(t===0)return-a}};var Ns=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Ns.prototype.countSegment=function(t,e){if(t.xi&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var a=t.x-this._p.x,c=t.y-this._p.y,p=e.x-this._p.x,u=e.y-this._p.y,b=Qu.signOfDet2x2(a,c,p,u);if(b===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};Ns.prototype.isPointInPolygon=function(){return this.getLocation()!==Lt.EXTERIOR};Ns.prototype.getLocation=function(){return this._isPointOnSegment?Lt.BOUNDARY:this._crossingCount%2===1?Lt.INTERIOR:Lt.EXTERIOR};Ns.prototype.isOnSegment=function(){return this._isPointOnSegment};Ns.prototype.interfaces_=function(){return[]};Ns.prototype.getClass=function(){return Ns};Ns.locatePointInRing=function(){if(arguments[0]instanceof wt&&Ne(arguments[1],mn)){for(var t=arguments[0],e=arguments[1],n=new Ns(t),i=new wt,a=new wt,c=1;c1||b<0||b>1)&&(a=!0)}}return a?Mo.min(ce.distancePointLine(t,n,i),ce.distancePointLine(e,n,i),ce.distancePointLine(n,t,e),ce.distancePointLine(i,t,e)):0};ce.isPointInRing=function(t,e){return ce.locatePointInRing(t,e)!==Lt.EXTERIOR};ce.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new wt;t.getCoordinate(0,i);for(var a=i.x,c=i.y,p=1;pn.y&&(n=c,i=a)}var p=i;do p=p-1,p<0&&(p=e);while(t[p].equals2D(n)&&p!==i);var u=i;do u=(u+1)%e;while(t[u].equals2D(n)&&u!==i);var b=t[p],w=t[u];if(b.equals2D(n)||w.equals2D(n)||b.equals2D(w))return!1;var T=ce.computeOrientation(b,n,w),P=!1;return T===0?P=b.x>w.x:P=T>0,P};ce.locatePointInRing=function(t,e){return Ns.locatePointInRing(t,e)};ce.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),a=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(a)*Math.sqrt(i)};ce.computeOrientation=function(t,e,n){return ce.orientationIndex(t,e,n)};ce.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Qn("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i=1)return c.distance(u);var T=((p.y-c.y)*(u.x-p.x)-(p.x-c.x)*(u.y-p.y))/b;return Math.abs(T)*Math.sqrt(b)}};ce.isOnLine=function(t,e){for(var n=new gu,i=1;i0};Ih.prototype.interfaces_=function(){return[Xo]};Ih.prototype.getClass=function(){return Ih};var Eh=function(){};Eh.prototype.isInBoundary=function(t){return t>1};Eh.prototype.interfaces_=function(){return[Xo]};Eh.prototype.getClass=function(){return Eh};var Sh=function(){};Sh.prototype.isInBoundary=function(t){return t===1};Sh.prototype.interfaces_=function(){return[Xo]};Sh.prototype.getClass=function(){return Sh};var Pi=function(){};Pi.prototype.add=function(){};Pi.prototype.addAll=function(){};Pi.prototype.isEmpty=function(){};Pi.prototype.iterator=function(){};Pi.prototype.size=function(){};Pi.prototype.toArray=function(){};Pi.prototype.remove=function(){};function ty(t){this.message=t||""}ty.prototype=new Error;ty.prototype.name="IndexOutOfBoundsException";var Xh=function(){};Xh.prototype.hasNext=function(){};Xh.prototype.next=function(){};Xh.prototype.remove=function(){};var ps=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Pi);function Yh(t){this.message=t||""}Yh.prototype=new Error;Yh.prototype.name="NoSuchElementException";var te=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Pi&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Pi]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var i=this,a=n.iterator();a.hasNext();)i.add(a.next());return!0},e.prototype.set=function(n,i){var a=this.array_[n];return this.array_[n]=i,a},e.prototype.iterator=function(){return new HE(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new ty;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,i=[],a=0,c=this.array_.length;a=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}t.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var T=arguments[0],P=arguments[1];return this.add(T,P),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var k=arguments[0],B=arguments[1],V=arguments[2];if(V)for(var tt=0;tt=0;ot--)i.add(k[ot],B);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof wt){var ut=arguments[0],W=arguments[1],X=arguments[2];if(!X){var J=this.size();if(J>0){if(ut>0){var ht=this.get(ut-1);if(ht.equals2D(W))return null}if(utFt&&(mt=-1);for(var Ct=It;Ct!==Ft;Ct+=mt)i.add(gt[Ct],St);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new wt(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(te),rn=function(){},Wm={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Wm.ForwardComparator.get=function(){return If};Wm.BidirectionalComparator.get=function(){return Ch};Wm.coordArrayType.get=function(){return new Array(0).fill(null)};rn.prototype.interfaces_=function(){return[]};rn.prototype.getClass=function(){return rn};rn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};rn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};rn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};rn.extract=function(t,e,n){e=Mo.clamp(e,0,t.length),n=Mo.clamp(n,-1,t.length);var i=n-e+1;n<0&&(i=0),e>=t.length&&(i=0),ni.length)return 1;if(n.length===0)return 0;var a=rn.compare(n,i),c=rn.isEqualReversed(n,i);return c?0:a};Ch.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.lengthi.length)return 1;if(n.length===0)return 0;for(var a=rn.increasingDirection(n),c=rn.increasingDirection(i),p=a>0?0:n.length-1,u=c>0?0:n.length-1,b=0;b0)e=e.right;else return e.value}return null};yr.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Fa,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,i,a;do if(i=n,a=t.compareTo(n.key),a<0)n=n.left;else if(a>0)n=n.right;else{var c=n.value;return n.value=e,c}while(n!==null);var p={key:t,left:null,right:null,value:e,parent:i,color:Fa,getValue:function(){return this.value},getKey:function(){return this.key}};return a<0?i.left=p:i.right=p,this.fixAfterInsertion(p),this.size_++,null};yr.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=tu;t!=null&&t!==this.root_&&t.parent.color===tu;)if(Fn(t)===p_(Fn(Fn(t)))){var n=wv(Fn(Fn(t)));bv(n)===tu?(Da(Fn(t),Fa),Da(n,Fa),Da(Fn(Fn(t)),tu),t=Fn(Fn(t))):(t===wv(Fn(t))&&(t=Fn(t),e.rotateLeft(t)),Da(Fn(t),Fa),Da(Fn(Fn(t)),tu),e.rotateRight(Fn(Fn(t))))}else{var i=p_(Fn(Fn(t)));bv(i)===tu?(Da(Fn(t),Fa),Da(i,Fa),Da(Fn(Fn(t)),tu),t=Fn(Fn(t))):(t===p_(Fn(t))&&(t=Fn(t),e.rotateRight(t)),Da(Fn(t),Fa),Da(Fn(Fn(t)),tu),e.rotateLeft(Fn(Fn(t))))}this.root_.color=Fa};yr.prototype.values=function(){var t=new te,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=yr.successor(e))!==null;)t.add(e.value);return t};yr.prototype.entrySet=function(){var t=new ey,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=yr.successor(e))!==null;)t.add(e);return t};yr.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};yr.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};yr.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};yr.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,i=t;n!==null&&i===n.right;)i=n,n=n.parent;return n}};yr.prototype.size=function(){return this.size_};var Ef=function(){};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};function cx(){}cx.prototype=new Hm;function qs(){this.array_=[],arguments[0]instanceof Pi&&this.addAll(arguments[0])}qs.prototype=new cx;qs.prototype.contains=function(t){for(var e=this,n=0,i=this.array_.length;n=0;){var p=a.substring(0,c);i.add(p),a=a.substring(c+n),c=a.indexOf(e)}a.length>0&&i.add(a);for(var u=new Array(i.size()).fill(null),b=0;b0)for(var c=a;c0&&i.append(" ");for(var c=0;c0&&i.append(","),i.append(jo.toString(t.getOrdinate(a,c)))}return i.append(")"),i.toString()}};gi.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return gi.createClosedRing(t,e,4);var i=e.getOrdinate(0,mn.X)===e.getOrdinate(n-1,mn.X)&&e.getOrdinate(0,mn.Y)===e.getOrdinate(n-1,mn.Y);return i?e:gi.createClosedRing(t,e,n+1)};gi.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),a=e.size();gi.copy(e,0,i,0,a);for(var c=a;c0&&gi.reverse(i._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?vn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return ce.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var i=this._points.copy();gi.reverse(i);var a=this.getFactory().createLineString(i);return a},e.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var a=arguments[0],c=a,p=0,u=0;p= 2)");this._points=i},e.prototype.isCoordinate=function(i){for(var a=this,c=0;c=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(ai),ha=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return De.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.isEquivalentClass(i)?t.prototype.equalsExact.call(this,i,a):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var i=this,a=this._geometries.length,c=new Array(a).fill(null),p=0;p0?e.createPoint(n[0]):e.createPoint():t};Tf.prototype.interfaces_=function(){return[Yo.GeometryEditorOperation]};Tf.prototype.getClass=function(){return Tf};var Lf=function(){};Lf.prototype.edit=function(t,e){return t instanceof da?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof ai?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof mo?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Lf.prototype.interfaces_=function(){return[Yo.GeometryEditorOperation]};Lf.prototype.getClass=function(){return Lf};var di=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new $s(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(i=3),i<2?new di(n):new di(n,i)}};ma.prototype.interfaces_=function(){return[bh,Qo]};ma.prototype.getClass=function(){return ma};ma.instance=function(){return ma.instanceObject};iy.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};iy.instanceObject.get=function(){return new ma};Object.defineProperties(ma,iy);var px=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,i){return this.map_.set(n,i),i},e.prototype.values=function(){for(var n=new te,i=this.map_.values(),a=i.next();!a.done;)n.add(a.value),a=i.next();return n},e.prototype.entrySet=function(){var n=new ey;return this.map_.entries().forEach(function(i){return n.add(i)}),n},e.prototype.size=function(){return this.map_.size()},e}(fc),bn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Zs){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}},ry={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};bn.prototype.equals=function(t){if(!(t instanceof bn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};bn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new Gs(n).compareTo(new Gs(i))};bn.prototype.getScale=function(){return this._scale};bn.prototype.isFloating=function(){return this._modelType===bn.FLOATING||this._modelType===bn.FLOATING_SINGLE};bn.prototype.getType=function(){return this._modelType};bn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===bn.FLOATING?t="Floating":this._modelType===bn.FLOATING_SINGLE?t="Floating-Single":this._modelType===bn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};bn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Ve.isNaN(t))return t;if(this._modelType===bn.FLOATING_SINGLE){var e=t;return e}return this._modelType===bn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof wt){var n=arguments[0];if(this._modelType===bn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};bn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===bn.FLOATING?t=16:this._modelType===bn.FLOATING_SINGLE?t=6:this._modelType===bn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};bn.prototype.setScale=function(t){this._scale=Math.abs(t)};bn.prototype.interfaces_=function(){return[Qo,Jo]};bn.prototype.getClass=function(){return bn};bn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};ry.serialVersionUID.get=function(){return 7777263578777804e3};ry.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(bn,ry);var Zs=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},oy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Zs.prototype.readResolve=function(){return Zs.nameToTypeMap.get(this._name)};Zs.prototype.toString=function(){return this._name};Zs.prototype.interfaces_=function(){return[Qo]};Zs.prototype.getClass=function(){return Zs};oy.serialVersionUID.get=function(){return-552860263173159e4};oy.nameToTypeMap.get=function(){return new px};Object.defineProperties(Zs,oy);bn.Type=Zs;bn.FIXED=new Zs("FIXED");bn.FLOATING=new Zs("FLOATING");bn.FLOATING_SINGLE=new Zs("FLOATING SINGLE");var tn=function t(){this._precisionModel=new bn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ne(arguments[0],bh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof bn&&(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]))},fx={serialVersionUID:{configurable:!0}};tn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new wt(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new wt(t.getMinX(),t.getMinY()),new wt(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new wt(t.getMinX(),t.getMinY()),new wt(t.getMinX(),t.getMaxY()),new wt(t.getMaxX(),t.getMaxY()),new wt(t.getMaxX(),t.getMinY()),new wt(t.getMinX(),t.getMinY())]),null)};tn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new ai(this.getCoordinateSequenceFactory().create(t),this);if(Ne(t,mn))return new ai(t,this)}else return new ai(this.getCoordinateSequenceFactory().create([]),this)};tn.prototype.createMultiLineString=function(){if(arguments.length===0)return new au(null,this);if(arguments.length===1){var t=arguments[0];return new au(t,this)}};tn.prototype.buildGeometry=function(t){for(var e=null,n=!1,i=!1,a=t.iterator();a.hasNext();){var c=a.next(),p=c.getClass();e===null&&(e=p),p!==e&&(n=!0),c.isGeometryCollectionOrDerived()&&(i=!0)}if(e===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(tn.toGeometryArray(t));var u=t.iterator().next(),b=t.size()>1;if(b){if(u instanceof Di)return this.createMultiPolygon(tn.toPolygonArray(t));if(u instanceof ai)return this.createMultiLineString(tn.toLineStringArray(t));if(u instanceof mo)return this.createMultiPoint(tn.toPointArray(t));Xe.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};tn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};tn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof wt){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Ne(arguments[0],mn)){var e=arguments[0];return new mo(e,this)}}};tn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};tn.prototype.createPolygon=function(){if(arguments.length===0)return new Di(null,null,this);if(arguments.length===1){if(Ne(arguments[0],mn)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof da){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return new Di(i,a,this)}};tn.prototype.getSRID=function(){return this._SRID};tn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Nr(null,this);if(arguments.length===1){var t=arguments[0];return new Nr(t,this)}};tn.prototype.createGeometry=function(t){var e=new Yo(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};tn.prototype.getPrecisionModel=function(){return this._precisionModel};tn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ne(arguments[0],mn)){var e=arguments[0];return new da(e,this)}}};tn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ha(null,this);if(arguments.length===1){var t=arguments[0];return new ha(t,this)}};tn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Th(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Th(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ne(arguments[0],mn)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var a=new Array(i.size()).fill(null),c=0;c=this.size())throw new Error;return this.array_[t]};ta.prototype.push=function(t){return this.array_.push(t),t};ta.prototype.pop=function(t){if(this.array_.length===0)throw new Qm;return this.array_.pop()};ta.prototype.peek=function(){if(this.array_.length===0)throw new Qm;return this.array_[this.array_.length-1]};ta.prototype.empty=function(){return this.array_.length===0};ta.prototype.isEmpty=function(){return this.empty()};ta.prototype.search=function(t){return this.array_.indexOf(t)};ta.prototype.size=function(){return this.array_.length};ta.prototype.toArray=function(){for(var t=this,e=[],n=0,i=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===ce.CLOCKWISE)&&(a=!0),a&&(this._minIndex=this._minIndex-1)};Ws.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),i=n.getCoordinates();if(e<0||e+1>=i.length||i[e].y===i[e+1].y)return-1;var a=Xt.LEFT;return i[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=i,e._minCoord=n[i])};Ws.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};Ws.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&e.checkForRightmostCoordinate(i)}Xe.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 a=this.getRightmostSide(this._minDe,this._minIndex);a===Xt.LEFT&&(this._orientedDe=this._minDe.getSym())};Ws.prototype.interfaces_=function(){return[]};Ws.prototype.getClass=function(){return Ws};var Za=function(t){function e(n,i){t.call(this,e.msgWithCoord(n,i)),this.pt=i?new wt(i):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},e}(qa),$m=function(){this.array_=[]};$m.prototype.addLast=function(t){this.array_.push(t)};$m.prototype.removeFirst=function(){return this.array_.shift()};$m.prototype.isEmpty=function(){return this.array_.length===0};var zr=function(){this._finder=null,this._dirEdgeList=new te,this._nodes=new te,this._rightMostCoord=null,this._env=null,this._finder=new Ws};zr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};zr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};zr.prototype.computeNodeDepth=function(t){for(var e=this,n=null,i=t.getEdges().iterator();i.hasNext();){var a=i.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Za("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var c=t.getEdges().iterator();c.hasNext();){var p=c.next();p.setVisited(!0),e.copySymDepths(p)}};zr.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Xt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};zr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};zr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Xt.RIGHT)>=1&&e.getDepth(Xt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};zr.prototype.computeDepths=function(t){var e=this,n=new ey,i=new $m,a=t.getNode();for(i.addLast(a),n.add(a),t.setVisited(!0);!i.isEmpty();){var c=i.removeFirst();n.add(c),e.computeNodeDepth(c);for(var p=c.getEdges().iterator();p.hasNext();){var u=p.next(),b=u.getSym();if(!b.isVisited()){var w=b.getNode();n.contains(w)||(i.addLast(w),n.add(w))}}}};zr.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};zr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Se,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),i=n.getEdge().getCoordinates(),a=0;athis.location.length){var n=new Array(3).fill(null);n[Xt.ON]=this.location[Xt.ON],n[Xt.LEFT]=Lt.NONE,n[Xt.RIGHT]=Lt.NONE,this.location=n}for(var i=0;i1&&t.append(Lt.toLocationSymbol(this.location[Xt.LEFT])),t.append(Lt.toLocationSymbol(this.location[Xt.ON])),this.location.length>1&&t.append(Lt.toLocationSymbol(this.location[Xt.RIGHT])),t.toString()};Bn.prototype.setLocations=function(t,e,n){this.location[Xt.ON]=t,this.location[Xt.LEFT]=e,this.location[Xt.RIGHT]=n};Bn.prototype.get=function(t){return t1};Bn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=i),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};wi.prototype.addPoints=function(t,e,n){var i=this,a=t.getCoordinates();if(e){var c=1;n&&(c=0);for(var p=c;p=0;b--)i._pts.add(a[b])}};wi.prototype.isHole=function(){return this._isHole};wi.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};wi.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!ce.isPointInRing(t,e.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var a=i.next();if(a.containsPoint(t))return!1}return!0};wi.prototype.addHole=function(t){this._holes.add(t)};wi.prototype.isShell=function(){return this._shell===null};wi.prototype.getLabel=function(){return this._label};wi.prototype.getEdges=function(){return this._edges};wi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};wi.prototype.getShell=function(){return this._shell};wi.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=e.getLocation(n,Xt.RIGHT);if(i===Lt.NONE)return null;if(this._label.getLocation(n)===Lt.NONE)return this._label.setLocation(n,i),null}};wi.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};wi.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(t)};Ao.prototype.isInResult=function(){return this._isInResult};Ao.prototype.isVisited=function(){return this._isVisited};Ao.prototype.interfaces_=function(){return[]};Ao.prototype.getClass=function(){return Ao};var tg=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new Sn(0,Lt.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,i){var a=Lt.NONE;if(a=this._label.getLocation(i),!n.isNull(i)){var c=n.getLocation(i);a!==Lt.BOUNDARY&&(a=c)}return a},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new Sn(n,i):this._label.setLocation(n,i)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Sn)for(var a=arguments[0],c=0;c<2;c++){var p=n.computeMergedLocation(a,c),u=n._label.getLocation(c);u===Lt.NONE&&n._label.setLocation(c,p)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=Lt.NONE;this._label!==null&&(i=this._label.getLocation(n));var a=null;switch(i){case Lt.BOUNDARY:a=Lt.INTERIOR;break;case Lt.INTERIOR:a=Lt.BOUNDARY;break;default:a=Lt.BOUNDARY;break}this._label.setLocation(n,a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ao),Hs=function(){this.nodeMap=new yr,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Hs.prototype.find=function(t){return this.nodeMap.get(t)};Hs.prototype.addNode=function(){if(arguments[0]instanceof wt){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof tg){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}};Hs.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Hs.prototype.iterator=function(){return this.nodeMap.values().iterator()};Hs.prototype.values=function(){return this.nodeMap.values()};Hs.prototype.getBoundaryNodes=function(t){for(var e=new te,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===Lt.BOUNDARY&&e.add(i)}return e};Hs.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};Hs.prototype.interfaces_=function(){return[]};Hs.prototype.getClass=function(){return Hs};var Ln=function(){},Kf={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.isNorthern=function(t){return t===Ln.NE||t===Ln.NW};Ln.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Ln.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var i=te?t:e;return i===0&&a===3?3:i};Ln.isInHalfPlane=function(t,e){return e===Ln.SE?t===Ln.SE||t===Ln.SW:t===e||t===e+1};Ln.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Qn("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Ln.NE:Ln.SE:e>=0?Ln.NW:Ln.SW}else if(arguments[0]instanceof wt&&arguments[1]instanceof wt){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new Qn("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Ln.NE:Ln.SE:i.y>=n.y?Ln.NW:Ln.SW}};Kf.NE.get=function(){return 0};Kf.NW.get=function(){return 1};Kf.SW.get=function(){return 2};Kf.SE.get=function(){return 3};Object.defineProperties(Ln,Kf);var vr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],a=null;this._edge=e,this.init(n,i),this._label=a}else if(arguments.length===4){var c=arguments[0],p=arguments[1],u=arguments[2],b=arguments[3];this._edge=c,this.init(p,u),this._label=b}};vr.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){p.linkDirectedEdgesForMinimalEdgeRings();var u=p.buildMinimalRings(),b=i.findShell(u);b!==null?(i.placePolygonHoles(b,u),e.add(b)):n.addAll(u)}else a.add(p)}return a};go.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};go.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new te,i=t.iterator();i.hasNext();){var a=i.next();if(a.isInResult()&&a.getLabel().isArea()&&a.getEdgeRing()===null){var c=new rS(a,e._geometryFactory);n.add(c),c.setInResult()}}return n};go.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}};go.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};go.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),a=n.getCoordinateN(0),c=null,p=null,u=e.iterator();u.hasNext();){var b=u.next(),w=b.getLinearRing(),T=w.getEnvelopeInternal();c!==null&&(p=c.getLinearRing().getEnvelopeInternal());var P=!1;T.contains(i)&&ce.isPointInRing(a,w.getCoordinates())&&(P=!0),P&&(c===null||p.contains(T))&&(c=b)}return c};go.prototype.findShell=function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var a=i.next();a.isHole()||(n=a,e++)}return Xe.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};go.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];ii.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),a=new te,c=this.buildMinimalEdgeRings(i,this._shellList,a);this.sortShellsAndHoles(c,this._shellList,a),this.placeFreeHoles(this._shellList,a)}};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};var Ph=function(){};Ph.prototype.getBounds=function(){};Ph.prototype.interfaces_=function(){return[]};Ph.prototype.getClass=function(){return Ph};var ms=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};ms.prototype.getItem=function(){return this._item};ms.prototype.getBounds=function(){return this._bounds};ms.prototype.interfaces_=function(){return[Ph,Qo]};ms.prototype.getClass=function(){return ms};var Wa=function(){this._size=null,this._items=null,this._size=0,this._items=new te,this._items.add(null)};Wa.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};Wa.prototype.size=function(){return this._size};Wa.prototype.reorder=function(t){for(var e=this,n=null,i=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(i)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,i)};Wa.prototype.clear=function(){this._size=0,this._items.clear()};Wa.prototype.isEmpty=function(){return this._size===0};Wa.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)};Wa.prototype.interfaces_=function(){return[]};Wa.prototype.getClass=function(){return Wa};var Sl=function(){};Sl.prototype.visitItem=function(t){};Sl.prototype.interfaces_=function(){return[]};Sl.prototype.getClass=function(){return Sl};var $u=function(){};$u.prototype.insert=function(t,e){};$u.prototype.remove=function(t,e){};$u.prototype.query=function(){};$u.prototype.interfaces_=function(){return[]};$u.prototype.getClass=function(){return $u};var ki=function(){if(this._childBoundables=new te,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},mx={serialVersionUID:{configurable:!0}};ki.prototype.getLevel=function(){return this._level};ki.prototype.size=function(){return this._childBoundables.size()};ki.prototype.getChildBoundables=function(){return this._childBoundables};ki.prototype.addChildBoundable=function(t){Xe.isTrue(this._bounds===null),this._childBoundables.add(t)};ki.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};ki.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};ki.prototype.interfaces_=function(){return[Ph,Qo]};ki.prototype.getClass=function(){return ki};mx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(ki,mx);var gs=function(){};gs.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};gs.min=function(t){return gs.sort(t),t.get(0)};gs.sort=function(t,e){var n=t.toArray();e?ru.sort(n,e):ru.sort(n);for(var i=t.iterator(),a=0,c=n.length;axi.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Qn("neither boundable is composite")};xi.prototype.isLeaves=function(){return!(xi.isComposite(this._boundable1)||xi.isComposite(this._boundable2))};xi.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};xi.prototype.expand=function(t,e,n,i){for(var a=this,c=t.getChildBoundables(),p=c.iterator();p.hasNext();){var u=p.next(),b=new xi(u,e,a._itemDistance);b.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},eg={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Qi.prototype.getNodeCapacity=function(){return this._nodeCapacity};Qi.prototype.lastNode=function(t){return t.get(t.size()-1)};Qi.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,i=e.getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof ki?n+=t.size(a):a instanceof ms&&(n+=1)}return n}};Qi.prototype.removeItem=function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof ms&&a.getItem()===e&&(n=a)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};Qi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new te:e}else if(arguments.length===1){for(var n=arguments[0],i=new te,a=n.getChildBoundables().iterator();a.hasNext();){var c=a.next();if(c instanceof ki){var p=t.itemsTree(c);p!==null&&i.add(p)}else c instanceof ms?i.add(c.getItem()):Xe.shouldNeverReachHere()}return i.size()<=0?null:i}};Qi.prototype.insert=function(t,e){Xe.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ms(t,e))};Qi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new te;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];if(Xe.isTrue(i>-2),a.getLevel()===i)return c.add(a),null;for(var p=a.getChildBoundables().iterator();p.hasNext();){var u=p.next();u instanceof ki?t.boundablesAtLevel(i,u,c):(Xe.isTrue(u instanceof ms),i===-1&&c.add(u))}return null}};Qi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new te;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,a)}else if(arguments.length===3){if(Ne(arguments[2],Sl)&&arguments[0]instanceof Object&&arguments[1]instanceof ki)for(var c=arguments[0],p=arguments[1],u=arguments[2],b=p.getChildBoundables(),w=0;wn&&(n=c)}}return n+1}};Qi.prototype.createParentBoundables=function(t,e){var n=this;Xe.isTrue(!t.isEmpty());var i=new te;i.add(this.createNode(e));var a=new te(t);gs.sort(a,this.getComparator());for(var c=a.iterator();c.hasNext();){var p=c.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(e)),n.lastNode(i).addChildBoundable(p)}return i};Qi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Qi.prototype.interfaces_=function(){return[Qo]};Qi.prototype.getClass=function(){return Qi};Qi.compareDoubles=function(t,e){return t>e?1:t0);for(var p=new te,u=0;u0;){var V=B.poll(),tt=V.getDistance();if(tt>=P)break;V.isLeaves()?(P=tt,k=V):V.expandToQueue(B,P)}return[k.getBoundable(0).getItem(),k.getBoundable(1).getItem()]}}else if(arguments.length===3){var ot=arguments[0],ut=arguments[1],W=arguments[2],X=new ms(ot,ut),J=new xi(this.getRoot(),X,W);return this.nearestNeighbour(J)[0]}},e.prototype.interfaces_=function(){return[$u,Qo]},e.prototype.getClass=function(){return e},e.centreX=function(i){return e.avg(i.getMinX(),i.getMaxX())},e.avg=function(i,a){return(i+a)/2},e.centreY=function(i){return e.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return Iv},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[xh]},compare:function(i,a){return t.compareDoubles(e.centreX(i.getBounds()),e.centreX(a.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[xh]},compare:function(i,a){return t.compareDoubles(e.centreY(i.getBounds()),e.centreY(a.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(i,a){return i.intersects(a)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Qi),Iv=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var a=i.next();n===null?n=new Se(a.getBounds()):n.expandToInclude(a.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ki),Kr=function(){};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};Kr.relativeSign=function(t,e){return te?1:0};Kr.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=Kr.relativeSign(e.x,n.x),a=Kr.relativeSign(e.y,n.y);switch(t){case 0:return Kr.compareValue(i,a);case 1:return Kr.compareValue(a,i);case 2:return Kr.compareValue(a,-i);case 3:return Kr.compareValue(-i,a);case 4:return Kr.compareValue(-i,-a);case 5:return Kr.compareValue(-a,-i);case 6:return Kr.compareValue(-a,i);case 7:return Kr.compareValue(i,-a)}return Xe.shouldNeverReachHere("invalid octant value"),0};Kr.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Cl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new wt(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))};Cl.prototype.getCoordinate=function(){return this.coord};Cl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Cl.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:Kr.compare(this._segmentOctant,this.coord,e.coord)};Cl.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Cl.prototype.isInterior=function(){return this._isInterior};Cl.prototype.interfaces_=function(){return[Jo]};Cl.prototype.getClass=function(){return Cl};var Or=function(){this._nodeMap=new yr,this._edge=null;var t=arguments[0];this._edge=t};Or.prototype.getSplitCoordinates=function(){var t=this,e=new Xf;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next();t.addEdgeCoordinates(i,a,e),i=a}return e.toCoordinateArray()};Or.prototype.addCollapsedNodes=function(){var t=this,e=new te;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var i=n.next().intValue();t.add(t._edge.getCoordinate(i),i)}};Or.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Or.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof wt&&arguments[1]instanceof wt){var a=arguments[0],c=arguments[1],p=c.x-a.x,u=c.y-a.y;if(p===0&&u===0)throw new Qn("Cannot compute the octant for two identical points "+a);return tc.octant(p,u)}};var ga=function(){};ga.prototype.getCoordinates=function(){};ga.prototype.size=function(){};ga.prototype.getCoordinate=function(t){};ga.prototype.isClosed=function(){};ga.prototype.setData=function(t){};ga.prototype.getData=function(){};ga.prototype.interfaces_=function(){return[]};ga.prototype.getClass=function(){return ga};var Pf=function(){};Pf.prototype.addIntersection=function(t,e){};Pf.prototype.interfaces_=function(){return[ga]};Pf.prototype.getClass=function(){return Pf};var _i=function(){this._nodeList=new Or(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};_i.prototype.getCoordinates=function(){return this._pts};_i.prototype.size=function(){return this._pts.length};_i.prototype.getCoordinate=function(t){return this._pts[t]};_i.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};_i.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};_i.prototype.setData=function(t){this._data=t};_i.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:tc.octant(t,e)};_i.prototype.getData=function(){return this._data};_i.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],a=arguments[3],c=new wt(n.getIntersection(a));this.addIntersection(c,i)}};_i.prototype.toString=function(){return fs.toLineString(new di(this._pts))};_i.prototype.getNodeList=function(){return this._nodeList};_i.prototype.addIntersectionNode=function(t,e){var n=e,i=n+1;if(i=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof wt){var i=arguments[0];return ce.orientationIndex(this.p0,this.p1,i)}};Ce.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Ce.prototype.isVertical=function(){return this.p0.x===this.p1.x};Ce.prototype.equals=function(t){if(!(t instanceof Ce))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Ce.prototype.intersection=function(t){var e=new gu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Ce.prototype.project=function(){if(arguments[0]instanceof wt){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new wt(t);var e=this.projectionFactor(t),n=new wt;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Ce){var i=arguments[0],a=this.projectionFactor(i.p0),c=this.projectionFactor(i.p1);if(a>=1&&c>=1||a<=0&&c<=0)return null;var p=this.project(i.p0);a<0&&(p=this.p0),a>1&&(p=this.p1);var u=this.project(i.p1);return c<0&&(u=this.p0),c>1&&(u=this.p1),new Ce(p,u)}};Ce.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Ce.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Ce.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Ce.prototype.distancePerpendicular=function(t){return ce.distancePointLinePerpendicular(t,this.p0,this.p1)};Ce.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Ce.prototype.midPoint=function(){return Ce.midPoint(this.p0,this.p1)};Ce.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;if(i<=0)return Ve.NaN;var a=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i;return a};Ce.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),i=Ve.MAX_VALUE,a=null,c=this.closestPoint(t.p0);i=c.distance(t.p0),n[0]=c,n[1]=t.p0;var p=this.closestPoint(t.p1);a=p.distance(t.p1),a0&&e<1)return this.project(t);var n=this.p0.distance(t),i=this.p1.distance(t);return n1||Ve.isNaN(e))&&(e=1),e};Ce.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Ce.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Ce.prototype.distance=function(){if(arguments[0]instanceof Ce){var t=arguments[0];return ce.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof wt){var e=arguments[0];return ce.distancePointLine(e,this.p0,this.p1)}};Ce.prototype.pointAlong=function(t){var e=new wt;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};Ce.prototype.hashCode=function(){var t=Ve.doubleToLongBits(this.p0.x);t^=Ve.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Ve.doubleToLongBits(this.p1.x);n^=Ve.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return e^i};Ce.prototype.interfaces_=function(){return[Jo,Qo]};Ce.prototype.getClass=function(){return Ce};Ce.midPoint=function(t,e){return new wt((t.x+e.x)/2,(t.y+e.y)/2)};_x.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Ce,_x);var Mf=function(){this.tempEnv1=new Se,this.tempEnv2=new Se,this._overlapSeg1=new Ce,this._overlapSeg2=new Ce};Mf.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Mf.prototype.interfaces_=function(){return[]};Mf.prototype.getClass=function(){return Mf};var _o=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i};_o.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};_o.prototype.computeSelect=function(t,e,n,i){var a=this._pts[e],c=this._pts[n];if(i.tempEnv1.init(a,c),n-e===1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var p=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var i=Ln.quadrant(t[n],t[n+1]),a=e+1;ap.getId()&&(p.computeOverlaps(w,a),i._nOverlaps++),i._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return Ev},Object.defineProperties(e,n),e}(Af),Ev=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3],p=n.getContext(),u=a.getContext();this._si.processIntersections(p,i,u,c)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Mf),xn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(arguments.length===4){var a=arguments[0],c=arguments[1],p=arguments[2],u=arguments[3];this.setQuadrantSegments(a),this.setEndCapStyle(c),this.setJoinStyle(p),this.setMitreLimit(u)}}},Ka={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}};xn.prototype.getEndCapStyle=function(){return this._endCapStyle};xn.prototype.isSingleSided=function(){return this._isSingleSided};xn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=xn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=xn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==xn.JOIN_ROUND&&(this._quadrantSegments=xn.DEFAULT_QUADRANT_SEGMENTS)};xn.prototype.getJoinStyle=function(){return this._joinStyle};xn.prototype.setJoinStyle=function(t){this._joinStyle=t};xn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};xn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};xn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};xn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};xn.prototype.getMitreLimit=function(){return this._mitreLimit};xn.prototype.setMitreLimit=function(t){this._mitreLimit=t};xn.prototype.setSingleSided=function(t){this._isSingleSided=t};xn.prototype.interfaces_=function(){return[]};xn.prototype.getClass=function(){return xn};xn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Ka.CAP_ROUND.get=function(){return 1};Ka.CAP_FLAT.get=function(){return 2};Ka.CAP_SQUARE.get=function(){return 3};Ka.JOIN_ROUND.get=function(){return 1};Ka.JOIN_MITRE.get=function(){return 2};Ka.JOIN_BEVEL.get=function(){return 3};Ka.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Ka.DEFAULT_MITRE_LIMIT.get=function(){return 5};Ka.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(xn,Ka);var li=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ce.COUNTERCLOCKWISE,this._inputLine=t||null},Jf={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};li.prototype.isDeletable=function(t,e,n,i){var a=this._inputLine[t],c=this._inputLine[e],p=this._inputLine[n];return!this.isConcave(a,c,p)||!this.isShallow(a,c,p,i)?!1:this.isShallowSampled(a,c,t,n,i)};li.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),i=this.findNextNonDeletedIndex(n),a=!1;i=0;a--)n.addPt(t[a])};ko.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=pn.PI_TIMES_2;for(;t<=-Math.PI;)t+=pn.PI_TIMES_2;return t};pn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=n.x-e.x,a=n.y-e.y;return Math.atan2(a,i)}};pn.isAcute=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,c=n.x-e.x,p=n.y-e.y,u=i*c+a*p;return u>0};pn.isObtuse=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,c=n.x-e.x,p=n.y-e.y,u=i*c+a*p;return u<0};pn.interiorAngle=function(t,e,n){var i=pn.angle(e,t),a=pn.angle(e,n);return Math.abs(a-i)};pn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=pn.PI_TIMES_2;t>=pn.PI_TIMES_2&&(t=0)}else{for(;t>=pn.PI_TIMES_2;)t-=pn.PI_TIMES_2;t<0&&(t=0)}return t};pn.angleBetween=function(t,e,n){var i=pn.angle(e,t),a=pn.angle(e,n);return pn.diff(i,a)};pn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};pn.toRadians=function(t){return t*Math.PI/180};pn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?pn.COUNTERCLOCKWISE:n<0?pn.CLOCKWISE:pn.NONE};pn.angleBetweenOriented=function(t,e,n){var i=pn.angle(e,t),a=pn.angle(e,n),c=a-i;return c<=-Math.PI?c+pn.PI_TIMES_2:c>Math.PI?c-pn.PI_TIMES_2:c};dc.PI_TIMES_2.get=function(){return 2*Math.PI};dc.PI_OVER_2.get=function(){return Math.PI/2};dc.PI_OVER_4.get=function(){return Math.PI/4};dc.COUNTERCLOCKWISE.get=function(){return ce.COUNTERCLOCKWISE};dc.CLOCKWISE.get=function(){return ce.CLOCKWISE};dc.NONE.get=function(){return ce.COLLINEAR};Object.defineProperties(pn,dc);var jn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Ce,this._seg1=new Ce,this._offset0=new Ce,this._offset1=new Ce,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new gu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===xn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},Qf={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}};jn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ce.computeOrientation(this._s0,this._s1,this._s2),i=n===ce.CLOCKWISE&&this._side===Xt.LEFT||n===ce.COUNTERCLOCKWISE&&this._side===Xt.RIGHT;n===0?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};jn.prototype.addLineEndCap=function(t,e){var n=new Ce(t,e),i=new Ce;this.computeOffsetSegment(n,Xt.LEFT,this._distance,i);var a=new Ce;this.computeOffsetSegment(n,Xt.RIGHT,this._distance,a);var c=e.x-t.x,p=e.y-t.y,u=Math.atan2(p,c);switch(this._bufParams.getEndCapStyle()){case xn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(e,u+Math.PI/2,u-Math.PI/2,ce.CLOCKWISE,this._distance),this._segList.addPt(a.p1);break;case xn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(a.p1);break;case xn.CAP_SQUARE:var b=new wt;b.x=Math.abs(this._distance)*Math.cos(u),b.y=Math.abs(this._distance)*Math.sin(u);var w=new wt(i.p1.x+b.x,i.p1.y+b.y),T=new wt(a.p1.x+b.x,a.p1.y+b.y);this._segList.addPt(w),this._segList.addPt(T);break}};jn.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};jn.prototype.addMitreJoin=function(t,e,n,i){var a=!0,c=null;try{c=hs.intersection(e.p0,e.p1,n.p0,n.p1);var p=i<=0?1:c.distance(t)/Math.abs(i);p>this._bufParams.getMitreLimit()&&(a=!1)}catch(u){if(u instanceof Hh)c=new wt(0,0),a=!1;else throw u}finally{}a?this._segList.addPt(c):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())};jn.prototype.addFilletCorner=function(t,e,n,i,a){var c=e.x-t.x,p=e.y-t.y,u=Math.atan2(p,c),b=n.x-t.x,w=n.y-t.y,T=Math.atan2(w,b);i===ce.CLOCKWISE?u<=T&&(u+=2*Math.PI):u>=T&&(u-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,u,T,i,a),this._segList.addPt(n)};jn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new wt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new wt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};jn.prototype.createCircle=function(t){var e=new wt(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};jn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};jn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ko,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*jn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};jn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===xn.JOIN_BEVEL||this._bufParams.getJoinStyle()===xn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ce.CLOCKWISE,this._distance))};jn.prototype.closeRing=function(){this._segList.closeRing()};jn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};jn.prototype.interfaces_=function(){return[]};jn.prototype.getClass=function(){return jn};Qf.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Qf.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Qf.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Qf.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(jn,Qf);var Qr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Qr.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,i=Math.abs(e),a=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],a):this.computeOffsetCurve(t,n,a);var c=a.getCoordinates();return n&&rn.reverse(c),c};Qr.prototype.computeSingleSidedBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var a=li.simplify(t,-i),c=a.length-1;n.initSideSegments(a[c],a[c-1],Xt.LEFT),n.addFirstSegment();for(var p=c-2;p>=0;p--)n.addNextSegment(a[p],!0)}else{n.addSegments(t,!1);var u=li.simplify(t,i),b=u.length-1;n.initSideSegments(u[0],u[1],Xt.LEFT),n.addFirstSegment();for(var w=2;w<=b;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};Qr.prototype.computeRingBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);e===Xt.RIGHT&&(i=-i);var a=li.simplify(t,i),c=a.length-1;n.initSideSegments(a[c-1],a[0],e);for(var p=1;p<=c;p++){var u=p!==1;n.addNextSegment(a[p],u)}n.closeRing()};Qr.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),i=li.simplify(t,n),a=i.length-1;e.initSideSegments(i[0],i[1],Xt.LEFT);for(var c=2;c<=a;c++)e.addNextSegment(i[c],!0);e.addLastSegment(),e.addLineEndCap(i[a-1],i[a]);var p=li.simplify(t,-n),u=p.length-1;e.initSideSegments(p[u],p[u-1],Xt.LEFT);for(var b=u-2;b>=0;b--)e.addNextSegment(p[b],!0);e.addLastSegment(),e.addLineEndCap(p[1],p[0]),e.closeRing()};Qr.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case xn.CAP_ROUND:e.createCircle(t);break;case xn.CAP_SQUARE:e.createSquare(t);break}};Qr.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var a=e<0;this.computeSingleSidedBufferCurve(t,a,i)}else this.computeLineBufferCurve(t,i);var c=i.getCoordinates();return c};Qr.prototype.getBufferParameters=function(){return this._bufParams};Qr.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};Qr.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return Qr.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()};Qr.prototype.computeOffsetCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var a=li.simplify(t,-i),c=a.length-1;n.initSideSegments(a[c],a[c-1],Xt.LEFT),n.addFirstSegment();for(var p=c-2;p>=0;p--)n.addNextSegment(a[p],!0)}else{var u=li.simplify(t,i),b=u.length-1;n.initSideSegments(u[0],u[1],Xt.LEFT),n.addFirstSegment();for(var w=2;w<=b;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};Qr.prototype.getSegGen=function(t){return new jn(this._precisionModel,this._bufParams,t)};Qr.prototype.interfaces_=function(){return[]};Qr.prototype.getClass=function(){return Qr};Qr.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;nc.getMaxY()||t.findStabbedSegments(e,a.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ne(arguments[2],ps)&&arguments[0]instanceof wt&&arguments[1]instanceof R_)for(var p=arguments[0],u=arguments[1],b=arguments[2],w=u.getEdge().getCoordinates(),T=0;Tt._seg.p1.y&&t._seg.reverse();var P=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Pt._seg.p1.y)&&ce.computeOrientation(t._seg.p0,t._seg.p1,p)!==ce.RIGHT){var k=u.getDepth(Xt.LEFT);t._seg.p0.equals(w[T])||(k=u.getDepth(Xt.RIGHT));var B=new uu(t._seg,k);b.add(B)}}else if(Ne(arguments[2],ps)&&arguments[0]instanceof wt&&Ne(arguments[1],ps))for(var V=arguments[0],tt=arguments[1],ot=arguments[2],ut=tt.iterator();ut.hasNext();){var W=ut.next();W.isForward()&&t.findStabbedSegments(V,W,ot)}}};ec.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=gs.min(e);return n._leftDepth};ec.prototype.interfaces_=function(){return[]};ec.prototype.getClass=function(){return ec};vx.DepthSegment.get=function(){return uu};Object.defineProperties(ec,vx);var uu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Ce(t),this._leftDepth=e};uu.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};uu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};uu.prototype.toString=function(){return this._upwardSeg.toString()};uu.prototype.interfaces_=function(){return[Jo]};uu.prototype.getClass=function(){return uu};var wn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};wn.prototype.area=function(){return wn.area(this.p0,this.p1,this.p2)};wn.prototype.signedArea=function(){return wn.signedArea(this.p0,this.p1,this.p2)};wn.prototype.interpolateZ=function(t){if(t===null)throw new Qn("Supplied point is null.");return wn.interpolateZ(t,this.p0,this.p1,this.p2)};wn.prototype.longestSideLength=function(){return wn.longestSideLength(this.p0,this.p1,this.p2)};wn.prototype.isAcute=function(){return wn.isAcute(this.p0,this.p1,this.p2)};wn.prototype.circumcentre=function(){return wn.circumcentre(this.p0,this.p1,this.p2)};wn.prototype.area3D=function(){return wn.area3D(this.p0,this.p1,this.p2)};wn.prototype.centroid=function(){return wn.centroid(this.p0,this.p1,this.p2)};wn.prototype.inCentre=function(){return wn.inCentre(this.p0,this.p1,this.p2)};wn.prototype.interfaces_=function(){return[]};wn.prototype.getClass=function(){return wn};wn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)};wn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};wn.det=function(t,e,n,i){return t*i-e*n};wn.interpolateZ=function(t,e,n,i){var a=e.x,c=e.y,p=n.x-a,u=i.x-a,b=n.y-c,w=i.y-c,T=p*w-u*b,P=t.x-a,k=t.y-c,B=(w*P-u*k)/T,V=(-b*P+p*k)/T,tt=e.z+B*(n.z-e.z)+V*(i.z-e.z);return tt};wn.longestSideLength=function(t,e,n){var i=t.distance(e),a=e.distance(n),c=n.distance(t),p=i;return a>p&&(p=a),c>p&&(p=c),p};wn.isAcute=function(t,e,n){return!(!pn.isAcute(t,e,n)||!pn.isAcute(e,n,t)||!pn.isAcute(n,t,e))};wn.circumcentre=function(t,e,n){var i=n.x,a=n.y,c=t.x-i,p=t.y-a,u=e.x-i,b=e.y-a,w=2*wn.det(c,p,u,b),T=wn.det(p,c*c+p*p,b,u*u+b*b),P=wn.det(c,c*c+p*p,u,u*u+b*b),k=i-T/w,B=a+P/w;return new wt(k,B)};wn.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=new hs(t.x+n/2,t.y+i/2,1),c=new hs(t.x-i+n/2,t.y+n+i/2,1);return new hs(a,c)};wn.angleBisector=function(t,e,n){var i=e.distance(t),a=e.distance(n),c=i/(i+a),p=n.x-t.x,u=n.y-t.y,b=new wt(t.x+c*p,t.y+c*u);return b};wn.area3D=function(t,e,n){var i=e.x-t.x,a=e.y-t.y,c=e.z-t.z,p=n.x-t.x,u=n.y-t.y,b=n.z-t.z,w=a*b-c*u,T=c*p-i*b,P=i*u-a*p,k=w*w+T*T+P*P,B=Math.sqrt(k)/2;return B};wn.centroid=function(t,e,n){var i=(t.x+e.x+n.x)/3,a=(t.y+e.y+n.y)/3;return new wt(i,a)};wn.inCentre=function(t,e,n){var i=e.distance(n),a=t.distance(n),c=t.distance(e),p=i+a+c,u=(i*t.x+a*e.x+c*n.x)/p,b=(i*t.y+a*e.y+c*n.y)/p;return new wt(u,b)};var Ko=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new te;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Ko.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Lt.EXTERIOR,Lt.INTERIOR)};Ko.prototype.addPolygon=function(t){var e=this,n=this._distance,i=Xt.LEFT;this._distance<0&&(n=-this._distance,i=Xt.RIGHT);var a=t.getExteriorRing(),c=rn.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,n,i,Lt.EXTERIOR,Lt.INTERIOR);for(var p=0;p0&&e.isErodedCompletely(u,-e._distance)||e.addPolygonRing(b,n,Xt.opposite(i),Lt.INTERIOR,Lt.EXTERIOR)}};Ko.prototype.isTriangleErodedCompletely=function(t,e){var n=new wn(t[0],t[1],t[2]),i=n.inCentre(),a=ce.distancePointLine(i,n.p0,n.p1);return a=da.MINIMUM_VALID_SIZE&&ce.isCCW(t)&&(c=a,p=i,n=Xt.opposite(n));var u=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(u,c,p)};Ko.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Di?this.addPolygon(t):t instanceof ai?this.addLineString(t):t instanceof mo?this.addPoint(t):t instanceof Th?this.addCollection(t):t instanceof au?this.addCollection(t):t instanceof ha?this.addCollection(t):t instanceof Nr&&this.addCollection(t)};Ko.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),a=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>a};Ko.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new Yh;var t=this._parent.getGeometryN(this._index++);return t instanceof Nr?(this._subcollectionIterator=new pa(t),this._subcollectionIterator.next()):t};pa.prototype.remove=function(){throw new Error(this.getClass().getName())};pa.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)};pa.prototype.interfaces_=function(){return[Xh]};pa.prototype.getClass=function(){return pa};pa.isAtomic=function(t){return!(t instanceof Nr)};var Lo=function(){this._geom=null;var t=arguments[0];this._geom=t};Lo.prototype.locate=function(t){return Lo.locate(t,this._geom)};Lo.prototype.interfaces_=function(){return[Ah]};Lo.prototype.getClass=function(){return Lo};Lo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?ce.isPointInRing(t,e.getCoordinates()):!1};Lo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Lo.isPointInRing(t,n))return!1;for(var i=0;i0&&(i.right=c.right,i.left=c,c.right=null),this._size++,this._root=i),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,i){var a;if(n===null)return null;n=nu(e,n,i);var c=i(e,n.key);return c===0?(n.left===null?a=n.right:(a=nu(e,n.left,i),a.right=n.right),this._size--,a):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=nu(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,i=this._comparator;n;){var a=i(e,n.key);if(a===0)return n;a<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=nu(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,i=this._comparator;n;){var a=i(e,n.key);if(a===0)return!0;a<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var i=this._root,a=[],c=!1;!c;)i!==null?(a.push(i),i=i.left):a.length!==0?(i=a.pop(),e.call(n,i),i=i.right):c=!0;return this},t.prototype.range=function(e,n,i,a){for(var c=[],p=this._comparator,u=this._root,b;c.length!==0||u;)if(u)c.push(u),u=u.left;else{if(u=c.pop(),b=p(u.key,n),b>0)break;if(p(u.key,e)>=0&&i.call(a,u))return this;u=u.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var i=n.key;return e.push(i)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var i=n.data;return e.push(i)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,i=!1,a=0,c=[];!i;)if(n)c.push(n),n=n.left;else if(c.length>0){if(n=c.pop(),a===e)return n;a++,n=n.right}else i=!0;return null},t.prototype.next=function(e){var n=this._root,i=null;if(e.right){for(i=e.right;i.left;)i=i.left;return i}for(var a=this._comparator;n;){var c=a(e.key,n.key);if(c===0)break;c<0?(i=n,n=n.left):n=n.right}return i},t.prototype.prev=function(e){var n=this._root,i=null;if(e.left!==null){for(i=e.left;i.right;)i=i.right;return i}for(var a=this._comparator;n;){var c=a(e.key,n.key);if(c===0)break;c<0?n=n.left:(i=n,n=n.right)}return i},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return EE(this._root)},t.prototype.load=function(e,n,i){n===void 0&&(n=[]),i===void 0&&(i=!1);var a=e.length,c=this._comparator;if(i&&P_(e,n,0,a-1,c),this._root===null)this._root=T_(e,n,0,a),this._size=a;else{var p=SE(this.toList(),IE(e,n),c);a=this._size+a,this._root=L_({head:p},0,a)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(i){return String(i.key)});var n=[];return C_(this._root,"",!0,function(i){return n.push(i)},e),n.join("")},t.prototype.update=function(e,n,i){var a=this._comparator,c=uv(e,this._root,a),p=c.left,u=c.right;a(e,n)<0?u=h_(n,i,u,a):p=h_(n,i,p,a),this._root=wE(p,u,a)},t.prototype.split=function(e){return uv(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,i;return xE(this,function(a){switch(a.label){case 0:e=this._root,n=[],i=!1,a.label=1;case 1:return i?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return a.sent(),e=e.right,[3,5];case 4:i=!0,a.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function T_(t,e,n,i){var a=i-n;if(a>0){var c=n+Math.floor(a/2),p=t[c],u=e[c],b=new su(p,u);return b.left=T_(t,e,n,c),b.right=T_(t,e,c+1,i),b}return null}function IE(t,e){for(var n=new su(null,null),i=n,a=0;a0?(e=c=c.next=n.pop(),e=e.right):i=!0;return c.next=null,a.next}function L_(t,e,n){var i=n-e;if(i>0){var a=e+Math.floor(i/2),c=L_(t,e,a),p=t.head;return p.left=c,t.head=t.head.next,p.right=L_(t,a+1,n),p}return null}function SE(t,e,n){for(var i=new su(null,null),a=i,c=t,p=e;c!==null&&p!==null;)n(c.key,p.key)<0?(a.next=c,c=c.next):(a.next=p,p=p.next),a=a.next;return c!==null?a.next=c:p!==null&&(a.next=p),i.next}function P_(t,e,n,i,a){if(!(n>=i)){for(var c=t[n+i>>1],p=n-1,u=i+1;;){do p++;while(a(t[p],c)<0);do u--;while(a(t[u],c)>0);if(p>=u)break;var b=t[p];t[p]=t[u],t[u]=b,b=e[p],e[p]=e[u],e[u]=b}P_(t,e,n,u,a),P_(t,e,u+1,i,a)}}function Qs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cv(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){Qs(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Po(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,i=0,a=n.length;i=0&&P>=0?wk?-1:0:b<0&&P<0?wk?1:0:Pb?1:0}}}]),t}(),AE=0,Tm=function(){Po(t,null,[{key:"compare",value:function(e,n){var i=e.leftSE.point.x,a=n.leftSE.point.x,c=e.rightSE.point.x,p=n.rightSE.point.x;if(pu&&b>w)return-1;var P=e.comparePoint(n.leftSE.point);if(P<0)return 1;if(P>0)return-1;var k=n.comparePoint(e.rightSE.point);return k!==0?k:-1}if(i>a){if(ub&&u>T)return 1;var B=n.comparePoint(e.leftSE.point);if(B!==0)return B;var V=e.comparePoint(n.rightSE.point);return V<0?1:V>0?-1:1}if(ub)return 1;if(cp){var ot=e.comparePoint(n.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(c!==p){var ut=w-u,W=c-i,X=T-b,J=p-a;if(ut>W&&XJ)return-1}return c>p?1:cT?1:e.idn.id?1:0}}]);function t(e,n,i,a){Qs(this,t),this.id=++AE,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=i,this.windings=a}return Po(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,i=this.rightSE.point,a=this.vector();if(n.x===i.x)return e.x===n.x?0:e.x0&&u.swapEvents(),Oa.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(a.checkForConsuming(),c.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n0){var c=n;n=i,i=c}if(n.prev===i){var p=n;n=i,i=p}for(var u=0,b=i.rings.length;u0)a=n,c=e,p=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var b=new Oa(a,!0),w=new Oa(c,!1);return new t(b,w,[i],[p])}}]),t}(),mv=function(){function t(e,n,i){if(Qs(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var a=bf.round(e[0][0],e[0][1]);this.bbox={ll:{x:a.x,y:a.y},ur:{x:a.x,y:a.y}};for(var c=a,p=1,u=e.length;pthis.bbox.ur.x&&(this.bbox.ur.x=b.x),b.y>this.bbox.ur.y&&(this.bbox.ur.y=b.y),c=b)}(a.x!==c.x||a.y!==c.y)&&this.segments.push(Tm.fromRing(c,a,this))}return Po(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,i=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=c.bbox.ur.x),c.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=c.bbox.ur.y),this.interiorRings.push(c)}this.multiPoly=n}return Po(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=c.bbox.ur.x),c.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=c.bbox.ur.y),this.polys.push(c)}this.isSubject=n}return Po(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,i=this.polys.length;n0&&(e=a)}for(var c=e.segment.prevInResult(),p=c?c.prevInResult():null;;){if(!c)return null;if(!p)return c.ringOut;if(p.ringOut!==c.ringOut)return p.ringOut.enclosingRing()!==c.ringOut?c.ringOut:c.ringOut.enclosingRing();c=p.prevInResult(),p=c?c.prevInResult():null}}}]),t}(),_v=function(){function t(e){Qs(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Po(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,i=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:Tm.compare;Qs(this,t),this.queue=e,this.tree=new Q_(n),this.segments=[]}return Po(t,[{key:"process",value:function(e){var n=e.segment,i=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),i;var a=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!a)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 c=a,p=a,u=void 0,b=void 0;u===void 0;)c=this.tree.prev(c),c===null?u=null:c.key.consumedBy===void 0&&(u=c.key);for(;b===void 0;)p=this.tree.next(p),p===null?b=null:p.key.consumedBy===void 0&&(b=p.key);if(e.isLeft){var w=null;if(u){var T=u.getIntersection(n);if(T!==null&&(n.isAnEndpoint(T)||(w=T),!u.isAnEndpoint(T)))for(var P=this._splitSafely(u,T),k=0,B=P.length;k0?(this.tree.remove(n),i.push(e)):(this.segments.push(n),n.prev=u)}else{if(u&&b){var St=u.getIntersection(b);if(St!==null){if(!u.isAnEndpoint(St))for(var It=this._splitSafely(u,St),Ft=0,mt=It.length;Ftyv)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var J=new NE(V),ht=V.size,vt=V.pop();vt;){var gt=vt.key;if(V.size===ht){var St=gt.segment;throw new Error("Unable to pop() ".concat(gt.isLeft?"left":"right"," SweepEvent ")+"[".concat(gt.point.x,", ").concat(gt.point.y,"] from segment #").concat(St.id," ")+"[".concat(St.leftSE.point.x,", ").concat(St.leftSE.point.y,"] -> ")+"[".concat(St.rightSE.point.x,", ").concat(St.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(V.size>yv)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(J.segments.length>zE)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var It=J.process(gt),Ft=0,mt=It.length;Ft1?e-1:0),i=1;i1?e-1:0),i=1;i1?e-1:0),i=1;i1?e-1:0),i=1;in[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};wt.prototype.clone=function(){};wt.prototype.copy=function(){return new wt(this)};wt.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};wt.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)};wt.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};wt.prototype.hashCode=function(){var t=17;return t=37*t+wt.hashCode(this.x),t=37*t+wt.hashCode(this.y),t};wt.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};wt.prototype.interfaces_=function(){return[Jo,jm,Qo]};wt.prototype.getClass=function(){return wt};wt.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=Ve.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};cc.DimensionalComparator.get=function(){return _l};cc.serialVersionUID.get=function(){return 6683108902428367e3};cc.NULL_ORDINATE.get=function(){return Ve.NaN};cc.X.get=function(){return 0};cc.Y.get=function(){return 1};cc.Z.get=function(){return 2};Object.defineProperties(wt,cc);var _l=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new Qn("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};_l.prototype.compare=function(t,e){var n=t,i=e,a=_l.compare(n.x,i.x);if(a!==0)return a;var c=_l.compare(n.y,i.y);if(c!==0)return c;if(this._dimensionsToTest<=2)return 0;var p=_l.compare(n.z,i.z);return p};_l.prototype.interfaces_=function(){return[xh]};_l.prototype.getClass=function(){return _l};_l.compare=function(t,e){return te?1:Ve.isNaN(t)?Ve.isNaN(e)?0:-1:Ve.isNaN(e)?1:0};var bh=function(){};bh.prototype.create=function(){};bh.prototype.interfaces_=function(){return[]};bh.prototype.getClass=function(){return bh};var Lt=function(){},Wf={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Lt.prototype.interfaces_=function(){return[]};Lt.prototype.getClass=function(){return Lt};Lt.toLocationSymbol=function(t){switch(t){case Lt.EXTERIOR:return"e";case Lt.BOUNDARY:return"b";case Lt.INTERIOR:return"i";case Lt.NONE:return"-"}throw new Qn("Unknown location value: "+t)};Wf.INTERIOR.get=function(){return 0};Wf.BOUNDARY.get=function(){return 1};Wf.EXTERIOR.get=function(){return 2};Wf.NONE.get=function(){return-1};Object.defineProperties(Lt,Wf);var Ne=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Mo=function(){},sx={LOG_10:{configurable:!0}};Mo.prototype.interfaces_=function(){return[]};Mo.prototype.getClass=function(){return Mo};Mo.log10=function(t){var e=Math.log(t);return Ve.isInfinite(e)||Ve.isNaN(e)?e:e/Mo.LOG_10};Mo.min=function(t,e,n,i){var a=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],a=arguments[1],c=arguments[2];return ic?c:i}};Mo.wrap=function(t,e){return t<0?e- -t%e:t%e};Mo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],p=arguments[2],u=arguments[3],b=a;return c>b&&(b=c),p>b&&(b=p),u>b&&(b=u),b}};Mo.average=function(t,e){return(t+e)/2};sx.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Mo,sx);var $s=function(t){this.str=t};$s.prototype.append=function(t){this.str+=t};$s.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};$s.prototype.toString=function(t){return this.str};var Gs=function(t){this.value=t};Gs.prototype.intValue=function(){return this.value};Gs.prototype.compareTo=function(t){return this.valuet?1:0};Gs.isNaN=function(t){return Number.isNaN(t)};var wf=function(){};wf.isWhitespace=function(t){return t<=32&&t>=0||t===127};wf.toUpperCase=function(t){return t.toUpperCase()};var Dt=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var i=arguments[0];t.call(this,t.parse(i))}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this.init(a,c)}},xs={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}};Dt.prototype.le=function(t){return(this._hi9?(T=!0,P="9"):P="0"+w,p.append(P),n=n.subtract(Dt.valueOf(w)).multiply(Dt.TEN),T&&n.selfAdd(Dt.TEN);var k=!0,B=Dt.magnitude(n._hi);if(B<0&&Math.abs(B)>=u-b&&(k=!1),!k)break}return e[0]=i,p.toString()};Dt.prototype.sqr=function(){return this.multiply(this)};Dt.prototype.doubleValue=function(){return this._hi+this._lo};Dt.prototype.subtract=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};Dt.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};Dt.prototype.isZero=function(){return this._hi===0&&this._lo===0};Dt.prototype.selfSubtract=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}};Dt.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};Dt.prototype.min=function(t){return this.le(t)?this:t};Dt.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=null,c=null,p=null,u=null,b=null,w=null,T=null,P=null;return b=this._hi/n,w=Dt.SPLIT*b,a=w-b,P=Dt.SPLIT*n,a=w-a,c=b-a,p=P-n,T=b*n,p=P-p,u=n-p,P=a*p-T+a*u+c*p+c*u,w=(this._hi-T-P+this._lo-b*i)/n,P=b+w,this._hi=P,this._lo=b-P+w,this}};Dt.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};Dt.prototype.divide=function(){if(arguments[0]instanceof Dt){var t=arguments[0],e=null,n=null,i=null,a=null,c=null,p=null,u=null,b=null;c=this._hi/t._hi,p=Dt.SPLIT*c,e=p-c,b=Dt.SPLIT*t._hi,e=p-e,n=c-e,i=b-t._hi,u=c*t._hi,i=b-i,a=t._hi-i,b=e*i-u+e*a+n*i+n*a,p=(this._hi-u-b+this._lo-c*t._lo)/t._hi,b=c+p;var w=b,T=c-b+p;return new Dt(w,T)}else if(typeof arguments[0]=="number"){var P=arguments[0];return Ve.isNaN(P)?Dt.createNaN():Dt.copy(this).selfDivide(P,0)}};Dt.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};Dt.prototype.pow=function(t){if(t===0)return Dt.valueOf(1);var e=new Dt(this),n=Dt.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(e),i/=2,i>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};Dt.prototype.ceil=function(){if(this.isNaN())return Dt.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Dt(t,e)};Dt.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};Dt.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};Dt.prototype.setValue=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};Dt.prototype.max=function(t){return this.ge(t)?this:t};Dt.prototype.sqrt=function(){if(this.isZero())return Dt.valueOf(0);if(this.isNegative())return Dt.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=Dt.valueOf(e),i=this.subtract(n.sqr()),a=i._hi*(t*.5);return n.add(a)};Dt.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,i=null,a=null,c=null,p=null,u=null;return a=this._hi+e,p=a-this._hi,c=a-p,c=e-p+(this._hi-c),u=c+this._lo,n=a+u,i=u+(a-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var b=arguments[0],w=arguments[1],T=null,P=null,k=null,B=null,V=null,tt=null,ot=null,ut=null;V=this._hi+b,k=this._lo+w,ot=V-this._hi,ut=k-this._lo,tt=V-ot,B=k-ut,tt=b-ot+(this._hi-tt),B=w-ut+(this._lo-B),ot=tt+k,T=V+ot,P=ot+(V-T),ot=B+P;var W=T+ot,X=ot+(T-W);return this._hi=W,this._lo=X,this}};Dt.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof Dt){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=null,c=null,p=null,u=null,b=null,w=null;b=Dt.SPLIT*this._hi,a=b-this._hi,w=Dt.SPLIT*n,a=b-a,c=this._hi-a,p=w-n,b=this._hi*n,p=w-p,u=n-p,w=a*p-b+a*u+c*p+c*u+(this._hi*i+this._lo*n);var T=b+w;a=b-T;var P=w+a;return this._hi=T,this._lo=P,this}};Dt.prototype.selfSqr=function(){return this.selfMultiply(this)};Dt.prototype.floor=function(){if(this.isNaN())return Dt.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Dt(t,e)};Dt.prototype.negate=function(){return this.isNaN()?this:new Dt(-this._hi,-this._lo)};Dt.prototype.clone=function(){};Dt.prototype.multiply=function(){if(arguments[0]instanceof Dt){var t=arguments[0];return t.isNaN()?Dt.createNaN():Dt.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return Ve.isNaN(e)?Dt.createNaN():Dt.copy(this).selfMultiply(e,0)}};Dt.prototype.isNaN=function(){return Ve.isNaN(this._hi)};Dt.prototype.intValue=function(){return Math.trunc(this._hi)};Dt.prototype.toString=function(){var t=Dt.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};Dt.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,a=n;if(n.charAt(0)===".")a="0"+n;else if(i<0)a="0."+Dt.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var c=i-n.length,p=Dt.stringOfChar("0",c);a=n+p+".0"}return this.isNegative()?"-"+a:a};Dt.prototype.reciprocal=function(){var t=null,e=null,n=null,i=null,a=null,c=null,p=null,u=null;a=1/this._hi,c=Dt.SPLIT*a,t=c-a,u=Dt.SPLIT*this._hi,t=c-t,e=a-t,n=u-this._hi,p=a*this._hi,n=u-n,i=this._hi-n,u=t*n-p+t*i+e*n+e*i,c=(1-p-u-a*this._lo)/this._hi;var b=a+c,w=a-b+c;return new Dt(b,w)};Dt.prototype.toSciNotation=function(){if(this.isZero())return Dt.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=Dt.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var a="";n.length>1&&(a=n.substring(1));var c=n.charAt(0)+"."+a;return this.isNegative()?"-"+c+i:c+i};Dt.prototype.abs=function(){return this.isNaN()?Dt.NaN:this.isNegative()?this.negate():new Dt(this)};Dt.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};Dt.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};Dt.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};Dt.prototype.trunc=function(){return this.isNaN()?Dt.NaN:this.isPositive()?this.floor():this.ceil()};Dt.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};Dt.prototype.interfaces_=function(){return[Qo,Jo,jm]};Dt.prototype.getClass=function(){return Dt};Dt.sqr=function(t){return Dt.valueOf(t).selfMultiply(t)};Dt.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return Dt.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new Dt(e)}};Dt.sqrt=function(t){return Dt.valueOf(t).sqrt()};Dt.parse=function(t){for(var e=0,n=t.length;wf.isWhitespace(t.charAt(e));)e++;var i=!1;if(e=n);){var w=t.charAt(e);if(e++,wf.isDigit(w)){var T=w-"0";c.selfMultiply(Dt.TEN),c.selfAdd(T),p++;continue}if(w==="."){u=p;continue}if(w==="e"||w==="E"){var P=t.substring(e);try{b=Gs.parseInt(P)}catch(ot){throw ot instanceof Error?new Error("Invalid exponent "+P+" in string "+t):ot}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var k=c,B=p-u-b;if(B===0)k=c;else if(B>0){var V=Dt.TEN.pow(B);k=c.divide(V)}else if(B<0){var tt=Dt.TEN.pow(-B);k=c.multiply(tt)}return i?k.negate():k};Dt.createNaN=function(){return new Dt(Ve.NaN,Ve.NaN)};Dt.copy=function(t){return new Dt(t)};Dt.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n)),a=Math.pow(10,i);return a*10<=e&&(i+=1),i};Dt.stringOfChar=function(t,e){for(var n=new $s,i=0;i0){if(c<=0)return Jr.signum(p);i=a+c}else if(a<0){if(c>=0)return Jr.signum(p);i=-a-c}else return Jr.signum(p);var u=Jr.DP_SAFE_EPSILON*i;return p>=u||-p>=u?Jr.signum(p):2};Jr.signum=function(t){return t>0?1:t<0?-1:0};ax.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(Jr,ax);var mn=function(){},Hf={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Hf.X.get=function(){return 0};Hf.Y.get=function(){return 1};Hf.Z.get=function(){return 2};Hf.M.get=function(){return 3};mn.prototype.setOrdinate=function(t,e,n){};mn.prototype.size=function(){};mn.prototype.getOrdinate=function(t,e){};mn.prototype.getCoordinate=function(){};mn.prototype.getCoordinateCopy=function(t){};mn.prototype.getDimension=function(){};mn.prototype.getX=function(t){};mn.prototype.clone=function(){};mn.prototype.expandEnvelope=function(t){};mn.prototype.copy=function(){};mn.prototype.getY=function(t){};mn.prototype.toCoordinateArray=function(){};mn.prototype.interfaces_=function(){return[jm]};mn.prototype.getClass=function(){return mn};Object.defineProperties(mn,Hf);var lx=function(){},Hh=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lx),ur=function(){};ur.arraycopy=function(t,e,n,i,a){for(var c=0,p=e;pt._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}};Se.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Se){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}};Se.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0};Se.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Se.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Se.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Se.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Se.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Se.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Se.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Se){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof wt){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}};Se.prototype.centre=function(){return this.isNull()?null:new wt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Se.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof wt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Se){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var a=arguments[0],c=arguments[1],p=arguments[2],u=arguments[3];at._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Se.prototype.hashCode=function(){var t=17;return t=37*t+wt.hashCode(this._minx),t=37*t+wt.hashCode(this._maxx),t=37*t+wt.hashCode(this._miny),t=37*t+wt.hashCode(this._maxy),t};Se.prototype.interfaces_=function(){return[Jo,Qo]};Se.prototype.getClass=function(){return Se};Se.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],p=arguments[3],u=Math.min(c.x,p.x),b=Math.max(c.x,p.x),w=Math.min(i.x,a.x),T=Math.max(i.x,a.x);return!(w>b||Tb)||Tn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};ni.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};ni.prototype.setPrecisionModel=function(t){this._precisionModel=t};ni.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;na?c=i:c=a;else{var p=Math.abs(t.x-e.x),u=Math.abs(t.y-e.y);i>a?c=p:c=u,c===0&&!t.equals(e)&&(c=Math.max(p,u))}return Xe.isTrue(!(c===0&&!t.equals(e)),"Bad distance calculation"),c};ni.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,c=Math.sqrt(i*i+a*a);return Xe.isTrue(!(c===0&&!t.equals(e)),"Invalid distance calculation"),c};hc.DONT_INTERSECT.get=function(){return 0};hc.DO_INTERSECT.get=function(){return 1};hc.COLLINEAR.get=function(){return 2};hc.NO_INTERSECTION.get=function(){return 0};hc.POINT_INTERSECTION.get=function(){return 1};hc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(ni,hc);var gu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var i=new Se(this._inputLines[0][0],this._inputLines[0][1]),a=new Se(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&a.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],a=arguments[2];if(this._isProper=!1,Se.intersects(i,a,n)&&ce.orientationIndex(i,a,n)===0&&ce.orientationIndex(a,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(a))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,i,a,c,p){p.x=this.smallestInAbsValue(n.x,i.x,a.x,c.x),p.y=this.smallestInAbsValue(n.y,i.y,a.y,c.y),n.x-=p.x,n.y-=p.y,i.x-=p.x,i.y-=p.y,a.x-=p.x,a.y-=p.y,c.x-=p.x,c.y-=p.y},e.prototype.safeHCoordinateIntersection=function(n,i,a,c){var p=null;try{p=hs.intersection(n,i,a,c)}catch(u){if(u instanceof Hh)p=e.nearestEndpoint(n,i,a,c);else throw u}finally{}return p},e.prototype.intersection=function(n,i,a,c){var p=this.intersectionWithNormalization(n,i,a,c);return this.isInSegmentEnvelopes(p)||(p=new wt(e.nearestEndpoint(n,i,a,c))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p},e.prototype.smallestInAbsValue=function(n,i,a,c){var p=n,u=Math.abs(p);return Math.abs(i)1e-4&&ur.out.println("Distance = "+p.distance(u))},e.prototype.intersectionWithNormalization=function(n,i,a,c){var p=new wt(n),u=new wt(i),b=new wt(a),w=new wt(c),T=new wt;this.normalizeToEnvCentre(p,u,b,w,T);var P=this.safeHCoordinateIntersection(p,u,b,w);return P.x+=T.x,P.y+=T.y,P},e.prototype.computeCollinearIntersection=function(n,i,a,c){var p=Se.intersects(n,i,a),u=Se.intersects(n,i,c),b=Se.intersects(a,c,n),w=Se.intersects(a,c,i);return p&&u?(this._intPt[0]=a,this._intPt[1]=c,t.COLLINEAR_INTERSECTION):b&&w?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):p&&b?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!u&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):p&&w?(this._intPt[0]=a,this._intPt[1]=i,a.equals(i)&&!u&&!b?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&b?(this._intPt[0]=c,this._intPt[1]=n,c.equals(n)&&!p&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):u&&w?(this._intPt[0]=c,this._intPt[1]=i,c.equals(i)&&!p&&!b?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,i,a,c,p){var u=n.xi.x?n.x:i.x,T=n.y>i.y?n.y:i.y,P=a.xc.x?a.x:c.x,V=a.y>c.y?a.y:c.y,tt=u>P?u:P,ot=wk?b:k,W=T0&&u>0||p<0&&u<0)return t.NO_INTERSECTION;var b=ce.orientationIndex(a,c,n),w=ce.orientationIndex(a,c,i);if(b>0&&w>0||b<0&&w<0)return t.NO_INTERSECTION;var T=p===0&&u===0&&b===0&&w===0;return T?this.computeCollinearIntersection(n,i,a,c):(p===0||u===0||b===0||w===0?(this._isProper=!1,n.equals2D(a)||n.equals2D(c)?this._intPt[0]=n:i.equals2D(a)||i.equals2D(c)?this._intPt[0]=i:p===0?this._intPt[0]=new wt(a):u===0?this._intPt[0]=new wt(c):b===0?this._intPt[0]=new wt(n):w===0&&(this._intPt[0]=new wt(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,a,c)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,i,a,c){var p=n,u=ce.distancePointLine(n,a,c),b=ce.distancePointLine(i,a,c);return b0?n>0?-a:a:n>0?a:-a;if(e===0||n===0)return i>0?t>0?a:-a:t>0?-a:a;if(e>0?i>0?e<=i||(a=-a,c=t,t=n,n=c,c=e,e=i,i=c):e<=-i?(a=-a,n=-n,i=-i):(c=t,t=-n,n=c,c=e,e=-i,i=c):i>0?-e<=i?(a=-a,t=-t,e=-e):(c=-t,t=n,n=c,c=-e,e=i,i=c):e>=i?(t=-t,e=-e,n=-n,i=-i):(a=-a,c=-t,t=-n,n=c,c=-e,e=-i,i=c),t>0)if(n>0){if(!(t<=n))return a}else return a;else{if(n>0)return-a;if(t>=n)a=-a,t=-t,n=-n;else return-a}for(;;){if(p=Math.floor(n/t),n=n-p*t,i=i-p*e,i<0)return-a;if(i>e)return a;if(t>n+n){if(ei+i)return-a;n=t-n,i=e-i,a=-a}if(i===0)return n===0?0:-a;if(n===0||(p=Math.floor(t/n),t=t-p*n,e=e-p*i,e<0))return a;if(e>i)return-a;if(n>t+t){if(ie+e)return a;t=n-t,e=i-e,a=-a}if(e===0)return t===0?0:a;if(t===0)return-a}};var Ns=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Ns.prototype.countSegment=function(t,e){if(t.xi&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var a=t.x-this._p.x,c=t.y-this._p.y,p=e.x-this._p.x,u=e.y-this._p.y,b=Qu.signOfDet2x2(a,c,p,u);if(b===0)return this._isPointOnSegment=!0,null;u0&&this._crossingCount++}};Ns.prototype.isPointInPolygon=function(){return this.getLocation()!==Lt.EXTERIOR};Ns.prototype.getLocation=function(){return this._isPointOnSegment?Lt.BOUNDARY:this._crossingCount%2===1?Lt.INTERIOR:Lt.EXTERIOR};Ns.prototype.isOnSegment=function(){return this._isPointOnSegment};Ns.prototype.interfaces_=function(){return[]};Ns.prototype.getClass=function(){return Ns};Ns.locatePointInRing=function(){if(arguments[0]instanceof wt&&Ne(arguments[1],mn)){for(var t=arguments[0],e=arguments[1],n=new Ns(t),i=new wt,a=new wt,c=1;c1||b<0||b>1)&&(a=!0)}}return a?Mo.min(ce.distancePointLine(t,n,i),ce.distancePointLine(e,n,i),ce.distancePointLine(n,t,e),ce.distancePointLine(i,t,e)):0};ce.isPointInRing=function(t,e){return ce.locatePointInRing(t,e)!==Lt.EXTERIOR};ce.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new wt;t.getCoordinate(0,i);for(var a=i.x,c=i.y,p=1;pn.y&&(n=c,i=a)}var p=i;do p=p-1,p<0&&(p=e);while(t[p].equals2D(n)&&p!==i);var u=i;do u=(u+1)%e;while(t[u].equals2D(n)&&u!==i);var b=t[p],w=t[u];if(b.equals2D(n)||w.equals2D(n)||b.equals2D(w))return!1;var T=ce.computeOrientation(b,n,w),P=!1;return T===0?P=b.x>w.x:P=T>0,P};ce.locatePointInRing=function(t,e){return Ns.locatePointInRing(t,e)};ce.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),a=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(a)*Math.sqrt(i)};ce.computeOrientation=function(t,e,n){return ce.orientationIndex(t,e,n)};ce.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new Qn("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i=1)return c.distance(u);var T=((p.y-c.y)*(u.x-p.x)-(p.x-c.x)*(u.y-p.y))/b;return Math.abs(T)*Math.sqrt(b)}};ce.isOnLine=function(t,e){for(var n=new gu,i=1;i0};Ih.prototype.interfaces_=function(){return[Xo]};Ih.prototype.getClass=function(){return Ih};var Eh=function(){};Eh.prototype.isInBoundary=function(t){return t>1};Eh.prototype.interfaces_=function(){return[Xo]};Eh.prototype.getClass=function(){return Eh};var Sh=function(){};Sh.prototype.isInBoundary=function(t){return t===1};Sh.prototype.interfaces_=function(){return[Xo]};Sh.prototype.getClass=function(){return Sh};var Pi=function(){};Pi.prototype.add=function(){};Pi.prototype.addAll=function(){};Pi.prototype.isEmpty=function(){};Pi.prototype.iterator=function(){};Pi.prototype.size=function(){};Pi.prototype.toArray=function(){};Pi.prototype.remove=function(){};function ty(t){this.message=t||""}ty.prototype=new Error;ty.prototype.name="IndexOutOfBoundsException";var Xh=function(){};Xh.prototype.hasNext=function(){};Xh.prototype.next=function(){};Xh.prototype.remove=function(){};var ps=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Pi);function Yh(t){this.message=t||""}Yh.prototype=new Error;Yh.prototype.name="NoSuchElementException";var te=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Pi&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Pi]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var i=this,a=n.iterator();a.hasNext();)i.add(a.next());return!0},e.prototype.set=function(n,i){var a=this.array_[n];return this.array_[n]=i,a},e.prototype.iterator=function(){return new HE(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new ty;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,i=[],a=0,c=this.array_.length;a=1){var w=this.get(this.size()-1);if(w.equals2D(u))return null}t.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var T=arguments[0],P=arguments[1];return this.add(T,P),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var k=arguments[0],B=arguments[1],V=arguments[2];if(V)for(var tt=0;tt=0;ot--)i.add(k[ot],B);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof wt){var ut=arguments[0],W=arguments[1],X=arguments[2];if(!X){var J=this.size();if(J>0){if(ut>0){var ht=this.get(ut-1);if(ht.equals2D(W))return null}if(utFt&&(mt=-1);for(var Ct=It;Ct!==Ft;Ct+=mt)i.add(gt[Ct],St);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new wt(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(te),rn=function(){},Wm={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Wm.ForwardComparator.get=function(){return If};Wm.BidirectionalComparator.get=function(){return Ch};Wm.coordArrayType.get=function(){return new Array(0).fill(null)};rn.prototype.interfaces_=function(){return[]};rn.prototype.getClass=function(){return rn};rn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};rn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};rn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};rn.extract=function(t,e,n){e=Mo.clamp(e,0,t.length),n=Mo.clamp(n,-1,t.length);var i=n-e+1;n<0&&(i=0),e>=t.length&&(i=0),ni.length)return 1;if(n.length===0)return 0;var a=rn.compare(n,i),c=rn.isEqualReversed(n,i);return c?0:a};Ch.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.lengthi.length)return 1;if(n.length===0)return 0;for(var a=rn.increasingDirection(n),c=rn.increasingDirection(i),p=a>0?0:n.length-1,u=c>0?0:n.length-1,b=0;b0)e=e.right;else return e.value}return null};yr.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Fa,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,i,a;do if(i=n,a=t.compareTo(n.key),a<0)n=n.left;else if(a>0)n=n.right;else{var c=n.value;return n.value=e,c}while(n!==null);var p={key:t,left:null,right:null,value:e,parent:i,color:Fa,getValue:function(){return this.value},getKey:function(){return this.key}};return a<0?i.left=p:i.right=p,this.fixAfterInsertion(p),this.size_++,null};yr.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=tu;t!=null&&t!==this.root_&&t.parent.color===tu;)if(On(t)===p_(On(On(t)))){var n=wv(On(On(t)));bv(n)===tu?(Da(On(t),Fa),Da(n,Fa),Da(On(On(t)),tu),t=On(On(t))):(t===wv(On(t))&&(t=On(t),e.rotateLeft(t)),Da(On(t),Fa),Da(On(On(t)),tu),e.rotateRight(On(On(t))))}else{var i=p_(On(On(t)));bv(i)===tu?(Da(On(t),Fa),Da(i,Fa),Da(On(On(t)),tu),t=On(On(t))):(t===p_(On(t))&&(t=On(t),e.rotateRight(t)),Da(On(t),Fa),Da(On(On(t)),tu),e.rotateLeft(On(On(t))))}this.root_.color=Fa};yr.prototype.values=function(){var t=new te,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=yr.successor(e))!==null;)t.add(e.value);return t};yr.prototype.entrySet=function(){var t=new ey,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=yr.successor(e))!==null;)t.add(e);return t};yr.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}};yr.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}};yr.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};yr.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,i=t;n!==null&&i===n.right;)i=n,n=n.parent;return n}};yr.prototype.size=function(){return this.size_};var Ef=function(){};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};function cx(){}cx.prototype=new Hm;function qs(){this.array_=[],arguments[0]instanceof Pi&&this.addAll(arguments[0])}qs.prototype=new cx;qs.prototype.contains=function(t){for(var e=this,n=0,i=this.array_.length;n=0;){var p=a.substring(0,c);i.add(p),a=a.substring(c+n),c=a.indexOf(e)}a.length>0&&i.add(a);for(var u=new Array(i.size()).fill(null),b=0;b0)for(var c=a;c0&&i.append(" ");for(var c=0;c0&&i.append(","),i.append(jo.toString(t.getOrdinate(a,c)))}return i.append(")"),i.toString()}};gi.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return gi.createClosedRing(t,e,4);var i=e.getOrdinate(0,mn.X)===e.getOrdinate(n-1,mn.X)&&e.getOrdinate(0,mn.Y)===e.getOrdinate(n-1,mn.Y);return i?e:gi.createClosedRing(t,e,n+1)};gi.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),a=e.size();gi.copy(e,0,i,0,a);for(var c=a;c0&&gi.reverse(i._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?vn.FALSE:0},e.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return ce.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var i=this._points.copy();gi.reverse(i);var a=this.getFactory().createLineString(i);return a},e.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var a=arguments[0],c=a,p=0,u=0;p= 2)");this._points=i},e.prototype.isCoordinate=function(i){for(var a=this,c=0;c=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(ai),ha=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return De.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.isEquivalentClass(i)?t.prototype.equalsExact.call(this,i,a):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var i=this,a=this._geometries.length,c=new Array(a).fill(null),p=0;p0?e.createPoint(n[0]):e.createPoint():t};Tf.prototype.interfaces_=function(){return[Yo.GeometryEditorOperation]};Tf.prototype.getClass=function(){return Tf};var Lf=function(){};Lf.prototype.edit=function(t,e){return t instanceof da?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof ai?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof mo?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Lf.prototype.interfaces_=function(){return[Yo.GeometryEditorOperation]};Lf.prototype.getClass=function(){return Lf};var di=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n0){var e=new $s(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(i=3),i<2?new di(n):new di(n,i)}};ma.prototype.interfaces_=function(){return[bh,Qo]};ma.prototype.getClass=function(){return ma};ma.instance=function(){return ma.instanceObject};iy.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};iy.instanceObject.get=function(){return new ma};Object.defineProperties(ma,iy);var px=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,i){return this.map_.set(n,i),i},e.prototype.values=function(){for(var n=new te,i=this.map_.values(),a=i.next();!a.done;)n.add(a.value),a=i.next();return n},e.prototype.entrySet=function(){var n=new ey;return this.map_.entries().forEach(function(i){return n.add(i)}),n},e.prototype.size=function(){return this.map_.size()},e}(fc),bn=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Zs){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}},ry={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};bn.prototype.equals=function(t){if(!(t instanceof bn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};bn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new Gs(n).compareTo(new Gs(i))};bn.prototype.getScale=function(){return this._scale};bn.prototype.isFloating=function(){return this._modelType===bn.FLOATING||this._modelType===bn.FLOATING_SINGLE};bn.prototype.getType=function(){return this._modelType};bn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===bn.FLOATING?t="Floating":this._modelType===bn.FLOATING_SINGLE?t="Floating-Single":this._modelType===bn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};bn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Ve.isNaN(t))return t;if(this._modelType===bn.FLOATING_SINGLE){var e=t;return e}return this._modelType===bn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof wt){var n=arguments[0];if(this._modelType===bn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};bn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===bn.FLOATING?t=16:this._modelType===bn.FLOATING_SINGLE?t=6:this._modelType===bn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};bn.prototype.setScale=function(t){this._scale=Math.abs(t)};bn.prototype.interfaces_=function(){return[Qo,Jo]};bn.prototype.getClass=function(){return bn};bn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};ry.serialVersionUID.get=function(){return 7777263578777804e3};ry.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(bn,ry);var Zs=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},oy={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Zs.prototype.readResolve=function(){return Zs.nameToTypeMap.get(this._name)};Zs.prototype.toString=function(){return this._name};Zs.prototype.interfaces_=function(){return[Qo]};Zs.prototype.getClass=function(){return Zs};oy.serialVersionUID.get=function(){return-552860263173159e4};oy.nameToTypeMap.get=function(){return new px};Object.defineProperties(Zs,oy);bn.Type=Zs;bn.FIXED=new Zs("FIXED");bn.FLOATING=new Zs("FLOATING");bn.FLOATING_SINGLE=new Zs("FLOATING SINGLE");var tn=function t(){this._precisionModel=new bn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ne(arguments[0],bh)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof bn&&(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]))},fx={serialVersionUID:{configurable:!0}};tn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new wt(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new wt(t.getMinX(),t.getMinY()),new wt(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new wt(t.getMinX(),t.getMinY()),new wt(t.getMinX(),t.getMaxY()),new wt(t.getMaxX(),t.getMaxY()),new wt(t.getMaxX(),t.getMinY()),new wt(t.getMinX(),t.getMinY())]),null)};tn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new ai(this.getCoordinateSequenceFactory().create(t),this);if(Ne(t,mn))return new ai(t,this)}else return new ai(this.getCoordinateSequenceFactory().create([]),this)};tn.prototype.createMultiLineString=function(){if(arguments.length===0)return new au(null,this);if(arguments.length===1){var t=arguments[0];return new au(t,this)}};tn.prototype.buildGeometry=function(t){for(var e=null,n=!1,i=!1,a=t.iterator();a.hasNext();){var c=a.next(),p=c.getClass();e===null&&(e=p),p!==e&&(n=!0),c.isGeometryCollectionOrDerived()&&(i=!0)}if(e===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(tn.toGeometryArray(t));var u=t.iterator().next(),b=t.size()>1;if(b){if(u instanceof Di)return this.createMultiPolygon(tn.toPolygonArray(t));if(u instanceof ai)return this.createMultiLineString(tn.toLineStringArray(t));if(u instanceof mo)return this.createMultiPoint(tn.toPointArray(t));Xe.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u};tn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};tn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof wt){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Ne(arguments[0],mn)){var e=arguments[0];return new mo(e,this)}}};tn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};tn.prototype.createPolygon=function(){if(arguments.length===0)return new Di(null,null,this);if(arguments.length===1){if(Ne(arguments[0],mn)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof da){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return new Di(i,a,this)}};tn.prototype.getSRID=function(){return this._SRID};tn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Nr(null,this);if(arguments.length===1){var t=arguments[0];return new Nr(t,this)}};tn.prototype.createGeometry=function(t){var e=new Yo(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};tn.prototype.getPrecisionModel=function(){return this._precisionModel};tn.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ne(arguments[0],mn)){var e=arguments[0];return new da(e,this)}}};tn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ha(null,this);if(arguments.length===1){var t=arguments[0];return new ha(t,this)}};tn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Th(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Th(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Ne(arguments[0],mn)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var a=new Array(i.size()).fill(null),c=0;c=this.size())throw new Error;return this.array_[t]};ta.prototype.push=function(t){return this.array_.push(t),t};ta.prototype.pop=function(t){if(this.array_.length===0)throw new Qm;return this.array_.pop()};ta.prototype.peek=function(){if(this.array_.length===0)throw new Qm;return this.array_[this.array_.length-1]};ta.prototype.empty=function(){return this.array_.length===0};ta.prototype.isEmpty=function(){return this.empty()};ta.prototype.search=function(t){return this.array_.indexOf(t)};ta.prototype.size=function(){return this.array_.length};ta.prototype.toArray=function(){for(var t=this,e=[],n=0,i=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===ce.CLOCKWISE)&&(a=!0),a&&(this._minIndex=this._minIndex-1)};Ws.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),i=n.getCoordinates();if(e<0||e+1>=i.length||i[e].y===i[e+1].y)return-1;var a=Xt.LEFT;return i[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=i,e._minCoord=n[i])};Ws.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};Ws.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&e.checkForRightmostCoordinate(i)}Xe.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 a=this.getRightmostSide(this._minDe,this._minIndex);a===Xt.LEFT&&(this._orientedDe=this._minDe.getSym())};Ws.prototype.interfaces_=function(){return[]};Ws.prototype.getClass=function(){return Ws};var ja=function(t){function e(n,i){t.call(this,e.msgWithCoord(n,i)),this.pt=i?new wt(i):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},e}(Ga),$m=function(){this.array_=[]};$m.prototype.addLast=function(t){this.array_.push(t)};$m.prototype.removeFirst=function(){return this.array_.shift()};$m.prototype.isEmpty=function(){return this.array_.length===0};var zr=function(){this._finder=null,this._dirEdgeList=new te,this._nodes=new te,this._rightMostCoord=null,this._env=null,this._finder=new Ws};zr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};zr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};zr.prototype.computeNodeDepth=function(t){for(var e=this,n=null,i=t.getEdges().iterator();i.hasNext();){var a=i.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new ja("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var c=t.getEdges().iterator();c.hasNext();){var p=c.next();p.setVisited(!0),e.copySymDepths(p)}};zr.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Xt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};zr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};zr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Xt.RIGHT)>=1&&e.getDepth(Xt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};zr.prototype.computeDepths=function(t){var e=this,n=new ey,i=new $m,a=t.getNode();for(i.addLast(a),n.add(a),t.setVisited(!0);!i.isEmpty();){var c=i.removeFirst();n.add(c),e.computeNodeDepth(c);for(var p=c.getEdges().iterator();p.hasNext();){var u=p.next(),b=u.getSym();if(!b.isVisited()){var w=b.getNode();n.contains(w)||(i.addLast(w),n.add(w))}}}};zr.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};zr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Se,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),i=n.getEdge().getCoordinates(),a=0;athis.location.length){var n=new Array(3).fill(null);n[Xt.ON]=this.location[Xt.ON],n[Xt.LEFT]=Lt.NONE,n[Xt.RIGHT]=Lt.NONE,this.location=n}for(var i=0;i1&&t.append(Lt.toLocationSymbol(this.location[Xt.LEFT])),t.append(Lt.toLocationSymbol(this.location[Xt.ON])),this.location.length>1&&t.append(Lt.toLocationSymbol(this.location[Xt.RIGHT])),t.toString()};Fn.prototype.setLocations=function(t,e,n){this.location[Xt.ON]=t,this.location[Xt.LEFT]=e,this.location[Xt.RIGHT]=n};Fn.prototype.get=function(t){return t1};Fn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=i),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};wi.prototype.addPoints=function(t,e,n){var i=this,a=t.getCoordinates();if(e){var c=1;n&&(c=0);for(var p=c;p=0;b--)i._pts.add(a[b])}};wi.prototype.isHole=function(){return this._isHole};wi.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};wi.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!ce.isPointInRing(t,e.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var a=i.next();if(a.containsPoint(t))return!1}return!0};wi.prototype.addHole=function(t){this._holes.add(t)};wi.prototype.isShell=function(){return this._shell===null};wi.prototype.getLabel=function(){return this._label};wi.prototype.getEdges=function(){return this._edges};wi.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};wi.prototype.getShell=function(){return this._shell};wi.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=e.getLocation(n,Xt.RIGHT);if(i===Lt.NONE)return null;if(this._label.getLocation(n)===Lt.NONE)return this._label.setLocation(n,i),null}};wi.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};wi.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(t)};Ao.prototype.isInResult=function(){return this._isInResult};Ao.prototype.isVisited=function(){return this._isVisited};Ao.prototype.interfaces_=function(){return[]};Ao.prototype.getClass=function(){return Ao};var tg=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new Sn(0,Lt.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,i){var a=Lt.NONE;if(a=this._label.getLocation(i),!n.isNull(i)){var c=n.getLocation(i);a!==Lt.BOUNDARY&&(a=c)}return a},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new Sn(n,i):this._label.setLocation(n,i)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Sn)for(var a=arguments[0],c=0;c<2;c++){var p=n.computeMergedLocation(a,c),u=n._label.getLocation(c);u===Lt.NONE&&n._label.setLocation(c,p)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=Lt.NONE;this._label!==null&&(i=this._label.getLocation(n));var a=null;switch(i){case Lt.BOUNDARY:a=Lt.INTERIOR;break;case Lt.INTERIOR:a=Lt.BOUNDARY;break;default:a=Lt.BOUNDARY;break}this._label.setLocation(n,a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ao),Hs=function(){this.nodeMap=new yr,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Hs.prototype.find=function(t){return this.nodeMap.get(t)};Hs.prototype.addNode=function(){if(arguments[0]instanceof wt){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof tg){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}};Hs.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Hs.prototype.iterator=function(){return this.nodeMap.values().iterator()};Hs.prototype.values=function(){return this.nodeMap.values()};Hs.prototype.getBoundaryNodes=function(t){for(var e=new te,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===Lt.BOUNDARY&&e.add(i)}return e};Hs.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};Hs.prototype.interfaces_=function(){return[]};Hs.prototype.getClass=function(){return Hs};var Ln=function(){},Kf={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Ln.prototype.interfaces_=function(){return[]};Ln.prototype.getClass=function(){return Ln};Ln.isNorthern=function(t){return t===Ln.NE||t===Ln.NW};Ln.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Ln.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var i=te?t:e;return i===0&&a===3?3:i};Ln.isInHalfPlane=function(t,e){return e===Ln.SE?t===Ln.SE||t===Ln.SW:t===e||t===e+1};Ln.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new Qn("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Ln.NE:Ln.SE:e>=0?Ln.NW:Ln.SW}else if(arguments[0]instanceof wt&&arguments[1]instanceof wt){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new Qn("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Ln.NE:Ln.SE:i.y>=n.y?Ln.NW:Ln.SW}};Kf.NE.get=function(){return 0};Kf.NW.get=function(){return 1};Kf.SW.get=function(){return 2};Kf.SE.get=function(){return 3};Object.defineProperties(Ln,Kf);var vr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],a=null;this._edge=e,this.init(n,i),this._label=a}else if(arguments.length===4){var c=arguments[0],p=arguments[1],u=arguments[2],b=arguments[3];this._edge=c,this.init(p,u),this._label=b}};vr.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){p.linkDirectedEdgesForMinimalEdgeRings();var u=p.buildMinimalRings(),b=i.findShell(u);b!==null?(i.placePolygonHoles(b,u),e.add(b)):n.addAll(u)}else a.add(p)}return a};go.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};go.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new te,i=t.iterator();i.hasNext();){var a=i.next();if(a.isInResult()&&a.getLabel().isArea()&&a.getEdgeRing()===null){var c=new rS(a,e._geometryFactory);n.add(c),c.setInResult()}}return n};go.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}};go.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};go.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),a=n.getCoordinateN(0),c=null,p=null,u=e.iterator();u.hasNext();){var b=u.next(),w=b.getLinearRing(),T=w.getEnvelopeInternal();c!==null&&(p=c.getLinearRing().getEnvelopeInternal());var P=!1;T.contains(i)&&ce.isPointInRing(a,w.getCoordinates())&&(P=!0),P&&(c===null||p.contains(T))&&(c=b)}return c};go.prototype.findShell=function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var a=i.next();a.isHole()||(n=a,e++)}return Xe.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};go.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];ii.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),a=new te,c=this.buildMinimalEdgeRings(i,this._shellList,a);this.sortShellsAndHoles(c,this._shellList,a),this.placeFreeHoles(this._shellList,a)}};go.prototype.interfaces_=function(){return[]};go.prototype.getClass=function(){return go};var Ph=function(){};Ph.prototype.getBounds=function(){};Ph.prototype.interfaces_=function(){return[]};Ph.prototype.getClass=function(){return Ph};var ms=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};ms.prototype.getItem=function(){return this._item};ms.prototype.getBounds=function(){return this._bounds};ms.prototype.interfaces_=function(){return[Ph,Qo]};ms.prototype.getClass=function(){return ms};var Za=function(){this._size=null,this._items=null,this._size=0,this._items=new te,this._items.add(null)};Za.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};Za.prototype.size=function(){return this._size};Za.prototype.reorder=function(t){for(var e=this,n=null,i=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(i)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,i)};Za.prototype.clear=function(){this._size=0,this._items.clear()};Za.prototype.isEmpty=function(){return this._size===0};Za.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)};Za.prototype.interfaces_=function(){return[]};Za.prototype.getClass=function(){return Za};var Sl=function(){};Sl.prototype.visitItem=function(t){};Sl.prototype.interfaces_=function(){return[]};Sl.prototype.getClass=function(){return Sl};var $u=function(){};$u.prototype.insert=function(t,e){};$u.prototype.remove=function(t,e){};$u.prototype.query=function(){};$u.prototype.interfaces_=function(){return[]};$u.prototype.getClass=function(){return $u};var ki=function(){if(this._childBoundables=new te,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},mx={serialVersionUID:{configurable:!0}};ki.prototype.getLevel=function(){return this._level};ki.prototype.size=function(){return this._childBoundables.size()};ki.prototype.getChildBoundables=function(){return this._childBoundables};ki.prototype.addChildBoundable=function(t){Xe.isTrue(this._bounds===null),this._childBoundables.add(t)};ki.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};ki.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};ki.prototype.interfaces_=function(){return[Ph,Qo]};ki.prototype.getClass=function(){return ki};mx.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(ki,mx);var gs=function(){};gs.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};gs.min=function(t){return gs.sort(t),t.get(0)};gs.sort=function(t,e){var n=t.toArray();e?ru.sort(n,e):ru.sort(n);for(var i=t.iterator(),a=0,c=n.length;axi.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Qn("neither boundable is composite")};xi.prototype.isLeaves=function(){return!(xi.isComposite(this._boundable1)||xi.isComposite(this._boundable2))};xi.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};xi.prototype.expand=function(t,e,n,i){for(var a=this,c=t.getChildBoundables(),p=c.iterator();p.hasNext();){var u=p.next(),b=new xi(u,e,a._itemDistance);b.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},eg={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Qi.prototype.getNodeCapacity=function(){return this._nodeCapacity};Qi.prototype.lastNode=function(t){return t.get(t.size()-1)};Qi.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,i=e.getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof ki?n+=t.size(a):a instanceof ms&&(n+=1)}return n}};Qi.prototype.removeItem=function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof ms&&a.getItem()===e&&(n=a)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};Qi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new te:e}else if(arguments.length===1){for(var n=arguments[0],i=new te,a=n.getChildBoundables().iterator();a.hasNext();){var c=a.next();if(c instanceof ki){var p=t.itemsTree(c);p!==null&&i.add(p)}else c instanceof ms?i.add(c.getItem()):Xe.shouldNeverReachHere()}return i.size()<=0?null:i}};Qi.prototype.insert=function(t,e){Xe.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ms(t,e))};Qi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new te;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];if(Xe.isTrue(i>-2),a.getLevel()===i)return c.add(a),null;for(var p=a.getChildBoundables().iterator();p.hasNext();){var u=p.next();u instanceof ki?t.boundablesAtLevel(i,u,c):(Xe.isTrue(u instanceof ms),i===-1&&c.add(u))}return null}};Qi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new te;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,a)}else if(arguments.length===3){if(Ne(arguments[2],Sl)&&arguments[0]instanceof Object&&arguments[1]instanceof ki)for(var c=arguments[0],p=arguments[1],u=arguments[2],b=p.getChildBoundables(),w=0;wn&&(n=c)}}return n+1}};Qi.prototype.createParentBoundables=function(t,e){var n=this;Xe.isTrue(!t.isEmpty());var i=new te;i.add(this.createNode(e));var a=new te(t);gs.sort(a,this.getComparator());for(var c=a.iterator();c.hasNext();){var p=c.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(e)),n.lastNode(i).addChildBoundable(p)}return i};Qi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};Qi.prototype.interfaces_=function(){return[Qo]};Qi.prototype.getClass=function(){return Qi};Qi.compareDoubles=function(t,e){return t>e?1:t0);for(var p=new te,u=0;u0;){var V=B.poll(),tt=V.getDistance();if(tt>=P)break;V.isLeaves()?(P=tt,k=V):V.expandToQueue(B,P)}return[k.getBoundable(0).getItem(),k.getBoundable(1).getItem()]}}else if(arguments.length===3){var ot=arguments[0],ut=arguments[1],W=arguments[2],X=new ms(ot,ut),J=new xi(this.getRoot(),X,W);return this.nearestNeighbour(J)[0]}},e.prototype.interfaces_=function(){return[$u,Qo]},e.prototype.getClass=function(){return e},e.centreX=function(i){return e.avg(i.getMinX(),i.getMaxX())},e.avg=function(i,a){return(i+a)/2},e.centreY=function(i){return e.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return Iv},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[xh]},compare:function(i,a){return t.compareDoubles(e.centreX(i.getBounds()),e.centreX(a.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[xh]},compare:function(i,a){return t.compareDoubles(e.centreY(i.getBounds()),e.centreY(a.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(i,a){return i.intersects(a)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Qi),Iv=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var a=i.next();n===null?n=new Se(a.getBounds()):n.expandToInclude(a.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ki),Kr=function(){};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};Kr.relativeSign=function(t,e){return te?1:0};Kr.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=Kr.relativeSign(e.x,n.x),a=Kr.relativeSign(e.y,n.y);switch(t){case 0:return Kr.compareValue(i,a);case 1:return Kr.compareValue(a,i);case 2:return Kr.compareValue(a,-i);case 3:return Kr.compareValue(-i,a);case 4:return Kr.compareValue(-i,-a);case 5:return Kr.compareValue(-a,-i);case 6:return Kr.compareValue(-a,i);case 7:return Kr.compareValue(i,-a)}return Xe.shouldNeverReachHere("invalid octant value"),0};Kr.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Cl=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new wt(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))};Cl.prototype.getCoordinate=function(){return this.coord};Cl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Cl.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:Kr.compare(this._segmentOctant,this.coord,e.coord)};Cl.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Cl.prototype.isInterior=function(){return this._isInterior};Cl.prototype.interfaces_=function(){return[Jo]};Cl.prototype.getClass=function(){return Cl};var Or=function(){this._nodeMap=new yr,this._edge=null;var t=arguments[0];this._edge=t};Or.prototype.getSplitCoordinates=function(){var t=this,e=new Xf;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next();t.addEdgeCoordinates(i,a,e),i=a}return e.toCoordinateArray()};Or.prototype.addCollapsedNodes=function(){var t=this,e=new te;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var i=n.next().intValue();t.add(t._edge.getCoordinate(i),i)}};Or.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Or.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof wt&&arguments[1]instanceof wt){var a=arguments[0],c=arguments[1],p=c.x-a.x,u=c.y-a.y;if(p===0&&u===0)throw new Qn("Cannot compute the octant for two identical points "+a);return tc.octant(p,u)}};var ga=function(){};ga.prototype.getCoordinates=function(){};ga.prototype.size=function(){};ga.prototype.getCoordinate=function(t){};ga.prototype.isClosed=function(){};ga.prototype.setData=function(t){};ga.prototype.getData=function(){};ga.prototype.interfaces_=function(){return[]};ga.prototype.getClass=function(){return ga};var Pf=function(){};Pf.prototype.addIntersection=function(t,e){};Pf.prototype.interfaces_=function(){return[ga]};Pf.prototype.getClass=function(){return Pf};var _i=function(){this._nodeList=new Or(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};_i.prototype.getCoordinates=function(){return this._pts};_i.prototype.size=function(){return this._pts.length};_i.prototype.getCoordinate=function(t){return this._pts[t]};_i.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};_i.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};_i.prototype.setData=function(t){this._data=t};_i.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:tc.octant(t,e)};_i.prototype.getData=function(){return this._data};_i.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],a=arguments[3],c=new wt(n.getIntersection(a));this.addIntersection(c,i)}};_i.prototype.toString=function(){return fs.toLineString(new di(this._pts))};_i.prototype.getNodeList=function(){return this._nodeList};_i.prototype.addIntersectionNode=function(t,e){var n=e,i=n+1;if(i=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof wt){var i=arguments[0];return ce.orientationIndex(this.p0,this.p1,i)}};Ce.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Ce.prototype.isVertical=function(){return this.p0.x===this.p1.x};Ce.prototype.equals=function(t){if(!(t instanceof Ce))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};Ce.prototype.intersection=function(t){var e=new gu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};Ce.prototype.project=function(){if(arguments[0]instanceof wt){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new wt(t);var e=this.projectionFactor(t),n=new wt;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof Ce){var i=arguments[0],a=this.projectionFactor(i.p0),c=this.projectionFactor(i.p1);if(a>=1&&c>=1||a<=0&&c<=0)return null;var p=this.project(i.p0);a<0&&(p=this.p0),a>1&&(p=this.p1);var u=this.project(i.p1);return c<0&&(u=this.p0),c>1&&(u=this.p1),new Ce(p,u)}};Ce.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Ce.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Ce.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Ce.prototype.distancePerpendicular=function(t){return ce.distancePointLinePerpendicular(t,this.p0,this.p1)};Ce.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Ce.prototype.midPoint=function(){return Ce.midPoint(this.p0,this.p1)};Ce.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;if(i<=0)return Ve.NaN;var a=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i;return a};Ce.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),i=Ve.MAX_VALUE,a=null,c=this.closestPoint(t.p0);i=c.distance(t.p0),n[0]=c,n[1]=t.p0;var p=this.closestPoint(t.p1);a=p.distance(t.p1),a0&&e<1)return this.project(t);var n=this.p0.distance(t),i=this.p1.distance(t);return n1||Ve.isNaN(e))&&(e=1),e};Ce.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Ce.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Ce.prototype.distance=function(){if(arguments[0]instanceof Ce){var t=arguments[0];return ce.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof wt){var e=arguments[0];return ce.distancePointLine(e,this.p0,this.p1)}};Ce.prototype.pointAlong=function(t){var e=new wt;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e};Ce.prototype.hashCode=function(){var t=Ve.doubleToLongBits(this.p0.x);t^=Ve.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=Ve.doubleToLongBits(this.p1.x);n^=Ve.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return e^i};Ce.prototype.interfaces_=function(){return[Jo,Qo]};Ce.prototype.getClass=function(){return Ce};Ce.midPoint=function(t,e){return new wt((t.x+e.x)/2,(t.y+e.y)/2)};_x.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Ce,_x);var Mf=function(){this.tempEnv1=new Se,this.tempEnv2=new Se,this._overlapSeg1=new Ce,this._overlapSeg2=new Ce};Mf.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Mf.prototype.interfaces_=function(){return[]};Mf.prototype.getClass=function(){return Mf};var _o=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i};_o.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};_o.prototype.computeSelect=function(t,e,n,i){var a=this._pts[e],c=this._pts[n];if(i.tempEnv1.init(a,c),n-e===1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var p=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var i=Ln.quadrant(t[n],t[n+1]),a=e+1;ap.getId()&&(p.computeOverlaps(w,a),i._nOverlaps++),i._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return Ev},Object.defineProperties(e,n),e}(Af),Ev=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3],p=n.getContext(),u=a.getContext();this._si.processIntersections(p,i,u,c)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Mf),xn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(arguments.length===4){var a=arguments[0],c=arguments[1],p=arguments[2],u=arguments[3];this.setQuadrantSegments(a),this.setEndCapStyle(c),this.setJoinStyle(p),this.setMitreLimit(u)}}},Ya={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}};xn.prototype.getEndCapStyle=function(){return this._endCapStyle};xn.prototype.isSingleSided=function(){return this._isSingleSided};xn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=xn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=xn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==xn.JOIN_ROUND&&(this._quadrantSegments=xn.DEFAULT_QUADRANT_SEGMENTS)};xn.prototype.getJoinStyle=function(){return this._joinStyle};xn.prototype.setJoinStyle=function(t){this._joinStyle=t};xn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};xn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};xn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};xn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};xn.prototype.getMitreLimit=function(){return this._mitreLimit};xn.prototype.setMitreLimit=function(t){this._mitreLimit=t};xn.prototype.setSingleSided=function(t){this._isSingleSided=t};xn.prototype.interfaces_=function(){return[]};xn.prototype.getClass=function(){return xn};xn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Ya.CAP_ROUND.get=function(){return 1};Ya.CAP_FLAT.get=function(){return 2};Ya.CAP_SQUARE.get=function(){return 3};Ya.JOIN_ROUND.get=function(){return 1};Ya.JOIN_MITRE.get=function(){return 2};Ya.JOIN_BEVEL.get=function(){return 3};Ya.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Ya.DEFAULT_MITRE_LIMIT.get=function(){return 5};Ya.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(xn,Ya);var li=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ce.COUNTERCLOCKWISE,this._inputLine=t||null},Jf={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};li.prototype.isDeletable=function(t,e,n,i){var a=this._inputLine[t],c=this._inputLine[e],p=this._inputLine[n];return!this.isConcave(a,c,p)||!this.isShallow(a,c,p,i)?!1:this.isShallowSampled(a,c,t,n,i)};li.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),i=this.findNextNonDeletedIndex(n),a=!1;i=0;a--)n.addPt(t[a])};ko.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return nMath.PI;)t-=pn.PI_TIMES_2;for(;t<=-Math.PI;)t+=pn.PI_TIMES_2;return t};pn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=n.x-e.x,a=n.y-e.y;return Math.atan2(a,i)}};pn.isAcute=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,c=n.x-e.x,p=n.y-e.y,u=i*c+a*p;return u>0};pn.isObtuse=function(t,e,n){var i=t.x-e.x,a=t.y-e.y,c=n.x-e.x,p=n.y-e.y,u=i*c+a*p;return u<0};pn.interiorAngle=function(t,e,n){var i=pn.angle(e,t),a=pn.angle(e,n);return Math.abs(a-i)};pn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=pn.PI_TIMES_2;t>=pn.PI_TIMES_2&&(t=0)}else{for(;t>=pn.PI_TIMES_2;)t-=pn.PI_TIMES_2;t<0&&(t=0)}return t};pn.angleBetween=function(t,e,n){var i=pn.angle(e,t),a=pn.angle(e,n);return pn.diff(i,a)};pn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};pn.toRadians=function(t){return t*Math.PI/180};pn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?pn.COUNTERCLOCKWISE:n<0?pn.CLOCKWISE:pn.NONE};pn.angleBetweenOriented=function(t,e,n){var i=pn.angle(e,t),a=pn.angle(e,n),c=a-i;return c<=-Math.PI?c+pn.PI_TIMES_2:c>Math.PI?c-pn.PI_TIMES_2:c};dc.PI_TIMES_2.get=function(){return 2*Math.PI};dc.PI_OVER_2.get=function(){return Math.PI/2};dc.PI_OVER_4.get=function(){return Math.PI/4};dc.COUNTERCLOCKWISE.get=function(){return ce.COUNTERCLOCKWISE};dc.CLOCKWISE.get=function(){return ce.CLOCKWISE};dc.NONE.get=function(){return ce.COLLINEAR};Object.defineProperties(pn,dc);var jn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Ce,this._seg1=new Ce,this._offset0=new Ce,this._offset1=new Ce,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new gu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===xn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)},Qf={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}};jn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ce.computeOrientation(this._s0,this._s1,this._s2),i=n===ce.CLOCKWISE&&this._side===Xt.LEFT||n===ce.COUNTERCLOCKWISE&&this._side===Xt.RIGHT;n===0?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};jn.prototype.addLineEndCap=function(t,e){var n=new Ce(t,e),i=new Ce;this.computeOffsetSegment(n,Xt.LEFT,this._distance,i);var a=new Ce;this.computeOffsetSegment(n,Xt.RIGHT,this._distance,a);var c=e.x-t.x,p=e.y-t.y,u=Math.atan2(p,c);switch(this._bufParams.getEndCapStyle()){case xn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(e,u+Math.PI/2,u-Math.PI/2,ce.CLOCKWISE,this._distance),this._segList.addPt(a.p1);break;case xn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(a.p1);break;case xn.CAP_SQUARE:var b=new wt;b.x=Math.abs(this._distance)*Math.cos(u),b.y=Math.abs(this._distance)*Math.sin(u);var w=new wt(i.p1.x+b.x,i.p1.y+b.y),T=new wt(a.p1.x+b.x,a.p1.y+b.y);this._segList.addPt(w),this._segList.addPt(T);break}};jn.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};jn.prototype.addMitreJoin=function(t,e,n,i){var a=!0,c=null;try{c=hs.intersection(e.p0,e.p1,n.p0,n.p1);var p=i<=0?1:c.distance(t)/Math.abs(i);p>this._bufParams.getMitreLimit()&&(a=!1)}catch(u){if(u instanceof Hh)c=new wt(0,0),a=!1;else throw u}finally{}a?this._segList.addPt(c):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())};jn.prototype.addFilletCorner=function(t,e,n,i,a){var c=e.x-t.x,p=e.y-t.y,u=Math.atan2(p,c),b=n.x-t.x,w=n.y-t.y,T=Math.atan2(w,b);i===ce.CLOCKWISE?u<=T&&(u+=2*Math.PI):u>=T&&(u-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,u,T,i,a),this._segList.addPt(n)};jn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new wt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new wt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};jn.prototype.createCircle=function(t){var e=new wt(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};jn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};jn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ko,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*jn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};jn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===xn.JOIN_BEVEL||this._bufParams.getJoinStyle()===xn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ce.CLOCKWISE,this._distance))};jn.prototype.closeRing=function(){this._segList.closeRing()};jn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};jn.prototype.interfaces_=function(){return[]};jn.prototype.getClass=function(){return jn};Qf.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Qf.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Qf.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Qf.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(jn,Qf);var Qr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Qr.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,i=Math.abs(e),a=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],a):this.computeOffsetCurve(t,n,a);var c=a.getCoordinates();return n&&rn.reverse(c),c};Qr.prototype.computeSingleSidedBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var a=li.simplify(t,-i),c=a.length-1;n.initSideSegments(a[c],a[c-1],Xt.LEFT),n.addFirstSegment();for(var p=c-2;p>=0;p--)n.addNextSegment(a[p],!0)}else{n.addSegments(t,!1);var u=li.simplify(t,i),b=u.length-1;n.initSideSegments(u[0],u[1],Xt.LEFT),n.addFirstSegment();for(var w=2;w<=b;w++)n.addNextSegment(u[w],!0)}n.addLastSegment(),n.closeRing()};Qr.prototype.computeRingBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);e===Xt.RIGHT&&(i=-i);var a=li.simplify(t,i),c=a.length-1;n.initSideSegments(a[c-1],a[0],e);for(var p=1;p<=c;p++){var u=p!==1;n.addNextSegment(a[p],u)}n.closeRing()};Qr.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),i=li.simplify(t,n),a=i.length-1;e.initSideSegments(i[0],i[1],Xt.LEFT);for(var c=2;c<=a;c++)e.addNextSegment(i[c],!0);e.addLastSegment(),e.addLineEndCap(i[a-1],i[a]);var p=li.simplify(t,-n),u=p.length-1;e.initSideSegments(p[u],p[u-1],Xt.LEFT);for(var b=u-2;b>=0;b--)e.addNextSegment(p[b],!0);e.addLastSegment(),e.addLineEndCap(p[1],p[0]),e.closeRing()};Qr.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case xn.CAP_ROUND:e.createCircle(t);break;case xn.CAP_SQUARE:e.createSquare(t);break}};Qr.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var a=e<0;this.computeSingleSidedBufferCurve(t,a,i)}else this.computeLineBufferCurve(t,i);var c=i.getCoordinates();return c};Qr.prototype.getBufferParameters=function(){return this._bufParams};Qr.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};Qr.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return Qr.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()};Qr.prototype.computeOffsetCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var a=li.simplify(t,-i),c=a.length-1;n.initSideSegments(a[c],a[c-1],Xt.LEFT),n.addFirstSegment();for(var p=c-2;p>=0;p--)n.addNextSegment(a[p],!0)}else{var u=li.simplify(t,i),b=u.length-1;n.initSideSegments(u[0],u[1],Xt.LEFT),n.addFirstSegment();for(var w=2;w<=b;w++)n.addNextSegment(u[w],!0)}n.addLastSegment()};Qr.prototype.getSegGen=function(t){return new jn(this._precisionModel,this._bufParams,t)};Qr.prototype.interfaces_=function(){return[]};Qr.prototype.getClass=function(){return Qr};Qr.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;nc.getMaxY()||t.findStabbedSegments(e,a.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Ne(arguments[2],ps)&&arguments[0]instanceof wt&&arguments[1]instanceof R_)for(var p=arguments[0],u=arguments[1],b=arguments[2],w=u.getEdge().getCoordinates(),T=0;Tt._seg.p1.y&&t._seg.reverse();var P=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(Pt._seg.p1.y)&&ce.computeOrientation(t._seg.p0,t._seg.p1,p)!==ce.RIGHT){var k=u.getDepth(Xt.LEFT);t._seg.p0.equals(w[T])||(k=u.getDepth(Xt.RIGHT));var B=new uu(t._seg,k);b.add(B)}}else if(Ne(arguments[2],ps)&&arguments[0]instanceof wt&&Ne(arguments[1],ps))for(var V=arguments[0],tt=arguments[1],ot=arguments[2],ut=tt.iterator();ut.hasNext();){var W=ut.next();W.isForward()&&t.findStabbedSegments(V,W,ot)}}};ec.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=gs.min(e);return n._leftDepth};ec.prototype.interfaces_=function(){return[]};ec.prototype.getClass=function(){return ec};vx.DepthSegment.get=function(){return uu};Object.defineProperties(ec,vx);var uu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Ce(t),this._leftDepth=e};uu.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)};uu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};uu.prototype.toString=function(){return this._upwardSeg.toString()};uu.prototype.interfaces_=function(){return[Jo]};uu.prototype.getClass=function(){return uu};var wn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};wn.prototype.area=function(){return wn.area(this.p0,this.p1,this.p2)};wn.prototype.signedArea=function(){return wn.signedArea(this.p0,this.p1,this.p2)};wn.prototype.interpolateZ=function(t){if(t===null)throw new Qn("Supplied point is null.");return wn.interpolateZ(t,this.p0,this.p1,this.p2)};wn.prototype.longestSideLength=function(){return wn.longestSideLength(this.p0,this.p1,this.p2)};wn.prototype.isAcute=function(){return wn.isAcute(this.p0,this.p1,this.p2)};wn.prototype.circumcentre=function(){return wn.circumcentre(this.p0,this.p1,this.p2)};wn.prototype.area3D=function(){return wn.area3D(this.p0,this.p1,this.p2)};wn.prototype.centroid=function(){return wn.centroid(this.p0,this.p1,this.p2)};wn.prototype.inCentre=function(){return wn.inCentre(this.p0,this.p1,this.p2)};wn.prototype.interfaces_=function(){return[]};wn.prototype.getClass=function(){return wn};wn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)};wn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};wn.det=function(t,e,n,i){return t*i-e*n};wn.interpolateZ=function(t,e,n,i){var a=e.x,c=e.y,p=n.x-a,u=i.x-a,b=n.y-c,w=i.y-c,T=p*w-u*b,P=t.x-a,k=t.y-c,B=(w*P-u*k)/T,V=(-b*P+p*k)/T,tt=e.z+B*(n.z-e.z)+V*(i.z-e.z);return tt};wn.longestSideLength=function(t,e,n){var i=t.distance(e),a=e.distance(n),c=n.distance(t),p=i;return a>p&&(p=a),c>p&&(p=c),p};wn.isAcute=function(t,e,n){return!(!pn.isAcute(t,e,n)||!pn.isAcute(e,n,t)||!pn.isAcute(n,t,e))};wn.circumcentre=function(t,e,n){var i=n.x,a=n.y,c=t.x-i,p=t.y-a,u=e.x-i,b=e.y-a,w=2*wn.det(c,p,u,b),T=wn.det(p,c*c+p*p,b,u*u+b*b),P=wn.det(c,c*c+p*p,u,u*u+b*b),k=i-T/w,B=a+P/w;return new wt(k,B)};wn.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=new hs(t.x+n/2,t.y+i/2,1),c=new hs(t.x-i+n/2,t.y+n+i/2,1);return new hs(a,c)};wn.angleBisector=function(t,e,n){var i=e.distance(t),a=e.distance(n),c=i/(i+a),p=n.x-t.x,u=n.y-t.y,b=new wt(t.x+c*p,t.y+c*u);return b};wn.area3D=function(t,e,n){var i=e.x-t.x,a=e.y-t.y,c=e.z-t.z,p=n.x-t.x,u=n.y-t.y,b=n.z-t.z,w=a*b-c*u,T=c*p-i*b,P=i*u-a*p,k=w*w+T*T+P*P,B=Math.sqrt(k)/2;return B};wn.centroid=function(t,e,n){var i=(t.x+e.x+n.x)/3,a=(t.y+e.y+n.y)/3;return new wt(i,a)};wn.inCentre=function(t,e,n){var i=e.distance(n),a=t.distance(n),c=t.distance(e),p=i+a+c,u=(i*t.x+a*e.x+c*n.x)/p,b=(i*t.y+a*e.y+c*n.y)/p;return new wt(u,b)};var Ko=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new te;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Ko.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Lt.EXTERIOR,Lt.INTERIOR)};Ko.prototype.addPolygon=function(t){var e=this,n=this._distance,i=Xt.LEFT;this._distance<0&&(n=-this._distance,i=Xt.RIGHT);var a=t.getExteriorRing(),c=rn.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,n,i,Lt.EXTERIOR,Lt.INTERIOR);for(var p=0;p0&&e.isErodedCompletely(u,-e._distance)||e.addPolygonRing(b,n,Xt.opposite(i),Lt.INTERIOR,Lt.EXTERIOR)}};Ko.prototype.isTriangleErodedCompletely=function(t,e){var n=new wn(t[0],t[1],t[2]),i=n.inCentre(),a=ce.distancePointLine(i,n.p0,n.p1);return a=da.MINIMUM_VALID_SIZE&&ce.isCCW(t)&&(c=a,p=i,n=Xt.opposite(n));var u=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(u,c,p)};Ko.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Di?this.addPolygon(t):t instanceof ai?this.addLineString(t):t instanceof mo?this.addPoint(t):t instanceof Th?this.addCollection(t):t instanceof au?this.addCollection(t):t instanceof ha?this.addCollection(t):t instanceof Nr&&this.addCollection(t)};Ko.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),a=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>a};Ko.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new Yh;var t=this._parent.getGeometryN(this._index++);return t instanceof Nr?(this._subcollectionIterator=new pa(t),this._subcollectionIterator.next()):t};pa.prototype.remove=function(){throw new Error(this.getClass().getName())};pa.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)};pa.prototype.interfaces_=function(){return[Xh]};pa.prototype.getClass=function(){return pa};pa.isAtomic=function(t){return!(t instanceof Nr)};var Lo=function(){this._geom=null;var t=arguments[0];this._geom=t};Lo.prototype.locate=function(t){return Lo.locate(t,this._geom)};Lo.prototype.interfaces_=function(){return[Ah]};Lo.prototype.getClass=function(){return Lo};Lo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?ce.isPointInRing(t,e.getCoordinates()):!1};Lo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Lo.isPointInRing(t,n))return!1;for(var i=0;i=0;c--){var p=n._edgeList.get(c),u=p.getSym();a===null&&(a=u),i!==null&&u.setNext(i),i=p}a.setNext(i)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],a=this.findIndex(i),c=i.getDepth(Xt.LEFT),p=i.getDepth(Xt.RIGHT),u=this.computeDepths(a+1,this._edgeList.size(),c),b=this.computeDepths(0,a,u);if(b!==p)throw new Za("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],T=arguments[1],P=arguments[2],k=P,B=w;B=0;u--){var b=i._resultAreaEdgeList.get(u),w=b.getSym();switch(a===null&&b.getEdgeRing()===n&&(a=b),p){case i._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;c=w,p=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(b.getEdgeRing()!==n)continue;c.setNextMin(b),p=i._SCANNING_FOR_INCOMING;break}}p===this._LINKING_TO_OUTGOING&&(Xe.isTrue(a!==null,"found null for first outgoing dirEdge"),Xe.isTrue(a.getEdgeRing()===n,"unable to link last incoming dirEdge"),c.setNextMin(a))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var a=i.next();a.isInResult()&&n++}return n}else if(arguments.length===1){for(var c=arguments[0],p=0,u=this.iterator();u.hasNext();){var b=u.next();b.getEdgeRing()===c&&p++}return p}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Lt.NONE,i=this.iterator();i.hasNext();){var a=i.next(),c=a.getSym();if(!a.isLineEdge()){if(a.isInResult()){n=Lt.INTERIOR;break}if(c.isInResult()){n=Lt.EXTERIOR;break}}}if(n===Lt.NONE)return null;for(var p=n,u=this.iterator();u.hasNext();){var b=u.next(),w=b.getSym();b.isLineEdge()?b.getEdge().setCovered(p===Lt.INTERIOR):(b.isInResult()&&(p=Lt.EXTERIOR),w.isInResult()&&(p=Lt.INTERIOR))}},e.prototype.computeLabelling=function(n){var i=this;t.prototype.computeLabelling.call(this,n),this._label=new Sn(Lt.NONE);for(var a=this.iterator();a.hasNext();)for(var c=a.next(),p=c.getEdge(),u=p.getLabel(),b=0;b<2;b++){var w=u.getLocation(b);(w===Lt.INTERIOR||w===Lt.BOUNDARY)&&i._label.setLocation(b,Lt.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xr),xx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new tg(n,new sS)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Lh),Tl=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Tl.prototype.compareTo=function(t){var e=t,n=Tl.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};Tl.prototype.interfaces_=function(){return[Jo]};Tl.prototype.getClass=function(){return Tl};Tl.orientation=function(t){return rn.increasingDirection(t)===1};Tl.compareOriented=function(t,e,n,i){for(var a=e?1:-1,c=i?1:-1,p=e?t.length:-1,u=i?n.length:-1,b=e?0:t.length-1,w=i?0:n.length-1;;){var T=t[b].compareTo(n[w]);if(T!==0)return T;b+=a,w+=c;var P=b===p,k=w===u;if(P&&!k)return-1;if(!P&&k)return 1;if(P&&k)return 0}};var _s=function(){this._edges=new te,this._ocaMap=new yr};_s.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var a=i.getCoordinates(),c=0;c0&&t.print(","),t.print(a[c].x+" "+a[c].y);t.println(")")}t.print(") ")};_s.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};_s.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(a);c||i--;var p=new Array(i).fill(null),u=0;p[u++]=new wt(t.coord);for(var b=t.segmentIndex+1;b<=e.segmentIndex;b++)p[u++]=n.edge.pts[b];return c&&(p[u]=e.coord),new Am(p,new Sn(this.edge._label))};_a.prototype.add=function(t,e,n){var i=new Xs(t,e,n),a=this._nodeMap.get(i);return a!==null?a:(this._nodeMap.put(i,i),i)};_a.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};_a.prototype.interfaces_=function(){return[]};_a.prototype.getClass=function(){return _a};var hu=function(){};hu.prototype.getChainStartIndices=function(t){var e=this,n=0,i=new te;i.add(new Gs(n));do{var a=e.findChainEnd(t,n);i.add(new Gs(a)),n=a}while(nn?e:n};Ha.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(a=1),t._depth[e][i]=a}}};lr.prototype.getDelta=function(t){return this._depth[t][Xt.RIGHT]-this._depth[t][Xt.LEFT]};lr.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Lt.EXTERIOR:Lt.INTERIOR};lr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};lr.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var a=e.getLocation(n,i);(a===Lt.EXTERIOR||a===Lt.INTERIOR)&&(t.isNull(n,i)?t._depth[n][i]=lr.depthAtLocation(a):t._depth[n][i]+=lr.depthAtLocation(a))}else if(arguments.length===3){var c=arguments[0],p=arguments[1],u=arguments[2];u===Lt.INTERIOR&&this._depth[c][p]++}};lr.prototype.interfaces_=function(){return[]};lr.prototype.getClass=function(){return lr};lr.depthAtLocation=function(t){return t===Lt.EXTERIOR?0:t===Lt.INTERIOR?1:lr.NULL_VALUE};bx.NULL_VALUE.get=function(){return-1};Object.defineProperties(lr,bx);var Am=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new _a(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new lr,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.pts=i,this._label=a}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new e(n,Sn.toLineLabel(this._label));return i},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var i=this;if(!(n instanceof e))return!1;var a=n;if(this.pts.length!==a.pts.length)return!1;for(var c=!0,p=!0,u=this.pts.length,b=0;b0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var a=0;a0&&n.print(","),n.print(i.pts[a].x+" "+i.pts[a].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var a=this.pts.length-1;a>=0;a--)n.print(i.pts[a]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ha(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Se;for(var i=0;i0&&i.append(","),i.append(n.pts[a].x+" "+n.pts[a].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},e.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var a=0;ai||this._maxyc;if(p)return!1;var u=this.intersectsToleranceSquare(t,e);return Xe.isTrue(!(p&&u),"Found bad envelope test"),u};$r.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new wt(this._maxx,this._maxy),this._corner[1]=new wt(this._minx,this._maxy),this._corner[2]=new wt(this._minx,this._miny),this._corner[3]=new wt(this._maxx,this._miny)};$r.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};$r.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};$r.prototype.getCoordinate=function(){return this._originalPt};$r.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};$r.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=$r.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Se(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};$r.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};$r.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||t.equals(this._pt)||e.equals(this._pt))};$r.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return this.intersects(n,i)?(t.addIntersection(this.getCoordinate(),e),!0):!1};$r.prototype.interfaces_=function(){return[]};$r.prototype.getClass=function(){return $r};Ix.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties($r,Ix);var kf=function(){this.tempEnv1=new Se,this.selectedSegment=new Ce};kf.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};kf.prototype.interfaces_=function(){return[]};kf.prototype.getClass=function(){return kf};var kh=function(){this._index=null;var t=arguments[0];this._index=t},Ex={HotPixelSnapAction:{configurable:!0}};kh.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],a=e.getSafeEnvelope(),c=new Sx(e,n,i);return this._index.query(a,{interfaces_:function(){return[Sl]},visitItem:function(p){var u=p;u.select(a,c)}}),c.isNodeAdded()}};kh.prototype.interfaces_=function(){return[]};kh.prototype.getClass=function(){return kh};Ex.HotPixelSnapAction.get=function(){return Sx};Object.defineProperties(kh,Ex);var Sx=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],a=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],a=n.getContext();if(this._parentEdge!==null&&a===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(a,i)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kf),nc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new te};nc.prototype.processIntersections=function(t,e,n,i){var a=this;if(t===n&&e===i)return null;var c=t.getCoordinates()[e],p=t.getCoordinates()[e+1],u=n.getCoordinates()[i],b=n.getCoordinates()[i+1];if(this._li.computeIntersection(c,p,u,b),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(c){if(c instanceof Za)t._saveException=c;else throw c}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=ar.precisionScaleFactor(this._argGeom,this._distance,n),a=new bn(i);this.bufferFixedPrecision(a)}};ar.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===bn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};ar.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};ar.prototype.bufferOriginalPrecision=function(){try{var t=new Dr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof qa)this._saveException=e;else throw e}finally{}};ar.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};ar.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};ar.prototype.interfaces_=function(){return[]};ar.prototype.getClass=function(){return ar};ar.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ar(t),i=n.getResultGeometry(e);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof De&&typeof arguments[1]=="number"){var a=arguments[0],c=arguments[1],p=arguments[2],u=new ar(a);u.setQuadrantSegments(p);var b=u.getResultGeometry(c);return b}else if(arguments[2]instanceof xn&&arguments[0]instanceof De&&typeof arguments[1]=="number"){var w=arguments[0],T=arguments[1],P=arguments[2],k=new ar(w,P),B=k.getResultGeometry(T);return B}}else if(arguments.length===4){var V=arguments[0],tt=arguments[1],ot=arguments[2],ut=arguments[3],W=new ar(V);W.setQuadrantSegments(ot),W.setEndCapStyle(ut);var X=W.getResultGeometry(tt);return X}};ar.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),a=Mo.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),c=e>0?e:0,p=a+2*c,u=Math.trunc(Math.log(p)/Math.log(10)+1),b=n-u,w=Math.pow(10,b);return w};Kh.CAP_ROUND.get=function(){return xn.CAP_ROUND};Kh.CAP_BUTT.get=function(){return xn.CAP_FLAT};Kh.CAP_FLAT.get=function(){return xn.CAP_FLAT};Kh.CAP_SQUARE.get=function(){return xn.CAP_SQUARE};Kh.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(ar,Kh);var Mr=function(){this._pt=[new wt,new wt],this._distance=Ve.NaN,this._isNull=!0};Mr.prototype.getCoordinates=function(){return this._pt};Mr.prototype.getCoordinate=function(t){return this._pt[t]};Mr.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);ithis._distance&&this.initialize(e,n,i)}};Mr.prototype.interfaces_=function(){return[]};Mr.prototype.getClass=function(){return Mr};var ua=function(){};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};ua.computeDistance=function(){if(arguments[2]instanceof Mr&&arguments[0]instanceof ai&&arguments[1]instanceof wt)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),a=new Ce,c=0;c0||this._isIn?Lt.INTERIOR:Lt.EXTERIOR)};ys.prototype.interfaces_=function(){return[]};ys.prototype.getClass=function(){return ys};var Ar=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];this._component=i,this._segIndex=a,this._pt=c}},Cx={INSIDE_AREA:{configurable:!0}};Ar.prototype.isInsideArea=function(){return this._segIndex===Ar.INSIDE_AREA};Ar.prototype.getCoordinate=function(){return this._pt};Ar.prototype.getGeometryComponent=function(){return this._component};Ar.prototype.getSegmentIndex=function(){return this._segIndex};Ar.prototype.interfaces_=function(){return[]};Ar.prototype.getClass=function(){return Ar};Cx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Ar,Cx);var bl=function(t){this._pts=t||null};bl.prototype.filter=function(t){t instanceof mo&&this._pts.add(t)};bl.prototype.interfaces_=function(){return[js]};bl.prototype.getClass=function(){return bl};bl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof mo?gs.singletonList(t):bl.getPoints(t,new te)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof mo?n.add(e):e instanceof Nr&&e.apply(new bl(n)),n}};var rc=function(){this._locations=null;var t=arguments[0];this._locations=t};rc.prototype.filter=function(t){(t instanceof mo||t instanceof ai||t instanceof Di)&&this._locations.add(new Ar(t,0,t.getCoordinate()))};rc.prototype.interfaces_=function(){return[js]};rc.prototype.getClass=function(){return rc};rc.getLocations=function(t){var e=new te;return t.apply(new rc(e)),e};var cr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ys,this._minDistanceLocation=null,this._minDistance=Ve.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],a=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=a}};cr.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=1-n,c=Ua.getPolygons(this._geom[n]);if(c.size()>0){var p=rc.getLocations(this._geom[a]);if(this.computeContainmentDistance(p,c,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[a]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ne(arguments[0],ps)&&Ne(arguments[1],ps)){for(var u=arguments[0],b=arguments[1],w=arguments[2],T=0;Tthis._minDistance)return null;for(var a=e.getCoordinates(),c=n.getCoordinate(),p=0;pthis._minDistance)return null;for(var B=T.getCoordinates(),V=P.getCoordinates(),tt=0;ttthis._distance&&this.initialize(e,n,i)}};_r.prototype.interfaces_=function(){return[]};_r.prototype.getClass=function(){return _r};var ks=function(){};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};ks.computeDistance=function(){if(arguments[2]instanceof _r&&arguments[0]instanceof ai&&arguments[1]instanceof wt)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new Ce,a=t.getCoordinates(),c=0;c1||t<=0)throw new Qn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};Zo.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};Zo.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};Zo.prototype.computeOrientedDistance=function(t,e,n){var i=new oc(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var a=new Ml(e,this._densifyFrac);t.apply(a),n.setMaximum(a.getMaxPointDistance())}};Zo.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};Zo.prototype.interfaces_=function(){return[]};Zo.prototype.getClass=function(){return Zo};Zo.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Zo(t,e);return n.distance()}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2],p=new Zo(i,a);return p.setDensifyFraction(c),p.distance()}};uy.MaxPointDistanceFilter.get=function(){return oc};uy.MaxDensifiedByFractionDistanceFilter.get=function(){return Ml};Object.defineProperties(Zo,uy);var oc=function(){this._maxPtDist=new _r,this._minPtDist=new _r,this._euclideanDist=new ks,this._geom=null;var t=arguments[0];this._geom=t};oc.prototype.filter=function(t){this._minPtDist.initialize(),ks.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};oc.prototype.getMaxPointDistance=function(){return this._maxPtDist};oc.prototype.interfaces_=function(){return[fa]};oc.prototype.getClass=function(){return oc};var Ml=function(){this._maxPtDist=new _r,this._minPtDist=new _r,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Ml.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var i=t.getCoordinate(e-1),a=t.getCoordinate(e),c=(a.x-i.x)/this._numSubSegs,p=(a.y-i.y)/this._numSubSegs,u=0;un){this._isValid=!1;var a=i.getCoordinates();this._errorLocation=a[1],this._errorIndicator=t.getFactory().createLineString(a),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+fs.toLineString(a[0],a[1])+")"}};po.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=po.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),po.VERBOSE&&ur.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};po.prototype.checkNegativeValid=function(){if(!(this._input instanceof Di||this._input instanceof ha||this._input instanceof Nr))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};po.prototype.getErrorIndicator=function(){return this._errorIndicator};po.prototype.checkMinimumDistance=function(t,e,n){var i=new cr(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};hr.prototype.report=function(t){if(!hr.VERBOSE)return null;ur.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};hr.prototype.getErrorMessage=function(){return this._errorMsg};hr.prototype.interfaces_=function(){return[]};hr.prototype.getClass=function(){return hr};hr.isValidMsg=function(t,e,n){var i=new hr(t,e,n);return i.isValid()?null:i.getErrorMessage()};hr.isValid=function(t,e,n){var i=new hr(t,e,n);return!!i.isValid()};hy.VERBOSE.get=function(){return!1};hy.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(hr,hy);var Ks=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ks.prototype.getCoordinates=function(){return this._pts};Ks.prototype.size=function(){return this._pts.length};Ks.prototype.getCoordinate=function(t){return this._pts[t]};Ks.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ks.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:tc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};Ks.prototype.setData=function(t){this._data=t};Ks.prototype.getData=function(){return this._data};Ks.prototype.toString=function(){return fs.toLineString(new di(this._pts))};Ks.prototype.interfaces_=function(){return[ga]};Ks.prototype.getClass=function(){return Ks};var $i=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new te,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};$i.prototype.getInteriorIntersection=function(){return this._interiorIntersection};$i.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};$i.prototype.getIntersectionSegments=function(){return this._intSegments};$i.prototype.count=function(){return this._intersectionCount};$i.prototype.getIntersections=function(){return this._intersections};$i.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};$i.prototype.setKeepIntersections=function(t){this._keepIntersections=t};$i.prototype.processIntersections=function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly){var a=this.isEndSegment(t,e)||this.isEndSegment(n,i);if(!a)return null}var c=t.getCoordinates()[e],p=t.getCoordinates()[e+1],u=n.getCoordinates()[i],b=n.getCoordinates()[i+1];this._li.computeIntersection(c,p,u,b),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=p,this._intSegments[2]=u,this._intSegments[3]=b,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};$i.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};$i.prototype.hasIntersection=function(){return this._interiorIntersection!==null};$i.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};$i.prototype.interfaces_=function(){return[cu]};$i.prototype.getClass=function(){return $i};$i.createAllIntersectionsFinder=function(t){var e=new $i(t);return e.setFindAllIntersections(!0),e};$i.createAnyIntersectionFinder=function(t){return new $i(t)};$i.createIntersectionCounter=function(t){var e=new $i(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var vs=function(){this._li=new gu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};vs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};vs.prototype.getIntersections=function(){return this._segInt.getIntersections()};vs.prototype.isValid=function(){return this.execute(),this._isValid};vs.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};vs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new $i(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ay;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};vs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Za(this.getErrorMessage(),this._segInt.getInteriorIntersection())};vs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fs.toLineString(t[0],t[1])+" and "+fs.toLineString(t[2],t[3])};vs.prototype.interfaces_=function(){return[]};vs.prototype.getClass=function(){return vs};vs.computeIntersections=function(t){var e=new vs(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var fu=function t(){this._nv=null;var e=arguments[0];this._nv=new vs(t.toSegmentStrings(e))};fu.prototype.checkValid=function(){this._nv.checkValid()};fu.prototype.interfaces_=function(){return[]};fu.prototype.getClass=function(){return fu};fu.toSegmentStrings=function(t){for(var e=new te,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ks(i.getCoordinates(),i))}return e};fu.checkValid=function(t){var e=new fu(t);e.checkValid()};var sc=function(t){this._mapOp=t};sc.prototype.map=function(t){for(var e=this,n=new te,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};to.prototype.interfaces_=function(){return[]};to.prototype.getClass=function(){return to};var va=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ce,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof ai&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1];this._srcPts=i,this._isClosed=t.isClosed(i),this._snapTolerance=a}};va.prototype.snapVertices=function(t,e){for(var n=this,i=this._isClosed?t.size()-1:t.size(),a=0;a=0&&t.add(p+1,new wt(c),!1)}};va.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,i=Ve.MAX_VALUE,a=-1,c=0;ce&&(e=i)}return e}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return Math.min(mi.computeOverlaySnapTolerance(a),mi.computeOverlaySnapTolerance(c))}};mi.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),i=n*mi.SNAP_PRECISION_FACTOR;return i};mi.snapToSelf=function(t,e,n){var i=new mi(t);return i.snapToSelf(e,n)};Tx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(mi,Tx);var Lx=function(t){function e(n,i,a){t.call(this),this._snapTolerance=n||null,this._snapPts=i||null,this._isSelfSnap=a!==void 0?a:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,i){var a=new va(n,this._snapTolerance);return a.setAllowSnappingToSourceVertices(this._isSelfSnap),a.snapTo(i)},e.prototype.transformCoordinates=function(n,i){var a=n.toCoordinateArray(),c=this.snapLine(a,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(c)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(to),Pr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Pr.prototype.getCommon=function(){return Ve.longBitsToDouble(this._commonBits)};Pr.prototype.add=function(t){var e=Ve.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Pr.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Pr.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Pr.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Pr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Pr.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Ve.longBitsToDouble(t),n=Ve.toBinaryString(t),i="0000000000000000000000000000000000000000000000000000000000000000"+n,a=i.substring(i.length-64),c=a.substring(0,1)+" "+a.substring(1,12)+"(exp) "+a.substring(12)+" [ "+e+" ]";return c}};Pr.prototype.interfaces_=function(){return[]};Pr.prototype.getClass=function(){return Pr};Pr.getBit=function(t,e){var n=1<>52};Pr.zeroLowerBits=function(t,e){var n=(1<=0;i--){if(Pr.getBit(t,i)!==Pr.getBit(e,i))return n;n++}return 52};var Al=function(){this._commonCoord=null,this._ccFilter=new lc},py={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Al.prototype.addCommonBits=function(t){var e=new kl(this._commonCoord);t.apply(e),t.geometryChanged()};Al.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new wt(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new kl(e);return t.apply(n),t.geometryChanged(),t};Al.prototype.getCommonCoordinate=function(){return this._commonCoord};Al.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Al.prototype.interfaces_=function(){return[]};Al.prototype.getClass=function(){return Al};py.CommonCoordinateFilter.get=function(){return lc};py.Translater.get=function(){return kl};Object.defineProperties(Al,py);var lc=function(){this._commonBitsX=new Pr,this._commonBitsY=new Pr};lc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};lc.prototype.getCommonCoordinate=function(){return new wt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};lc.prototype.interfaces_=function(){return[fa]};lc.prototype.getClass=function(){return lc};var kl=function(){this.trans=null;var t=arguments[0];this.trans=t};kl.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)};kl.prototype.isDone=function(){return!1};kl.prototype.isGeometryChanged=function(){return!0};kl.prototype.interfaces_=function(){return[ds]};kl.prototype.getClass=function(){return kl};var tr=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};tr.prototype.selfSnap=function(t){var e=new mi(t),n=e.snapTo(t,this._snapTolerance);return n};tr.prototype.removeCommonBits=function(t){this._cbr=new Al,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};tr.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};tr.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=We.overlayOp(e[0],e[1],t);return this.prepareResult(n)};tr.prototype.checkValid=function(t){t.isValid()||ur.out.println("Snapped geometry is invalid")};tr.prototype.computeSnapTolerance=function(){this._snapTolerance=mi.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};tr.prototype.snap=function(t){var e=this.removeCommonBits(t),n=mi.snap(e[0],e[1],this._snapTolerance);return n};tr.prototype.interfaces_=function(){return[]};tr.prototype.getClass=function(){return tr};tr.overlayOp=function(t,e,n){var i=new tr(t,e);return i.getResultGeometry(n)};tr.union=function(t,e){return tr.overlayOp(t,e,We.UNION)};tr.intersection=function(t,e){return tr.overlayOp(t,e,We.INTERSECTION)};tr.symDifference=function(t,e){return tr.overlayOp(t,e,We.SYMDIFFERENCE)};tr.difference=function(t,e){return tr.overlayOp(t,e,We.DIFFERENCE)};var Fr=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Fr.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=We.overlayOp(this._geom[0],this._geom[1],t);var a=!0;a&&(n=!0)}catch(c){if(c instanceof qa)i=c;else throw c}finally{}if(!n)try{e=tr.overlayOp(this._geom[0],this._geom[1],t)}catch(c){throw c instanceof qa?i:c}finally{}return e};Fr.prototype.interfaces_=function(){return[]};Fr.prototype.getClass=function(){return Fr};Fr.overlayOp=function(t,e,n){var i=new Fr(t,e);return i.getResultGeometry(n)};Fr.union=function(t,e){return Fr.overlayOp(t,e,We.UNION)};Fr.intersection=function(t,e){return Fr.overlayOp(t,e,We.INTERSECTION)};Fr.symDifference=function(t,e){return Fr.overlayOp(t,e,We.SYMDIFFERENCE)};Fr.difference=function(t,e){return Fr.overlayOp(t,e,We.DIFFERENCE)};var Df=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Df.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Df.prototype.interfaces_=function(){return[]};Df.prototype.getClass=function(){return Df};var yo=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];this._eventType=t.INSERT,this._label=i,this._xValue=a,this._obj=c}},fy={INSERT:{configurable:!0},DELETE:{configurable:!0}};yo.prototype.isDelete=function(){return this._eventType===yo.DELETE};yo.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};yo.prototype.getObject=function(){return this._obj};yo.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};yo.prototype.getInsertEvent=function(){return this._insertEvent};yo.prototype.isInsert=function(){return this._eventType===yo.INSERT};yo.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};yo.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};yo.prototype.interfaces_=function(){return[Jo]};yo.prototype.getClass=function(){return yo};fy.INSERT.get=function(){return 1};fy.DELETE.get=function(){return 2};Object.defineProperties(yo,fy);var km=function(){};km.prototype.interfaces_=function(){return[]};km.prototype.getClass=function(){return km};var pr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};pr.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(pr.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var a=t.getNumPoints()-1;if(e===0&&i===a||i===0&&e===a)return!0}}return!1};pr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};pr.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};pr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};pr.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next(),a=i.getCoordinate();if(t.isIntersection(a))return!0}return!1};pr.prototype.hasProperIntersection=function(){return this._hasProper};pr.prototype.hasIntersection=function(){return this._hasIntersection};pr.prototype.isDone=function(){return this._isDone};pr.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};pr.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};pr.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],p=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(a,c,p,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};pr.prototype.interfaces_=function(){return[]};pr.prototype.getClass=function(){return pr};pr.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var aS=function(t){function e(){t.call(this),this.events=new te,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;gs.sort(this.events);for(var i=0;ie||this._maxc?1:0};Rf.prototype.interfaces_=function(){return[xh]};Rf.prototype.getClass=function(){return Rf};var lS=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],i=arguments[1],a=arguments[2];this._min=n,this._max=i,this._item=a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,i,a){if(!this.intersects(n,i))return null;a.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xa),uS=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],i=arguments[1];this._node1=n,this._node2=i,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},e.prototype.query=function(n,i,a){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,a),this._node2!==null&&this._node2.query(n,i,a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xa),ba=function(){this._leaves=new te,this._root=null,this._level=0};ba.prototype.buildTree=function(){var t=this;gs.sort(this._leaves,new xa.NodeComparator);for(var e=this._leaves,n=null,i=new te;;){if(t.buildLevel(e,i),i.size()===1)return i.get(0);n=e,e=i,i=n}};ba.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new lS(t,e,n))};ba.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};ba.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ba.prototype.printNode=function(t){ur.out.println(fs.toLineString(new wt(t._min,this._level),new wt(t._max,this._level)))};ba.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ba.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),a=0,c=n.iterator();c.hasNext();){var p=c.next();i[a++]=p.getCoordinate().copy()}return i},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,i,a){if(this.isBoundaryNode(n,i))return null;a===Lt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,a)},e.prototype.addPolygonRing=function(n,i,a){if(n.isEmpty())return null;var c=rn.removeRepeatedPoints(n.getCoordinates());if(c.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=c[0],null;var p=i,u=a;ce.isCCW(c)&&(p=a,u=i);var b=new Am(c,new Sn(this._argIndex,Lt.BOUNDARY,p,u));this._lineEdgeMap.put(n,b),this.insertEdge(b),this.insertPoint(this._argIndex,c[0],Lt.BOUNDARY)},e.prototype.insertPoint=function(n,i,a){var c=this._nodes.addNode(i),p=c.getLabel();p===null?c._label=new Sn(n,a):p.setLocation(n,a)},e.prototype.createEdgeSetIntersector=function(){return new aS},e.prototype.addSelfIntersectionNodes=function(n){for(var i=this,a=this._edges.iterator();a.hasNext();)for(var c=a.next(),p=c.getLabel().getLocation(n),u=c.eiList.iterator();u.hasNext();){var b=u.next();i.addSelfIntersectionNode(n,b.coord,p)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof ha&&(this._useBoundaryDeterminationRule=!1),n instanceof Di)this.addPolygon(n);else if(n instanceof ai)this.addLineString(n);else if(n instanceof mo)this.addPoint(n);else if(n instanceof Th)this.addCollection(n);else if(n instanceof au)this.addCollection(n);else if(n instanceof ha)this.addCollection(n);else if(n instanceof Nr)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var i=this,a=0;a50?(this._areaPtLocator===null&&(this._areaPtLocator=new Rh(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,i){return n.isInBoundary(i)?Lt.BOUNDARY:Lt.INTERIOR},e}(ii),zh=function(){if(this._li=new gu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new tf(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=Xo.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tf(0,e,i),this._arg[1]=new tf(1,n,i)}else if(arguments.length===3){var a=arguments[0],c=arguments[1],p=arguments[2];a.getPrecisionModel().compareTo(c.getPrecisionModel())>=0?this.setComputationPrecision(a.getPrecisionModel()):this.setComputationPrecision(c.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tf(0,a,p),this._arg[1]=new tf(1,c,p)}};zh.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};zh.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};zh.prototype.interfaces_=function(){return[]};zh.prototype.getClass=function(){return zh};var ou=function(){};ou.prototype.interfaces_=function(){return[]};ou.prototype.getClass=function(){return ou};ou.map=function(){if(arguments[0]instanceof De&&Ne(arguments[1],ou.MapOp)){for(var t=arguments[0],e=arguments[1],n=new te,i=0;i=t.size()?null:t.get(e)};bi.union=function(t){var e=new bi(t);return e.union()};Ax.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(bi,Ax);var Dm=function(){};Dm.prototype.interfaces_=function(){return[]};Dm.prototype.getClass=function(){return Dm};Dm.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return We.createEmptyResult(We.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Fr.overlayOp(t,e,We.UNION)};function _u(){return new Rm}function Rm(){this.reset()}Rm.prototype={constructor:Rm,reset:function(){this.s=this.t=0},add:function(t){Sv(um,t,this.t),Sv(this,um.s,this.s),this.s?this.t+=um.t:this.s=um.t},valueOf:function(){return this.s}};var um=new Rm;function Sv(t,e,n){var i=t.s=e+n,a=i-e,c=i-a;t.t=e-c+(n-a)}var si=1e-6,kn=Math.PI,Va=kn/2,Cv=kn/4,Xa=kn*2,eu=180/kn,Ms=kn/180,kr=Math.abs,cS=Math.atan,Fh=Math.atan2,Mi=Math.cos,Ai=Math.sin,Jh=Math.sqrt;function kx(t){return t>1?0:t<-1?kn:Math.acos(t)}function uc(t){return t>1?Va:t<-1?-Va:Math.asin(t)}function uf(){}function Nm(t,e){t&&Lv.hasOwnProperty(t.type)&&Lv[t.type](t,e)}var Tv={Feature:function(t,e){Nm(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,a=n.length;++ikn?t-Xa:t<-kn?t+Xa:t,e]}F_.invert=F_;function pS(t,e,n){return(t%=Xa)?e||n?Dx(Av(t),kv(e,n)):Av(t):e||n?kv(e,n):F_}function Mv(t){return function(e,n){return e+=t,[e>kn?e-Xa:e<-kn?e+Xa:e,n]}}function Av(t){var e=Mv(t);return e.invert=Mv(-t),e}function kv(t,e){var n=Mi(t),i=Ai(t),a=Mi(e),c=Ai(e);function p(u,b){var w=Mi(b),T=Mi(u)*w,P=Ai(u)*w,k=Ai(b),B=k*n+T*i;return[Fh(P*a-B*c,T*n-k*i),uc(B*a+P*c)]}return p.invert=function(u,b){var w=Mi(b),T=Mi(u)*w,P=Ai(u)*w,k=Ai(b),B=k*a-P*c;return[Fh(P*a+k*c,T*n+B*i),uc(B*n-T*i)]},p}function fS(t,e,n,i,a,c){if(n){var p=Mi(e),u=Ai(e),b=i*n;a==null?(a=e+i*Xa,c=e-b/2):(a=Dv(p,a),c=Dv(p,c),(i>0?ac)&&(a+=i*Xa));for(var w,T=a;i>0?T>c:T1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function dS(t,e,n,i,a,c){var p=t[0],u=t[1],b=e[0],w=e[1],T=0,P=1,k=b-p,B=w-u,V;if(V=n-p,!(!k&&V>0)){if(V/=k,k<0){if(V0){if(V>P)return;V>T&&(T=V)}if(V=a-p,!(!k&&V<0)){if(V/=k,k<0){if(V>P)return;V>T&&(T=V)}else if(k>0){if(V0)){if(V/=B,B<0){if(V0){if(V>P)return;V>T&&(T=V)}if(V=c-u,!(!B&&V<0)){if(V/=B,B<0){if(V>P)return;V>T&&(T=V)}else if(B>0){if(V0&&(t[0]=p+T*k,t[1]=u+T*B),P<1&&(e[0]=p+P*k,e[1]=u+P*B),!0}}}}}function _m(t,e){return kr(t[0]-e[0])=0;--u)a.point((P=T[u])[0],P[1]);else i(k.x,k.p.x,-1,a);k=k.p}k=k.o,T=k.z,B=!B}while(!k.v);a.lineEnd()}}}function Rv(t){if(e=t.length){for(var e,n=0,i=t[0],a;++ne?1:t>=e?0:NaN}function mS(t){return t.length===1&&(t=gS(t)),{left:function(e,n,i,a){for(i==null&&(i=0),a==null&&(a=e.length);i>>1;t(e[c],n)<0?i=c+1:a=c}return i},right:function(e,n,i,a){for(i==null&&(i=0),a==null&&(a=e.length);i>>1;t(e[c],n)>0?a=c:i=c+1}return i}}}function gS(t){return function(e,n){return zx(t(e),n)}}mS(zx);function Ox(t){for(var e=t.length,n,i=-1,a=0,c,p;++i=0;)for(p=t[e],n=p.length;--n>=0;)c[--a]=p[n];return c}var cf=1e9,fm=-cf;function _S(t,e,n,i){function a(w,T){return t<=w&&w<=n&&e<=T&&T<=i}function c(w,T,P,k){var B=0,V=0;if(w==null||(B=p(w,P))!==(V=p(T,P))||b(w,T)<0^P>0)do k.point(B===0||B===3?t:n,B>1?i:e);while((B=(B+P+4)%4)!==V);else k.point(T[0],T[1])}function p(w,T){return kr(w[0]-t)0?0:3:kr(w[0]-n)0?2:1:kr(w[1]-e)0?1:0:T>0?3:2}function u(w,T){return b(w.x,T.x)}function b(w,T){var P=p(w,1),k=p(T,1);return P!==k?P-k:P===0?T[1]-w[1]:P===1?w[0]-T[0]:P===2?w[1]-T[1]:T[0]-w[0]}return function(w){var T=w,P=Rx(),k,B,V,tt,ot,ut,W,X,J,ht,vt,gt={point:St,lineStart:Ct,lineEnd:ie,polygonStart:Ft,polygonEnd:mt};function St(ee,ge){a(ee,ge)&&T.point(ee,ge)}function It(){for(var ee=0,ge=0,Te=B.length;gei&&(qn-Me)*(i-Rn)>(Zn-Rn)*(t-Me)&&++ee:Zn<=i&&(qn-Me)*(i-Rn)<(Zn-Rn)*(t-Me)&&--ee;return ee}function Ft(){T=P,k=[],B=[],vt=!0}function mt(){var ee=It(),ge=vt&&ee,Te=(k=Ox(k)).length;(ge||Te)&&(w.polygonStart(),ge&&(w.lineStart(),c(null,null,1,w),w.lineEnd()),Te&&Nx(k,u,ee,c,w),w.polygonEnd()),T=w,k=B=V=null}function Ct(){gt.point=Tt,B&&B.push(V=[]),ht=!0,J=!1,W=X=NaN}function ie(){k&&(Tt(tt,ot),ut&&J&&P.rejoin(),k.push(P.result())),gt.point=St,J&&T.lineEnd()}function Tt(ee,ge){var Te=a(ee,ge);if(B&&V.push([ee,ge]),ht)tt=ee,ot=ge,ut=Te,ht=!1,Te&&(T.lineStart(),T.point(ee,ge));else if(Te&&J)T.point(ee,ge);else{var Oe=[W=Math.max(fm,Math.min(cf,W)),X=Math.max(fm,Math.min(cf,X))],on=[ee=Math.max(fm,Math.min(cf,ee)),ge=Math.max(fm,Math.min(cf,ge))];dS(Oe,on,t,e,n,i)?(J||(T.lineStart(),T.point(Oe[0],Oe[1])),T.point(on[0],on[1]),Te||T.lineEnd(),vt=!1):Te&&(T.lineStart(),T.point(ee,ge),vt=!1)}W=ee,X=ge,J=Te}return gt}}var d_=_u();function yS(t,e){var n=e[0],i=e[1],a=[Ai(n),-Mi(n),0],c=0,p=0;d_.reset();for(var u=0,b=t.length;u=0?1:-1,St=gt*vt,It=St>kn,Ft=V*J;if(d_.add(Fh(Ft*gt*Ai(St),tt*ht+Ft*Mi(St))),c+=It?vt+gt*Xa:vt,It^k>=n^W>=n){var mt=zm(Bh(P),Bh(ut));O_(mt);var Ct=zm(a,mt);O_(Ct);var ie=(It^vt>=0?-1:1)*uc(Ct[2]);(i>ie||i===ie&&(mt[0]||mt[1]))&&(p+=It^vt>=0?1:-1)}}return(c<-si||cNf&&(Nf=t),eFm&&(Fm=e)}_u();function Fx(t,e,n,i){return function(a,c){var p=e(c),u=a.invert(i[0],i[1]),b=Rx(),w=e(b),T=!1,P,k,B,V={point:tt,lineStart:ut,lineEnd:W,polygonStart:function(){V.point=X,V.lineStart=J,V.lineEnd=ht,k=[],P=[]},polygonEnd:function(){V.point=tt,V.lineStart=ut,V.lineEnd=W,k=Ox(k);var vt=yS(P,u);k.length?(T||(c.polygonStart(),T=!0),Nx(k,bS,vt,n,c)):vt&&(T||(c.polygonStart(),T=!0),c.lineStart(),n(null,null,1,c),c.lineEnd()),T&&(c.polygonEnd(),T=!1),k=P=null},sphere:function(){c.polygonStart(),c.lineStart(),n(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function tt(vt,gt){var St=a(vt,gt);t(vt=St[0],gt=St[1])&&c.point(vt,gt)}function ot(vt,gt){var St=a(vt,gt);p.point(St[0],St[1])}function ut(){V.point=ot,p.lineStart()}function W(){V.point=tt,p.lineEnd()}function X(vt,gt){B.push([vt,gt]);var St=a(vt,gt);w.point(St[0],St[1])}function J(){w.lineStart(),B=[]}function ht(){X(B[0][0],B[0][1]),w.lineEnd();var vt=w.clean(),gt=b.result(),St,It=gt.length,Ft,mt,Ct;if(B.pop(),P.push(B),B=null,!!It){if(vt&1){if(mt=gt[0],(Ft=mt.length-1)>0){for(T||(c.polygonStart(),T=!0),c.lineStart(),St=0;St1&&vt&2&>.push(gt.pop().concat(gt.shift())),k.push(gt.filter(xS))}}return V}}function xS(t){return t.length>1}function bS(t,e){return((t=t.x)[0]<0?t[1]-Va-si:Va-t[1])-((e=e.x)[0]<0?e[1]-Va-si:Va-e[1])}const Ov=Fx(function(){return!0},wS,ES,[-kn,-Va]);function wS(t){var e=NaN,n=NaN,i=NaN,a;return{lineStart:function(){t.lineStart(),a=1},point:function(c,p){var u=c>0?kn:-kn,b=kr(c-e);kr(b-kn)0?Va:-Va),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(c,n),a=0):i!==u&&b>=kn&&(kr(e-i)si?cS((Ai(e)*(c=Mi(i))*Ai(n)-Ai(i)*(a=Mi(e))*Ai(t))/(a*c*p)):(e+i)/2}function ES(t,e,n,i){var a;if(t==null)a=n*Va,i.point(-kn,a),i.point(0,a),i.point(kn,a),i.point(kn,0),i.point(kn,-a),i.point(0,-a),i.point(-kn,-a),i.point(-kn,0),i.point(-kn,a);else if(kr(t[0]-e[0])>si){var c=t[0]0,a=kr(n)>si;function c(T,P,k,B){fS(B,t,e,k,T,P)}function p(T,P){return Mi(T)*Mi(P)>n}function u(T){var P,k,B,V,tt;return{lineStart:function(){V=B=!1,tt=1},point:function(ot,ut){var W=[ot,ut],X,J=p(ot,ut),ht=i?J?0:w(ot,ut):J?w(ot+(ot<0?kn:-kn),ut):0;if(!P&&(V=B=J)&&T.lineStart(),J!==B&&(X=b(P,W),(!X||_m(P,X)||_m(W,X))&&(W[0]+=si,W[1]+=si,J=p(W[0],W[1]))),J!==B)tt=0,J?(T.lineStart(),X=b(W,P),T.point(X[0],X[1])):(X=b(P,W),T.point(X[0],X[1]),T.lineEnd()),P=X;else if(a&&P&&i^J){var vt;!(ht&k)&&(vt=b(W,P,!0))&&(tt=0,i?(T.lineStart(),T.point(vt[0][0],vt[0][1]),T.point(vt[1][0],vt[1][1]),T.lineEnd()):(T.point(vt[1][0],vt[1][1]),T.lineEnd(),T.lineStart(),T.point(vt[0][0],vt[0][1])))}J&&(!P||!_m(P,W))&&T.point(W[0],W[1]),P=W,B=J,k=ht},lineEnd:function(){B&&T.lineEnd(),P=null},clean:function(){return tt|(V&&B)<<1}}}function b(T,P,k){var B=Bh(T),V=Bh(P),tt=[1,0,0],ot=zm(B,V),ut=cm(ot,ot),W=ot[0],X=ut-W*W;if(!X)return!k&&T;var J=n*ut/X,ht=-n*W/X,vt=zm(tt,ot),gt=hm(tt,J),St=hm(ot,ht);f_(gt,St);var It=vt,Ft=cm(gt,It),mt=cm(It,It),Ct=Ft*Ft-mt*(cm(gt,gt)-1);if(!(Ct<0)){var ie=Jh(Ct),Tt=hm(It,(-Ft-ie)/mt);if(f_(Tt,gt),Tt=z_(Tt),!k)return Tt;var ee=T[0],ge=P[0],Te=T[1],Oe=P[1],on;ge0^Tt[1]<(kr(Tt[0]-ee)kn^(ee<=Tt[0]&&Tt[0]<=ge)){var Rn=hm(It,(-Ft+ie)/mt);return f_(Rn,gt),[Tt,z_(Rn)]}}}function w(T,P){var k=i?t:kn-t,B=0;return T<-k?B|=1:T>k&&(B|=2),P<-k?B|=4:P>k&&(B|=8),B}return Fx(p,u,c,i?[0,-t]:[-kn,t-kn])}function Bx(t){return function(e){var n=new B_;for(var i in t)n[i]=t[i];return n.stream=e,n}}function B_(){}B_.prototype={constructor:B_,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Vx(t,e,n){var i=e[1][0]-e[0][0],a=e[1][1]-e[0][1],c=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),c!=null&&t.clipExtent(null),hS(n,t.stream(zv));var p=zv.result(),u=Math.min(i/(p[1][0]-p[0][0]),a/(p[1][1]-p[0][1])),b=+e[0][0]+(i-u*(p[1][0]+p[0][0]))/2,w=+e[0][1]+(a-u*(p[1][1]+p[0][1]))/2;return c!=null&&t.clipExtent(c),t.scale(u*150).translate([b,w])}function CS(t,e,n){return Vx(t,[[0,0],e],n)}var Fv=16,TS=Mi(30*Ms);function Bv(t,e){return+e?PS(t,e):LS(t)}function LS(t){return Bx({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function PS(t,e){function n(i,a,c,p,u,b,w,T,P,k,B,V,tt,ot){var ut=w-i,W=T-a,X=ut*ut+W*W;if(X>4*e&&tt--){var J=p+k,ht=u+B,vt=b+V,gt=Jh(J*J+ht*ht+vt*vt),St=uc(vt/=gt),It=kr(kr(vt)-1)e||kr((ut*ie+W*Tt)/X-.5)>.3||p*k+u*B+b*V2?Tt[2]%360*Ms:0,Ct()):[w*eu,T*eu,P*eu]},It.precision=function(Tt){return arguments.length?(vt=Bv(mt,ht=Tt*Tt),ie()):Jh(ht)},It.fitExtent=function(Tt,ee){return Vx(It,Tt,ee)},It.fitSize=function(Tt,ee){return CS(It,Tt,ee)};function Ct(){B=Dx(k=pS(w,T,P),e);var Tt=e(u,b);return c=i-Tt[0]*n,p=a+Tt[1]*n,ie()}function ie(){return gt=St=null,It}return function(){return e=t.apply(this,arguments),It.invert=e.invert&&Ft,Ct()}}function Ux(t){return function(e,n){var i=Mi(e),a=Mi(n),c=t(i*a);return[c*a*Ai(e),c*Ai(n)]}}function Gx(t){return function(e,n){var i=Jh(e*e+n*n),a=t(i),c=Ai(a),p=Mi(a);return[Fh(e*c,i*p),uc(i&&n*c/i)]}}var DS=Ux(function(t){return Jh(2/(1+t))});DS.invert=Gx(function(t){return 2*uc(t/2)});var qx=Ux(function(t){return(t=kx(t))&&t/Ai(t)});qx.invert=Gx(function(t){return t});function RS(){return AS(qx).scale(79.4188).clipAngle(180-.001)}function Vv(t,e){return[t,e]}Vv.invert=Vv;function NS(t,e,n){n=n||{};var i=n.units||"kilometers",a=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof a!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(a<=0)throw new Error("steps must be greater than 0");var c=[];switch(t.type){case"GeometryCollection":return rx(t,function(p){var u=ym(p,e,i,a);u&&c.push(u)}),k_(c);case"FeatureCollection":return xv(t,function(p){var u=ym(p,e,i,a);u&&xv(u,function(b){b&&c.push(b)})}),k_(c)}return ym(t,e,i,a)}function ym(t,e,n,i){var a=t.properties||{},c=t.type==="Feature"?t.geometry:t;if(c.type==="GeometryCollection"){var p=[];return rx(t,function(tt){var ot=ym(tt,e,n,i);ot&&p.push(ot)}),k_(p)}var u=zS(c),b={type:c.type,coordinates:Zx(c.coordinates,u)},w=new sy,T=w.read(b),P=qE(jE(e,n),"meters"),k=ar.bufferOp(T,P,i),B=new dx;if(k=B.write(k),!jx(k.coordinates)){var V={type:k.type,coordinates:Wx(k.coordinates,u)};return qm(V,a)}}function jx(t){return Array.isArray(t[0])?jx(t[0]):isNaN(t[0])}function Zx(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return Zx(n,e)})}function Wx(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return Wx(n,e)})}function zS(t){var e=WE(t).geometry.coordinates,n=[-e[0],-e[1]];return RS().rotate(n).scale(Co)}function OS(t,e){var n=Lm(t),i=Lm(e),a=t.properties||{},c=$1.difference(n.coordinates,i.coordinates);return c.length===0?null:c.length===1?ex(c[0],a):nx(c,a)}function Uv(t){let e;for(const n of t)e&&n[0]-e[0]>=180?n[0]-=360:e&&n[0]-e[0]<-180&&(n[0]+=360),e=n}function Gv(t,e){const n=OS({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const i=NS(t,0);if(i.geometry.type==="Polygon")for(const a of i.geometry.coordinates)Uv(a);else for(const a of i.geometry.coordinates)for(const c of a)Uv(c);e({type:"FeatureCollection",features:[i,n]})}let qv={type:"FeatureCollection",features:[]};function FS(t,e,n=!0,i=!0,a={},c={},p={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,b=[],w,T;function P(){(p!=null&&p.fill||p!=null&&p.line)&&t.addSource("full-geom",{type:"geojson",data:qv}),p!=null&&p.fill&&t.addLayer({...p==null?void 0:p.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),p!=null&&p.line&&t.addLayer({...p==null?void 0:p.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?P():t.once("load",()=>{P()});const k=V=>{u==null||u({type:"mapClick",coordinates:[V.lngLat.lng,V.lngLat.lat]})};function B(V=!1){if(!e)throw new Error;const tt=document.createElement("div");return V&&tt.classList.add("marker-interactive"),new fE({props:{displayIn:"maplibre"},target:tt}),new e.Marker({element:tt,offset:[1,-13]})}return{setEventHandler(V){V?(u=V,t.on("click",k)):(u=void 0,t.off("click",k))},flyTo(V,tt){t.flyTo({center:V,zoom:tt,...a})},fitBounds(V,tt,ot){t.fitBounds([[V[0],V[1]],[V[2],V[3]]],{padding:tt,maxZoom:ot,...c})},indicateReverse(V){t.getCanvasContainer().style.cursor=V?"crosshair":""},setReverseMarker(V){!e||!n||(T?V?T.setLngLat(V):(T.remove(),T=void 0):V&&(T=(typeof n=="object"?new e.Marker(n):B()).setLngLat(V).addTo(t),T.getElement().classList.add("marker-reverse")))},setMarkers(V,tt){if(!n)return;function ot(ut){var W;(W=t.getSource("full-geom"))==null||W.setData(ut)}for(const ut of b)ut.remove();if(b.length=0,ot(qv),!!e){if(tt){let ut=!1;if(tt.geometry.type==="GeometryCollection"){const W=tt.geometry.geometries.filter(X=>X.type==="Polygon"||X.type==="MultiPolygon");if(W.length>0){let X=W.pop();for(const J of W)X=ZE(X,J);Gv({...tt,geometry:X},ot),ut=!0}else{const X=tt.geometry.geometries.filter(J=>J.type==="LineString"||J.type==="MultiLineString");X.length>0&&(ot({...tt,geometry:{type:"GeometryCollection",geometries:X}}),ut=!0)}}if(!ut){if(tt.geometry.type==="Polygon"||tt.geometry.type==="MultiPolygon")Gv(tt,ot);else if(tt.geometry.type==="LineString"||tt.geometry.type==="MultiLineString"){ot(tt);return}}n&&b.push((typeof n=="object"?new e.Marker(n):B()).setLngLat(tt.center).addTo(t))}if(i)for(const ut of V??[]){if(ut===tt)continue;const W=(typeof i=="object"?new e.Marker(i):B(!0)).setLngLat(ut.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(ut.place_type[0]==="reverse"?ut.place_name:ut.place_name.replace(/,.*/,""))).addTo(t),X=W.getElement();X.addEventListener("click",J=>{J.stopPropagation(),u==null||u({type:"markerClick",id:ut.id})}),X.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:ut.id}),W.togglePopup()}),X.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:ut.id}),W.togglePopup()}),b.push(W)}}},setSelectedMarker(V){w&&w.getElement().classList.toggle("marker-selected",!1),w=V>-1?b[V]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const V=t.getCenter();return[t.getZoom(),V.lng,V.lat]}}}function BS(t){let e,n;return{c(){e=vl("svg"),n=vl("path"),zt(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"),zt(e,"viewBox","0 0 14 14"),zt(e,"width","13"),zt(e,"height","13"),zt(e,"class","svelte-en2qvf")},m(i,a){fe(i,e,a),Zt(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&pe(e)}}}class Hx extends Tn{constructor(e){super(),Cn(this,e,null,BS,In,{})}}function VS(t){let e,n;return{c(){e=vl("svg"),n=vl("path"),zt(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"),zt(e,"viewBox","0 0 30 30"),zt(e,"fill","none"),zt(e,"xmlns","http://www.w3.org/2000/svg"),zt(e,"class","svelte-d2loi5")},m(i,a){fe(i,e,a),Zt(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&pe(e)}}}class Xx extends Tn{constructor(e){super(),Cn(this,e,null,VS,In,{})}}function US(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"area.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"area.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function GS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"reverse.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"reverse.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function qS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"poi.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"poi.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function jS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"postal_code.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"postal_code.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function ZS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"street.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"street.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function WS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"road.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"road.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function HS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"housenumber.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"housenumber.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function XS(t){let e,n,i,a;return{c(){e=se("img"),fo(e.src,n=t[5])||zt(e,"src",n),zt(e,"alt",t[4]),zt(e,"class","svelte-ltkwvy")},m(c,p){fe(c,e,p),i||(a=un(e,"error",t[14]),i=!0)},p(c,p){p&32&&!fo(e.src,n=c[5])&&zt(e,"src",n),p&16&&zt(e,"alt",c[4])},d(c){c&&pe(e),i=!1,a()}}}function jv(t){let e,n;return{c(){e=se("span"),n=Dn(t[6]),zt(e,"class","secondary svelte-ltkwvy")},m(i,a){fe(i,e,a),Zt(e,n)},p(i,a){a&64&&Ga(n,i[6])},d(i){i&&pe(e)}}}function YS(t){var gt,St;let e,n,i,a,c,p,u,b,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",T,P,k=t[2]==="always"||t[2]&&!t[0].address&&((gt=t[0].properties)==null?void 0:gt.kind)!=="road"&&((St=t[0].properties)==null?void 0:St.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],B,V,tt=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",ot,ut,W;function X(It,Ft){var mt,Ct;return Ft&1&&(n=null),Ft&1&&(i=null),Ft&1&&(a=null),It[5]?XS:It[0].address?HS:((mt=It[0].properties)==null?void 0:mt.kind)==="road"||((Ct=It[0].properties)==null?void 0:Ct.kind)==="road_relation"?WS:(n==null&&(n=!!It[0].id.startsWith("address.")),n?ZS:(i==null&&(i=!!It[0].id.startsWith("postal_code.")),i?jS:(a==null&&(a=!!It[0].id.startsWith("poi.")),a?qS:It[7]?GS:US)))}let J=X(t,-1),ht=J(t),vt=k&&jv(t);return{c(){e=se("li"),ht.c(),c=qe(),p=se("span"),u=se("span"),b=se("span"),T=Dn(w),P=qe(),vt&&vt.c(),B=qe(),V=se("span"),ot=Dn(tt),zt(b,"class","primary svelte-ltkwvy"),zt(u,"class","svelte-ltkwvy"),zt(V,"class","line2 svelte-ltkwvy"),zt(p,"class","texts svelte-ltkwvy"),zt(e,"tabindex","0"),zt(e,"data-selected",t[1]),zt(e,"class","svelte-ltkwvy"),Ba(e,"selected",t[1])},m(It,Ft){fe(It,e,Ft),ht.m(e,null),Zt(e,c),Zt(e,p),Zt(p,u),Zt(u,b),Zt(b,T),Zt(u,P),vt&&vt.m(u,null),Zt(p,B),Zt(p,V),Zt(V,ot),ut||(W=[un(e,"mouseenter",t[12]),un(e,"focus",t[13])],ut=!0)},p(It,[Ft]){var mt,Ct;J===(J=X(It,Ft))&&ht?ht.p(It,Ft):(ht.d(1),ht=J(It),ht&&(ht.c(),ht.m(e,c))),Ft&1&&w!==(w=(It[7]?It[0].place_name:It[0].place_name.replace(/,.*/,""))+"")&&Ga(T,w),Ft&37&&(k=It[2]==="always"||It[2]&&!It[0].address&&((mt=It[0].properties)==null?void 0:mt.kind)!=="road"&&((Ct=It[0].properties)==null?void 0:Ct.kind)!=="road_relation"&&!It[0].id.startsWith("address.")&&!It[0].id.startsWith("postal_code.")&&(!It[0].id.startsWith("poi.")||!It[5])&&!It[7]),k?vt?vt.p(It,Ft):(vt=jv(It),vt.c(),vt.m(u,null)):vt&&(vt.d(1),vt=null),Ft&1&&tt!==(tt=(It[7]?"":It[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Ga(ot,tt),Ft&2&&zt(e,"data-selected",It[1]),Ft&2&&Ba(e,"selected",It[1])},i:Ye,o:Ye,d(It){It&&pe(e),ht.d(),vt&&vt.d(),ut=!1,eo(W)}}}function KS(t,e,n){var X;let i,a,{feature:c}=e,{selected:p=!1}=e,{showPlaceType:u}=e,{missingIconsCache:b}=e,{iconsBaseUrl:w}=e;const T=(X=c.properties)==null?void 0:X.categories;let P,k,B=0,V=c.place_type[0]==="reverse";function tt(J){k&&b.add(k),n(10,B++,B)}function ot(J){Ji.call(this,t,J)}function ut(J){Ji.call(this,t,J)}const W=J=>tt(J.currentTarget);return t.$$set=J=>{"feature"in J&&n(0,c=J.feature),"selected"in J&&n(1,p=J.selected),"showPlaceType"in J&&n(2,u=J.showPlaceType),"missingIconsCache"in J&&n(9,b=J.missingIconsCache),"iconsBaseUrl"in J&&n(3,w=J.iconsBaseUrl)},t.$$.update=()=>{var J,ht,vt,gt;if(t.$$.dirty&3640)do n(11,i--,i),n(4,P=T==null?void 0:T[i]),n(5,k=P?w+P.replace(/ /g,"_")+".svg":void 0);while(i>-1&&(!k||b.has(k)));t.$$.dirty&1&&n(6,a=c.id.startsWith("poi.")?(ht=(J=c.properties)==null?void 0:J.categories)==null?void 0:ht.join(", "):((gt=(vt=c.properties)==null?void 0:vt.place_type_name)==null?void 0:gt[0])??c.place_type[0])},n(11,i=(T==null?void 0:T.length)??0),[c,p,u,w,P,k,a,V,tt,b,B,i,ot,ut,W]}class JS extends Tn{constructor(e){super(),Cn(this,e,KS,YS,In,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function QS(t){let e;return{c(){e=se("div"),e.innerHTML='',zt(e,"class","svelte-7cmwmc")},m(n,i){fe(n,e,i)},p:Ye,i:Ye,o:Ye,d(n){n&&pe(e)}}}class $S extends Tn{constructor(e){super(),Cn(this,e,null,QS,In,{})}}function tC(t){let e,n;return{c(){e=vl("svg"),n=vl("path"),zt(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"),zt(e,"viewBox","0 0 60.006 21.412"),zt(e,"width","14"),zt(e,"height","20"),zt(e,"class","svelte-en2qvf")},m(i,a){fe(i,e,a),Zt(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&pe(e)}}}class eC extends Tn{constructor(e){super(),Cn(this,e,null,tC,In,{})}}function nC(t){let e,n,i;return{c(){e=vl("svg"),n=vl("circle"),i=vl("path"),zt(n,"cx","4.789"),zt(n,"cy","4.787"),zt(n,"r","3.85"),ju(n,"stroke-width","1.875"),ju(n,"fill","none"),zt(i,"d","M12.063 12.063 7.635 7.635"),ju(i,"stroke-width","1.875"),ju(i,"stroke-linecap","round"),zt(e,"xmlns","http://www.w3.org/2000/svg"),zt(e,"width","13"),zt(e,"height","13"),zt(e,"viewBox","0 0 13 13"),zt(e,"class","svelte-1bpbt60")},m(a,c){fe(a,e,c),Zt(e,n),Zt(e,i)},p:Ye,i:Ye,o:Ye,d(a){a&&pe(e)}}}class iC extends Tn{constructor(e){super(),Cn(this,e,null,nC,In,{})}}function rC(t,e,n){const i=e[1],a=e[0],c=i-a;return t===i&&n?t:((t-a)%c+c)%c+a}function Zv(t){const e=[...t];return e[2]i[0]||a.maxZoom!=null&&a.maxZoomDate.now()){if(!ef.coords)break t;return ef.coords}let c;try{return c=await new Promise((p,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(b=>{p([b.coords.longitude,b.coords.latitude].map(w=>w.toFixed(6)).join(","))},b=>{u(b)},a)}),c}catch{}finally{a.cachedLocationExpiry&&(ef={time:Date.now(),coords:c})}if(n.signal.aborted)return}if(a.type==="server-geolocation")return"ip";if(i&&a.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}const Wv=/(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,Hv=/(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,Xv=/(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,Yv=/(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 sC(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(p=>Number(p.trim()));let n=Kv(e[0],t),i=Kv(e[1],t);n.endsWith('.0"')&&i.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),i=i.replace(/\.0"$/,'"'));const a=e[0]>=0?" N":" S",c=e[1]>=0?" E":" W";return`${n+a}, ${i+c}`}else throw new Error("no decimal coordinates to convert")}function Kv(t,e){const n=Math.abs(t),i=Math.floor(n),a=(n-i)*60;if(e=="DM"){let u=aC(a,3).toFixed(3).padStart(6,"0");return`${i}° ${u}'`}let c=Math.floor(a),p=((a-c)*60).toFixed(1).padStart(4,"0");return c=c.toString().padStart(2,"0"),`${i}° ${c}' ${p}"`}function aC(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function my(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,i=null,a="",c="",p=[],u=!1;if(Wv.test(t))if(p=Wv.exec(t),u=dm(p),u){if(n=p[2],i=p[6],n.includes(",")&&(n=n.replace(",",".")),i.includes(",")&&(i=i.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(i))==Number(i))throw new Error("integer only coordinate provided");p[1]?(a=p[1],c=p[5]):p[4]&&(a=p[4],c=p[8])}else throw new Error("invalid decimal coordinate format");else if(Hv.test(t))if(p=Hv.exec(t),u=dm(p),u)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6].replace(",",".")/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[9])),p[11]&&(i+=p[11]/60),p[13]&&(i+=p[13].replace(",",".")/3600),parseInt(p[9])<0&&(i=-1*i),p[1]?(a=p[1],c=p[8]):p[7]&&(a=p[7],c=p[14]);else throw new Error("invalid DMS coordinates format");else if(Xv.test(t))if(p=Xv.exec(t),u=dm(p),u)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(a=p[1],c=p[9]):p[8]&&(a=p[8],c=p[16]);else throw new Error("invalid DMS coordinates format");else if(Yv.test(t))if(p=Yv.exec(t),u=dm(p),u)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(a=p[1],c=p[9]):p[8]&&(a=p[8],c=p[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(i)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((a||c)&&(!a||!c))throw new Error("invalid coordinates format");if(a&&a==c)throw new Error("invalid coordinates format");let b=/S|SOUTH/i;b.test(a)&&n>0&&(n=-1*n),b=/W|WEST/i,b.test(c)&&i>0&&(i=-1*i);const w=p[0].trim();let T,P;const k=/[,/;\u0020]/g,B=w.match(k);if(B==null){const ot=Math.floor(t.length/2);T=w.substring(0,ot).trim(),P=w.substring(ot).trim()}else{let ot;B.length%2==1?ot=Math.floor(B.length/2):ot=B.length/2-1;let ut=0;if(ot==0)ut=w.indexOf(B[0]),T=w.substring(0,ut).trim(),P=w.substring(ut+1).trim();else{let W=0,X=0;for(;W<=ot;)ut=w.indexOf(B[W],X),X=ut+1,W++;T=w.substring(0,ut).trim(),P=w.substring(ut+1).trim()}}const V=T.split(".");if(V.length==2&&V[1]==0&&V[1].length!=2)throw new Error("invalid coordinates format");const tt=P.split(".");if(tt.length==2&&tt[1]==0&&tt[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(T)||/^\d+$/.test(P))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(i)&&i.includes(",")&&(i=i.replace(",",".")),i=Number(Number(i).toFixed(e)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:T,verbatimLongitude:P,decimalLatitude:n,decimalLongitude:i,decimalCoordinates:`${n},${i}`,closeEnough:lC,toCoordinateFormat:sC})}else throw new Error("coordinates pattern match failed")}function dm(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,i=/[eastsouthnorthwest]+/i,a=e.length/2;for(let c=0;c{e.decimalLatitude?t.push(e):t.push({...e,...hC})}),[...t,...pC,...fC]}const mC=dC();my.formats=mC.map(t=>t.verbatimCoordinates);const gC=my;function Qv(t,e,n){const i=t.slice();return i[81]=e[n],i[83]=n,i}function $v(t){let e,n;return e=new $S({}),{c(){cn(e.$$.fragment)},m(i,a){en(e,i,a),n=!0},i(i){n||(ne(e.$$.fragment,i),n=!0)},o(i){he(e.$$.fragment,i),n=!1},d(i){nn(e,i)}}}function t1(t){let e,n,i,a,c;return n=new eC({}),{c(){e=se("button"),cn(n.$$.fragment),zt(e,"type","button"),zt(e,"title",t[9]),zt(e,"class","svelte-zh3kmv"),Ba(e,"active",t[0])},m(p,u){fe(p,e,u),en(n,e,null),i=!0,a||(c=un(e,"click",t[67]),a=!0)},p(p,u){(!i||u[0]&512)&&zt(e,"title",p[9]),(!i||u[0]&1)&&Ba(e,"active",p[0])},i(p){i||(ne(n.$$.fragment,p),i=!0)},o(p){he(n.$$.fragment,p),i=!1},d(p){p&&pe(e),nn(n),a=!1,c()}}}function _C(t){let e,n=[],i=new Map,a,c,p,u=bm(t[14]);const b=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{gt=null}),cs()),(!X||ee[0]&2)&&Ba(w,"displayable",Tt[1]!==""),Tt[5]===!0?St?(St.p(Tt,ee),ee[0]&32&&ne(St,1)):(St=t1(Tt),St.c(),ne(St,1),St.m(i,V)):St&&(us(),he(St,1,1,()=>{St=null}),cs()),Ft&&Ft.p&&(!X||ee[1]&134217728)&&Bs(Ft,It,Tt,Tt[58],X?Fs(It,Tt[58],ee,null):Vs(Tt[58]),null);let ge=ot;ot=ie(Tt),ot===ge?~ot&&Ct[ot].p(Tt,ee):(ut&&(us(),he(Ct[ge],1,1,()=>{Ct[ge]=null}),cs()),~ot?(ut=Ct[ot],ut?ut.p(Tt,ee):(ut=Ct[ot]=mt[ot](Tt),ut.c()),ne(ut,1),ut.m(n,null)):ut=null),(!X||ee[0]&4&&W!==(W=vm(Tt[2])+" svelte-zh3kmv"))&&zt(n,"class",W),(!X||ee[0]&22)&&Ba(n,"can-collapse",Tt[4]&&Tt[1]==="")},i(Tt){X||(ne(vt),ne(c.$$.fragment,Tt),ne(P.$$.fragment,Tt),ne(gt),ne(St),ne(Ft,Tt),ne(ut),X=!0)},o(Tt){he(vt),he(c.$$.fragment,Tt),he(P.$$.fragment,Tt),he(gt),he(St),he(Ft,Tt),he(ut),X=!1},d(Tt){Tt&&(pe(e),pe(n)),nn(c),t[61](null),nn(P),gt&>.d(),St&&St.d(),Ft&&Ft.d(Tt),~ot&&Ct[ot].d(),J=!1,eo(ht)}}}function wC(t,e,n){let i,{$$slots:a={},$$scope:c}=e,{class:p=void 0}=e,{apiKey:u}=e,{bbox:b=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:T=!1}=e,{collapsed:P=!1}=e,{country:k=void 0}=e,{debounceSearch:B=200}=e,{enableReverse:V=!1}=e,{errorMessage:tt="Something went wrong…"}=e,{filter:ot=()=>!0}=e,{flyTo:ut=!0}=e,{fuzzyMatch:W=!0}=e,{language:X=void 0}=e,{limit:J=void 0}=e,{mapController:ht=void 0}=e,{minLength:vt=2}=e,{noResultsMessage:gt="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:St="Search"}=e,{proximity:It=[{type:"server-geolocation"}]}=e,{reverseActive:Ft=V==="always"}=e,{reverseButtonTitle:mt="toggle reverse geocoding"}=e,{searchValue:Ct=""}=e,{showFullGeometry:ie=!0}=e,{showPlaceType:Tt="ifNeeded"}=e,{showResultsWhileTyping:ee=!0}=e,{selectFirst:ge=!0}=e,{flyToSelected:Te=!1}=e,{markerOnSelected:Oe=!0}=e,{types:on=void 0}=e,{excludeTypes:gn=!1}=e,{zoom:Re=16}=e,{maxZoom:Me=18}=e,{apiUrl:Rn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:qn={}}=e,{iconsBaseUrl:Zn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:Wn=H=>{}}=e;function ri(){Mt.focus()}function Kt(){Mt.blur()}function Ue(H,dt=!0){n(1,Ct=H),dt?(n(15,sn=-1),Ja()):(Ni(),setTimeout(()=>{Mt.focus(),Mt.select()}))}function yn(){n(14,Gt=void 0),n(55,Ie=void 0),n(15,sn=-1)}function br(){n(54,Fe=[]),n(55,Ie=void 0)}let er=!1,Gt,Fe,Ie,Ri="",Mt,sn=-1,Bi,Qe=[],$n,fr,$o,ws;const Ia=new Set,wr=Ff();Il(()=>{ht&&(ht.setEventHandler(void 0),ht.indicateReverse(!1),ht.setSelectedMarker(-1),ht.setMarkers(void 0,void 0))});function Ja(H){if(fr&&(clearTimeout(fr),fr=void 0),sn>-1&&Gt)n(55,Ie=Gt[sn]),n(1,Ct=Ie.place_type[0]==="reverse"?Ie.place_name:Ie.place_name.replace(/,.*/,"")),n(18,Bi=void 0),n(54,Fe=void 0),n(15,sn=-1);else if(Ct){const dt=H||!ts(Ct);Wt(Ct,{exact:!0}).then(()=>{n(54,Fe=Gt),n(55,Ie=void 0),dt&&No()}).catch(lt=>n(18,Bi=lt))}}function ts(H){try{return gC(H,6)}catch{return!1}}async function Wt(H,{byId:dt=!1,exact:lt=!1}={}){n(18,Bi=void 0),$n==null||$n.abort();const xt=new AbortController;n(19,$n=xt);try{const At=ts(H),Rt=new URLSearchParams;if(X!==void 0&&Rt.set("language",Array.isArray(X)?X.join(","):X??""),on&&Rt.set("types",on.join(",")),gn&&Rt.set("excludeTypes",String(gn)),b&&Rt.set("bbox",b.map(ze=>ze.toFixed(6)).join(",")),k&&Rt.set("country",Array.isArray(k)?k.join(","):k),!dt&&!At){const ze=await oC(ht,It,xt);ze&&Rt.set("proximity",ze),(lt||!ee)&&Rt.set("autocomplete","false"),Rt.set("fuzzyMatch",String(W))}J!==void 0&&(!At||(on==null?void 0:on.length)===1)&&Rt.set("limit",String(J)),Rt.set("key",u),Wn(Rt);const Nt=Rn+"/"+encodeURIComponent(At?At.decimalLongitude+","+At.decimalLatitude:H)+".json?"+Rt.toString();if(Nt===Ri){dt?(n(14,Gt=void 0),n(55,Ie=Qe[0])):n(14,Gt=Qe);return}Ri=Nt;const xe=await fetch(Nt,{signal:xt.signal,...qn});if(!xe.ok)throw new Error(await xe.text());const Ee=await xe.json();wr("response",{url:Nt,featureCollection:Ee}),dt?(n(14,Gt=void 0),n(55,Ie=Ee.features[0]),Qe=[Ie]):(n(14,Gt=Ee.features.filter(ot)),At&&Gt.unshift({type:"Feature",properties:{},id:"reverse_"+At.decimalLongitude+"_"+At.decimalLatitude,text:At.decimalLatitude+", "+At.decimalLongitude,place_name:At.decimalLatitude+", "+At.decimalLongitude,place_type:["reverse"],center:[At.decimalLongitude,At.decimalLatitude],bbox:[At.decimalLongitude,At.decimalLatitude,At.decimalLongitude,At.decimalLatitude],geometry:{type:"Point",coordinates:[At.decimalLongitude,At.decimalLatitude]}}),Qe=Gt,At&&Mt.focus())}catch(At){if(At&&typeof At=="object"&&"name"in At&&At.name==="AbortError")return;throw At}finally{xt===$n&&n(19,$n=void 0)}}function No(){var lt;if(!(Fe!=null&&Fe.length)||!ut)return;const H=[180,90,-180,-90],dt=!Fe.some(xt=>!xt.matching_text);for(const xt of Fe)if(dt||!xt.matching_text)for(const At of[0,1,2,3])H[At]=Math[At<2?"min":"max"](H[At],((lt=xt.bbox)==null?void 0:lt[At])??xt.center[At%2]);ht&&Fe.length>0&&(Ie&&H[0]===H[2]&&H[1]===H[3]?ht.flyTo(Ie.center,Re):ht.fitBounds(Zv(H),50,Me))}function Br(H){n(0,Ft=V==="always"),n(14,Gt=void 0),n(55,Ie=void 0),n(15,sn=-1),Ue(H[1].toFixed(6)+", "+rC(H[0],[-180,180],!0).toFixed(6),!1)}function Qa(H){if(!Gt)return;let dt=H.key==="ArrowDown"?1:H.key==="ArrowUp"?-1:0;dt&&(sn===(ge?0:-1)&&dt===-1&&n(15,sn=Gt.length),n(15,sn+=dt),sn>=Gt.length&&n(15,sn=-1),sn<0&&ge&&n(15,sn=0),H.preventDefault())}function Ni(H=!0){if(n(18,Bi=void 0),ee){if(fr&&clearTimeout(fr),Ct.length{Wt(dt).catch(lt=>n(18,Bi=lt))},H?B:0)}else n(14,Gt=void 0),n(18,Bi=void 0)}function Jt(H){n(55,Ie=H),n(1,Ct=H.place_name),n(15,sn=-1)}const He=()=>Mt.focus();function je(H){Rr[H?"unshift":"push"](()=>{Mt=H,n(17,Mt)})}function yi(){Ct=this.value,n(1,Ct),n(13,er),n(27,T)}const zo=()=>n(13,er=!0),Ge=()=>n(13,er=!1),ea=()=>Ni(),Ii=()=>{n(1,Ct=""),Mt.focus()},rt=()=>n(0,Ft=!Ft),O=()=>n(18,Bi=void 0),U=H=>n(15,sn=H),Z=H=>Jt(H),$=()=>{ge||n(15,sn=-1)},ft=()=>{};return t.$$set=H=>{"class"in H&&n(2,p=H.class),"apiKey"in H&&n(25,u=H.apiKey),"bbox"in H&&n(26,b=H.bbox),"clearButtonTitle"in H&&n(3,w=H.clearButtonTitle),"clearOnBlur"in H&&n(27,T=H.clearOnBlur),"collapsed"in H&&n(4,P=H.collapsed),"country"in H&&n(28,k=H.country),"debounceSearch"in H&&n(29,B=H.debounceSearch),"enableReverse"in H&&n(5,V=H.enableReverse),"errorMessage"in H&&n(6,tt=H.errorMessage),"filter"in H&&n(30,ot=H.filter),"flyTo"in H&&n(31,ut=H.flyTo),"fuzzyMatch"in H&&n(32,W=H.fuzzyMatch),"language"in H&&n(33,X=H.language),"limit"in H&&n(34,J=H.limit),"mapController"in H&&n(35,ht=H.mapController),"minLength"in H&&n(36,vt=H.minLength),"noResultsMessage"in H&&n(7,gt=H.noResultsMessage),"placeholder"in H&&n(8,St=H.placeholder),"proximity"in H&&n(37,It=H.proximity),"reverseActive"in H&&n(0,Ft=H.reverseActive),"reverseButtonTitle"in H&&n(9,mt=H.reverseButtonTitle),"searchValue"in H&&n(1,Ct=H.searchValue),"showFullGeometry"in H&&n(38,ie=H.showFullGeometry),"showPlaceType"in H&&n(10,Tt=H.showPlaceType),"showResultsWhileTyping"in H&&n(39,ee=H.showResultsWhileTyping),"selectFirst"in H&&n(11,ge=H.selectFirst),"flyToSelected"in H&&n(40,Te=H.flyToSelected),"markerOnSelected"in H&&n(41,Oe=H.markerOnSelected),"types"in H&&n(42,on=H.types),"excludeTypes"in H&&n(43,gn=H.excludeTypes),"zoom"in H&&n(44,Re=H.zoom),"maxZoom"in H&&n(45,Me=H.maxZoom),"apiUrl"in H&&n(46,Rn=H.apiUrl),"fetchParameters"in H&&n(47,qn=H.fetchParameters),"iconsBaseUrl"in H&&n(12,Zn=H.iconsBaseUrl),"adjustUrlQuery"in H&&n(48,Wn=H.adjustUrlQuery),"$$scope"in H&&n(58,c=H.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,$o=er),T&&!er&&n(1,Ct="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&Ct.lengthn(18,Bi=H)),t.$$.dirty[1]&50356241&&(ht&&Ie&&Ie.id!==ws&&ut&&(!Ie.bbox||Ie.bbox[0]===Ie.bbox[2]&&Ie.bbox[1]===Ie.bbox[3]?ht.flyTo(Ie.center,Ie.id.startsWith("poi.")||Ie.id.startsWith("address.")?Me:Re):ht.fitBounds(Zv(Ie.bbox),50,Me),n(14,Gt=void 0),n(54,Fe=void 0),n(15,sn=-1)),n(56,ws=Ie==null?void 0:Ie.id)),t.$$.dirty[0]&18432&&ge&&Gt!=null&&Gt.length&&n(15,sn=0),t.$$.dirty[0]&2050&&(ge||n(15,sn=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Fe!==Gt&&n(54,Fe=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&ht&&ht.setEventHandler(H=>{switch(H.type){case"mapClick":Ft&&Br(H.coordinates);break;case"markerClick":{const dt=Gt==null?void 0:Gt.find(lt=>lt.id===H.id);dt&&Jt(dt)}break;case"markerMouseEnter":Fe&&n(15,sn=$o?(Gt==null?void 0:Gt.findIndex(dt=>dt.id===H.id))??-1:-1);break;case"markerMouseLeave":Fe&&n(15,sn=-1);break}}),t.$$.dirty[0]&49152&&n(57,i=Gt==null?void 0:Gt[sn]),t.$$.dirty[1]&67133969&&ht&&i&&ut&&Te&&ht.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Me:Re),t.$$.dirty[1]&1040&&(Oe||ht==null||ht.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&ht&&Oe&&!Fe&&(ht.setMarkers(i?[i]:void 0,void 0),ht.setSelectedMarker(i?0:-1)),t.$$.dirty[1]&25165840&&ht&&ht.setMarkers(Fe,Ie),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Fe&&ht&&ht.setSelectedMarker(sn),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&ht){const H=ts(Ct);ht.setReverseMarker(H?[H.decimalLongitude,H.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&wr("select",i),t.$$.dirty[1]&16777216&&wr("pick",Ie),t.$$.dirty[0]&81920&&wr("optionsVisibilityChange",$o&&!!Gt),t.$$.dirty[0]&16384&&wr("featuresListed",Gt),t.$$.dirty[1]&8388608&&wr("featuresMarked",Fe),t.$$.dirty[0]&1&&wr("reverseToggle",Ft),t.$$.dirty[0]&2&&wr("queryChange",Ct),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&ht&&ht.indicateReverse(Ft)},[Ft,Ct,p,w,P,V,tt,gt,St,mt,Tt,ge,Zn,er,Gt,sn,$o,Mt,Bi,$n,Ia,Ja,Qa,Ni,Jt,u,b,T,k,B,ot,ut,W,X,J,ht,vt,It,ie,ee,Te,Oe,on,gn,Re,Me,Rn,qn,Wn,ri,Kt,Ue,yn,br,Fe,Ie,ws,i,c,a,He,je,yi,zo,Ge,ea,Ii,rt,O,U,Z,$,ft]}class IC extends Tn{constructor(e){super(),Cn(this,e,wC,bC,In,{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 n1(t){let e,n,i;return n=new IC({props:{mapController:t[0],apiKey:Z1}}),{c(){e=se("div"),cn(n.$$.fragment),zt(e,"class","svelte-kr8bm")},m(a,c){fe(a,e,c),en(n,e,null),i=!0},p(a,c){const p={};c&1&&(p.mapController=a[0]),n.$set(p)},i(a){i||(ne(n.$$.fragment,a),i=!0)},o(a){he(n.$$.fragment,a),i=!1},d(a){a&&pe(e),nn(n)}}}function EC(t){let e,n,i=t[0]&&n1(t);return{c(){i&&i.c(),e=Dl()},m(a,c){i&&i.m(a,c),fe(a,e,c),n=!0},p(a,[c]){a[0]?i?(i.p(a,c),c&1&&ne(i,1)):(i=n1(a),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function SC(t,e,n){let i;Gn(t,Yu,c=>n(1,i=c));let a;return w1(()=>{i&&n(0,a=FS(i,qh))}),[a]}class QT extends Tn{constructor(e){super(),Cn(this,e,SC,EC,In,{})}}const CC=t=>({}),i1=t=>({}),TC=t=>({}),r1=t=>({});function LC(t){let e,n,i,a;const c=t[1].left,p=Os(c,t,t[0],r1),u=t[1].main,b=Os(u,t,t[0],i1);return{c(){e=se("div"),p&&p.c(),n=qe(),i=se("div"),b&&b.c(),zt(e,"class","left svelte-194izft"),zt(i,"class","main svelte-194izft")},m(w,T){fe(w,e,T),p&&p.m(e,null),fe(w,n,T),fe(w,i,T),b&&b.m(i,null),a=!0},p(w,[T]){p&&p.p&&(!a||T&1)&&Bs(p,c,w,w[0],a?Fs(c,w[0],T,TC):Vs(w[0]),r1),b&&b.p&&(!a||T&1)&&Bs(b,u,w,w[0],a?Fs(u,w[0],T,CC):Vs(w[0]),i1)},i(w){a||(ne(p,w),ne(b,w),a=!0)},o(w){he(p,w),he(b,w),a=!1},d(w){w&&(pe(e),pe(n),pe(i)),p&&p.d(w),b&&b.d(w)}}}function PC(t,e,n){let{$$slots:i={},$$scope:a}=e;return t.$$set=c=>{"$$scope"in c&&n(0,a=c.$$scope)},[a,i]}class $T extends Tn{constructor(e){super(),Cn(this,e,PC,LC,In,{})}}function zf(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Uh(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Yx(t,e,n){if(n===void 0&&(n={}),n.final===!0)return MC(t,e);var i=zf(t),a=zf(e),c=Rs(i[0]),p=Rs(a[0]),u=Rs(i[1]),b=Rs(a[1]),w=Math.sin(p-c)*Math.cos(b),T=Math.cos(u)*Math.sin(b)-Math.sin(u)*Math.cos(b)*Math.cos(p-c);return vf(Math.atan2(w,T))}function MC(t,e){var n=Yx(e,t);return n=(n+180)%360,n}function nf(t,e,n){n===void 0&&(n={});var i=zf(t),a=zf(e),c=Rs(a[1]-i[1]),p=Rs(a[0]-i[0]),u=Rs(i[1]),b=Rs(a[1]),w=Math.pow(Math.sin(c/2),2)+Math.pow(Math.sin(p/2),2)*Math.cos(u)*Math.cos(b);return X_(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function o1(t,e,n,i){i===void 0&&(i={});var a=zf(t),c=Rs(a[0]),p=Rs(a[1]),u=Rs(n),b=Um(e,i.units),w=Math.asin(Math.sin(p)*Math.cos(b)+Math.cos(p)*Math.sin(b)*Math.cos(u)),T=c+Math.atan2(Math.sin(u)*Math.sin(b)*Math.cos(p),Math.cos(b)-Math.sin(p)*Math.sin(w)),P=vf(T),k=vf(w);return Go([P,k],i.properties)}function s1(t){if(!t)throw new Error("geojson is required");var e=[];return Wh(t,function(n){AC(n,e)}),Xu(e)}function AC(t,e){var n=[],i=t.geometry;if(i!==null){switch(i.type){case"Polygon":n=Uh(i);break;case"LineString":n=[Uh(i)]}n.forEach(function(a){var c=kC(a,t.properties);c.forEach(function(p){p.id=e.length,e.push(p)})})}}function kC(t,e){var n=[];return t.reduce(function(i,a){var c=Ds([i,a],e);return c.bbox=DC(i,a),n.push(c),a}),n}function DC(t,e){var n=t[0],i=t[1],a=e[0],c=e[1],p=na?n:a,w=i>c?i:c;return[p,u,b,w]}var gy={exports:{}},Kx={exports:{}};(function(t,e){(function(n,i){t.exports=i()})(L1,function(){function n(W,X,J,ht,vt){(function gt(St,It,Ft,mt,Ct){for(;mt>Ft;){if(mt-Ft>600){var ie=mt-Ft+1,Tt=It-Ft+1,ee=Math.log(ie),ge=.5*Math.exp(2*ee/3),Te=.5*Math.sqrt(ee*ge*(ie-ge)/ie)*(Tt-ie/2<0?-1:1),Oe=Math.max(Ft,Math.floor(It-Tt*ge/ie+Te)),on=Math.min(mt,Math.floor(It+(ie-Tt)*ge/ie+Te));gt(St,It,Oe,on,Ct)}var gn=St[It],Re=Ft,Me=mt;for(i(St,Ft,It),Ct(St[mt],gn)>0&&i(St,Ft,mt);Re0;)Me--}Ct(St[Ft],gn)===0?i(St,Ft,Me):i(St,++Me,mt),Me<=It&&(Ft=Me+1),It<=Me&&(mt=Me-1)}})(W,X,J||0,ht||W.length-1,vt||a)}function i(W,X,J){var ht=W[X];W[X]=W[J],W[J]=ht}function a(W,X){return WX?1:0}var c=function(W){W===void 0&&(W=9),this._maxEntries=Math.max(4,W),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function p(W,X,J){if(!J)return X.indexOf(W);for(var ht=0;ht=W.minX&&X.maxY>=W.minY}function ot(W){return{children:W,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ut(W,X,J,ht,vt){for(var gt=[X,J];gt.length;)if(!((J=gt.pop())-(X=gt.pop())<=ht)){var St=X+Math.ceil((J-X)/ht/2)*ht;n(W,St,X,J,vt),gt.push(X,St,St,J)}}return c.prototype.all=function(){return this._all(this.data,[])},c.prototype.search=function(W){var X=this.data,J=[];if(!tt(W,X))return J;for(var ht=this.toBBox,vt=[];X;){for(var gt=0;gt=0&&vt[X].children.length>this._maxEntries;)this._split(vt,X),X--;this._adjustParentBBoxes(ht,vt,X)},c.prototype._split=function(W,X){var J=W[X],ht=J.children.length,vt=this._minEntries;this._chooseSplitAxis(J,vt,ht);var gt=this._chooseSplitIndex(J,vt,ht),St=ot(J.children.splice(gt,J.children.length-gt));St.height=J.height,St.leaf=J.leaf,u(J,this.toBBox),u(St,this.toBBox),X?W[X-1].children.push(St):this._splitRoot(J,St)},c.prototype._splitRoot=function(W,X){this.data=ot([W,X]),this.data.height=W.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},c.prototype._chooseSplitIndex=function(W,X,J){for(var ht,vt,gt,St,It,Ft,mt,Ct=1/0,ie=1/0,Tt=X;Tt<=J-X;Tt++){var ee=b(W,0,Tt,this.toBBox),ge=b(W,Tt,J,this.toBBox),Te=(vt=ee,gt=ge,St=void 0,It=void 0,Ft=void 0,mt=void 0,St=Math.max(vt.minX,gt.minX),It=Math.max(vt.minY,gt.minY),Ft=Math.min(vt.maxX,gt.maxX),mt=Math.min(vt.maxY,gt.maxY),Math.max(0,Ft-St)*Math.max(0,mt-It)),Oe=k(ee)+k(ge);Te=X;Ct--){var ie=W.children[Ct];w(St,W.leaf?vt(ie):ie),It+=B(St)}return It},c.prototype._adjustParentBBoxes=function(W,X,J){for(var ht=J;ht>=0;ht--)w(X[ht],W)},c.prototype._condense=function(W){for(var X=W.length-1,J=void 0;X>=0;X--)W[X].children.length===0?X>0?(J=W[X-1].children).splice(J.indexOf(W[X]),1):this.clear():u(W[X],this.toBBox)},c})})(Kx);var RC=Kx.exports;const NC=G_(MI),zC=G_(UI),OC=G_(GI);var Ra=RC,Jx=NC,Qx=zC,fh=OC.default,FC=Qx.featureEach;Qx.coordEach;Jx.polygon;var a1=Jx.featureCollection;function $x(t){var e=new Ra(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:fh(n),Ra.prototype.insert.call(this,n)},e.load=function(n){var i=[];return Array.isArray(n)?n.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:fh(a),i.push(a)}):FC(n,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:fh(a),i.push(a)}),Ra.prototype.load.call(this,i)},e.remove=function(n,i){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:fh(n),Ra.prototype.remove.call(this,n,i)},e.clear=function(){return Ra.prototype.clear.call(this)},e.search=function(n){var i=Ra.prototype.search.call(this,this.toBBox(n));return a1(i)},e.collides=function(n){return Ra.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=Ra.prototype.all.call(this);return a1(n)},e.toJSON=function(){return Ra.prototype.toJSON.call(this)},e.fromJSON=function(n){return Ra.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var i;if(n.bbox)i=n.bbox;else if(Array.isArray(n)&&n.length===4)i=n;else if(Array.isArray(n)&&n.length===6)i=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")i=fh(n);else if(n.type==="FeatureCollection")i=fh(n);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},e}gy.exports=$x;gy.exports.default=$x;var BC=gy.exports;const VC=P1(BC);function UC(t,e){var n={},i=[];if(t.type==="LineString"&&(t=Us(t)),e.type==="LineString"&&(e=Us(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var a=l1(t,e);return a&&i.push(a),Xu(i)}var c=VC();return c.load(s1(e)),Em(s1(t),function(p){Em(c.search(p),function(u){var b=l1(p,u);if(b){var w=Uh(b).join(",");n[w]||(n[w]=!0,i.push(b))}})}),Xu(i)}function l1(t,e){var n=Uh(t),i=Uh(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var a=n[0][0],c=n[0][1],p=n[1][0],u=n[1][1],b=i[0][0],w=i[0][1],T=i[1][0],P=i[1][1],k=(P-w)*(p-a)-(T-b)*(u-c),B=(T-b)*(c-w)-(P-w)*(a-b),V=(p-a)*(c-w)-(u-c)*(a-b);if(k===0)return null;var tt=B/k,ot=V/k;if(tt>=0&&tt<=1&&ot>=0&&ot<=1){var ut=a+tt*(p-a),W=c+tt*(u-c);return Go([ut,W])}return null}function GC(t,e,n){n===void 0&&(n={});var i=Go([1/0,1/0],{dist:1/0}),a=0;return Wh(t,function(c){for(var p=Uh(c),u=0;u0&&(ot=tt.features[0],ot.properties.dist=nf(e,ot,n),ot.properties.location=a+nf(b,ot,n)),b.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,i=this.dragFrom[1]-e.lngLat.lat;for(let a of this.points)a[0]-=n,a[1]-=i}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});or(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(u1(this.points).forEach((i,a)=>{n.push([a+1,GC(i,this.cursor).properties.dist])}),n.sort((i,a)=>i[1]-a[1]),n.length>0){let i=n[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});or(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=m_(e.lngLat.toArray()),this.onClick(e),this.finish())});or(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});or(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});or(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});or(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e={type:"FeatureCollection",features:[]};this.points.forEach((a,c)=>{let p=m_(a);p.properties.hover=this.hover==c,p.properties.idx=c,e.features.push(p)}),e.features=e.features.concat(u1(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),eb.set(e);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,nb.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=m_(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(tb),n=[JSON.parse(JSON.stringify(e))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>WC&&this.previousStates.shift()}}function u1(t){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[t[t.length-1],t[0]]},properties:{}}),e}function XC(t){let e,n,i;return{c(){e=Dn("Undo ("),n=Dn(t[1]),i=Dn(")")},m(a,c){fe(a,e,c),fe(a,n,c),fe(a,i,c)},p(a,c){c&2&&Ga(n,a[1])},d(a){a&&(pe(e),pe(n),pe(i))}}}function YC(t){let e;return{c(){e=Dn("Undo")},m(n,i){fe(n,e,i)},p:Ye,d(n){n&&pe(e)}}}function KC(t){let e,n,i,a,c,p,u,b,w,T,P;function k(tt,ot){return tt[1]==0?YC:XC}let B=k(t),V=B(t);return{c(){e=se("div"),n=se("button"),n.textContent="Finish",i=qe(),a=se("button"),a.textContent="Cancel",c=qe(),p=se("button"),V.c(),b=qe(),w=se("ul"),w.innerHTML=`
  • Click +`)}return t.toString()};xr.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.computeLabel(t)}};xr.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getLabel(),p=0;p<2;p++)c.isLine(p)&&c.getLocation(p)===Lt.BOUNDARY&&(n[p]=!0);for(var u=this.iterator();u.hasNext();)for(var b=u.next(),w=b.getLabel(),T=0;T<2;T++)if(w.isAnyNull(T)){var P=Lt.NONE;if(n[T])P=Lt.EXTERIOR;else{var k=b.getCoordinate();P=e.getLocation(T,k,t)}w.setAllLocationsIfNull(T,P)}};xr.prototype.getDegree=function(){return this._edgeMap.size()};xr.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null};xr.prototype.interfaces_=function(){return[]};xr.prototype.getClass=function(){return xr};var sS=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var i=null,a=null,c=this._SCANNING_FOR_INCOMING,p=0;p=0;c--){var p=n._edgeList.get(c),u=p.getSym();a===null&&(a=u),i!==null&&u.setNext(i),i=p}a.setNext(i)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],a=this.findIndex(i),c=i.getDepth(Xt.LEFT),p=i.getDepth(Xt.RIGHT),u=this.computeDepths(a+1,this._edgeList.size(),c),b=this.computeDepths(0,a,u);if(b!==p)throw new ja("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],T=arguments[1],P=arguments[2],k=P,B=w;B=0;u--){var b=i._resultAreaEdgeList.get(u),w=b.getSym();switch(a===null&&b.getEdgeRing()===n&&(a=b),p){case i._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;c=w,p=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(b.getEdgeRing()!==n)continue;c.setNextMin(b),p=i._SCANNING_FOR_INCOMING;break}}p===this._LINKING_TO_OUTGOING&&(Xe.isTrue(a!==null,"found null for first outgoing dirEdge"),Xe.isTrue(a.getEdgeRing()===n,"unable to link last incoming dirEdge"),c.setNextMin(a))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var a=i.next();a.isInResult()&&n++}return n}else if(arguments.length===1){for(var c=arguments[0],p=0,u=this.iterator();u.hasNext();){var b=u.next();b.getEdgeRing()===c&&p++}return p}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Lt.NONE,i=this.iterator();i.hasNext();){var a=i.next(),c=a.getSym();if(!a.isLineEdge()){if(a.isInResult()){n=Lt.INTERIOR;break}if(c.isInResult()){n=Lt.EXTERIOR;break}}}if(n===Lt.NONE)return null;for(var p=n,u=this.iterator();u.hasNext();){var b=u.next(),w=b.getSym();b.isLineEdge()?b.getEdge().setCovered(p===Lt.INTERIOR):(b.isInResult()&&(p=Lt.EXTERIOR),w.isInResult()&&(p=Lt.INTERIOR))}},e.prototype.computeLabelling=function(n){var i=this;t.prototype.computeLabelling.call(this,n),this._label=new Sn(Lt.NONE);for(var a=this.iterator();a.hasNext();)for(var c=a.next(),p=c.getEdge(),u=p.getLabel(),b=0;b<2;b++){var w=u.getLocation(b);(w===Lt.INTERIOR||w===Lt.BOUNDARY)&&i._label.setLocation(b,Lt.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xr),xx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new tg(n,new sS)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Lh),Tl=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Tl.prototype.compareTo=function(t){var e=t,n=Tl.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};Tl.prototype.interfaces_=function(){return[Jo]};Tl.prototype.getClass=function(){return Tl};Tl.orientation=function(t){return rn.increasingDirection(t)===1};Tl.compareOriented=function(t,e,n,i){for(var a=e?1:-1,c=i?1:-1,p=e?t.length:-1,u=i?n.length:-1,b=e?0:t.length-1,w=i?0:n.length-1;;){var T=t[b].compareTo(n[w]);if(T!==0)return T;b+=a,w+=c;var P=b===p,k=w===u;if(P&&!k)return-1;if(!P&&k)return 1;if(P&&k)return 0}};var _s=function(){this._edges=new te,this._ocaMap=new yr};_s.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var a=i.getCoordinates(),c=0;c0&&t.print(","),t.print(a[c].x+" "+a[c].y);t.println(")")}t.print(") ")};_s.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};_s.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(a);c||i--;var p=new Array(i).fill(null),u=0;p[u++]=new wt(t.coord);for(var b=t.segmentIndex+1;b<=e.segmentIndex;b++)p[u++]=n.edge.pts[b];return c&&(p[u]=e.coord),new Am(p,new Sn(this.edge._label))};_a.prototype.add=function(t,e,n){var i=new Xs(t,e,n),a=this._nodeMap.get(i);return a!==null?a:(this._nodeMap.put(i,i),i)};_a.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};_a.prototype.interfaces_=function(){return[]};_a.prototype.getClass=function(){return _a};var hu=function(){};hu.prototype.getChainStartIndices=function(t){var e=this,n=0,i=new te;i.add(new Gs(n));do{var a=e.findChainEnd(t,n);i.add(new Gs(a)),n=a}while(nn?e:n};Wa.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(a=1),t._depth[e][i]=a}}};lr.prototype.getDelta=function(t){return this._depth[t][Xt.RIGHT]-this._depth[t][Xt.LEFT]};lr.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Lt.EXTERIOR:Lt.INTERIOR};lr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};lr.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var a=e.getLocation(n,i);(a===Lt.EXTERIOR||a===Lt.INTERIOR)&&(t.isNull(n,i)?t._depth[n][i]=lr.depthAtLocation(a):t._depth[n][i]+=lr.depthAtLocation(a))}else if(arguments.length===3){var c=arguments[0],p=arguments[1],u=arguments[2];u===Lt.INTERIOR&&this._depth[c][p]++}};lr.prototype.interfaces_=function(){return[]};lr.prototype.getClass=function(){return lr};lr.depthAtLocation=function(t){return t===Lt.EXTERIOR?0:t===Lt.INTERIOR?1:lr.NULL_VALUE};bx.NULL_VALUE.get=function(){return-1};Object.defineProperties(lr,bx);var Am=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new _a(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new lr,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.pts=i,this._label=a}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new e(n,Sn.toLineLabel(this._label));return i},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var i=this;if(!(n instanceof e))return!1;var a=n;if(this.pts.length!==a.pts.length)return!1;for(var c=!0,p=!0,u=this.pts.length,b=0;b0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var a=0;a0&&n.print(","),n.print(i.pts[a].x+" "+i.pts[a].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var a=this.pts.length-1;a>=0;a--)n.print(i.pts[a]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Wa(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Se;for(var i=0;i0&&i.append(","),i.append(n.pts[a].x+" "+n.pts[a].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},e.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var a=0;ai||this._maxyc;if(p)return!1;var u=this.intersectsToleranceSquare(t,e);return Xe.isTrue(!(p&&u),"Found bad envelope test"),u};$r.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new wt(this._maxx,this._maxy),this._corner[1]=new wt(this._minx,this._maxy),this._corner[2]=new wt(this._minx,this._miny),this._corner[3]=new wt(this._maxx,this._miny)};$r.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};$r.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};$r.prototype.getCoordinate=function(){return this._originalPt};$r.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};$r.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=$r.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Se(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};$r.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))};$r.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||t.equals(this._pt)||e.equals(this._pt))};$r.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return this.intersects(n,i)?(t.addIntersection(this.getCoordinate(),e),!0):!1};$r.prototype.interfaces_=function(){return[]};$r.prototype.getClass=function(){return $r};Ix.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties($r,Ix);var kf=function(){this.tempEnv1=new Se,this.selectedSegment=new Ce};kf.prototype.select=function(){if(arguments.length!==1&&arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}};kf.prototype.interfaces_=function(){return[]};kf.prototype.getClass=function(){return kf};var kh=function(){this._index=null;var t=arguments[0];this._index=t},Ex={HotPixelSnapAction:{configurable:!0}};kh.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],a=e.getSafeEnvelope(),c=new Sx(e,n,i);return this._index.query(a,{interfaces_:function(){return[Sl]},visitItem:function(p){var u=p;u.select(a,c)}}),c.isNodeAdded()}};kh.prototype.interfaces_=function(){return[]};kh.prototype.getClass=function(){return kh};Ex.HotPixelSnapAction.get=function(){return Sx};Object.defineProperties(kh,Ex);var Sx=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],a=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],a=n.getContext();if(this._parentEdge!==null&&a===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(a,i)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kf),nc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new te};nc.prototype.processIntersections=function(t,e,n,i){var a=this;if(t===n&&e===i)return null;var c=t.getCoordinates()[e],p=t.getCoordinates()[e+1],u=n.getCoordinates()[i],b=n.getCoordinates()[i+1];if(this._li.computeIntersection(c,p,u,b),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(c){if(c instanceof ja)t._saveException=c;else throw c}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=ar.precisionScaleFactor(this._argGeom,this._distance,n),a=new bn(i);this.bufferFixedPrecision(a)}};ar.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===bn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};ar.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};ar.prototype.bufferOriginalPrecision=function(){try{var t=new Dr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof Ga)this._saveException=e;else throw e}finally{}};ar.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};ar.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};ar.prototype.interfaces_=function(){return[]};ar.prototype.getClass=function(){return ar};ar.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ar(t),i=n.getResultGeometry(e);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof De&&typeof arguments[1]=="number"){var a=arguments[0],c=arguments[1],p=arguments[2],u=new ar(a);u.setQuadrantSegments(p);var b=u.getResultGeometry(c);return b}else if(arguments[2]instanceof xn&&arguments[0]instanceof De&&typeof arguments[1]=="number"){var w=arguments[0],T=arguments[1],P=arguments[2],k=new ar(w,P),B=k.getResultGeometry(T);return B}}else if(arguments.length===4){var V=arguments[0],tt=arguments[1],ot=arguments[2],ut=arguments[3],W=new ar(V);W.setQuadrantSegments(ot),W.setEndCapStyle(ut);var X=W.getResultGeometry(tt);return X}};ar.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),a=Mo.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),c=e>0?e:0,p=a+2*c,u=Math.trunc(Math.log(p)/Math.log(10)+1),b=n-u,w=Math.pow(10,b);return w};Kh.CAP_ROUND.get=function(){return xn.CAP_ROUND};Kh.CAP_BUTT.get=function(){return xn.CAP_FLAT};Kh.CAP_FLAT.get=function(){return xn.CAP_FLAT};Kh.CAP_SQUARE.get=function(){return xn.CAP_SQUARE};Kh.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(ar,Kh);var Mr=function(){this._pt=[new wt,new wt],this._distance=Ve.NaN,this._isNull=!0};Mr.prototype.getCoordinates=function(){return this._pt};Mr.prototype.getCoordinate=function(t){return this._pt[t]};Mr.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);ithis._distance&&this.initialize(e,n,i)}};Mr.prototype.interfaces_=function(){return[]};Mr.prototype.getClass=function(){return Mr};var ua=function(){};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};ua.computeDistance=function(){if(arguments[2]instanceof Mr&&arguments[0]instanceof ai&&arguments[1]instanceof wt)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),a=new Ce,c=0;c0||this._isIn?Lt.INTERIOR:Lt.EXTERIOR)};ys.prototype.interfaces_=function(){return[]};ys.prototype.getClass=function(){return ys};var Ar=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];this._component=i,this._segIndex=a,this._pt=c}},Cx={INSIDE_AREA:{configurable:!0}};Ar.prototype.isInsideArea=function(){return this._segIndex===Ar.INSIDE_AREA};Ar.prototype.getCoordinate=function(){return this._pt};Ar.prototype.getGeometryComponent=function(){return this._component};Ar.prototype.getSegmentIndex=function(){return this._segIndex};Ar.prototype.interfaces_=function(){return[]};Ar.prototype.getClass=function(){return Ar};Cx.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Ar,Cx);var xl=function(t){this._pts=t||null};xl.prototype.filter=function(t){t instanceof mo&&this._pts.add(t)};xl.prototype.interfaces_=function(){return[js]};xl.prototype.getClass=function(){return xl};xl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof mo?gs.singletonList(t):xl.getPoints(t,new te)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof mo?n.add(e):e instanceof Nr&&e.apply(new xl(n)),n}};var rc=function(){this._locations=null;var t=arguments[0];this._locations=t};rc.prototype.filter=function(t){(t instanceof mo||t instanceof ai||t instanceof Di)&&this._locations.add(new Ar(t,0,t.getCoordinate()))};rc.prototype.interfaces_=function(){return[js]};rc.prototype.getClass=function(){return rc};rc.getLocations=function(t){var e=new te;return t.apply(new rc(e)),e};var cr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ys,this._minDistanceLocation=null,this._minDistance=Ve.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],a=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=a}};cr.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=1-n,c=Ua.getPolygons(this._geom[n]);if(c.size()>0){var p=rc.getLocations(this._geom[a]);if(this.computeContainmentDistance(p,c,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[a]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ne(arguments[0],ps)&&Ne(arguments[1],ps)){for(var u=arguments[0],b=arguments[1],w=arguments[2],T=0;Tthis._minDistance)return null;for(var a=e.getCoordinates(),c=n.getCoordinate(),p=0;pthis._minDistance)return null;for(var B=T.getCoordinates(),V=P.getCoordinates(),tt=0;ttthis._distance&&this.initialize(e,n,i)}};_r.prototype.interfaces_=function(){return[]};_r.prototype.getClass=function(){return _r};var ks=function(){};ks.prototype.interfaces_=function(){return[]};ks.prototype.getClass=function(){return ks};ks.computeDistance=function(){if(arguments[2]instanceof _r&&arguments[0]instanceof ai&&arguments[1]instanceof wt)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new Ce,a=t.getCoordinates(),c=0;c1||t<=0)throw new Qn("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};Zo.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};Zo.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};Zo.prototype.computeOrientedDistance=function(t,e,n){var i=new oc(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var a=new Ml(e,this._densifyFrac);t.apply(a),n.setMaximum(a.getMaxPointDistance())}};Zo.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};Zo.prototype.interfaces_=function(){return[]};Zo.prototype.getClass=function(){return Zo};Zo.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Zo(t,e);return n.distance()}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2],p=new Zo(i,a);return p.setDensifyFraction(c),p.distance()}};uy.MaxPointDistanceFilter.get=function(){return oc};uy.MaxDensifiedByFractionDistanceFilter.get=function(){return Ml};Object.defineProperties(Zo,uy);var oc=function(){this._maxPtDist=new _r,this._minPtDist=new _r,this._euclideanDist=new ks,this._geom=null;var t=arguments[0];this._geom=t};oc.prototype.filter=function(t){this._minPtDist.initialize(),ks.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};oc.prototype.getMaxPointDistance=function(){return this._maxPtDist};oc.prototype.interfaces_=function(){return[fa]};oc.prototype.getClass=function(){return oc};var Ml=function(){this._maxPtDist=new _r,this._minPtDist=new _r,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Ml.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var i=t.getCoordinate(e-1),a=t.getCoordinate(e),c=(a.x-i.x)/this._numSubSegs,p=(a.y-i.y)/this._numSubSegs,u=0;un){this._isValid=!1;var a=i.getCoordinates();this._errorLocation=a[1],this._errorIndicator=t.getFactory().createLineString(a),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+fs.toLineString(a[0],a[1])+")"}};po.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=po.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),po.VERBOSE&&ur.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};po.prototype.checkNegativeValid=function(){if(!(this._input instanceof Di||this._input instanceof ha||this._input instanceof Nr))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};po.prototype.getErrorIndicator=function(){return this._errorIndicator};po.prototype.checkMinimumDistance=function(t,e,n){var i=new cr(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};hr.prototype.report=function(t){if(!hr.VERBOSE)return null;ur.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};hr.prototype.getErrorMessage=function(){return this._errorMsg};hr.prototype.interfaces_=function(){return[]};hr.prototype.getClass=function(){return hr};hr.isValidMsg=function(t,e,n){var i=new hr(t,e,n);return i.isValid()?null:i.getErrorMessage()};hr.isValid=function(t,e,n){var i=new hr(t,e,n);return!!i.isValid()};hy.VERBOSE.get=function(){return!1};hy.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(hr,hy);var Ks=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ks.prototype.getCoordinates=function(){return this._pts};Ks.prototype.size=function(){return this._pts.length};Ks.prototype.getCoordinate=function(t){return this._pts[t]};Ks.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ks.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:tc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};Ks.prototype.setData=function(t){this._data=t};Ks.prototype.getData=function(){return this._data};Ks.prototype.toString=function(){return fs.toLineString(new di(this._pts))};Ks.prototype.interfaces_=function(){return[ga]};Ks.prototype.getClass=function(){return Ks};var $i=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new te,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};$i.prototype.getInteriorIntersection=function(){return this._interiorIntersection};$i.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};$i.prototype.getIntersectionSegments=function(){return this._intSegments};$i.prototype.count=function(){return this._intersectionCount};$i.prototype.getIntersections=function(){return this._intersections};$i.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};$i.prototype.setKeepIntersections=function(t){this._keepIntersections=t};$i.prototype.processIntersections=function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly){var a=this.isEndSegment(t,e)||this.isEndSegment(n,i);if(!a)return null}var c=t.getCoordinates()[e],p=t.getCoordinates()[e+1],u=n.getCoordinates()[i],b=n.getCoordinates()[i+1];this._li.computeIntersection(c,p,u,b),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=p,this._intSegments[2]=u,this._intSegments[3]=b,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};$i.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};$i.prototype.hasIntersection=function(){return this._interiorIntersection!==null};$i.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};$i.prototype.interfaces_=function(){return[cu]};$i.prototype.getClass=function(){return $i};$i.createAllIntersectionsFinder=function(t){var e=new $i(t);return e.setFindAllIntersections(!0),e};$i.createAnyIntersectionFinder=function(t){return new $i(t)};$i.createIntersectionCounter=function(t){var e=new $i(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var vs=function(){this._li=new gu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};vs.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};vs.prototype.getIntersections=function(){return this._segInt.getIntersections()};vs.prototype.isValid=function(){return this.execute(),this._isValid};vs.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};vs.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new $i(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ay;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};vs.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new ja(this.getErrorMessage(),this._segInt.getInteriorIntersection())};vs.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fs.toLineString(t[0],t[1])+" and "+fs.toLineString(t[2],t[3])};vs.prototype.interfaces_=function(){return[]};vs.prototype.getClass=function(){return vs};vs.computeIntersections=function(t){var e=new vs(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var fu=function t(){this._nv=null;var e=arguments[0];this._nv=new vs(t.toSegmentStrings(e))};fu.prototype.checkValid=function(){this._nv.checkValid()};fu.prototype.interfaces_=function(){return[]};fu.prototype.getClass=function(){return fu};fu.toSegmentStrings=function(t){for(var e=new te,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ks(i.getCoordinates(),i))}return e};fu.checkValid=function(t){var e=new fu(t);e.checkValid()};var sc=function(t){this._mapOp=t};sc.prototype.map=function(t){for(var e=this,n=new te,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};to.prototype.interfaces_=function(){return[]};to.prototype.getClass=function(){return to};var va=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Ce,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof ai&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1];this._srcPts=i,this._isClosed=t.isClosed(i),this._snapTolerance=a}};va.prototype.snapVertices=function(t,e){for(var n=this,i=this._isClosed?t.size()-1:t.size(),a=0;a=0&&t.add(p+1,new wt(c),!1)}};va.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,i=Ve.MAX_VALUE,a=-1,c=0;ce&&(e=i)}return e}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return Math.min(mi.computeOverlaySnapTolerance(a),mi.computeOverlaySnapTolerance(c))}};mi.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),i=n*mi.SNAP_PRECISION_FACTOR;return i};mi.snapToSelf=function(t,e,n){var i=new mi(t);return i.snapToSelf(e,n)};Tx.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(mi,Tx);var Lx=function(t){function e(n,i,a){t.call(this),this._snapTolerance=n||null,this._snapPts=i||null,this._isSelfSnap=a!==void 0?a:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,i){var a=new va(n,this._snapTolerance);return a.setAllowSnappingToSourceVertices(this._isSelfSnap),a.snapTo(i)},e.prototype.transformCoordinates=function(n,i){var a=n.toCoordinateArray(),c=this.snapLine(a,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(c)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(to),Pr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Pr.prototype.getCommon=function(){return Ve.longBitsToDouble(this._commonBits)};Pr.prototype.add=function(t){var e=Ve.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=Pr.signExpBits(this._commonBits),this._isFirst=!1,null;var n=Pr.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Pr.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=Pr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};Pr.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=Ve.longBitsToDouble(t),n=Ve.toBinaryString(t),i="0000000000000000000000000000000000000000000000000000000000000000"+n,a=i.substring(i.length-64),c=a.substring(0,1)+" "+a.substring(1,12)+"(exp) "+a.substring(12)+" [ "+e+" ]";return c}};Pr.prototype.interfaces_=function(){return[]};Pr.prototype.getClass=function(){return Pr};Pr.getBit=function(t,e){var n=1<>52};Pr.zeroLowerBits=function(t,e){var n=(1<=0;i--){if(Pr.getBit(t,i)!==Pr.getBit(e,i))return n;n++}return 52};var Al=function(){this._commonCoord=null,this._ccFilter=new lc},py={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Al.prototype.addCommonBits=function(t){var e=new kl(this._commonCoord);t.apply(e),t.geometryChanged()};Al.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new wt(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new kl(e);return t.apply(n),t.geometryChanged(),t};Al.prototype.getCommonCoordinate=function(){return this._commonCoord};Al.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};Al.prototype.interfaces_=function(){return[]};Al.prototype.getClass=function(){return Al};py.CommonCoordinateFilter.get=function(){return lc};py.Translater.get=function(){return kl};Object.defineProperties(Al,py);var lc=function(){this._commonBitsX=new Pr,this._commonBitsY=new Pr};lc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};lc.prototype.getCommonCoordinate=function(){return new wt(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};lc.prototype.interfaces_=function(){return[fa]};lc.prototype.getClass=function(){return lc};var kl=function(){this.trans=null;var t=arguments[0];this.trans=t};kl.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)};kl.prototype.isDone=function(){return!1};kl.prototype.isGeometryChanged=function(){return!0};kl.prototype.interfaces_=function(){return[ds]};kl.prototype.getClass=function(){return kl};var tr=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};tr.prototype.selfSnap=function(t){var e=new mi(t),n=e.snapTo(t,this._snapTolerance);return n};tr.prototype.removeCommonBits=function(t){this._cbr=new Al,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e};tr.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};tr.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=We.overlayOp(e[0],e[1],t);return this.prepareResult(n)};tr.prototype.checkValid=function(t){t.isValid()||ur.out.println("Snapped geometry is invalid")};tr.prototype.computeSnapTolerance=function(){this._snapTolerance=mi.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};tr.prototype.snap=function(t){var e=this.removeCommonBits(t),n=mi.snap(e[0],e[1],this._snapTolerance);return n};tr.prototype.interfaces_=function(){return[]};tr.prototype.getClass=function(){return tr};tr.overlayOp=function(t,e,n){var i=new tr(t,e);return i.getResultGeometry(n)};tr.union=function(t,e){return tr.overlayOp(t,e,We.UNION)};tr.intersection=function(t,e){return tr.overlayOp(t,e,We.INTERSECTION)};tr.symDifference=function(t,e){return tr.overlayOp(t,e,We.SYMDIFFERENCE)};tr.difference=function(t,e){return tr.overlayOp(t,e,We.DIFFERENCE)};var Fr=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Fr.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=We.overlayOp(this._geom[0],this._geom[1],t);var a=!0;a&&(n=!0)}catch(c){if(c instanceof Ga)i=c;else throw c}finally{}if(!n)try{e=tr.overlayOp(this._geom[0],this._geom[1],t)}catch(c){throw c instanceof Ga?i:c}finally{}return e};Fr.prototype.interfaces_=function(){return[]};Fr.prototype.getClass=function(){return Fr};Fr.overlayOp=function(t,e,n){var i=new Fr(t,e);return i.getResultGeometry(n)};Fr.union=function(t,e){return Fr.overlayOp(t,e,We.UNION)};Fr.intersection=function(t,e){return Fr.overlayOp(t,e,We.INTERSECTION)};Fr.symDifference=function(t,e){return Fr.overlayOp(t,e,We.SYMDIFFERENCE)};Fr.difference=function(t,e){return Fr.overlayOp(t,e,We.DIFFERENCE)};var Df=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Df.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Df.prototype.interfaces_=function(){return[]};Df.prototype.getClass=function(){return Df};var yo=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];this._eventType=t.INSERT,this._label=i,this._xValue=a,this._obj=c}},fy={INSERT:{configurable:!0},DELETE:{configurable:!0}};yo.prototype.isDelete=function(){return this._eventType===yo.DELETE};yo.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};yo.prototype.getObject=function(){return this._obj};yo.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};yo.prototype.getInsertEvent=function(){return this._insertEvent};yo.prototype.isInsert=function(){return this._eventType===yo.INSERT};yo.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};yo.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};yo.prototype.interfaces_=function(){return[Jo]};yo.prototype.getClass=function(){return yo};fy.INSERT.get=function(){return 1};fy.DELETE.get=function(){return 2};Object.defineProperties(yo,fy);var km=function(){};km.prototype.interfaces_=function(){return[]};km.prototype.getClass=function(){return km};var pr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};pr.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(pr.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var a=t.getNumPoints()-1;if(e===0&&i===a||i===0&&e===a)return!0}}return!1};pr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};pr.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};pr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};pr.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next(),a=i.getCoordinate();if(t.isIntersection(a))return!0}return!1};pr.prototype.hasProperIntersection=function(){return this._hasProper};pr.prototype.hasIntersection=function(){return this._hasIntersection};pr.prototype.isDone=function(){return this._isDone};pr.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};pr.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};pr.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],p=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(a,c,p,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};pr.prototype.interfaces_=function(){return[]};pr.prototype.getClass=function(){return pr};pr.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var aS=function(t){function e(){t.call(this),this.events=new te,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){var n=this;gs.sort(this.events);for(var i=0;ie||this._maxc?1:0};Rf.prototype.interfaces_=function(){return[xh]};Rf.prototype.getClass=function(){return Rf};var lS=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],i=arguments[1],a=arguments[2];this._min=n,this._max=i,this._item=a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,i,a){if(!this.intersects(n,i))return null;a.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xa),uS=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],i=arguments[1];this._node1=n,this._node2=i,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},e.prototype.query=function(n,i,a){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,a),this._node2!==null&&this._node2.query(n,i,a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(xa),ba=function(){this._leaves=new te,this._root=null,this._level=0};ba.prototype.buildTree=function(){var t=this;gs.sort(this._leaves,new xa.NodeComparator);for(var e=this._leaves,n=null,i=new te;;){if(t.buildLevel(e,i),i.size()===1)return i.get(0);n=e,e=i,i=n}};ba.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new lS(t,e,n))};ba.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};ba.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ba.prototype.printNode=function(t){ur.out.println(fs.toLineString(new wt(t._min,this._level),new wt(t._max,this._level)))};ba.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ba.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),a=0,c=n.iterator();c.hasNext();){var p=c.next();i[a++]=p.getCoordinate().copy()}return i},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,i,a){if(this.isBoundaryNode(n,i))return null;a===Lt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,a)},e.prototype.addPolygonRing=function(n,i,a){if(n.isEmpty())return null;var c=rn.removeRepeatedPoints(n.getCoordinates());if(c.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=c[0],null;var p=i,u=a;ce.isCCW(c)&&(p=a,u=i);var b=new Am(c,new Sn(this._argIndex,Lt.BOUNDARY,p,u));this._lineEdgeMap.put(n,b),this.insertEdge(b),this.insertPoint(this._argIndex,c[0],Lt.BOUNDARY)},e.prototype.insertPoint=function(n,i,a){var c=this._nodes.addNode(i),p=c.getLabel();p===null?c._label=new Sn(n,a):p.setLocation(n,a)},e.prototype.createEdgeSetIntersector=function(){return new aS},e.prototype.addSelfIntersectionNodes=function(n){for(var i=this,a=this._edges.iterator();a.hasNext();)for(var c=a.next(),p=c.getLabel().getLocation(n),u=c.eiList.iterator();u.hasNext();){var b=u.next();i.addSelfIntersectionNode(n,b.coord,p)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof ha&&(this._useBoundaryDeterminationRule=!1),n instanceof Di)this.addPolygon(n);else if(n instanceof ai)this.addLineString(n);else if(n instanceof mo)this.addPoint(n);else if(n instanceof Th)this.addCollection(n);else if(n instanceof au)this.addCollection(n);else if(n instanceof ha)this.addCollection(n);else if(n instanceof Nr)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var i=this,a=0;a50?(this._areaPtLocator===null&&(this._areaPtLocator=new Rh(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,i){return n.isInBoundary(i)?Lt.BOUNDARY:Lt.INTERIOR},e}(ii),zh=function(){if(this._li=new gu,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new tf(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=Xo.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tf(0,e,i),this._arg[1]=new tf(1,n,i)}else if(arguments.length===3){var a=arguments[0],c=arguments[1],p=arguments[2];a.getPrecisionModel().compareTo(c.getPrecisionModel())>=0?this.setComputationPrecision(a.getPrecisionModel()):this.setComputationPrecision(c.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new tf(0,a,p),this._arg[1]=new tf(1,c,p)}};zh.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};zh.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};zh.prototype.interfaces_=function(){return[]};zh.prototype.getClass=function(){return zh};var ou=function(){};ou.prototype.interfaces_=function(){return[]};ou.prototype.getClass=function(){return ou};ou.map=function(){if(arguments[0]instanceof De&&Ne(arguments[1],ou.MapOp)){for(var t=arguments[0],e=arguments[1],n=new te,i=0;i=t.size()?null:t.get(e)};bi.union=function(t){var e=new bi(t);return e.union()};Ax.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(bi,Ax);var Dm=function(){};Dm.prototype.interfaces_=function(){return[]};Dm.prototype.getClass=function(){return Dm};Dm.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return We.createEmptyResult(We.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Fr.overlayOp(t,e,We.UNION)};function _u(){return new Rm}function Rm(){this.reset()}Rm.prototype={constructor:Rm,reset:function(){this.s=this.t=0},add:function(t){Sv(um,t,this.t),Sv(this,um.s,this.s),this.s?this.t+=um.t:this.s=um.t},valueOf:function(){return this.s}};var um=new Rm;function Sv(t,e,n){var i=t.s=e+n,a=i-e,c=i-a;t.t=e-c+(n-a)}var si=1e-6,kn=Math.PI,Va=kn/2,Cv=kn/4,Ha=kn*2,eu=180/kn,Ms=kn/180,kr=Math.abs,cS=Math.atan,Fh=Math.atan2,Mi=Math.cos,Ai=Math.sin,Jh=Math.sqrt;function kx(t){return t>1?0:t<-1?kn:Math.acos(t)}function uc(t){return t>1?Va:t<-1?-Va:Math.asin(t)}function uf(){}function Nm(t,e){t&&Lv.hasOwnProperty(t.type)&&Lv[t.type](t,e)}var Tv={Feature:function(t,e){Nm(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,a=n.length;++ikn?t-Ha:t<-kn?t+Ha:t,e]}F_.invert=F_;function pS(t,e,n){return(t%=Ha)?e||n?Dx(Av(t),kv(e,n)):Av(t):e||n?kv(e,n):F_}function Mv(t){return function(e,n){return e+=t,[e>kn?e-Ha:e<-kn?e+Ha:e,n]}}function Av(t){var e=Mv(t);return e.invert=Mv(-t),e}function kv(t,e){var n=Mi(t),i=Ai(t),a=Mi(e),c=Ai(e);function p(u,b){var w=Mi(b),T=Mi(u)*w,P=Ai(u)*w,k=Ai(b),B=k*n+T*i;return[Fh(P*a-B*c,T*n-k*i),uc(B*a+P*c)]}return p.invert=function(u,b){var w=Mi(b),T=Mi(u)*w,P=Ai(u)*w,k=Ai(b),B=k*a-P*c;return[Fh(P*a+k*c,T*n+B*i),uc(B*n-T*i)]},p}function fS(t,e,n,i,a,c){if(n){var p=Mi(e),u=Ai(e),b=i*n;a==null?(a=e+i*Ha,c=e-b/2):(a=Dv(p,a),c=Dv(p,c),(i>0?ac)&&(a+=i*Ha));for(var w,T=a;i>0?T>c:T1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function dS(t,e,n,i,a,c){var p=t[0],u=t[1],b=e[0],w=e[1],T=0,P=1,k=b-p,B=w-u,V;if(V=n-p,!(!k&&V>0)){if(V/=k,k<0){if(V0){if(V>P)return;V>T&&(T=V)}if(V=a-p,!(!k&&V<0)){if(V/=k,k<0){if(V>P)return;V>T&&(T=V)}else if(k>0){if(V0)){if(V/=B,B<0){if(V0){if(V>P)return;V>T&&(T=V)}if(V=c-u,!(!B&&V<0)){if(V/=B,B<0){if(V>P)return;V>T&&(T=V)}else if(B>0){if(V0&&(t[0]=p+T*k,t[1]=u+T*B),P<1&&(e[0]=p+P*k,e[1]=u+P*B),!0}}}}}function _m(t,e){return kr(t[0]-e[0])=0;--u)a.point((P=T[u])[0],P[1]);else i(k.x,k.p.x,-1,a);k=k.p}k=k.o,T=k.z,B=!B}while(!k.v);a.lineEnd()}}}function Rv(t){if(e=t.length){for(var e,n=0,i=t[0],a;++ne?1:t>=e?0:NaN}function mS(t){return t.length===1&&(t=gS(t)),{left:function(e,n,i,a){for(i==null&&(i=0),a==null&&(a=e.length);i>>1;t(e[c],n)<0?i=c+1:a=c}return i},right:function(e,n,i,a){for(i==null&&(i=0),a==null&&(a=e.length);i>>1;t(e[c],n)>0?a=c:i=c+1}return i}}}function gS(t){return function(e,n){return zx(t(e),n)}}mS(zx);function Ox(t){for(var e=t.length,n,i=-1,a=0,c,p;++i=0;)for(p=t[e],n=p.length;--n>=0;)c[--a]=p[n];return c}var cf=1e9,fm=-cf;function _S(t,e,n,i){function a(w,T){return t<=w&&w<=n&&e<=T&&T<=i}function c(w,T,P,k){var B=0,V=0;if(w==null||(B=p(w,P))!==(V=p(T,P))||b(w,T)<0^P>0)do k.point(B===0||B===3?t:n,B>1?i:e);while((B=(B+P+4)%4)!==V);else k.point(T[0],T[1])}function p(w,T){return kr(w[0]-t)0?0:3:kr(w[0]-n)0?2:1:kr(w[1]-e)0?1:0:T>0?3:2}function u(w,T){return b(w.x,T.x)}function b(w,T){var P=p(w,1),k=p(T,1);return P!==k?P-k:P===0?T[1]-w[1]:P===1?w[0]-T[0]:P===2?w[1]-T[1]:T[0]-w[0]}return function(w){var T=w,P=Rx(),k,B,V,tt,ot,ut,W,X,J,ht,vt,gt={point:St,lineStart:Ct,lineEnd:ie,polygonStart:Ft,polygonEnd:mt};function St(ee,ge){a(ee,ge)&&T.point(ee,ge)}function It(){for(var ee=0,ge=0,Te=B.length;gei&&(qn-Me)*(i-Dn)>(Zn-Dn)*(t-Me)&&++ee:Zn<=i&&(qn-Me)*(i-Dn)<(Zn-Dn)*(t-Me)&&--ee;return ee}function Ft(){T=P,k=[],B=[],vt=!0}function mt(){var ee=It(),ge=vt&&ee,Te=(k=Ox(k)).length;(ge||Te)&&(w.polygonStart(),ge&&(w.lineStart(),c(null,null,1,w),w.lineEnd()),Te&&Nx(k,u,ee,c,w),w.polygonEnd()),T=w,k=B=V=null}function Ct(){gt.point=Tt,B&&B.push(V=[]),ht=!0,J=!1,W=X=NaN}function ie(){k&&(Tt(tt,ot),ut&&J&&P.rejoin(),k.push(P.result())),gt.point=St,J&&T.lineEnd()}function Tt(ee,ge){var Te=a(ee,ge);if(B&&V.push([ee,ge]),ht)tt=ee,ot=ge,ut=Te,ht=!1,Te&&(T.lineStart(),T.point(ee,ge));else if(Te&&J)T.point(ee,ge);else{var Oe=[W=Math.max(fm,Math.min(cf,W)),X=Math.max(fm,Math.min(cf,X))],on=[ee=Math.max(fm,Math.min(cf,ee)),ge=Math.max(fm,Math.min(cf,ge))];dS(Oe,on,t,e,n,i)?(J||(T.lineStart(),T.point(Oe[0],Oe[1])),T.point(on[0],on[1]),Te||T.lineEnd(),vt=!1):Te&&(T.lineStart(),T.point(ee,ge),vt=!1)}W=ee,X=ge,J=Te}return gt}}var d_=_u();function yS(t,e){var n=e[0],i=e[1],a=[Ai(n),-Mi(n),0],c=0,p=0;d_.reset();for(var u=0,b=t.length;u=0?1:-1,St=gt*vt,It=St>kn,Ft=V*J;if(d_.add(Fh(Ft*gt*Ai(St),tt*ht+Ft*Mi(St))),c+=It?vt+gt*Ha:vt,It^k>=n^W>=n){var mt=zm(Bh(P),Bh(ut));O_(mt);var Ct=zm(a,mt);O_(Ct);var ie=(It^vt>=0?-1:1)*uc(Ct[2]);(i>ie||i===ie&&(mt[0]||mt[1]))&&(p+=It^vt>=0?1:-1)}}return(c<-si||cNf&&(Nf=t),eFm&&(Fm=e)}_u();function Fx(t,e,n,i){return function(a,c){var p=e(c),u=a.invert(i[0],i[1]),b=Rx(),w=e(b),T=!1,P,k,B,V={point:tt,lineStart:ut,lineEnd:W,polygonStart:function(){V.point=X,V.lineStart=J,V.lineEnd=ht,k=[],P=[]},polygonEnd:function(){V.point=tt,V.lineStart=ut,V.lineEnd=W,k=Ox(k);var vt=yS(P,u);k.length?(T||(c.polygonStart(),T=!0),Nx(k,bS,vt,n,c)):vt&&(T||(c.polygonStart(),T=!0),c.lineStart(),n(null,null,1,c),c.lineEnd()),T&&(c.polygonEnd(),T=!1),k=P=null},sphere:function(){c.polygonStart(),c.lineStart(),n(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function tt(vt,gt){var St=a(vt,gt);t(vt=St[0],gt=St[1])&&c.point(vt,gt)}function ot(vt,gt){var St=a(vt,gt);p.point(St[0],St[1])}function ut(){V.point=ot,p.lineStart()}function W(){V.point=tt,p.lineEnd()}function X(vt,gt){B.push([vt,gt]);var St=a(vt,gt);w.point(St[0],St[1])}function J(){w.lineStart(),B=[]}function ht(){X(B[0][0],B[0][1]),w.lineEnd();var vt=w.clean(),gt=b.result(),St,It=gt.length,Ft,mt,Ct;if(B.pop(),P.push(B),B=null,!!It){if(vt&1){if(mt=gt[0],(Ft=mt.length-1)>0){for(T||(c.polygonStart(),T=!0),c.lineStart(),St=0;St1&&vt&2&>.push(gt.pop().concat(gt.shift())),k.push(gt.filter(xS))}}return V}}function xS(t){return t.length>1}function bS(t,e){return((t=t.x)[0]<0?t[1]-Va-si:Va-t[1])-((e=e.x)[0]<0?e[1]-Va-si:Va-e[1])}const Ov=Fx(function(){return!0},wS,ES,[-kn,-Va]);function wS(t){var e=NaN,n=NaN,i=NaN,a;return{lineStart:function(){t.lineStart(),a=1},point:function(c,p){var u=c>0?kn:-kn,b=kr(c-e);kr(b-kn)0?Va:-Va),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(c,n),a=0):i!==u&&b>=kn&&(kr(e-i)si?cS((Ai(e)*(c=Mi(i))*Ai(n)-Ai(i)*(a=Mi(e))*Ai(t))/(a*c*p)):(e+i)/2}function ES(t,e,n,i){var a;if(t==null)a=n*Va,i.point(-kn,a),i.point(0,a),i.point(kn,a),i.point(kn,0),i.point(kn,-a),i.point(0,-a),i.point(-kn,-a),i.point(-kn,0),i.point(-kn,a);else if(kr(t[0]-e[0])>si){var c=t[0]0,a=kr(n)>si;function c(T,P,k,B){fS(B,t,e,k,T,P)}function p(T,P){return Mi(T)*Mi(P)>n}function u(T){var P,k,B,V,tt;return{lineStart:function(){V=B=!1,tt=1},point:function(ot,ut){var W=[ot,ut],X,J=p(ot,ut),ht=i?J?0:w(ot,ut):J?w(ot+(ot<0?kn:-kn),ut):0;if(!P&&(V=B=J)&&T.lineStart(),J!==B&&(X=b(P,W),(!X||_m(P,X)||_m(W,X))&&(W[0]+=si,W[1]+=si,J=p(W[0],W[1]))),J!==B)tt=0,J?(T.lineStart(),X=b(W,P),T.point(X[0],X[1])):(X=b(P,W),T.point(X[0],X[1]),T.lineEnd()),P=X;else if(a&&P&&i^J){var vt;!(ht&k)&&(vt=b(W,P,!0))&&(tt=0,i?(T.lineStart(),T.point(vt[0][0],vt[0][1]),T.point(vt[1][0],vt[1][1]),T.lineEnd()):(T.point(vt[1][0],vt[1][1]),T.lineEnd(),T.lineStart(),T.point(vt[0][0],vt[0][1])))}J&&(!P||!_m(P,W))&&T.point(W[0],W[1]),P=W,B=J,k=ht},lineEnd:function(){B&&T.lineEnd(),P=null},clean:function(){return tt|(V&&B)<<1}}}function b(T,P,k){var B=Bh(T),V=Bh(P),tt=[1,0,0],ot=zm(B,V),ut=cm(ot,ot),W=ot[0],X=ut-W*W;if(!X)return!k&&T;var J=n*ut/X,ht=-n*W/X,vt=zm(tt,ot),gt=hm(tt,J),St=hm(ot,ht);f_(gt,St);var It=vt,Ft=cm(gt,It),mt=cm(It,It),Ct=Ft*Ft-mt*(cm(gt,gt)-1);if(!(Ct<0)){var ie=Jh(Ct),Tt=hm(It,(-Ft-ie)/mt);if(f_(Tt,gt),Tt=z_(Tt),!k)return Tt;var ee=T[0],ge=P[0],Te=T[1],Oe=P[1],on;ge0^Tt[1]<(kr(Tt[0]-ee)kn^(ee<=Tt[0]&&Tt[0]<=ge)){var Dn=hm(It,(-Ft+ie)/mt);return f_(Dn,gt),[Tt,z_(Dn)]}}}function w(T,P){var k=i?t:kn-t,B=0;return T<-k?B|=1:T>k&&(B|=2),P<-k?B|=4:P>k&&(B|=8),B}return Fx(p,u,c,i?[0,-t]:[-kn,t-kn])}function Bx(t){return function(e){var n=new B_;for(var i in t)n[i]=t[i];return n.stream=e,n}}function B_(){}B_.prototype={constructor:B_,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Vx(t,e,n){var i=e[1][0]-e[0][0],a=e[1][1]-e[0][1],c=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),c!=null&&t.clipExtent(null),hS(n,t.stream(zv));var p=zv.result(),u=Math.min(i/(p[1][0]-p[0][0]),a/(p[1][1]-p[0][1])),b=+e[0][0]+(i-u*(p[1][0]+p[0][0]))/2,w=+e[0][1]+(a-u*(p[1][1]+p[0][1]))/2;return c!=null&&t.clipExtent(c),t.scale(u*150).translate([b,w])}function CS(t,e,n){return Vx(t,[[0,0],e],n)}var Fv=16,TS=Mi(30*Ms);function Bv(t,e){return+e?PS(t,e):LS(t)}function LS(t){return Bx({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function PS(t,e){function n(i,a,c,p,u,b,w,T,P,k,B,V,tt,ot){var ut=w-i,W=T-a,X=ut*ut+W*W;if(X>4*e&&tt--){var J=p+k,ht=u+B,vt=b+V,gt=Jh(J*J+ht*ht+vt*vt),St=uc(vt/=gt),It=kr(kr(vt)-1)e||kr((ut*ie+W*Tt)/X-.5)>.3||p*k+u*B+b*V2?Tt[2]%360*Ms:0,Ct()):[w*eu,T*eu,P*eu]},It.precision=function(Tt){return arguments.length?(vt=Bv(mt,ht=Tt*Tt),ie()):Jh(ht)},It.fitExtent=function(Tt,ee){return Vx(It,Tt,ee)},It.fitSize=function(Tt,ee){return CS(It,Tt,ee)};function Ct(){B=Dx(k=pS(w,T,P),e);var Tt=e(u,b);return c=i-Tt[0]*n,p=a+Tt[1]*n,ie()}function ie(){return gt=St=null,It}return function(){return e=t.apply(this,arguments),It.invert=e.invert&&Ft,Ct()}}function Ux(t){return function(e,n){var i=Mi(e),a=Mi(n),c=t(i*a);return[c*a*Ai(e),c*Ai(n)]}}function Gx(t){return function(e,n){var i=Jh(e*e+n*n),a=t(i),c=Ai(a),p=Mi(a);return[Fh(e*c,i*p),uc(i&&n*c/i)]}}var DS=Ux(function(t){return Jh(2/(1+t))});DS.invert=Gx(function(t){return 2*uc(t/2)});var qx=Ux(function(t){return(t=kx(t))&&t/Ai(t)});qx.invert=Gx(function(t){return t});function RS(){return AS(qx).scale(79.4188).clipAngle(180-.001)}function Vv(t,e){return[t,e]}Vv.invert=Vv;function NS(t,e,n){n=n||{};var i=n.units||"kilometers",a=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof a!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(a<=0)throw new Error("steps must be greater than 0");var c=[];switch(t.type){case"GeometryCollection":return rx(t,function(p){var u=ym(p,e,i,a);u&&c.push(u)}),k_(c);case"FeatureCollection":return xv(t,function(p){var u=ym(p,e,i,a);u&&xv(u,function(b){b&&c.push(b)})}),k_(c)}return ym(t,e,i,a)}function ym(t,e,n,i){var a=t.properties||{},c=t.type==="Feature"?t.geometry:t;if(c.type==="GeometryCollection"){var p=[];return rx(t,function(tt){var ot=ym(tt,e,n,i);ot&&p.push(ot)}),k_(p)}var u=zS(c),b={type:c.type,coordinates:Zx(c.coordinates,u)},w=new sy,T=w.read(b),P=qE(jE(e,n),"meters"),k=ar.bufferOp(T,P,i),B=new dx;if(k=B.write(k),!jx(k.coordinates)){var V={type:k.type,coordinates:Wx(k.coordinates,u)};return qm(V,a)}}function jx(t){return Array.isArray(t[0])?jx(t[0]):isNaN(t[0])}function Zx(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return Zx(n,e)})}function Wx(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return Wx(n,e)})}function zS(t){var e=WE(t).geometry.coordinates,n=[-e[0],-e[1]];return RS().rotate(n).scale(Co)}function OS(t,e){var n=Lm(t),i=Lm(e),a=t.properties||{},c=$1.difference(n.coordinates,i.coordinates);return c.length===0?null:c.length===1?ex(c[0],a):nx(c,a)}function Uv(t){let e;for(const n of t)e&&n[0]-e[0]>=180?n[0]-=360:e&&n[0]-e[0]<-180&&(n[0]+=360),e=n}function Gv(t,e){const n=OS({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const i=NS(t,0);if(i.geometry.type==="Polygon")for(const a of i.geometry.coordinates)Uv(a);else for(const a of i.geometry.coordinates)for(const c of a)Uv(c);e({type:"FeatureCollection",features:[i,n]})}let qv={type:"FeatureCollection",features:[]};function FS(t,e,n=!0,i=!0,a={},c={},p={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,b=[],w,T;function P(){(p!=null&&p.fill||p!=null&&p.line)&&t.addSource("full-geom",{type:"geojson",data:qv}),p!=null&&p.fill&&t.addLayer({...p==null?void 0:p.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),p!=null&&p.line&&t.addLayer({...p==null?void 0:p.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?P():t.once("load",()=>{P()});const k=V=>{u==null||u({type:"mapClick",coordinates:[V.lngLat.lng,V.lngLat.lat]})};function B(V=!1){if(!e)throw new Error;const tt=document.createElement("div");return V&&tt.classList.add("marker-interactive"),new fE({props:{displayIn:"maplibre"},target:tt}),new e.Marker({element:tt,offset:[1,-13]})}return{setEventHandler(V){V?(u=V,t.on("click",k)):(u=void 0,t.off("click",k))},flyTo(V,tt){t.flyTo({center:V,zoom:tt,...a})},fitBounds(V,tt,ot){t.fitBounds([[V[0],V[1]],[V[2],V[3]]],{padding:tt,maxZoom:ot,...c})},indicateReverse(V){t.getCanvasContainer().style.cursor=V?"crosshair":""},setReverseMarker(V){!e||!n||(T?V?T.setLngLat(V):(T.remove(),T=void 0):V&&(T=(typeof n=="object"?new e.Marker(n):B()).setLngLat(V).addTo(t),T.getElement().classList.add("marker-reverse")))},setMarkers(V,tt){if(!n)return;function ot(ut){var W;(W=t.getSource("full-geom"))==null||W.setData(ut)}for(const ut of b)ut.remove();if(b.length=0,ot(qv),!!e){if(tt){let ut=!1;if(tt.geometry.type==="GeometryCollection"){const W=tt.geometry.geometries.filter(X=>X.type==="Polygon"||X.type==="MultiPolygon");if(W.length>0){let X=W.pop();for(const J of W)X=ZE(X,J);Gv({...tt,geometry:X},ot),ut=!0}else{const X=tt.geometry.geometries.filter(J=>J.type==="LineString"||J.type==="MultiLineString");X.length>0&&(ot({...tt,geometry:{type:"GeometryCollection",geometries:X}}),ut=!0)}}if(!ut){if(tt.geometry.type==="Polygon"||tt.geometry.type==="MultiPolygon")Gv(tt,ot);else if(tt.geometry.type==="LineString"||tt.geometry.type==="MultiLineString"){ot(tt);return}}n&&b.push((typeof n=="object"?new e.Marker(n):B()).setLngLat(tt.center).addTo(t))}if(i)for(const ut of V??[]){if(ut===tt)continue;const W=(typeof i=="object"?new e.Marker(i):B(!0)).setLngLat(ut.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(ut.place_type[0]==="reverse"?ut.place_name:ut.place_name.replace(/,.*/,""))).addTo(t),X=W.getElement();X.addEventListener("click",J=>{J.stopPropagation(),u==null||u({type:"markerClick",id:ut.id})}),X.addEventListener("mouseenter",()=>{u==null||u({type:"markerMouseEnter",id:ut.id}),W.togglePopup()}),X.addEventListener("mouseleave",()=>{u==null||u({type:"markerMouseLeave",id:ut.id}),W.togglePopup()}),b.push(W)}}},setSelectedMarker(V){w&&w.getElement().classList.toggle("marker-selected",!1),w=V>-1?b[V]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const V=t.getCenter();return[t.getZoom(),V.lng,V.lat]}}}function BS(t){let e,n;return{c(){e=yl("svg"),n=yl("path"),zt(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"),zt(e,"viewBox","0 0 14 14"),zt(e,"width","13"),zt(e,"height","13"),zt(e,"class","svelte-en2qvf")},m(i,a){fe(i,e,a),Zt(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&pe(e)}}}class Hx extends Tn{constructor(e){super(),Cn(this,e,null,BS,In,{})}}function VS(t){let e,n;return{c(){e=yl("svg"),n=yl("path"),zt(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"),zt(e,"viewBox","0 0 30 30"),zt(e,"fill","none"),zt(e,"xmlns","http://www.w3.org/2000/svg"),zt(e,"class","svelte-d2loi5")},m(i,a){fe(i,e,a),Zt(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&pe(e)}}}class Xx extends Tn{constructor(e){super(),Cn(this,e,null,VS,In,{})}}function US(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"area.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"area.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function GS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"reverse.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"reverse.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function qS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"poi.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"poi.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function jS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"postal_code.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"postal_code.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function ZS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"street.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"street.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function WS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"road.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"road.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function HS(t){let e,n;return{c(){e=se("img"),fo(e.src,n=t[3]+"housenumber.svg")||zt(e,"src",n),zt(e,"alt",t[6]),zt(e,"class","svelte-ltkwvy")},m(i,a){fe(i,e,a)},p(i,a){a&8&&!fo(e.src,n=i[3]+"housenumber.svg")&&zt(e,"src",n),a&64&&zt(e,"alt",i[6])},d(i){i&&pe(e)}}}function XS(t){let e,n,i,a;return{c(){e=se("img"),fo(e.src,n=t[5])||zt(e,"src",n),zt(e,"alt",t[4]),zt(e,"class","svelte-ltkwvy")},m(c,p){fe(c,e,p),i||(a=un(e,"error",t[14]),i=!0)},p(c,p){p&32&&!fo(e.src,n=c[5])&&zt(e,"src",n),p&16&&zt(e,"alt",c[4])},d(c){c&&pe(e),i=!1,a()}}}function jv(t){let e,n;return{c(){e=se("span"),n=Un(t[6]),zt(e,"class","secondary svelte-ltkwvy")},m(i,a){fe(i,e,a),Zt(e,n)},p(i,a){a&64&&wl(n,i[6])},d(i){i&&pe(e)}}}function YS(t){var gt,St;let e,n,i,a,c,p,u,b,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",T,P,k=t[2]==="always"||t[2]&&!t[0].address&&((gt=t[0].properties)==null?void 0:gt.kind)!=="road"&&((St=t[0].properties)==null?void 0:St.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],B,V,tt=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",ot,ut,W;function X(It,Ft){var mt,Ct;return Ft&1&&(n=null),Ft&1&&(i=null),Ft&1&&(a=null),It[5]?XS:It[0].address?HS:((mt=It[0].properties)==null?void 0:mt.kind)==="road"||((Ct=It[0].properties)==null?void 0:Ct.kind)==="road_relation"?WS:(n==null&&(n=!!It[0].id.startsWith("address.")),n?ZS:(i==null&&(i=!!It[0].id.startsWith("postal_code.")),i?jS:(a==null&&(a=!!It[0].id.startsWith("poi.")),a?qS:It[7]?GS:US)))}let J=X(t,-1),ht=J(t),vt=k&&jv(t);return{c(){e=se("li"),ht.c(),c=qe(),p=se("span"),u=se("span"),b=se("span"),T=Un(w),P=qe(),vt&&vt.c(),B=qe(),V=se("span"),ot=Un(tt),zt(b,"class","primary svelte-ltkwvy"),zt(u,"class","svelte-ltkwvy"),zt(V,"class","line2 svelte-ltkwvy"),zt(p,"class","texts svelte-ltkwvy"),zt(e,"tabindex","0"),zt(e,"data-selected",t[1]),zt(e,"class","svelte-ltkwvy"),Ba(e,"selected",t[1])},m(It,Ft){fe(It,e,Ft),ht.m(e,null),Zt(e,c),Zt(e,p),Zt(p,u),Zt(u,b),Zt(b,T),Zt(u,P),vt&&vt.m(u,null),Zt(p,B),Zt(p,V),Zt(V,ot),ut||(W=[un(e,"mouseenter",t[12]),un(e,"focus",t[13])],ut=!0)},p(It,[Ft]){var mt,Ct;J===(J=X(It,Ft))&&ht?ht.p(It,Ft):(ht.d(1),ht=J(It),ht&&(ht.c(),ht.m(e,c))),Ft&1&&w!==(w=(It[7]?It[0].place_name:It[0].place_name.replace(/,.*/,""))+"")&&wl(T,w),Ft&37&&(k=It[2]==="always"||It[2]&&!It[0].address&&((mt=It[0].properties)==null?void 0:mt.kind)!=="road"&&((Ct=It[0].properties)==null?void 0:Ct.kind)!=="road_relation"&&!It[0].id.startsWith("address.")&&!It[0].id.startsWith("postal_code.")&&(!It[0].id.startsWith("poi.")||!It[5])&&!It[7]),k?vt?vt.p(It,Ft):(vt=jv(It),vt.c(),vt.m(u,null)):vt&&(vt.d(1),vt=null),Ft&1&&tt!==(tt=(It[7]?"":It[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&wl(ot,tt),Ft&2&&zt(e,"data-selected",It[1]),Ft&2&&Ba(e,"selected",It[1])},i:Ye,o:Ye,d(It){It&&pe(e),ht.d(),vt&&vt.d(),ut=!1,eo(W)}}}function KS(t,e,n){var X;let i,a,{feature:c}=e,{selected:p=!1}=e,{showPlaceType:u}=e,{missingIconsCache:b}=e,{iconsBaseUrl:w}=e;const T=(X=c.properties)==null?void 0:X.categories;let P,k,B=0,V=c.place_type[0]==="reverse";function tt(J){k&&b.add(k),n(10,B++,B)}function ot(J){Ji.call(this,t,J)}function ut(J){Ji.call(this,t,J)}const W=J=>tt(J.currentTarget);return t.$$set=J=>{"feature"in J&&n(0,c=J.feature),"selected"in J&&n(1,p=J.selected),"showPlaceType"in J&&n(2,u=J.showPlaceType),"missingIconsCache"in J&&n(9,b=J.missingIconsCache),"iconsBaseUrl"in J&&n(3,w=J.iconsBaseUrl)},t.$$.update=()=>{var J,ht,vt,gt;if(t.$$.dirty&3640)do n(11,i--,i),n(4,P=T==null?void 0:T[i]),n(5,k=P?w+P.replace(/ /g,"_")+".svg":void 0);while(i>-1&&(!k||b.has(k)));t.$$.dirty&1&&n(6,a=c.id.startsWith("poi.")?(ht=(J=c.properties)==null?void 0:J.categories)==null?void 0:ht.join(", "):((gt=(vt=c.properties)==null?void 0:vt.place_type_name)==null?void 0:gt[0])??c.place_type[0])},n(11,i=(T==null?void 0:T.length)??0),[c,p,u,w,P,k,a,V,tt,b,B,i,ot,ut,W]}class JS extends Tn{constructor(e){super(),Cn(this,e,KS,YS,In,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function QS(t){let e;return{c(){e=se("div"),e.innerHTML='',zt(e,"class","svelte-7cmwmc")},m(n,i){fe(n,e,i)},p:Ye,i:Ye,o:Ye,d(n){n&&pe(e)}}}class $S extends Tn{constructor(e){super(),Cn(this,e,null,QS,In,{})}}function tC(t){let e,n;return{c(){e=yl("svg"),n=yl("path"),zt(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"),zt(e,"viewBox","0 0 60.006 21.412"),zt(e,"width","14"),zt(e,"height","20"),zt(e,"class","svelte-en2qvf")},m(i,a){fe(i,e,a),Zt(e,n)},p:Ye,i:Ye,o:Ye,d(i){i&&pe(e)}}}class eC extends Tn{constructor(e){super(),Cn(this,e,null,tC,In,{})}}function nC(t){let e,n,i;return{c(){e=yl("svg"),n=yl("circle"),i=yl("path"),zt(n,"cx","4.789"),zt(n,"cy","4.787"),zt(n,"r","3.85"),ju(n,"stroke-width","1.875"),ju(n,"fill","none"),zt(i,"d","M12.063 12.063 7.635 7.635"),ju(i,"stroke-width","1.875"),ju(i,"stroke-linecap","round"),zt(e,"xmlns","http://www.w3.org/2000/svg"),zt(e,"width","13"),zt(e,"height","13"),zt(e,"viewBox","0 0 13 13"),zt(e,"class","svelte-1bpbt60")},m(a,c){fe(a,e,c),Zt(e,n),Zt(e,i)},p:Ye,i:Ye,o:Ye,d(a){a&&pe(e)}}}class iC extends Tn{constructor(e){super(),Cn(this,e,null,nC,In,{})}}function rC(t,e,n){const i=e[1],a=e[0],c=i-a;return t===i&&n?t:((t-a)%c+c)%c+a}function Zv(t){const e=[...t];return e[2]i[0]||a.maxZoom!=null&&a.maxZoomDate.now()){if(!ef.coords)break t;return ef.coords}let c;try{return c=await new Promise((p,u)=>{n.signal.addEventListener("abort",()=>{u(Error("aborted"))}),navigator.geolocation.getCurrentPosition(b=>{p([b.coords.longitude,b.coords.latitude].map(w=>w.toFixed(6)).join(","))},b=>{u(b)},a)}),c}catch{}finally{a.cachedLocationExpiry&&(ef={time:Date.now(),coords:c})}if(n.signal.aborted)return}if(a.type==="server-geolocation")return"ip";if(i&&a.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}const Wv=/(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,Hv=/(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,Xv=/(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,Yv=/(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 sC(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(p=>Number(p.trim()));let n=Kv(e[0],t),i=Kv(e[1],t);n.endsWith('.0"')&&i.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),i=i.replace(/\.0"$/,'"'));const a=e[0]>=0?" N":" S",c=e[1]>=0?" E":" W";return`${n+a}, ${i+c}`}else throw new Error("no decimal coordinates to convert")}function Kv(t,e){const n=Math.abs(t),i=Math.floor(n),a=(n-i)*60;if(e=="DM"){let u=aC(a,3).toFixed(3).padStart(6,"0");return`${i}° ${u}'`}let c=Math.floor(a),p=((a-c)*60).toFixed(1).padStart(4,"0");return c=c.toString().padStart(2,"0"),`${i}° ${c}' ${p}"`}function aC(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function my(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,i=null,a="",c="",p=[],u=!1;if(Wv.test(t))if(p=Wv.exec(t),u=dm(p),u){if(n=p[2],i=p[6],n.includes(",")&&(n=n.replace(",",".")),i.includes(",")&&(i=i.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(i))==Number(i))throw new Error("integer only coordinate provided");p[1]?(a=p[1],c=p[5]):p[4]&&(a=p[4],c=p[8])}else throw new Error("invalid decimal coordinate format");else if(Hv.test(t))if(p=Hv.exec(t),u=dm(p),u)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6].replace(",",".")/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[9])),p[11]&&(i+=p[11]/60),p[13]&&(i+=p[13].replace(",",".")/3600),parseInt(p[9])<0&&(i=-1*i),p[1]?(a=p[1],c=p[8]):p[7]&&(a=p[7],c=p[14]);else throw new Error("invalid DMS coordinates format");else if(Xv.test(t))if(p=Xv.exec(t),u=dm(p),u)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(a=p[1],c=p[9]):p[8]&&(a=p[8],c=p[16]);else throw new Error("invalid DMS coordinates format");else if(Yv.test(t))if(p=Yv.exec(t),u=dm(p),u)n=Math.abs(parseInt(p[2])),p[4]&&(n+=p[4]/60),p[6]&&(n+=p[6]/3600),parseInt(p[2])<0&&(n=-1*n),i=Math.abs(parseInt(p[10])),p[12]&&(i+=p[12]/60),p[14]&&(i+=p[14]/3600),parseInt(p[10])<0&&(i=-1*i),p[1]?(a=p[1],c=p[9]):p[8]&&(a=p[8],c=p[16]);else throw new Error("invalid coordinates format");if(u){if(Math.abs(i)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((a||c)&&(!a||!c))throw new Error("invalid coordinates format");if(a&&a==c)throw new Error("invalid coordinates format");let b=/S|SOUTH/i;b.test(a)&&n>0&&(n=-1*n),b=/W|WEST/i,b.test(c)&&i>0&&(i=-1*i);const w=p[0].trim();let T,P;const k=/[,/;\u0020]/g,B=w.match(k);if(B==null){const ot=Math.floor(t.length/2);T=w.substring(0,ot).trim(),P=w.substring(ot).trim()}else{let ot;B.length%2==1?ot=Math.floor(B.length/2):ot=B.length/2-1;let ut=0;if(ot==0)ut=w.indexOf(B[0]),T=w.substring(0,ut).trim(),P=w.substring(ut+1).trim();else{let W=0,X=0;for(;W<=ot;)ut=w.indexOf(B[W],X),X=ut+1,W++;T=w.substring(0,ut).trim(),P=w.substring(ut+1).trim()}}const V=T.split(".");if(V.length==2&&V[1]==0&&V[1].length!=2)throw new Error("invalid coordinates format");const tt=P.split(".");if(tt.length==2&&tt[1]==0&&tt[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(T)||/^\d+$/.test(P))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(i)&&i.includes(",")&&(i=i.replace(",",".")),i=Number(Number(i).toFixed(e)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:T,verbatimLongitude:P,decimalLatitude:n,decimalLongitude:i,decimalCoordinates:`${n},${i}`,closeEnough:lC,toCoordinateFormat:sC})}else throw new Error("coordinates pattern match failed")}function dm(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,i=/[eastsouthnorthwest]+/i,a=e.length/2;for(let c=0;c{e.decimalLatitude?t.push(e):t.push({...e,...hC})}),[...t,...pC,...fC]}const mC=dC();my.formats=mC.map(t=>t.verbatimCoordinates);const gC=my;function Qv(t,e,n){const i=t.slice();return i[81]=e[n],i[83]=n,i}function $v(t){let e,n;return e=new $S({}),{c(){cn(e.$$.fragment)},m(i,a){en(e,i,a),n=!0},i(i){n||(ne(e.$$.fragment,i),n=!0)},o(i){he(e.$$.fragment,i),n=!1},d(i){nn(e,i)}}}function t1(t){let e,n,i,a,c;return n=new eC({}),{c(){e=se("button"),cn(n.$$.fragment),zt(e,"type","button"),zt(e,"title",t[9]),zt(e,"class","svelte-zh3kmv"),Ba(e,"active",t[0])},m(p,u){fe(p,e,u),en(n,e,null),i=!0,a||(c=un(e,"click",t[67]),a=!0)},p(p,u){(!i||u[0]&512)&&zt(e,"title",p[9]),(!i||u[0]&1)&&Ba(e,"active",p[0])},i(p){i||(ne(n.$$.fragment,p),i=!0)},o(p){he(n.$$.fragment,p),i=!1},d(p){p&&pe(e),nn(n),a=!1,c()}}}function _C(t){let e,n=[],i=new Map,a,c,p,u=bm(t[14]);const b=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{gt=null}),cs()),(!X||ee[0]&2)&&Ba(w,"displayable",Tt[1]!==""),Tt[5]===!0?St?(St.p(Tt,ee),ee[0]&32&&ne(St,1)):(St=t1(Tt),St.c(),ne(St,1),St.m(i,V)):St&&(us(),he(St,1,1,()=>{St=null}),cs()),Ft&&Ft.p&&(!X||ee[1]&134217728)&&Bs(Ft,It,Tt,Tt[58],X?Fs(It,Tt[58],ee,null):Vs(Tt[58]),null);let ge=ot;ot=ie(Tt),ot===ge?~ot&&Ct[ot].p(Tt,ee):(ut&&(us(),he(Ct[ge],1,1,()=>{Ct[ge]=null}),cs()),~ot?(ut=Ct[ot],ut?ut.p(Tt,ee):(ut=Ct[ot]=mt[ot](Tt),ut.c()),ne(ut,1),ut.m(n,null)):ut=null),(!X||ee[0]&4&&W!==(W=vm(Tt[2])+" svelte-zh3kmv"))&&zt(n,"class",W),(!X||ee[0]&22)&&Ba(n,"can-collapse",Tt[4]&&Tt[1]==="")},i(Tt){X||(ne(vt),ne(c.$$.fragment,Tt),ne(P.$$.fragment,Tt),ne(gt),ne(St),ne(Ft,Tt),ne(ut),X=!0)},o(Tt){he(vt),he(c.$$.fragment,Tt),he(P.$$.fragment,Tt),he(gt),he(St),he(Ft,Tt),he(ut),X=!1},d(Tt){Tt&&(pe(e),pe(n)),nn(c),t[61](null),nn(P),gt&>.d(),St&&St.d(),Ft&&Ft.d(Tt),~ot&&Ct[ot].d(),J=!1,eo(ht)}}}function wC(t,e,n){let i,{$$slots:a={},$$scope:c}=e,{class:p=void 0}=e,{apiKey:u}=e,{bbox:b=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:T=!1}=e,{collapsed:P=!1}=e,{country:k=void 0}=e,{debounceSearch:B=200}=e,{enableReverse:V=!1}=e,{errorMessage:tt="Something went wrong…"}=e,{filter:ot=()=>!0}=e,{flyTo:ut=!0}=e,{fuzzyMatch:W=!0}=e,{language:X=void 0}=e,{limit:J=void 0}=e,{mapController:ht=void 0}=e,{minLength:vt=2}=e,{noResultsMessage:gt="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:St="Search"}=e,{proximity:It=[{type:"server-geolocation"}]}=e,{reverseActive:Ft=V==="always"}=e,{reverseButtonTitle:mt="toggle reverse geocoding"}=e,{searchValue:Ct=""}=e,{showFullGeometry:ie=!0}=e,{showPlaceType:Tt="ifNeeded"}=e,{showResultsWhileTyping:ee=!0}=e,{selectFirst:ge=!0}=e,{flyToSelected:Te=!1}=e,{markerOnSelected:Oe=!0}=e,{types:on=void 0}=e,{excludeTypes:gn=!1}=e,{zoom:Re=16}=e,{maxZoom:Me=18}=e,{apiUrl:Dn="https://api.maptiler.com/geocoding"}=e,{fetchParameters:qn={}}=e,{iconsBaseUrl:Zn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:Wn=H=>{}}=e;function ri(){Mt.focus()}function Kt(){Mt.blur()}function Ue(H,dt=!0){n(1,Ct=H),dt?(n(15,sn=-1),Ka()):(Ni(),setTimeout(()=>{Mt.focus(),Mt.select()}))}function yn(){n(14,Gt=void 0),n(55,Ie=void 0),n(15,sn=-1)}function br(){n(54,Fe=[]),n(55,Ie=void 0)}let er=!1,Gt,Fe,Ie,Ri="",Mt,sn=-1,Bi,Qe=[],$n,fr,$o,ws;const Ia=new Set,wr=Ff();Il(()=>{ht&&(ht.setEventHandler(void 0),ht.indicateReverse(!1),ht.setSelectedMarker(-1),ht.setMarkers(void 0,void 0))});function Ka(H){if(fr&&(clearTimeout(fr),fr=void 0),sn>-1&&Gt)n(55,Ie=Gt[sn]),n(1,Ct=Ie.place_type[0]==="reverse"?Ie.place_name:Ie.place_name.replace(/,.*/,"")),n(18,Bi=void 0),n(54,Fe=void 0),n(15,sn=-1);else if(Ct){const dt=H||!ts(Ct);Wt(Ct,{exact:!0}).then(()=>{n(54,Fe=Gt),n(55,Ie=void 0),dt&&No()}).catch(lt=>n(18,Bi=lt))}}function ts(H){try{return gC(H,6)}catch{return!1}}async function Wt(H,{byId:dt=!1,exact:lt=!1}={}){n(18,Bi=void 0),$n==null||$n.abort();const xt=new AbortController;n(19,$n=xt);try{const At=ts(H),Rt=new URLSearchParams;if(X!==void 0&&Rt.set("language",Array.isArray(X)?X.join(","):X??""),on&&Rt.set("types",on.join(",")),gn&&Rt.set("excludeTypes",String(gn)),b&&Rt.set("bbox",b.map(ze=>ze.toFixed(6)).join(",")),k&&Rt.set("country",Array.isArray(k)?k.join(","):k),!dt&&!At){const ze=await oC(ht,It,xt);ze&&Rt.set("proximity",ze),(lt||!ee)&&Rt.set("autocomplete","false"),Rt.set("fuzzyMatch",String(W))}J!==void 0&&(!At||(on==null?void 0:on.length)===1)&&Rt.set("limit",String(J)),Rt.set("key",u),Wn(Rt);const Nt=Dn+"/"+encodeURIComponent(At?At.decimalLongitude+","+At.decimalLatitude:H)+".json?"+Rt.toString();if(Nt===Ri){dt?(n(14,Gt=void 0),n(55,Ie=Qe[0])):n(14,Gt=Qe);return}Ri=Nt;const xe=await fetch(Nt,{signal:xt.signal,...qn});if(!xe.ok)throw new Error(await xe.text());const Ee=await xe.json();wr("response",{url:Nt,featureCollection:Ee}),dt?(n(14,Gt=void 0),n(55,Ie=Ee.features[0]),Qe=[Ie]):(n(14,Gt=Ee.features.filter(ot)),At&&Gt.unshift({type:"Feature",properties:{},id:"reverse_"+At.decimalLongitude+"_"+At.decimalLatitude,text:At.decimalLatitude+", "+At.decimalLongitude,place_name:At.decimalLatitude+", "+At.decimalLongitude,place_type:["reverse"],center:[At.decimalLongitude,At.decimalLatitude],bbox:[At.decimalLongitude,At.decimalLatitude,At.decimalLongitude,At.decimalLatitude],geometry:{type:"Point",coordinates:[At.decimalLongitude,At.decimalLatitude]}}),Qe=Gt,At&&Mt.focus())}catch(At){if(At&&typeof At=="object"&&"name"in At&&At.name==="AbortError")return;throw At}finally{xt===$n&&n(19,$n=void 0)}}function No(){var lt;if(!(Fe!=null&&Fe.length)||!ut)return;const H=[180,90,-180,-90],dt=!Fe.some(xt=>!xt.matching_text);for(const xt of Fe)if(dt||!xt.matching_text)for(const At of[0,1,2,3])H[At]=Math[At<2?"min":"max"](H[At],((lt=xt.bbox)==null?void 0:lt[At])??xt.center[At%2]);ht&&Fe.length>0&&(Ie&&H[0]===H[2]&&H[1]===H[3]?ht.flyTo(Ie.center,Re):ht.fitBounds(Zv(H),50,Me))}function Br(H){n(0,Ft=V==="always"),n(14,Gt=void 0),n(55,Ie=void 0),n(15,sn=-1),Ue(H[1].toFixed(6)+", "+rC(H[0],[-180,180],!0).toFixed(6),!1)}function Ja(H){if(!Gt)return;let dt=H.key==="ArrowDown"?1:H.key==="ArrowUp"?-1:0;dt&&(sn===(ge?0:-1)&&dt===-1&&n(15,sn=Gt.length),n(15,sn+=dt),sn>=Gt.length&&n(15,sn=-1),sn<0&&ge&&n(15,sn=0),H.preventDefault())}function Ni(H=!0){if(n(18,Bi=void 0),ee){if(fr&&clearTimeout(fr),Ct.length{Wt(dt).catch(lt=>n(18,Bi=lt))},H?B:0)}else n(14,Gt=void 0),n(18,Bi=void 0)}function Jt(H){n(55,Ie=H),n(1,Ct=H.place_name),n(15,sn=-1)}const He=()=>Mt.focus();function je(H){Rr[H?"unshift":"push"](()=>{Mt=H,n(17,Mt)})}function yi(){Ct=this.value,n(1,Ct),n(13,er),n(27,T)}const zo=()=>n(13,er=!0),Ge=()=>n(13,er=!1),ea=()=>Ni(),Ii=()=>{n(1,Ct=""),Mt.focus()},rt=()=>n(0,Ft=!Ft),O=()=>n(18,Bi=void 0),U=H=>n(15,sn=H),Z=H=>Jt(H),$=()=>{ge||n(15,sn=-1)},ft=()=>{};return t.$$set=H=>{"class"in H&&n(2,p=H.class),"apiKey"in H&&n(25,u=H.apiKey),"bbox"in H&&n(26,b=H.bbox),"clearButtonTitle"in H&&n(3,w=H.clearButtonTitle),"clearOnBlur"in H&&n(27,T=H.clearOnBlur),"collapsed"in H&&n(4,P=H.collapsed),"country"in H&&n(28,k=H.country),"debounceSearch"in H&&n(29,B=H.debounceSearch),"enableReverse"in H&&n(5,V=H.enableReverse),"errorMessage"in H&&n(6,tt=H.errorMessage),"filter"in H&&n(30,ot=H.filter),"flyTo"in H&&n(31,ut=H.flyTo),"fuzzyMatch"in H&&n(32,W=H.fuzzyMatch),"language"in H&&n(33,X=H.language),"limit"in H&&n(34,J=H.limit),"mapController"in H&&n(35,ht=H.mapController),"minLength"in H&&n(36,vt=H.minLength),"noResultsMessage"in H&&n(7,gt=H.noResultsMessage),"placeholder"in H&&n(8,St=H.placeholder),"proximity"in H&&n(37,It=H.proximity),"reverseActive"in H&&n(0,Ft=H.reverseActive),"reverseButtonTitle"in H&&n(9,mt=H.reverseButtonTitle),"searchValue"in H&&n(1,Ct=H.searchValue),"showFullGeometry"in H&&n(38,ie=H.showFullGeometry),"showPlaceType"in H&&n(10,Tt=H.showPlaceType),"showResultsWhileTyping"in H&&n(39,ee=H.showResultsWhileTyping),"selectFirst"in H&&n(11,ge=H.selectFirst),"flyToSelected"in H&&n(40,Te=H.flyToSelected),"markerOnSelected"in H&&n(41,Oe=H.markerOnSelected),"types"in H&&n(42,on=H.types),"excludeTypes"in H&&n(43,gn=H.excludeTypes),"zoom"in H&&n(44,Re=H.zoom),"maxZoom"in H&&n(45,Me=H.maxZoom),"apiUrl"in H&&n(46,Dn=H.apiUrl),"fetchParameters"in H&&n(47,qn=H.fetchParameters),"iconsBaseUrl"in H&&n(12,Zn=H.iconsBaseUrl),"adjustUrlQuery"in H&&n(48,Wn=H.adjustUrlQuery),"$$scope"in H&&n(58,c=H.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,$o=er),T&&!er&&n(1,Ct="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&Ct.lengthn(18,Bi=H)),t.$$.dirty[1]&50356241&&(ht&&Ie&&Ie.id!==ws&&ut&&(!Ie.bbox||Ie.bbox[0]===Ie.bbox[2]&&Ie.bbox[1]===Ie.bbox[3]?ht.flyTo(Ie.center,Ie.id.startsWith("poi.")||Ie.id.startsWith("address.")?Me:Re):ht.fitBounds(Zv(Ie.bbox),50,Me),n(14,Gt=void 0),n(54,Fe=void 0),n(15,sn=-1)),n(56,ws=Ie==null?void 0:Ie.id)),t.$$.dirty[0]&18432&&ge&&Gt!=null&&Gt.length&&n(15,sn=0),t.$$.dirty[0]&2050&&(ge||n(15,sn=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Fe!==Gt&&n(54,Fe=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&ht&&ht.setEventHandler(H=>{switch(H.type){case"mapClick":Ft&&Br(H.coordinates);break;case"markerClick":{const dt=Gt==null?void 0:Gt.find(lt=>lt.id===H.id);dt&&Jt(dt)}break;case"markerMouseEnter":Fe&&n(15,sn=$o?(Gt==null?void 0:Gt.findIndex(dt=>dt.id===H.id))??-1:-1);break;case"markerMouseLeave":Fe&&n(15,sn=-1);break}}),t.$$.dirty[0]&49152&&n(57,i=Gt==null?void 0:Gt[sn]),t.$$.dirty[1]&67133969&&ht&&i&&ut&&Te&&ht.flyTo(i.center,i.id.startsWith("poi.")||i.id.startsWith("address.")?Me:Re),t.$$.dirty[1]&1040&&(Oe||ht==null||ht.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&ht&&Oe&&!Fe&&(ht.setMarkers(i?[i]:void 0,void 0),ht.setSelectedMarker(i?0:-1)),t.$$.dirty[1]&25165840&&ht&&ht.setMarkers(Fe,Ie),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Fe&&ht&&ht.setSelectedMarker(sn),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&ht){const H=ts(Ct);ht.setReverseMarker(H?[H.decimalLongitude,H.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&wr("select",i),t.$$.dirty[1]&16777216&&wr("pick",Ie),t.$$.dirty[0]&81920&&wr("optionsVisibilityChange",$o&&!!Gt),t.$$.dirty[0]&16384&&wr("featuresListed",Gt),t.$$.dirty[1]&8388608&&wr("featuresMarked",Fe),t.$$.dirty[0]&1&&wr("reverseToggle",Ft),t.$$.dirty[0]&2&&wr("queryChange",Ct),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&ht&&ht.indicateReverse(Ft)},[Ft,Ct,p,w,P,V,tt,gt,St,mt,Tt,ge,Zn,er,Gt,sn,$o,Mt,Bi,$n,Ia,Ka,Ja,Ni,Jt,u,b,T,k,B,ot,ut,W,X,J,ht,vt,It,ie,ee,Te,Oe,on,gn,Re,Me,Dn,qn,Wn,ri,Kt,Ue,yn,br,Fe,Ie,ws,i,c,a,He,je,yi,zo,Ge,ea,Ii,rt,O,U,Z,$,ft]}class IC extends Tn{constructor(e){super(),Cn(this,e,wC,bC,In,{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 n1(t){let e,n,i;return n=new IC({props:{mapController:t[0],apiKey:Z1}}),{c(){e=se("div"),cn(n.$$.fragment),zt(e,"class","svelte-kr8bm")},m(a,c){fe(a,e,c),en(n,e,null),i=!0},p(a,c){const p={};c&1&&(p.mapController=a[0]),n.$set(p)},i(a){i||(ne(n.$$.fragment,a),i=!0)},o(a){he(n.$$.fragment,a),i=!1},d(a){a&&pe(e),nn(n)}}}function EC(t){let e,n,i=t[0]&&n1(t);return{c(){i&&i.c(),e=Dl()},m(a,c){i&&i.m(a,c),fe(a,e,c),n=!0},p(a,[c]){a[0]?i?(i.p(a,c),c&1&&ne(i,1)):(i=n1(a),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function SC(t,e,n){let i;Gn(t,Yu,c=>n(1,i=c));let a;return w1(()=>{i&&n(0,a=FS(i,qh))}),[a]}class JT extends Tn{constructor(e){super(),Cn(this,e,SC,EC,In,{})}}const CC=t=>({}),i1=t=>({}),TC=t=>({}),r1=t=>({});function LC(t){let e,n,i,a;const c=t[1].left,p=Os(c,t,t[0],r1),u=t[1].main,b=Os(u,t,t[0],i1);return{c(){e=se("div"),p&&p.c(),n=qe(),i=se("div"),b&&b.c(),zt(e,"class","left svelte-194izft"),zt(i,"class","main svelte-194izft")},m(w,T){fe(w,e,T),p&&p.m(e,null),fe(w,n,T),fe(w,i,T),b&&b.m(i,null),a=!0},p(w,[T]){p&&p.p&&(!a||T&1)&&Bs(p,c,w,w[0],a?Fs(c,w[0],T,TC):Vs(w[0]),r1),b&&b.p&&(!a||T&1)&&Bs(b,u,w,w[0],a?Fs(u,w[0],T,CC):Vs(w[0]),i1)},i(w){a||(ne(p,w),ne(b,w),a=!0)},o(w){he(p,w),he(b,w),a=!1},d(w){w&&(pe(e),pe(n),pe(i)),p&&p.d(w),b&&b.d(w)}}}function PC(t,e,n){let{$$slots:i={},$$scope:a}=e;return t.$$set=c=>{"$$scope"in c&&n(0,a=c.$$scope)},[a,i]}class QT extends Tn{constructor(e){super(),Cn(this,e,PC,LC,In,{})}}function zf(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Uh(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Yx(t,e,n){if(n===void 0&&(n={}),n.final===!0)return MC(t,e);var i=zf(t),a=zf(e),c=Rs(i[0]),p=Rs(a[0]),u=Rs(i[1]),b=Rs(a[1]),w=Math.sin(p-c)*Math.cos(b),T=Math.cos(u)*Math.sin(b)-Math.sin(u)*Math.cos(b)*Math.cos(p-c);return vf(Math.atan2(w,T))}function MC(t,e){var n=Yx(e,t);return n=(n+180)%360,n}function nf(t,e,n){n===void 0&&(n={});var i=zf(t),a=zf(e),c=Rs(a[1]-i[1]),p=Rs(a[0]-i[0]),u=Rs(i[1]),b=Rs(a[1]),w=Math.pow(Math.sin(c/2),2)+Math.pow(Math.sin(p/2),2)*Math.cos(u)*Math.cos(b);return X_(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function o1(t,e,n,i){i===void 0&&(i={});var a=zf(t),c=Rs(a[0]),p=Rs(a[1]),u=Rs(n),b=Um(e,i.units),w=Math.asin(Math.sin(p)*Math.cos(b)+Math.cos(p)*Math.sin(b)*Math.cos(u)),T=c+Math.atan2(Math.sin(u)*Math.sin(b)*Math.cos(p),Math.cos(b)-Math.sin(p)*Math.sin(w)),P=vf(T),k=vf(w);return Go([P,k],i.properties)}function s1(t){if(!t)throw new Error("geojson is required");var e=[];return Wh(t,function(n){AC(n,e)}),Xu(e)}function AC(t,e){var n=[],i=t.geometry;if(i!==null){switch(i.type){case"Polygon":n=Uh(i);break;case"LineString":n=[Uh(i)]}n.forEach(function(a){var c=kC(a,t.properties);c.forEach(function(p){p.id=e.length,e.push(p)})})}}function kC(t,e){var n=[];return t.reduce(function(i,a){var c=Ds([i,a],e);return c.bbox=DC(i,a),n.push(c),a}),n}function DC(t,e){var n=t[0],i=t[1],a=e[0],c=e[1],p=na?n:a,w=i>c?i:c;return[p,u,b,w]}var gy={exports:{}},Kx={exports:{}};(function(t,e){(function(n,i){t.exports=i()})(L1,function(){function n(W,X,J,ht,vt){(function gt(St,It,Ft,mt,Ct){for(;mt>Ft;){if(mt-Ft>600){var ie=mt-Ft+1,Tt=It-Ft+1,ee=Math.log(ie),ge=.5*Math.exp(2*ee/3),Te=.5*Math.sqrt(ee*ge*(ie-ge)/ie)*(Tt-ie/2<0?-1:1),Oe=Math.max(Ft,Math.floor(It-Tt*ge/ie+Te)),on=Math.min(mt,Math.floor(It+(ie-Tt)*ge/ie+Te));gt(St,It,Oe,on,Ct)}var gn=St[It],Re=Ft,Me=mt;for(i(St,Ft,It),Ct(St[mt],gn)>0&&i(St,Ft,mt);Re0;)Me--}Ct(St[Ft],gn)===0?i(St,Ft,Me):i(St,++Me,mt),Me<=It&&(Ft=Me+1),It<=Me&&(mt=Me-1)}})(W,X,J||0,ht||W.length-1,vt||a)}function i(W,X,J){var ht=W[X];W[X]=W[J],W[J]=ht}function a(W,X){return WX?1:0}var c=function(W){W===void 0&&(W=9),this._maxEntries=Math.max(4,W),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function p(W,X,J){if(!J)return X.indexOf(W);for(var ht=0;ht=W.minX&&X.maxY>=W.minY}function ot(W){return{children:W,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ut(W,X,J,ht,vt){for(var gt=[X,J];gt.length;)if(!((J=gt.pop())-(X=gt.pop())<=ht)){var St=X+Math.ceil((J-X)/ht/2)*ht;n(W,St,X,J,vt),gt.push(X,St,St,J)}}return c.prototype.all=function(){return this._all(this.data,[])},c.prototype.search=function(W){var X=this.data,J=[];if(!tt(W,X))return J;for(var ht=this.toBBox,vt=[];X;){for(var gt=0;gt=0&&vt[X].children.length>this._maxEntries;)this._split(vt,X),X--;this._adjustParentBBoxes(ht,vt,X)},c.prototype._split=function(W,X){var J=W[X],ht=J.children.length,vt=this._minEntries;this._chooseSplitAxis(J,vt,ht);var gt=this._chooseSplitIndex(J,vt,ht),St=ot(J.children.splice(gt,J.children.length-gt));St.height=J.height,St.leaf=J.leaf,u(J,this.toBBox),u(St,this.toBBox),X?W[X-1].children.push(St):this._splitRoot(J,St)},c.prototype._splitRoot=function(W,X){this.data=ot([W,X]),this.data.height=W.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},c.prototype._chooseSplitIndex=function(W,X,J){for(var ht,vt,gt,St,It,Ft,mt,Ct=1/0,ie=1/0,Tt=X;Tt<=J-X;Tt++){var ee=b(W,0,Tt,this.toBBox),ge=b(W,Tt,J,this.toBBox),Te=(vt=ee,gt=ge,St=void 0,It=void 0,Ft=void 0,mt=void 0,St=Math.max(vt.minX,gt.minX),It=Math.max(vt.minY,gt.minY),Ft=Math.min(vt.maxX,gt.maxX),mt=Math.min(vt.maxY,gt.maxY),Math.max(0,Ft-St)*Math.max(0,mt-It)),Oe=k(ee)+k(ge);Te=X;Ct--){var ie=W.children[Ct];w(St,W.leaf?vt(ie):ie),It+=B(St)}return It},c.prototype._adjustParentBBoxes=function(W,X,J){for(var ht=J;ht>=0;ht--)w(X[ht],W)},c.prototype._condense=function(W){for(var X=W.length-1,J=void 0;X>=0;X--)W[X].children.length===0?X>0?(J=W[X-1].children).splice(J.indexOf(W[X]),1):this.clear():u(W[X],this.toBBox)},c})})(Kx);var RC=Kx.exports;const NC=G_(MI),zC=G_(UI),OC=G_(GI);var Ra=RC,Jx=NC,Qx=zC,fh=OC.default,FC=Qx.featureEach;Qx.coordEach;Jx.polygon;var a1=Jx.featureCollection;function $x(t){var e=new Ra(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:fh(n),Ra.prototype.insert.call(this,n)},e.load=function(n){var i=[];return Array.isArray(n)?n.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:fh(a),i.push(a)}):FC(n,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:fh(a),i.push(a)}),Ra.prototype.load.call(this,i)},e.remove=function(n,i){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:fh(n),Ra.prototype.remove.call(this,n,i)},e.clear=function(){return Ra.prototype.clear.call(this)},e.search=function(n){var i=Ra.prototype.search.call(this,this.toBBox(n));return a1(i)},e.collides=function(n){return Ra.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=Ra.prototype.all.call(this);return a1(n)},e.toJSON=function(){return Ra.prototype.toJSON.call(this)},e.fromJSON=function(n){return Ra.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var i;if(n.bbox)i=n.bbox;else if(Array.isArray(n)&&n.length===4)i=n;else if(Array.isArray(n)&&n.length===6)i=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")i=fh(n);else if(n.type==="FeatureCollection")i=fh(n);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},e}gy.exports=$x;gy.exports.default=$x;var BC=gy.exports;const VC=P1(BC);function UC(t,e){var n={},i=[];if(t.type==="LineString"&&(t=Us(t)),e.type==="LineString"&&(e=Us(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var a=l1(t,e);return a&&i.push(a),Xu(i)}var c=VC();return c.load(s1(e)),Em(s1(t),function(p){Em(c.search(p),function(u){var b=l1(p,u);if(b){var w=Uh(b).join(",");n[w]||(n[w]=!0,i.push(b))}})}),Xu(i)}function l1(t,e){var n=Uh(t),i=Uh(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(i.length!==2)throw new Error(" line2 must only contain 2 coordinates");var a=n[0][0],c=n[0][1],p=n[1][0],u=n[1][1],b=i[0][0],w=i[0][1],T=i[1][0],P=i[1][1],k=(P-w)*(p-a)-(T-b)*(u-c),B=(T-b)*(c-w)-(P-w)*(a-b),V=(p-a)*(c-w)-(u-c)*(a-b);if(k===0)return null;var tt=B/k,ot=V/k;if(tt>=0&&tt<=1&&ot>=0&&ot<=1){var ut=a+tt*(p-a),W=c+tt*(u-c);return Go([ut,W])}return null}function GC(t,e,n){n===void 0&&(n={});var i=Go([1/0,1/0],{dist:1/0}),a=0;return Wh(t,function(c){for(var p=Uh(c),u=0;u0&&(ot=tt.features[0],ot.properties.dist=nf(e,ot,n),ot.properties.location=a+nf(b,ot,n)),b.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,i=this.dragFrom[1]-e.lngLat.lat;for(let a of this.points)a[0]-=n,a[1]-=i}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});or(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(u1(this.points).forEach((i,a)=>{n.push([a+1,GC(i,this.cursor).properties.dist])}),n.sort((i,a)=>i[1]-a[1]),n.length>0){let i=n[0][0];this.points.splice(i,0,this.cursor.geometry.coordinates),this.hover=i}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});or(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=m_(e.lngLat.toArray()),this.onClick(e),this.finish())});or(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});or(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});or(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});or(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e={type:"FeatureCollection",features:[]};this.points.forEach((a,c)=>{let p=m_(a);p.properties.hover=this.hover==c,p.properties.idx=c,e.features.push(p)}),e.features=e.features.concat(u1(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),eb.set(e);let i="crosshair";this.hover!=null&&(i=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=i,nb.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=m_(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(tb),n=[JSON.parse(JSON.stringify(e))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>WC&&this.previousStates.shift()}}function u1(t){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[t[t.length-1],t[0]]},properties:{}}),e}function XC(t){let e,n,i;return{c(){e=Un("Undo ("),n=Un(t[1]),i=Un(")")},m(a,c){fe(a,e,c),fe(a,n,c),fe(a,i,c)},p(a,c){c&2&&wl(n,a[1])},d(a){a&&(pe(e),pe(n),pe(i))}}}function YC(t){let e;return{c(){e=Un("Undo")},m(n,i){fe(n,e,i)},p:Ye,d(n){n&&pe(e)}}}function KC(t){let e,n,i,a,c,p,u,b,w,T,P;function k(tt,ot){return tt[1]==0?YC:XC}let B=k(t),V=B(t);return{c(){e=se("div"),n=se("button"),n.textContent="Finish",i=qe(),a=se("button"),a.textContent="Cancel",c=qe(),p=se("button"),V.c(),b=qe(),w=se("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 @@ -611,15 +611,15 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,p.disabled=u=t[1]==0,ju(e,"display","flex"),ju(e,"justify-content","space-between")},m(tt,ot){fe(tt,e,ot),Zt(e,n),Zt(e,i),Zt(e,a),Zt(e,c),Zt(e,p),V.m(p,null),fe(tt,b,ot),fe(tt,w,ot),T||(P=[un(n,"click",t[2]),un(a,"click",t[3]),un(p,"click",t[4])],T=!0)},p(tt,[ot]){B===(B=k(tt))&&V?V.p(tt,ot):(V.d(1),V=B(tt),V&&(V.c(),V.m(p,null))),ot&2&&u!==(u=tt[1]==0)&&(p.disabled=u)},i:Ye,o:Ye,d(tt){tt&&(pe(e),pe(b),pe(w)),V.d(),T=!1,eo(P)}}}function JC(t,e,n){let i;Gn(t,nb,b=>n(1,i=b));let{polygonTool:a}=e;const c=()=>a.finish(),p=()=>a.cancel(),u=()=>a.undo();return t.$$set=b=>{"polygonTool"in b&&n(0,a=b.polygonTool)},[a,i,c,p,u]}class QC extends Tn{constructor(e){super(),Cn(this,e,JC,KC,In,{polygonTool:0})}}function $C(t){let e,n,i,a,c,p;return e=new Gf({props:{id:"edit-polygon-fill",filter:qC,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),i=new k1({props:{id:"edit-polygon-lines",filter:jC,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),c=new E2({props:{id:"edit-polygon-vertices",filter:ZC,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment),a=qe(),cn(c.$$.fragment)},m(u,b){en(e,u,b),fe(u,n,b),en(i,u,b),fe(u,a,b),en(c,u,b),p=!0},p:Ye,i(u){p||(ne(e.$$.fragment,u),ne(i.$$.fragment,u),ne(c.$$.fragment,u),p=!0)},o(u){he(e.$$.fragment,u),he(i.$$.fragment,u),he(c.$$.fragment,u),p=!1},d(u){u&&(pe(n),pe(a)),nn(e,u),nn(i,u),nn(c,u)}}}function tT(t){let e,n;return e=new jh({props:{data:t[0],$$slots:{default:[$C]},$$scope:{ctx:t}}}),{c(){cn(e.$$.fragment)},m(i,a){en(e,i,a),n=!0},p(i,[a]){const c={};a&1&&(c.data=i[0]),a&2&&(c.$$scope={dirty:a,ctx:i}),e.$set(c)},i(i){n||(ne(e.$$.fragment,i),n=!0)},o(i){he(e.$$.fragment,i),n=!1},d(i){nn(e,i)}}}function eT(t,e,n){let i;return Gn(t,eb,a=>n(0,i=a)),[i]}class nT extends Tn{constructor(e){super(),Cn(this,e,eT,tT,In,{})}}function c1(t){let e,n,i,a,c,p,u;e=new R1({}),i=new D1({props:{position:"bottom-right",visualizePitch:!0}}),c=new nT({});const b=t[5].default,w=Os(b,t,t[9],null);return{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment),a=qe(),cn(c.$$.fragment),p=qe(),w&&w.c()},m(T,P){en(e,T,P),fe(T,n,P),en(i,T,P),fe(T,a,P),en(c,T,P),fe(T,p,P),w&&w.m(T,P),u=!0},p(T,P){w&&w.p&&(!u||P&512)&&Bs(w,b,T,T[9],u?Fs(b,T[9],P,null):Vs(T[9]),null)},i(T){u||(ne(e.$$.fragment,T),ne(i.$$.fragment,T),ne(c.$$.fragment,T),ne(w,T),u=!0)},o(T){he(e.$$.fragment,T),he(i.$$.fragment,T),he(c.$$.fragment,T),he(w,T),u=!1},d(T){T&&(pe(n),pe(a),pe(p)),nn(e,T),nn(i,T),nn(c,T),w&&w.d(T)}}}function iT(t){let e,n,i=t[3]&&c1(t);return{c(){i&&i.c(),e=Dl()},m(a,c){i&&i.m(a,c),fe(a,e,c),n=!0},p(a,c){a[3]?i?(i.p(a,c),c&8&&ne(i,1)):(i=c1(a),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function rT(t){let e,n,i,a,c;function p(w){t[6](w)}function u(w){t[7](w)}let b={style:t[4](t[2]),hash:!0,$$slots:{default:[iT]},$$scope:{ctx:t}};return t[0]!==void 0&&(b.map=t[0]),t[1]!==void 0&&(b.loaded=t[1]),n=new X2({props:b}),Rr.push(()=>Ho(n,"map",p)),Rr.push(()=>Ho(n,"loaded",u)),n.$on("error",t[8]),{c(){e=se("div"),cn(n.$$.fragment),zt(e,"class","svelte-cexkjr")},m(w,T){fe(w,e,T),en(n,e,null),c=!0},p(w,[T]){const P={};T&4&&(P.style=w[4](w[2])),T&520&&(P.$$scope={dirty:T,ctx:w}),!i&&T&1&&(i=!0,P.map=w[0],Wo(()=>i=!1)),!a&&T&2&&(a=!0,P.loaded=w[1],Wo(()=>a=!1)),n.$set(P)},i(w){c||(ne(n.$$.fragment,w),c=!0)},o(w){he(n.$$.fragment,w),c=!1},d(w){w&&pe(e),nn(n)}}}function oT(t,e,n){let i,a;Gn(t,qI,B=>n(2,i=B)),Gn(t,Yu,B=>n(3,a=B));let{$$slots:c={},$$scope:p}=e,u,b=!1;function w(B){return B=="blank"?{version:8,sources:{},layers:[]}:`https://api.maptiler.com/maps/${B}/style.json?key=${Z1}`}function T(B){u=B,n(0,u)}function P(B){b=B,n(1,b)}const k=B=>{console.log(B.detail.error)};return t.$$set=B=>{"$$scope"in B&&n(9,p=B.$$scope)},t.$$.update=()=>{t.$$.dirty&3&&b&&Yu.set(u)},[u,b,i,a,w,c,T,P,k,p]}let tL=class extends Tn{constructor(e){super(),Cn(this,e,oT,rT,In,{})}};const{window:sT}=v1;function h1(t){let e,n,i,a,c,p,u,b,w,T,P;return w=x1(t[5][0]),{c(){e=se("div"),n=se("label"),i=se("input"),a=Dn(` - Google StreetView`),c=qe(),p=se("label"),u=se("input"),b=Dn(` - Bing Streetside`),zt(i,"type","radio"),i.__value="google",ls(i,i.__value),zt(u,"type","radio"),u.__value="bing",ls(u,u.__value),ju(e,"background","grey"),w.p(i,u)},m(k,B){fe(k,e,B),Zt(e,n),Zt(n,i),i.checked=i.__value===t[1],Zt(n,a),Zt(e,c),Zt(e,p),Zt(p,u),u.checked=u.__value===t[1],Zt(p,b),T||(P=[un(i,"change",t[4]),un(u,"change",t[6])],T=!0)},p(k,B){B&2&&(i.checked=i.__value===k[1]),B&2&&(u.checked=u.__value===k[1])},d(k){k&&pe(e),w.r(),T=!1,eo(P)}}}function aT(t){let e,n,i,a,c,p,u,b=t[0]&&h1(t);return{c(){e=se("label"),n=se("input"),i=Dn(` - StreetView`),a=qe(),b&&b.c(),c=Dl(),zt(n,"type","checkbox")},m(w,T){fe(w,e,T),Zt(e,n),n.checked=t[0],Zt(e,i),fe(w,a,T),b&&b.m(w,T),fe(w,c,T),p||(u=[un(sT,"keydown",t[2]),un(n,"change",t[3])],p=!0)},p(w,[T]){T&1&&(n.checked=w[0]),w[0]?b?b.p(w,T):(b=h1(w),b.c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null)},i:Ye,o:Ye,d(w){w&&(pe(e),pe(a),pe(c)),b&&b.d(w),p=!1,eo(u)}}}function lT(t,e,n){let i;Gn(t,Yu,V=>n(7,i=V));let{enabled:a=!1}=e,c="google";function p(){i.on("click",b),i.getCanvas().style.cursor="zoom-in"}function u(){i.off("click",b),i.getCanvas().style.cursor="auto"}Il(u);function b(V){let tt=V.lngLat.lng,ot=V.lngLat.lat;c=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${ot},${tt}&cbp=11,0,0,0,0`,"_blank"):c=="bing"&&window.open(`https://www.bing.com/maps?cp=${ot}~${tt}&style=x`,"_blank")}function w(V){a&&V.key=="Escape"&&n(0,a=!1)}const T=[[]];function P(){a=this.checked,n(0,a)}function k(){c=this.__value,n(1,c)}function B(){c=this.__value,n(1,c)}return t.$$set=V=>{"enabled"in V&&n(0,a=V.enabled)},t.$$.update=()=>{t.$$.dirty&1&&(a?p():u())},[a,c,w,P,k,T,B]}class nL extends Tn{constructor(e){super(),Cn(this,e,lT,aT,In,{enabled:0})}}const{window:uT}=v1;function p1(t,e,n){const i=t.slice();return i[8]=e[n],i}function f1(t){let e,n=t[8]+"",i,a;return{c(){e=se("option"),i=Dn(n),e.__value=a=t[8],ls(e,e.__value)},m(c,p){fe(c,e,p),Zt(e,i)},p(c,p){p&2&&n!==(n=c[8]+"")&&Ga(i,n),p&2&&a!==(a=c[8])&&(e.__value=a,ls(e,e.__value))},d(c){c&&pe(e)}}}function cT(t){let e,n,i,a,c,p,u,b,w,T,P,k,B=bm(t[1]),V=[];for(let tt=0;ttt[6].call(c)),b.disabled=T=t[0]=="none"},m(tt,ot){fe(tt,e,ot),Zt(e,n),fe(tt,a,ot),fe(tt,c,ot),Zt(c,p);for(let ut=0;ut{let P=await fetch("/osm2streets//tests.json");n(1,c=await P.json()),a!="none"&&await p()});async function p(){if(a=="none"){i("resetToNone");return}try{i("loading","Loading built-in boundary and OSM XML");let B=(await(await fetch(`/osm2streets//tests/${a}/boundary.json`)).json()).features[0],tt=await(await fetch(`/osm2streets//tests/${a}/input.osm`)).text();i("load",{testCase:a,boundaryGj:B,osmXml:tt})}catch(P){i("error",P.toString())}}async function u(){let P=new URLSearchParams(window.location.search).get("test")||"none";console.log(`Navigated back in history -- changing test case from ${a} to ${P}`),n(0,a=P),await p()}async function b(){let P=c.indexOf(a);P!=-1&&P!=0&&(n(0,a=c[P-1]),await p())}async function w(){let P=c.indexOf(a);P!=-1&&P!=c.length-1&&(n(0,a=c[P+1]),await p())}function T(){a=b1(this),n(0,a),n(1,c)}return t.$$set=P=>{"testCase"in P&&n(0,a=P.testCase)},[a,c,p,u,b,w,T]}class pT extends Tn{constructor(e){super(),Cn(this,e,hT,cT,In,{testCase:0})}}function fT(t){let e,n,i,a,c,p,u;return{c(){e=se("button"),e.textContent="Import current view",n=qe(),i=se("i"),i.textContent="or...",a=qe(),c=se("button"),c.textContent="Draw an area to import on the map",zt(e,"type","button"),zt(c,"type","button")},m(b,w){fe(b,e,w),fe(b,n,w),fe(b,i,w),fe(b,a,w),fe(b,c,w),p||(u=[un(e,"click",t[2]),un(c,"click",t[1])],p=!0)},p:Ye,i:Ye,o:Ye,d(b){b&&(pe(e),pe(n),pe(i),pe(a),pe(c)),p=!1,eo(u)}}}function dT(t){let e,n;return e=new QC({props:{polygonTool:t[0]}}),{c(){cn(e.$$.fragment)},m(i,a){en(e,i,a),n=!0},p(i,a){const c={};a&1&&(c.polygonTool=i[0]),e.$set(c)},i(i){n||(ne(e.$$.fragment,i),n=!0)},o(i){he(e.$$.fragment,i),n=!1},d(i){nn(e,i)}}}function mT(t){let e,n,i,a;const c=[dT,fT],p=[];function u(b,w){return b[0]?0:1}return e=u(t),n=p[e]=c[e](t),{c(){n.c(),i=Dl()},m(b,w){p[e].m(b,w),fe(b,i,w),a=!0},p(b,[w]){let T=e;e=u(b),e===T?p[e].p(b,w):(us(),he(p[T],1,1,()=>{p[T]=null}),cs(),n=p[e],n?n.p(b,w):(n=p[e]=c[e](b),n.c()),ne(n,1),n.m(i.parentNode,i))},i(b){a||(ne(n),a=!0)},o(b){he(n),a=!1},d(b){b&&pe(i),p[e].d(b)}}}function gT(t){let e='poly:"';for(let[i,a]of t.geometry.coordinates[0])e+=`${a} ${i} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function rf(t){return[t.lng,t.lat]}function _T(t,e,n){let{map:i}=e,a=null,c=Ff();function p(){i&&(n(0,a=new HC(i)),a.startNew(),a.addEventListenerSuccess(async T=>{n(0,a=null),await u(T)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}async function u(T){try{c("loading","Loading from Overpass");let k=await(await fetch(gT(T))).text();c("load",{testCase:"none",boundaryGj:T,osmXml:k})}catch(P){c("error",P.toString())}}function b(){let T=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[rf(T.getSouthWest()),rf(T.getNorthWest()),rf(T.getNorthEast()),rf(T.getSouthEast()),rf(T.getSouthWest())]],type:"Polygon"}}}async function w(){if(i){if(i.getZoom()<15){c("error","Zoom in more to import");return}await u(b())}}return t.$$set=T=>{"map"in T&&n(3,i=T.map)},[a,p,w,i,u]}class yT extends Tn{constructor(e){super(),Cn(this,e,_T,mT,In,{map:3,importPolygon:4})}get importPolygon(){return this.$$.ctx[4]}}function vT(t){let e,n,i,a,c,p,u,b,w,T,P,k,B,V,tt,ot,ut,W,X,J,ht,vt,gt,St,It,Ft,mt,Ct,ie,Tt,ee,ge,Te,Oe,on,gn;return Oe=x1(t[6][0]),{c(){e=se("details"),n=se("summary"),n.textContent="Processing Options",i=qe(),a=se("label"),c=se("input"),p=Dn(` - Debug each transformation step`),u=qe(),b=se("label"),w=se("input"),T=Dn(` - Enable dual carriageway experiment`),P=qe(),k=se("label"),B=se("input"),V=Dn(` - Enable sidepath zipping experiment`),tt=qe(),ot=se("div"),ut=Dn(`Sidewalks: - `),W=se("label"),X=se("input"),J=Dn(` - use mapped footways`),ht=qe(),vt=se("label"),gt=se("input"),St=Dn(` - infer on roads`),It=qe(),Ft=se("label"),mt=se("input"),Ct=Dn(` - Infer kerbs`),ie=qe(),Tt=se("div"),ee=Dn(`Change the time and date: - `),ge=se("label"),Te=se("input"),zt(n,"class","svelte-1c5zxm"),zt(c,"type","checkbox"),zt(a,"class","svelte-1c5zxm"),zt(w,"type","checkbox"),zt(b,"class","svelte-1c5zxm"),zt(B,"type","checkbox"),zt(k,"class","svelte-1c5zxm"),zt(X,"type","radio"),X.__value=!1,ls(X,X.__value),zt(W,"class","svelte-1c5zxm"),zt(gt,"type","radio"),gt.__value=!0,ls(gt,gt.__value),zt(vt,"class","svelte-1c5zxm"),zt(ot,"class","svelte-1c5zxm"),zt(mt,"type","checkbox"),zt(Ft,"class","svelte-1c5zxm"),zt(Te,"type","datetime-local"),zt(ge,"class","svelte-1c5zxm"),zt(Tt,"class","svelte-1c5zxm"),zt(e,"class","svelte-1c5zxm"),Oe.p(X,gt)},m(Re,Me){fe(Re,e,Me),Zt(e,n),Zt(e,i),Zt(e,a),Zt(a,c),c.checked=t[0].debug_each_step,Zt(a,p),Zt(e,u),Zt(e,b),Zt(b,w),w.checked=t[0].dual_carriageway_experiment,Zt(b,T),Zt(e,P),Zt(e,k),Zt(k,B),B.checked=t[0].sidepath_zipping_experiment,Zt(k,V),Zt(e,tt),Zt(e,ot),Zt(ot,ut),Zt(ot,W),Zt(W,X),X.checked=X.__value===t[0].inferred_sidewalks,Zt(W,J),Zt(ot,ht),Zt(ot,vt),Zt(vt,gt),gt.checked=gt.__value===t[0].inferred_sidewalks,Zt(vt,St),Zt(e,It),Zt(e,Ft),Zt(Ft,mt),mt.checked=t[0].inferred_kerbs,Zt(Ft,Ct),Zt(e,ie),Zt(e,Tt),Zt(Tt,ee),Zt(Tt,ge),Zt(ge,Te),ls(Te,t[1]),on||(gn=[un(c,"change",t[2]),un(w,"change",t[3]),un(B,"change",t[4]),un(X,"change",t[5]),un(gt,"change",t[7]),un(mt,"change",t[8]),un(Te,"input",t[9])],on=!0)},p(Re,[Me]){Me&1&&(c.checked=Re[0].debug_each_step),Me&1&&(w.checked=Re[0].dual_carriageway_experiment),Me&1&&(B.checked=Re[0].sidepath_zipping_experiment),Me&1&&(X.checked=X.__value===Re[0].inferred_sidewalks),Me&1&&(gt.checked=gt.__value===Re[0].inferred_sidewalks),Me&1&&(mt.checked=Re[0].inferred_kerbs),Me&2&&ls(Te,Re[1])},i:Ye,o:Ye,d(Re){Re&&pe(e),Oe.r(),on=!1,eo(gn)}}}function xT(t,e,n){let{settings:i={debug_each_step:!1,dual_carriageway_experiment:!1,sidepath_zipping_experiment:!1,inferred_sidewalks:!1,inferred_kerbs:!0,date_time:void 0}}=e,a;const c=[[]];function p(){i.debug_each_step=this.checked,n(0,i),n(1,a)}function u(){i.dual_carriageway_experiment=this.checked,n(0,i),n(1,a)}function b(){i.sidepath_zipping_experiment=this.checked,n(0,i),n(1,a)}function w(){i.inferred_sidewalks=this.__value,n(0,i),n(1,a)}function T(){i.inferred_sidewalks=this.__value,n(0,i),n(1,a)}function P(){i.inferred_kerbs=this.checked,n(0,i),n(1,a)}function k(){a=this.value,n(1,a)}return t.$$set=B=>{"settings"in B&&n(0,i=B.settings)},t.$$.update=()=>{t.$$.dirty&2&&n(0,i.date_time=a&&a+":00",i)},[i,a,p,u,b,w,c,T,P,k]}class bT extends Tn{constructor(e){super(),Cn(this,e,xT,vT,In,{settings:0})}}function wT(t){let e,n,i,a,c,p,u,b;return{c(){e=se("div"),n=se("button"),n.textContent="Update OSM data",i=qe(),a=se("button"),a.textContent="Download osm.xml",c=qe(),p=se("button"),p.textContent="Reset view",zt(n,"type","button"),zt(a,"type","button"),zt(p,"type","button")},m(w,T){fe(w,e,T),Zt(e,n),Zt(e,i),Zt(e,a),Zt(e,c),Zt(e,p),u||(b=[un(n,"click",t[6]),un(a,"click",t[5]),un(p,"click",t[7])],u=!0)},p:Ye,d(w){w&&pe(e),u=!1,eo(b)}}}function IT(t){let e,n,i=t[2].msg+"",a;return{c(){e=se("p"),n=Dn("Error: "),a=Dn(i)},m(c,p){fe(c,e,p),Zt(e,n),Zt(e,a)},p(c,p){p&4&&i!==(i=c[2].msg+"")&&Ga(a,i)},d(c){c&&pe(e)}}}function ET(t){let e,n=t[2].msg+"",i;return{c(){e=se("p"),i=Dn(n)},m(a,c){fe(a,e,c),Zt(e,i)},p(a,c){c&4&&n!==(n=a[2].msg+"")&&Ga(i,n)},d(a){a&&pe(e)}}}function ST(t){let e;return{c(){e=se("p"),e.textContent="Use the polygon tool to select an area to import"},m(n,i){fe(n,e,i)},p:Ye,d(n){n&&pe(e)}}}function CT(t){let e,n,i,a,c,p,u,b,w,T,P,k,B={map:t[4]};n=new yT({props:B}),t[12](n),n.$on("loading",t[11]),n.$on("load",t[8]),n.$on("resetToNone",t[9]),n.$on("error",t[10]);function V(ht){t[13](ht)}let tt={};t[1]!==void 0&&(tt.testCase=t[1]),p=new pT({props:tt}),Rr.push(()=>Ho(p,"testCase",V)),p.$on("loading",t[11]),p.$on("load",t[8]),p.$on("resetToNone",t[9]),p.$on("error",t[10]);function ot(ht,vt){if(ht[2].kind==="nothing")return ST;if(ht[2].kind==="loading")return ET;if(ht[2].kind==="error")return IT;if(ht[2].kind==="done")return wT}let ut=ot(t),W=ut&&ut(t);function X(ht){t[14](ht)}let J={};return t[0]!==void 0&&(J.settings=t[0]),T=new bT({props:J}),Rr.push(()=>Ho(T,"settings",X)),{c(){e=se("div"),cn(n.$$.fragment),i=qe(),a=se("fieldset"),c=se("legend"),cn(p.$$.fragment),b=qe(),W&&W.c(),w=qe(),cn(T.$$.fragment),zt(a,"class","svelte-1e8er7a"),zt(e,"class","controls svelte-1e8er7a")},m(ht,vt){fe(ht,e,vt),en(n,e,null),Zt(e,i),Zt(e,a),Zt(a,c),en(p,c,null),Zt(a,b),W&&W.m(a,null),Zt(e,w),en(T,e,null),k=!0},p(ht,[vt]){const gt={};vt&16&&(gt.map=ht[4]),n.$set(gt);const St={};!u&&vt&2&&(u=!0,St.testCase=ht[1],Wo(()=>u=!1)),p.$set(St),ut===(ut=ot(ht))&&W?W.p(ht,vt):(W&&W.d(1),W=ut&&ut(ht),W&&(W.c(),W.m(a,null)));const It={};!P&&vt&1&&(P=!0,It.settings=ht[0],Wo(()=>P=!1)),T.$set(It)},i(ht){k||(ne(n.$$.fragment,ht),ne(p.$$.fragment,ht),ne(T.$$.fragment,ht),k=!0)},o(ht){he(n.$$.fragment,ht),he(p.$$.fragment,ht),he(T.$$.fragment,ht),k=!1},d(ht){ht&&pe(e),t[12](null),nn(n),nn(p),W&&W.d(),nn(T)}}}function TT(t,e,n){let i;Gn(t,Yu,J=>n(4,i=J));let a={kind:"nothing"},c,p,u=new URLSearchParams(window.location.search).get("test")||"none";function b(J){a.kind=="done"&&J&&(console.log("Settings changed, re-importing"),w(a.osmXml,a.boundaryGj))}function w(J,ht){try{n(2,a={kind:"loading",msg:"Running osm2streets"});let vt=new Vm(new Uint8Array(new TextEncoder().encode(J)),JSON.stringify(ht),c);n(2,a={kind:"done",boundaryGj:ht,osmXml:J,network:vt}),Ku.set(a.network),b_.set(a.boundaryGj)}catch(vt){n(2,a={kind:"error",msg:vt.toString()})}}function T(){a.kind==="done"&&W1("osm.xml",a.osmXml)}function P(){a.kind==="done"&&p.importPolygon(a.boundaryGj)}function k(){a.kind==="done"&&i.fitBounds(H1(a.boundaryGj),{animate:!1,padding:10})}function B(J){w(J.detail.osmXml,J.detail.boundaryGj),n(1,u=J.detail.testCase)}function V(J){n(2,a={kind:"nothing"}),Ku.set(null),b_.set(null)}function tt(J){n(2,a={kind:"error",msg:J.detail})}function ot(J){n(2,a={kind:"loading",msg:J.detail})}function ut(J){Rr[J?"unshift":"push"](()=>{p=J,n(3,p)})}function W(J){u=J,n(1,u)}function X(J){c=J,n(0,c)}return t.$$.update=()=>{if(t.$$.dirty&1&&b(c),t.$$.dirty&2){let J=new URL(window.location.href);u!="none"?J.searchParams.set("test",u):J.searchParams.delete("test"),window.history.pushState({},"",J)}},[c,u,a,p,i,T,P,k,B,V,tt,ot,ut,W,X]}class iL extends Tn{constructor(e){super(),Cn(this,e,TT,CT,In,{})}}function d1(t){let e,n,i,a;return{c(){e=se("button"),n=Dn("Download"),zt(e,"type","button"),e.disabled=t[3]},m(c,p){fe(c,e,p),Zt(e,n),i||(a=un(e,"click",t[4]),i=!0)},p(c,p){p&8&&(e.disabled=c[3])},d(c){c&&pe(e),i=!1,a()}}}function LT(t){let e,n,i,a,c,p,u,b,w=t[2]&&d1(t);return{c(){e=se("div"),n=se("label"),i=se("input"),a=qe(),c=Dn(t[1]),p=qe(),w&&w.c(),zt(i,"type","checkbox")},m(T,P){fe(T,e,P),Zt(e,n),Zt(n,i),i.checked=t[0],Zt(n,a),Zt(n,c),Zt(e,p),w&&w.m(e,null),u||(b=un(i,"change",t[6]),u=!0)},p(T,[P]){P&1&&(i.checked=T[0]),P&2&&Ga(c,T[1]),T[2]?w?w.p(T,P):(w=d1(T),w.c(),w.m(e,null)):w&&(w.d(1),w=null)},i:Ye,o:Ye,d(T){T&&pe(e),w&&w.d(),u=!1,b()}}}function PT(t,e,n){let i,{gj:a}=e,{name:c}=e,{show:p}=e,{downloadable:u=!0}=e;function b(){W1(`${c}.geojson`,JSON.stringify(a))}function w(){p=this.checked,n(0,p)}return t.$$set=T=>{"gj"in T&&n(5,a=T.gj),"name"in T&&n(1,c=T.name),"show"in T&&n(0,p=T.show),"downloadable"in T&&n(2,u=T.downloadable)},t.$$.update=()=>{t.$$.dirty&32&&n(3,i=a.type=="FeatureCollection"&&a.features.length==0)},[p,c,u,i,b,a,w]}class $f extends Tn{constructor(e){super(),Cn(this,e,PT,LT,In,{gj:5,name:1,show:0,downloadable:2})}}function MT(t){let e,n;const i=[Zf("boundary"),{layout:{visibility:t[0]?"visible":"none"}},{paint:{"line-color":"blue","line-width":4}}];let a={};for(let c=0;cHo(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&2&&(T.data=b[1]),w&33&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&2&&(P.gj=b[1]),!a&&w&1&&(a=!0,P.show=b[0],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function kT(t,e,n){let i,a,c;Gn(t,b_,b=>n(2,a=b)),Gn(t,Yu,b=>n(3,c=b));let p=!0;function u(b){p=b,n(0,p)}return t.$$.update=()=>{t.$$.dirty&4&&n(1,i=a??jf()),t.$$.dirty&12&&a&&(c==null||c.fitBounds(H1(a),{animate:!1,padding:10}))},[p,i,a,c,u]}class rL extends Tn{constructor(e){super(),Cn(this,e,kT,AT,In,{})}}function DT(t){let e,n;const i=[Zf("intersection-markings"),{layout:{visibility:t[0]?"visible":"none"}},{paint:{"fill-color":vh("type",{"sidewalk corner":"#CCCCCC","marked crossing line":"white","unmarked crossing outline":"white"},"red"),"fill-opacity":.9}}];let a={};for(let c=0;cHo(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&2&&(T.data=b[1]),w&17&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&2&&(P.gj=b[1]),!a&&w&1&&(a=!0,P.show=b[0],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function NT(t,e,n){let i,a;Gn(t,Ku,u=>n(2,a=u));let c=!0;function p(u){c=u,n(0,c)}return t.$$.update=()=>{t.$$.dirty&4&&n(1,i=a?JSON.parse(a.toIntersectionMarkingsGeojson()):jf())},[c,i,a,p]}class oL extends Tn{constructor(e){super(),Cn(this,e,NT,RT,In,{})}}function zT(t){let e;const n=t[6].default,i=Os(n,t,t[9],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&512)&&Bs(i,n,a,a[9],e?Fs(n,a[9],c,null):Vs(a[9]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function OT(t){let e,n,i;const a=[Zf("intersection-polygons"),{layout:{visibility:t[1]?"visible":"none"}},{manageHoverState:!0},{hoverCursor:t[0]},{filter:["==",["get","type"],"intersection"]},{paint:{"fill-color":{debug:vh("intersection_kind",{MapEdge:"#696",Terminus:"#999",Connection:"#666",Fork:"#669",Intersection:"#966"},"red"),realistic:"black"}[t[4]],"fill-opacity":y_(.9,.4)}}];function c(u){t[7](u)}let p={$$slots:{default:[zT]},$$scope:{ctx:t}};for(let u=0;uHo(e,"hovered",c)),{c(){cn(e.$$.fragment)},m(u,b){en(e,u,b),i=!0},p(u,b){const w=b&19?Bf(a,[a[0],b&2&&{layout:{visibility:u[1]?"visible":"none"}},a[2],b&1&&{hoverCursor:u[0]},a[4],b&16&&{paint:{"fill-color":{debug:vh("intersection_kind",{MapEdge:"#696",Terminus:"#999",Connection:"#666",Fork:"#669",Intersection:"#966"},"red"),realistic:"black"}[u[4]],"fill-opacity":y_(.9,.4)}}]):{};b&512&&(w.$$scope={dirty:b,ctx:u}),!n&&b&8&&(n=!0,w.hovered=u[3],Wo(()=>n=!1)),e.$set(w)},i(u){i||(ne(e.$$.fragment,u),i=!0)},o(u){he(e.$$.fragment,u),i=!1},d(u){nn(e,u)}}}function FT(t){let e,n,i,a,c;e=new jh({props:{data:t[2],generateId:!0,$$slots:{default:[OT]},$$scope:{ctx:t}}});function p(b){t[8](b)}let u={gj:t[2],name:"Intersection polygons"};return t[1]!==void 0&&(u.show=t[1]),i=new $f({props:u}),Rr.push(()=>Ho(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&4&&(T.data=b[2]),w&539&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&4&&(P.gj=b[2]),!a&&w&2&&(a=!0,P.show=b[1],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function BT(t,e,n){let i,a,c,p;Gn(t,Ku,B=>n(5,a=B)),Gn(t,I_,B=>n(3,c=B)),Gn(t,jI,B=>n(4,p=B));let{$$slots:u={},$$scope:b}=e,{hoverCursor:w=void 0}=e,T=!0;function P(B){c=B,I_.set(c)}function k(B){T=B,n(1,T)}return t.$$set=B=>{"hoverCursor"in B&&n(0,w=B.hoverCursor),"$$scope"in B&&n(9,b=B.$$scope)},t.$$.update=()=>{t.$$.dirty&32&&n(2,i=a?JSON.parse(a.toGeojsonPlain()):jf())},[w,T,i,c,p,a,u,P,k,b]}class sL extends Tn{constructor(e){super(),Cn(this,e,BT,FT,In,{hoverCursor:0})}}function VT(t){let e,n;const i=[Zf("lane-markings"),{layout:{visibility:t[0]?"visible":"none"}},{paint:{"fill-color":vh("type",{"center line":"yellow","lane separator":Ls,"lane arrow":Ls,"buffer edge":Ls,"buffer stripe":Ls,"parking hatch":Ls,"vehicle stop line":Ls,"sidewalk line":"#BBBBBB","bike stop line":"green","path outline":"black"},"red"),"fill-opacity":.9}}];let a={};for(let c=0;cHo(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&2&&(T.data=b[1]),w&17&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&2&&(P.gj=b[1]),!a&&w&1&&(a=!0,P.show=b[0],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}let Ls="white";function GT(t,e,n){let i,a;Gn(t,Ku,u=>n(2,a=u));let c=!0;function p(u){c=u,n(0,c)}return t.$$.update=()=>{t.$$.dirty&4&&n(1,i=a?JSON.parse(a.toLaneMarkingsGeojson()):jf())},[c,i,a,p]}class aL extends Tn{constructor(e){super(),Cn(this,e,GT,UT,In,{})}}function qT(t){let e;const n=t[5].default,i=Os(n,t,t[9],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&512)&&Bs(i,n,a,a[9],e?Fs(n,a[9],c,null):Vs(a[9]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function jT(t){let e,n,i;const a=[Zf("lane-polygons"),{layout:{visibility:t[1]?"visible":"none"}},{manageHoverState:!0},{hoverCursor:t[0]},{paint:{"fill-color":vh("type",{Driving:"black",Parking:"#333333",Sidewalk:"#CCCCCC",Shoulder:"#CCCCCC",Biking:"#0F7D4B",Bus:"#BE4A4C",SharedLeftTurn:"black",Construction:"#FF6D00",LightRail:"#844204",Footway:"#DDDDE8",SharedUse:"#DED68A","Buffer(Planters)":"#555555","Buffer(Curb)":"white"},"red"),"fill-opacity":y_(.9,.4)}}];function c(u){t[6](u)}let p={$$slots:{default:[qT]},$$scope:{ctx:t}};for(let u=0;uHo(e,"hovered",c)),e.$on("click",t[7]),{c(){cn(e.$$.fragment)},m(u,b){en(e,u,b),i=!0},p(u,b){const w=b&3?Bf(a,[a[0],b&2&&{layout:{visibility:u[1]?"visible":"none"}},a[2],b&1&&{hoverCursor:u[0]},a[4]]):{};b&512&&(w.$$scope={dirty:b,ctx:u}),!n&&b&8&&(n=!0,w.hovered=u[3],Wo(()=>n=!1)),e.$set(w)},i(u){i||(ne(e.$$.fragment,u),i=!0)},o(u){he(e.$$.fragment,u),i=!1},d(u){nn(e,u)}}}function ZT(t){let e,n,i,a,c;e=new jh({props:{data:t[2],generateId:!0,$$slots:{default:[jT]},$$scope:{ctx:t}}});function p(b){t[8](b)}let u={gj:t[2],name:"Lane polygons"};return t[1]!==void 0&&(u.show=t[1]),i=new $f({props:u}),Rr.push(()=>Ho(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&4&&(T.data=b[2]),w&523&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&4&&(P.gj=b[2]),!a&&w&2&&(a=!0,P.show=b[1],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function WT(t,e,n){let i,a,c;Gn(t,Ku,B=>n(4,a=B)),Gn(t,w_,B=>n(3,c=B));let{$$slots:p={},$$scope:u}=e,{hoverCursor:b=void 0}=e,w=!0;function T(B){c=B,w_.set(c)}function P(B){Ji.call(this,t,B)}function k(B){w=B,n(1,w)}return t.$$set=B=>{"hoverCursor"in B&&n(0,b=B.hoverCursor),"$$scope"in B&&n(9,u=B.$$scope)},t.$$.update=()=>{t.$$.dirty&16&&n(2,i=a?JSON.parse(a.toLanePolygonsGeojson()):jf())},[b,w,i,c,a,p,T,P,k,u]}class lL extends Tn{constructor(e){super(),Cn(this,e,WT,ZT,In,{hoverCursor:0})}}export{Ku as $,en as A,Wo as B,nn as C,Vf as D,Ji as E,gr as F,jf as G,Dn as H,ls as I,yf as J,Zt as K,q_ as L,xm as M,un as N,Ye as O,qI as P,b1 as Q,bm as R,Tn as S,Qw as T,qe as U,zt as V,ju as W,Ga as X,jI as Y,jh as Z,eo as _,fe as a,Zf as a0,vh as a1,Gh as a2,Gf as a3,Bf as a4,$f as a5,I_ as a6,w_ as a7,Yu as a8,m2 as a9,$T as aa,JT as ab,tL as ac,dI as ad,iL as ae,rL as af,sL as ag,oL as ah,lL as ai,aL as aj,nL as ak,QT as al,W1 as am,a2 as an,YT as ao,he as b,cs as c,pe as d,Dl as e,XT as f,us as g,Ff as h,Cn as i,Gn as j,qh as k,Il as l,Uf as m,Hu as n,w1 as o,se as p,Os as q,Vs as r,In as s,ne as t,Bs as u,Fs as v,KT as w,Rr as x,Ho as y,cn as z}; + to cancel`,p.disabled=u=t[1]==0,ju(e,"display","flex"),ju(e,"justify-content","space-between")},m(tt,ot){fe(tt,e,ot),Zt(e,n),Zt(e,i),Zt(e,a),Zt(e,c),Zt(e,p),V.m(p,null),fe(tt,b,ot),fe(tt,w,ot),T||(P=[un(n,"click",t[2]),un(a,"click",t[3]),un(p,"click",t[4])],T=!0)},p(tt,[ot]){B===(B=k(tt))&&V?V.p(tt,ot):(V.d(1),V=B(tt),V&&(V.c(),V.m(p,null))),ot&2&&u!==(u=tt[1]==0)&&(p.disabled=u)},i:Ye,o:Ye,d(tt){tt&&(pe(e),pe(b),pe(w)),V.d(),T=!1,eo(P)}}}function JC(t,e,n){let i;Gn(t,nb,b=>n(1,i=b));let{polygonTool:a}=e;const c=()=>a.finish(),p=()=>a.cancel(),u=()=>a.undo();return t.$$set=b=>{"polygonTool"in b&&n(0,a=b.polygonTool)},[a,i,c,p,u]}class QC extends Tn{constructor(e){super(),Cn(this,e,JC,KC,In,{polygonTool:0})}}function $C(t){let e,n,i,a,c,p;return e=new Gf({props:{id:"edit-polygon-fill",filter:qC,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),i=new k1({props:{id:"edit-polygon-lines",filter:jC,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),c=new E2({props:{id:"edit-polygon-vertices",filter:ZC,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment),a=qe(),cn(c.$$.fragment)},m(u,b){en(e,u,b),fe(u,n,b),en(i,u,b),fe(u,a,b),en(c,u,b),p=!0},p:Ye,i(u){p||(ne(e.$$.fragment,u),ne(i.$$.fragment,u),ne(c.$$.fragment,u),p=!0)},o(u){he(e.$$.fragment,u),he(i.$$.fragment,u),he(c.$$.fragment,u),p=!1},d(u){u&&(pe(n),pe(a)),nn(e,u),nn(i,u),nn(c,u)}}}function tT(t){let e,n;return e=new jh({props:{data:t[0],$$slots:{default:[$C]},$$scope:{ctx:t}}}),{c(){cn(e.$$.fragment)},m(i,a){en(e,i,a),n=!0},p(i,[a]){const c={};a&1&&(c.data=i[0]),a&2&&(c.$$scope={dirty:a,ctx:i}),e.$set(c)},i(i){n||(ne(e.$$.fragment,i),n=!0)},o(i){he(e.$$.fragment,i),n=!1},d(i){nn(e,i)}}}function eT(t,e,n){let i;return Gn(t,eb,a=>n(0,i=a)),[i]}class nT extends Tn{constructor(e){super(),Cn(this,e,eT,tT,In,{})}}function c1(t){let e,n,i,a,c,p,u;e=new R1({}),i=new D1({props:{position:"bottom-right",visualizePitch:!0}}),c=new nT({});const b=t[5].default,w=Os(b,t,t[9],null);return{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment),a=qe(),cn(c.$$.fragment),p=qe(),w&&w.c()},m(T,P){en(e,T,P),fe(T,n,P),en(i,T,P),fe(T,a,P),en(c,T,P),fe(T,p,P),w&&w.m(T,P),u=!0},p(T,P){w&&w.p&&(!u||P&512)&&Bs(w,b,T,T[9],u?Fs(b,T[9],P,null):Vs(T[9]),null)},i(T){u||(ne(e.$$.fragment,T),ne(i.$$.fragment,T),ne(c.$$.fragment,T),ne(w,T),u=!0)},o(T){he(e.$$.fragment,T),he(i.$$.fragment,T),he(c.$$.fragment,T),he(w,T),u=!1},d(T){T&&(pe(n),pe(a),pe(p)),nn(e,T),nn(i,T),nn(c,T),w&&w.d(T)}}}function iT(t){let e,n,i=t[3]&&c1(t);return{c(){i&&i.c(),e=Dl()},m(a,c){i&&i.m(a,c),fe(a,e,c),n=!0},p(a,c){a[3]?i?(i.p(a,c),c&8&&ne(i,1)):(i=c1(a),i.c(),ne(i,1),i.m(e.parentNode,e)):i&&(us(),he(i,1,1,()=>{i=null}),cs())},i(a){n||(ne(i),n=!0)},o(a){he(i),n=!1},d(a){a&&pe(e),i&&i.d(a)}}}function rT(t){let e,n,i,a,c;function p(w){t[6](w)}function u(w){t[7](w)}let b={style:t[4](t[2]),hash:!0,$$slots:{default:[iT]},$$scope:{ctx:t}};return t[0]!==void 0&&(b.map=t[0]),t[1]!==void 0&&(b.loaded=t[1]),n=new X2({props:b}),Rr.push(()=>Ho(n,"map",p)),Rr.push(()=>Ho(n,"loaded",u)),n.$on("error",t[8]),{c(){e=se("div"),cn(n.$$.fragment),zt(e,"class","svelte-cexkjr")},m(w,T){fe(w,e,T),en(n,e,null),c=!0},p(w,[T]){const P={};T&4&&(P.style=w[4](w[2])),T&520&&(P.$$scope={dirty:T,ctx:w}),!i&&T&1&&(i=!0,P.map=w[0],Wo(()=>i=!1)),!a&&T&2&&(a=!0,P.loaded=w[1],Wo(()=>a=!1)),n.$set(P)},i(w){c||(ne(n.$$.fragment,w),c=!0)},o(w){he(n.$$.fragment,w),c=!1},d(w){w&&pe(e),nn(n)}}}function oT(t,e,n){let i,a;Gn(t,qI,B=>n(2,i=B)),Gn(t,Yu,B=>n(3,a=B));let{$$slots:c={},$$scope:p}=e,u,b=!1;function w(B){return B=="blank"?{version:8,sources:{},layers:[]}:`https://api.maptiler.com/maps/${B}/style.json?key=${Z1}`}function T(B){u=B,n(0,u)}function P(B){b=B,n(1,b)}const k=B=>{console.log(B.detail.error)};return t.$$set=B=>{"$$scope"in B&&n(9,p=B.$$scope)},t.$$.update=()=>{t.$$.dirty&3&&b&&Yu.set(u)},[u,b,i,a,w,c,T,P,k,p]}let $T=class extends Tn{constructor(e){super(),Cn(this,e,oT,rT,In,{})}};const{window:sT}=v1;function h1(t){let e,n,i,a,c,p,u,b,w,T,P;return w=x1(t[5][0]),{c(){e=se("div"),n=se("label"),i=se("input"),a=Un(` + Google StreetView`),c=qe(),p=se("label"),u=se("input"),b=Un(` + Bing Streetside`),zt(i,"type","radio"),i.__value="google",ls(i,i.__value),zt(u,"type","radio"),u.__value="bing",ls(u,u.__value),ju(e,"background","grey"),w.p(i,u)},m(k,B){fe(k,e,B),Zt(e,n),Zt(n,i),i.checked=i.__value===t[1],Zt(n,a),Zt(e,c),Zt(e,p),Zt(p,u),u.checked=u.__value===t[1],Zt(p,b),T||(P=[un(i,"change",t[4]),un(u,"change",t[6])],T=!0)},p(k,B){B&2&&(i.checked=i.__value===k[1]),B&2&&(u.checked=u.__value===k[1])},d(k){k&&pe(e),w.r(),T=!1,eo(P)}}}function aT(t){let e,n,i,a,c,p,u,b=t[0]&&h1(t);return{c(){e=se("label"),n=se("input"),i=Un(` + StreetView`),a=qe(),b&&b.c(),c=Dl(),zt(n,"type","checkbox")},m(w,T){fe(w,e,T),Zt(e,n),n.checked=t[0],Zt(e,i),fe(w,a,T),b&&b.m(w,T),fe(w,c,T),p||(u=[un(sT,"keydown",t[2]),un(n,"change",t[3])],p=!0)},p(w,[T]){T&1&&(n.checked=w[0]),w[0]?b?b.p(w,T):(b=h1(w),b.c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null)},i:Ye,o:Ye,d(w){w&&(pe(e),pe(a),pe(c)),b&&b.d(w),p=!1,eo(u)}}}function lT(t,e,n){let i;Gn(t,Yu,V=>n(7,i=V));let{enabled:a=!1}=e,c="google";function p(){i.on("click",b),i.getCanvas().style.cursor="zoom-in"}function u(){i.off("click",b),i.getCanvas().style.cursor="auto"}Il(u);function b(V){let tt=V.lngLat.lng,ot=V.lngLat.lat;c=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${ot},${tt}&cbp=11,0,0,0,0`,"_blank"):c=="bing"&&window.open(`https://www.bing.com/maps?cp=${ot}~${tt}&style=x`,"_blank")}function w(V){a&&V.key=="Escape"&&n(0,a=!1)}const T=[[]];function P(){a=this.checked,n(0,a)}function k(){c=this.__value,n(1,c)}function B(){c=this.__value,n(1,c)}return t.$$set=V=>{"enabled"in V&&n(0,a=V.enabled)},t.$$.update=()=>{t.$$.dirty&1&&(a?p():u())},[a,c,w,P,k,T,B]}class eL extends Tn{constructor(e){super(),Cn(this,e,lT,aT,In,{enabled:0})}}const{window:uT}=v1;function p1(t,e,n){const i=t.slice();return i[8]=e[n],i}function f1(t){let e,n=t[8]+"",i,a;return{c(){e=se("option"),i=Un(n),e.__value=a=t[8],ls(e,e.__value)},m(c,p){fe(c,e,p),Zt(e,i)},p(c,p){p&2&&n!==(n=c[8]+"")&&wl(i,n),p&2&&a!==(a=c[8])&&(e.__value=a,ls(e,e.__value))},d(c){c&&pe(e)}}}function cT(t){let e,n,i,a,c,p,u,b,w,T,P,k,B=bm(t[1]),V=[];for(let tt=0;ttt[6].call(c)),b.disabled=T=t[0]=="none"},m(tt,ot){fe(tt,e,ot),Zt(e,n),fe(tt,a,ot),fe(tt,c,ot),Zt(c,p);for(let ut=0;ut{let P=await fetch("/osm2streets//tests.json");n(1,c=await P.json()),a!="none"&&await p()});async function p(){if(a=="none"){i("resetToNone");return}try{i("loading","Loading built-in boundary and OSM XML");let B=(await(await fetch(`/osm2streets//tests/${a}/boundary.json`)).json()).features[0],tt=await(await fetch(`/osm2streets//tests/${a}/input.osm`)).text();i("load",{testCase:a,boundaryGj:B,osmXml:tt})}catch(P){i("error",P.toString())}}async function u(){let P=new URLSearchParams(window.location.search).get("test")||"none";console.log(`Navigated back in history -- changing test case from ${a} to ${P}`),n(0,a=P),await p()}async function b(){let P=c.indexOf(a);P!=-1&&P!=0&&(n(0,a=c[P-1]),await p())}async function w(){let P=c.indexOf(a);P!=-1&&P!=c.length-1&&(n(0,a=c[P+1]),await p())}function T(){a=b1(this),n(0,a),n(1,c)}return t.$$set=P=>{"testCase"in P&&n(0,a=P.testCase)},[a,c,p,u,b,w,T]}class pT extends Tn{constructor(e){super(),Cn(this,e,hT,cT,In,{testCase:0})}}function fT(t){let e,n,i,a,c,p,u;return{c(){e=se("button"),e.textContent="Import current view",n=qe(),i=se("i"),i.textContent="or...",a=qe(),c=se("button"),c.textContent="Draw an area to import on the map",zt(e,"type","button"),zt(c,"type","button")},m(b,w){fe(b,e,w),fe(b,n,w),fe(b,i,w),fe(b,a,w),fe(b,c,w),p||(u=[un(e,"click",t[2]),un(c,"click",t[1])],p=!0)},p:Ye,i:Ye,o:Ye,d(b){b&&(pe(e),pe(n),pe(i),pe(a),pe(c)),p=!1,eo(u)}}}function dT(t){let e,n;return e=new QC({props:{polygonTool:t[0]}}),{c(){cn(e.$$.fragment)},m(i,a){en(e,i,a),n=!0},p(i,a){const c={};a&1&&(c.polygonTool=i[0]),e.$set(c)},i(i){n||(ne(e.$$.fragment,i),n=!0)},o(i){he(e.$$.fragment,i),n=!1},d(i){nn(e,i)}}}function mT(t){let e,n,i,a;const c=[dT,fT],p=[];function u(b,w){return b[0]?0:1}return e=u(t),n=p[e]=c[e](t),{c(){n.c(),i=Dl()},m(b,w){p[e].m(b,w),fe(b,i,w),a=!0},p(b,[w]){let T=e;e=u(b),e===T?p[e].p(b,w):(us(),he(p[T],1,1,()=>{p[T]=null}),cs(),n=p[e],n?n.p(b,w):(n=p[e]=c[e](b),n.c()),ne(n,1),n.m(i.parentNode,i))},i(b){a||(ne(n),a=!0)},o(b){he(n),a=!1},d(b){b&&pe(i),p[e].d(b)}}}function gT(t){let e='poly:"';for(let[i,a]of t.geometry.coordinates[0])e+=`${a} ${i} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function rf(t){return[t.lng,t.lat]}function _T(t,e,n){let{map:i}=e,a=null,c=Ff();function p(){i&&(n(0,a=new HC(i)),a.startNew(),a.addEventListenerSuccess(async T=>{n(0,a=null),await u(T)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}async function u(T){try{c("loading","Loading from Overpass");let k=await(await fetch(gT(T))).text();c("load",{testCase:"none",boundaryGj:T,osmXml:k})}catch(P){c("error",P.toString())}}function b(){let T=i.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[rf(T.getSouthWest()),rf(T.getNorthWest()),rf(T.getNorthEast()),rf(T.getSouthEast()),rf(T.getSouthWest())]],type:"Polygon"}}}async function w(){if(i){if(i.getZoom()<15){c("error","Zoom in more to import (or draw a custom area)");return}await u(b())}}return t.$$set=T=>{"map"in T&&n(3,i=T.map)},[a,p,w,i,u]}class yT extends Tn{constructor(e){super(),Cn(this,e,_T,mT,In,{map:3,importPolygon:4})}get importPolygon(){return this.$$.ctx[4]}}function vT(t){let e,n,i,a,c,p,u,b,w,T,P,k,B,V,tt,ot,ut,W,X,J,ht,vt,gt,St,It,Ft,mt,Ct,ie,Tt,ee,ge,Te,Oe,on,gn;return Oe=x1(t[6][0]),{c(){e=se("details"),n=se("summary"),n.textContent="Processing Options",i=qe(),a=se("label"),c=se("input"),p=Un(` + Debug each transformation step`),u=qe(),b=se("label"),w=se("input"),T=Un(` + Enable dual carriageway experiment`),P=qe(),k=se("label"),B=se("input"),V=Un(` + Enable sidepath zipping experiment`),tt=qe(),ot=se("div"),ut=Un(`Sidewalks: + `),W=se("label"),X=se("input"),J=Un(` + use mapped footways`),ht=qe(),vt=se("label"),gt=se("input"),St=Un(` + infer on roads`),It=qe(),Ft=se("label"),mt=se("input"),Ct=Un(` + Infer kerbs`),ie=qe(),Tt=se("div"),ee=Un(`Change the time and date: + `),ge=se("label"),Te=se("input"),zt(n,"class","svelte-1c5zxm"),zt(c,"type","checkbox"),zt(a,"class","svelte-1c5zxm"),zt(w,"type","checkbox"),zt(b,"class","svelte-1c5zxm"),zt(B,"type","checkbox"),zt(k,"class","svelte-1c5zxm"),zt(X,"type","radio"),X.__value=!1,ls(X,X.__value),zt(W,"class","svelte-1c5zxm"),zt(gt,"type","radio"),gt.__value=!0,ls(gt,gt.__value),zt(vt,"class","svelte-1c5zxm"),zt(ot,"class","svelte-1c5zxm"),zt(mt,"type","checkbox"),zt(Ft,"class","svelte-1c5zxm"),zt(Te,"type","datetime-local"),zt(ge,"class","svelte-1c5zxm"),zt(Tt,"class","svelte-1c5zxm"),zt(e,"class","svelte-1c5zxm"),Oe.p(X,gt)},m(Re,Me){fe(Re,e,Me),Zt(e,n),Zt(e,i),Zt(e,a),Zt(a,c),c.checked=t[0].debug_each_step,Zt(a,p),Zt(e,u),Zt(e,b),Zt(b,w),w.checked=t[0].dual_carriageway_experiment,Zt(b,T),Zt(e,P),Zt(e,k),Zt(k,B),B.checked=t[0].sidepath_zipping_experiment,Zt(k,V),Zt(e,tt),Zt(e,ot),Zt(ot,ut),Zt(ot,W),Zt(W,X),X.checked=X.__value===t[0].inferred_sidewalks,Zt(W,J),Zt(ot,ht),Zt(ot,vt),Zt(vt,gt),gt.checked=gt.__value===t[0].inferred_sidewalks,Zt(vt,St),Zt(e,It),Zt(e,Ft),Zt(Ft,mt),mt.checked=t[0].inferred_kerbs,Zt(Ft,Ct),Zt(e,ie),Zt(e,Tt),Zt(Tt,ee),Zt(Tt,ge),Zt(ge,Te),ls(Te,t[1]),on||(gn=[un(c,"change",t[2]),un(w,"change",t[3]),un(B,"change",t[4]),un(X,"change",t[5]),un(gt,"change",t[7]),un(mt,"change",t[8]),un(Te,"input",t[9])],on=!0)},p(Re,[Me]){Me&1&&(c.checked=Re[0].debug_each_step),Me&1&&(w.checked=Re[0].dual_carriageway_experiment),Me&1&&(B.checked=Re[0].sidepath_zipping_experiment),Me&1&&(X.checked=X.__value===Re[0].inferred_sidewalks),Me&1&&(gt.checked=gt.__value===Re[0].inferred_sidewalks),Me&1&&(mt.checked=Re[0].inferred_kerbs),Me&2&&ls(Te,Re[1])},i:Ye,o:Ye,d(Re){Re&&pe(e),Oe.r(),on=!1,eo(gn)}}}function xT(t,e,n){let{settings:i={debug_each_step:!1,dual_carriageway_experiment:!1,sidepath_zipping_experiment:!1,inferred_sidewalks:!1,inferred_kerbs:!0,date_time:void 0}}=e,a;const c=[[]];function p(){i.debug_each_step=this.checked,n(0,i),n(1,a)}function u(){i.dual_carriageway_experiment=this.checked,n(0,i),n(1,a)}function b(){i.sidepath_zipping_experiment=this.checked,n(0,i),n(1,a)}function w(){i.inferred_sidewalks=this.__value,n(0,i),n(1,a)}function T(){i.inferred_sidewalks=this.__value,n(0,i),n(1,a)}function P(){i.inferred_kerbs=this.checked,n(0,i),n(1,a)}function k(){a=this.value,n(1,a)}return t.$$set=B=>{"settings"in B&&n(0,i=B.settings)},t.$$.update=()=>{t.$$.dirty&2&&n(0,i.date_time=a&&a+":00",i)},[i,a,p,u,b,w,c,T,P,k]}class bT extends Tn{constructor(e){super(),Cn(this,e,xT,vT,In,{settings:0})}}function wT(t){let e,n,i,a,c,p,u,b;return{c(){e=se("div"),n=se("button"),n.textContent="Update OSM data",i=qe(),a=se("button"),a.textContent="Download osm.xml",c=qe(),p=se("button"),p.textContent="Reset view",zt(n,"type","button"),zt(a,"type","button"),zt(p,"type","button")},m(w,T){fe(w,e,T),Zt(e,n),Zt(e,i),Zt(e,a),Zt(e,c),Zt(e,p),u||(b=[un(n,"click",t[6]),un(a,"click",t[5]),un(p,"click",t[7])],u=!0)},p:Ye,d(w){w&&pe(e),u=!1,eo(b)}}}function IT(t){let e,n=t[2].msg+"",i;return{c(){e=se("p"),i=Un(n)},m(a,c){fe(a,e,c),Zt(e,i)},p(a,c){c&4&&n!==(n=a[2].msg+"")&&wl(i,n)},d(a){a&&pe(e)}}}function ET(t){let e;return{c(){e=se("p"),e.textContent="Use the polygon tool to select an area to import"},m(n,i){fe(n,e,i)},p:Ye,d(n){n&&pe(e)}}}function ST(t){let e,n,i,a,c,p,u,b,w,T,P,k,B={map:t[4]};n=new yT({props:B}),t[12](n),n.$on("loading",t[11]),n.$on("load",t[8]),n.$on("resetToNone",t[9]),n.$on("error",t[10]);function V(ht){t[13](ht)}let tt={};t[1]!==void 0&&(tt.testCase=t[1]),p=new pT({props:tt}),Rr.push(()=>Ho(p,"testCase",V)),p.$on("loading",t[11]),p.$on("load",t[8]),p.$on("resetToNone",t[9]),p.$on("error",t[10]);function ot(ht,vt){if(ht[2].kind==="nothing")return ET;if(ht[2].kind==="loading")return IT;if(ht[2].kind==="done")return wT}let ut=ot(t),W=ut&&ut(t);function X(ht){t[14](ht)}let J={};return t[0]!==void 0&&(J.settings=t[0]),T=new bT({props:J}),Rr.push(()=>Ho(T,"settings",X)),{c(){e=se("div"),cn(n.$$.fragment),i=qe(),a=se("fieldset"),c=se("legend"),cn(p.$$.fragment),b=qe(),W&&W.c(),w=qe(),cn(T.$$.fragment),zt(a,"class","svelte-1e8er7a"),zt(e,"class","controls svelte-1e8er7a")},m(ht,vt){fe(ht,e,vt),en(n,e,null),Zt(e,i),Zt(e,a),Zt(a,c),en(p,c,null),Zt(a,b),W&&W.m(a,null),Zt(e,w),en(T,e,null),k=!0},p(ht,[vt]){const gt={};vt&16&&(gt.map=ht[4]),n.$set(gt);const St={};!u&&vt&2&&(u=!0,St.testCase=ht[1],Wo(()=>u=!1)),p.$set(St),ut===(ut=ot(ht))&&W?W.p(ht,vt):(W&&W.d(1),W=ut&&ut(ht),W&&(W.c(),W.m(a,null)));const It={};!P&&vt&1&&(P=!0,It.settings=ht[0],Wo(()=>P=!1)),T.$set(It)},i(ht){k||(ne(n.$$.fragment,ht),ne(p.$$.fragment,ht),ne(T.$$.fragment,ht),k=!0)},o(ht){he(n.$$.fragment,ht),he(p.$$.fragment,ht),he(T.$$.fragment,ht),k=!1},d(ht){ht&&pe(e),t[12](null),nn(n),nn(p),W&&W.d(),nn(T)}}}function CT(t,e,n){let i;Gn(t,Yu,J=>n(4,i=J));let a={kind:"nothing"},c,p,u=new URLSearchParams(window.location.search).get("test")||"none";function b(J){a.kind=="done"&&J&&(console.log("Settings changed, re-importing"),w(a.osmXml,a.boundaryGj))}function w(J,ht){try{n(2,a={kind:"loading",msg:"Running osm2streets"});let vt=new Vm(new Uint8Array(new TextEncoder().encode(J)),JSON.stringify(ht),c);n(2,a={kind:"done",boundaryGj:ht,osmXml:J,network:vt}),Ku.set(a.network),b_.set(a.boundaryGj)}catch(vt){window.alert(vt.toString()),n(2,a={kind:"nothing"})}}function T(){a.kind==="done"&&W1("osm.xml",a.osmXml)}function P(){a.kind==="done"&&p.importPolygon(a.boundaryGj)}function k(){a.kind==="done"&&i.fitBounds(H1(a.boundaryGj),{animate:!1,padding:10})}function B(J){w(J.detail.osmXml,J.detail.boundaryGj),n(1,u=J.detail.testCase)}function V(J){n(2,a={kind:"nothing"}),Ku.set(null),b_.set(null)}function tt(J){window.alert(J.detail),n(2,a={kind:"nothing"})}function ot(J){n(2,a={kind:"loading",msg:J.detail})}function ut(J){Rr[J?"unshift":"push"](()=>{p=J,n(3,p)})}function W(J){u=J,n(1,u)}function X(J){c=J,n(0,c)}return t.$$.update=()=>{if(t.$$.dirty&1&&b(c),t.$$.dirty&2){let J=new URL(window.location.href);u!="none"?J.searchParams.set("test",u):J.searchParams.delete("test"),window.history.pushState({},"",J)}},[c,u,a,p,i,T,P,k,B,V,tt,ot,ut,W,X]}class nL extends Tn{constructor(e){super(),Cn(this,e,CT,ST,In,{})}}function d1(t){let e,n,i,a;return{c(){e=se("button"),n=Un("Download"),zt(e,"type","button"),e.disabled=t[3]},m(c,p){fe(c,e,p),Zt(e,n),i||(a=un(e,"click",t[4]),i=!0)},p(c,p){p&8&&(e.disabled=c[3])},d(c){c&&pe(e),i=!1,a()}}}function TT(t){let e,n,i,a,c,p,u,b,w=t[2]&&d1(t);return{c(){e=se("div"),n=se("label"),i=se("input"),a=qe(),c=Un(t[1]),p=qe(),w&&w.c(),zt(i,"type","checkbox")},m(T,P){fe(T,e,P),Zt(e,n),Zt(n,i),i.checked=t[0],Zt(n,a),Zt(n,c),Zt(e,p),w&&w.m(e,null),u||(b=un(i,"change",t[6]),u=!0)},p(T,[P]){P&1&&(i.checked=T[0]),P&2&&wl(c,T[1]),T[2]?w?w.p(T,P):(w=d1(T),w.c(),w.m(e,null)):w&&(w.d(1),w=null)},i:Ye,o:Ye,d(T){T&&pe(e),w&&w.d(),u=!1,b()}}}function LT(t,e,n){let i,{gj:a}=e,{name:c}=e,{show:p}=e,{downloadable:u=!0}=e;function b(){W1(`${c}.geojson`,JSON.stringify(a))}function w(){p=this.checked,n(0,p)}return t.$$set=T=>{"gj"in T&&n(5,a=T.gj),"name"in T&&n(1,c=T.name),"show"in T&&n(0,p=T.show),"downloadable"in T&&n(2,u=T.downloadable)},t.$$.update=()=>{t.$$.dirty&32&&n(3,i=a.type=="FeatureCollection"&&a.features.length==0)},[p,c,u,i,b,a,w]}class $f extends Tn{constructor(e){super(),Cn(this,e,LT,TT,In,{gj:5,name:1,show:0,downloadable:2})}}function PT(t){let e,n;const i=[Zf("boundary"),{layout:{visibility:t[0]?"visible":"none"}},{paint:{"line-color":"blue","line-width":4}}];let a={};for(let c=0;cHo(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&2&&(T.data=b[1]),w&33&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&2&&(P.gj=b[1]),!a&&w&1&&(a=!0,P.show=b[0],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function AT(t,e,n){let i,a,c;Gn(t,b_,b=>n(2,a=b)),Gn(t,Yu,b=>n(3,c=b));let p=!0;function u(b){p=b,n(0,p)}return t.$$.update=()=>{t.$$.dirty&4&&n(1,i=a??jf()),t.$$.dirty&12&&a&&(c==null||c.fitBounds(H1(a),{animate:!1,padding:10}))},[p,i,a,c,u]}class iL extends Tn{constructor(e){super(),Cn(this,e,AT,MT,In,{})}}function kT(t){let e,n;const i=[Zf("intersection-markings"),{layout:{visibility:t[0]?"visible":"none"}},{paint:{"fill-color":vh("type",{"sidewalk corner":"#CCCCCC","marked crossing line":"white","unmarked crossing outline":"white"},"red"),"fill-opacity":.9}}];let a={};for(let c=0;cHo(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&2&&(T.data=b[1]),w&17&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&2&&(P.gj=b[1]),!a&&w&1&&(a=!0,P.show=b[0],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function RT(t,e,n){let i,a;Gn(t,Ku,u=>n(2,a=u));let c=!0;function p(u){c=u,n(0,c)}return t.$$.update=()=>{t.$$.dirty&4&&n(1,i=a?JSON.parse(a.toIntersectionMarkingsGeojson()):jf())},[c,i,a,p]}class rL extends Tn{constructor(e){super(),Cn(this,e,RT,DT,In,{})}}function NT(t){let e;const n=t[6].default,i=Os(n,t,t[9],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&512)&&Bs(i,n,a,a[9],e?Fs(n,a[9],c,null):Vs(a[9]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function zT(t){let e,n,i;const a=[Zf("intersection-polygons"),{layout:{visibility:t[1]?"visible":"none"}},{manageHoverState:!0},{hoverCursor:t[0]},{filter:["==",["get","type"],"intersection"]},{paint:{"fill-color":{debug:vh("intersection_kind",{MapEdge:"#696",Terminus:"#999",Connection:"#666",Fork:"#669",Intersection:"#966"},"red"),realistic:"black"}[t[4]],"fill-opacity":y_(.9,.4)}}];function c(u){t[7](u)}let p={$$slots:{default:[NT]},$$scope:{ctx:t}};for(let u=0;uHo(e,"hovered",c)),{c(){cn(e.$$.fragment)},m(u,b){en(e,u,b),i=!0},p(u,b){const w=b&19?Bf(a,[a[0],b&2&&{layout:{visibility:u[1]?"visible":"none"}},a[2],b&1&&{hoverCursor:u[0]},a[4],b&16&&{paint:{"fill-color":{debug:vh("intersection_kind",{MapEdge:"#696",Terminus:"#999",Connection:"#666",Fork:"#669",Intersection:"#966"},"red"),realistic:"black"}[u[4]],"fill-opacity":y_(.9,.4)}}]):{};b&512&&(w.$$scope={dirty:b,ctx:u}),!n&&b&8&&(n=!0,w.hovered=u[3],Wo(()=>n=!1)),e.$set(w)},i(u){i||(ne(e.$$.fragment,u),i=!0)},o(u){he(e.$$.fragment,u),i=!1},d(u){nn(e,u)}}}function OT(t){let e,n,i,a,c;e=new jh({props:{data:t[2],generateId:!0,$$slots:{default:[zT]},$$scope:{ctx:t}}});function p(b){t[8](b)}let u={gj:t[2],name:"Intersection polygons"};return t[1]!==void 0&&(u.show=t[1]),i=new $f({props:u}),Rr.push(()=>Ho(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&4&&(T.data=b[2]),w&539&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&4&&(P.gj=b[2]),!a&&w&2&&(a=!0,P.show=b[1],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function FT(t,e,n){let i,a,c,p;Gn(t,Ku,B=>n(5,a=B)),Gn(t,I_,B=>n(3,c=B)),Gn(t,jI,B=>n(4,p=B));let{$$slots:u={},$$scope:b}=e,{hoverCursor:w=void 0}=e,T=!0;function P(B){c=B,I_.set(c)}function k(B){T=B,n(1,T)}return t.$$set=B=>{"hoverCursor"in B&&n(0,w=B.hoverCursor),"$$scope"in B&&n(9,b=B.$$scope)},t.$$.update=()=>{t.$$.dirty&32&&n(2,i=a?JSON.parse(a.toGeojsonPlain()):jf())},[w,T,i,c,p,a,u,P,k,b]}class oL extends Tn{constructor(e){super(),Cn(this,e,FT,OT,In,{hoverCursor:0})}}function BT(t){let e,n;const i=[Zf("lane-markings"),{layout:{visibility:t[0]?"visible":"none"}},{paint:{"fill-color":vh("type",{"center line":"yellow","lane separator":Ls,"lane arrow":Ls,"buffer edge":Ls,"buffer stripe":Ls,"parking hatch":Ls,"vehicle stop line":Ls,"sidewalk line":"#BBBBBB","bike stop line":"green","path outline":"black"},"red"),"fill-opacity":.9}}];let a={};for(let c=0;cHo(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&2&&(T.data=b[1]),w&17&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&2&&(P.gj=b[1]),!a&&w&1&&(a=!0,P.show=b[0],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}let Ls="white";function UT(t,e,n){let i,a;Gn(t,Ku,u=>n(2,a=u));let c=!0;function p(u){c=u,n(0,c)}return t.$$.update=()=>{t.$$.dirty&4&&n(1,i=a?JSON.parse(a.toLaneMarkingsGeojson()):jf())},[c,i,a,p]}class sL extends Tn{constructor(e){super(),Cn(this,e,UT,VT,In,{})}}function GT(t){let e;const n=t[5].default,i=Os(n,t,t[9],null);return{c(){i&&i.c()},m(a,c){i&&i.m(a,c),e=!0},p(a,c){i&&i.p&&(!e||c&512)&&Bs(i,n,a,a[9],e?Fs(n,a[9],c,null):Vs(a[9]),null)},i(a){e||(ne(i,a),e=!0)},o(a){he(i,a),e=!1},d(a){i&&i.d(a)}}}function qT(t){let e,n,i;const a=[Zf("lane-polygons"),{layout:{visibility:t[1]?"visible":"none"}},{manageHoverState:!0},{hoverCursor:t[0]},{paint:{"fill-color":vh("type",{Driving:"black",Parking:"#333333",Sidewalk:"#CCCCCC",Shoulder:"#CCCCCC",Biking:"#0F7D4B",Bus:"#BE4A4C",SharedLeftTurn:"black",Construction:"#FF6D00",LightRail:"#844204",Footway:"#DDDDE8",SharedUse:"#DED68A","Buffer(Planters)":"#555555","Buffer(Curb)":"white"},"red"),"fill-opacity":y_(.9,.4)}}];function c(u){t[6](u)}let p={$$slots:{default:[GT]},$$scope:{ctx:t}};for(let u=0;uHo(e,"hovered",c)),e.$on("click",t[7]),{c(){cn(e.$$.fragment)},m(u,b){en(e,u,b),i=!0},p(u,b){const w=b&3?Bf(a,[a[0],b&2&&{layout:{visibility:u[1]?"visible":"none"}},a[2],b&1&&{hoverCursor:u[0]},a[4]]):{};b&512&&(w.$$scope={dirty:b,ctx:u}),!n&&b&8&&(n=!0,w.hovered=u[3],Wo(()=>n=!1)),e.$set(w)},i(u){i||(ne(e.$$.fragment,u),i=!0)},o(u){he(e.$$.fragment,u),i=!1},d(u){nn(e,u)}}}function jT(t){let e,n,i,a,c;e=new jh({props:{data:t[2],generateId:!0,$$slots:{default:[qT]},$$scope:{ctx:t}}});function p(b){t[8](b)}let u={gj:t[2],name:"Lane polygons"};return t[1]!==void 0&&(u.show=t[1]),i=new $f({props:u}),Rr.push(()=>Ho(i,"show",p)),{c(){cn(e.$$.fragment),n=qe(),cn(i.$$.fragment)},m(b,w){en(e,b,w),fe(b,n,w),en(i,b,w),c=!0},p(b,[w]){const T={};w&4&&(T.data=b[2]),w&523&&(T.$$scope={dirty:w,ctx:b}),e.$set(T);const P={};w&4&&(P.gj=b[2]),!a&&w&2&&(a=!0,P.show=b[1],Wo(()=>a=!1)),i.$set(P)},i(b){c||(ne(e.$$.fragment,b),ne(i.$$.fragment,b),c=!0)},o(b){he(e.$$.fragment,b),he(i.$$.fragment,b),c=!1},d(b){b&&pe(n),nn(e,b),nn(i,b)}}}function ZT(t,e,n){let i,a,c;Gn(t,Ku,B=>n(4,a=B)),Gn(t,w_,B=>n(3,c=B));let{$$slots:p={},$$scope:u}=e,{hoverCursor:b=void 0}=e,w=!0;function T(B){c=B,w_.set(c)}function P(B){Ji.call(this,t,B)}function k(B){w=B,n(1,w)}return t.$$set=B=>{"hoverCursor"in B&&n(0,b=B.hoverCursor),"$$scope"in B&&n(9,u=B.$$scope)},t.$$.update=()=>{t.$$.dirty&16&&n(2,i=a?JSON.parse(a.toLanePolygonsGeojson()):jf())},[b,w,i,c,a,p,T,P,k,u]}class aL extends Tn{constructor(e){super(),Cn(this,e,ZT,jT,In,{hoverCursor:0})}}export{Ku as $,en as A,Wo as B,nn as C,Vf as D,Ji as E,gr as F,jf as G,Un as H,ls as I,yf as J,Zt as K,q_ as L,xm as M,un as N,Ye as O,qI as P,b1 as Q,bm as R,Tn as S,Qw as T,qe as U,zt as V,ju as W,wl as X,jI as Y,jh as Z,eo as _,fe as a,Zf as a0,vh as a1,Gh as a2,Gf as a3,Bf as a4,$f as a5,I_ as a6,w_ as a7,Yu as a8,m2 as a9,QT as aa,KT as ab,$T as ac,dI as ad,nL as ae,iL as af,oL as ag,rL as ah,aL as ai,sL as aj,eL as ak,JT as al,W1 as am,a2 as an,XT as ao,he as b,cs as c,pe as d,Dl as e,HT as f,us as g,Ff as h,Cn as i,Gn as j,qh as k,Il as l,Uf as m,Hu as n,w1 as o,se as p,Os as q,Vs as r,In as s,ne as t,Bs as u,Fs as v,YT as w,Rr as x,Ho as y,cn as z}; diff --git a/assets/main-47acf589.js b/assets/main-2ee87bcc.js similarity index 99% rename from assets/main-47acf589.js rename to assets/main-2ee87bcc.js index 2c1863d9..4865f7d0 100644 --- a/assets/main-47acf589.js +++ b/assets/main-2ee87bcc.js @@ -1,4 +1,4 @@ -import{S as re,i as ie,s as ne,e as De,a as g,t as v,g as Ie,b as C,c as je,d as h,f as Nt,h as Bt,m as zt,j as Z,o as vt,k as Te,l as Pt,n as Jt,p as c,q as wt,u as Ct,r as Ot,v as Lt,w as Rt,x as ve,L as At,y as Ee,z as B,A as z,B as He,C as P,D as Dt,E as Me,F as Et,G as Pe,H as R,I as Se,J as Mt,K as u,M as Ae,N as fe,O as V,P as tt,Q as Tt,R as he,T as Ge,U as y,V as K,W as nt,X as St,Y as lt,Z as Fe,_ as It,$ as de,a0 as We,a1 as ot,a2 as qe,a3 as Ze,a4 as Ue,a5 as Qe,a6 as jt,a7 as Ht,a8 as Gt,a9 as Ft,aa as Wt,ab as qt,ac as Ut,ad as Vt,ae as Kt,af as Zt,ag as Qt,ah as Xt,ai as Yt,aj as $t,ak as xt,al as en}from"./RenderLanePolygons-2fe1713d.js";const tn=s=>({features:s[0]&16,data:s[0]&16,map:s[0]&4,close:s[0]&1}),st=s=>{var e;return{features:s[4],data:(e=s[4])==null?void 0:e[0],map:s[2],close:s[31]}};function rt(s){let e,n,t=(s[4]||s[3]instanceof Te.Marker)&&it(s);return{c(){e=c("div"),t&&t.c()},m(l,o){g(l,e,o),t&&t.m(e,null),s[32](e),n=!0},p(l,o){l[4]||l[3]instanceof Te.Marker?t?(t.p(l,o),o[0]&24&&v(t,1)):(t=it(l),t.c(),v(t,1),t.m(e,null)):t&&(Ie(),C(t,1,1,()=>{t=null}),je())},i(l){n||(v(t),n=!0)},o(l){C(t),n=!1},d(l){l&&h(e),t&&t.d(),s[32](null)}}}function it(s){let e;const n=s[30].default,t=wt(n,s,s[29],st);return{c(){t&&t.c()},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o[0]&536870933)&&Ct(t,n,l,l[29],e?Lt(n,l[29],o,tn):Ot(l[29]),st)},i(l){e||(v(t,l),e=!0)},o(l){C(t,l),e=!1},d(l){t&&t.d(l)}}}function nn(s){let e,n,t=s[9].default&&rt(s);return{c(){t&&t.c(),e=De()},m(l,o){t&&t.m(l,o),g(l,e,o),n=!0},p(l,o){l[9].default?t?(t.p(l,o),o[0]&512&&v(t,1)):(t=rt(l),t.c(),v(t,1),t.m(e.parentNode,e)):t&&(Ie(),C(t,1,1,()=>{t=null}),je())},i(l){n||(v(t),n=!0)},o(l){C(t),n=!1},d(l){l&&h(e),t&&t.d(l)}}}function ln(s,e,n){let t,l,o,r,f,i,{$$slots:a={},$$scope:b}=e;const O=Nt(a);let{closeButton:T=void 0}=e,{closeOnClickOutside:w=!0}=e,{closeOnClickInside:I=!1}=e,{closeOnMove:p=!1}=e,{openOn:k="click"}=e,{openIfTopMost:j=!0}=e,{focusAfterOpen:S=!0}=e,{anchor:G=void 0}=e,{offset:F=void 0}=e,{popupClass:Y=void 0}=e,{maxWidth:D=void 0}=e,{lngLat:W=void 0}=e,{html:U=void 0}=e,{open:E=!1}=e;const $=Bt(),{map:Q,popupTarget:_,layerEvent:le,layer:q,eventTopMost:oe}=zt();Z(s,Q,m=>n(2,o=m)),Z(s,_,m=>n(3,f=m)),Z(s,le,m=>n(28,r=m)),Z(s,q,m=>n(35,i=m));const H=["click","dblclick","contextmenu"];let d,N=!1,J;function L(){if(!d)return;let m=d.getElement();!m||m===J||(J=m,k==="hover"&&(J.style.pointerEvents="none"),J.addEventListener("mouseenter",()=>{n(24,N=!0)},{passive:!0}),J.addEventListener("mouseleave",()=>{n(24,N=!1)},{passive:!0}),J.addEventListener("click",()=>{I&&n(0,E=!1)},{passive:!0}))}vt(()=>{if(o)return o.on("click",ae),o.on("contextmenu",ae),typeof f=="string"&&(o.on("click",f,ue),o.on("dblclick",f,ue),o.on("contextmenu",f,ue),o.on("mousemove",f,ge),o.on("mouseleave",f,Ce),o.on("touchstart",f,we),o.on("touchend",f,be)),()=>{o!=null&&o.loaded()&&(d==null||d.remove(),o.off("click",ae),o.off("contextmenu",ae),f instanceof Te.Marker?f.getPopup()===d&&f.setPopup(void 0):typeof f=="string"&&(o.off("click",f,ue),o.off("dblclick",f,ue),o.off("contextmenu",f,ue),o.off("mousemove",f,ge),o.off("mouseleave",f,Ce),o.off("touchstart",f,we),o.off("touchend",f,be)))}});function se(m){return j?!("marker"in m)&&!Rt(m)&&oe(m)!==i:!1}let x=null,ee="normal";function ue(m){m.type===k&&(se(m)||("layerType"in m?m.layerType==="deckgl"?(n(10,W=m.coordinate),n(4,x=m.object?[m.object]:null)):(n(10,W=m.lngLat),n(4,x=m.features??[])):(n(10,W=m.lngLat),n(4,x=m.features??[])),setTimeout(()=>n(0,E=!0))))}let me=null;function we(m){me=m.point}function be(m){if(!me||k!=="hover")return;let pe=me.dist(m.point);me=null,pe<3&&(n(10,W=m.lngLat),n(4,x=m.features??[]),d.isOpen()?n(25,ee="justOpened"):(n(25,ee="opening"),n(0,E=!0)))}function Ce(m){k!=="hover"||me||ee!=="normal"||(n(0,E=!1),n(4,x=null))}function ge(m){if(!(k!=="hover"||me||ee!=="normal")){if(se(m)){n(0,E=!1),n(4,x=null);return}n(0,E=!0),n(4,x=m.features??[]),n(10,W=m.lngLat)}}function ae(m){if(ee==="justOpened"){n(25,ee="normal");return}if(!w)return;let pe=[J,f instanceof Te.Marker?f==null?void 0:f.getElement():null];E&&d.isOpen()&&!pe.some(_e=>_e==null?void 0:_e.contains(m.originalEvent.target))&&(m.type==="contextmenu"&&k==="contextmenu"||m.type!=="contextmenu")&&n(0,E=!1)}Pt(()=>{o&&(d!=null&&d.isOpen())&&d.remove()});let ce;const Je=()=>n(0,E=!1);function ke(m){ve[m?"unshift":"push"](()=>{ce=m,n(1,ce)})}return s.$$set=m=>{"closeButton"in m&&n(11,T=m.closeButton),"closeOnClickOutside"in m&&n(12,w=m.closeOnClickOutside),"closeOnClickInside"in m&&n(13,I=m.closeOnClickInside),"closeOnMove"in m&&n(14,p=m.closeOnMove),"openOn"in m&&n(15,k=m.openOn),"openIfTopMost"in m&&n(16,j=m.openIfTopMost),"focusAfterOpen"in m&&n(17,S=m.focusAfterOpen),"anchor"in m&&n(18,G=m.anchor),"offset"in m&&n(19,F=m.offset),"popupClass"in m&&n(20,Y=m.popupClass),"maxWidth"in m&&n(21,D=m.maxWidth),"lngLat"in m&&n(10,W=m.lngLat),"html"in m&&n(22,U=m.html),"open"in m&&n(0,E=m.open),"$$scope"in m&&n(29,b=m.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&14336&&n(27,t=T??(!w&&!I)),s.$$.dirty[0]&146685952&&(d||(n(23,d=new Te.Popup({closeButton:t,closeOnClick:!1,closeOnMove:p,focusAfterOpen:S,maxWidth:D,className:Y,anchor:G,offset:F})),J=d.getElement(),d.on("open",()=>{n(0,E=!0),L(),$("open",d)}),d.on("close",()=>{n(0,E=!1),$("close",d)}),d.on("hover",()=>{$("hover",d)}))),s.$$.dirty[0]&8421384&&d&&f instanceof Te.Marker&&(k==="click"?f.setPopup(d):f.getPopup()===d&&f.setPopup(void 0)),s.$$.dirty[0]&268468224&&H.includes(k)&&(r==null?void 0:r.type)===k&&(ue(r),Jt(le,r=null,r)),s.$$.dirty[0]&268468224&&n(26,l=k==="hover"&&((r==null?void 0:r.type)==="mousemove"||(r==null?void 0:r.type)==="mouseenter")),s.$$.dirty[0]&352354304&&k==="hover"&&le&&(l&&r&&(r.layerType==="deckgl"?(n(10,W=r.coordinate),n(4,x=r.object?[r.object]:null)):(n(10,W=r.lngLat),n(4,x=r.features??[]))),n(0,E=(l||N)??!1)),s.$$.dirty[0]&12582914&&(ce?d.setDOMContent(ce):U&&d.setHTML(U)),s.$$.dirty[0]&8389632&&W&&d.setLngLat(W),s.$$.dirty[0]&41943045&&o){let m=d.isOpen();E&&!m?(d.addTo(o),ee==="opening"&&n(25,ee="justOpened")):!E&&m&&d.remove()}},[E,ce,o,f,x,Q,_,le,q,O,W,T,w,I,p,k,j,S,G,F,Y,D,U,d,N,ee,l,t,r,b,a,Je,ke]}class Xe extends re{constructor(e){super(),ie(this,e,ln,nn,ne,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}function on(s){let e;const n=s[16].default,t=wt(n,s,s[24],null);return{c(){t&&t.c()},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o&16777216)&&Ct(t,n,l,l[24],e?Lt(n,l[24],o,null):Ot(l[24]),null)},i(l){e||(v(t,l),e=!0)},o(l){C(t,l),e=!1},d(l){t&&t.d(l)}}}function sn(s){let e,n,t;function l(r){s[17](r)}let o={id:s[1],type:"symbol",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],applyToClusters:s[9],minzoom:s[10],maxzoom:s[11],hoverCursor:s[12],manageHoverState:s[13],eventsIfTopMost:s[14],interactive:s[15],$$slots:{default:[on]},$$scope:{ctx:s}};return s[0]!==void 0&&(o.hovered=s[0]),e=new At({props:o}),ve.push(()=>Ee(e,"hovered",l)),e.$on("click",s[18]),e.$on("dblclick",s[19]),e.$on("contextmenu",s[20]),e.$on("mouseenter",s[21]),e.$on("mousemove",s[22]),e.$on("mouseleave",s[23]),{c(){B(e.$$.fragment)},m(r,f){z(e,r,f),t=!0},p(r,[f]){const i={};f&2&&(i.id=r[1]),f&4&&(i.source=r[2]),f&8&&(i.sourceLayer=r[3]),f&16&&(i.beforeId=r[4]),f&32&&(i.beforeLayerType=r[5]),f&64&&(i.paint=r[6]),f&128&&(i.layout=r[7]),f&256&&(i.filter=r[8]),f&512&&(i.applyToClusters=r[9]),f&1024&&(i.minzoom=r[10]),f&2048&&(i.maxzoom=r[11]),f&4096&&(i.hoverCursor=r[12]),f&8192&&(i.manageHoverState=r[13]),f&16384&&(i.eventsIfTopMost=r[14]),f&32768&&(i.interactive=r[15]),f&16777216&&(i.$$scope={dirty:f,ctx:r}),!n&&f&1&&(n=!0,i.hovered=r[0],He(()=>n=!1)),e.$set(i)},i(r){t||(v(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function rn(s,e,n){let{$$slots:t={},$$scope:l}=e,{id:o=Dt("symbol")}=e,{source:r=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:i=void 0}=e,{beforeLayerType:a=void 0}=e,{paint:b=void 0}=e,{layout:O=void 0}=e,{filter:T=void 0}=e,{applyToClusters:w=void 0}=e,{minzoom:I=void 0}=e,{maxzoom:p=void 0}=e,{hoverCursor:k=void 0}=e,{manageHoverState:j=!1}=e,{hovered:S=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:F=!0}=e;function Y(_){S=_,n(0,S)}function D(_){Me.call(this,s,_)}function W(_){Me.call(this,s,_)}function U(_){Me.call(this,s,_)}function E(_){Me.call(this,s,_)}function $(_){Me.call(this,s,_)}function Q(_){Me.call(this,s,_)}return s.$$set=_=>{"id"in _&&n(1,o=_.id),"source"in _&&n(2,r=_.source),"sourceLayer"in _&&n(3,f=_.sourceLayer),"beforeId"in _&&n(4,i=_.beforeId),"beforeLayerType"in _&&n(5,a=_.beforeLayerType),"paint"in _&&n(6,b=_.paint),"layout"in _&&n(7,O=_.layout),"filter"in _&&n(8,T=_.filter),"applyToClusters"in _&&n(9,w=_.applyToClusters),"minzoom"in _&&n(10,I=_.minzoom),"maxzoom"in _&&n(11,p=_.maxzoom),"hoverCursor"in _&&n(12,k=_.hoverCursor),"manageHoverState"in _&&n(13,j=_.manageHoverState),"hovered"in _&&n(0,S=_.hovered),"eventsIfTopMost"in _&&n(14,G=_.eventsIfTopMost),"interactive"in _&&n(15,F=_.interactive),"$$scope"in _&&n(24,l=_.$$scope)},[S,o,r,f,i,a,b,O,T,w,I,p,k,j,G,F,t,Y,D,W,U,E,$,Q,l]}class fn extends re{constructor(e){super(),ie(this,e,rn,sn,ne,{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})}}const Re=Et(Pe());function un(s){let e,n,t,l,o,r,f,i,a,b;return{c(){e=c("div"),n=c("label"),t=R(`Basemap: +import{S as re,i as ie,s as ne,e as De,a as g,t as v,g as Ie,b as C,c as je,d as h,f as Nt,h as Bt,m as zt,j as Z,o as vt,k as Te,l as Pt,n as Jt,p as c,q as wt,u as Ct,r as Ot,v as Lt,w as Rt,x as ve,L as At,y as Ee,z as B,A as z,B as He,C as P,D as Dt,E as Me,F as Et,G as Pe,H as R,I as Se,J as Mt,K as u,M as Ae,N as fe,O as V,P as tt,Q as Tt,R as he,T as Ge,U as y,V as K,W as nt,X as St,Y as lt,Z as Fe,_ as It,$ as de,a0 as We,a1 as ot,a2 as qe,a3 as Ze,a4 as Ue,a5 as Qe,a6 as jt,a7 as Ht,a8 as Gt,a9 as Ft,aa as Wt,ab as qt,ac as Ut,ad as Vt,ae as Kt,af as Zt,ag as Qt,ah as Xt,ai as Yt,aj as $t,ak as xt,al as en}from"./RenderLanePolygons-b4bc0e33.js";const tn=s=>({features:s[0]&16,data:s[0]&16,map:s[0]&4,close:s[0]&1}),st=s=>{var e;return{features:s[4],data:(e=s[4])==null?void 0:e[0],map:s[2],close:s[31]}};function rt(s){let e,n,t=(s[4]||s[3]instanceof Te.Marker)&&it(s);return{c(){e=c("div"),t&&t.c()},m(l,o){g(l,e,o),t&&t.m(e,null),s[32](e),n=!0},p(l,o){l[4]||l[3]instanceof Te.Marker?t?(t.p(l,o),o[0]&24&&v(t,1)):(t=it(l),t.c(),v(t,1),t.m(e,null)):t&&(Ie(),C(t,1,1,()=>{t=null}),je())},i(l){n||(v(t),n=!0)},o(l){C(t),n=!1},d(l){l&&h(e),t&&t.d(),s[32](null)}}}function it(s){let e;const n=s[30].default,t=wt(n,s,s[29],st);return{c(){t&&t.c()},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o[0]&536870933)&&Ct(t,n,l,l[29],e?Lt(n,l[29],o,tn):Ot(l[29]),st)},i(l){e||(v(t,l),e=!0)},o(l){C(t,l),e=!1},d(l){t&&t.d(l)}}}function nn(s){let e,n,t=s[9].default&&rt(s);return{c(){t&&t.c(),e=De()},m(l,o){t&&t.m(l,o),g(l,e,o),n=!0},p(l,o){l[9].default?t?(t.p(l,o),o[0]&512&&v(t,1)):(t=rt(l),t.c(),v(t,1),t.m(e.parentNode,e)):t&&(Ie(),C(t,1,1,()=>{t=null}),je())},i(l){n||(v(t),n=!0)},o(l){C(t),n=!1},d(l){l&&h(e),t&&t.d(l)}}}function ln(s,e,n){let t,l,o,r,f,i,{$$slots:a={},$$scope:b}=e;const O=Nt(a);let{closeButton:T=void 0}=e,{closeOnClickOutside:w=!0}=e,{closeOnClickInside:I=!1}=e,{closeOnMove:p=!1}=e,{openOn:k="click"}=e,{openIfTopMost:j=!0}=e,{focusAfterOpen:S=!0}=e,{anchor:G=void 0}=e,{offset:F=void 0}=e,{popupClass:Y=void 0}=e,{maxWidth:D=void 0}=e,{lngLat:W=void 0}=e,{html:U=void 0}=e,{open:E=!1}=e;const $=Bt(),{map:Q,popupTarget:_,layerEvent:le,layer:q,eventTopMost:oe}=zt();Z(s,Q,m=>n(2,o=m)),Z(s,_,m=>n(3,f=m)),Z(s,le,m=>n(28,r=m)),Z(s,q,m=>n(35,i=m));const H=["click","dblclick","contextmenu"];let d,N=!1,J;function L(){if(!d)return;let m=d.getElement();!m||m===J||(J=m,k==="hover"&&(J.style.pointerEvents="none"),J.addEventListener("mouseenter",()=>{n(24,N=!0)},{passive:!0}),J.addEventListener("mouseleave",()=>{n(24,N=!1)},{passive:!0}),J.addEventListener("click",()=>{I&&n(0,E=!1)},{passive:!0}))}vt(()=>{if(o)return o.on("click",ae),o.on("contextmenu",ae),typeof f=="string"&&(o.on("click",f,ue),o.on("dblclick",f,ue),o.on("contextmenu",f,ue),o.on("mousemove",f,ge),o.on("mouseleave",f,Ce),o.on("touchstart",f,we),o.on("touchend",f,be)),()=>{o!=null&&o.loaded()&&(d==null||d.remove(),o.off("click",ae),o.off("contextmenu",ae),f instanceof Te.Marker?f.getPopup()===d&&f.setPopup(void 0):typeof f=="string"&&(o.off("click",f,ue),o.off("dblclick",f,ue),o.off("contextmenu",f,ue),o.off("mousemove",f,ge),o.off("mouseleave",f,Ce),o.off("touchstart",f,we),o.off("touchend",f,be)))}});function se(m){return j?!("marker"in m)&&!Rt(m)&&oe(m)!==i:!1}let x=null,ee="normal";function ue(m){m.type===k&&(se(m)||("layerType"in m?m.layerType==="deckgl"?(n(10,W=m.coordinate),n(4,x=m.object?[m.object]:null)):(n(10,W=m.lngLat),n(4,x=m.features??[])):(n(10,W=m.lngLat),n(4,x=m.features??[])),setTimeout(()=>n(0,E=!0))))}let me=null;function we(m){me=m.point}function be(m){if(!me||k!=="hover")return;let pe=me.dist(m.point);me=null,pe<3&&(n(10,W=m.lngLat),n(4,x=m.features??[]),d.isOpen()?n(25,ee="justOpened"):(n(25,ee="opening"),n(0,E=!0)))}function Ce(m){k!=="hover"||me||ee!=="normal"||(n(0,E=!1),n(4,x=null))}function ge(m){if(!(k!=="hover"||me||ee!=="normal")){if(se(m)){n(0,E=!1),n(4,x=null);return}n(0,E=!0),n(4,x=m.features??[]),n(10,W=m.lngLat)}}function ae(m){if(ee==="justOpened"){n(25,ee="normal");return}if(!w)return;let pe=[J,f instanceof Te.Marker?f==null?void 0:f.getElement():null];E&&d.isOpen()&&!pe.some(_e=>_e==null?void 0:_e.contains(m.originalEvent.target))&&(m.type==="contextmenu"&&k==="contextmenu"||m.type!=="contextmenu")&&n(0,E=!1)}Pt(()=>{o&&(d!=null&&d.isOpen())&&d.remove()});let ce;const Je=()=>n(0,E=!1);function ke(m){ve[m?"unshift":"push"](()=>{ce=m,n(1,ce)})}return s.$$set=m=>{"closeButton"in m&&n(11,T=m.closeButton),"closeOnClickOutside"in m&&n(12,w=m.closeOnClickOutside),"closeOnClickInside"in m&&n(13,I=m.closeOnClickInside),"closeOnMove"in m&&n(14,p=m.closeOnMove),"openOn"in m&&n(15,k=m.openOn),"openIfTopMost"in m&&n(16,j=m.openIfTopMost),"focusAfterOpen"in m&&n(17,S=m.focusAfterOpen),"anchor"in m&&n(18,G=m.anchor),"offset"in m&&n(19,F=m.offset),"popupClass"in m&&n(20,Y=m.popupClass),"maxWidth"in m&&n(21,D=m.maxWidth),"lngLat"in m&&n(10,W=m.lngLat),"html"in m&&n(22,U=m.html),"open"in m&&n(0,E=m.open),"$$scope"in m&&n(29,b=m.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&14336&&n(27,t=T??(!w&&!I)),s.$$.dirty[0]&146685952&&(d||(n(23,d=new Te.Popup({closeButton:t,closeOnClick:!1,closeOnMove:p,focusAfterOpen:S,maxWidth:D,className:Y,anchor:G,offset:F})),J=d.getElement(),d.on("open",()=>{n(0,E=!0),L(),$("open",d)}),d.on("close",()=>{n(0,E=!1),$("close",d)}),d.on("hover",()=>{$("hover",d)}))),s.$$.dirty[0]&8421384&&d&&f instanceof Te.Marker&&(k==="click"?f.setPopup(d):f.getPopup()===d&&f.setPopup(void 0)),s.$$.dirty[0]&268468224&&H.includes(k)&&(r==null?void 0:r.type)===k&&(ue(r),Jt(le,r=null,r)),s.$$.dirty[0]&268468224&&n(26,l=k==="hover"&&((r==null?void 0:r.type)==="mousemove"||(r==null?void 0:r.type)==="mouseenter")),s.$$.dirty[0]&352354304&&k==="hover"&&le&&(l&&r&&(r.layerType==="deckgl"?(n(10,W=r.coordinate),n(4,x=r.object?[r.object]:null)):(n(10,W=r.lngLat),n(4,x=r.features??[]))),n(0,E=(l||N)??!1)),s.$$.dirty[0]&12582914&&(ce?d.setDOMContent(ce):U&&d.setHTML(U)),s.$$.dirty[0]&8389632&&W&&d.setLngLat(W),s.$$.dirty[0]&41943045&&o){let m=d.isOpen();E&&!m?(d.addTo(o),ee==="opening"&&n(25,ee="justOpened")):!E&&m&&d.remove()}},[E,ce,o,f,x,Q,_,le,q,O,W,T,w,I,p,k,j,S,G,F,Y,D,U,d,N,ee,l,t,r,b,a,Je,ke]}class Xe extends re{constructor(e){super(),ie(this,e,ln,nn,ne,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}function on(s){let e;const n=s[16].default,t=wt(n,s,s[24],null);return{c(){t&&t.c()},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o&16777216)&&Ct(t,n,l,l[24],e?Lt(n,l[24],o,null):Ot(l[24]),null)},i(l){e||(v(t,l),e=!0)},o(l){C(t,l),e=!1},d(l){t&&t.d(l)}}}function sn(s){let e,n,t;function l(r){s[17](r)}let o={id:s[1],type:"symbol",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],applyToClusters:s[9],minzoom:s[10],maxzoom:s[11],hoverCursor:s[12],manageHoverState:s[13],eventsIfTopMost:s[14],interactive:s[15],$$slots:{default:[on]},$$scope:{ctx:s}};return s[0]!==void 0&&(o.hovered=s[0]),e=new At({props:o}),ve.push(()=>Ee(e,"hovered",l)),e.$on("click",s[18]),e.$on("dblclick",s[19]),e.$on("contextmenu",s[20]),e.$on("mouseenter",s[21]),e.$on("mousemove",s[22]),e.$on("mouseleave",s[23]),{c(){B(e.$$.fragment)},m(r,f){z(e,r,f),t=!0},p(r,[f]){const i={};f&2&&(i.id=r[1]),f&4&&(i.source=r[2]),f&8&&(i.sourceLayer=r[3]),f&16&&(i.beforeId=r[4]),f&32&&(i.beforeLayerType=r[5]),f&64&&(i.paint=r[6]),f&128&&(i.layout=r[7]),f&256&&(i.filter=r[8]),f&512&&(i.applyToClusters=r[9]),f&1024&&(i.minzoom=r[10]),f&2048&&(i.maxzoom=r[11]),f&4096&&(i.hoverCursor=r[12]),f&8192&&(i.manageHoverState=r[13]),f&16384&&(i.eventsIfTopMost=r[14]),f&32768&&(i.interactive=r[15]),f&16777216&&(i.$$scope={dirty:f,ctx:r}),!n&&f&1&&(n=!0,i.hovered=r[0],He(()=>n=!1)),e.$set(i)},i(r){t||(v(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){P(e,r)}}}function rn(s,e,n){let{$$slots:t={},$$scope:l}=e,{id:o=Dt("symbol")}=e,{source:r=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:i=void 0}=e,{beforeLayerType:a=void 0}=e,{paint:b=void 0}=e,{layout:O=void 0}=e,{filter:T=void 0}=e,{applyToClusters:w=void 0}=e,{minzoom:I=void 0}=e,{maxzoom:p=void 0}=e,{hoverCursor:k=void 0}=e,{manageHoverState:j=!1}=e,{hovered:S=null}=e,{eventsIfTopMost:G=!1}=e,{interactive:F=!0}=e;function Y(_){S=_,n(0,S)}function D(_){Me.call(this,s,_)}function W(_){Me.call(this,s,_)}function U(_){Me.call(this,s,_)}function E(_){Me.call(this,s,_)}function $(_){Me.call(this,s,_)}function Q(_){Me.call(this,s,_)}return s.$$set=_=>{"id"in _&&n(1,o=_.id),"source"in _&&n(2,r=_.source),"sourceLayer"in _&&n(3,f=_.sourceLayer),"beforeId"in _&&n(4,i=_.beforeId),"beforeLayerType"in _&&n(5,a=_.beforeLayerType),"paint"in _&&n(6,b=_.paint),"layout"in _&&n(7,O=_.layout),"filter"in _&&n(8,T=_.filter),"applyToClusters"in _&&n(9,w=_.applyToClusters),"minzoom"in _&&n(10,I=_.minzoom),"maxzoom"in _&&n(11,p=_.maxzoom),"hoverCursor"in _&&n(12,k=_.hoverCursor),"manageHoverState"in _&&n(13,j=_.manageHoverState),"hovered"in _&&n(0,S=_.hovered),"eventsIfTopMost"in _&&n(14,G=_.eventsIfTopMost),"interactive"in _&&n(15,F=_.interactive),"$$scope"in _&&n(24,l=_.$$scope)},[S,o,r,f,i,a,b,O,T,w,I,p,k,j,G,F,t,Y,D,W,U,E,$,Q,l]}class fn extends re{constructor(e){super(),ie(this,e,rn,sn,ne,{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})}}const Re=Et(Pe());function un(s){let e,n,t,l,o,r,f,i,a,b;return{c(){e=c("div"),n=c("label"),t=R(`Basemap: `),l=c("select"),o=c("option"),o.textContent="MapTiler Dataviz",r=c("option"),r.textContent="MapTiler Streets",f=c("option"),f.textContent="MapTiler Satellite",i=c("option"),i.textContent="Blank",o.__value="dataviz",Se(o,o.__value),r.__value="streets",Se(r,r.__value),f.__value="hybrid",Se(f,f.__value),i.__value="blank",Se(i,i.__value),s[0]===void 0&&Mt(()=>s[1].call(l))},m(O,T){g(O,e,T),u(e,n),u(n,t),u(n,l),u(l,o),u(l,r),u(l,f),u(l,i),Ae(l,s[0],!0),a||(b=fe(l,"change",s[1]),a=!0)},p(O,[T]){T&1&&Ae(l,O[0])},i:V,o:V,d(O){O&&h(e),a=!1,b()}}}function an(s,e,n){let t;Z(s,tt,o=>n(0,t=o));function l(){t=Tt(this),tt.set(t)}return[t,l]}class cn extends re{constructor(e){super(),ie(this,e,an,un,ne,{})}}function ft(s,e,n){const t=s.slice();return t[1]=e[n][0],t[2]=e[n][1],t}function ut(s){let e,n,t,l=s[1]+"",o,r;return{c(){e=c("li"),n=c("span"),t=y(),o=R(l),r=y(),K(n,"class","svelte-kzgqtg"),nt(n,"background",s[2])},m(f,i){g(f,e,i),u(e,n),u(e,t),u(e,o),u(e,r)},p(f,i){i&1&&nt(n,"background",f[2]),i&1&&l!==(l=f[1]+"")&&St(o,l)},d(f){f&&h(e)}}}function mn(s){let e,n=he(s[0]),t=[];for(let l=0;l{"rows"in l&&n(0,t=l.rows)},[t]}class dn extends re{constructor(e){super(),ie(this,e,pn,mn,ne,{rows:0})}}function _n(s){let e,n,t,l,o,r,f,i;return{c(){e=c("div"),n=c("label"),t=R(`Theme: `),l=c("select"),o=c("option"),o.textContent="Debug",r=c("option"),r.textContent="Realistic",o.__value="debug",Se(o,o.__value),r.__value="realistic",Se(r,r.__value),s[0]===void 0&&Mt(()=>s[1].call(l))},m(a,b){g(a,e,b),u(e,n),u(n,t),u(n,l),u(l,o),u(l,r),Ae(l,s[0],!0),f||(i=fe(l,"change",s[1]),f=!0)},p(a,[b]){b&1&&Ae(l,a[0])},i:V,o:V,d(a){a&&h(e),f=!1,i()}}}function gn(s,e,n){let t;Z(s,lt,o=>n(0,t=o));function l(){t=Tt(this),lt.set(t)}return[t,l]}class hn extends re{constructor(e){super(),ie(this,e,gn,_n,ne,{})}}function bn(s){let e,n=s[6].properties.kind+"",t;return{c(){e=c("p"),t=R(n)},m(l,o){g(l,e,o),u(e,t)},p(l,o){o&64&&n!==(n=l[6].properties.kind+"")&&St(t,n)},d(l){l&&h(e)}}}function kn(s){let e,n;return e=new Xe({props:{openOn:"hover",$$slots:{default:[bn,({data:t})=>({6:t}),({data:t})=>t?64:0]},$$scope:{ctx:s}}}),{c(){B(e.$$.fragment)},m(t,l){z(e,t,l),n=!0},p(t,l){const o={};l&192&&(o.$$scope={dirty:l,ctx:t}),e.$set(o)},i(t){n||(v(e.$$.fragment,t),n=!0)},o(t){C(e.$$.fragment,t),n=!1},d(t){P(e,t)}}}function yn(s){let e,n;const t=[We("block"),{paint:{"fill-color":ot("kind",s[4],"red"),"fill-opacity":.8}}];let l={$$slots:{default:[kn]},$$scope:{ctx:s}};for(let o=0;o{p=null}),je())},i(k){T||(v(e.$$.fragment,k),v(p),T=!0)},o(k){C(e.$$.fragment,k),C(p),T=!1},d(k){k&&(h(n),h(t),h(b),h(O)),P(e,k),p&&p.d(k),w=!1,It(I)}}}function wn(s,e,n){let t,l,o;Z(s,de,a=>n(5,l=a)),Z(s,Re,a=>n(0,o=a));function r(){Re.set(Pe())}function f(){Re.set(JSON.parse(l.findAllBlocks()))}let i={RoadAndSidewalk:"green",RoadAndCycleLane:"orange",CycleLaneAndSidewalk:"yellow",DualCarriageway:"purple",Unknown:"blue"};return s.$$.update=()=>{s.$$.dirty&1&&n(1,t=o.features.length>0)},[o,t,r,f,i]}class Cn extends re{constructor(e){super(),ie(this,e,wn,vn,ne,{})}}function On(s){let e,n;const t=[We("connected-roads"),{layout:{visibility:s[0]?"visible":"none"}},{paint:{"fill-color":"blue","fill-opacity":.5}}];let l={};for(let o=0;oEe(t,"show",r)),{c(){B(e.$$.fragment),n=y(),B(t.$$.fragment)},m(i,a){z(e,i,a),g(i,n,a),z(t,i,a),o=!0},p(i,[a]){const b={};a&2&&(b.data=i[1]),a&33&&(b.$$scope={dirty:a,ctx:i}),e.$set(b);const O={};a&2&&(O.gj=i[1]),!l&&a&1&&(l=!0,O.show=i[0],He(()=>l=!1)),t.$set(O)},i(i){o||(v(e.$$.fragment,i),v(t.$$.fragment,i),o=!0)},o(i){C(e.$$.fragment,i),C(t.$$.fragment,i),o=!1},d(i){i&&h(n),P(e,i),P(t,i)}}}function Mn(s,e,n){let t,l,o;Z(s,jt,i=>n(2,l=i)),Z(s,de,i=>n(3,o=i));let r=!0;function f(i){r=i,n(0,r)}return s.$$.update=()=>{s.$$.dirty&12&&n(1,t=o&&l?JSON.parse(o.debugRoadsConnectedToIntersectionGeojson(l.properties.id)):Pe())},[r,t,l,o,f]}class Tn extends re{constructor(e){super(),ie(this,e,Mn,Ln,ne,{})}}function Sn(s){let e,n;const t=[We("movements"),{layout:{visibility:s[0]?"visible":"none"}},{paint:{"fill-color":"blue","fill-opacity":.5}}];let l={};for(let o=0;oEe(t,"show",r)),{c(){B(e.$$.fragment),n=y(),B(t.$$.fragment)},m(i,a){z(e,i,a),g(i,n,a),z(t,i,a),o=!0},p(i,[a]){const b={};a&2&&(b.data=i[1]),a&33&&(b.$$scope={dirty:a,ctx:i}),e.$set(b);const O={};a&2&&(O.gj=i[1]),!l&&a&1&&(l=!0,O.show=i[0],He(()=>l=!1)),t.$set(O)},i(i){o||(v(e.$$.fragment,i),v(t.$$.fragment,i),o=!0)},o(i){C(e.$$.fragment,i),C(t.$$.fragment,i),o=!1},d(i){i&&h(n),P(e,i),P(t,i)}}}function jn(s,e,n){let t,l,o;Z(s,Ht,i=>n(2,l=i)),Z(s,de,i=>n(3,o=i));let r=!0;function f(i){r=i,n(0,r)}return s.$$.update=()=>{s.$$.dirty&12&&n(1,t=o&&l?JSON.parse(o.debugMovementsFromLaneGeojson(l.properties.road,l.properties.index)):Pe())},[r,t,l,o,f]}class Nn extends re{constructor(e){super(),ie(this,e,jn,In,ne,{})}}function Bn(s){let e,n,t,l,o,r;return{c(){e=c("div"),n=c("label"),t=c("input"),l=R(` diff --git a/assets/nested-a19638a8.js b/assets/nested-a080194a.js similarity index 99% rename from assets/nested-a19638a8.js rename to assets/nested-a080194a.js index 308d946c..046a17bd 100644 --- a/assets/nested-a19638a8.js +++ b/assets/nested-a080194a.js @@ -1,4 +1,4 @@ -import{S as q,i as P,s as A,p as h,H as G,U as y,V as L,a as b,K as _,N as j,X as x,O as N,d as v,j as B,$ as D,am as ne,R as X,an as le,_ as ee,h as re,I as J,ao as ae,z as S,e as te,A as M,g as z,b as w,c as H,t as g,C as T,x as se,aa as oe,o as ie,G as ue,ab as fe,ac as ce,ad as de,ae as pe,ak as me,af as _e,ag as $e,ah as ge,ai as ye,aj as he,Z as we,al as ke,W as be,a8 as ve,a0 as We,a2 as Ce,a3 as Oe}from"./RenderLanePolygons-2fe1713d.js";function Se(i){let e,t=i[0].size+"",n,l,r,a,s,d;return{c(){e=h("div"),n=G(t),l=G(" ways edited"),r=y(),a=h("button"),a.textContent="Download .osc",L(a,"type","button")},m(c,f){b(c,e,f),_(e,n),_(e,l),b(c,r,f),b(c,a,f),s||(d=j(a,"click",i[1]),s=!0)},p(c,[f]){f&1&&t!==(t=c[0].size+"")&&x(n,t)},i:N,o:N,d(c){c&&(v(e),v(r),v(a)),s=!1,d()}}}function Me(i,e,t){let n;B(i,D,s=>t(3,n=s));let l=new Set;function r(s){l.add(s.detail),t(0,l)}function a(){let s=` +import{S as q,i as P,s as A,p as h,H as G,U as y,V as L,a as b,K as _,N as j,X as x,O as N,d as v,j as B,$ as D,am as ne,R as X,an as le,_ as ee,h as re,I as J,ao as ae,z as S,e as te,A as M,g as z,b as w,c as H,t as g,C as T,x as se,aa as oe,o as ie,G as ue,ab as fe,ac as ce,ad as de,ae as pe,ak as me,af as _e,ag as $e,ah as ge,ai as ye,aj as he,Z as we,al as ke,W as be,a8 as ve,a0 as We,a2 as Ce,a3 as Oe}from"./RenderLanePolygons-b4bc0e33.js";function Se(i){let e,t=i[0].size+"",n,l,r,a,s,d;return{c(){e=h("div"),n=G(t),l=G(" ways edited"),r=y(),a=h("button"),a.textContent="Download .osc",L(a,"type","button")},m(c,f){b(c,e,f),_(e,n),_(e,l),b(c,r,f),b(c,a,f),s||(d=j(a,"click",i[1]),s=!0)},p(c,[f]){f&1&&t!==(t=c[0].size+"")&&x(n,t)},i:N,o:N,d(c){c&&(v(e),v(r),v(a)),s=!1,d()}}}function Me(i,e,t){let n;B(i,D,s=>t(3,n=s));let l=new Set;function r(s){l.add(s.detail),t(0,l)}function a(){let s=` `;s+=` `,s+=` `;for(let d of l)try{s+=n.wayToXml(d),s+=` diff --git a/index.html b/index.html index 856b2e42..c634932e 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@ StreetExplorer - - + + diff --git a/lane_editor.html b/lane_editor.html index 732820df..acc9f02d 100644 --- a/lane_editor.html +++ b/lane_editor.html @@ -4,8 +4,8 @@ osm2streets lane editor - - + +