diff --git a/assets/backend_bg.wasm b/assets/backend_bg.wasm index 6949bd2..a3a5952 100644 Binary files a/assets/backend_bg.wasm and b/assets/backend_bg.wasm differ diff --git a/assets/main-1c35fdec.js b/assets/main-1c35fdec.js new file mode 100644 index 0000000..1f1e6a2 --- /dev/null +++ b/assets/main-1c35fdec.js @@ -0,0 +1,647 @@ +var nP=Object.defineProperty;var rP=(t,e,n)=>e in t?nP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gi=(t,e,n)=>(rP(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function tt(){}function iP(t,e){for(const n in e)t[n]=e[n];return t}function oP(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function dE(t){return t()}function ux(){return Object.create(null)}function Ai(t){t.forEach(dE)}function E_(t){return typeof t=="function"}function Wt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let dg;function To(t,e){return t===e?!0:(dg||(dg=document.createElement("a")),dg.href=e,t===dg.href)}function sP(t){return Object.keys(t).length===0}function mE(t,...e){if(t==null){for(const r of e)r(void 0);return tt}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function gE(t){let e;return mE(t,n=>e=n)(),e}function Lt(t,e,n){t.$$.on_destroy.push(mE(e,n))}function Xr(t,e,n,r){if(t){const i=_E(t,e,n,r);return t[0](i)}}function _E(t,e,n,r){return t[1]&&r?iP(n.ctx.slice(),t[1](r(e))):n.ctx}function Yr(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],c=Math.max(e.dirty.length,i.length);for(let l=0;l32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function uP(t){return function(e){return e.preventDefault(),t.call(this,e)}}function t0(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Fe(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Xc(t){return t===""?null:+t}function cP(t){return Array.from(t.childNodes)}function An(t,e){e=""+e,t.data!==e&&(t.data=e)}function yi(t,e){t.value=e??""}function Ii(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Ug(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=hP(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function Iv(t,e){return Zf().$$.context.set(t,e),e}function Cv(t){return Zf().$$.context.get(t)}function dn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const lf=[],Gn=[];let mf=[];const k0=[],vE=Promise.resolve();let D0=!1;function bE(){D0||(D0=!0,vE.then(Tv))}function xE(){return bE(),vE}function Pd(t){mf.push(t)}function Xi(t){k0.push(t)}const n0=new Set;let ef=0;function Tv(){if(ef!==0)return;const t=Ld;do{try{for(;eft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),mf=e}const Tg=new Set;let Lc;function Ln(){Lc={r:0,c:[],p:Lc}}function Pn(){Lc.r||Ai(Lc.c),Lc=Lc.p}function _e(t,e){t&&t.i&&(Tg.delete(t),t.i(e))}function Se(t,e,n,r){if(t&&t.o){if(Tg.has(t))return;Tg.add(t),Lc.c.push(()=>{Tg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function vf(t,e){const n=e.token={};function r(i,a,c,l){if(e.token!==n)return;e.resolved=l;let d=e.ctx;c!==void 0&&(d=d.slice(),d[c]=l);const w=i&&(e.current=i)(d);let S=!1;e.block&&(e.blocks?e.blocks.forEach((I,T)=>{T!==a&&I&&(Ln(),Se(I,1,1,()=>{e.blocks[T]===I&&(e.blocks[T]=null)}),Pn())}):e.block.d(1),w.c(),_e(w,1),w.m(e.mount(),e.anchor),S=!0),e.block=w,e.blocks&&(e.blocks[a]=w),S&&Tv()}if(oP(t)){const i=Zf();if(t.then(a=>{Zl(i),r(e.then,1,e.value,a),Zl(null)},a=>{if(Zl(i),r(e.catch,2,e.error,a),Zl(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function Lv(t,e,n){const r=e.slice(),{resolved:i}=t;t.current===t.then&&(r[t.value]=i),t.current===t.catch&&(r[t.error]=i),t.block.p(r,n)}function zr(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function dP(t,e){Se(t,1,1,()=>{e.delete(t.key)})}function mP(t,e,n,r,i,a,c,l,d,w,S,I){let T=t.length,k=a.length,D=T;const U={};for(;D--;)U[t[D].key]=D;const j=[],$=new Map,B=new Map,q=[];for(D=k;D--;){const de=I(i,a,D),ie=n(de);let ee=c.get(ie);ee?r&&q.push(()=>ee.p(de,e)):(ee=w(ie,de),ee.c()),$.set(ie,j[D]=ee),ie in U&&B.set(ie,Math.abs(D-U[ie]))}const J=new Set,ce=new Set;function fe(de){_e(de,1),de.m(l,S),c.set(de.key,de),S=de.first,k--}for(;T&&k;){const de=j[k-1],ie=t[T-1],ee=de.key,Le=ie.key;de===ie?(S=de.first,T--,k--):$.has(Le)?!c.has(ee)||J.has(ee)?fe(de):ce.has(Le)?T--:B.get(ee)>B.get(Le)?(ce.add(ee),fe(de)):(J.add(Le),T--):(d(ie,c),T--)}for(;T--;){const de=t[T];$.has(de.key)||d(de,c)}for(;k;)fe(j[k-1]);return Ai(q),j}function Yi(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function st(t){t&&t.c()}function it(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Pd(()=>{const a=t.$$.on_mount.map(dE).filter(E_);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ai(a),t.$$.on_mount=[]}),i.forEach(Pd)}function ot(t,e){const n=t.$$;n.fragment!==null&&(pP(n.after_update),Ai(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function gP(t,e){t.$$.dirty[0]===-1&&(lf.push(t),bE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const D=k.length?k[0]:T;return w.ctx&&i(w.ctx[I],w.ctx[I]=D)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](D),S&&gP(t,I)),T}):[],w.update(),S=!0,Ai(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=cP(e.target);w.fragment&&w.fragment.l(I),I.forEach(Pe)}else w.fragment&&w.fragment.c();e.intro&&_e(t.$$.fragment),it(t,e.target,e.anchor),Tv()}Zl(d)}class Jt{constructor(){gi(this,"$$");gi(this,"$$set")}$destroy(){ot(this,1),this.$destroy=tt}$on(e,n){if(!E_(n))return tt;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!sP(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const _P="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_P);const yP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAAmJLR0QA/4ePzL8AAACgSURBVBjTY2D4D4cvGHoY2BlQwH8U2I4pCQKsDHFg3VglGRjEgazvmJLlQNjIcAnIOobbztcM5piSHUBYzxDNwMfAgMtOGKjHJpnJ8IwhhcGFYREDM6ZkCMMqoPHXGC4zBKEa5cPwBKioAAiXMIQz/GZ4yuCFkHzC4MjgxPCNoZaBjeE+kOXEcB0h+RjIdWG4AGU7w9lg4A0UesBgj8oGAP6nSFElh0b7AAAAAElFTkSuQmCC",vP="/15m/assets/logo_dark-ed08d841.svg";const bP=t=>({dialog:t&1}),cx=t=>({dialog:t[0]});function xP(t){let e,n,r,i,a;const c=t[4].default,l=Xr(c,t,t[3],cx);return{c(){e=ke("dialog"),n=ke("article"),l&&l.c(),e.open=!0},m(d,w){Ae(d,e,w),be(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(a=[Ut(window,"click",t[1]),Ut(window,"keydown",t[2]),Ut(e,"close",t[5])],i=!0)},p(d,[w]){l&&l.p&&(!r||w&9)&&Kr(l,c,d,d[3],r?Yr(c,d[3],w,bP):Jr(d[3]),cx)},i(d){r||(_e(l,d),r=!0)},o(d){Se(l,d),r=!1},d(d){d&&Pe(e),l&&l.d(d),t[6](null),i=!1,Ai(a)}}}function wP(t,e,n){let{$$slots:r={},$$scope:i}=e,a;function c(S){a.open&&S.target==a&&a.close()}function l(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function d(S){dn.call(this,t,S)}function w(S){Gn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,c,l,i,r,d,w]}class Pv extends Jt{constructor(e){super(),Kt(this,e,wP,xP,Wt,{})}}function hx(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function fx(t){let e,n,r=t[1]+"",i,a,c,l=t[2]+"",d,w;return{c(){e=ke("tr"),n=ke("td"),i=xt(r),a=rt(),c=ke("td"),d=xt(l),w=rt()},m(S,I){Ae(S,e,I),be(e,n),be(n,i),be(e,a),be(e,c),be(c,d),be(e,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&An(i,r),I&1&&l!==(l=S[2]+"")&&An(d,l)},d(S){S&&Pe(e)}}}function SP(t){let e,n,r=zr(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class Mv extends Jt{constructor(e){super(),Kt(this,e,EP,SP,Wt,{properties:0})}}function px(t,e,n){const r=t.slice();return r[3]=e[n],r}function dx(t,e,n){const r=t.slice();return r[6]=e[n],r}function mx(t){let e,n;return{c(){e=ke("span"),n=xt(`  + `),Ii(e,"background",t[6]),Ii(e,"width","100%"),Ii(e,"border","1px solid black")},m(r,i){Ae(r,e,i),be(e,n)},p(r,i){i&1&&Ii(e,"background",r[6])},d(r){r&&Pe(e)}}}function IP(t){let e,n=t[3]+"",r;return{c(){e=ke("span"),r=xt(n)},m(i,a){Ae(i,e,a),be(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&An(r,n)},d(i){i&&Pe(e)}}}function CP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=ke("span"),r=xt(n)},m(i,a){Ae(i,e,a),be(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&An(r,n)},d(i){i&&Pe(e)}}}function gx(t){let e;function n(a,c){return a[2]>0?CP:IP}let r=n(t),i=r(t);return{c(){i.c(),e=ur()},m(a,c){i.m(a,c),Ae(a,e,c)},p(a,c){r===(r=n(a))&&i?i.p(a,c):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&Pe(e),i.d(a)}}}function TP(t){let e,n,r,i=zr(t[0]),a=[];for(let d=0;d{"colorScale"in c&&n(0,r=c.colorScale),"limits"in c&&n(1,i=c.limits),"decimalPlaces"in c&&n(2,a=c.decimalPlaces)},[r,i,a]}class Av extends Jt{constructor(e){super(),Kt(this,e,LP,TP,Wt,{colorScale:0,limits:1,decimalPlaces:2})}}function cs(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const tf=[];function r0(t,e){return{subscribe:Zn(t,e).subscribe}}function Zn(t,e=tt){let n;const r=new Set;function i(l){if(Wt(t,l)&&(t=l,n)){const d=!tf.length;for(const w of r)w[1](),tf.push(w,t);if(d){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:c}}/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */const wE=Symbol("Comlink.proxy"),PP=Symbol("Comlink.endpoint"),MP=Symbol("Comlink.releaseProxy"),i0=Symbol("Comlink.finalizer"),Lg=Symbol("Comlink.thrown"),SE=t=>typeof t=="object"&&t!==null||typeof t=="function",AP={canHandle:t=>SE(t)&&t[wE],serialize(t){const{port1:e,port2:n}=new MessageChannel;return kv(t,e),[n,[n]]},deserialize(t){return t.start(),CE(t)}},kP={canHandle:t=>SE(t)&&Lg in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},EE=new Map([["proxy",AP],["throw",kP]]);function DP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function kv(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!DP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:c,path:l}=Object.assign({path:[]},i.data),d=(i.data.argumentList||[]).map(Tc);let w;try{const S=l.slice(0,-1).reduce((T,k)=>T[k],t),I=l.reduce((T,k)=>T[k],t);switch(c){case"GET":w=I;break;case"SET":S[l.slice(-1)[0]]=Tc(i.data.value),w=!0;break;case"APPLY":w=I.apply(S,d);break;case"CONSTRUCT":{const T=new I(...d);w=Dv(T)}break;case"ENDPOINT":{const{port1:T,port2:k}=new MessageChannel;kv(t,k),w=FP(T,[T])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[Lg]:0}}Promise.resolve(w).catch(S=>({value:S,[Lg]:0})).then(S=>{const[I,T]=qg(S);e.postMessage(Object.assign(Object.assign({},I),{id:a}),T),c==="RELEASE"&&(e.removeEventListener("message",r),IE(e),i0 in t&&typeof t[i0]=="function"&&t[i0]())}).catch(S=>{const[I,T]=qg({value:new TypeError("Unserializable return value"),[Lg]:0});e.postMessage(Object.assign(Object.assign({},I),{id:a}),T)})}),e.start&&e.start()}function RP(t){return t.constructor.name==="MessagePort"}function IE(t){RP(t)&&t.close()}function CE(t,e){return R0(t,[],e)}function mg(t){if(t)throw new Error("Proxy has been released and is not useable")}function TE(t){return uf(t,{type:"RELEASE"}).then(()=>{IE(t)})}const Gg=new WeakMap,jg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Gg.get(t)||0)-1;Gg.set(t,e),e===0&&TE(t)});function NP(t,e){const n=(Gg.get(e)||0)+1;Gg.set(e,n),jg&&jg.register(t,e,t)}function OP(t){jg&&jg.unregister(t)}function R0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(mg(r),c===MP)return()=>{OP(i),TE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const l=uf(t,{type:"GET",path:e.map(d=>d.toString())}).then(Tc);return l.then.bind(l)}return R0(t,[...e,c])},set(a,c,l){mg(r);const[d,w]=qg(l);return uf(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:d},w).then(Tc)},apply(a,c,l){mg(r);const d=e[e.length-1];if(d===PP)return uf(t,{type:"ENDPOINT"}).then(Tc);if(d==="bind")return R0(t,e.slice(0,-1));const[w,S]=_x(l);return uf(t,{type:"APPLY",path:e.map(I=>I.toString()),argumentList:w},S).then(Tc)},construct(a,c){mg(r);const[l,d]=_x(c);return uf(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:l},d).then(Tc)}});return NP(i,t),i}function zP(t){return Array.prototype.concat.apply([],t)}function _x(t){const e=t.map(qg);return[e.map(n=>n[0]),zP(e.map(n=>n[1]))]}const LE=new WeakMap;function FP(t,e){return LE.set(t,e),t}function Dv(t){return Object.assign(t,{[wE]:!0})}function qg(t){for(const[e,n]of EE)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},LE.get(t)||[]]}function Tc(t){switch(t.type){case"HANDLER":return EE.get(t.name).deserialize(t.value);case"RAW":return t.value}}function uf(t,e,n){return new Promise(r=>{const i=BP();t.addEventListener("message",function a(c){!c.data||!c.data.id||c.data.id!==i||(t.removeEventListener("message",a),r(c.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)})}function BP(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let Mt;const Hl=new Array(128).fill(void 0);Hl.push(void 0,null,!0,!1);function pt(t){return Hl[t]}let xd=Hl.length;function VP(t){t<132||(Hl[t]=xd,xd=t)}function La(t){const e=pt(t);return VP(t),e}let pl=0,dd=null;function wd(){return(dd===null||dd.byteLength===0)&&(dd=new Uint8Array(Mt.memory.buffer)),dd}const Pg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},UP=typeof Pg.encodeInto=="function"?function(t,e){return Pg.encodeInto(t,e)}:function(t,e){const n=Pg.encode(t);return e.set(n),{read:t.length,written:n.length}};function ff(t,e,n){if(n===void 0){const l=Pg.encode(t),d=e(l.length,1)>>>0;return wd().subarray(d,d+l.length).set(l),pl=l.length,d}let r=t.length,i=e(r,1)>>>0;const a=wd();let c=0;for(;c127)break;a[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=wd().subarray(i+c,i+r),d=UP(t,l);c+=d.written,i=n(i,r,c,1)>>>0}return pl=c,i}function Js(t){return t==null}let md=null;function _n(){return(md===null||md.byteLength===0)&&(md=new Int32Array(Mt.memory.buffer)),md}function Ft(t){xd===Hl.length&&Hl.push(Hl.length+1);const e=xd;return xd=Hl[e],Hl[e]=t,e}const PE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&PE.decode();function uo(t,e){return t=t>>>0,PE.decode(wd().subarray(t,t+e))}let gd=null;function ME(){return(gd===null||gd.byteLength===0)&&(gd=new Float64Array(Mt.memory.buffer)),gd}let _d=null;function GP(){return(_d===null||_d.byteLength===0)&&(_d=new BigInt64Array(Mt.memory.buffer)),_d}function N0(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let a="[";i>0&&(a+=N0(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:r}const yx=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{Mt.__wbindgen_export_2.get(t.dtor)(t.a,t.b)});function vx(t,e,n,r){const i={a:t,b:e,cnt:1,dtor:n},a=(...c)=>{i.cnt++;const l=i.a;i.a=0;try{return r(l,i.b,...c)}finally{--i.cnt===0?(Mt.__wbindgen_export_2.get(i.dtor)(l,i.b),yx.unregister(i)):i.a=l}};return a.original=i,yx.register(a,i,i),a}function jP(t,e,n){Mt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha0b106c86a4071f7(t,e,Ft(n))}function qP(t,e,n){Mt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a3a4bb5c4c0b039(t,e,Ft(n))}function WP(t,e){const n=e(t.length*1,1)>>>0;return wd().set(t,n/1),pl=t.length,n}function HP(t,e){return t=t>>>0,ME().subarray(t/8,t/8+e)}function _i(t,e){try{return t.apply(this,e)}catch(n){Mt.__wbindgen_exn_store(Ft(n))}}function ZP(t,e,n,r){Mt.wasm_bindgen__convert__closures__invoke2_mut__h5b77cba7b0f68717(t,e,Ft(n),Ft(r))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Mt.__wbg_intounderlyingbytesource_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Mt.__wbg_intounderlyingsink_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Mt.__wbg_intounderlyingsource_free(t>>>0));const bx=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Mt.__wbg_mapmodel_free(t>>>0));class Md{static __wrap(e){e=e>>>0;const n=Object.create(Md.prototype);return n.__wbg_ptr=e,bx.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,bx.unregister(this),e}free(){const e=this.__destroy_into_raw();Mt.__wbg_mapmodel_free(e)}constructor(e,n,r,i,a){const c=WP(e,Mt.__wbindgen_malloc),l=pl;var d=Js(r)?0:ff(r,Mt.__wbindgen_malloc,Mt.__wbindgen_realloc),w=pl,S=Js(i)?0:ff(i,Mt.__wbindgen_malloc,Mt.__wbindgen_realloc),I=pl;const T=Mt.mapmodel_new(c,l,n,d,w,S,I,Js(a)?0:Ft(a));return La(T)}renderDebug(){let e,n;try{const w=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_renderDebug(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(e,n,1)}}renderAmenities(){let e,n;try{const w=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_renderAmenities(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(e,n,1)}}getBounds(){try{const i=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_getBounds(i,this.__wbg_ptr);var e=_n()[i/4+0],n=_n()[i/4+1],r=HP(e,n).slice();return Mt.__wbindgen_free(e,n*8,8),r}finally{Mt.__wbindgen_add_to_stack_pointer(16)}}renderZones(){let e,n;try{const w=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_renderZones(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(e,n,1)}}isochrone(e){let n,r;try{const S=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_isochrone(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,uo(d,w)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_route(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,uo(d,w)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(n,r,1)}}bufferRoute(e){let n,r;try{const S=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_bufferRoute(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,uo(d,w)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(n,r,1)}}score(e,n){let r,i;try{const I=Mt.__wbindgen_add_to_stack_pointer(-16);Mt.mapmodel_score(I,this.__wbg_ptr,Ft(e),Js(n)?0:Ft(n));var a=_n()[I/4+0],c=_n()[I/4+1],l=_n()[I/4+2],d=_n()[I/4+3],w=a,S=c;if(d)throw w=0,S=0,La(l);return r=w,i=S,uo(w,S)}finally{Mt.__wbindgen_add_to_stack_pointer(16),Mt.__wbindgen_free(r,i,1)}}}async function XP(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function YP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){La(e)},t.wbg.__wbg_mapmodel_new=function(e){const n=Md.__wrap(e);return Ft(n)},t.wbg.__wbindgen_string_get=function(e,n){const r=pt(n),i=typeof r=="string"?r:void 0;var a=Js(i)?0:ff(i,Mt.__wbindgen_malloc,Mt.__wbindgen_realloc),c=pl;_n()[e/4+1]=c,_n()[e/4+0]=a},t.wbg.__wbindgen_is_bigint=function(e){return typeof pt(e)=="bigint"},t.wbg.__wbindgen_bigint_from_u64=function(e){const n=BigInt.asUintN(64,e);return Ft(n)},t.wbg.__wbindgen_jsval_eq=function(e,n){return pt(e)===pt(n)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(uo(e,n));return Ft(r)},t.wbg.__wbindgen_boolean_get=function(e){const n=pt(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_string_new=function(e,n){const r=uo(e,n);return Ft(r)},t.wbg.__wbindgen_is_object=function(e){const n=pt(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return pt(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return pt(e)in pt(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=pt(n),i=typeof r=="number"?r:void 0;ME()[e/8+1]=Js(i)?0:i,_n()[e/4+0]=!Js(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return pt(e)==pt(n)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=pt(e);return Ft(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=pt(e)[pt(n)];return Ft(r)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ft(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=pt(n).stack,i=ff(r,Mt.__wbindgen_malloc,Mt.__wbindgen_realloc),a=pl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(uo(e,n))}finally{Mt.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=pt(e).performance;return Ft(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return pt(e).now()},t.wbg.__wbindgen_cb_drop=function(e){const n=La(e).original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){const n=fetch(pt(e));return Ft(n)},t.wbg.__wbg_done_2ffa852272310e47=function(e){return pt(e).done},t.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return _i(function(e){const n=pt(e).getReader();return Ft(n)},arguments)},t.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){const n=pt(e).value;return Ft(n)},t.wbg.__wbg_fetch_1e4e8ed1f64c7e28=function(e){const n=fetch(pt(e));return Ft(n)},t.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){const n=pt(e).queueMicrotask;return Ft(n)},t.wbg.__wbindgen_is_function=function(e){return typeof pt(e)=="function"},t.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(pt(e))},t.wbg.__wbg_fetch_693453ca3f88c055=function(e,n){const r=pt(e).fetch(pt(n));return Ft(r)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(pt(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(pt(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(pt(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(pt(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(pt(e))},t.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03=function(){return _i(function(e,n,r){const i=new Request(uo(e,n),pt(r));return Ft(i)},arguments)},t.wbg.__wbg_instanceof_Response_4c3b1446206114d1=function(e){let n;try{n=pt(e)instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_83a6a4f65f7a2b38=function(e,n){const r=pt(n).url,i=ff(r,Mt.__wbindgen_malloc,Mt.__wbindgen_realloc),a=pl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_status_d6d47ad2837621eb=function(e){return pt(e).status},t.wbg.__wbg_headers_24def508a7518df9=function(e){const n=pt(e).headers;return Ft(n)},t.wbg.__wbg_body_69be35dff3d68d53=function(e){const n=pt(e).body;return Js(n)?0:Ft(n)},t.wbg.__wbg_arrayBuffer_5b2688e3dd873fed=function(){return _i(function(e){const n=pt(e).arrayBuffer();return Ft(n)},arguments)},t.wbg.__wbg_signal_3c701f5f40a5f08d=function(e){const n=pt(e).signal;return Ft(n)},t.wbg.__wbg_new_0ae46f44b7485bb2=function(){return _i(function(){const e=new AbortController;return Ft(e)},arguments)},t.wbg.__wbg_abort_2c4fb490d878d2b2=function(e){pt(e).abort()},t.wbg.__wbg_byobRequest_05466bb0cacd89fa=function(e){const n=pt(e).byobRequest;return Js(n)?0:Ft(n)},t.wbg.__wbg_close_d29a75e8efc5fa94=function(){return _i(function(e){pt(e).close()},arguments)},t.wbg.__wbg_view_1fe68975176283b3=function(e){const n=pt(e).view;return Js(n)?0:Ft(n)},t.wbg.__wbg_respond_6272b341f88864a2=function(){return _i(function(e,n){pt(e).respond(n>>>0)},arguments)},t.wbg.__wbg_read_79c1f6a58844174c=function(e){const n=pt(e).read();return Ft(n)},t.wbg.__wbg_releaseLock_6eb6fa75435874b8=function(e){pt(e).releaseLock()},t.wbg.__wbg_cancel_ef8b2c6f99da9cde=function(e){const n=pt(e).cancel();return Ft(n)},t.wbg.__wbg_new_7a20246daa6eec7e=function(){return _i(function(){const e=new Headers;return Ft(e)},arguments)},t.wbg.__wbg_append_aa3f462f9e2b5ff2=function(){return _i(function(e,n,r,i,a){pt(e).append(uo(n,r),uo(i,a))},arguments)},t.wbg.__wbg_close_79df9bcee94a607c=function(){return _i(function(e){pt(e).close()},arguments)},t.wbg.__wbg_enqueue_e8019641f9877e27=function(){return _i(function(e,n){pt(e).enqueue(pt(n))},arguments)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,n){const r=pt(e)[n>>>0];return Ft(r)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return pt(e).length},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(uo(e,n));return Ft(r)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const n=pt(e).next;return Ft(n)},t.wbg.__wbg_next_196c84450b364254=function(){return _i(function(e){const n=pt(e).next();return Ft(n)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return pt(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const n=pt(e).value;return Ft(n)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Ft(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return _i(function(e,n){const r=Reflect.get(pt(e),pt(n));return Ft(r)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return _i(function(e,n){const r=pt(e).call(pt(n));return Ft(r)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return Ft(e)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return _i(function(){const e=self.self;return Ft(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return _i(function(){const e=window.window;return Ft(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return _i(function(){const e=globalThis.globalThis;return Ft(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return _i(function(){const e=global.global;return Ft(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(pt(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=pt(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_new_28c511d9baebfa89=function(e,n){const r=new Error(uo(e,n));return Ft(r)},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return _i(function(e,n,r){const i=pt(e).call(pt(n),pt(r));return Ft(i)},arguments)},t.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(pt(e))},t.wbg.__wbg_new_81740750da40724f=function(e,n){try{var r={a:e,b:n},i=(c,l)=>{const d=r.a;r.a=0;try{return ZP(d,r.b,c,l)}finally{r.a=d}};const a=new Promise(i);return Ft(a)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_b0083a7967828ec8=function(e){const n=Promise.resolve(pt(e));return Ft(n)},t.wbg.__wbg_catch_0260e338d10f79ae=function(e,n){const r=pt(e).catch(pt(n));return Ft(r)},t.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,n){const r=pt(e).then(pt(n));return Ft(r)},t.wbg.__wbg_then_a73caa9a87991566=function(e,n,r){const i=pt(e).then(pt(n),pt(r));return Ft(i)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=pt(e).buffer;return Ft(n)},t.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,n,r){const i=new Uint8Array(pt(e),n>>>0,r>>>0);return Ft(i)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(pt(e));return Ft(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){pt(e).set(pt(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return pt(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=pt(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){const n=pt(e).buffer;return Ft(n)},t.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return pt(e).byteLength},t.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return pt(e).byteOffset},t.wbg.__wbg_has_0af94d20077affa2=function(){return _i(function(e,n){return Reflect.has(pt(e),pt(n))},arguments)},t.wbg.__wbg_set_1f9b04f170055d33=function(){return _i(function(e,n,r){return Reflect.set(pt(e),pt(n),pt(r))},arguments)},t.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return _i(function(e){const n=JSON.stringify(pt(e));return Ft(n)},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=pt(n),i=typeof r=="bigint"?r:void 0;GP()[e/8+1]=Js(i)?BigInt(0):i,_n()[e/4+0]=!Js(i)},t.wbg.__wbindgen_debug_string=function(e,n){const r=N0(pt(n)),i=ff(r,Mt.__wbindgen_malloc,Mt.__wbindgen_realloc),a=pl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(uo(e,n))},t.wbg.__wbindgen_memory=function(){const e=Mt.memory;return Ft(e)},t.wbg.__wbindgen_closure_wrapper1726=function(e,n,r){const i=vx(e,n,623,jP);return Ft(i)},t.wbg.__wbindgen_closure_wrapper2715=function(e,n,r){const i=vx(e,n,762,qP);return Ft(i)},t}function KP(t,e){return Mt=t.exports,O0.__wbindgen_wasm_module=e,_d=null,gd=null,md=null,dd=null,Mt}async function O0(t){if(Mt!==void 0)return Mt;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=YP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await XP(await t,e);return KP(n,r)}class JP{constructor(){gi(this,"inner");this.inner=null}async loadOsmFile(e,n,r,i){await O0(),this.inner=await new Md(e,!0,n,r,i)}async loadGraphFile(e){await O0(),this.inner=await new Md(e,!1,void 0,void 0,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}renderAmenities(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderAmenities())}renderZones(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderZones())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime,max_seconds:e.maxSeconds}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}bufferRoute(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.bufferRoute({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,use_heuristic:e.useHeuristic,start_time:e.startTime,max_seconds:e.maxSeconds}))}score(e,n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds,max_seconds:e.maxSeconds},n))}}kv(JP);let AE="MZEJTanw3WpxRvt7qDfo",$s=Zn({kind:"title"}),I_=Zn(null),Wg=Zn(!0),z0=Zn(!1);function xx(t){return["!=",["get",`access_${t}`],"None"]}let bf=Zn("foot"),Hg=Zn("07:00"),Pc=Zn(null),xf=Zn(null),wx=Zn(!0),Sx=Zn(!1),Ex=Zn(15),Ix=Zn(5),eu=Zn(null),gf=Zn(!1);function Zg(t){let e=t.properties.name||`a ${t.properties.amenity_kind}`;return t.properties.brand&&(e+=` (${t.properties.brand})`),t.properties.cuisine&&(e+=` (${t.properties.cuisine})`),e}function Cx(t){let e,n;return e=new Pv({props:{$$slots:{default:[QP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function QP(t){let e,n,r,i,a,c,l,d,w,S;function I(){return t[1](t[3])}return{c(){e=ke("h1"),e.textContent="15-minute neighborhood tool",n=rt(),r=ke("p"),r.textContent="TODO. Extremely early in development.",i=rt(),a=ke("p"),a.innerHTML=`This open source + tool is created by + Dustin Carlino + and relies heavily on + OpenStreetMap data.`,c=rt(),l=ke("center"),d=ke("button"),d.textContent="Start!"},m(T,k){Ae(T,e,k),Ae(T,n,k),Ae(T,r,k),Ae(T,i,k),Ae(T,a,k),Ae(T,c,k),Ae(T,l,k),be(l,d),w||(S=Ut(d,"click",I),w=!0)},p(T,k){t=T},d(T){T&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a),Pe(c),Pe(l)),w=!1,S()}}}function $P(t){let e,n,r=t[0]&&Cx(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=Cx(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function eM(t,e,n){let r;return Lt(t,Wg,c=>n(0,r=c)),[r,c=>cs(c).close(),()=>Xn(Wg,r=!1,r)]}class tM extends Jt{constructor(e){super(),Kt(this,e,eM,$P,Wt,{})}}var Jd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function C_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Tx=Object.prototype.toString,kE=function(e){var n=Tx.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Tx.call(e.callee)==="[object Function]"),r},o0,Lx;function nM(){if(Lx)return o0;Lx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=kE,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(T){var k=T.constructor;return k&&k.prototype===T},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var T in window)try{if(!w["$"+T]&&e.call(window,T)&&window[T]!==null&&typeof window[T]=="object")try{d(window[T])}catch{return!0}}catch{return!0}return!1}(),I=function(T){if(typeof window>"u"||!S)return d(T);try{return d(T)}catch{return!1}};t=function(k){var D=k!==null&&typeof k=="object",U=n.call(k)==="[object Function]",j=r(k),$=D&&n.call(k)==="[object String]",B=[];if(!D&&!U&&!j)throw new TypeError("Object.keys called on a non-object");var q=c&&U;if($&&k.length>0&&!e.call(k,0))for(var J=0;J0)for(var ce=0;ce"u"||!Gi?zn:Gi(Uint8Array),Ac={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":nf&&Gi?Gi([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":cf,"%AsyncGenerator%":cf,"%AsyncGeneratorFunction%":cf,"%AsyncIteratorPrototype%":cf,"%Atomics%":typeof Atomics>"u"?zn:Atomics,"%BigInt%":typeof BigInt>"u"?zn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?zn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?zn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?zn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":EM,"%eval%":eval,"%EvalError%":IM,"%Float32Array%":typeof Float32Array>"u"?zn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?zn:FinalizationRegistry,"%Function%":NE,"%GeneratorFunction%":cf,"%Int8Array%":typeof Int8Array>"u"?zn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?zn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":nf&&Gi?Gi(Gi([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map>"u"?zn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!nf||!Gi?zn:Gi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?zn:Promise,"%Proxy%":typeof Proxy>"u"?zn:Proxy,"%RangeError%":CM,"%ReferenceError%":TM,"%Reflect%":typeof Reflect>"u"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?zn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!nf||!Gi?zn:Gi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":nf&&Gi?Gi(""[Symbol.iterator]()):zn,"%Symbol%":nf?Symbol:zn,"%SyntaxError%":wf,"%ThrowTypeError%":PM,"%TypedArray%":AM,"%TypeError%":_f,"%Uint8Array%":typeof Uint8Array>"u"?zn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?zn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?zn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?zn:Uint32Array,"%URIError%":LM,"%WeakMap%":typeof WeakMap>"u"?zn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?zn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?zn:WeakSet};if(Gi)try{null.error}catch(t){var kM=Gi(Gi(t));Ac["%Error.prototype%"]=kM}var DM=function t(e){var n;if(e==="%AsyncFunction%")n=a0("async function () {}");else if(e==="%GeneratorFunction%")n=a0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=a0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Gi&&(n=Gi(i.prototype))}return Ac[e]=n,n},Dx={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qd=zv,Xg=RE,RM=Qd.call(Function.call,Array.prototype.concat),NM=Qd.call(Function.apply,Array.prototype.splice),Rx=Qd.call(Function.call,String.prototype.replace),Yg=Qd.call(Function.call,String.prototype.slice),OM=Qd.call(Function.call,RegExp.prototype.exec),zM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,FM=/\\(\\)?/g,BM=function(e){var n=Yg(e,0,1),r=Yg(e,-1);if(n==="%"&&r!=="%")throw new wf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new wf("invalid intrinsic syntax, expected opening `%`");var i=[];return Rx(e,zM,function(a,c,l,d){i[i.length]=l?Rx(d,FM,"$1"):c||a}),i},VM=function(e,n){var r=e,i;if(Xg(Dx,r)&&(i=Dx[r],r="%"+i[0]+"%"),Xg(Ac,r)){var a=Ac[r];if(a===cf&&(a=DM(r)),typeof a>"u"&&!n)throw new _f("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new wf("intrinsic "+e+" does not exist!")},Sl=function(e,n){if(typeof e!="string"||e.length===0)throw new _f("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new _f('"allowMissing" argument must be a boolean');if(OM(/^%?[^%]*%?$/,e)===null)throw new wf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=BM(e),i=r.length>0?r[0]:"",a=VM("%"+i+"%",n),c=a.name,l=a.value,d=!1,w=a.alias;w&&(i=w[0],NM(r,RM([0,1],w)));for(var S=1,I=!0;S=r.length){var U=Mc(l,T);I=!!U,I&&"get"in U&&!("originalValue"in U.get)?l=U.get:l=l[T]}else I=Xg(l,T),l=l[T];I&&!d&&(Ac[c]=l)}}return l},u0,Nx;function Fv(){if(Nx)return u0;Nx=1;var t=Sl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return u0=e,u0}var UM=Sl,Ag=UM("%Object.getOwnPropertyDescriptor%",!0);if(Ag)try{Ag([],"length")}catch{Ag=null}var Bv=Ag,Ox=Fv(),GM=DE,rf=Ju,zx=Bv,Vv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new rf("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new rf("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new rf("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new rf("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new rf("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new rf("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,d=!!zx&&zx(e,n);if(Ox)Ox(e,n,{configurable:c===null&&d?d.configurable:!c,enumerable:i===null&&d?d.enumerable:!i,value:r,writable:a===null&&d?d.writable:!a});else if(l||!i&&!a&&!c)e[n]=r;else throw new GM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},F0=Fv(),OE=function(){return!!F0};OE.hasArrayLengthDefineBug=function(){if(!F0)return null;try{return F0([],"length",{value:1}).length!==1}catch{return!0}};var Uv=OE,jM=Nv,qM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",WM=Object.prototype.toString,HM=Array.prototype.concat,Fx=Vv,ZM=function(t){return typeof t=="function"&&WM.call(t)==="[object Function]"},zE=Uv(),XM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!ZM(r)||!r())return}zE?Fx(t,e,n,!0):Fx(t,e,n)},FE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=jM(e);qM&&(r=HM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||JM(n)!==n)throw new Ux("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Vx){var c=Vx(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(KM?Bx(e,"length",n,!0,!0):Bx(e,"length",n)),e};(function(t){var e=zv,n=Sl,r=QM,i=Ju,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,a),d=Fv(),w=n("%Math.max%");t.exports=function(T){if(typeof T!="function")throw new i("a function is required");var k=l(e,c,arguments);return r(k,1+w(0,T.length-(arguments.length-1)),!0)};var S=function(){return l(e,a,arguments)};d?d(t.exports,"apply",{value:S}):t.exports.apply=S})(BE);var Xf=BE.exports,VE=Sl,UE=Xf,$M=UE(VE("String.prototype.indexOf")),ga=function(e,n){var r=VE(e,!!n);return typeof r=="function"&&$M(e,".prototype.")>-1?UE(r):r},eA=Nv,GE=T_(),jE=ga,Gx=Object,tA=jE("Array.prototype.push"),jx=jE("Object.prototype.propertyIsEnumerable"),nA=GE?Object.getOwnPropertySymbols:null,qE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Gx(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||_A)&&(gA?qx(e,"name",n,!0,!0):qx(e,"name",n)),e},bA=vA,xA=Ju,wA=Object,XE=bA(function(){if(this==null||this!==wA(this))throw new xA("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),SA=XE,EA=Yc.supportsDescriptors,IA=Object.getOwnPropertyDescriptor,YE=function(){if(EA&&/a/mig.flags==="gim"){var e=IA(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return SA},CA=Yc.supportsDescriptors,TA=YE,LA=Object.getOwnPropertyDescriptor,PA=Object.defineProperty,MA=TypeError,Wx=Object.getPrototypeOf,AA=/a/,kA=function(){if(!CA||!Wx)throw new MA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=TA(),n=Wx(AA),r=LA(n,"flags");return(!r||r.get!==e)&&PA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},DA=Yc,RA=Xf,NA=XE,KE=YE,OA=kA,JE=RA(KE());DA(JE,{getPolyfill:KE,implementation:NA,shim:OA});var zA=JE,kg={exports:{}},FA=T_,Kc=function(){return FA()&&!!Symbol.toStringTag},BA=Kc(),VA=ga,B0=VA("Object.prototype.toString"),L_=function(e){return BA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:B0(e)==="[object Arguments]"},QE=function(e){return L_(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&B0(e)!=="[object Array]"&&B0(e.callee)==="[object Function]"},UA=function(){return L_(arguments)}();L_.isLegacyArguments=QE;var $E=UA?L_:QE;const GA={},jA=Object.freeze(Object.defineProperty({__proto__:null,default:GA},Symbol.toStringTag,{value:"Module"})),qA=C_(jA);var Gv=typeof Map=="function"&&Map.prototype,h0=Object.getOwnPropertyDescriptor&&Gv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Kg=Gv&&h0&&typeof h0.get=="function"?h0.get:null,Hx=Gv&&Map.prototype.forEach,jv=typeof Set=="function"&&Set.prototype,f0=Object.getOwnPropertyDescriptor&&jv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Jg=jv&&f0&&typeof f0.get=="function"?f0.get:null,Zx=jv&&Set.prototype.forEach,WA=typeof WeakMap=="function"&&WeakMap.prototype,Ed=WA?WeakMap.prototype.has:null,HA=typeof WeakSet=="function"&&WeakSet.prototype,Id=HA?WeakSet.prototype.has:null,ZA=typeof WeakRef=="function"&&WeakRef.prototype,Xx=ZA?WeakRef.prototype.deref:null,XA=Boolean.prototype.valueOf,YA=Object.prototype.toString,KA=Function.prototype.toString,JA=String.prototype.match,qv=String.prototype.slice,Nu=String.prototype.replace,QA=String.prototype.toUpperCase,Yx=String.prototype.toLowerCase,eI=RegExp.prototype.test,Kx=Array.prototype.concat,hl=Array.prototype.join,$A=Array.prototype.slice,Jx=Math.floor,V0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,p0=Object.getOwnPropertySymbols,U0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Sf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Lo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Sf||"symbol")?Symbol.toStringTag:null,tI=Object.prototype.propertyIsEnumerable,Qx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function $x(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||eI.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Jx(-t):Jx(t);if(r!==t){var i=String(r),a=qv.call(e,i.length+1);return Nu.call(i,n,"$&_")+"."+Nu.call(Nu.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Nu.call(e,n,"$&_")}var G0=qA,ew=G0.custom,tw=rI(ew)?ew:null,ek=function t(e,n,r,i){var a=n||{};if(Du(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Du(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=Du(a,"customInspect")?a.customInspect:!0;if(typeof c!="boolean"&&c!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Du(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Du(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return oI(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var d=String(e);return l?$x(e,d):d}if(typeof e=="bigint"){var w=String(e)+"n";return l?$x(e,w):w}var S=typeof a.depth>"u"?5:a.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof e=="object")return j0(e)?"[Array]":"[Object]";var I=yk(a,r);if(typeof i>"u")i=[];else if(iI(i,e)>=0)return"[Circular]";function T(Ye,xe,Ge){if(xe&&(i=$A.call(i),i.push(xe)),Ge){var Xe={depth:a.depth};return Du(a,"quoteStyle")&&(Xe.quoteStyle=a.quoteStyle),t(Ye,Xe,r+1,i)}return t(Ye,a,r+1,i)}if(typeof e=="function"&&!nw(e)){var k=uk(e),D=gg(e,T);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(D.length>0?" { "+hl.call(D,", ")+" }":"")}if(rI(e)){var U=Sf?Nu.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):U0.call(e);return typeof e=="object"&&!Sf?sd(U):U}if(mk(e)){for(var j="<"+Yx.call(String(e.nodeName)),$=e.attributes||[],B=0;B<$.length;B++)j+=" "+$[B].name+"="+nI(tk($[B].value),"double",a);return j+=">",e.childNodes&&e.childNodes.length&&(j+="..."),j+="",j}if(j0(e)){if(e.length===0)return"[]";var q=gg(e,T);return I&&!_k(q)?"["+q0(q,I)+"]":"[ "+hl.call(q,", ")+" ]"}if(rk(e)){var J=gg(e,T);return!("cause"in Error.prototype)&&"cause"in e&&!tI.call(e,"cause")?"{ ["+String(e)+"] "+hl.call(Kx.call("[cause]: "+T(e.cause),J),", ")+" }":J.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+hl.call(J,", ")+" }"}if(typeof e=="object"&&c){if(tw&&typeof e[tw]=="function"&&G0)return G0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ck(e)){var ce=[];return Hx&&Hx.call(e,function(Ye,xe){ce.push(T(xe,e,!0)+" => "+T(Ye,e))}),rw("Map",Kg.call(e),ce,I)}if(pk(e)){var fe=[];return Zx&&Zx.call(e,function(Ye){fe.push(T(Ye,e))}),rw("Set",Jg.call(e),fe,I)}if(hk(e))return d0("WeakMap");if(dk(e))return d0("WeakSet");if(fk(e))return d0("WeakRef");if(ok(e))return sd(T(Number(e)));if(ak(e))return sd(T(V0.call(e)));if(sk(e))return sd(XA.call(e));if(ik(e))return sd(T(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Jd)return"{ [object globalThis] }";if(!nk(e)&&!nw(e)){var de=gg(e,T),ie=Qx?Qx(e)===Object.prototype:e instanceof Object||e.constructor===Object,ee=e instanceof Object?"":"null prototype",Le=!ie&&Lo&&Object(e)===e&&Lo in e?qv.call(Qu(e),8,-1):ee?"Object":"",X=ie||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",le=X+(Le||ee?"["+hl.call(Kx.call([],Le||[],ee||[]),": ")+"] ":"");return de.length===0?le+"{}":I?le+"{"+q0(de,I)+"}":le+"{ "+hl.call(de,", ")+" }"}return String(e)};function nI(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function tk(t){return Nu.call(String(t),/"/g,""")}function j0(t){return Qu(t)==="[object Array]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function nk(t){return Qu(t)==="[object Date]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function nw(t){return Qu(t)==="[object RegExp]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function rk(t){return Qu(t)==="[object Error]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function ik(t){return Qu(t)==="[object String]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function ok(t){return Qu(t)==="[object Number]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function sk(t){return Qu(t)==="[object Boolean]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function rI(t){if(Sf)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!U0)return!1;try{return U0.call(t),!0}catch{}return!1}function ak(t){if(!t||typeof t!="object"||!V0)return!1;try{return V0.call(t),!0}catch{}return!1}var lk=Object.prototype.hasOwnProperty||function(t){return t in this};function Du(t,e){return lk.call(t,e)}function Qu(t){return YA.call(t)}function uk(t){if(t.name)return t.name;var e=JA.call(KA.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function iI(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return oI(qv.call(t,0,e.maxStringLength),e)+r}var i=Nu.call(Nu.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,gk);return nI(i,"single",e)}function gk(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+QA.call(e.toString(16))}function sd(t){return"Object("+t+")"}function d0(t){return t+" { ? }"}function rw(t,e,n,r){var i=r?q0(n,r):hl.call(n,", ");return t+" ("+e+") {"+i+"}"}function _k(t){for(var e=0;e=0)return!1;return!0}function yk(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=hl.call(Array(t.indent+1)," ");else return null;return{base:n,prev:hl.call(Array(e+1),n)}}function q0(t,e){if(t.length===0)return"";var n=` +`+e.prev+e.base;return n+hl.call(t,","+n)+` +`+e.prev}function gg(t,e){var n=j0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=hw(e,n);if(i<55296||i>56319)return n+1;var a=hw(e,n+1);return a<56320||a>57343?n+1:n+2},g0=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},fw=function(e,n){if(Gk(e)||aw(e))return g0(e);if(jk(e)){var r=0;return{next:function(){var a=Zk(e,r),c=Hk(e,r,a);return r=a,{done:a>e.length,value:c}}}}if(n&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!qk&&!Wk)kg.exports=function(e){if(e!=null)return fw(e,!0)};else{var Xk=hI,Yk=pI,pw=Ta("Map.prototype.forEach",!0),dw=Ta("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var mw=Ta("Map.prototype.iterator",!0),gw=Ta("Set.prototype.iterator",!0);var _w=Ta("Map.prototype.@@iterator",!0)||Ta("Map.prototype._es6-shim iterator_",!0),yw=Ta("Set.prototype.@@iterator",!0)||Ta("Set.prototype._es6-shim iterator_",!0),Kk=function(e){if(Xk(e)){if(mw)return lw(mw(e));if(_w)return _w(e);if(pw){var n=[];return pw(e,function(i,a){cw(n,[a,i])}),g0(n)}}if(Yk(e)){if(gw)return lw(gw(e));if(yw)return yw(e);if(dw){var r=[];return dw(e,function(i){cw(r,i)}),g0(r)}}};kg.exports=function(e){return Kk(e)||fw(e)}}}var Jk=kg.exports,vw=function(t){return t!==t},dI=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||vw(e)&&vw(n))},Qk=dI,mI=function(){return typeof Object.is=="function"?Object.is:Qk},$k=mI,e3=Yc,t3=function(){var e=$k();return e3(Object,{is:e},{is:function(){return Object.is!==e}}),e},n3=Yc,r3=Xf,i3=dI,gI=mI,o3=t3,_I=r3(gI(),Object);n3(_I,{getPolyfill:gI,implementation:i3,shim:o3});var s3=_I,a3=Xf,yI=ga,l3=Sl,W0=l3("%ArrayBuffer%",!0),Dg=yI("ArrayBuffer.prototype.byteLength",!0),u3=yI("Object.prototype.toString"),bw=!!W0&&!Dg&&new W0(0).slice,xw=!!bw&&a3(bw),vI=Dg||xw?function(e){if(!e||typeof e!="object")return!1;try{return Dg?Dg(e):xw(e,0),!0}catch{return!1}}:W0?function(e){return u3(e)==="[object ArrayBuffer]"}:function(e){return!1},c3=Date.prototype.getDay,h3=function(e){try{return c3.call(e),!0}catch{return!1}},f3=Object.prototype.toString,p3="[object Date]",d3=Kc(),m3=function(e){return typeof e!="object"||e===null?!1:d3?h3(e):f3.call(e)===p3},H0=ga,bI=Kc(),xI,wI,Z0,X0;if(bI){xI=H0("Object.prototype.hasOwnProperty"),wI=H0("RegExp.prototype.exec"),Z0={};var _0=function(){throw Z0};X0={toString:_0,valueOf:_0},typeof Symbol.toPrimitive=="symbol"&&(X0[Symbol.toPrimitive]=_0)}var g3=H0("Object.prototype.toString"),_3=Object.getOwnPropertyDescriptor,y3="[object RegExp]",v3=bI?function(e){if(!e||typeof e!="object")return!1;var n=_3(e,"lastIndex"),r=n&&xI(n,"value");if(!r)return!1;try{wI(e,X0)}catch(i){return i===Z0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:g3(e)===y3},b3=ga,ww=b3("SharedArrayBuffer.prototype.byteLength",!0),x3=ww?function(e){if(!e||typeof e!="object")return!1;try{return ww(e),!0}catch{return!1}}:function(e){return!1},w3=Number.prototype.toString,S3=function(e){try{return w3.call(e),!0}catch{return!1}},E3=Object.prototype.toString,I3="[object Number]",C3=Kc(),T3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:C3?S3(e):E3.call(e)===I3},SI=ga,L3=SI("Boolean.prototype.toString"),P3=SI("Object.prototype.toString"),M3=function(e){try{return L3(e),!0}catch{return!1}},A3="[object Boolean]",k3=Kc(),D3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:k3&&Symbol.toStringTag in e?M3(e):P3(e)===A3},Y0={exports:{}},R3=Object.prototype.toString,N3=Ov();if(N3){var O3=Symbol.prototype.toString,z3=/^Symbol\(.*\)$/,F3=function(e){return typeof e.valueOf()!="symbol"?!1:z3.test(O3.call(e))};Y0.exports=function(e){if(typeof e=="symbol")return!0;if(R3.call(e)!=="[object Symbol]")return!1;try{return F3(e)}catch{return!1}}}else Y0.exports=function(e){return!1};var B3=Y0.exports,K0={exports:{}},Sw=typeof BigInt<"u"&&BigInt,V3=function(){return typeof Sw=="function"&&typeof BigInt=="function"&&typeof Sw(42)=="bigint"&&typeof BigInt(42)=="bigint"},U3=V3();if(U3){var G3=BigInt.prototype.valueOf,j3=function(e){try{return G3.call(e),!0}catch{}return!1};K0.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:j3(e)}}else K0.exports=function(e){return!1};var q3=K0.exports,W3=uI,H3=T3,Z3=D3,X3=B3,Y3=q3,K3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(W3(e))return"String";if(H3(e))return"Number";if(Z3(e))return"Boolean";if(X3(e))return"Symbol";if(Y3(e))return"BigInt"},e_=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Ew=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,t_;e_||(t_=function(e){return!1});var J0=e_?e_.prototype.has:null,y0=Ew?Ew.prototype.has:null;!t_&&!J0&&(t_=function(e){return!1});var J3=t_||function(e){if(!e||typeof e!="object")return!1;try{if(J0.call(e,J0),y0)try{y0.call(e,y0)}catch{return!0}return e instanceof e_}catch{}return!1},Q0={exports:{}},Q3=Sl,EI=ga,$3=Q3("%WeakSet%",!0),v0=EI("WeakSet.prototype.has",!0);if(v0){var b0=EI("WeakMap.prototype.has",!0);Q0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(v0(e,v0),b0)try{b0(e,b0)}catch{return!0}return e instanceof $3}catch{}return!1}}else Q0.exports=function(e){return!1};var e4=Q0.exports,t4=hI,n4=pI,r4=J3,i4=e4,o4=function(e){if(e&&typeof e=="object"){if(t4(e))return"Map";if(n4(e))return"Set";if(r4(e))return"WeakMap";if(i4(e))return"WeakSet"}return!1},II=Function.prototype.toString,pf=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,$0,Rg;if(typeof pf=="function"&&typeof Object.defineProperty=="function")try{$0=Object.defineProperty({},"length",{get:function(){throw Rg}}),Rg={},pf(function(){throw 42},null,$0)}catch(t){t!==Rg&&(pf=null)}else pf=null;var s4=/^\s*class\b/,ev=function(e){try{var n=II.call(e);return s4.test(n)}catch{return!1}},x0=function(e){try{return ev(e)?!1:(II.call(e),!0)}catch{return!1}},Ng=Object.prototype.toString,a4="[object Object]",l4="[object Function]",u4="[object GeneratorFunction]",c4="[object HTMLAllCollection]",h4="[object HTML document.all class]",f4="[object HTMLCollection]",p4=typeof Symbol=="function"&&!!Symbol.toStringTag,d4=!(0 in[,]),tv=function(){return!1};if(typeof document=="object"){var m4=document.all;Ng.call(m4)===Ng.call(document.all)&&(tv=function(e){if((d4||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Ng.call(e);return(n===c4||n===h4||n===f4||n===a4)&&e("")==null}catch{}return!1})}var g4=pf?function(e){if(tv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{pf(e,null,$0)}catch(n){if(n!==Rg)return!1}return!ev(e)&&x0(e)}:function(e){if(tv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(p4)return x0(e);if(ev(e))return!1;var n=Ng.call(e);return n!==l4&&n!==u4&&!/^\[object HTML/.test(n)?!1:x0(e)},_4=g4,y4=Object.prototype.toString,CI=Object.prototype.hasOwnProperty,v4=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),y4.call(e)==="[object Array]"?v4(e,n,i):typeof e=="string"?b4(e,n,i):x4(e,n,i)},S4=w4,E4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],w0=E4,I4=typeof globalThis>"u"?Jd:globalThis,C4=function(){for(var e=[],n=0;n"u"?Jd:globalThis,nv=T4(),Kv=Yv("String.prototype.slice"),S0=Object.getPrototypeOf,P4=Yv("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:A4(e)}return Og?M4(e):null},D4=ga,Tw=D4("ArrayBuffer.prototype.byteLength",!0),R4=vI,N4=function(e){return R4(e)?Tw?Tw(e):e.byteLength:NaN},LI=pA,El=ga,Lw=zA,O4=Sl,Ef=Jk,z4=aI,Pw=s3,Mw=$E,Aw=lI,kw=vI,Dw=m3,Rw=v3,Nw=x3,Ow=Nv,zw=K3,Fw=o4,Bw=k4,Vw=N4,Uw=El("SharedArrayBuffer.prototype.byteLength",!0),Gw=El("Date.prototype.getTime"),E0=Object.getPrototypeOf,jw=El("Object.prototype.toString"),i_=O4("%Set%",!0),rv=El("Map.prototype.has",!0),o_=El("Map.prototype.get",!0),qw=El("Map.prototype.size",!0),s_=El("Set.prototype.add",!0),PI=El("Set.prototype.delete",!0),a_=El("Set.prototype.has",!0),zg=El("Set.prototype.size",!0);function Ww(t,e,n,r){for(var i=Ef(t),a;(a=i.next())&&!a.done;)if(ka(e,a.value,n,r))return PI(t,a.value),!0;return!1}function MI(t){if(typeof t>"u")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function F4(t,e,n,r,i,a){var c=MI(n);if(c!=null)return c;var l=o_(e,c),d=LI({},i,{strict:!1});return typeof l>"u"&&!rv(e,c)||!ka(r,l,d,a)?!1:!rv(t,c)&&ka(r,l,d,a)}function B4(t,e,n){var r=MI(n);return r??(a_(e,r)&&!a_(t,r))}function Hw(t,e,n,r,i,a){for(var c=Ef(t),l,d;(l=c.next())&&!l.done;)if(d=l.value,ka(n,d,i,a)&&ka(r,o_(e,d),i,a))return PI(t,d),!0;return!1}function ka(t,e,n,r){var i=n||{};if(i.strict?Pw(t,e):t===e)return!0;var a=zw(t),c=zw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Pw(t,e):t==e;var l=r.has(t),d=r.has(e),w;if(l&&d){if(r.get(t)===r.get(e))return!0}else w={};return l||r.set(t,w),d||r.set(e,w),G4(t,e,i,r)}function Zw(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function V4(t,e,n,r){if(zg(t)!==zg(e))return!1;for(var i=Ef(t),a=Ef(e),c,l,d;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")d||(d=new i_),s_(d,c.value);else if(!a_(e,c.value)){if(n.strict||!B4(t,e,c.value))return!1;d||(d=new i_),s_(d,c.value)}if(d){for(;(l=a.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!Ww(d,l.value,n.strict,r))return!1}else if(!n.strict&&!a_(t,l.value)&&!Ww(d,l.value,n.strict,r))return!1;return zg(d)===0}return!0}function U4(t,e,n,r){if(qw(t)!==qw(e))return!1;for(var i=Ef(t),a=Ef(e),c,l,d,w,S,I;(c=i.next())&&!c.done;)if(w=c.value[0],S=c.value[1],w&&typeof w=="object")d||(d=new i_),s_(d,w);else if(I=o_(e,w),typeof I>"u"&&!rv(e,w)||!ka(S,I,n,r)){if(n.strict||!F4(t,e,w,S,n,r))return!1;d||(d=new i_),s_(d,w)}if(d){for(;(l=a.next())&&!l.done;)if(w=l.value[0],I=l.value[1],w&&typeof w=="object"){if(!Hw(d,t,w,I,n,r))return!1}else if(!n.strict&&(!t.has(w)||!ka(o_(t,w),I,n,r))&&!Hw(d,t,w,I,LI({},n,{strict:!1}),r))return!1;return zg(d)===0}return!0}function G4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||jw(t)!==jw(e)||Mw(t)!==Mw(e))return!1;var c=Aw(t),l=Aw(e);if(c!==l)return!1;var d=t instanceof Error,w=e instanceof Error;if(d!==w||(d||w)&&(t.name!==e.name||t.message!==e.message))return!1;var S=Rw(t),I=Rw(e);if(S!==I||(S||I)&&(t.source!==e.source||Lw(t)!==Lw(e)))return!1;var T=Dw(t),k=Dw(e);if(T!==k||(T||k)&&Gw(t)!==Gw(e)||n.strict&&E0&&E0(t)!==E0(e))return!1;var D=Bw(t),U=Bw(e);if(D!==U)return!1;if(D||U){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(fe[i]!=de[i])return!1;for(i=fe.length-1;i>=0;i--)if(a=fe[i],!ka(t[a],e[a],n,r))return!1;var ie=Fw(t),ee=Fw(e);return ie!==ee?!1:ie==="Set"||ee==="Set"?V4(t,e,n,r):ie==="Map"?U4(t,e,n,r):!0}var j4=function(e,n,r){return ka(e,n,r,z4())};const q4=Rv(j4);var W4=Object.defineProperty,rr=(t,e)=>W4(t,"name",{value:e,configurable:!0}),H4=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!yd(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=iv(e),i=iv(n);return r.every(a=>i.some(c=>this.compare(a,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(a=>i.some(c=>this.compareLine(a,c,1,!0)))}return!1}compareGeometryCollection(e,n){return yd(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?q4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return yd(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};rr(H4,"GeojsonEquality");function yd(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}rr(yd,"sameLength");function iv(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}rr(iv,"explode");var Cs=63710088e-1,AI={centimeters:Cs*100,centimetres:Cs*100,degrees:360/(2*Math.PI),feet:Cs*3.28084,inches:Cs*39.37,kilometers:Cs/1e3,kilometres:Cs/1e3,meters:Cs,metres:Cs,miles:Cs/1609.344,millimeters:Cs*1e3,millimetres:Cs*1e3,nauticalmiles:Cs/1852,radians:1,yards:Cs*1.0936},Xw={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function gl(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}rr(gl,"feature");function Z4(t,e,n={}){switch(t){case"Point":return Wl(e).geometry;case"LineString":return Xl(e).geometry;case"Polygon":return Jv(e).geometry;case"MultiPoint":return DI(e).geometry;case"MultiLineString":return kI(e).geometry;case"MultiPolygon":return RI(e).geometry;default:throw new Error(t+" is invalid")}}rr(Z4,"geometry");function Wl(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!l_(t[0])||!l_(t[1]))throw new Error("coordinates must contain numbers");return gl({type:"Point",coordinates:t},e,n)}rr(Wl,"point");function X4(t,e,n={}){return P_(t.map(r=>Wl(r,e)),n)}rr(X4,"points");function Jv(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let a=0;aJv(r,e)),n)}rr(Y4,"polygons");function Xl(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return gl({type:"LineString",coordinates:t},e,n)}rr(Xl,"lineString");function K4(t,e,n={}){return P_(t.map(r=>Xl(r,e)),n)}rr(K4,"lineStrings");function P_(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}rr(P_,"featureCollection");function kI(t,e,n={}){return gl({type:"MultiLineString",coordinates:t},e,n)}rr(kI,"multiLineString");function DI(t,e,n={}){return gl({type:"MultiPoint",coordinates:t},e,n)}rr(DI,"multiPoint");function RI(t,e,n={}){return gl({type:"MultiPolygon",coordinates:t},e,n)}rr(RI,"multiPolygon");function J4(t,e,n={}){return gl({type:"GeometryCollection",geometries:t},e,n)}rr(J4,"geometryCollection");function Q4(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}rr(Q4,"round");function NI(t,e="kilometers"){const n=AI[e];if(!n)throw new Error(e+" units is invalid");return t*n}rr(NI,"radiansToLength");function Qv(t,e="kilometers"){const n=AI[e];if(!n)throw new Error(e+" units is invalid");return t/n}rr(Qv,"lengthToRadians");function $4(t,e){return OI(Qv(t,e))}rr($4,"lengthToDegrees");function eD(t){let e=t%360;return e<0&&(e+=360),e}rr(eD,"bearingToAzimuth");function OI(t){return t%(2*Math.PI)*180/Math.PI}rr(OI,"radiansToDegrees");function tD(t){return t%360*Math.PI/180}rr(tD,"degreesToRadians");function nD(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return NI(Qv(t,e),n)}rr(nD,"convertLength");function rD(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=Xw[e];if(!r)throw new Error("invalid original units");const i=Xw[n];if(!i)throw new Error("invalid final units");return t/r*i}rr(rD,"convertArea");function l_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}rr(l_,"isNumber");function $v(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}rr($v,"isObject");function iD(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!l_(e))throw new Error("bbox must only contain numbers")})}rr(iD,"validateBBox");function oD(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")}rr(oD,"validateId");var sD=Object.defineProperty,mo=(t,e)=>sD(t,"name",{value:e,configurable:!0});function Kf(t,e,n){if(t!==null)for(var r,i,a,c,l,d,w,S=0,I=0,T,k=t.type,D=k==="FeatureCollection",U=k==="Feature",j=D?t.features.length:1,$=0;$d||D>w||U>S){l=I,d=r,w=D,S=U,a=0;return}var j=Xl([l,I],n.properties);if(e(j,r,i,U,a)===!1)return!1;a++,l=I})===!1)return!1}}})}mo(BI,"segmentEach");function pD(t,e,n){var r=n,i=!1;return BI(t,function(a,c,l,d,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,d,w),i=!0}),r}mo(pD,"segmentReduce");function VI(t,e){if(!t)throw new Error("geojson is required");M_(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l_D(t,"name",{value:e,configurable:!0});function t1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Kf(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]1)return 1;for(var h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var D=d(T);let U,j;function $(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function B(){if(j==null&&(j=!1,$())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const _=4*p;o.fillStyle=`rgb(${_},${_+1},${_+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){j=!0;break}}}return j||!1}function q(u,o,h,p){const _=new D(u,o,h,p);return function(b){return _.solve(b)}}const J=q(.25,.1,.25,1);function ce(u,o,h){return Math.min(h,Math.max(o,u))}function fe(u,o,h){const p=h-o,_=((u-o)%p+p)%p+o;return _===o?h:_}function de(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let ie=1;function ee(u,o,h){const p={};for(const _ in u)p[_]=o.call(h||this,u[_],_,u);return p}function Le(u,o,h){const p={};for(const _ in u)o.call(h||this,u[_],_,u)&&(p[_]=u[_]);return p}function X(u){return Array.isArray(u)?u.map(X):typeof u=="object"&&u?ee(u,X):u}const le={};function Ye(u){le[u]||(typeof console<"u"&&console.warn(u),le[u]=!0)}function xe(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function Ge(u){let o=0;for(let h,p,_=0,b=u.length,x=b-1;_"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(u,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),P=new Uint8ClampedArray(p*_*4);if(yield b.copyTo(P,function(A,N,O,G,H){const Y=4*Math.max(-N,0),ne=(Math.max(0,O)-O)*G*4+Y,ue=4*G,ge=Math.max(0,N),Re=Math.max(0,O);return{rect:{x:ge,y:Re,width:Math.min(A.width,N+G)-ge,height:Math.min(A.height,O+H)-Re},layout:[{offset:ne,stride:ue}]}}(u,o,h,p,_)),E)for(let A=0;AXe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,_r=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=mn(u.url);if(p)return p(u,o);if(Xe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Bn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test($r())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:$r(),signal:_.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new ir(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const P=yield E;if(_.signal.aborted)throw Fn();return{data:P,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(u,o);if(Xe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Bn},o)}var h;return function(p,_){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const P in p.headers)E.setRequestHeader(P,p.headers[P]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!_.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let P=E.response;if(p.type==="json")try{P=JSON.parse(E.response)}catch(A){return void x(A)}b({data:P,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const P=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new ir(E.status,E.statusText,p.url,P))}},_.signal.addEventListener("abort",()=>{E.abort(),x(Fn())}),E.send(p.body)})}(u,o)};function cr(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function or(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function re(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Ce{constructor(o,h={}){de(this,h),this.type=o}}class vt extends Ce{constructor(o,h={}){super("error",de({error:o},h))}}class xn{on(o,h){return this._listeners=this._listeners||{},or(o,h,this._listeners),this}off(o,h){return re(o,h,this._listeners),re(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},or(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Ce(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of _)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)re(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(de(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof vt&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,h){return this._eventedParent=o,this._eventedParentData=h,this}}var ze={$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 en=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Dr(u,o){const h={};for(const p in u)p!=="ref"&&(h[p]=u[p]);return en.forEach(p=>{p in o&&(h[p]=o[p])}),h}function fn(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let h=0;h`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Ee=[ei,dt,on,nn,Rr,Vr,$o,K(tn),he,V,W];function Q(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(u.itemType,o.itemType))&&(typeof u.N!="number"||u.N===o.N))return null}else{if(u.kind===o.kind)return null;if(u.kind==="value"){for(const h of Ee)if(!Q(h,o))return null}}return`Expected ${oe(u)} but found ${oe(o)} instead.`}function Ie(u,o){return o.some(h=>h.kind===u.kind)}function ye(u,o){return o.some(h=>h==="null"?u===null:h==="array"?Array.isArray(u):h==="object"?u&&!Array.isArray(u)&&typeof u=="object":h===typeof u)}function De(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const je=.96422,He=.82521,Ke=4/29,At=6/29,Nt=3*At*At,Yt=At*At*At,Qt=Math.PI/180,En=180/Math.PI;function Yn(u){return(u%=360)<0&&(u+=360),u}function hr([u,o,h,p]){let _,b;const x=cn((.2225045*(u=ti(u))+.7168786*(o=ti(o))+.0606169*(h=ti(h)))/1);u===o&&o===h?_=b=x:(_=cn((.4360747*u+.3850649*o+.1430804*h)/je),b=cn((.0139322*u+.0971045*o+.7141733*h)/He));const E=116*x-16;return[E<0?0:E,500*(_-x),200*(x-b),p]}function ti(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function cn(u){return u>Yt?Math.pow(u,1/3):u/Nt+Ke}function Ir([u,o,h,p]){let _=(u+16)/116,b=isNaN(o)?_:_+o/500,x=isNaN(h)?_:_-h/200;return _=1*to(_),b=je*to(b),x=He*to(x),[ai(3.1338561*b-1.6168667*_-.4906146*x),ai(-.9787684*b+1.9161415*_+.033454*x),ai(.0719453*b-.2289914*_+1.4052427*x),p]}function ai(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function to(u){return u>At?u*u*u:Nt*(u-Ke)}function go(u){return parseInt(u.padEnd(2,u),16)/255}function wi(u,o){return Vs(o?u/100:u,0,1)}function Vs(u,o,h){return Math.min(Math.max(o,u),h)}function um(u){return!u.some(Number.isNaN)}const K_={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 jn{constructor(o,h,p,_=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=_,b||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[o,h,p,_]))}static parse(o){if(o instanceof jn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=K_[p];if(_){const[x,E,P]=_;return[x/255,E/255,P/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[go(p.slice(E,E+=x)),go(p.slice(E,E+=x)),go(p.slice(E,E+=x)),go(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,P,A,N,O,G,H,Y,ne,ue,ge,Re]=x,ve=[N||" ",H||" ",ue].join("");if(ve===" "||ve===" /"||ve===",,"||ve===",,,"){const Te=[A,G,ne].join(""),Je=Te==="%%%"?100:Te===""?255:0;if(Je){const Qe=[Vs(+P/Je,0,1),Vs(+O/Je,0,1),Vs(+Y/Je,0,1),ge?wi(+ge,Re):1];if(um(Qe))return Qe}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,P,A,N,O,G,H,Y]=b,ne=[P||" ",N||" ",G].join("");if(ne===" "||ne===" /"||ne===",,"||ne===",,,"){const ue=[+E,Vs(+A,0,100),Vs(+O,0,100),H?wi(+H,Y):1];if(um(ue))return function([ge,Re,ve,Te]){function Je(Qe){const Et=(Qe+ge/30)%12,Pt=Re*Math.min(ve,1-ve);return ve-Pt*Math.max(-1,Math.min(Et-3,9-Et,1))}return ge=Yn(ge),Re/=100,ve/=100,[Je(0),Je(8),Je(4),Te]}(ue)}}}(o);return h?new jn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:_}=this,b=_||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,_])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,_,b]=hr(o),x=Math.sqrt(p*p+_*_);return[Math.round(1e4*x)?Yn(Math.atan2(_,p)*En):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",hr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,_]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${_})`}}jn.black=new jn(0,0,0,1),jn.white=new jn(1,1,1,1),jn.transparent=new jn(0,0,0,0),jn.red=new jn(1,0,0,1);class sp{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ap{constructor(o,h,p,_,b){this.text=o,this.image=h,this.scale=p,this.fontStack=_,this.textColor=b}}class Ro{constructor(o){this.sections=o}static fromString(o){return new Ro([new ap(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Ro?o:Ro.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class _o{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof _o)return o;if(typeof o=="number")return new _o([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new _o(o)}}toString(){return JSON.stringify(this.values)}}const tc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class es{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof es)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&u<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,h,p]:[u,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rh(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof jn||u instanceof sp||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts)return!0;if(Array.isArray(u)){for(const o of u)if(!rh(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!rh(u[o]))return!1;return!0}return!1}function ni(u){if(u===null)return ei;if(typeof u=="string")return on;if(typeof u=="boolean")return nn;if(typeof u=="number")return dt;if(u instanceof jn)return Rr;if(u instanceof sp)return ba;if(u instanceof Ro)return Vr;if(u instanceof _o)return he;if(u instanceof es)return W;if(u instanceof ts)return V;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const _=ni(p);if(h){if(h===_)continue;h=tn;break}h=_}return K(h||tn,o)}return $o}function nc(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof jn||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts?u.toString():JSON.stringify(u)}class Xa{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!rh(o[1]))return h.error("invalid value");const p=o[1];let _=ni(p);const b=h.expectedType;return _.kind!=="array"||_.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(_=b),new Xa(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class yr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const ih={string:on,number:dt,boolean:nn,object:$o};class No{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,_=1;const b=o[0];if(b==="array"){let E,P;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in ih)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);E=ih[A],_++}else E=tn;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);P=o[2],_++}p=K(E,P)}else{if(!ih[b])throw new Error(`Types doesn't contain name = ${b}`);p=ih[b]}const x=[];for(;_o.outputDefined())}}const oh={"to-boolean":nn,"to-color":Rr,"to-number":dt,"to-string":on};class Us{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!oh[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const _=oh[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:hu(h[0],h[1],h[2],h[3]),!p))return new jn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new yr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const _=_o.parse(h);if(_)return _}throw new yr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const _=es.parse(h);if(_)return _}throw new yr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new yr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ro.fromString(nc(this.args[0].evaluate(o)));case"resolvedImage":return ts.fromString(nc(this.args[0].evaluate(o)));default:return nc(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const rc=["Unknown","Point","LineString","Polygon"];class qn{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"?rc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=jn.parse(o)),h}}class sh{constructor(o,h,p=[],_,b=new Ll,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=_,this._isConstant=h}parse(o,h,p,_,b={}){return h?this.concat(h,p,_)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(_,b,x){return x==="assert"?new No(b,[_]):x==="coerce"?new Us(b,[_]):_}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const _=o[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[_];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,P=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||P.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(E.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(E,P))return null}else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"assert")}if(!(x instanceof Xa)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new qn;try{x=new Xa(x.type,x.evaluate(E))}catch(P){return this.error(P.message),null}}return x}return this.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,h,p){const _=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new sh(this.registry,this._isConstant,_,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new eo(p,o))}checkSubtype(o,h){const p=Q(o,h);return p&&this.error(p),p}}class fu{constructor(o,h,p){this.type=ba,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,nn);if(!_)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,nn);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,on),!x)?null:new fu(_,b,x)}evaluate(o){return new sp(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Ya=8192;function ah(u,o){u[0]=Math.min(u[0],o[0]),u[1]=Math.min(u[1],o[1]),u[2]=Math.max(u[2],o[0]),u[3]=Math.max(u[3],o[1])}function ic(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function J_(u,o){const h=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,_=Math.pow(2,o.z);return[Math.round(h*_*Ya),Math.round(p*_*Ya)]}function cm(u,o,h){const p=u[0]-o[0],_=u[1]-o[1],b=u[0]-h[0],x=u[1]-h[1];return p*x-b*_==0&&p*b<=0&&_*x<=0}function lh(u,o){let h=!1;for(let x=0,E=o.length;x(p=u)[1]!=(b=P[A+1])[1]>p[1]&&p[0]<(b[0]-_[0])*(p[1]-_[1])/(b[1]-_[1])+_[0]&&(h=!h)}}var p,_,b;return h}function Q_(u,o){for(let h=0;h0&&E<0||x<0&&E>0}function $_(u,o,h){for(const A of h)for(let N=0;Nh[2]){const _=.5*p;let b=u[0]-h[0]>_?-p:h[0]-u[0]>_?p:0;b===0&&(b=u[0]-h[2]>_?-p:h[2]-u[0]>_?p:0),u[0]+=b}ah(o,u)}function ch(u,o,h,p){const _=Math.pow(2,p.z)*Ya,b=[p.x*Ya,p.y*Ya],x=[];for(const E of u)for(const P of E){const A=[P.x+b[0],P.y+b[1]];mm(A,o,h,_),x.push(A)}return x}function gm(u,o,h,p){const _=Math.pow(2,p.z)*Ya,b=[p.x*Ya,p.y*Ya],x=[];for(const P of u){const A=[];for(const N of P){const O=[N.x+b[0],N.y+b[1]];ah(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=_/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const P of x)for(const A of P)mm(A,o,h,_)}var E;return x}class Pl{constructor(o,h){this.type=nn,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(rh(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const _=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&_.push(E),x==="MultiPolygon"&&_.push(...E)}if(_.length)return new Pl(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Pl(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Pl(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const E=uh(p.coordinates,b,x),P=ch(h.geometry(),_,b,x);if(!ic(_,b))return!1;for(const A of P)if(!lh(A,E))return!1}if(p.type==="MultiPolygon"){const E=dm(p.coordinates,b,x),P=ch(h.geometry(),_,b,x);if(!ic(_,b))return!1;for(const A of P)if(!Q_(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const E=uh(p.coordinates,b,x),P=gm(h.geometry(),_,b,x);if(!ic(_,b))return!1;for(const A of P)if(!fm(A,E))return!1}if(p.type==="MultiPolygon"){const E=dm(p.coordinates,b,x),P=gm(h.geometry(),_,b,x);if(!ic(_,b))return!1;for(const A of P)if(!pm(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class hh{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new hh(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Oo{constructor(o,h,p,_){this.name=o,this.type=h,this._evaluate=p,this.args=_}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],_=Oo.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(_)?_[0]:_.type,x=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let P=null;for(const[A,N]of E){P=new sh(h.registry,oc,h.path,null,h.scope);const O=[];let G=!1;for(let H=1;H{return G=O,Array.isArray(G)?`(${G.map(oe).join(", ")})`:`(${oe(G.type)}...)`;var G}).join(" | "),N=[];for(let O=1;O{h=o?h&&oc(p):h&&p instanceof Xa}),!!h&&fh(u)&&ac(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function fh(u){if(u instanceof Oo&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof Pl)return!1;let o=!0;return u.eachChild(h=>{o&&!fh(h)&&(o=!1)}),o}function sc(u){if(u instanceof Oo&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!sc(h)&&(o=!1)}),o}function ac(u,o){if(u instanceof Oo&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!ac(p,o)&&(h=!1)}),h}function lc(u,o){const h=u.length-1;let p,_,b=0,x=h,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=u[E],_=u[E+1],p<=o){if(E===h||o<_)return E;b=E+1}else{if(!(p>o))throw new yr("Input is not a number.");x=E-1}return 0}class uc{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,b]of p)this.labels.push(_),this.outputs.push(b)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,dt);if(!p)return null;const _=[];let b=null;h.expectedType&&h.expectedType.kind!=="value"&&(b=h.expectedType);for(let x=1;x=E)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=h.parse(P,N,b);if(!O)return null;b=b||O.type,_.push([E,O])}return new uc(b,p,_)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;return _>=h[b-1]?p[b-1].evaluate(o):p[lc(h,_)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function ey(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var ty=_m;function _m(u,o,h,p){this.cx=3*u,this.bx=3*(h-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=o,this.p2x=h,this.p2y=p}_m.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,o){if(o===void 0&&(o=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var ny=ey(ty);function Ml(u,o,h){return u+h*(o-u)}function ph(u,o,h){return u.map((p,_)=>Ml(p,o[_],h))}const no={number:Ml,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[_,b,x,E]=ph(u.rgb,o.rgb,h);return new jn(_,b,x,E,!1)}case"hcl":{const[_,b,x,E]=u.hcl,[P,A,N,O]=o.hcl;let G,H;if(isNaN(_)||isNaN(P))isNaN(_)?isNaN(P)?G=NaN:(G=P,x!==1&&x!==0||(H=A)):(G=_,N!==1&&N!==0||(H=b));else{let Re=P-_;P>_&&Re>180?Re-=360:P<_&&_-P>180&&(Re+=360),G=_+h*Re}const[Y,ne,ue,ge]=function([Re,ve,Te,Je]){return Re=isNaN(Re)?0:Re*Qt,Ir([Te,Math.cos(Re)*ve,Math.sin(Re)*ve,Je])}([G,H??Ml(b,A,h),Ml(x,N,h),Ml(E,O,h)]);return new jn(Y,ne,ue,ge,!1)}case"lab":{const[_,b,x,E]=Ir(ph(u.lab,o.lab,h));return new jn(_,b,x,E,!1)}}},array:ph,padding:function(u,o,h){return new _o(ph(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,_=o.values;if(p.length!==_.length)throw new yr(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof N!="number"||N<0||N>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(b=h.parse(b,2,dt),!b)return null;const E=[];let P=null;p==="interpolate-hcl"||p==="interpolate-lab"?P=Rr:h.expectedType&&h.expectedType.kind!=="value"&&(P=h.expectedType);for(let A=0;A=N)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',G);const Y=h.parse(O,H,P);if(!Y)return null;P=P||Y.type,E.push([N,Y])}return De(P,dt)||De(P,Rr)||De(P,he)||De(P,W)||De(P,K(dt))?new Fi(P,p,_,b,E):h.error(`Type ${oe(P)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;if(_>=h[b-1])return p[b-1].evaluate(o);const x=lc(h,_),E=Fi.interpolationFactor(this.interpolation,_,h[x],h[x+1]),P=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return no[this.type.kind](P,A,E);case"interpolate-hcl":return no.color(P,A,E,"hcl");case"interpolate-lab":return no.color(P,A,E,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function On(u,o,h,p){const _=p-h,b=u-h;return _===0?0:o===1?b/_:(Math.pow(o,b)-1)/(Math.pow(o,_)-1)}class dh{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const _=h.expectedType;_&&_.kind!=="value"&&(p=_);const b=[];for(const E of o.slice(1)){const P=h.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!P)return null;p=p||P.type,b.push(P)}if(!p)throw new Error("No output type");const x=_&&b.some(E=>Q(_,E.type));return new dh(x?tn:p,b)}evaluate(o){let h,p=null,_=0;for(const b of this.args)if(_++,p=b.evaluate(o),p&&p instanceof ts&&!p.available&&(h||(h=p.name),p=null,_===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class mh{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new yr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new yr(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class up{constructor(o,h){this.type=nn,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,tn),_=h.parse(o[2],2,tn);return p&&_?Ie(p.type,[nn,on,dt,ei,tn])?new up(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${oe(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!ye(h,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${oe(ni(h))} instead.`);if(!ye(p,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${oe(ni(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class gh{constructor(o,h,p){this.type=dt,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,tn),_=h.parse(o[2],2,tn);if(!p||!_)return null;if(!Ie(p.type,[nn,on,dt,ei,tn]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${oe(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,dt);return b?new gh(p,_,b):null}return new gh(p,_)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!ye(h,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${oe(ni(h))} instead.`);if(!ye(p,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${oe(ni(p))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(o);return p.indexOf(h,_)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class cp{constructor(o,h,p,_,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=_,this.outputs=b,this.otherwise=x}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,ni(Y)))return null}else p=ni(Y);if(b[String(Y)]!==void 0)return G.error("Branch labels must be unique.");b[String(Y)]=x.length}const H=h.parse(O,A,_);if(!H)return null;_=_||H.type,x.push(H)}const E=h.parse(o[1],1,tn);if(!E)return null;const P=h.parse(o[o.length-1],o.length-1,_);return P?E.type.kind!=="value"&&h.concat(1).checkSubtype(p,E.type)?null:new cp(p,_,E,b,x,P):null}evaluate(o){const h=this.input.evaluate(o);return(ni(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class hp{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const _=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class _h{constructor(o,h,p,_){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=_}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,tn),_=h.parse(o[2],2,dt);if(!p||!_)return null;if(!Ie(p.type,[K(tn),on,tn]))return h.error(`Expected first argument to be of type array or string, but found ${oe(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,dt);return b?new _h(p.type,p,_,b):null}return new _h(p.type,p,_)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!ye(h,["string","array"]))throw new yr(`Expected first argument to be of type array or string, but found ${oe(ni(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(o);return h.slice(p,_)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function ym(u,o){return u==="=="||u==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function vm(u,o,h,p){return p.compare(o,h)===0}function pu(u,o,h){const p=u!=="=="&&u!=="!=";return class GI{constructor(b,x,E){this.type=nn,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let P=x.parse(b[1],1,tn);if(!P)return null;if(!ym(E,P.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${oe(P.type)}'.`);let A=x.parse(b[2],2,tn);if(!A)return null;if(!ym(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${oe(A.type)}'.`);if(P.type.kind!==A.type.kind&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${oe(P.type)}' and '${oe(A.type)}'.`);p&&(P.type.kind==="value"&&A.type.kind!=="value"?P=new No(A.type,[P]):P.type.kind!=="value"&&A.type.kind==="value"&&(A=new No(P.type,[A])));let N=null;if(b.length===4){if(P.type.kind!=="string"&&A.type.kind!=="string"&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,ba),!N)return null}return new GI(P,A,N)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const P=ni(x),A=ni(E);if(P.kind!==A.kind||P.kind!=="string"&&P.kind!=="number")throw new yr(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${P.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const P=ni(x),A=ni(E);if(P.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?h(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const ry=pu("==",function(u,o,h){return o===h},vm),iy=pu("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!vm(0,o,h,p)}),oy=pu("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),ay=pu("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),ly=pu(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class fp{constructor(o,h,p,_,b){this.type=on,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,dt);if(!p)return null;const _=o[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let b=null;if(_.locale&&(b=h.parse(_.locale,1,on),!b))return null;let x=null;if(_.currency&&(x=h.parse(_.currency,1,on),!x))return null;let E=null;if(_["min-fraction-digits"]&&(E=h.parse(_["min-fraction-digits"],1,dt),!E))return null;let P=null;return _["max-fraction-digits"]&&(P=h.parse(_["max-fraction-digits"],1,dt),!P)?null:new fp(p,b,x,E,P)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class yh{constructor(o){this.type=Vr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const _=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let P=null;if(E["font-scale"]&&(P=h.parse(E["font-scale"],1,dt),!P))return null;let A=null;if(E["text-font"]&&(A=h.parse(E["text-font"],1,K(on)),!A))return null;let N=null;if(E["text-color"]&&(N=h.parse(E["text-color"],1,Rr),!N))return null;const O=_[_.length-1];O.scale=P,O.font=A,O.textColor=N}else{const P=h.parse(o[x],1,tn);if(!P)return null;const A=P.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,_.push({content:P,scale:null,font:null,textColor:null})}}return new yh(_)}evaluate(o){return new Ro(this.sections.map(h=>{const p=h.content.evaluate(o);return ni(p)===V?new ap("",p,null,null,null):new ap(nc(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class pp{constructor(o){this.type=V,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,on);return p?new pp(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=ts.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class dp{constructor(o){this.type=dt,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${oe(p.type)} instead.`):new dp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new yr(`Expected value to be of type string or array, but found ${oe(ni(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const du={"==":ry,"!=":iy,">":sy,"<":oy,">=":ly,"<=":ay,array:No,at:lp,boolean:No,case:hp,coalesce:dh,collator:fu,format:yh,image:pp,in:up,"index-of":gh,interpolate:Fi,"interpolate-hcl":Fi,"interpolate-lab":Fi,length:dp,let:mh,literal:Xa,match:cp,number:No,"number-format":fp,object:No,slice:_h,step:uc,string:No,"to-boolean":Us,"to-color":Us,"to-number":Us,"to-string":Us,var:hh,within:Pl};function bm(u,[o,h,p,_]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const b=_?_.evaluate(u):1,x=hu(o,h,p,b);if(x)throw new yr(x);return new jn(o/255,h/255,p/255,b,!1)}function xm(u,o){return u in o}function mp(u,o){const h=o[u];return h===void 0?null:h}function Al(u){return{type:u}}function wm(u){return{result:"success",value:u}}function mu(u){return{result:"error",value:u}}function gu(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function Sm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function gp(u){return!!u.expression&&u.expression.interpolated}function Mn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function vh(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function uy(u){return u}function Em(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",_=p||!(p||u.property!==void 0),b=u.type||(gp(o)?"exponential":"interval");if(h||o.type==="padding"){const N=h?jn.parse:_o.parse;(u=Qo({},u)).stops&&(u.stops=u.stops.map(O=>[O[0],N(O[1])])),u.default=N(u.default?u.default:o.default)}if(u.colorSpace&&(x=u.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var x;let E,P,A;if(b==="exponential")E=In;else if(b==="interval")E=cy;else if(b==="categorical"){E=Ur,P=Object.create(null);for(const N of u.stops)P[N[0]]=N[1];A=typeof u.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=_p}if(p){const N={},O=[];for(let Y=0;YY[0]),evaluate:({zoom:Y},ne)=>In({stops:G,base:u.base},o,Y).evaluate(Y,ne)}}if(_){const N=b==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:Fi.interpolationFactor.bind(void 0,N),zoomStops:u.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(u,o,O,P,A)}}return{kind:"source",evaluate(N,O){const G=O&&O.properties?O.properties[u.property]:void 0;return G===void 0?cc(u.default,o.default):E(u,o,G,P,A)}}}function cc(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function Ur(u,o,h,p,_){return cc(typeof h===_?p[h]:void 0,u.default,o.default)}function cy(u,o,h){if(Mn(h)!=="number")return cc(u.default,o.default);const p=u.stops.length;if(p===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[p-1][0])return u.stops[p-1][1];const _=lc(u.stops.map(b=>b[0]),h);return u.stops[_][1]}function In(u,o,h){const p=u.base!==void 0?u.base:1;if(Mn(h)!=="number")return cc(u.default,o.default);const _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];const b=lc(u.stops.map(N=>N[0]),h),x=function(N,O,G,H){const Y=H-G,ne=N-G;return Y===0?0:O===1?ne/Y:(Math.pow(O,ne)-1)/(Math.pow(O,Y)-1)}(h,p,u.stops[b][0],u.stops[b+1][0]),E=u.stops[b][1],P=u.stops[b+1][1],A=no[o.type]||uy;return typeof E.evaluate=="function"?{evaluate(...N){const O=E.evaluate.apply(void 0,N),G=P.evaluate.apply(void 0,N);if(O!==void 0&&G!==void 0)return A(O,G,x,u.colorSpace)}}:A(E,P,x,u.colorSpace)}function _p(u,o,h){switch(o.type){case"color":h=jn.parse(h);break;case"formatted":h=Ro.fromString(h.toString());break;case"resolvedImage":h=ts.fromString(h.toString());break;case"padding":h=_o.parse(h);break;default:Mn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return cc(h,u.default,o.default)}Oo.register(du,{error:[{kind:"error"},[on],(u,[o])=>{throw new yr(o.evaluate(u))}],typeof:[on,[tn],(u,[o])=>oe(ni(o.evaluate(u)))],"to-rgba":[K(dt,4),[Rr],(u,[o])=>{const[h,p,_,b]=o.evaluate(u).rgb;return[255*h,255*p,255*_,b]}],rgb:[Rr,[dt,dt,dt],bm],rgba:[Rr,[dt,dt,dt,dt],bm],has:{type:nn,overloads:[[[on],(u,[o])=>xm(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>xm(o.evaluate(u),h.evaluate(u))]]},get:{type:tn,overloads:[[[on],(u,[o])=>mp(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>mp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[tn,[on],(u,[o])=>mp(o.evaluate(u),u.featureState||{})],properties:[$o,[],u=>u.properties()],"geometry-type":[on,[],u=>u.geometryType()],id:[tn,[],u=>u.id()],zoom:[dt,[],u=>u.globals.zoom],"heatmap-density":[dt,[],u=>u.globals.heatmapDensity||0],"line-progress":[dt,[],u=>u.globals.lineProgress||0],accumulated:[tn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[dt,Al(dt),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[dt,Al(dt),(u,o)=>{let h=1;for(const p of o)h*=p.evaluate(u);return h}],"-":{type:dt,overloads:[[[dt,dt],(u,[o,h])=>o.evaluate(u)-h.evaluate(u)],[[dt],(u,[o])=>-o.evaluate(u)]]},"/":[dt,[dt,dt],(u,[o,h])=>o.evaluate(u)/h.evaluate(u)],"%":[dt,[dt,dt],(u,[o,h])=>o.evaluate(u)%h.evaluate(u)],ln2:[dt,[],()=>Math.LN2],pi:[dt,[],()=>Math.PI],e:[dt,[],()=>Math.E],"^":[dt,[dt,dt],(u,[o,h])=>Math.pow(o.evaluate(u),h.evaluate(u))],sqrt:[dt,[dt],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[dt,[dt],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[dt,[dt],(u,[o])=>Math.log(o.evaluate(u))],log2:[dt,[dt],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[dt,[dt],(u,[o])=>Math.sin(o.evaluate(u))],cos:[dt,[dt],(u,[o])=>Math.cos(o.evaluate(u))],tan:[dt,[dt],(u,[o])=>Math.tan(o.evaluate(u))],asin:[dt,[dt],(u,[o])=>Math.asin(o.evaluate(u))],acos:[dt,[dt],(u,[o])=>Math.acos(o.evaluate(u))],atan:[dt,[dt],(u,[o])=>Math.atan(o.evaluate(u))],min:[dt,Al(dt),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[dt,Al(dt),(u,o)=>Math.max(...o.map(h=>h.evaluate(u)))],abs:[dt,[dt],(u,[o])=>Math.abs(o.evaluate(u))],round:[dt,[dt],(u,[o])=>{const h=o.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[dt,[dt],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[dt,[dt],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[nn,[on,tn],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[nn,[tn],(u,[o])=>u.id()===o.value],"filter-type-==":[nn,[on],(u,[o])=>u.geometryType()===o.value],"filter-<":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[nn,[tn],(u,[o])=>o.value in u.properties()],"filter-has-id":[nn,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[nn,[K(on)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[nn,[K(tn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[nn,[on,K(tn)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[nn,[on,K(tn)],(u,[o,h])=>function(p,_,b,x){for(;b<=x;){const E=b+x>>1;if(_[E]===p)return!0;_[E]>p?x=E-1:b=E+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Al(nn),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Al(nn),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[nn,[nn],(u,[o])=>!o.evaluate(u)],"is-supported-script":[nn,[on],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[on,[on],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[on,[on],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[on,Al(tn),(u,o)=>o.map(h=>nc(h.evaluate(u))).join("")],"resolved-locale":[on,[ba],(u,[o])=>o.evaluate(u).resolvedLocale()]});class sr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new qn,this._defaultValue=h?(p=h).type==="color"&&vh(p.default)?new jn(0,0,0,0):p.type==="color"?jn.parse(p.default)||null:p.type==="padding"?_o.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?es.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,_,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new yr(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function er(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in du}function kl(u,o){const h=new sh(du,oc,[],o?function(_){const b={color:Rr,string:on,number:dt,enum:on,boolean:nn,formatted:Vr,padding:he,resolvedImage:V,variableAnchorOffsetCollection:W};return _.type==="array"?K(b[_.value]||tn,_.length):b[_.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?wm(new sr(p,o)):mu(h.errors)}class bh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!sc(h.expression)}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}}class yp{constructor(o,h,p,_){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!sc(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}interpolationFactor(o,h,p){return this.interpolationType?Fi.interpolationFactor(this.interpolationType,o,h,p):0}}function Im(u,o){const h=kl(u,o);if(h.result==="error")return h;const p=h.value.expression,_=fh(p);if(!_&&!gu(o))return mu([new eo("","data expressions not supported")]);const b=ac(p,["zoom"]);if(!b&&!Sm(o))return mu([new eo("","zoom expressions not supported")]);const x=wh(p);return x||b?x instanceof eo?mu([x]):x instanceof Fi&&!gp(o)?mu([new eo("",'"interpolate" expressions cannot be used with this property')]):wm(x?new yp(_?"camera":"composite",h.value,x.labels,x instanceof Fi?x.interpolation:void 0):new bh(_?"constant":"source",h.value)):mu([new eo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class xh{constructor(o,h){this._parameters=o,this._specification=h,Qo(this,Em(this._parameters,this._specification))}static deserialize(o){return new xh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function wh(u){let o=null;if(u instanceof mh)o=wh(u.result);else if(u instanceof dh){for(const h of u.args)if(o=wh(h),o)break}else(u instanceof uc||u instanceof Fi)&&u.input instanceof Oo&&u.input.name==="zoom"&&(o=u);return o instanceof eo||u.eachChild(h=>{const p=wh(h);p instanceof eo?o=p:!o&&p?o=new eo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new eo("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function Sh(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const o of u.slice(1))if(!Sh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Cm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Eh(u){if(u==null)return{filter:()=>!0,needGeometry:!1};Sh(u)||(u=Ch(u));const o=kl(u,Cm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>o.value.evaluate(h,p,{},_),needGeometry:Ih(u)}}function Tm(u,o){return uo?1:0}function Ih(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?vp(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(Ch))):o==="all"?["all"].concat(u.slice(1).map(Ch)):o==="none"?["all"].concat(u.slice(1).map(Ch).map(Th)):o==="in"?Lm(u[1],u.slice(2)):o==="!in"?Th(Lm(u[1],u.slice(2))):o==="has"?Pm(u[1]):o==="!has"?Th(Pm(u[1])):o!=="within"||u;var h}function vp(u,o,h){switch(u){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,u,o]}}function Lm(u,o){if(o.length===0)return!1;switch(u){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(h=>typeof h!=typeof o[0])?["filter-in-large",u,["literal",o.sort(Tm)]]:["filter-in-small",u,["literal",o]]}}function Pm(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Th(u){return["!",u]}function bp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let _="[";for(const b of u)_+=`${bp(b)},`;return`${_}]`}const h=Object.keys(u).sort();let p="{";for(let _=0;_p.maximum?[new lt(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Am(u){const o=u.valueSpec,h=Cr(u.value.type);let p,_,b,x={};const E=h!=="categorical"&&u.value.property===void 0,P=!E,A=Mn(u.value.stops)==="array"&&Mn(u.value.stops[0])==="array"&&Mn(u.value.stops[0][0])==="object",N=ro({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(H){if(h==="identity")return[new lt(H.key,H.value,'identity function may not have a "stops" property')];let Y=[];const ne=H.value;return Y=Y.concat(xp({key:H.key,value:ne,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:O})),Mn(ne)==="array"&&ne.length===0&&Y.push(new lt(H.key,ne,"array must have at least one stop")),Y},default:function(H){return H.validateSpec({key:H.key,value:H.value,valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec})}}});return h==="identity"&&E&&N.push(new lt(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||N.push(new lt(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!gp(u.valueSpec)&&N.push(new lt(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(P&&!gu(u.valueSpec)?N.push(new lt(u.key,u.value,"property functions not supported")):E&&!Sm(u.valueSpec)&&N.push(new lt(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!A||u.value.property!==void 0||N.push(new lt(u.key,u.value,'"property" property is required')),N;function O(H){let Y=[];const ne=H.value,ue=H.key;if(Mn(ne)!=="array")return[new lt(ue,ne,`array expected, ${Mn(ne)} found`)];if(ne.length!==2)return[new lt(ue,ne,`array length 2 expected, length ${ne.length} found`)];if(A){if(Mn(ne[0])!=="object")return[new lt(ue,ne,`object expected, ${Mn(ne[0])} found`)];if(ne[0].zoom===void 0)return[new lt(ue,ne,"object stop key must have zoom")];if(ne[0].value===void 0)return[new lt(ue,ne,"object stop key must have value")];if(b&&b>Cr(ne[0].zoom))return[new lt(ue,ne[0].zoom,"stop zoom values must appear in ascending order")];Cr(ne[0].zoom)!==b&&(b=Cr(ne[0].zoom),_=void 0,x={}),Y=Y.concat(ro({key:`${ue}[0]`,value:ne[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:Lh,value:G}}))}else Y=Y.concat(G({key:`${ue}[0]`,value:ne[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},ne));return er(Ka(ne[1]))?Y.concat([new lt(`${ue}[1]`,ne[1],"expressions are not allowed in function stops.")]):Y.concat(H.validateSpec({key:`${ue}[1]`,value:ne[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function G(H,Y){const ne=Mn(H.value),ue=Cr(H.value),ge=H.value!==null?H.value:Y;if(p){if(ne!==p)return[new lt(H.key,ge,`${ne} stop domain type must match previous stop domain type ${p}`)]}else p=ne;if(ne!=="number"&&ne!=="string"&&ne!=="boolean")return[new lt(H.key,ge,"stop domain value must be a number, string, or boolean")];if(ne!=="number"&&h!=="categorical"){let Re=`number expected, ${ne} found`;return gu(o)&&h===void 0&&(Re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new lt(H.key,ge,Re)]}return h!=="categorical"||ne!=="number"||isFinite(ue)&&Math.floor(ue)===ue?h!=="categorical"&&ne==="number"&&_!==void 0&&ue<_?[new lt(H.key,ge,"stop domain values must appear in ascending order")]:(_=ue,h==="categorical"&&ue in x?[new lt(H.key,ge,"stop domain values must be unique")]:(x[ue]=!0,[])):[new lt(H.key,ge,`integer expected, found ${ue}`)]}}function Ja(u){const o=(u.expressionContext==="property"?Im:kl)(Ka(u.value),u.valueSpec);if(o.result==="error")return o.value.map(p=>new lt(`${u.key}${p.key}`,u.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new lt(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!sc(h))return[new lt(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!sc(h))return[new lt(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!ac(h,["zoom","feature-state"]))return[new lt(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!fh(h))return[new lt(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qa(u){const o=u.key,h=u.value,p=u.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(Cr(h))===-1&&_.push(new lt(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Cr(h))===-1&&_.push(new lt(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function _u(u){return Sh(Ka(u.value))?Ja(Qo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):wp(u)}function wp(u){const o=u.value,h=u.key;if(Mn(o)!=="array")return[new lt(h,o,`array expected, ${Mn(o)} found`)];const p=u.styleSpec;let _,b=[];if(o.length<1)return[new lt(h,o,"filter array must have at least 1 element")];switch(b=b.concat(Qa({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Cr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Cr(o[1])==="$type"&&b.push(new lt(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new lt(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(_=Mn(o[1]),_!=="string"&&b.push(new lt(`${h}[1]`,o[1],`string expected, ${_} found`)));for(let x=2;x{A in h&&o.push(new lt(p,h[A],`"${A}" is prohibited for ref layers`))}),_.layers.forEach(A=>{Cr(A.id)===E&&(P=A)}),P?P.ref?o.push(new lt(p,h.ref,"ref cannot reference another ref layer")):x=Cr(P.type):o.push(new lt(p,h.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(h.source){const P=_.sources&&_.sources[h.source],A=P&&Cr(P.type);P?A==="vector"&&x==="raster"?o.push(new lt(p,h.source,`layer "${h.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new lt(p,h.source,`layer "${h.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new lt(p,h.source,`layer "${h.id}" requires a vector source`)):A!=="vector"||h["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new lt(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!h.paint||!h.paint["line-gradient"]||A==="geojson"&&P.lineMetrics||o.push(new lt(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new lt(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new lt(p,h.source,`source "${h.source}" not found`))}else o.push(new lt(p,h,'missing required property "source"'));return o=o.concat(ro({key:p,value:h,valueSpec:b.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:h.type,valueSpec:b.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:_u,layout:P=>ro({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Ep(Qo({layerType:x},A))}}),paint:P=>ro({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Sp(Qo({layerType:x},A))}})}})),o}function Dl(u){const o=u.value,h=u.key,p=Mn(o);return p!=="string"?[new lt(h,o,`string expected, ${p} found`)]:[]}const km={promoteId:function({key:u,value:o}){if(Mn(o)==="string")return Dl({key:u,value:o});{const h=[];for(const p in o)h.push(...Dl({key:`${u}.${p}`,value:o[p]}));return h}}};function Dm(u){const o=u.value,h=u.key,p=u.styleSpec,_=u.style,b=u.validateSpec;if(!o.type)return[new lt(h,o,'"type" is required')];const x=Cr(o.type);let E;switch(x){case"vector":case"raster":return E=ro({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:km,validateSpec:b}),E;case"raster-dem":return E=function(P){var A;const N=(A=P.sourceName)!==null&&A!==void 0?A:"",O=P.value,G=P.styleSpec,H=G.source_raster_dem,Y=P.style;let ne=[];const ue=Mn(O);if(O===void 0)return ne;if(ue!=="object")return ne.push(new lt("source_raster_dem",O,`object expected, ${ue} found`)),ne;const ge=Cr(O.encoding)==="custom",Re=["redFactor","greenFactor","blueFactor","baseShift"],ve=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Te in O)!ge&&Re.includes(Te)?ne.push(new lt(Te,O[Te],`In "${N}": "${Te}" is only valid when "encoding" is set to "custom". ${ve} encoding found`)):H[Te]?ne=ne.concat(P.validateSpec({key:Te,value:O[Te],valueSpec:H[Te],validateSpec:P.validateSpec,style:Y,styleSpec:G})):ne.push(new lt(Te,O[Te],`unknown property "${Te}"`));return ne}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=ro({key:h,value:o,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:b,objectElementValidators:km}),o.cluster)for(const P in o.clusterProperties){const[A,N]=o.clusterProperties[P],O=typeof A=="string"?[A,["accumulated"],["get",P]]:A;E.push(...Ja({key:`${h}.${P}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),E.push(...Ja({key:`${h}.${P}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return ro({key:h,value:o,valueSpec:p.source_video,style:_,validateSpec:b,styleSpec:p});case"image":return ro({key:h,value:o,valueSpec:p.source_image,style:_,validateSpec:b,styleSpec:p});case"canvas":return[new lt(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qa({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:b,styleSpec:p})}}function Rm(u){const o=u.value,h=u.styleSpec,p=h.light,_=u.style;let b=[];const x=Mn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new lt("light",o,`object expected, ${x} found`)]),b;for(const E in o){const P=E.match(/^(.*)-transition$/);b=b.concat(P&&p[P[1]]&&p[P[1]].transition?u.validateSpec({key:E,value:o[E],valueSpec:h.transition,validateSpec:u.validateSpec,style:_,styleSpec:h}):p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new lt(E,o[E],`unknown property "${E}"`)])}return b}function Nm(u){const o=u.value,h=u.styleSpec,p=h.sky,_=u.style,b=Mn(o);if(o===void 0)return[];if(b!=="object")return[new lt("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Gs({key:E,value:o[E],valueSpec:p[E],style:_,styleSpec:h}):[new lt(E,o[E],`unknown property "${E}"`)]);return x}function fc(u){const o=u.value,h=u.styleSpec,p=h.terrain,_=u.style;let b=[];const x=Mn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new lt("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new lt(E,o[E],`unknown property "${E}"`)]);return b}function pc(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const _=[],b=[];for(const x in h)h[x].id&&_.includes(h[x].id)&&o.push(new lt(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),_.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new lt(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat(ro({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return Dl({key:p,value:h})}const yo={"*":()=>[],array:xp,boolean:function(u){const o=u.value,h=u.key,p=Mn(o);return p!=="boolean"?[new lt(h,o,`boolean expected, ${p} found`)]:[]},number:Lh,color:function(u){const o=u.key,h=u.value,p=Mn(h);return p!=="string"?[new lt(o,h,`color expected, ${p} found`)]:jn.parse(String(h))?[]:[new lt(o,h,`color expected, "${h}" found`)]},constants:Mm,enum:Qa,filter:_u,function:Am,layer:hc,object:ro,source:Dm,light:Rm,sky:Nm,terrain:fc,string:Dl,formatted:function(u){return Dl(u).length===0?[]:Ja(u)},resolvedImage:function(u){return Dl(u).length===0?[]:Ja(u)},padding:function(u){const o=u.key,h=u.value;if(Mn(h)==="array"){if(h.length<1||h.length>4)return[new lt(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let b=0;b[]}})),u.constants&&(h=h.concat(Mm({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:Gs}))),yu(h)}function js(u){return function(o){return u({...o,validateSpec:Gs})}}function yu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function vs(u){return function(...o){return yu(u.apply(this,o))}}ys.source=vs(js(Dm)),ys.sprite=vs(js(pc)),ys.glyphs=vs(js(Ip)),ys.light=vs(js(Rm)),ys.sky=vs(js(Nm)),ys.terrain=vs(js(fc)),ys.layer=vs(js(hc)),ys.filter=vs(js(_u)),ys.paintProperty=vs(js(Sp)),ys.layoutProperty=vs(js(Ep));const Rl=ys,fy=Rl.light,Cp=Rl.paintProperty,py=Rl.layoutProperty;function vu(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new vt(new Error(p.message))),h=!0;return h}class dc{constructor(o,h,p){const _=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(h=x[1])+2*(p=x[2]);for(let P=0;P=O[Y+0]&&_>=O[Y+1])?(E[H]=!0,x.push(N[H])):E[H]=!1}}}}_forEachCell(o,h,p,_,b,x,E,P){const A=this._convertToCellCoord(o),N=this._convertToCellCoord(h),O=this._convertToCellCoord(p),G=this._convertToCellCoord(_);for(let H=A;H<=O;H++)for(let Y=N;Y<=G;Y++){const ne=this.d*Y+H;if((!P||P(this._convertFromCellCoord(H),this._convertFromCellCoord(Y),this._convertFromCellCoord(H+1),this._convertFromCellCoord(Y+1)))&&b.call(this,o,h,p,_,ne,x,E,P))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,h=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=u[b];_[b]=qs[p].shallow.indexOf(b)>=0?x:bu(x,o)}u instanceof Error&&(_.message=u.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(_.$name=p),_}throw new Error("can't serialize object of type "+typeof u)}function xu(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||u instanceof Error||Mh(u)||$e(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(xu);if(typeof u=="object"){const o=u.$name||"Object";if(!qs[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=qs[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const _ of Object.keys(u)){if(_==="$name")continue;const b=u[_];p[_]=qs[o].shallow.indexOf(_)>=0?b:xu(b)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Om{constructor(){this.first=!0}update(o,h){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519};function wu(u){for(const o of u)if(Ah(o.charCodeAt(0)))return!0;return!1}function zm(u){for(const o of u)if(!Fm(o.charCodeAt(0)))return!1;return!0}function Fm(u){return!(wt.Arabic(u)||wt["Arabic Supplement"](u)||wt["Arabic Extended-A"](u)||wt["Arabic Presentation Forms-A"](u)||wt["Arabic Presentation Forms-B"](u))}function Ah(u){return!(u!==746&&u!==747&&(u<4352||!(wt["Bopomofo Extended"](u)||wt.Bopomofo(u)||wt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||wt["CJK Compatibility Ideographs"](u)||wt["CJK Compatibility"](u)||wt["CJK Radicals Supplement"](u)||wt["CJK Strokes"](u)||!(!wt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||wt["CJK Unified Ideographs Extension A"](u)||wt["CJK Unified Ideographs"](u)||wt["Enclosed CJK Letters and Months"](u)||wt["Hangul Compatibility Jamo"](u)||wt["Hangul Jamo Extended-A"](u)||wt["Hangul Jamo Extended-B"](u)||wt["Hangul Jamo"](u)||wt["Hangul Syllables"](u)||wt.Hiragana(u)||wt["Ideographic Description Characters"](u)||wt.Kanbun(u)||wt["Kangxi Radicals"](u)||wt["Katakana Phonetic Extensions"](u)||wt.Katakana(u)&&u!==12540||!(!wt["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!wt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||wt["Unified Canadian Aboriginal Syllabics"](u)||wt["Unified Canadian Aboriginal Syllabics Extended"](u)||wt["Vertical Forms"](u)||wt["Yijing Hexagram Symbols"](u)||wt["Yi Syllables"](u)||wt["Yi Radicals"](u))))}function Tp(u){return!(Ah(u)||function(o){return!!(wt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||wt["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||wt["Letterlike Symbols"](o)||wt["Number Forms"](o)||wt["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||wt["Control Pictures"](o)&&o!==9251||wt["Optical Character Recognition"](o)||wt["Enclosed Alphanumerics"](o)||wt["Geometric Shapes"](o)||wt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||wt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||wt["CJK Symbols and Punctuation"](o)||wt.Katakana(o)||wt["Private Use Area"](o)||wt["CJK Compatibility Forms"](o)||wt["Small Form Variants"](o)||wt["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function kh(u){return u>=1424&&u<=2303||wt["Arabic Presentation Forms-A"](u)||wt["Arabic Presentation Forms-B"](u)}function Bm(u,o){return!(!o&&kh(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||wt.Khmer(u))}function dy(u){for(const o of u)if(kh(o.charCodeAt(0)))return!0;return!1}const $a=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class fr{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Om,this.transition={})}isSupportedScript(o){return function(h,p){for(const _ of h)if(!Bm(_.charCodeAt(0),p))return!1;return!0}(o,$a.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class mc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,_){if(vh(p))return new xh(p,_);if(er(p)){const b=Im(p,_);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return _.type==="color"&&typeof p=="string"?b=jn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=es.parse(p)):b=_o.parse(p),{kind:"constant",evaluate:()=>b}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class Dh{constructor(o){this.property=o,this.value=new mc(o,void 0)}transitioned(o,h){return new Vm(this.property,this.value,h,de({},o.transition,this.transition),o.now)}untransitioned(){return new Vm(this.property,this.value,null,{},0)}}class Lp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return X(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Dh(this._values[o].property)),this._values[o].value=new mc(this._values[o].property,h===null?void 0:X(h))}getTransition(o){return X(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Dh(this._values[o].property)),this._values[o].transition=X(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const _=this.getTransition(h);_!==void 0&&(o[`${h}-transition`]=_)}return o}transitioned(o,h){const p=new Um(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(o,h._values[_]);return p}untransitioned(){const o=new Um(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Vm{constructor(o,h,p,_,b){this.property=o,this.value=h,this.begin=b+_.delay||0,this.end=this.begin+_.duration||0,o.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const _=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(_>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(_=1)return 1;const A=P*P,N=A*P;return 4*(P<.5?N:3*(P-A)+N-.75)}(E))}}return b}}class Um{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const _=new gc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Gm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return X(this._values[o].value)}setValue(o,h){this._values[o]=new mc(this._values[o].property,h===null?void 0:X(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const _=new gc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}}class bs{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,_){return this.property.evaluate(this.value,this.parameters,o,h,p,_)}}class gc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Rt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const _=no[this.specification.type];return _?_(o,h,p):o}}class Vt{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,_){return new bs(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,_)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new bs(this,{kind:"constant",value:void 0},o.parameters);const _=no[this.specification.type];if(_){const b=_(o.value.value,h.value.value,p);return new bs(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,_,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,_,b,x)}}class Rh extends Vt{possiblyEvaluate(o,h,p,_){if(o.value===void 0)return new bs(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,h);return new bs(this,{kind:"constant",value:E},h)}if(o.expression.kind==="camera"){const b=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new bs(this,{kind:"constant",value:b},h)}return new bs(this,o.expression,h)}evaluate(o,h,p,_,b,x){if(o.kind==="source"){const E=o.evaluate(h,p,_,b,x);return this._calculate(E,E,E,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,_),o.evaluate({zoom:Math.floor(h.zoom)},p,_),o.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):o.value}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class _c{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new fr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new fr(Math.floor(h.zoom),h)),o.expression.evaluate(new fr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Pp{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){return!!o.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class vo{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new mc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new Dh(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}Ct("DataDrivenProperty",Vt),Ct("DataConstantProperty",Rt),Ct("CrossFadedDataDrivenProperty",Rh),Ct("CrossFadedProperty",_c),Ct("ColorRampProperty",Pp);const Mp="-transition";class xs extends xn{constructor(o,h){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),h.layout&&(this._unevaluatedLayout=new Gm(h.layout)),h.paint)){this._transitionablePaint=new Lp(h.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new gc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(py,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(Mp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(Cp,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(Mp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[o],b=_.property.specification["property-type"]==="cross-faded-data-driven",x=_.value.isDataDriven(),E=_.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const P=this._transitionablePaint._values[o].value;return P.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,P)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Le(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,_,b={}){return(!b||b.validate!==!1)&&vu(this,o.call(Rl,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:ze,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof bs&&gu(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const jm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class yc{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Tr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Gr(u,o=1){let h=0,p=0;return{members:u.map(_=>{const b=jm[_.type].BYTES_PER_ELEMENT,x=h=qm(h,Math.max(o,b)),E=_.components||1;return p=Math.max(p,b),h+=b*E,{name:_.name,type:_.type,components:E,offset:x}}),size:qm(h,Math.max(p,o)),alignment:o}}function qm(u,o){return Math.ceil(u/o)*o}class vc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.int16[_+0]=h,this.int16[_+1]=p,o}}vc.prototype.bytesPerElement=4,Ct("StructArrayLayout2i4",vc);class xa extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=_,o}}xa.prototype.bytesPerElement=6,Ct("StructArrayLayout3i6",xa);class Ap extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=_,this.int16[x+3]=b,o}}Ap.prototype.bytesPerElement=8,Ct("StructArrayLayout4i8",Ap);class kp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,o}}kp.prototype.bytesPerElement=12,Ct("StructArrayLayout2i4i12",kp);class Dp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=4*o,A=8*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.uint8[A+4]=_,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}Dp.prototype.bytesPerElement=8,Ct("StructArrayLayout2i4ub8",Dp);class bc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.float32[_+0]=h,this.float32[_+1]=p,o}}bc.prototype.bytesPerElement=8,Ct("StructArrayLayout2f8",bc);class Nh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,_,b,x,E,P,A,N)}emplace(o,h,p,_,b,x,E,P,A,N,O){const G=10*o;return this.uint16[G+0]=h,this.uint16[G+1]=p,this.uint16[G+2]=_,this.uint16[G+3]=b,this.uint16[G+4]=x,this.uint16[G+5]=E,this.uint16[G+6]=P,this.uint16[G+7]=A,this.uint16[G+8]=N,this.uint16[G+9]=O,o}}Nh.prototype.bytesPerElement=20,Ct("StructArrayLayout10ui20",Nh);class Rp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G){const H=this.length;return this.resize(H+1),this.emplace(H,o,h,p,_,b,x,E,P,A,N,O,G)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H){const Y=12*o;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=b,this.uint16[Y+4]=x,this.uint16[Y+5]=E,this.uint16[Y+6]=P,this.uint16[Y+7]=A,this.int16[Y+8]=N,this.int16[Y+9]=O,this.int16[Y+10]=G,this.int16[Y+11]=H,o}}Rp.prototype.bytesPerElement=24,Ct("StructArrayLayout4i4ui4i24",Rp);class Np extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Np.prototype.bytesPerElement=12,Ct("StructArrayLayout3f12",Np);class wa extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}wa.prototype.bytesPerElement=4,Ct("StructArrayLayout1ul4",wa);class Oh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,_,b,x,E,P,A)}emplace(o,h,p,_,b,x,E,P,A,N){const O=10*o,G=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=_,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[G+3]=P,this.uint16[O+8]=A,this.uint16[O+9]=N,o}}Oh.prototype.bytesPerElement=20,Ct("StructArrayLayout6i1ul2ui20",Oh);class xc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,o}}xc.prototype.bytesPerElement=12,Ct("StructArrayLayout2i2i2i12",xc);class zh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_,b)}emplace(o,h,p,_,b,x){const E=4*o,P=8*o;return this.float32[E+0]=h,this.float32[E+1]=p,this.float32[E+2]=_,this.int16[P+6]=b,this.int16[P+7]=x,o}}zh.prototype.bytesPerElement=16,Ct("StructArrayLayout2f1f2i16",zh);class wc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=12*o,E=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[E+1]=_,this.float32[E+2]=b,o}}wc.prototype.bytesPerElement=12,Ct("StructArrayLayout2ub2f12",wc);class Fh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=_,o}}Fh.prototype.bytesPerElement=6,Ct("StructArrayLayout3ui6",Fh);class Su extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne,ue,ge){const Re=this.length;return this.resize(Re+1),this.emplace(Re,o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne,ue,ge)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne,ue,ge,Re){const ve=24*o,Te=12*o,Je=48*o;return this.int16[ve+0]=h,this.int16[ve+1]=p,this.uint16[ve+2]=_,this.uint16[ve+3]=b,this.uint32[Te+2]=x,this.uint32[Te+3]=E,this.uint32[Te+4]=P,this.uint16[ve+10]=A,this.uint16[ve+11]=N,this.uint16[ve+12]=O,this.float32[Te+7]=G,this.float32[Te+8]=H,this.uint8[Je+36]=Y,this.uint8[Je+37]=ne,this.uint8[Je+38]=ue,this.uint32[Te+10]=ge,this.int16[ve+22]=Re,o}}Su.prototype.bytesPerElement=48,Ct("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Su);class Nl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne,ue,ge,Re,ve,Te,Je,Qe,Et,Pt,St,bt,ft,Tt){const _t=this.length;return this.resize(_t+1),this.emplace(_t,o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne,ue,ge,Re,ve,Te,Je,Qe,Et,Pt,St,bt,ft,Tt)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne,ue,ge,Re,ve,Te,Je,Qe,Et,Pt,St,bt,ft,Tt,_t){const at=32*o,Bt=16*o;return this.int16[at+0]=h,this.int16[at+1]=p,this.int16[at+2]=_,this.int16[at+3]=b,this.int16[at+4]=x,this.int16[at+5]=E,this.int16[at+6]=P,this.int16[at+7]=A,this.uint16[at+8]=N,this.uint16[at+9]=O,this.uint16[at+10]=G,this.uint16[at+11]=H,this.uint16[at+12]=Y,this.uint16[at+13]=ne,this.uint16[at+14]=ue,this.uint16[at+15]=ge,this.uint16[at+16]=Re,this.uint16[at+17]=ve,this.uint16[at+18]=Te,this.uint16[at+19]=Je,this.uint16[at+20]=Qe,this.uint16[at+21]=Et,this.uint16[at+22]=Pt,this.uint32[Bt+12]=St,this.float32[Bt+13]=bt,this.float32[Bt+14]=ft,this.uint16[at+30]=Tt,this.uint16[at+31]=_t,o}}Nl.prototype.bytesPerElement=64,Ct("StructArrayLayout8i15ui1ul2f2ui64",Nl);class Bh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Bh.prototype.bytesPerElement=4,Ct("StructArrayLayout1f4",Bh);class Vh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Vh.prototype.bytesPerElement=12,Ct("StructArrayLayout1ui2f12",Vh);class Ol extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=_,o}}Ol.prototype.bytesPerElement=8,Ct("StructArrayLayout1ul2ui8",Ol);class Op extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.uint16[_+0]=h,this.uint16[_+1]=p,o}}Op.prototype.bytesPerElement=4,Ct("StructArrayLayout2ui4",Op);class zp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}zp.prototype.bytesPerElement=2,Ct("StructArrayLayout1ui2",zp);class Uh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,this.float32[x+3]=b,o}}Uh.prototype.bytesPerElement=16,Ct("StructArrayLayout4f16",Uh);class Wm extends yc{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 I(this.anchorPointX,this.anchorPointY)}}Wm.prototype.size=20;class y extends Oh{get(o){return new Wm(this,o)}}Ct("CollisionBoxArray",y);class s extends yc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends Su{get(o){return new s(this,o)}}Ct("PlacedSymbolArray",f);class m extends yc{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}m.prototype.size=64;class g extends Nl{get(o){return new m(this,o)}}Ct("SymbolInstanceArray",g);class v extends Bh{getoffsetX(o){return this.float32[1*o+0]}}Ct("GlyphOffsetArray",v);class C extends xa{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}Ct("SymbolLineVertexArray",C);class L extends yc{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 M extends Vh{get(o){return new L(this,o)}}Ct("TextAnchorOffsetArray",M);class R extends yc{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 Ol{get(o){return new R(this,o)}}Ct("FeatureIndexArray",z);class F extends vc{}class Z extends vc{}class ae extends vc{}class se extends kp{}class pe extends Dp{}class te extends bc{}class we extends Nh{}class Ve extends Rp{}class me extends Np{}class Me extends wa{}class Ue extends xc{}class qe extends wc{}class Ze extends Fh{}class nt extends Op{}const et=Gr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ct}=et;class mt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,_){let b=this.segments[this.segments.length-1];return o>mt.MAX_VERTEX_ARRAY_LENGTH&&Ye(`Max vertices per segment is ${mt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>mt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==_)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(b.sortKey=_),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,_){return new mt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function sn(u,o){return 256*(u=ce(Math.floor(u),0,255))+ce(Math.floor(o),0,255)}mt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ct("SegmentVector",mt);const gt=Gr([{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 jt={exports:{}},an={exports:{}};an.exports=function(u,o){var h,p,_,b,x,E,P,A;for(p=u.length-(h=3&u.length),_=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(P=0,h){case 3:P^=(255&u.charCodeAt(A+2))<<16;case 2:P^=(255&u.charCodeAt(A+1))<<8;case 1:_^=P=(65535&(P=(P=(65535&(P^=255&u.charCodeAt(A)))*x+(((P>>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295}return _^=u.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var Cn=an.exports,Xt={exports:{}};Xt.exports=function(u,o){for(var h,p=u.length,_=o^p,b=0;p>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(b)|(255&u.charCodeAt(++b))<<8|(255&u.charCodeAt(++b))<<16|(255&u.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:_^=(255&u.charCodeAt(b+2))<<16;case 2:_^=(255&u.charCodeAt(b+1))<<8;case 1:_=1540483477*(65535&(_^=255&u.charCodeAt(b)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var hn=Cn,pn=Xt.exports;jt.exports=hn,jt.exports.murmur3=hn,jt.exports.murmur2=pn;var Lr=d(jt.exports);class Wn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,_){this.ids.push(zo(o)),this.positions.push(h,p,_)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zo(o);let p=0,_=this.ids.length-1;for(;p<_;){const x=p+_>>1;this.ids[x]>=h?_=x:p=x+1}const b=[];for(;this.ids[p]===h;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,h){const p=new Float64Array(o.ids),_=new Uint32Array(o.positions);return li(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(o){const h=new Wn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function zo(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Lr(String(u))}function li(u,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(u[b]<_);do x--;while(u[x]>_);if(b>=x)break;vr(u,b,x),vr(o,3*b,3*x),vr(o,3*b+1,3*x+1),vr(o,3*b+2,3*x+2)}x-h`u_${_}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new el(o,h):new Fo(o,h)}}class ri{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,_){const b=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Ws(o,h):new Fo(o,h)}}class br{constructor(o,h,p,_){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(o,h,p,_,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new fr(0),h,{},_,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const _=tl(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=h.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,h,p,_,b){const x=this.expression.evaluate(new fr(this.zoom),h,{},_,[],b),E=this.expression.evaluate(new fr(this.zoom+1),h,{},_,[],b),P=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(P,o,x,E)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:this.zoom},p,_),x=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,_){if(this.type==="color"){const b=tl(p),x=tl(_);for(let E=o;E`#define HAS_UNIFORM_${_}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof br||p instanceof pr)for(let _=0;_!0){this.programConfigurations={};for(const _ of o)this.programConfigurations[_.id]=new ii(_,h,p);this.needsUpload=!1,this._featureMap=new Wn,this._bufferOffset=0}populatePaintArrays(o,h,p,_,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,h,_,b,x);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,_){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,_)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function rs(u,o){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[u]||[u.replace(`${o}-`,"").replace(/-/g,"_")]}function oi(u,o,h){const p={color:{source:bc,composite:Uh},number:{source:Bh,composite:bc}},_=function(b){return{"line-pattern":{source:we,composite:we},"fill-pattern":{source:we,composite:we},"fill-extrusion-pattern":{source:we,composite:we}}[b]}(u);return _&&_[h]||p[o][h]}Ct("ConstantBinder",Hs),Ct("CrossFadedConstantBinder",ri),Ct("SourceExpressionBinder",br),Ct("CrossFadedCompositeBinder",ns),Ct("CompositeExpressionBinder",pr),Ct("ProgramConfiguration",ii,{omit:["_buffers"]}),Ct("ProgramConfigurationSet",xr);const Nr=8192,Fp=Math.pow(2,14)-1,Hm=-Fp-1;function zl(u){const o=Nr/u.extent,h=u.loadGeometry();for(let p=0;px.x+1||Px.y+1)&&Ye("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function Fl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?zl(u):[]}}function Gh(u,o,h,p,_){u.emplaceBack(2*o+(p+1)/2,2*h+(_+1)/2)}class nl{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Z,this.indexArray=new Ze,this.segments=new mt,this.programConfigurations=new xr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const _=this.layers[0],b=[];let x=null,E=!1;_.type==="circle"&&(x=_.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:P,id:A,index:N,sourceLayerIndex:O}of o){const G=this.layers[0]._featureFilter.needGeometry,H=Fl(P,G);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),H,p))continue;const Y=E?x.evaluate(H,{},p):void 0,ne={id:A,properties:P.properties,type:P.type,sourceLayerIndex:O,index:N,geometry:G?H.geometry:zl(P),patterns:{},sortKey:Y};b.push(ne)}E&&b.sort((P,A)=>P.sortKey-A.sortKey);for(const P of b){const{geometry:A,index:N,sourceLayerIndex:O}=P,G=o[N].feature;this.addFeature(P,A,N,p),h.featureIndex.insert(G,A,N,O,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,ct),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,h,p,_){for(const b of h)for(const x of b){const E=x.x,P=x.y;if(E<0||E>=Nr||P<0||P>=Nr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),N=A.vertexLength;Gh(this.layoutVertexArray,E,P,-1,-1),Gh(this.layoutVertexArray,E,P,1,-1),Gh(this.layoutVertexArray,E,P,1,1),Gh(this.layoutVertexArray,E,P,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},_)}}function Bp(u,o){for(let h=0;h1){if(jh(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(_)._add(o))}function N1(u,o){let h,p,_,b=!1;for(let x=0;xo.y!=_.y>o.y&&o.x<(_.x-p.x)*(o.y-p.y)/(_.y-p.y)+p.x&&(b=!b)}return b}function qh(u,o){let h=!1;for(let p=0,_=u.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(h=!h)}return h}function fT(u,o,h){const p=h[0],_=h[2];if(u.x_.x&&o.x>_.x||u.y_.y&&o.y>_.y)return!1;const b=xe(u,o,h[0]);return b!==xe(u,o,h[1])||b!==xe(u,o,h[2])||b!==xe(u,o,h[3])}function jp(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function Xm(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Ym(u,o,h,p,_){if(!o[0]&&!o[1])return u;const b=I.convert(o)._mult(_);h==="viewport"&&b._rotate(-p);const x=[];for(let E=0;EB1(ue,ne))}(A,P),H=O?N*E:N;for(const Y of _)for(const ne of Y){const ue=O?ne:B1(ne,P);let ge=H;const Re=Km([],[ne.x,ne.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ge*=Re[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ge*=x.cameraToCenterDistance/Re[3]),Zm(G,ue,ge))return!0}return!1}}function B1(u,o){const h=Km([],[u.x,u.y,0,1],o);return new I(h[0]/h[3],h[1]/h[3])}class V1 extends nl{}let U1;Ct("HeatmapBucket",V1,{omit:["layers"]});var gT={get paint(){return U1=U1||new vo({"heatmap-radius":new Vt(ze.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vt(ze.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Rt(ze.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Pp(ze.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Rt(ze.paint_heatmap["heatmap-opacity"])})}};function _y(u,{width:o,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${o*h*p}`)}else _=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=_,u}function G1(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const _=_y({},{width:o,height:h},p);yy(u,_,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,h)},p),u.width=o,u.height=h,u.data=_.data}function yy(u,o,h,p,_,b){if(_.width===0||_.height===0)return o;if(_.width>u.width||_.height>u.height||h.x>u.width-_.width||h.y>u.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>o.width||_.height>o.height||p.x>o.width-_.width||p.y>o.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const x=u.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<_.height;P++){const A=((h.y+P)*u.width+h.x)*b,N=((p.y+P)*o.width+p.x)*b;for(let O=0;O<_.width*b;O++)E[N+O]=x[A+O]}return o}class Wp{constructor(o,h){_y(this,o,1,h)}resize(o){G1(this,o,1)}clone(){return new Wp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){yy(o,h,p,_,b,1)}}class ws{constructor(o,h){_y(this,o,4,h)}resize(o){G1(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new ws({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){yy(o,h,p,_,b,4)}}function j1(u){const o={},h=u.resolution||256,p=u.clips?u.clips.length:1,_=u.image||new ws({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const b=(x,E,P)=>{o[u.evaluationKey]=P;const A=u.expression.evaluate(o);_.data[x+E+0]=Math.floor(255*A.r/A.a),_.data[x+E+1]=Math.floor(255*A.g/A.a),_.data[x+E+2]=Math.floor(255*A.b/A.a),_.data[x+E+3]=Math.floor(255*A.a)};if(u.clips)for(let x=0,E=0;x80*h){p=b=u[0],_=x=u[1];for(var Y=h;Yb&&(b=E),P>x&&(x=P);A=(A=Math.max(b-p,x-_))!==0?32767/A:0}return Hp(G,H,h,p,_,A,0),H}function W1(u,o,h,p,_){var b,x;if(_===wy(u,o,h,p)>0)for(b=o;b=o;b-=p)x=X1(b,u[b],u[b+1],x);return x&&Qm(x,x.next)&&(Xp(x),x=x.next),x}function Ec(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!Qm(p,p.next)&&jr(p.prev,p,p.next)!==0)p=p.next;else{if(Xp(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function Hp(u,o,h,p,_,b,x){if(u){!x&&b&&function(N,O,G,H){var Y=N;do Y.z===0&&(Y.z=by(Y.x,Y.y,O,G,H)),Y.prevZ=Y.prev,Y.nextZ=Y.next,Y=Y.next;while(Y!==N);Y.prevZ.nextZ=null,Y.prevZ=null,function(ne){var ue,ge,Re,ve,Te,Je,Qe,Et,Pt=1;do{for(ge=ne,ne=null,Te=null,Je=0;ge;){for(Je++,Re=ge,Qe=0,ue=0;ue0||Et>0&ℜ)Qe!==0&&(Et===0||!Re||ge.z<=Re.z)?(ve=ge,ge=ge.nextZ,Qe--):(ve=Re,Re=Re.nextZ,Et--),Te?Te.nextZ=ve:ne=ve,ve.prevZ=Te,Te=ve;ge=Re}Te.nextZ=null,Pt*=2}while(Je>1)}(Y)}(u,p,_,b);for(var E,P,A=u;u.prev!==u.next;)if(E=u.prev,P=u.next,b?ST(u,p,_,b):wT(u))o.push(E.i/h|0),o.push(u.i/h|0),o.push(P.i/h|0),Xp(u),u=P.next,A=P.next;else if((u=P)===A){x?x===1?Hp(u=ET(Ec(u),o,h),o,h,p,_,b,2):x===2&&IT(u,o,h,p,_,b):Hp(Ec(u),o,h,p,_,b,1);break}}}function wT(u){var o=u.prev,h=u,p=u.next;if(jr(o,h,p)>=0)return!1;for(var _=o.x,b=h.x,x=p.x,E=o.y,P=h.y,A=p.y,N=_b?_>x?_:x:b>x?b:x,H=E>P?E>A?E:A:P>A?P:A,Y=p.next;Y!==o;){if(Y.x>=N&&Y.x<=G&&Y.y>=O&&Y.y<=H&&Hh(_,E,b,P,x,A,Y.x,Y.y)&&jr(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function ST(u,o,h,p){var _=u.prev,b=u,x=u.next;if(jr(_,b,x)>=0)return!1;for(var E=_.x,P=b.x,A=x.x,N=_.y,O=b.y,G=x.y,H=EP?E>A?E:A:P>A?P:A,ue=N>O?N>G?N:G:O>G?O:G,ge=by(H,Y,o,h,p),Re=by(ne,ue,o,h,p),ve=u.prevZ,Te=u.nextZ;ve&&ve.z>=ge&&Te&&Te.z<=Re;){if(ve.x>=H&&ve.x<=ne&&ve.y>=Y&&ve.y<=ue&&ve!==_&&ve!==x&&Hh(E,N,P,O,A,G,ve.x,ve.y)&&jr(ve.prev,ve,ve.next)>=0||(ve=ve.prevZ,Te.x>=H&&Te.x<=ne&&Te.y>=Y&&Te.y<=ue&&Te!==_&&Te!==x&&Hh(E,N,P,O,A,G,Te.x,Te.y)&&jr(Te.prev,Te,Te.next)>=0))return!1;Te=Te.nextZ}for(;ve&&ve.z>=ge;){if(ve.x>=H&&ve.x<=ne&&ve.y>=Y&&ve.y<=ue&&ve!==_&&ve!==x&&Hh(E,N,P,O,A,G,ve.x,ve.y)&&jr(ve.prev,ve,ve.next)>=0)return!1;ve=ve.prevZ}for(;Te&&Te.z<=Re;){if(Te.x>=H&&Te.x<=ne&&Te.y>=Y&&Te.y<=ue&&Te!==_&&Te!==x&&Hh(E,N,P,O,A,G,Te.x,Te.y)&&jr(Te.prev,Te,Te.next)>=0)return!1;Te=Te.nextZ}return!0}function ET(u,o,h){var p=u;do{var _=p.prev,b=p.next.next;!Qm(_,b)&&H1(_,p,p.next,b)&&Zp(_,b)&&Zp(b,_)&&(o.push(_.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),Xp(p),Xp(p.next),p=u=b),p=p.next}while(p!==u);return Ec(p)}function IT(u,o,h,p,_,b){var x=u;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&MT(x,E)){var P=Z1(x,E);return x=Ec(x,x.next),P=Ec(P,P.next),Hp(x,o,h,p,_,b,0),void Hp(P,o,h,p,_,b,0)}E=E.next}x=x.next}while(x!==u)}function CT(u,o){return u.x-o.x}function TT(u,o){var h=function(_,b){var x,E=b,P=_.x,A=_.y,N=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var O=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(O<=P&&O>N&&(N=O,x=E.x=E.x&&E.x>=Y&&P!==E.x&&Hh(Ax.x||E.x===x.x&<(x,E)))&&(x=E,ue=G)),E=E.next;while(E!==H);return x}(u,o);if(!h)return o;var p=Z1(h,u);return Ec(p,p.next),Ec(h,h.next)}function LT(u,o){return jr(u.prev,u,o.prev)<0&&jr(o.next,u,u.next)<0}function by(u,o,h,p,_){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*_|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*_|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function PT(u){var o=u,h=u;do(o.x=(u-x)*(b-E)&&(u-x)*(p-E)>=(h-x)*(o-E)&&(h-x)*(b-E)>=(_-x)*(p-E)}function MT(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&H1(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(u,o)&&(Zp(u,o)&&Zp(o,u)&&function(h,p){var _=h,b=!1,x=(h.x+p.x)/2,E=(h.y+p.y)/2;do _.y>E!=_.next.y>E&&_.next.y!==_.y&&x<(_.next.x-_.x)*(E-_.y)/(_.next.y-_.y)+_.x&&(b=!b),_=_.next;while(_!==h);return b}(u,o)&&(jr(u.prev,u,o.prev)||jr(u,o.prev,o))||Qm(u,o)&&jr(u.prev,u,u.next)>0&&jr(o.prev,o,o.next)>0)}function jr(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function Qm(u,o){return u.x===o.x&&u.y===o.y}function H1(u,o,h,p){var _=eg(jr(u,o,h)),b=eg(jr(u,o,p)),x=eg(jr(h,p,u)),E=eg(jr(h,p,o));return _!==b&&x!==E||!(_!==0||!$m(u,h,o))||!(b!==0||!$m(u,p,o))||!(x!==0||!$m(h,u,p))||!(E!==0||!$m(h,o,p))}function $m(u,o,h){return o.x<=Math.max(u.x,h.x)&&o.x>=Math.min(u.x,h.x)&&o.y<=Math.max(u.y,h.y)&&o.y>=Math.min(u.y,h.y)}function eg(u){return u>0?1:u<0?-1:0}function Zp(u,o){return jr(u.prev,u,u.next)<0?jr(u,o,u.next)>=0&&jr(u,u.prev,o)>=0:jr(u,o,u.prev)<0||jr(u,u.next,o)<0}function Z1(u,o){var h=new xy(u.i,u.x,u.y),p=new xy(o.i,o.x,o.y),_=u.next,b=o.prev;return u.next=o,o.prev=u,h.next=_,_.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function X1(u,o,h,p){var _=new xy(u,o,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function Xp(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function xy(u,o,h){this.i=u,this.x=o,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wy(u,o,h,p){for(var _=0,b=o,x=h-p;b0&&h.holes.push(p+=u[_-1].length)}return h};var Y1=d(vy.exports);function AT(u,o,h,p,_){K1(u,o,h||0,p||u.length-1,_||kT)}function K1(u,o,h,p,_){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,E=Math.log(b),P=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*P*(b-P)/b)*(x-b/2<0?-1:1);K1(u,o,Math.max(h,Math.floor(o-x*P/b+A)),Math.min(p,Math.floor(o+(b-x)*P/b+A)),_)}var N=u[o],O=h,G=p;for(Yp(u,h,o),_(u[p],N)>0&&Yp(u,h,p);O0;)G--}_(u[h],N)===0?Yp(u,h,G):Yp(u,++G,p),G<=o&&(h=G+1),o<=G&&(p=G-1)}}function Yp(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function kT(u,o){return uo?1:0}function Sy(u,o){const h=u.length;if(h<=1)return[u];const p=[];let _,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ae,this.indexArray=new Ze,this.indexArray2=new nt,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new mt,this.segments2=new mt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Ey("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),b=!_.isConstant(),x=[];for(const{feature:E,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=Fl(E,O);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),G,p))continue;const H=b?_.evaluate(G,{},p,h.availableImages):void 0,Y={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:zl(E),patterns:{},sortKey:H};x.push(Y)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:A,sourceLayerIndex:N}=E;if(this.hasPattern){const O=Iy("fill",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,xT),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,h,p,_,b){for(const x of Sy(h,500)){let E=0;for(const H of x)E+=H.length;const P=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=P.vertexLength,N=[],O=[];for(const H of x){if(H.length===0)continue;H!==x[0]&&O.push(N.length/2);const Y=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),ne=Y.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(ne+H.length-1,ne),N.push(H[0].x),N.push(H[0].y);for(let ue=1;ue>3}if(_--,p===1||p===2)b+=u.readSVarint(),x+=u.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new BT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},Zh.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,_=0,b=0,x=1/0,E=-1/0,P=1/0,A=-1/0;u.pos>3}if(p--,h===1||h===2)(_+=u.readSVarint())E&&(E=_),(b+=u.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,P,E,A]},Zh.prototype.toGeoJSON=function(u,o,h){var p,_,b=this.extent*Math.pow(2,h),x=this.extent*u,E=this.extent*o,P=this.loadGeometry(),A=Zh.types[this.type];function N(H){for(var Y=0;Y>3;_=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return _}(h))}tb.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var o=this._pbf.readVarint()+this._pbf.pos;return new GT(this._pbf,o,this.extent,this._keys,this._values)};var qT=eb;function WT(u,o,h){if(u===3){var p=new qT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}Eu.VectorTile=function(u,o){this.layers=u.readFields(WT,{},o)},Eu.VectorTileFeature=$1,Eu.VectorTileLayer=eb;const HT=Eu.VectorTileFeature.types,Ty=Math.pow(2,13);function Kp(u,o,h,p,_,b,x,E){u.emplaceBack(o,h,2*Math.floor(p*Ty)+x,_*Ty*2,b*Ty*2,Math.round(E))}class Ly{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new se,this.centroidVertexArray=new F,this.indexArray=new Ze,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new mt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=Ey("fill-extrusion",this.layers,h);for(const{feature:_,id:b,index:x,sourceLayerIndex:E}of o){const P=this.layers[0]._featureFilter.needGeometry,A=Fl(_,P);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),A,p))continue;const N={id:b,sourceLayerIndex:E,index:x,geometry:P?A.geometry:zl(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(Iy("fill-extrusion",this.layers,N,this.zoom,h)):this.addFeature(N,N.geometry,x,p,{}),h.featureIndex.insert(_,N.geometry,x,E,this.index,!0)}}addFeatures(o,h,p){for(const _ of this.features){const{geometry:b}=_;this.addFeature(_,b,_.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,FT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,zT.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,h,p,_,b){const x={x:0,y:0,vertexCount:0};for(const E of Sy(h,500)){let P=0;for(const Y of E)P+=Y.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of E){if(Y.length===0||XT(Y))continue;let ne=0;for(let ue=0;ue=1){const Re=Y[ue-1];if(!ZT(ge,Re)){A.vertexLength+4>mt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ve=ge.sub(Re)._perp()._unit(),Te=Re.dist(ge);ne+Te>32768&&(ne=0),Kp(this.layoutVertexArray,ge.x,ge.y,ve.x,ve.y,0,0,ne),Kp(this.layoutVertexArray,ge.x,ge.y,ve.x,ve.y,0,1,ne),x.x+=2*ge.x,x.y+=2*ge.y,x.vertexCount+=2,ne+=Te,Kp(this.layoutVertexArray,Re.x,Re.y,ve.x,ve.y,0,0,ne),Kp(this.layoutVertexArray,Re.x,Re.y,ve.x,ve.y,0,1,ne),x.x+=2*Re.x,x.y+=2*Re.y,x.vertexCount+=2;const Je=A.vertexLength;this.indexArray.emplaceBack(Je,Je+2,Je+1),this.indexArray.emplaceBack(Je+1,Je+2,Je+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+P>mt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),HT[o.type]!=="Polygon")continue;const N=[],O=[],G=A.vertexLength;for(const Y of E)if(Y.length!==0){Y!==E[0]&&O.push(N.length/2);for(let ne=0;neNr)||u.y===o.y&&(u.y<0||u.y>Nr)}function XT(u){return u.every(o=>o.x<0)||u.every(o=>o.x>Nr)||u.every(o=>o.y<0)||u.every(o=>o.y>Nr)}let nb;Ct("FillExtrusionBucket",Ly,{omit:["layers","features"]});var YT={get paint(){return nb=nb||new vo({"fill-extrusion-opacity":new Rt(ze["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Rt(ze["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Rt(ze["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Rh(ze["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Rt(ze["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class KT extends xs{constructor(o){super(o,YT)}createBucket(o){return new Ly(o)}queryRadius(){return Xm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,_,b,x,E,P){const A=Ym(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),N=this.paint.get("fill-extrusion-height").evaluate(h,p),O=this.paint.get("fill-extrusion-base").evaluate(h,p),G=function(Y,ne,ue,ge){const Re=[];for(const ve of Y){const Te=[ve.x,ve.y,0,1];Km(Te,Te,ne),Re.push(new I(Te[0]/Te[3],Te[1]/Te[3]))}return Re}(A,P),H=function(Y,ne,ue,ge){const Re=[],ve=[],Te=ge[8]*ne,Je=ge[9]*ne,Qe=ge[10]*ne,Et=ge[11]*ne,Pt=ge[8]*ue,St=ge[9]*ue,bt=ge[10]*ue,ft=ge[11]*ue;for(const Tt of Y){const _t=[],at=[];for(const Bt of Tt){const kt=Bt.x,gn=Bt.y,ar=ge[0]*kt+ge[4]*gn+ge[12],dr=ge[1]*kt+ge[5]*gn+ge[13],hi=ge[2]*kt+ge[6]*gn+ge[14],is=ge[3]*kt+ge[7]*gn+ge[15],xo=hi+Qe,si=is+Et,Di=ar+Pt,Vi=dr+St,wo=hi+bt,So=is+ft,fi=new I((ar+Te)/si,(dr+Je)/si);fi.z=xo/si,_t.push(fi);const pi=new I(Di/So,Vi/So);pi.z=wo/So,at.push(pi)}Re.push(_t),ve.push(at)}return[Re,ve]}(_,O,N,P);return function(Y,ne,ue){let ge=1/0;Vp(ue,ne)&&(ge=rb(ue,ne[0]));for(let Re=0;Reh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new pe,this.layoutVertexArray2=new te,this.indexArray=new Ze,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new mt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Ey("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),b=!_.isConstant(),x=[];for(const{feature:E,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=Fl(E,O);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),G,p))continue;const H=b?_.evaluate(G,{},p):void 0,Y={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:zl(E),patterns:{},sortKey:H};x.push(Y)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:A,sourceLayerIndex:N}=E;if(this.hasPattern){const O=Iy("line",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,eL)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,QT),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,h,p,_,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),P=x.get("line-cap"),A=x.get("line-miter-limit"),N=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of h)this.addLine(O,o,E,P,A,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,_)}addLine(o,h,p,_,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ge=0;ge=2&&o[P-1].equals(o[P-2]);)P--;let A=0;for(;A0;if(Et&&ge>A){const ft=G.dist(H);if(ft>2*N){const Tt=G.sub(G.sub(H)._mult(N/ft)._round());this.updateDistance(H,Tt),this.addCurrentVertex(Tt,ne,0,0,O),H=Tt}}const St=H&&Y;let bt=St?p:E?"butt":_;if(St&&bt==="round"&&(Jeb&&(bt="bevel"),bt==="bevel"&&(Je>2&&(bt="flipbevel"),Je100)Re=ue.mult(-1);else{const ft=Je*ne.add(ue).mag()/ne.sub(ue).mag();Re._perp()._mult(ft*(Pt?-1:1))}this.addCurrentVertex(G,Re,0,0,O),this.addCurrentVertex(G,Re.mult(-1),0,0,O)}else if(bt==="bevel"||bt==="fakeround"){const ft=-Math.sqrt(Je*Je-1),Tt=Pt?ft:0,_t=Pt?0:ft;if(H&&this.addCurrentVertex(G,ne,Tt,_t,O),bt==="fakeround"){const at=Math.round(180*Qe/Math.PI/20);for(let Bt=1;Bt2*N){const Tt=G.add(Y.sub(G)._mult(N/ft)._round());this.updateDistance(G,Tt),this.addCurrentVertex(Tt,ue,0,0,O),G=Tt}}}}addCurrentVertex(o,h,p,_,b,x=!1){const E=h.y*_-h.x,P=-h.y-h.x*_;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,E,P,x,!0,-_,b),this.distance>ib/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,_,b,x))}addHalfVertex({x:o,y:h},p,_,b,x,E,P){const A=.5*(this.lineClips?this.scaledDistance*(ib-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const N=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),P.primitiveLength++),x?this.e2=N:this.e1=N}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let ob,sb;Ct("LineBucket",Py,{omit:["layers","patternFeatures"]});var ab={get paint(){return sb=sb||new vo({"line-opacity":new Vt(ze.paint_line["line-opacity"]),"line-color":new Vt(ze.paint_line["line-color"]),"line-translate":new Rt(ze.paint_line["line-translate"]),"line-translate-anchor":new Rt(ze.paint_line["line-translate-anchor"]),"line-width":new Vt(ze.paint_line["line-width"]),"line-gap-width":new Vt(ze.paint_line["line-gap-width"]),"line-offset":new Vt(ze.paint_line["line-offset"]),"line-blur":new Vt(ze.paint_line["line-blur"]),"line-dasharray":new _c(ze.paint_line["line-dasharray"]),"line-pattern":new Rh(ze.paint_line["line-pattern"]),"line-gradient":new Pp(ze.paint_line["line-gradient"])})},get layout(){return ob=ob||new vo({"line-cap":new Rt(ze.layout_line["line-cap"]),"line-join":new Vt(ze.layout_line["line-join"]),"line-miter-limit":new Rt(ze.layout_line["line-miter-limit"]),"line-round-limit":new Rt(ze.layout_line["line-round-limit"]),"line-sort-key":new Vt(ze.layout_line["line-sort-key"])})}};class rL extends Vt{possiblyEvaluate(o,h){return h=new fr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,_){return h=de({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,_)}}let tg;class iL extends xs{constructor(o){super(o,ab),this.gradientVersion=0,tg||(tg=new rL(ab.paint.properties["line-width"].specification),tg.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof uc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=tg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new Py(o)}queryRadius(o){const h=o,p=lb(jp("line-width",this,h),jp("line-gap-width",this,h)),_=jp("line-offset",this,h);return p/2+Math.abs(_)+Xm(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,_,b,x,E){const P=Ym(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*lb(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),N=this.paint.get("line-offset").evaluate(h,p);return N&&(_=function(O,G){const H=[];for(let Y=0;Y=3){for(let ue=0;ue0?o+2*u:u}const oL=Gr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),sL=Gr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Gr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aL=Gr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Gr([{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 ub=Gr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lL=Gr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function uL(u,o,h){return u.sections.forEach(p=>{p.text=function(_,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?_=_.toLocaleUpperCase():E==="lowercase"&&(_=_.toLocaleLowerCase()),$a.applyArabicShaping&&(_=$a.applyArabicShaping(_)),_}(p.text,o,h)}),u}Gr([{name:"triangle",components:3,type:"Uint16"}]),Gr([{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"}]),Gr([{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"}]),Gr([{type:"Float32",name:"offsetX"}]),Gr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Gr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Qp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ci=24,cb=Kn,hb=function(u,o,h,p,_){var b,x,E=8*_-p-1,P=(1<>1,N=-7,O=h?_-1:0,G=h?-1:1,H=u[o+O];for(O+=G,b=H&(1<<-N)-1,H>>=-N,N+=E;N>0;b=256*b+u[o+O],O+=G,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=p;N>0;x=256*x+u[o+O],O+=G,N-=8);if(b===0)b=1-A;else{if(b===P)return x?NaN:1/0*(H?-1:1);x+=Math.pow(2,p),b-=A}return(H?-1:1)*x*Math.pow(2,b-p)},fb=function(u,o,h,p,_,b){var x,E,P,A=8*b-_-1,N=(1<>1,G=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=p?0:b-1,Y=p?1:-1,ne=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,x=N):(x=Math.floor(Math.log(o)/Math.LN2),o*(P=Math.pow(2,-x))<1&&(x--,P*=2),(o+=x+O>=1?G/P:G*Math.pow(2,1-O))*P>=2&&(x++,P/=2),x+O>=N?(E=0,x=N):x+O>=1?(E=(o*P-1)*Math.pow(2,_),x+=O):(E=o*Math.pow(2,O-1)*Math.pow(2,_),x=0));_>=8;u[h+H]=255&E,H+=Y,E/=256,_-=8);for(x=x<<_|E,A+=_;A>0;u[h+H]=255&x,H+=Y,x/=256,A-=8);u[h+H-Y]|=128*ne};function Kn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}Kn.Varint=0,Kn.Fixed64=1,Kn.Bytes=2,Kn.Fixed32=5;var My=4294967296,pb=1/My,db=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Bl(u){return u.type===Kn.Bytes?u.readVarint()+u.pos:u.pos+1}function Xh(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function mb(u,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=u;_--)h.buf[_+p]=h.buf[_]}function cL(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function gb(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}Kn.prototype={destroy:function(){this.buf=null},readFields:function(u,o,h){for(h=h||this.length;this.pos>3,b=this.pos;this.type=7&p,u(_,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=ng(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=gb(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=ng(this.buf,this.pos)+ng(this.buf,this.pos+4)*My;return this.pos+=8,u},readSFixed64:function(){var u=ng(this.buf,this.pos)+gb(this.buf,this.pos+4)*My;return this.pos+=8,u},readFloat:function(){var u=hb(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=hb(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(_,b,x){var E,P,A=x.buf;if(E=(112&(P=A[x.pos++]))>>4,P<128||(E|=(127&(P=A[x.pos++]))<<3,P<128)||(E|=(127&(P=A[x.pos++]))<<10,P<128)||(E|=(127&(P=A[x.pos++]))<<17,P<128)||(E|=(127&(P=A[x.pos++]))<<24,P<128)||(E|=(1&(P=A[x.pos++]))<<31,P<128))return Xh(_,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,o=this.pos;return this.pos=u,u-o>=12&&db?function(h,p,_){return db.decode(h.subarray(p,_))}(this.buf,o,u):function(h,p,_){for(var b="",x=p;x<_;){var E,P,A,N=h[x],O=null,G=N>239?4:N>223?3:N>191?2:1;if(x+G>_)break;G===1?N<128&&(O=N):G===2?(192&(E=h[x+1]))==128&&(O=(31&N)<<6|63&E)<=127&&(O=null):G===3?(P=h[x+2],(192&(E=h[x+1]))==128&&(192&P)==128&&((O=(15&N)<<12|(63&E)<<6|63&P)<=2047||O>=55296&&O<=57343)&&(O=null)):G===4&&(P=h[x+2],A=h[x+3],(192&(E=h[x+1]))==128&&(192&P)==128&&(192&A)==128&&((O=(15&N)<<18|(63&E)<<12|(63&P)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,G=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=G}return b}(this.buf,o,u)},readBytes:function(){var u=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,u);return this.pos=u,o},readPackedVarint:function(u,o){if(this.type!==Kn.Bytes)return u.push(this.readVarint(o));var h=Bl(this);for(u=u||[];this.pos127;);else if(o===Kn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Kn.Fixed32)this.pos+=4;else{if(o!==Kn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(u,o){this.writeVarint(u<<3|o)},realloc:function(u){for(var o=this.length||16;o268435455||u<0?function(o,h){var p,_;if(o>=0?(p=o%4294967296|0,_=o/4294967296|0):(_=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,_=_+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,h),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(_,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var o=this.pos;this.pos=function(p,_,b){for(var x,E,P=0;P<_.length;P++){if((x=_.charCodeAt(P))>55295&&x<57344){if(!E){x>56319||P+1===_.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,u,this.pos);var h=this.pos-o;h>=128&&mb(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),fb(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),fb(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var o=u.length;this.writeVarint(o),this.realloc(o);for(var h=0;h=128&&mb(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,h){this.writeTag(u,Kn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,cL,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,hL,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,dL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,fL,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,pL,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,mL,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,gL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,_L,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,yL,o)},writeBytesField:function(u,o){this.writeTag(u,Kn.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,Kn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,Kn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,Kn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,Kn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,Kn.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,Kn.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,Kn.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,Kn.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,Kn.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var Ay=d(cb);const ky=3;function vL(u,o,h){u===1&&h.readMessage(bL,o)}function bL(u,o,h){if(u===3){const{id:p,bitmap:_,width:b,height:x,left:E,top:P,advance:A}=h.readMessage(xL,{});o.push({id:p,bitmap:new Wp({width:b+2*ky,height:x+2*ky},_),metrics:{width:b,height:x,left:E,top:P,advance:A}})}}function xL(u,o,h){u===1?o.id=h.readVarint():u===2?o.bitmap=h.readBytes():u===3?o.width=h.readVarint():u===4?o.height=h.readVarint():u===5?o.left=h.readSVarint():u===6?o.top=h.readSVarint():u===7&&(o.advance=h.readVarint())}const _b=ky;function yb(u){let o=0,h=0;for(const x of u)o+=x.w*x.h,h=Math.max(h,x.w);u.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let _=0,b=0;for(const x of u)for(let E=p.length-1;E>=0;E--){const P=p[E];if(!(x.w>P.w||x.h>P.h)){if(x.x=P.x,x.y=P.y,b=Math.max(b,x.y+x.h),_=Math.max(_,x.x+x.w),x.w===P.w&&x.h===P.h){const A=p.pop();E=0&&p>=o&&ig[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new Kh;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push(ed.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function rg(u,o,h,p,_,b,x,E,P,A,N,O,G,H,Y,ne){const ue=Kh.fromFeature(u,_);let ge;O===c.ah.vertical&&ue.verticalizePunctuation();const{processBidirectionalText:Re,processStyledBidirectionalText:ve}=$a;if(Re&&ue.sections.length===1){ge=[];const Qe=Re(ue.toString(),Ry(ue,A,b,o,p,H,Y));for(const Et of Qe){const Pt=new Kh;Pt.text=Et,Pt.sections=ue.sections;for(let St=0;St0&&Ul>Vo&&(Vo=Ul)}else{const Es=Pt[wn.fontStack],Go=Es&&Es[Ui];if(Go&&Go.rect)Sa=Go.rect,Zs=Go.metrics;else{const Ul=Et[wn.fontStack],od=Ul&&Ul[Ui];if(!od)continue;Zs=od.metrics}mi=(pi-wn.scale)*ci}Xs?(Qe.verticalizable=!0,oo.push({glyph:Ui,imageName:Ea,x:ar,y:dr+mi,vertical:Xs,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:so,metrics:Zs,rect:Sa}),ar+=Vl*wn.scale+Bt):(oo.push({glyph:Ui,imageName:Ea,x:ar,y:dr+mi,vertical:Xs,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:so,metrics:Zs,rect:Sa}),ar+=Zs.advance*wn.scale+Bt)}oo.length!==0&&(hi=Math.max(ar-Bt,hi),EL(oo,0,oo.length-1,xo,Vo)),ar=0;const Uo=ft*pi+Vo;Eo.lineOffset=Math.max(Vo,io),dr+=Uo,is=Math.max(Uo,is),++si}var Di;const Vi=dr-$p,{horizontalAlign:wo,verticalAlign:So}=Ny(Tt);(function(fi,pi,io,Eo,oo,Vo,Uo,di,wn){const so=(pi-io)*oo;let Ui=0;Ui=Vo!==Uo?-di*Eo-$p:(-Eo*wn+.5)*Uo;for(const mi of fi)for(const Zs of mi.positionedGlyphs)Zs.x+=so,Zs.y+=Ui})(Qe.positionedLines,xo,wo,So,hi,is,ft,Vi,bt.length),Qe.top+=-So*Vi,Qe.bottom=Qe.top+Vi,Qe.left+=-wo*hi,Qe.right=Qe.left+hi}(Je,o,h,p,ge,x,E,P,O,A,G,ne),!function(Qe){for(const Et of Qe)if(Et.positionedGlyphs.length!==0)return!1;return!0}(Te)&&Je}const ig={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},wL={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 bb(u,o,h,p,_,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ci/b+_:0}{const x=h[o.fontStack],E=x&&x[u];return E?E.metrics.advance*o.scale+_:0}}function xb(u,o,h,p){const _=Math.pow(u-o,2);return p?u=0;let N=0;for(let G=0;Gx.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=gy([]),this.placementViewportMatrix=gy([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ib(this.zoom,h["text-size"]),this.iconSizeData=Ib(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=Oy(p,"text-overlap","text-allow-overlap")!=="never"||Oy(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>c.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new Fy(new xr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new Fy(new xr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new g,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,h,p,_,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!N)return;const G=h.iconDependencies,H=h.glyphDependencies,Y=h.availableImages,ne=new fr(this.zoom);for(const{feature:ue,id:ge,index:Re,sourceLayerIndex:ve}of o){const Te=_._featureFilter.needGeometry,Je=Fl(ue,Te);if(!_._featureFilter.filter(ne,Je,p))continue;let Qe,Et;if(Te||(Je.geometry=zl(ue)),A){const St=_.getValueAndResolveTokens("text-field",Je,p,Y),bt=Ro.factory(St),ft=this.hasRTLText=this.hasRTLText||LL(bt);(!ft||$a.getRTLTextPluginStatus()==="unavailable"||ft&&$a.isParsed())&&(Qe=uL(bt,_,Je))}if(N){const St=_.getValueAndResolveTokens("icon-image",Je,p,Y);Et=St instanceof ts?St:ts.fromString(St)}if(!Qe&&!Et)continue;const Pt=this.sortFeaturesByKey?O.evaluate(Je,{},p):void 0;if(this.features.push({id:ge,text:Qe,icon:Et,index:Re,sourceLayerIndex:ve,geometry:Je.geometry,properties:ue.properties,type:CL[ue.type],sortKey:Pt}),Et&&(G[Et.name]=!0),Qe){const St=x.evaluate(Je,{},p).join(","),bt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ah.vertical)>=0;for(const ft of Qe.sections)if(ft.image)G[ft.image.name]=!0;else{const Tt=wu(Qe.toString()),_t=ft.fontStack||St,at=H[_t]=H[_t]||{};this.calculateGlyphDependencies(ft.text,at,bt,this.allowVerticalPlacement,Tt)}}}b.get("symbol-placement")==="line"&&(this.features=function(ue){const ge={},Re={},ve=[];let Te=0;function Je(St){ve.push(ue[St]),Te++}function Qe(St,bt,ft){const Tt=Re[St];return delete Re[St],Re[bt]=Tt,ve[Tt].geometry[0].pop(),ve[Tt].geometry[0]=ve[Tt].geometry[0].concat(ft[0]),Tt}function Et(St,bt,ft){const Tt=ge[bt];return delete ge[bt],ge[St]=Tt,ve[Tt].geometry[0].shift(),ve[Tt].geometry[0]=ft[0].concat(ve[Tt].geometry[0]),Tt}function Pt(St,bt,ft){const Tt=ft?bt[0][bt[0].length-1]:bt[0][0];return`${St}:${Tt.x}:${Tt.y}`}for(let St=0;StSt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ue,ge)=>ue.sortKey-ge.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let _=o.dist(h[o.segment+1]),b=o.dist(h[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:h[E].x,y:h[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=h[E-1].dist(h[E]));for(let E=0;E0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(o,h){const p=o.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;b<_;b+=4)o.indexArray.emplaceBack(b,b+1,b+2),o.indexArray.emplaceBack(b+1,b+2,b+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),_=[],b=[],x=[];for(let E=0;E_[E]-_[P]||b[P]-b[E]),x}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,b,x)=>{_>=0&&x.indexOf(_)===b&&this.addIndicesForPlacedSymbol(this.text,_)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Cb,Tb;Ct("SymbolBucket",Jh,{omit:["layers","collisionBoxArray","features","compareText"]}),Jh.MAX_GLYPHS=65535,Jh.addDynamicAttributes=zy;var Vy={get paint(){return Tb=Tb||new vo({"icon-opacity":new Vt(ze.paint_symbol["icon-opacity"]),"icon-color":new Vt(ze.paint_symbol["icon-color"]),"icon-halo-color":new Vt(ze.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vt(ze.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vt(ze.paint_symbol["icon-halo-blur"]),"icon-translate":new Rt(ze.paint_symbol["icon-translate"]),"icon-translate-anchor":new Rt(ze.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vt(ze.paint_symbol["text-opacity"]),"text-color":new Vt(ze.paint_symbol["text-color"],{runtimeType:Rr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Vt(ze.paint_symbol["text-halo-color"]),"text-halo-width":new Vt(ze.paint_symbol["text-halo-width"]),"text-halo-blur":new Vt(ze.paint_symbol["text-halo-blur"]),"text-translate":new Rt(ze.paint_symbol["text-translate"]),"text-translate-anchor":new Rt(ze.paint_symbol["text-translate-anchor"])})},get layout(){return Cb=Cb||new vo({"symbol-placement":new Rt(ze.layout_symbol["symbol-placement"]),"symbol-spacing":new Rt(ze.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Rt(ze.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vt(ze.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Rt(ze.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Rt(ze.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Rt(ze.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Rt(ze.layout_symbol["icon-ignore-placement"]),"icon-optional":new Rt(ze.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Rt(ze.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vt(ze.layout_symbol["icon-size"]),"icon-text-fit":new Rt(ze.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Rt(ze.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vt(ze.layout_symbol["icon-image"]),"icon-rotate":new Vt(ze.layout_symbol["icon-rotate"]),"icon-padding":new Vt(ze.layout_symbol["icon-padding"]),"icon-keep-upright":new Rt(ze.layout_symbol["icon-keep-upright"]),"icon-offset":new Vt(ze.layout_symbol["icon-offset"]),"icon-anchor":new Vt(ze.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Rt(ze.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Rt(ze.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Rt(ze.layout_symbol["text-rotation-alignment"]),"text-field":new Vt(ze.layout_symbol["text-field"]),"text-font":new Vt(ze.layout_symbol["text-font"]),"text-size":new Vt(ze.layout_symbol["text-size"]),"text-max-width":new Vt(ze.layout_symbol["text-max-width"]),"text-line-height":new Rt(ze.layout_symbol["text-line-height"]),"text-letter-spacing":new Vt(ze.layout_symbol["text-letter-spacing"]),"text-justify":new Vt(ze.layout_symbol["text-justify"]),"text-radial-offset":new Vt(ze.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Rt(ze.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Vt(ze.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Vt(ze.layout_symbol["text-anchor"]),"text-max-angle":new Rt(ze.layout_symbol["text-max-angle"]),"text-writing-mode":new Rt(ze.layout_symbol["text-writing-mode"]),"text-rotate":new Vt(ze.layout_symbol["text-rotate"]),"text-padding":new Rt(ze.layout_symbol["text-padding"]),"text-keep-upright":new Rt(ze.layout_symbol["text-keep-upright"]),"text-transform":new Vt(ze.layout_symbol["text-transform"]),"text-offset":new Vt(ze.layout_symbol["text-offset"]),"text-allow-overlap":new Rt(ze.layout_symbol["text-allow-overlap"]),"text-overlap":new Rt(ze.layout_symbol["text-overlap"]),"text-ignore-placement":new Rt(ze.layout_symbol["text-ignore-placement"]),"text-optional":new Rt(ze.layout_symbol["text-optional"])})}};class Lb{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:ei,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ct("FormatSectionOverride",Lb,{omit:["defaultValue"]});class sg extends xs{constructor(o){super(o,Vy)}recalculate(o,h){if(super.recalculate(o,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const _=[];for(const b of p)_.indexOf(b)<0&&_.push(b);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,_){const b=this.layout.get(o).evaluate(h,{},p,_),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||er(x.value)||!b?b:function(E,P){return P.replace(/{([^{}]+)}/g,(A,N)=>E&&N in E?String(E[N]):"")}(h.properties,b)}createBucket(o){return new Jh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of Vy.paint.overridableProperties){if(!sg.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new Lb(h),_=new sr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new bh("source",_):new yp("composite",_,h.value.zoomStops),this.paint._values[o]=new bs(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&sg.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),_=Vy.paint.properties[h];let b=!1;const x=E=>{for(const P of E)if(_.overrides&&_.overrides.hasOverride(P))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ro)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Xa&&ni(A.value)===Vr?x(A.value.sections):A instanceof yh?x(A.sections):A.eachChild(E))},P=p.value;P._styleExpression&&E(P._styleExpression.expression)}return b}}let Pb;var PL={get paint(){return Pb=Pb||new vo({"background-color":new Rt(ze.paint_background["background-color"]),"background-pattern":new _c(ze.paint_background["background-pattern"]),"background-opacity":new Rt(ze.paint_background["background-opacity"])})}};class ML extends xs{constructor(o){super(o,PL)}}let Mb;var AL={get paint(){return Mb=Mb||new vo({"raster-opacity":new Rt(ze.paint_raster["raster-opacity"]),"raster-hue-rotate":new Rt(ze.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Rt(ze.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Rt(ze.paint_raster["raster-brightness-max"]),"raster-saturation":new Rt(ze.paint_raster["raster-saturation"]),"raster-contrast":new Rt(ze.paint_raster["raster-contrast"]),"raster-resampling":new Rt(ze.paint_raster["raster-resampling"]),"raster-fade-duration":new Rt(ze.paint_raster["raster-fade-duration"])})}};class kL extends xs{constructor(o){super(o,AL)}}class DL extends xs{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class RL{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Uy=63710088e-1;class Tu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Tu(fe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,_=o.lat*h,b=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((o.lng-this.lng)*h);return Uy*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof Tu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Tu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Tu(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Ab=2*Math.PI*Uy;function kb(u){return Ab*Math.cos(u*Math.PI/180)}function Db(u){return(180+u)/360}function Rb(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function Nb(u,o){return u/kb(o)}function Gy(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class ag{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=Tu.convert(o);return new ag(Db(p.lng),Rb(p.lat),Nb(h,p.lat))}toLngLat(){return new Tu(360*this.x-180,Gy(this.y))}toAltitude(){return this.z*kb(Gy(this.y))}meterInMercatorCoordinateUnits(){return 1/Ab*(o=Gy(this.y),1/Math.cos(o*Math.PI/180));var o}}function Ob(u,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class jy{constructor(o,h,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||h<0||h>=Math.pow(2,o))throw new Error(`x=${h}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=h,this.y=p,this.key=nd(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const _=(x=this.y,E=this.z,P=Ob(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=Ob(256*(b+1),256*(x+1),E),P[0]+","+P[1]+","+A[0]+","+A[1]);var b,x,E,P,A;const N=function(O,G,H){let Y,ne="";for(let ue=O;ue>0;ue--)Y=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,_)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new I((o.x*h-this.x)*Nr,(o.y*h-this.y)*Nr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class zb{constructor(o,h){this.wrap=o,this.canonical=h,this.key=nd(o,h.z,h.z,h.x,h.y)}}class Ss{constructor(o,h,p,_,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new jy(p,+_,+b),this.key=nd(h,o,p,_,b)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-o;return o>this.canonical.z?new Ss(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?nd(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):nd(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new Ss(h,this.wrap,h,p,_),new Ss(h,this.wrap,h,p+1,_),new Ss(h,this.wrap,h,p,_+1),new Ss(h,this.wrap,h,p+1,_+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new ws({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(h){case-1:_=b-1;break;case 1:b=_+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const P=-h*this.dim,A=-p*this.dim;for(let N=x;N=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class Vb{constructor(o,h,p,_,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=_,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class Ub{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new dc(Nr,16,0),this.grid3D=new dc(Nr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,_,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,b);const P=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&P.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Eu.VectorTile(new Ay(this.rawTileData)).layers,this.sourceLayerCoder=new Bb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,_){this.loadVTLayers();const b=o.params||{},x=Nr/o.tileSize/o.scale,E=Eh(b.filter),P=o.queryGeometry,A=o.queryPadding*x,N=jb(P),O=this.grid.query(N.minX-A,N.minY-A,N.maxX+A,N.maxY+A),G=jb(o.cameraQueryGeometry),H=this.grid3D.query(G.minX-A,G.minY-A,G.maxX+A,G.maxY+A,(ue,ge,Re,ve)=>function(Te,Je,Qe,Et,Pt){for(const bt of Te)if(Je<=bt.x&&Qe<=bt.y&&Et>=bt.x&&Pt>=bt.y)return!0;const St=[new I(Je,Qe),new I(Je,Pt),new I(Et,Pt),new I(Et,Qe)];if(Te.length>2){for(const bt of St)if(qh(Te,bt))return!0}for(let bt=0;bt(ve||(ve=zl(Te)),Je.queryIntersectsFeature(P,Te,Qe,ve,this.z,o.transform,x,o.pixelPosMatrix)))}return Y}loadMatchingFeature(o,h,p,_,b,x,E,P,A,N,O){const G=this.bucketLayerIDs[h];if(x&&!function(ue,ge){for(let Re=0;Re=0)return!0;return!1}(x,G))return;const H=this.sourceLayerCoder.decode(p),Y=this.vtLayers[H].feature(_);if(b.needGeometry){const ue=Fl(Y,!0);if(!b.filter(new fr(this.tileID.overscaledZ),ue,this.tileID.canonical))return}else if(!b.filter(new fr(this.tileID.overscaledZ),Y))return;const ne=this.getId(Y,H);for(let ue=0;ue{const E=o instanceof gc?o.get(x):null;return E&&E.evaluate?E.evaluate(h,p,_):E})}function jb(u){let o=1/0,h=1/0,p=-1/0,_=-1/0;for(const b of u)o=Math.min(o,b.x),h=Math.min(h,b.y),p=Math.max(p,b.x),_=Math.max(_,b.y);return{minX:o,minY:h,maxX:p,maxY:_}}function NL(u,o){return o-u}function qb(u,o,h,p,_){const b=[];for(let x=0;x=p&&O.x>=p||(N.x>=p?N=new I(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round():O.x>=p&&(O=new I(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round()),N.y>=_&&O.y>=_||(N.y>=_?N=new I(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round():O.y>=_&&(O=new I(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round()),P&&N.equals(P[P.length-1])||(P=[N],b.push(P)),P.push(O)))))}}return b}Ct("FeatureIndex",Ub,{omit:["rawTileData","sourceLayerCoder"]});class Lu extends I{constructor(o,h,p,_){super(o,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new Lu(this.x,this.y,this.angle,this.segment)}}function Wb(u,o,h,p,_){if(o.segment===void 0||h===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-h/2;){if(x--,x<0)return!1;E-=u[x].dist(b),b=u[x]}E+=u[x].dist(u[x+1]),x++;const P=[];let A=0;for(;Ep;)A-=P.shift().angleDelta;if(A>_)return!1;x++,E+=N.dist(O)}return!0}function Hb(u){let o=0;for(let h=0;hA){const Y=(A-P)/H,ne=no.number(O.x,G.x,Y),ue=no.number(O.y,G.y,Y),ge=new Lu(ne,ue,G.angleTo(O),N);return ge._round(),!x||Wb(u,ge,E,x,o)?ge:void 0}P+=H}}function zL(u,o,h,p,_,b,x,E,P){const A=Zb(p,b,x),N=Xb(p,_),O=N*x,G=u[0].x===0||u[0].x===P||u[0].y===0||u[0].y===P;return o-O=0&&Te=0&&Je=0&&G+A<=N){const Qe=new Lu(Te,Je,Re,Y);Qe._round(),p&&!Wb(u,Qe,b,p,_)||H.push(Qe)}}O+=ge}return E||H.length||x||(H=Yb(u,O/2,h,p,_,b,x,!0,P)),H}Ct("Anchor",Lu);const Qh=Bo;function Kb(u,o,h,p){const _=[],b=u.image,x=b.pixelRatio,E=b.paddedRect.w-2*Qh,P=b.paddedRect.h-2*Qh,A=u.right-u.left,N=u.bottom-u.top,O=b.stretchX||[[0,E]],G=b.stretchY||[[0,P]],H=(ft,Tt)=>ft+Tt[1]-Tt[0],Y=O.reduce(H,0),ne=G.reduce(H,0),ue=E-Y,ge=P-ne;let Re=0,ve=Y,Te=0,Je=ne,Qe=0,Et=ue,Pt=0,St=ge;if(b.content&&p){const ft=b.content;Re=lg(O,0,ft[0]),Te=lg(G,0,ft[1]),ve=lg(O,ft[0],ft[2]),Je=lg(G,ft[1],ft[3]),Qe=ft[0]-Re,Pt=ft[1]-Te,Et=ft[2]-ft[0]-ve,St=ft[3]-ft[1]-Je}const bt=(ft,Tt,_t,at)=>{const Bt=ug(ft.stretch-Re,ve,A,u.left),kt=cg(ft.fixed-Qe,Et,ft.stretch,Y),gn=ug(Tt.stretch-Te,Je,N,u.top),ar=cg(Tt.fixed-Pt,St,Tt.stretch,ne),dr=ug(_t.stretch-Re,ve,A,u.left),hi=cg(_t.fixed-Qe,Et,_t.stretch,Y),is=ug(at.stretch-Te,Je,N,u.top),xo=cg(at.fixed-Pt,St,at.stretch,ne),si=new I(Bt,gn),Di=new I(dr,gn),Vi=new I(dr,is),wo=new I(Bt,is),So=new I(kt/x,ar/x),fi=new I(hi/x,xo/x),pi=o*Math.PI/180;if(pi){const oo=Math.sin(pi),Vo=Math.cos(pi),Uo=[Vo,-oo,oo,Vo];si._matMult(Uo),Di._matMult(Uo),wo._matMult(Uo),Vi._matMult(Uo)}const io=ft.stretch+ft.fixed,Eo=Tt.stretch+Tt.fixed;return{tl:si,tr:Di,bl:wo,br:Vi,tex:{x:b.paddedRect.x+Qh+io,y:b.paddedRect.y+Qh+Eo,w:_t.stretch+_t.fixed-io,h:at.stretch+at.fixed-Eo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:So,pixelOffsetBR:fi,minFontScaleX:Et/x/A,minFontScaleY:St/x/N,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ft=Jb(O,ue,Y),Tt=Jb(G,ge,ne);for(let _t=0;_t0&&(Y=Math.max(10,Y),this.circleDiameter=Y)}else{let O=x.top*E-P[0],G=x.bottom*E+P[2],H=x.left*E-P[3],Y=x.right*E+P[1];const ne=x.collisionPadding;if(ne&&(H-=ne[0]*E,O-=ne[1]*E,Y+=ne[2]*E,G+=ne[3]*E),N){const ue=new I(H,O),ge=new I(Y,O),Re=new I(H,G),ve=new I(Y,G),Te=N*Math.PI/180;ue._rotate(Te),ge._rotate(Te),Re._rotate(Te),ve._rotate(Te),H=Math.min(ue.x,ge.x,Re.x,ve.x),Y=Math.max(ue.x,ge.x,Re.x,ve.x),O=Math.min(ue.y,ge.y,Re.y,ve.y),G=Math.max(ue.y,ge.y,Re.y,ve.y)}o.emplaceBack(h.x,h.y,H,O,Y,G,p,_,b)}this.boxEndIndex=o.length}}class FL{constructor(o=[],h=BL){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,_=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(_,x)>=0)break;h[o]=x,o=b}h[o]=_}_down(o){const{data:h,compare:p}=this,_=this.length>>1,b=h[o];for(;o<_;){let x=1+(o<<1),E=h[x];const P=x+1;if(P=0)break;h[o]=E,o=x}h[o]=b}}function BL(u,o){return uo?1:0}function VL(u,o=1,h=!1){let p=1/0,_=1/0,b=-1/0,x=-1/0;const E=u[0];for(let H=0;Hb)&&(b=Y.x),(!H||Y.y>x)&&(x=Y.y)}const P=Math.min(b-p,x-_);let A=P/2;const N=new FL([],UL);if(P===0)return new I(p,_);for(let H=p;HO.d||!O.d)&&(O=H,h&&console.log("found best %d after %d probes",Math.round(1e4*H.d)/1e4,G)),H.max-O.d<=o||(A=H.h/2,N.push(new $h(H.p.x-A,H.p.y-A,A,u)),N.push(new $h(H.p.x+A,H.p.y-A,A,u)),N.push(new $h(H.p.x-A,H.p.y+A,A,u)),N.push(new $h(H.p.x+A,H.p.y+A,A,u)),G+=4)}return h&&(console.log(`num probes: ${G}`),console.log(`best distance: ${O.d}`)),O.p}function UL(u,o){return o.max-u.max}function $h(u,o,h,p){this.p=new I(u,o),this.h=h,this.d=function(_,b){let x=!1,E=1/0;for(let P=0;P_.y!=Y.y>_.y&&_.x<(Y.x-H.x)*(_.y-H.y)/(Y.y-H.y)+H.x&&(x=!x),E=Math.min(E,R1(_,H,Y))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Bi;c.ap=void 0,(Bi=c.ap||(c.ap={}))[Bi.center=1]="center",Bi[Bi.left=2]="left",Bi[Bi.right=3]="right",Bi[Bi.top=4]="top",Bi[Bi.bottom=5]="bottom",Bi[Bi["top-left"]=6]="top-left",Bi[Bi["top-right"]=7]="top-right",Bi[Bi["bottom-left"]=8]="bottom-left",Bi[Bi["bottom-right"]=9]="bottom-right";const Pu=7,qy=Number.POSITIVE_INFINITY;function Qb(u,o){return o[1]!==qy?function(h,p,_){let b=0,x=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":x=_-Pu;break;case"bottom-right":case"bottom-left":case"bottom":x=-_+Pu}switch(h){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(u,o[0],o[1]):function(h,p){let _=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-Pu;break;case"bottom-right":case"bottom-left":b=-x+Pu;break;case"bottom":b=-p+Pu;break;case"top":b=p-Pu}switch(h){case"top-right":case"bottom-right":_=-x;break;case"top-left":case"bottom-left":_=x;break;case"left":_=p;break;case"right":_=-p}return[_,b]}(u,o[0])}function $b(u,o,h){var p;const _=u.layout,b=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const E=b.values,P=[];for(let A=0;AG*ci);N.startsWith("top")?O[1]-=Pu:N.startsWith("bottom")&&(O[1]+=Pu),P[A+1]=O}return new es(P)}const x=_.get("text-variable-anchor");if(x){let E;E=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(o,{},h)*ci,qy]:_.get("text-offset").evaluate(o,{},h).map(A=>A*ci);const P=[];for(const A of x)P.push(A,Qb(A,E));return new es(P)}return null}function Wy(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function GL(u,o,h,p,_,b,x,E,P,A,N){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const G=u.layers[0].layout,H=G.get("icon-offset").evaluate(o,{},N),Y=tx(h.horizontal),ne=x/24,ue=u.tilePixelRatio*ne,ge=u.tilePixelRatio*O/24,Re=u.tilePixelRatio*E,ve=u.tilePixelRatio*G.get("symbol-spacing"),Te=G.get("text-padding")*u.tilePixelRatio,Je=function(at,Bt,kt,gn=1){const ar=at.get("icon-padding").evaluate(Bt,{},kt),dr=ar&&ar.values;return[dr[0]*gn,dr[1]*gn,dr[2]*gn,dr[3]*gn]}(G,o,N,u.tilePixelRatio),Qe=G.get("text-max-angle")/180*Math.PI,Et=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Pt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",St=G.get("symbol-placement"),bt=ve/2,ft=G.get("icon-text-fit");let Tt;p&&ft!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(Tt=Eb(p,h.vertical,ft,G.get("icon-text-fit-padding"),H,ne)),Y&&(p=Eb(p,Y,ft,G.get("icon-text-fit-padding"),H,ne)));const _t=(at,Bt)=>{Bt.x<0||Bt.x>=Nr||Bt.y<0||Bt.y>=Nr||function(kt,gn,ar,dr,hi,is,xo,si,Di,Vi,wo,So,fi,pi,io,Eo,oo,Vo,Uo,di,wn,so,Ui,mi,Zs){const Sa=kt.addToLineVertexArray(gn,ar);let Ea,Vl,Xs,Es,Go=0,Ul=0,od=0,ox=0,$y=-1,e0=-1;const Gl={};let sx=Lr("");if(kt.allowVerticalPlacement&&dr.vertical){const ao=si.layout.get("text-rotate").evaluate(wn,{},mi)+90;Xs=new hg(Di,gn,Vi,wo,So,dr.vertical,fi,pi,io,ao),xo&&(Es=new hg(Di,gn,Vi,wo,So,xo,oo,Vo,io,ao))}if(hi){const ao=si.layout.get("icon-rotate").evaluate(wn,{}),Is=si.layout.get("icon-text-fit")!=="none",Ic=Kb(hi,ao,Ui,Is),Ca=xo?Kb(xo,ao,Ui,Is):void 0;Vl=new hg(Di,gn,Vi,wo,So,hi,oo,Vo,!1,ao),Go=4*Ic.length;const Cc=kt.iconSizeData;let il=null;Cc.kind==="source"?(il=[rl*si.layout.get("icon-size").evaluate(wn,{})],il[0]>Cu&&Ye(`${kt.layerIds[0]}: Value for "icon-size" is >= ${td}. Reduce your "icon-size".`)):Cc.kind==="composite"&&(il=[rl*so.compositeIconSizes[0].evaluate(wn,{},mi),rl*so.compositeIconSizes[1].evaluate(wn,{},mi)],(il[0]>Cu||il[1]>Cu)&&Ye(`${kt.layerIds[0]}: Value for "icon-size" is >= ${td}. Reduce your "icon-size".`)),kt.addSymbols(kt.icon,Ic,il,di,Uo,wn,c.ah.none,gn,Sa.lineStartIndex,Sa.lineLength,-1,mi),$y=kt.icon.placedSymbolArray.length-1,Ca&&(Ul=4*Ca.length,kt.addSymbols(kt.icon,Ca,il,di,Uo,wn,c.ah.vertical,gn,Sa.lineStartIndex,Sa.lineLength,-1,mi),e0=kt.icon.placedSymbolArray.length-1)}const ax=Object.keys(dr.horizontal);for(const ao of ax){const Is=dr.horizontal[ao];if(!Ea){sx=Lr(Is.text);const Ca=si.layout.get("text-rotate").evaluate(wn,{},mi);Ea=new hg(Di,gn,Vi,wo,So,Is,fi,pi,io,Ca)}const Ic=Is.positionedLines.length===1;if(od+=ex(kt,gn,Is,is,si,io,wn,Eo,Sa,dr.vertical?c.ah.horizontal:c.ah.horizontalOnly,Ic?ax:[ao],Gl,$y,so,mi),Ic)break}dr.vertical&&(ox+=ex(kt,gn,dr.vertical,is,si,io,wn,Eo,Sa,c.ah.vertical,["vertical"],Gl,e0,so,mi));const WL=Ea?Ea.boxStartIndex:kt.collisionBoxArray.length,HL=Ea?Ea.boxEndIndex:kt.collisionBoxArray.length,ZL=Xs?Xs.boxStartIndex:kt.collisionBoxArray.length,XL=Xs?Xs.boxEndIndex:kt.collisionBoxArray.length,YL=Vl?Vl.boxStartIndex:kt.collisionBoxArray.length,KL=Vl?Vl.boxEndIndex:kt.collisionBoxArray.length,JL=Es?Es.boxStartIndex:kt.collisionBoxArray.length,QL=Es?Es.boxEndIndex:kt.collisionBoxArray.length;let Ia=-1;const pg=(ao,Is)=>ao&&ao.circleDiameter?Math.max(ao.circleDiameter,Is):Is;Ia=pg(Ea,Ia),Ia=pg(Xs,Ia),Ia=pg(Vl,Ia),Ia=pg(Es,Ia);const lx=Ia>-1?1:0;lx&&(Ia*=Zs/ci),kt.glyphOffsetArray.length>=Jh.MAX_GLYPHS&&Ye("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wn.sortKey!==void 0&&kt.addToSortKeyRanges(kt.symbolInstances.length,wn.sortKey);const $L=$b(si,wn,mi),[eP,tP]=function(ao,Is){const Ic=ao.length,Ca=Is==null?void 0:Is.values;if((Ca==null?void 0:Ca.length)>0)for(let Cc=0;Cc=0?Gl.right:-1,Gl.center>=0?Gl.center:-1,Gl.left>=0?Gl.left:-1,Gl.vertical||-1,$y,e0,sx,WL,HL,ZL,XL,YL,KL,JL,QL,Vi,od,ox,Go,Ul,lx,0,fi,Ia,eP,tP)}(u,Bt,at,h,p,_,Tt,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ue,[Te,Te,Te,Te],Et,P,Re,Je,Pt,H,o,b,A,N,x)};if(St==="line")for(const at of qb(o.geometry,0,0,Nr,Nr)){const Bt=zL(at,ve,Qe,h.vertical||Y,p,24,ge,u.overscaling,Nr);for(const kt of Bt)Y&&jL(u,Y.text,bt,kt)||_t(at,kt)}else if(St==="line-center"){for(const at of o.geometry)if(at.length>1){const Bt=OL(at,Qe,h.vertical||Y,p,24,ge);Bt&&_t(at,Bt)}}else if(o.type==="Polygon")for(const at of Sy(o.geometry,0)){const Bt=VL(at,16);_t(at[0],new Lu(Bt.x,Bt.y,0))}else if(o.type==="LineString")for(const at of o.geometry)_t(at,new Lu(at[0].x,at[0].y,0));else if(o.type==="Point")for(const at of o.geometry)for(const Bt of at)_t([Bt],new Lu(Bt.x,Bt.y,0))}function ex(u,o,h,p,_,b,x,E,P,A,N,O,G,H,Y){const ne=function(Re,ve,Te,Je,Qe,Et,Pt,St){const bt=Je.layout.get("text-rotate").evaluate(Et,{})*Math.PI/180,ft=[];for(const Tt of ve.positionedLines)for(const _t of Tt.positionedGlyphs){if(!_t.rect)continue;const at=_t.rect||{};let Bt=_b+1,kt=!0,gn=1,ar=0;const dr=(Qe||St)&&_t.vertical,hi=_t.metrics.advance*_t.scale/2;if(St&&ve.verticalizable&&(ar=Tt.lineOffset/2-(_t.imageName?-(ci-_t.metrics.width*_t.scale)/2:(_t.scale-1)*ci)),_t.imageName){const di=Pt[_t.imageName];kt=di.sdf,gn=di.pixelRatio,Bt=Bo/gn}const is=Qe?[_t.x+hi,_t.y]:[0,0];let xo=Qe?[0,0]:[_t.x+hi+Te[0],_t.y+Te[1]-ar],si=[0,0];dr&&(si=xo,xo=[0,0]);const Di=_t.metrics.isDoubleResolution?2:1,Vi=(_t.metrics.left-Bt)*_t.scale-hi+xo[0],wo=(-_t.metrics.top-Bt)*_t.scale+xo[1],So=Vi+at.w/Di*_t.scale/gn,fi=wo+at.h/Di*_t.scale/gn,pi=new I(Vi,wo),io=new I(So,wo),Eo=new I(Vi,fi),oo=new I(So,fi);if(dr){const di=new I(-hi,hi-$p),wn=-Math.PI/2,so=ci/2-hi,Ui=new I(5-$p-so,-(_t.imageName?so:0)),mi=new I(...si);pi._rotateAround(wn,di)._add(Ui)._add(mi),io._rotateAround(wn,di)._add(Ui)._add(mi),Eo._rotateAround(wn,di)._add(Ui)._add(mi),oo._rotateAround(wn,di)._add(Ui)._add(mi)}if(bt){const di=Math.sin(bt),wn=Math.cos(bt),so=[wn,-di,di,wn];pi._matMult(so),io._matMult(so),Eo._matMult(so),oo._matMult(so)}const Vo=new I(0,0),Uo=new I(0,0);ft.push({tl:pi,tr:io,bl:Eo,br:oo,tex:at,writingMode:ve.writingMode,glyphOffset:is,sectionIndex:_t.sectionIndex,isSDF:kt,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return ft}(0,h,E,_,b,x,p,u.allowVerticalPlacement),ue=u.textSizeData;let ge=null;ue.kind==="source"?(ge=[rl*_.layout.get("text-size").evaluate(x,{})],ge[0]>Cu&&Ye(`${u.layerIds[0]}: Value for "text-size" is >= ${td}. Reduce your "text-size".`)):ue.kind==="composite"&&(ge=[rl*H.compositeTextSizes[0].evaluate(x,{},Y),rl*H.compositeTextSizes[1].evaluate(x,{},Y)],(ge[0]>Cu||ge[1]>Cu)&&Ye(`${u.layerIds[0]}: Value for "text-size" is >= ${td}. Reduce your "text-size".`)),u.addSymbols(u.text,ne,ge,E,b,x,A,o,P.lineStartIndex,P.lineLength,G,Y);for(const Re of N)O[Re]=u.text.placedSymbolArray.length-1;return 4*ne.length}function tx(u){for(const o in u)return u[o];return null}function jL(u,o,h,p){const _=u.compareText;if(o in _){const b=_[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const b=nx[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new Hy(E,x,b,o)}constructor(o,h=64,p=Float64Array,_){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=nx.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+P,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+P),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+P,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return Zy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,P=[0,b.length-1,0],A=[];for(;P.length;){const N=P.pop()||0,O=P.pop()||0,G=P.pop()||0;if(O-G<=E){for(let ue=G;ue<=O;ue++){const ge=x[2*ue],Re=x[2*ue+1];ge>=o&&ge<=p&&Re>=h&&Re<=_&&A.push(b[ue])}continue}const H=G+O>>1,Y=x[2*H],ne=x[2*H+1];Y>=o&&Y<=p&&ne>=h&&ne<=_&&A.push(b[H]),(N===0?o<=Y:h<=ne)&&(P.push(G),P.push(H-1),P.push(1-N)),(N===0?p>=Y:_>=ne)&&(P.push(H+1),P.push(O),P.push(1-N))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:b,nodeSize:x}=this,E=[0,_.length-1,0],P=[],A=p*p;for(;E.length;){const N=E.pop()||0,O=E.pop()||0,G=E.pop()||0;if(O-G<=x){for(let ue=G;ue<=O;ue++)ix(b[2*ue],b[2*ue+1],o,h)<=A&&P.push(_[ue]);continue}const H=G+O>>1,Y=b[2*H],ne=b[2*H+1];ix(Y,ne,o,h)<=A&&P.push(_[H]),(N===0?o-p<=Y:h-p<=ne)&&(E.push(G),E.push(H-1),E.push(1-N)),(N===0?o+p>=Y:h+p>=ne)&&(E.push(H+1),E.push(O),E.push(1-N))}return P}}function Zy(u,o,h,p,_,b){if(_-p<=h)return;const x=p+_>>1;rx(u,o,x,p,_,b),Zy(u,o,h,p,x-1,1-b),Zy(u,o,h,x+1,_,1-b)}function rx(u,o,h,p,_,b){for(;_>p;){if(_-p>600){const A=_-p+1,N=h-p+1,O=Math.log(A),G=.5*Math.exp(2*O/3),H=.5*Math.sqrt(O*G*(A-G)/A)*(N-A/2<0?-1:1);rx(u,o,h,Math.max(p,Math.floor(h-N*G/A+H)),Math.min(_,Math.floor(h+(A-N)*G/A+H)),b)}const x=o[2*h+b];let E=p,P=_;for(rd(u,o,p,h),o[2*_+b]>x&&rd(u,o,p,_);Ex;)P--}o[2*p+b]===x?rd(u,o,p,P):(P++,rd(u,o,P,_)),P<=h&&(p=P+1),h<=P&&(_=P-1)}}function rd(u,o,h,p){Xy(u,h,p),Xy(o,2*h,2*p),Xy(o,2*h+1,2*p+1)}function Xy(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function ix(u,o,h,p){const _=u-h,b=o-p;return _*_+b*b}var Yy;c.bd=void 0,(Yy=c.bd||(c.bd={})).create="create",Yy.load="load",Yy.fullLoad="fullLoad";let fg=null,id=[];const Ky=1e3/60,Jy="loadTime",Qy="fullLoadTime",qL={mark(u){performance.mark(u)},frame(u){const o=u;fg!=null&&id.push(o-fg),fg=o},clearMetrics(){fg=null,id=[],performance.clearMeasures(Jy),performance.clearMeasures(Qy);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(Jy,c.bd.create,c.bd.load),performance.measure(Qy,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(Jy)[0].duration,o=performance.getEntriesByName(Qy)[0].duration,h=id.length,p=1/(id.reduce((b,x)=>b+x,0)/h/1e3),_=id.filter(b=>b>Ky).reduce((b,x)=>b+(x-Ky)/Ky,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};c.$=mt,c.A=Wh,c.B=function(u){if(Ne==null){const o=u.navigator?u.navigator.userAgent:null;Ne=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Ne},c.C=class{constructor(u,o){this.target=u,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new RL(()=>this.process()),this.subscription=function(h,p,_,b){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Xe(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const E={id:_,type:"",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},u),{id:_,sourceMapId:this.mapId,origin:location.origin,data:bu(u.data,b)});this.target.postMessage(x,{transfer:b})})}receive(u){const o=u.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Xe(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const u=this.taskQueue.shift(),o=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(u,o)}processTask(u,o){return l(this,void 0,void 0,function*(){if(o.type===""){const _=this.resolveRejects[u];return delete this.resolveRejects[u],_?void(o.error?_.reject(xu(o.error)):_.resolve(xu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=xu(o.data),p=new AbortController;this.abortControllers[u]=p;try{const _=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,_)}catch(_){this.completeTask(u,_)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const _={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?bu(o):null,data:bu(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Rt,c.E=xn,c.F=function(){var u=new Wh(16);return Wh!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},c.G=Bn,c.H=function(u,o,h){var p,_,b,x,E,P,A,N,O,G,H,Y,ne=h[0],ue=h[1],ge=h[2];return o===u?(u[12]=o[0]*ne+o[4]*ue+o[8]*ge+o[12],u[13]=o[1]*ne+o[5]*ue+o[9]*ge+o[13],u[14]=o[2]*ne+o[6]*ue+o[10]*ge+o[14],u[15]=o[3]*ne+o[7]*ue+o[11]*ge+o[15]):(_=o[1],b=o[2],x=o[3],E=o[4],P=o[5],A=o[6],N=o[7],O=o[8],G=o[9],H=o[10],Y=o[11],u[0]=p=o[0],u[1]=_,u[2]=b,u[3]=x,u[4]=E,u[5]=P,u[6]=A,u[7]=N,u[8]=O,u[9]=G,u[10]=H,u[11]=Y,u[12]=p*ne+E*ue+O*ge+o[12],u[13]=_*ne+P*ue+G*ge+o[13],u[14]=b*ne+A*ue+H*ge+o[14],u[15]=x*ne+N*ue+Y*ge+o[15]),u},c.I=Dy,c.J=function(u,o,h){var p=h[0],_=h[1],b=h[2];return u[0]=o[0]*p,u[1]=o[1]*p,u[2]=o[2]*p,u[3]=o[3]*p,u[4]=o[4]*_,u[5]=o[5]*_,u[6]=o[6]*_,u[7]=o[7]*_,u[8]=o[8]*b,u[9]=o[9]*b,u[10]=o[10]*b,u[11]=o[11]*b,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},c.K=F1,c.L=function(u,o){const h={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of u){const _=window.document.createElement("source");cr(p)||(o.crossOrigin="Anonymous"),_.src=p,o.appendChild(_)}})},c.a3=function(){return ie++},c.a4=y,c.a5=Jh,c.a6=Eh,c.a7=Fl,c.a8=fr,c.a9=Vb,c.aA=X,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!fn(u.version,o.version))return[{command:"setStyle",args:[o]}];fn(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),fn(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),fn(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),fn(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),fn(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),fn(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),fn(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),fn(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),fn(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),fn(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},_=[];(function(x,E,P,A){let N;for(N in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,N)&&(Object.prototype.hasOwnProperty.call(E,N)||gs(N,P,A));for(N in E)Object.prototype.hasOwnProperty.call(E,N)&&(Object.prototype.hasOwnProperty.call(x,N)?fn(x[N],E[N])||(x[N].type==="geojson"&&E[N].type==="geojson"&&Za(x,E,N)?tr(P,{command:"setGeoJSONSourceData",args:[N,E[N].data]}):Bs(N,E,P,A)):Do(N,E,P))})(u.sources,o.sources,_,p);const b=[];u.layers&&u.layers.forEach(x=>{"source"in x&&p[x.source]?h.push({command:"removeLayer",args:[x.id]}):b.push(x)}),h=h.concat(_),function(x,E,P){E=E||[];const A=(x=x||[]).map(Tl),N=E.map(Tl),O=x.reduce(_s,{}),G=E.reduce(_s,{}),H=A.slice(),Y=Object.create(null);let ne,ue,ge,Re,ve;for(let Te=0,Je=0;Te@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,b)=>{const x=_||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=ce,c.ad=function(u,o,h){var p=Math.sin(h),_=Math.cos(h),b=o[0],x=o[1],E=o[2],P=o[3],A=o[4],N=o[5],O=o[6],G=o[7];return o!==u&&(u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[0]=b*_+A*p,u[1]=x*_+N*p,u[2]=E*_+O*p,u[3]=P*_+G*p,u[4]=A*_-b*p,u[5]=N*_-x*p,u[6]=O*_-E*p,u[7]=G*_-P*p,u},c.ae=function(u){var o=new Wh(16);return o[0]=u[0],o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=u[6],o[7]=u[7],o[8]=u[8],o[9]=u[9],o[10]=u[10],o[11]=u[11],o[12]=u[12],o[13]=u[13],o[14]=u[14],o[15]=u[15],o},c.af=Km,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:_,minZoom:b,maxZoom:x}=u,E=_?ce(Fi.interpolationFactor(_,o,b,x),0,1):0;u.kind==="camera"?p=no.number(u.minSize,u.maxSize,E):h=E}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:_}){return u.kind==="source"?p/rl:u.kind==="composite"?no.number(p/rl,_/rl,h):o},c.aj=zy,c.ak=function(u,o,h,p){const _=o.y-u.y,b=o.x-u.x,x=p.y-h.y,E=p.x-h.x,P=x*b-E*_;if(P===0)return null;const A=(E*(u.y-h.y)-x*(u.x-h.x))/P;return new I(u.x+A*b,u.y+A*_)},c.al=qb,c.am=Bp,c.an=gy,c.ao=ci,c.aq=Oy,c.ar=function(u,o){var h=o[0],p=o[1],_=o[2],b=o[3],x=o[4],E=o[5],P=o[6],A=o[7],N=o[8],O=o[9],G=o[10],H=o[11],Y=o[12],ne=o[13],ue=o[14],ge=o[15],Re=h*E-p*x,ve=h*P-_*x,Te=h*A-b*x,Je=p*P-_*E,Qe=p*A-b*E,Et=_*A-b*P,Pt=N*ne-O*Y,St=N*ue-G*Y,bt=N*ge-H*Y,ft=O*ue-G*ne,Tt=O*ge-H*ne,_t=G*ge-H*ue,at=Re*_t-ve*Tt+Te*ft+Je*bt-Qe*St+Et*Pt;return at?(u[0]=(E*_t-P*Tt+A*ft)*(at=1/at),u[1]=(_*Tt-p*_t-b*ft)*at,u[2]=(ne*Et-ue*Qe+ge*Je)*at,u[3]=(G*Qe-O*Et-H*Je)*at,u[4]=(P*bt-x*_t-A*St)*at,u[5]=(h*_t-_*bt+b*St)*at,u[6]=(ue*Te-Y*Et-ge*ve)*at,u[7]=(N*Et-G*Te+H*ve)*at,u[8]=(x*Tt-E*bt+A*Pt)*at,u[9]=(p*bt-h*Tt-b*Pt)*at,u[10]=(Y*Qe-ne*Te+ge*Re)*at,u[11]=(O*Te-N*Qe-H*Re)*at,u[12]=(E*St-x*ft-P*Pt)*at,u[13]=(h*ft-p*St+_*Pt)*at,u[14]=(ne*ve-Y*Je-ue*Re)*at,u[15]=(N*Je-O*ve+G*Re)*at,u):null},c.as=Wy,c.at=Ny,c.au=Hy,c.av=function(){const u={},o=ze.$version;for(const h in ze.$root){const p=ze.$root[h];if(p.required){let _=null;_=h==="version"?o:p.type==="array"?[]:{},_!=null&&(u[h]=_)}}return u},c.aw=Om,c.ax=$r,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hat*ci)}let St=x?"center":h.get("text-justify").evaluate(A,{},u.canonical);const bt=h.get("symbol-placement"),ft=bt==="point"?h.get("text-max-width").evaluate(A,{},u.canonical)*ci:0,Tt=()=>{u.bucket.allowVerticalPlacement&&wu(Te)&&(Y.vertical=rg(ne,u.glyphMap,u.glyphPositions,u.imagePositions,N,ft,b,Et,"left",Qe,ge,c.ah.vertical,!0,bt,G,O))};if(!x&&Pt){const _t=new Set;if(St==="auto")for(let Bt=0;Btl(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(u)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=de,c.f=u=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=ht})},p.onerror=()=>h(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const _=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(_):ht}),c.g=mn,c.h=(u,o)=>_r(de(u,{type:"json"}),o),c.i=Xe,c.j=vt,c.k=Ce,c.l=(u,o)=>_r(de(u,{type:"arrayBuffer"}),o),c.m=_r,c.n=function(u){return new Ay(u).readFields(vL,[])},c.o=Wp,c.p=yb,c.q=vo,c.r=fy,c.s=cr,c.t=vu,c.u=wt,c.v=ze,c.w=Ye,c.x=Rl,c.y=function([u,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(h),y:u*Math.sin(o)*Math.sin(h),z:u*Math.cos(h)}},c.z=no}),i("worker",["./shared"],function(c){class l{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,W){for(const oe of V){this._layerConfigs[oe.id]=oe;const Ee=this._layers[oe.id]=c.az(oe);Ee._featureFilter=c.a6(Ee.filter),this.keyCache[oe.id]&&delete this.keyCache[oe.id]}for(const oe of W)delete this.keyCache[oe],delete this._layerConfigs[oe],delete this._layers[oe];this.familiesBySource={};const K=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const oe of K){const Ee=oe.map(He=>this._layers[He.id]),Q=Ee[0];if(Q.visibility==="none")continue;const Ie=Q.source||"";let ye=this.familiesBySource[Ie];ye||(ye=this.familiesBySource[Ie]={});const De=Q.sourceLayer||"_geojsonTileLayer";let je=ye[De];je||(je=ye[De]=[]),je.push(Ee)}}}class d{constructor(V){const W={},K=[];for(const Ie in V){const ye=V[Ie],De=W[Ie]={};for(const je in ye){const He=ye[+je];if(!He||He.bitmap.width===0||He.bitmap.height===0)continue;const Ke={x:0,y:0,w:He.bitmap.width+2,h:He.bitmap.height+2};K.push(Ke),De[je]={rect:Ke,metrics:He.metrics}}}const{w:oe,h:Ee}=c.p(K),Q=new c.o({width:oe||1,height:Ee||1});for(const Ie in V){const ye=V[Ie];for(const De in ye){const je=ye[+De];if(!je||je.bitmap.width===0||je.bitmap.height===0)continue;const He=W[Ie][De].rect;c.o.copy(je.bitmap,Q,{x:0,y:0},{x:He.x+1,y:He.y+1},je.bitmap)}}this.image=Q,this.positions=W}}c.bi("GlyphAtlas",d);class w{constructor(V){this.tileID=new c.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,W,K,oe){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new c.a4;const Ee=new c.bj(Object.keys(V.layers).sort()),Q=new c.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const Ie={},ye={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},De=W.familiesBySource[this.source];for(const cn in De){const Ir=V.layers[cn];if(!Ir)continue;Ir.version===1&&c.w(`Vector tile source "${this.source}" layer "${cn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ai=Ee.encode(cn),to=[];for(let go=0;go=wi.maxzoom||wi.visibility!=="none"&&(S(go,this.zoom,K),(Ie[wi.id]=wi.createBucket({index:Q.bucketLayerIDs.length,layers:go,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(to,ye,this.tileID.canonical),Q.bucketLayerIDs.push(go.map(Vs=>Vs.id)))}}const je=c.aE(ye.glyphDependencies,cn=>Object.keys(cn).map(Number));this.inFlightDependencies.forEach(cn=>cn==null?void 0:cn.abort()),this.inFlightDependencies=[];let He=Promise.resolve({});if(Object.keys(je).length){const cn=new AbortController;this.inFlightDependencies.push(cn),He=oe.sendAsync({type:"GG",data:{stacks:je,source:this.source,tileID:this.tileID,type:"glyphs"}},cn)}const Ke=Object.keys(ye.iconDependencies);let At=Promise.resolve({});if(Ke.length){const cn=new AbortController;this.inFlightDependencies.push(cn),At=oe.sendAsync({type:"GI",data:{icons:Ke,source:this.source,tileID:this.tileID,type:"icons"}},cn)}const Nt=Object.keys(ye.patternDependencies);let Yt=Promise.resolve({});if(Nt.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Yt=oe.sendAsync({type:"GI",data:{icons:Nt,source:this.source,tileID:this.tileID,type:"patterns"}},cn)}const[Qt,En,Yn]=yield Promise.all([He,At,Yt]),hr=new d(Qt),ti=new c.bl(En,Yn);for(const cn in Ie){const Ir=Ie[cn];Ir instanceof c.a5?(S(Ir.layers,this.zoom,K),c.bm({bucket:Ir,glyphMap:Qt,glyphPositions:hr.positions,imageMap:En,imagePositions:ti.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ir.hasPattern&&(Ir instanceof c.bn||Ir instanceof c.bo||Ir instanceof c.bp)&&(S(Ir.layers,this.zoom,K),Ir.addFeatures(ye,this.tileID.canonical,ti.patternPositions))}return this.status="done",{buckets:Object.values(Ie).filter(cn=>!cn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:hr.image,imageAtlas:ti,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?En:null,glyphPositions:this.returnDependencies?hr.positions:null}})}}function S(he,V,W){const K=new c.a8(V);for(const oe of he)oe.recalculate(K,W)}class I{constructor(V,W,K){this.actor=V,this.layerIndex=W,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,W){return c._(this,void 0,void 0,function*(){const K=yield c.l(V.request,W);try{return{vectorTile:new c.bq.VectorTile(new c.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(oe){const Ee=new Uint8Array(K.data);let Q=`Unable to parse the tile at ${V.request.url}, `;throw Q+=Ee[0]===31&&Ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${oe.messge}`,new Error(Q)}})}loadTile(V){return c._(this,void 0,void 0,function*(){const W=V.uid,K=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request),oe=new w(V);this.loading[W]=oe;const Ee=new AbortController;oe.abort=Ee;try{const Q=yield this.loadVectorTile(V,Ee);if(delete this.loading[W],!Q)return null;const Ie=Q.rawData,ye={};Q.expires&&(ye.expires=Q.expires),Q.cacheControl&&(ye.cacheControl=Q.cacheControl);const De={};if(K){const He=K.finish();He&&(De.resourceTiming=JSON.parse(JSON.stringify(He)))}oe.vectorTile=Q.vectorTile;const je=oe.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=oe,this.fetching[W]={rawTileData:Ie,cacheControl:ye,resourceTiming:De};try{const He=yield je;return c.e({rawTileData:Ie.slice(0)},He,ye,De)}finally{delete this.fetching[W]}}catch(Q){throw delete this.loading[W],oe.status="done",this.loaded[W]=oe,Q}})}reloadTile(V){return c._(this,void 0,void 0,function*(){const W=V.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[W];if(K.showCollisionBoxes=V.showCollisionBoxes,K.status==="parsing"){const oe=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let Ee;if(this.fetching[W]){const{rawTileData:Q,cacheControl:Ie,resourceTiming:ye}=this.fetching[W];delete this.fetching[W],Ee=c.e({rawTileData:Q.slice(0)},oe,Ie,ye)}else Ee=oe;return Ee}if(K.status==="done"&&K.vectorTile)return K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return c._(this,void 0,void 0,function*(){const W=this.loading,K=V.uid;W&&W[K]&&W[K].abort&&(W[K].abort.abort(),delete W[K])})}removeTile(V){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class T{constructor(){this.loaded={}}loadTile(V){return c._(this,void 0,void 0,function*(){const{uid:W,encoding:K,rawImageData:oe,redFactor:Ee,greenFactor:Q,blueFactor:Ie,baseShift:ye}=V,De=oe.width+2,je=oe.height+2,He=c.b(oe)?new c.R({width:De,height:je},yield c.bt(oe,-1,-1,De,je)):oe,Ke=new c.bu(W,He,K,Ee,Q,Ie,ye);return this.loaded=this.loaded||{},this.loaded[W]=Ke,Ke})}removeTile(V){const W=this.loaded,K=V.uid;W&&W[K]&&delete W[K]}}function k(he,V){if(he.length!==0){D(he[0],V);for(var W=1;W=Math.abs(Ie)?W-ye+Ie:Ie-ye+W,W=ye}W+K>=0!=!!V&&he.reverse()}var U=c.bv(function he(V,W){var K,oe=V&&V.type;if(oe==="FeatureCollection")for(K=0;K>31}function Ge(he,V){for(var W=he.loadGeometry(),K=he.type,oe=0,Ee=0,Q=W.length,Ie=0;Iehe},ht=Math.fround||(Gt=new Float32Array(1),he=>(Gt[0]=+he,Gt[0]));var Gt;const Ht=3,Dt=5,un=6;class Fn{constructor(V){this.options=Object.assign(Object.create($e),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:W,minZoom:K,maxZoom:oe}=this.options;W&&console.time("total time");const Ee=`prepare ${V.length} points`;W&&console.time(Ee),this.points=V;const Q=[];for(let ye=0;ye=K;ye--){const De=+Date.now();Ie=this.trees[ye]=this._createTree(this._cluster(Ie,ye)),W&&console.log("z%d: %d clusters in %dms",ye,Ie.numItems,+Date.now()-De)}return W&&console.timeEnd("total time"),this}getClusters(V,W){let K=((V[0]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,V[1]));let Ee=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)K=-180,Ee=180;else if(K>Ee){const He=this.getClusters([K,oe,180,Q],W),Ke=this.getClusters([-180,oe,Ee,Q],W);return He.concat(Ke)}const Ie=this.trees[this._limitZoom(W)],ye=Ie.range(Bn(K),ir(Q),Bn(Ee),ir(oe)),De=Ie.data,je=[];for(const He of ye){const Ke=this.stride*He;je.push(De[Ke+Dt]>1?bn(De,Ke,this.clusterProps):this.points[De[Ke+Ht]])}return je}getChildren(V){const W=this._getOriginId(V),K=this._getOriginZoom(V),oe="No cluster with the specified id.",Ee=this.trees[K];if(!Ee)throw new Error(oe);const Q=Ee.data;if(W*this.stride>=Q.length)throw new Error(oe);const Ie=this.options.radius/(this.options.extent*Math.pow(2,K-1)),ye=Ee.within(Q[W*this.stride],Q[W*this.stride+1],Ie),De=[];for(const je of ye){const He=je*this.stride;Q[He+4]===V&&De.push(Q[He+Dt]>1?bn(Q,He,this.clusterProps):this.points[Q[He+Ht]])}if(De.length===0)throw new Error(oe);return De}getLeaves(V,W,K){const oe=[];return this._appendLeaves(oe,V,W=W||10,K=K||0,0),oe}getTile(V,W,K){const oe=this.trees[this._limitZoom(V)],Ee=Math.pow(2,V),{extent:Q,radius:Ie}=this.options,ye=Ie/Q,De=(K-ye)/Ee,je=(K+1+ye)/Ee,He={features:[]};return this._addTileFeatures(oe.range((W-ye)/Ee,De,(W+1+ye)/Ee,je),oe.data,W,K,Ee,He),W===0&&this._addTileFeatures(oe.range(1-ye/Ee,De,1,je),oe.data,Ee,K,Ee,He),W===Ee-1&&this._addTileFeatures(oe.range(0,De,ye/Ee,je),oe.data,-1,K,Ee,He),He.features.length?He:null}getClusterExpansionZoom(V){let W=this._getOriginZoom(V)-1;for(;W<=this.options.maxZoom;){const K=this.getChildren(V);if(W++,K.length!==1)break;V=K[0].properties.cluster_id}return W}_appendLeaves(V,W,K,oe,Ee){const Q=this.getChildren(W);for(const Ie of Q){const ye=Ie.properties;if(ye&&ye.cluster?Ee+ye.point_count<=oe?Ee+=ye.point_count:Ee=this._appendLeaves(V,ye.cluster_id,K,oe,Ee):Ee1;let je,He,Ke;if(De)je=mn(W,ye,this.clusterProps),He=W[ye],Ke=W[ye+1];else{const Yt=this.points[W[ye+Ht]];je=Yt.properties;const[Qt,En]=Yt.geometry.coordinates;He=Bn(Qt),Ke=ir(En)}const At={type:1,geometry:[[Math.round(this.options.extent*(He*Ee-K)),Math.round(this.options.extent*(Ke*Ee-oe))]],tags:je};let Nt;Nt=De||this.options.generateId?W[ye+Ht]:this.points[W[ye+Ht]].id,Nt!==void 0&&(At.id=Nt),Q.features.push(At)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,W){const{radius:K,extent:oe,reduce:Ee,minPoints:Q}=this.options,Ie=K/(oe*Math.pow(2,W)),ye=V.data,De=[],je=this.stride;for(let He=0;HeW&&(Qt+=ye[Yn+Dt])}if(Qt>Yt&&Qt>=Q){let En,Yn=Ke*Yt,hr=At*Yt,ti=-1;const cn=((He/je|0)<<5)+(W+1)+this.points.length;for(const Ir of Nt){const ai=Ir*je;if(ye[ai+2]<=W)continue;ye[ai+2]=W;const to=ye[ai+Dt];Yn+=ye[ai]*to,hr+=ye[ai+1]*to,ye[ai+4]=cn,Ee&&(En||(En=this._map(ye,He,!0),ti=this.clusterProps.length,this.clusterProps.push(En)),Ee(En,this._map(ye,ai)))}ye[He+4]=cn,De.push(Yn/Qt,hr/Qt,1/0,cn,-1,Qt),Ee&&De.push(ti)}else{for(let En=0;En1)for(const En of Nt){const Yn=En*je;if(!(ye[Yn+2]<=W)){ye[Yn+2]=W;for(let hr=0;hr>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,W,K){if(V[W+Dt]>1){const Q=this.clusterProps[V[W+un]];return K?Object.assign({},Q):Q}const oe=this.points[V[W+Ht]].properties,Ee=this.options.map(oe);return K&&Ee===oe?Object.assign({},Ee):Ee}}function bn(he,V,W){return{type:"Feature",id:he[V+Ht],properties:mn(he,V,W),geometry:{type:"Point",coordinates:[(K=he[V],360*(K-.5)),$r(he[V+1])]}};var K}function mn(he,V,W){const K=he[V+Dt],oe=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,Ee=he[V+un],Q=Ee===-1?{}:Object.assign({},W[Ee]);return Object.assign(Q,{cluster:!0,cluster_id:he[V+Ht],point_count:K,point_count_abbreviated:oe})}function Bn(he){return he/360+.5}function ir(he){const V=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return W<0?0:W>1?1:W}function $r(he){const V=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function _r(he,V,W,K){for(var oe,Ee=K,Q=W-V>>1,Ie=W-V,ye=he[V],De=he[V+1],je=he[W],He=he[W+1],Ke=V+3;KeEe)oe=Ke,Ee=At;else if(At===Ee){var Nt=Math.abs(Ke-Q);NtK&&(oe-V>3&&_r(he,V,oe,K),he[oe+2]=Ee,W-oe>3&&_r(he,oe,W,K))}function cr(he,V,W,K,oe,Ee){var Q=oe-W,Ie=Ee-K;if(Q!==0||Ie!==0){var ye=((he-W)*Q+(V-K)*Ie)/(Q*Q+Ie*Ie);ye>1?(W=oe,K=Ee):ye>0&&(W+=Q*ye,K+=Ie*ye)}return(Q=he-W)*Q+(Ie=V-K)*Ie}function or(he,V,W,K){var oe={id:he===void 0?null:he,type:V,geometry:W,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ee){var Q=Ee.geometry,Ie=Ee.type;if(Ie==="Point"||Ie==="MultiPoint"||Ie==="LineString")re(Ee,Q);else if(Ie==="Polygon"||Ie==="MultiLineString")for(var ye=0;ye0&&(Q+=K?(oe*De-ye*Ee)/2:Math.sqrt(Math.pow(ye-oe,2)+Math.pow(De-Ee,2))),oe=ye,Ee=De}var je=V.length-3;V[2]=1,_r(V,0,je,W),V[je+2]=1,V.size=Math.abs(Q),V.start=0,V.end=V.size}function ze(he,V,W,K){for(var oe=0;oe1?1:W}function fn(he,V,W,K,oe,Ee,Q,Ie){if(K/=V,Ee>=(W/=V)&&Q=K)return null;for(var ye=[],De=0;De=W&&Nt=K)){var Yt=[];if(Ke==="Point"||Ke==="MultiPoint")tr(He,Yt,W,K,oe);else if(Ke==="LineString")Do(He,Yt,W,K,oe,!1,Ie.lineMetrics);else if(Ke==="MultiLineString")Bs(He,Yt,W,K,oe,!1);else if(Ke==="Polygon")Bs(He,Yt,W,K,oe,!0);else if(Ke==="MultiPolygon")for(var Qt=0;Qt=W&&Q<=K&&(V.push(he[Ee]),V.push(he[Ee+1]),V.push(he[Ee+2]))}}function Do(he,V,W,K,oe,Ee,Q){for(var Ie,ye,De=gs(he),je=oe===0?ki:Tl,He=he.start,Ke=0;KeW&&(ye=je(De,At,Nt,Qt,En,W),Q&&(De.start=He+Ie*ye)):Yn>K?hr=W&&(ye=je(De,At,Nt,Qt,En,W),ti=!0),hr>K&&Yn<=K&&(ye=je(De,At,Nt,Qt,En,K),ti=!0),!Ee&&ti&&(Q&&(De.end=He+Ie*ye),V.push(De),De=gs(he)),Q&&(He+=Ie)}var cn=he.length-3;At=he[cn],Nt=he[cn+1],Yt=he[cn+2],(Yn=oe===0?At:Nt)>=W&&Yn<=K&&Za(De,At,Nt,Yt),cn=De.length-3,Ee&&cn>=3&&(De[cn]!==De[0]||De[cn+1]!==De[1])&&Za(De,De[0],De[1],De[2]),De.length&&V.push(De)}function gs(he){var V=[];return V.size=he.size,V.start=he.start,V.end=he.end,V}function Bs(he,V,W,K,oe,Ee){for(var Q=0;QQ.maxX&&(Q.maxX=je),He>Q.maxY&&(Q.maxY=He)}return Q}function ei(he,V,W,K){var oe=V.geometry,Ee=V.type,Q=[];if(Ee==="Point"||Ee==="MultiPoint")for(var Ie=0;Ie0&&V.size<(oe?Q:K))W.numPoints+=V.length/3;else{for(var Ie=[],ye=0;yeQ)&&(W.numSimplified++,Ie.push(V[ye]),Ie.push(V[ye+1])),W.numPoints++;oe&&function(De,je){for(var He=0,Ke=0,At=De.length,Nt=At-2;Ke0===je)for(Ke=0,At=De.length;Ke24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var K=function(oe,Ee){var Q=[];if(oe.type==="FeatureCollection")for(var Ie=0;Ie1&&console.time("creation"),Ke=this.tiles[He]=Ll(he,V,W,K,ye),this.tileCoords.push({z:V,x:W,y:K}),De)){De>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,W,K,Ke.numFeatures,Ke.numPoints,Ke.numSimplified),console.timeEnd("creation"));var At="z"+V;this.stats[At]=(this.stats[At]||0)+1,this.total++}if(Ke.source=he,oe){if(V===ye.maxZoom||V===oe)continue;var Nt=1<1&&console.time("clipping");var Yt,Qt,En,Yn,hr,ti,cn=.5*ye.buffer/ye.extent,Ir=.5-cn,ai=.5+cn,to=1+cn;Yt=Qt=En=Yn=null,hr=fn(he,je,W-cn,W+ai,0,Ke.minX,Ke.maxX,ye),ti=fn(he,je,W+Ir,W+to,0,Ke.minX,Ke.maxX,ye),he=null,hr&&(Yt=fn(hr,je,K-cn,K+ai,1,Ke.minY,Ke.maxY,ye),Qt=fn(hr,je,K+Ir,K+to,1,Ke.minY,Ke.maxY,ye),hr=null),ti&&(En=fn(ti,je,K-cn,K+ai,1,Ke.minY,Ke.maxY,ye),Yn=fn(ti,je,K+Ir,K+to,1,Ke.minY,Ke.maxY,ye),ti=null),De>1&&console.timeEnd("clipping"),Ie.push(Yt||[],V+1,2*W,2*K),Ie.push(Qt||[],V+1,2*W,2*K+1),Ie.push(En||[],V+1,2*W+1,2*K),Ie.push(Yn||[],V+1,2*W+1,2*K+1)}}},on.prototype.getTile=function(he,V,W){var K=this.options,oe=K.extent,Ee=K.debug;if(he<0||he>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",he,V,W);for(var ye,De=he,je=V,He=W;!ye&&De>0;)De--,je=Math.floor(je/2),He=Math.floor(He/2),ye=this.tiles[nn(De,je,He)];return ye&&ye.source?(Ee>1&&console.log("found parent tile z%d-%d-%d",De,je,He),Ee>1&&console.time("drilling down"),this.splitTile(ye.source,De,je,He,he,V,W),Ee>1&&console.timeEnd("drilling down"),this.tiles[Ie]?Qo(this.tiles[Ie],oe):null):null};class ba extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,W){return c._(this,void 0,void 0,function*(){const K=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const oe=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!oe)return null;const Ee=new class{constructor(Ie){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=Ie.length,this._features=Ie}feature(Ie){return new class{constructor(ye){this._feature=ye,this.extent=c.W,this.type=ye.type,this.properties=ye.tags,"id"in ye&&!isNaN(ye.id)&&(this.id=parseInt(ye.id,10))}loadGeometry(){if(this._feature.type===1){const ye=[];for(const De of this._feature.geometry)ye.push([new c.P(De[0],De[1])]);return ye}{const ye=[];for(const De of this._feature.geometry){const je=[];for(const He of De)je.push(new c.P(He[0],He[1]));ye.push(je)}return ye}}toGeoJSON(ye,De,je){return j.call(this,ye,De,je)}}(this._features[Ie])}}(oe.features);let Q=Ne(Ee);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:Ee,rawData:Q.buffer}})}loadData(V){return c._(this,void 0,void 0,function*(){var W;(W=this._pendingRequest)===null||W===void 0||W.abort();const K=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request);this._pendingRequest=new AbortController;try{let oe=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof oe!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(U(oe,!0),V.filter){const Q=c.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));oe={type:"FeatureCollection",features:oe.features.filter(ye=>Q.value.evaluate({zoom:0},ye))}}this._geoJSONIndex=V.cluster?new Fn(function({superclusterOptions:Q,clusterProperties:Ie}){if(!Ie||!Q)return Q;const ye={},De={},je={accumulated:null,zoom:0},He={properties:null},Ke=Object.keys(Ie);for(const At of Ke){const[Nt,Yt]=Ie[At],Qt=c.by(Yt),En=c.by(typeof Nt=="string"?[Nt,["accumulated"],["get",At]]:Nt);ye[At]=Qt.value,De[At]=En.value}return Q.map=At=>{He.properties=At;const Nt={};for(const Yt of Ke)Nt[Yt]=ye[Yt].evaluate(je,He);return Nt},Q.reduce=(At,Nt)=>{He.properties=Nt;for(const Yt of Ke)je.accumulated=At[Yt],At[Yt]=De[Yt].evaluate(je,He)},Q}(V)).load(oe.features):function(Q,Ie){return new on(Q,Ie)}(oe,V.geojsonVtOptions),this.loaded={};const Ee={};if(K){const Q=K.finish();Q&&(Ee.resourceTiming={},Ee.resourceTiming[V.source]=JSON.parse(JSON.stringify(Q)))}return Ee}catch(oe){if(delete this._pendingRequest,c.bz(oe))return{abandoned:!0};throw oe}})}reloadTile(V){const W=this.loaded;return W&&W[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,W){return c._(this,void 0,void 0,function*(){const{promoteId:K}=V;if(V.request){const oe=yield c.h(V.request,W);return this._dataUpdateable=$o(oe.data,K)?tn(oe.data,K):void 0,oe.data}if(typeof V.data=="string")try{const oe=JSON.parse(V.data);return this._dataUpdateable=$o(oe,K)?tn(oe,K):void 0,oe}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(oe,Ee,Q){var Ie,ye,De,je;if(Ee.removeAll&&oe.clear(),Ee.remove)for(const He of Ee.remove)oe.delete(He);if(Ee.add)for(const He of Ee.add){const Ke=Rr(He,Q);Ke!=null&&oe.set(Ke,He)}if(Ee.update)for(const He of Ee.update){let Ke=oe.get(He.id);if(Ke==null)continue;const At=!He.removeAllProperties&&(((Ie=He.removeProperties)===null||Ie===void 0?void 0:Ie.length)>0||((ye=He.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0);if((He.newGeometry||He.removeAllProperties||At)&&(Ke=Object.assign({},Ke),oe.set(He.id,Ke),At&&(Ke.properties=Object.assign({},Ke.properties))),He.newGeometry&&(Ke.geometry=He.newGeometry),He.removeAllProperties)Ke.properties={};else if(((De=He.removeProperties)===null||De===void 0?void 0:De.length)>0)for(const Nt of He.removeProperties)Object.prototype.hasOwnProperty.call(Ke.properties,Nt)&&delete Ke.properties[Nt];if(((je=He.addOrUpdateProperties)===null||je===void 0?void 0:je.length)>0)for(const{key:Nt,value:Yt}of He.addOrUpdateProperties)Ke.properties[Nt]=Yt}}(this._dataUpdateable,V.dataDiff,K),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class Vr{constructor(V){this.self=V,this.actor=new c.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,K)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=K},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=W=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,K)=>this._getDEMWorkerSource(W,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(W,K)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(W,K)=>this._getWorkerSource(W,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(W,K)=>this._getWorkerSource(W,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(W,K)=>this._getWorkerSource(W,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(W,K)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][K.type]||!this.workerSources[W][K.type][K.source])return;const oe=this.workerSources[W][K.type][K.source];delete this.workerSources[W][K.type][K.source],oe.removeSource!==void 0&&oe.removeSource(K)})),this.actor.registerMessageHandler("RM",W=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,K)=>c._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(W,K)=>this._syncRTLPluginState(W,K)),this.actor.registerMessageHandler("IS",(W,K)=>c._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(W,K)=>this._setImages(W,K)),this.actor.registerMessageHandler("UL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(K)}))}_setImages(V,W){return c._(this,void 0,void 0,function*(){this.availableImages[V]=W;for(const K in this.workerSources[V]){const oe=this.workerSources[V][K];for(const Ee in oe)oe[Ee].availableImages=W}})}_syncRTLPluginState(V,W){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(W.pluginStatus!=="loading")return c.bA.setState(W),W;const K=W.pluginURL;if(this.self.importScripts(K),c.bA.isParsed()){const oe={pluginStatus:"loaded",pluginURL:K};return c.bA.setState(oe),oe}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_getAvailableImages(V){let W=this.availableImages[V];return W||(W=[]),W}_getLayerIndex(V){let W=this.layerIndexes[V];return W||(W=this.layerIndexes[V]=new l),W}_getWorkerSource(V,W,K){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][W]||(this.workerSources[V][W]={}),!this.workerSources[V][W][K]){const oe={sendAsync:(Ee,Q)=>(Ee.targetMapId=V,this.actor.sendAsync(Ee,Q))};switch(W){case"vector":this.workerSources[V][W][K]=new I(oe,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][W][K]=new ba(oe,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][W][K]=new this.externalWorkerSourceTypes[W](oe,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][W][K]}_getDEMWorkerSource(V,W){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][W]||(this.demWorkerSources[V][W]=new T),this.demWorkerSources[V][W]}}return c.i(self)&&(self.worker=new Vr(self)),Vr}),i("index",["exports","./shared"],function(c,l){var d="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((s,f)=>{const m=requestAnimationFrame(s);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),f(l.c())})}),getImageData(y,s=0){return this.getImageCanvasContext(y).getImageData(-s,-s,y.width+2*s,y.height+2*s)},getImageCanvasContext(y){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=y.width,s.height=y.height,f.drawImage(y,0,0,y.width,y.height),f},resolveURL:y=>(w||(w=document.createElement("a")),w.href=y,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class T{static testProp(s){if(!T.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",T.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,m){const g=f.boundingClientRect;return new l.P((m.clientX-g.left)/f.x-s.clientLeft,(m.clientY-g.top)/f.y-s.clientTop)}static mousePos(s,f){const m=T.getScale(s);return T.getPoint(s,m,f)}static touchPos(s,f){const m=[],g=T.getScale(s);for(let v=0;v{s=[],f=0,m=0,g={}},y.addThrottleControl=M=>{const R=m++;return g[R]=M,R},y.removeThrottleControl=M=>{delete g[M],C()},y.getImage=(M,R,z=!0)=>new Promise((F,Z)=>{k.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),l.e(M,{type:"image"}),s.push({abortController:R,requestParameters:M,supportImageRefresh:z,state:"queued",onError:ae=>{Z(ae)},onSuccess:ae=>{F(ae)}}),C()});const v=M=>l._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:R,supportImageRefresh:z,onError:F,onSuccess:Z,abortController:ae}=M,se=z===!1&&!l.i(self)&&!l.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((we,Ve)=>we&&Ve==="accept",!0));f++;const pe=se?L(R,ae):l.m(R,ae);try{const we=yield pe;delete M.abortController,M.state="completed",we.data instanceof HTMLImageElement||l.b(we.data)?Z(we):we.data&&Z({data:yield(te=we.data,typeof createImageBitmap=="function"?l.d(te):l.f(te)),cacheControl:we.cacheControl,expires:we.expires})}catch(we){delete M.abortController,F(we)}finally{f--,C()}var te}),C=()=>{const M=(()=>{for(const R of Object.keys(g))if(g[R]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=f;R0;R++){const z=s.shift();z.abortController.signal.aborted?R--:v(z)}},L=(M,R)=>new Promise((z,F)=>{const Z=new Image,ae=M.url,se=M.credentials;se&&se==="include"?Z.crossOrigin="use-credentials":(se&&se==="same-origin"||!l.s(ae))&&(Z.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,z({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,R.signal.aborted||F(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},Z.src=ae})}(q||(q={})),q.resetRequestQueue();class J{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,m){const g=function(v){const C=v.match(ce);if(!C)throw new Error(`Unable to parse URL "${v}"`);return{protocol:C[1],authority:C[2],path:C[3]||"/",params:C[4]?C[4].split("&"):[]}}(s);return g.path+=`${f}${m}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const ce=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function fe(y){var s=new l.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var de,ie=function(y,s,f){return y[0]=s[0]-f[0],y[1]=s[1]-f[1],y[2]=s[2]-f[2],y};de=new l.A(3),l.A!=Float32Array&&(de[0]=0,de[1]=0,de[2]=0);var ee=function(y){var s=y[0],f=y[1];return s*s+f*f};function Le(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const f=[];for(const{id:m,url:g}of y){const v=`${m}${g}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:m,url:g}))}}return s}(function(){var y=new l.A(2);l.A!=Float32Array&&(y[0]=0,y[1]=0)})();class X{constructor(s,f,m,g){this.context=s,this.format=m,this.texture=s.gl.createTexture(),this.update(f,g)}update(s,f,m){const{width:g,height:v}=s,C=!(this.size&&this.size[0]===g&&this.size[1]===v||m),{context:L}=this,{gl:M}=L;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[g,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:R,y:z}=m||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,R,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,R,z,g,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,m){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),m!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,m||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function le(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class Ye extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:m}of this.requestors)m(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const m=f.spriteData;f.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let m=!0;const g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchX" value`))),m=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchY" value`))),m=!1),this._validateContent(f.content,f)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "content" value`))),m=!1),m}_validateStretch(s,f){if(!s)return!0;let m=0;for(const g of s){if(g[0]{let g=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(g=!1);this.isLoaded()||g?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const m of s){let g=this.getImage(m);g||(this.fire(new l.k("styleimagemissing",{id:m})),g=this.getImage(m)),g?f[m]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:l.w(`Image "${m}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],m=this.getImage(s);if(!m)return null;if(f&&f.position.version===m.version)return f.position;if(f)f.position.version=m.version;else{const g={w:m.data.width+2,h:m.data.height+2,x:0,y:0},v=new l.I(g,m);this.patterns[s]={bin:g,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new X(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:m}=l.p(s),g=this.atlasImage;g.resize({width:f||1,height:m||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],L=C.x+1,M=C.y+1,R=this.getImage(v).data,z=R.width,F=R.height;l.R.copy(R,g,{x:0,y:0},{x:L,y:M},{width:z,height:F}),l.R.copy(R,g,{x:0,y:F-1},{x:L,y:M-1},{width:z,height:1}),l.R.copy(R,g,{x:0,y:0},{x:L,y:M+F},{width:z,height:1}),l.R.copy(R,g,{x:z-1,y:0},{x:L-1,y:M},{width:1,height:F}),l.R.copy(R,g,{x:0,y:0},{x:L+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const m=this.getImage(f);m||l.w(`Image with ID: "${f}" was not found`),le(m)&&this.updateImage(f,m)}}}const xe=1e20;function Ge(y,s,f,m,g,v,C,L,M){for(let R=s;R-1);M++,v[M]=L,C[M]=R,C[M+1]=xe}for(let L=0,M=0;L65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[v])return{stack:s,id:f,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[v]){const L=Ne.loadGlyphRange(s,v,this.url,this.requestManager);m.requests[v]=L}const C=yield m.requests[v];for(const L in C)this._doesCharSupportLocalGlyph(+L)||(m.glyphs[+L]=C[+L]);return m.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](s)||l.u["Hangul Syllables"](s)||l.u.Hiragana(s)||l.u.Katakana(s))}_tinySDF(s,f,m){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(m))return;let v=s.tinySDF;if(!v){let L="400";/bold/i.test(f)?L="900":/medium/i.test(f)?L="500":/light/i.test(f)&&(L="200"),v=s.tinySDF=new Ne.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:L})}const C=v.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ne.loadGlyphRange=function(y,s,f,m){return l._(this,void 0,void 0,function*(){const g=256*s,v=g+255,C=m.transformRequest(f.replace("{fontstack}",y).replace("{range}",`${g}-${v}`),"Glyphs"),L=yield l.l(C,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);const M={};for(const R of l.n(L.data))M[R.id]=R;return M})},Ne.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:f=8,cutoff:m=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=m,this.radius=f;const L=this.size=y+4*s,M=this._createCanvas(L),R=this.ctx=M.getContext("2d",{willReadFrequently:!0});R.font=`${C} ${v} ${y}px ${g}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:m,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(y),C=Math.ceil(f),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-g))),M=Math.min(this.size-this.buffer,C+Math.ceil(m)),R=L+2*this.buffer,z=M+2*this.buffer,F=Math.max(R*z,0),Z=new Uint8ClampedArray(F),ae={data:Z,width:R,height:z,glyphWidth:L,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(L===0||M===0)return ae;const{ctx:se,buffer:pe,gridInner:te,gridOuter:we}=this;se.clearRect(pe,pe,L,M),se.fillText(y,pe,pe+C);const Ve=se.getImageData(pe,pe,L,M);we.fill(xe,0,F),te.fill(0,0,F);for(let me=0;me0?Ze*Ze:0,te[qe]=Ze<0?Ze*Ze:0}}Ge(we,0,0,R,z,R,this.f,this.v,this.z),Ge(te,pe,pe,L,M,R,this.f,this.v,this.z);for(let me=0;me1&&(M=s[++L]);const z=Math.abs(R-M.left),F=Math.abs(R-M.right),Z=Math.min(z,F);let ae;const se=v/m*(g+1);if(M.isDash){const pe=g-Math.abs(se);ae=Math.sqrt(Z*Z+pe*pe)}else ae=g-Math.sqrt(Z*Z+se*se);this.data[C+R]=Math.max(0,Math.min(255,ae+128))}}}addRegularDash(s){for(let L=s.length-1;L>=0;--L){const M=s[L],R=s[L+1];M.zeroLength?s.splice(L,1):R&&R.isDash===M.isDash&&(R.left=M.left,s.splice(L,1))}const f=s[0],m=s[s.length-1];f.isDash===m.isDash&&(f.left=m.left-this.width,m.right=f.right+this.width);const g=this.width*this.nextRow;let v=0,C=s[v];for(let L=0;L1&&(C=s[++v]);const M=Math.abs(L-C.left),R=Math.abs(L-C.right),z=Math.min(M,R);this.data[g+L]=Math.max(0,Math.min(255,(C.isDash?z:-z)+128))}}addDash(s,f){const m=f?7:0,g=2*m+1;if(this.nextRow+g>this.height)return l.w("LineAtlas out of space"),null;let v=0;for(let L=0;L{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Dt]}numActive(){return Object.keys(this.active).length}}const Fn=Math.floor(I.hardwareConcurrency/2);let bn,mn;function Bn(){return bn||(bn=new un),bn}un.workerCount=l.B(globalThis)?Math.max(Math.min(Fn,3),1):1;class ir{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const m=this.workerPool.acquire(f);for(let g=0;g{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const m of this.actors)m.registerMessageHandler(s,f)}}function $r(){return mn||(mn=new ir(Bn(),l.G),mn.registerMessageHandler("GR",(y,s,f)=>l.m(s,f))),mn}function _r(y,s){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*y.width,.5*y.height,1]),l.K(f,f,y.calculatePosMatrix(s.toUnwrapped()))}function cr(y,s,f,m,g,v){const C=function(F,Z,ae){if(F)for(const se of F){const pe=Z[se];if(pe&&pe.source===ae&&pe.type==="fill-extrusion")return!0}else for(const se in Z){const pe=Z[se];if(pe.source===ae&&pe.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),L=v.maxPitchScaleFactor(),M=y.tilesIn(m,L,C);M.sort(or);const R=[];for(const F of M)R.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,y._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,g,v,L,_r(y.transform,F.tileID))});const z=function(F){const Z={},ae={};for(const se of F){const pe=se.queryResults,te=se.wrappedTileID,we=ae[te]=ae[te]||{};for(const Ve in pe){const me=pe[Ve],Me=we[Ve]=we[Ve]||{},Ue=Z[Ve]=Z[Ve]||[];for(const qe of me)Me[qe.featureIndex]||(Me[qe.featureIndex]=!0,Ue.push(qe))}}return Z}(R);for(const F in z)z[F].forEach(Z=>{const ae=Z.feature,se=y.getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=se});return z}function or(y,s){const f=y.tileID,m=s.tileID;return f.overscaledZ-m.overscaledZ||f.canonical.y-m.canonical.y||f.wrap-m.wrap||f.canonical.x-m.canonical.x}function re(y,s,f){return l._(this,void 0,void 0,function*(){let m=y;if(y.url?m=(yield l.h(s.transformRequest(y.url,"Source"),f)).data:yield I.frameAsync(f),!m)return null;const g=l.L(l.e(m,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(g.vectorLayerIds=m.vector_layers.map(v=>v.id)),g})}class Ce{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}extend(s){const f=this._sw,m=this._ne;let g,v;if(s instanceof l.M)g=s,v=s;else{if(!(s instanceof Ce))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ce.convert(s)):this.extend(l.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(l.M.convert(s)):this;if(g=s._sw,v=s._ne,!g||!v)return this}return f||m?(f.lng=Math.min(g.lng,f.lng),f.lat=Math.min(g.lat,f.lat),m.lng=Math.max(v.lng,m.lng),m.lat=Math.max(v.lat,m.lat)):(this._sw=new l.M(g.lng,g.lat),this._ne=new l.M(v.lng,v.lat)),this}getCenter(){return new l.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l.M(this.getWest(),this.getNorth())}getSouthEast(){return new l.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:m}=l.M.convert(s);let g=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&g}static convert(s){return s instanceof Ce?s:s&&new Ce(s)}static fromLngLat(s,f=0){const m=360*f/40075017,g=m/Math.cos(Math.PI/180*s.lat);return new Ce(new l.M(s.lng-g,s.lat-m),new l.M(s.lng+g,s.lat+m))}}class vt{constructor(s,f,m){this.bounds=Ce.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=m||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),m=Math.floor(l.N(this.bounds.getWest())*f),g=Math.floor(l.O(this.bounds.getNorth())*f),v=Math.ceil(l.N(this.bounds.getEast())*f),C=Math.ceil(l.O(this.bounds.getSouth())*f);return s.x>=m&&s.x=g&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let g="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,C)=>{s.reloadPromise={resolve:v,reject:C}})}else s.actor=this.dispatcher.getActor(),g="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:g,data:m},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const m=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(m.resolve).catch(m.reject)}}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class ze extends l.E{constructor(s,f,m,g){super(),this.id=s,this.dispatcher=m,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},f),l.e(this,l.L(f,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield re(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new vt(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return l.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const m=yield q.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const g=this.map.painter.context,v=g.gl,C=m.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new X(g,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class en extends ze{constructor(s,f,m,g){super(s,f,m,g),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const g=yield q.getImage(m,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(g&&g.data){const v=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&s.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const C=l.b(v)&&l.S()?v:yield this.readImageNow(v),L={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:L});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(g){if(delete s.abortController,s.aborted)s.state="unloaded";else if(g)throw s.state="errored",g}})}readImageNow(s){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.U()){const f=s.width+2,m=s.height+2;try{return new l.R({width:f,height:m},yield l.V(s,-1,-1,f,m))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,m=Math.pow(2,f.z),g=(f.x-1+m)%m,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+m)%m,L=f.x+1===m?s.wrap+1:s.wrap,M={};return M[new l.Q(s.overscaledZ,v,f.z,g,f.y).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new l.Q(s.overscaledZ,v,f.z,g,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&l.e(v,{resourceTiming:g}),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const m={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const g=yield this.actor.sendAsync({type:f,data:m},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(g,this.map.painter,f==="RT")})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var fn=l.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class tr extends l.E{constructor(s,f,m,g){super(),this.id=s,this.dispatcher=m,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=f}load(s){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new l.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(l.Y.fromLngLat);this.tileID=function(g){let v=1/0,C=1/0,L=-1/0,M=-1/0;for(const Z of g)v=Math.min(v,Z.x),C=Math.min(C,Z.y),L=Math.max(L,Z.x),M=Math.max(M,Z.y);const R=Math.max(L-v,M-C),z=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),F=Math.pow(2,z);return new l.a0(z,Math.floor((v+L)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const m=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new l.Z,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.W,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.W),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.W,l.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new X(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Do extends tr{constructor(s,f,m,g){super(s,f,m,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield l.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new l.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new l.j(new l.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new X(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class gs extends tr{constructor(s,f,m,g){super(s,f,m,g),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(C=>typeof C!="number"))||this.fire(new l.j(new l.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new l.j(new l.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.j(new l.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return l._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,m=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new X(f,this.canvas,m.RGBA,{premultiply:!0});let g=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,g=!0)}g&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Bs={},Za=y=>{switch(y){case"geojson":return Dr;case"image":return tr;case"raster":return ze;case"raster-dem":return en;case"vector":return xn;case"video":return Do;case"canvas":return gs}return Bs[y]},ki="RTLPluginLoaded";class Tl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$r()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return l._(this,arguments,void 0,function*(f,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=I.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(ki))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _s=null;function lt(){return _s||(_s=new Tl),_s}class Qo{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=l.a3(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(s){const f=s+this.timeAdded;fv.getLayer(R)).filter(Boolean);if(M.length!==0){L.layers=M,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(R=>M.filter(z=>z.id===R)[0]));for(const R of M)C[R.id]=L}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5){if(this.hasSymbolBuckets=!0,!m)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5&&v.hasRTLText){this.hasRTLText=!0,lt().lazyLoad();break}}this.queryPadding=0;for(const g in this.buckets){const v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(g).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new l.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const m in this.buckets){const g=this.buckets[m];g.uploadPending()&&g.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new X(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new X(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,m,g,v,C,L,M,R,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:L,queryPadding:this.queryPadding*R},s,f,m):{}}querySourceFeatures(s,f){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const g=m.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=g._geojsonTileLayer||g[v];if(!C)return;const L=l.a6(f&&f.filter),{z:M,x:R,y:z}=this.tileID.canonical,F={z:M,x:R,y:z};for(let Z=0;Zm)g=!1;else if(f)if(this.expirationTime{this.remove(s,v)},m)),this.data[g].push(v),this.order.push(g),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const m=s.wrapped().key,g=f===void 0?0:this.data[m].indexOf(f),v=this.data[m][g];return this.data[m].splice(g,1),v.timeout&&clearTimeout(v.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(v.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const m in this.data)for(const g of this.data[m])s(g.value)||f.push(g);for(const m of f)this.remove(m.value.tileID,m)}}class Ll{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,m){const g=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},l.e(this.stateChanges[s][g],m),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==g&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const v in this.state[s][g])m[v]||(this.deletedStates[s][g][v]=null)}else for(const v in m)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][v]===null&&delete this.deletedStates[s][g][v]}removeFeatureState(s,f,m){if(this.deletedStates[s]===null)return;const g=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},m&&f!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][m]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(m in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][m]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,f){const m=String(f),g=l.e({},(this.state[s]||{})[m],(this.stateChanges[s]||{})[m]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete g[C]}return g}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const m={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const v={};for(const C in this.stateChanges[g])this.state[g][C]||(this.state[g][C]={}),l.e(this.state[g][C],this.stateChanges[g][C]),v[C]=this.state[g][C];m[g]=v}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const v={};if(this.deletedStates[g]===null)for(const C in this.state[g])v[C]={},this.state[g][C]={};else for(const C in this.deletedStates[g]){if(this.deletedStates[g][C]===null)this.state[g][C]={};else for(const L of Object.keys(this.deletedStates[g][C]))delete this.state[g][C][L];v[C]=this.state[g][C]}m[g]=m[g]||{},l.e(m[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const g in s)s[g].setFeatureState(m,f)}}class ei extends l.E{constructor(s,f,m){super(),this.id=s,this.dispatcher=m,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,v,C,L)=>{const M=new(Za(v.type))(g,v,C,L);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,f,m,this),this._tiles={},this._cache=new eo(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ll,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,m)}catch(g){s.state="errored",g.status!==404?this._source.fire(new l.j(g,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new l.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const m=this._tiles[f];m.upload(s),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(dt).map(s=>s.key)}getRenderableIds(s){const f=[];for(const m in this._tiles)this._isIdRenderable(m,s)&&f.push(this._tiles[m]);return s?f.sort((m,g)=>{const v=m.tileID,C=g.tileID,L=new l.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new l.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-L.y||M.x-L.x}).map(m=>m.tileID.key):f.map(m=>m.tileID).sort(dt).map(m=>m.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return l._(this,void 0,void 0,function*(){const m=this._tiles[s];m&&(m.state!=="loading"&&(m.state=f),yield this._loadTile(m,s,f))})}_tileLoaded(s,f,m){s.timeAdded=I.now(),m==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let g=0;g1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,C,L),g.neighboringTiles&&g.neighboringTiles[R]&&(g.neighboringTiles[R].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,m,g){for(const v in this._tiles){let C=this._tiles[v];if(g[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>m)continue;let L=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const R=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[R.key],C&&C.hasData()&&(L=R)}let M=L;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[L.key]=L;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const m=this._loadedParentTiles[s.key];return m&&m.tileID.overscaledZ>=f?m:null}for(let m=s.overscaledZ-1;m>=f;m--){const g=s.scaledTo(m),v=this._getLoadedTile(g);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,m=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(f*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const m={};for(const g in this._tiles){const v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),m[v.tileID.key]=v}this._tiles=m;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let m;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new l.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(m=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(m=m.filter(z=>this._source.hasTile(z)))):m=[];const g=s.coveringZoomLevel(this._source),v=Math.max(g-ei.maxOverzooming,this._source.minzoom),C=Math.max(g+ei.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);z[Z.key]=Z;const ae=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[ae.key]=ae}m=m.concat(Object.values(z))}const L=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(m,g);if(on(this._source.type)){const z={},F={},Z=Object.keys(M),ae=I.now();for(const se of Z){const pe=M[se],te=this._tiles[se];if(!te||te.fadeEndTime!==0&&te.fadeEndTime<=ae)continue;const we=this.findLoadedParent(pe,v);we&&(this._addTile(we.tileID),z[we.tileID.key]=we.tileID),F[se]=pe}this._retainLoadedChildren(F,g,C,M);for(const se in z)M[se]||(this._coveredTiles[se]=!0,M[se]=z[se]);if(f){const se={},pe={};for(const te of m)this._tiles[te.key].hasData()?se[te.key]=te:pe[te.key]=te;for(const te in pe){const we=pe[te].children(this._source.maxzoom);this._tiles[we[0].key]&&this._tiles[we[1].key]&&this._tiles[we[2].key]&&this._tiles[we[3].key]&&(se[we[0].key]=M[we[0].key]=we[0],se[we[1].key]=M[we[1].key]=we[1],se[we[2].key]=M[we[2].key]=we[2],se[we[3].key]=M[we[3].key]=we[3],delete pe[te])}for(const te in pe){const we=this.findLoadedParent(pe[te],this._source.minzoom);if(we){se[we.tileID.key]=M[we.tileID.key]=we.tileID;for(const Ve in se)se[Ve].isChildOf(we.tileID)&&delete se[Ve]}}for(const te in this._tiles)se[te]||(this._coveredTiles[te]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const R=l.ab(this._tiles,M);for(const z of R){const F=this._tiles[z];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const m={},g={},v=Math.max(f-ei.maxOverzooming,this._source.minzoom),C=Math.max(f+ei.maxUnderzooming,this._source.minzoom),L={};for(const M of s){const R=this._addTile(M);m[M.key]=M,R.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],Z=this.getTile(F);if(Z&&Z.hasData()){m[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(m[F[0].key]&&m[F[1].key]&&m[F[2].key]&&m[F[3].key])continue}let z=R.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const Z=M.scaledTo(F);if(g[Z.key])break;if(g[Z.key]=!0,R=this.getTile(Z),!R&&z&&(R=this._addTile(Z)),R){const ae=R.hasData();if((z||ae)&&(m[Z.key]=Z),z=R.wasRequested(),ae)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let m,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){m=this._loadedParentTiles[g.key];break}f.push(g.key);const v=g.scaledTo(g.overscaledZ-1);if(m=this._getLoadedTile(v),m)break;g=v}for(const v of f)this._loadedParentTiles[v]=m}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const m=f;return f||(f=new Qo(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,m||this._source.fire(new l.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const m=f.getExpiryTimeout();m&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},m))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,m){const g=[],v=this.transform;if(!v)return g;const C=m?v.getCameraQueryGeometry(s):s,L=s.map(se=>v.pointCoordinate(se,this.terrain)),M=C.map(se=>v.pointCoordinate(se,this.terrain)),R=this.getIds();let z=1/0,F=1/0,Z=-1/0,ae=-1/0;for(const se of M)z=Math.min(z,se.x),F=Math.min(F,se.y),Z=Math.max(Z,se.x),ae=Math.max(ae,se.y);for(let se=0;se=0&&me[1].y+Ve>=0){const Me=L.map(qe=>te.getTilePoint(qe)),Ue=M.map(qe=>te.getTilePoint(qe));g.push({tile:pe,tileID:te,queryGeometry:Me,cameraQueryGeometry:Ue,scale:we})}}return g}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(m=>this._tiles[m].tileID);for(const m of f)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(on(this._source.type)){const s=I.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,m){this._state.updateState(s=s||"_geojsonTileLayer",f,m)}removeFeatureState(s,f,m){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,m)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,m){const g=this._tiles[s];g&&g.setDependencies(f,m)}reloadTilesForDependencies(s,f){for(const m in this._tiles)this._tiles[m].hasDependency(s,f)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(s,f))}}function dt(y,s){const f=Math.abs(2*y.wrap)-+(y.wrap<0),m=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||m-f||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function on(y){return y==="raster"||y==="image"||y==="video"}ei.maxOverzooming=10,ei.maxUnderzooming=3;class nn{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let m=1;m0?(g-C)/L:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Rr(y,s){let f=!0;return y==="always"||y!=="never"&&s!=="never"||(f=!1),f}class $o{constructor(s,f,m){const g=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/m),this.yCellCount=Math.ceil(f/m);for(let C=0;Cthis.width||g<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=m&&this.height<=g){if(v)return[{key:null,x1:s,y1:f,x2:m,y2:g}];for(let R=0;R0}hitTestCircle(s,f,m,g,v){const C=s-m,L=s+m,M=f-m,R=f+m;if(L<0||C>this.width||R<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,L,R,this._queryCellCircle,z,{hitTest:!0,overlapMode:g,circle:{x:s,y:f,radius:m},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,m,g,v,C,L,M){const{seenUids:R,hitTest:z,overlapMode:F}=L,Z=this.boxCells[v];if(Z!==null){const se=this.bboxes;for(const pe of Z)if(!R.box[pe]){R.box[pe]=!0;const te=4*pe,we=this.boxKeys[pe];if(s<=se[te+2]&&f<=se[te+3]&&m>=se[te+0]&&g>=se[te+1]&&(!M||M(we))&&(!z||!Rr(F,we.overlapMode))&&(C.push({key:we,x1:se[te],y1:se[te+1],x2:se[te+2],y2:se[te+3]}),z))return!0}}const ae=this.circleCells[v];if(ae!==null){const se=this.circles;for(const pe of ae)if(!R.circle[pe]){R.circle[pe]=!0;const te=3*pe,we=this.circleKeys[pe];if(this._circleAndRectCollide(se[te],se[te+1],se[te+2],s,f,m,g)&&(!M||M(we))&&(!z||!Rr(F,we.overlapMode))){const Ve=se[te],me=se[te+1],Me=se[te+2];if(C.push({key:we,x1:Ve-Me,y1:me-Me,x2:Ve+Me,y2:me+Me}),z)return!0}}}return!1}_queryCellCircle(s,f,m,g,v,C,L,M){const{circle:R,seenUids:z,overlapMode:F}=L,Z=this.boxCells[v];if(Z!==null){const se=this.bboxes;for(const pe of Z)if(!z.box[pe]){z.box[pe]=!0;const te=4*pe,we=this.boxKeys[pe];if(this._circleAndRectCollide(R.x,R.y,R.radius,se[te+0],se[te+1],se[te+2],se[te+3])&&(!M||M(we))&&!Rr(F,we.overlapMode))return C.push(!0),!0}}const ae=this.circleCells[v];if(ae!==null){const se=this.circles;for(const pe of ae)if(!z.circle[pe]){z.circle[pe]=!0;const te=3*pe,we=this.circleKeys[pe];if(this._circlesCollide(se[te],se[te+1],se[te+2],R.x,R.y,R.radius)&&(!M||M(we))&&!Rr(F,we.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,m,g,v,C,L,M){const R=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(g);for(let ae=R;ae<=F;ae++)for(let se=z;se<=Z;se++)if(v.call(this,s,f,m,g,this.xCellCount*se+ae,C,L,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,m,g,v,C){const L=g-s,M=v-f,R=m+C;return R*R>L*L+M*M}_circleAndRectCollide(s,f,m,g,v,C,L){const M=(C-g)/2,R=Math.abs(s-(g+M));if(R>M+m)return!1;const z=(L-v)/2,F=Math.abs(f-(v+z));if(F>z+m)return!1;if(R<=M||F<=z)return!0;const Z=R-M,ae=F-z;return Z*Z+ae*ae<=m*m}}function tn(y,s,f,m,g){const v=l.F();return s?(l.J(v,v,[1/g,1/g,1]),f||l.ad(v,v,m.angle)):l.K(v,m.labelPlaneMatrix,y),v}function ba(y,s,f,m,g){if(s){const v=l.ae(y);return l.J(v,v,[g,g,1]),f||l.ad(v,v,-m.angle),v}return m.glCoordMatrix}function Vr(y,s,f){let m;f?(m=[y.x,y.y,f(y.x,y.y),1],l.af(m,m,s)):(m=[y.x,y.y,0,1],At(m,m,s));const g=m[3];return{point:new l.P(m[0]/g,m[1]/g),signedDistanceFromCamera:g}}function he(y,s){return .5+y/s*.5}function V(y,s){const f=y[0]/y[3],m=y[1]/y[3];return f>=-s[0]&&f<=s[0]&&m>=-s[1]&&m<=s[1]}function W(y,s,f,m,g,v,C,L,M,R){const z=m?y.textSizeData:y.iconSizeData,F=l.ag(z,f.transform.zoom),Z=[256/f.width*2+1,256/f.height*2+1],ae=m?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;ae.clear();const se=y.lineVertexArray,pe=m?y.text.placedSymbolArray:y.icon.placedSymbolArray,te=f.transform.width/f.transform.height;let we=!1;for(let Ve=0;VeMath.abs(f.x-s.x)*m?{useVertical:!0}:(y===l.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function Ee(y,s,f,m,g,v,C,L,M,R,z,F,Z,ae,se,pe){const te=s/24,we=y.lineOffsetX*te,Ve=y.lineOffsetY*te;let me;if(y.numGlyphs>1){const Me=y.glyphStartIndex+y.numGlyphs,Ue=y.lineStartIndex,qe=y.lineStartIndex+y.lineLength,Ze=K(te,L,we,Ve,f,z,F,y,M,v,Z,se,pe);if(!Ze)return{notEnoughRoom:!0};const nt=Vr(Ze.first.point,C,pe).point,et=Vr(Ze.last.point,C,pe).point;if(m&&!f){const ct=oe(y.writingMode,nt,et,ae);if(ct)return ct}me=[Ze.first];for(let ct=y.glyphStartIndex+1;ct0?nt.point:Q(F,Ze,Ue,1,g,pe),ct=oe(y.writingMode,Ue,et,ae);if(ct)return ct}const Me=je(te*L.getoffsetX(y.glyphStartIndex),we,Ve,f,z,F,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,v,Z,se,pe);if(!Me)return{notEnoughRoom:!0};me=[Me]}for(const Me of me)l.aj(R,Me.point,Me.angle);return{}}function Q(y,s,f,m,g,v){const C=Vr(y.add(y.sub(s)._unit()),g,v).point,L=f.sub(C);return f.add(L._mult(m/L.mag()))}function Ie(y,s){const{projectionCache:f,lineVertexArray:m,labelPlaneMatrix:g,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:L,previousVertex:M,direction:R,absOffsetX:z}=s;if(f.projections[y])return f.projections[y];const F=new l.P(m.getx(y),m.gety(y)),Z=Vr(F,g,L);if(Z.signedDistanceFromCamera>0)return f.projections[y]=Z.point,Z.point;const ae=y-R;return Q(C===0?v:new l.P(m.getx(ae),m.gety(ae)),F,M,z-C+1,g,L)}function ye(y,s,f){return y._unit()._perp()._mult(s*f)}function De(y,s,f,m,g,v,C,L){const{projectionCache:M,direction:R}=L;if(M.offsets[y])return M.offsets[y];const z=f.add(s);if(y+R=g)return M.offsets[y]=z,z;const F=Ie(y+R,L),Z=ye(F.sub(f),C,R),ae=f.add(Z),se=F.add(Z);return M.offsets[y]=l.ak(v,z,ae,se)||z,M.offsets[y]}function je(y,s,f,m,g,v,C,L,M,R,z,F,Z,ae){const se=m?y-s:y+s;let pe=se>0?1:-1,te=0;m&&(pe*=-1,te=Math.PI),pe<0&&(te+=Math.PI);let we,Ve,me=pe>0?L+C:L+C+1,Me=g,Ue=g,qe=0,Ze=0;const nt=Math.abs(se),et=[];let ct;for(;qe+Ze<=nt;){if(me+=pe,me=M)return null;qe+=Ze,Ue=Me,Ve=we;const gt={projectionCache:F,lineVertexArray:R,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:qe,getElevation:ae,previousVertex:Ue,direction:pe,absOffsetX:nt};if(Me=Ie(me,gt),f===0)et.push(Ue),ct=Me.sub(Ue);else{let jt;const an=Me.sub(Ue);jt=an.mag()===0?ye(Ie(me+pe,gt).sub(Me),f,pe):ye(an,f,pe),Ve||(Ve=Ue.add(jt)),we=De(me,jt,Me,L,M,Ve,f,gt),et.push(Ve),ct=we.sub(Ve)}Ze=ct.mag()}const mt=ct._mult((nt-qe)/Ze)._add(Ve||Ue),sn=te+Math.atan2(Me.y-Ue.y,Me.x-Ue.x);return et.push(mt),{point:mt,angle:Z?sn:0,path:et}}const He=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ke(y,s){for(let f=0;f=1;hn--)an.push(gt.path[hn]);for(let hn=1;hnVr(pn,M,se));an=hn.some(pn=>pn.signedDistanceFromCamera<=0)?[]:hn.map(pn=>pn.point)}let Xt=[];if(an.length>0){const hn=an[0].clone(),pn=an[0].clone();for(let Lr=1;Lr=ct.x&&pn.x<=mt.x&&hn.y>=ct.y&&pn.y<=mt.y?[an]:pn.xmt.x||pn.ymt.y?[]:l.al([an],ct.x,ct.y,mt.x,mt.y)}for(const hn of Xt){sn.reset(hn,.25*et);let pn=0;pn=sn.length<=.5*et?1:Math.ceil(sn.paddedLength/Cn)+1;for(let Lr=0;Lr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,f,m,g){return m>=0&&s=0&&fm.collisionGroupID===f}}return this.collisionGroups[s]}}function ai(y,s,f,m,g){const{horizontalAlign:v,verticalAlign:C}=l.at(y);return new l.P(-(v-.5)*s+m[0]*g,-(C-.5)*f+m[1]*g)}function to(y,s,f,m,g,v){const{x1:C,x2:L,y1:M,y2:R,anchorPointX:z,anchorPointY:F}=y,Z=new l.P(s,f);return m&&Z._rotate(g?v:-v),{x1:C+Z.x,y1:M+Z.y,x2:L+Z.x,y2:R+Z.y,anchorPointX:z,anchorPointY:F}}class go{constructor(s,f,m,g,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Yt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Ir(g),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,m,g){const v=m.getBucket(f),C=m.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const L=m.collisionBoxArray,M=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),z=m.tileSize/l.W,F=this.transform.calculatePosMatrix(m.tileID.toUnwrapped()),Z=M.get("text-pitch-alignment")==="map",ae=M.get("text-rotation-alignment")==="map",se=Qt(m,1,this.transform.zoom),pe=tn(F,Z,ae,this.transform,se);let te=null;if(Z){const Ve=ba(F,Z,ae,this.transform,se);te=l.K([],this.transform.labelPlaneMatrix,Ve)}this.retainedQueryData[v.bucketInstanceId]=new cn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,m.tileID);const we={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:pe,labelToScreenMatrix:te,scale:R,textPixelRatio:z,holdingForFade:m.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:l.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(const Ve of v.sortKeyRanges){const{sortKey:me,symbolInstanceStart:Me,symbolInstanceEnd:Ue}=Ve;s.push({sortKey:me,symbolInstanceStart:Me,symbolInstanceEnd:Ue,parameters:we})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:we})}attemptAnchorPlacement(s,f,m,g,v,C,L,M,R,z,F,Z,ae,se,pe,te){const we=l.ap[s.textAnchor],Ve=[s.textOffset0,s.textOffset1],me=ai(we,m,g,Ve,v),Me=this.collisionIndex.placeCollisionBox(to(f,me.x,me.y,C,L,this.transform.angle),F,M,R,z.predicate,te);if((!pe||this.collisionIndex.placeCollisionBox(to(pe,me.x,me.y,C,L,this.transform.angle),F,M,R,z.predicate,te).box.length!==0)&&Me.box.length>0){let Ue;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Ue=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:Ve,width:m,height:g,anchor:we,textBoxScale:v,prevAnchor:Ue},this.markUsedJustification(ae,we,Z,se),ae.allowVerticalPlacement&&(this.markUsedOrientation(ae,se,Z),this.placedOrientations[Z.crossTileID]=se),{shift:me,placedGlyphBoxes:Me}}}placeLayerBucketPart(s,f,m){const{bucket:g,layout:v,posMatrix:C,textLabelPlaneMatrix:L,labelToScreenMatrix:M,textPixelRatio:R,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:Z,collisionGroup:ae}=s.parameters,se=v.get("text-optional"),pe=v.get("icon-optional"),te=l.aq(v,"text-overlap","text-allow-overlap"),we=te==="always",Ve=l.aq(v,"icon-overlap","icon-allow-overlap"),me=Ve==="always",Me=v.get("text-rotation-alignment")==="map",Ue=v.get("text-pitch-alignment")==="map",qe=v.get("icon-text-fit")!=="none",Ze=v.get("symbol-z-order")==="viewport-y",nt=we&&(me||!g.hasIconData()||pe),et=me&&(we||!g.hasTextData()||se);!g.collisionArrays&&F&&g.deserializeCollisionBoxes(F);const ct=this.retainedQueryData[g.bucketInstanceId].tileID,mt=this.terrain?(gt,jt)=>this.terrain.getElevation(ct,gt,jt):null,sn=(gt,jt)=>{var an,Cn;if(f[gt.crossTileID])return;if(z)return void(this.placements[gt.crossTileID]=new hr(!1,!1,!1));let Xt=!1,hn=!1,pn=!0,Lr=null,Wn={box:null,offscreen:null},zo={box:null,offscreen:null},li=null,vr=null,ui=null,Fo=0,Ws=0,el=0;jt.textFeatureIndex?Fo=jt.textFeatureIndex:gt.useRuntimeCollisionCircles&&(Fo=gt.featureIndex),jt.verticalTextFeatureIndex&&(Ws=jt.verticalTextFeatureIndex);const Sc=jt.textBox;if(Sc){const ri=ii=>{let xr=l.ah.horizontal;if(g.allowVerticalPlacement&&!ii&&this.prevPlacement){const rs=this.prevPlacement.placedOrientations[gt.crossTileID];rs&&(this.placedOrientations[gt.crossTileID]=rs,xr=rs,this.markUsedOrientation(g,xr,gt))}return xr},br=(ii,xr)=>{if(g.allowVerticalPlacement&>.numVerticalGlyphVertices>0&&jt.verticalTextBox){for(const rs of g.writingModes)if(rs===l.ah.vertical?(Wn=xr(),zo=Wn):Wn=ii(),Wn&&Wn.box&&Wn.box.length)break}else Wn=ii()},pr=gt.textAnchorOffsetStartIndex,ns=gt.textAnchorOffsetEndIndex;if(ns===pr){const ii=(xr,rs)=>{const oi=this.collisionIndex.placeCollisionBox(xr,te,R,C,ae.predicate,mt);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(g,rs,gt),this.placedOrientations[gt.crossTileID]=rs),oi};br(()=>ii(Sc,l.ah.horizontal),()=>{const xr=jt.verticalTextBox;return g.allowVerticalPlacement&>.numVerticalGlyphVertices>0&&xr?ii(xr,l.ah.vertical):{box:null,offscreen:null}}),ri(Wn&&Wn.box&&Wn.box.length)}else{let ii=l.ap[(Cn=(an=this.prevPlacement)===null||an===void 0?void 0:an.variableOffsets[gt.crossTileID])===null||Cn===void 0?void 0:Cn.anchor];const xr=(oi,Nr,Fp)=>{const Hm=oi.x2-oi.x1,zl=oi.y2-oi.y1,Fl=gt.textBoxScale,Gh=qe&&Ve==="never"?Nr:null;let nl={box:[],offscreen:!1},Bp=te==="never"?1:2,Zm="never";ii&&Bp++;for(let Vp=0;Vpxr(Sc,jt.iconBox,l.ah.horizontal),()=>{const oi=jt.verticalTextBox;return g.allowVerticalPlacement&&!(Wn&&Wn.box&&Wn.box.length)&>.numVerticalGlyphVertices>0&&oi?xr(oi,jt.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),Wn&&(Xt=Wn.box,pn=Wn.offscreen);const rs=ri(Wn&&Wn.box);if(!Xt&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[gt.crossTileID];oi&&(this.variableOffsets[gt.crossTileID]=oi,this.markUsedJustification(g,oi.anchor,gt,rs))}}}if(li=Wn,Xt=li&&li.box&&li.box.length>0,pn=li&&li.offscreen,gt.useRuntimeCollisionCircles){const ri=g.text.placedSymbolArray.get(gt.centerJustifiedTextSymbolIndex),br=l.ai(g.textSizeData,Z,ri),pr=v.get("text-padding");vr=this.collisionIndex.placeCollisionCircles(te,ri,g.lineVertexArray,g.glyphOffsetArray,br,C,L,M,m,Ue,ae.predicate,gt.collisionCircleDiameter,pr,mt),vr.circles.length&&vr.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Xt=we||vr.circles.length>0&&!vr.collisionDetected,pn=pn&&vr.offscreen}if(jt.iconFeatureIndex&&(el=jt.iconFeatureIndex),jt.iconBox){const ri=br=>{const pr=qe&&Lr?to(br,Lr.x,Lr.y,Me,Ue,this.transform.angle):br;return this.collisionIndex.placeCollisionBox(pr,Ve,R,C,ae.predicate,mt)};zo&&zo.box&&zo.box.length&&jt.verticalIconBox?(ui=ri(jt.verticalIconBox),hn=ui.box.length>0):(ui=ri(jt.iconBox),hn=ui.box.length>0),pn=pn&&ui.offscreen}const tl=se||gt.numHorizontalGlyphVertices===0&>.numVerticalGlyphVertices===0,Hs=pe||gt.numIconVertices===0;if(tl||Hs?Hs?tl||(hn=hn&&Xt):Xt=hn&&Xt:hn=Xt=hn&&Xt,Xt&&li&&li.box&&this.collisionIndex.insertCollisionBox(li.box,te,v.get("text-ignore-placement"),g.bucketInstanceId,zo&&zo.box&&Ws?Ws:Fo,ae.ID),hn&&ui&&this.collisionIndex.insertCollisionBox(ui.box,Ve,v.get("icon-ignore-placement"),g.bucketInstanceId,el,ae.ID),vr&&(Xt&&this.collisionIndex.insertCollisionCircles(vr.circles,te,v.get("text-ignore-placement"),g.bucketInstanceId,Fo,ae.ID),m)){const ri=g.bucketInstanceId;let br=this.collisionCircleArrays[ri];br===void 0&&(br=this.collisionCircleArrays[ri]=new ti);for(let pr=0;pr=0;--jt){const an=gt[jt];sn(g.symbolInstances.get(an),g.collisionArrays[an])}}else for(let gt=s.symbolInstanceStart;gt=0&&(s.text.placedSymbolArray.get(L).crossTileID=v>=0&&L!==v?0:m.crossTileID)}markUsedOrientation(s,f,m){const g=f===l.ah.horizontal||f===l.ah.horizontalOnly?f:0,v=f===l.ah.vertical?f:0,C=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const L of C)s.text.placedSymbolArray.get(L).placedOrientation=g;m.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let m=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const g=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},L=f?f.placedOrientations:{};for(const M in this.placements){const R=this.placements[M],z=v[M];z?(this.opacities[M]=new Yn(z,g,R.text,R.icon),m=m||R.text!==z.text.placed||R.icon!==z.icon.placed):(this.opacities[M]=new Yn(null,g,R.text,R.icon,R.skipFade),m=m||R.text||R.icon)}for(const M in v){const R=v[M];if(!this.opacities[M]){const z=new Yn(R,g,!1,!1);z.isHidden()||(this.opacities[M]=z,m=m||R.text.placed||R.icon.placed)}}for(const M in C)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=C[M]);for(const M in L)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=L[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const m={};for(const g of f){const v=g.getBucket(s);v&&g.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,m,g.collisionBoxArray)}}updateBucketOpacities(s,f,m){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],v=g.layout,C=new Yn(null,0,!1,!1,!0),L=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),R=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",Z=v.get("icon-text-fit")!=="none",ae=new Yn(null,0,L&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(L||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&m&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(m);const se=(pe,te,we)=>{for(let Ve=0;Ve0,qe=this.placedOrientations[te.crossTileID],Ze=qe===l.ah.vertical,nt=qe===l.ah.horizontal||qe===l.ah.horizontalOnly;if(we>0||Ve>0){const et=_o(Me.text);se(s.text,we,Ze?tc:et),se(s.text,Ve,nt?tc:et);const ct=Me.text.isHidden();[te.rightJustifiedTextSymbolIndex,te.centerJustifiedTextSymbolIndex,te.leftJustifiedTextSymbolIndex].forEach(gt=>{gt>=0&&(s.text.placedSymbolArray.get(gt).hidden=ct||Ze?1:0)}),te.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(te.verticalPlacedTextSymbolIndex).hidden=ct||nt?1:0);const mt=this.variableOffsets[te.crossTileID];mt&&this.markUsedJustification(s,mt.anchor,te,qe);const sn=this.placedOrientations[te.crossTileID];sn&&(this.markUsedJustification(s,"left",te,sn),this.markUsedOrientation(s,sn,te))}if(Ue){const et=_o(Me.icon),ct=!(Z&&te.verticalPlacedIconSymbolIndex&&Ze);te.placedIconSymbolIndex>=0&&(se(s.icon,te.numIconVertices,ct?et:tc),s.icon.placedSymbolArray.get(te.placedIconSymbolIndex).hidden=Me.icon.isHidden()),te.verticalPlacedIconSymbolIndex>=0&&(se(s.icon,te.numVerticalIconVertices,ct?tc:et),s.icon.placedSymbolArray.get(te.verticalPlacedIconSymbolIndex).hidden=Me.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const et=s.collisionArrays[pe];if(et){let ct=new l.P(0,0);if(et.textBox||et.verticalTextBox){let sn=!0;if(R){const gt=this.variableOffsets[me];gt?(ct=ai(gt.anchor,gt.width,gt.height,gt.textOffset,gt.textBoxScale),z&&ct._rotate(F?this.transform.angle:-this.transform.angle)):sn=!1}et.textBox&&wi(s.textCollisionBox.collisionVertexArray,Me.text.placed,!sn||Ze,ct.x,ct.y),et.verticalTextBox&&wi(s.textCollisionBox.collisionVertexArray,Me.text.placed,!sn||nt,ct.x,ct.y)}const mt=!!(!nt&&et.verticalIconBox);et.iconBox&&wi(s.iconCollisionBox.collisionVertexArray,Me.icon.placed,mt,Z?ct.x:0,Z?ct.y:0),et.verticalIconBox&&wi(s.iconCollisionBox.collisionVertexArray,Me.icon.placed,!mt,Z?ct.x:0,Z?ct.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const pe=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=pe.invProjMatrix,s.placementViewportMatrix=pe.viewportMatrix,s.collisionCircleArray=pe.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function wi(y,s,f,m,g){y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0)}const Vs=Math.pow(2,25),um=Math.pow(2,24),K_=Math.pow(2,17),jn=Math.pow(2,16),sp=Math.pow(2,9),ap=Math.pow(2,8),Ro=Math.pow(2,1);function _o(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,f=Math.floor(127*y.opacity);return f*Vs+s*um+f*K_+s*jn+f*sp+s*ap+f*Ro+s}const tc=0;class es{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,m,g,v){const C=this._bucketParts;for(;this._currentTileIndexL.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-g>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=L)&&(!C.maxzoom||C.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new es(C)),this._inProgressLayer.continuePlacement(m[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const hu=512/l.W/2;class rh{constructor(s,f,m){this.tileID=s,this.bucketInstanceId=m,this._symbolsByKey={};const g=new Map;for(let v=0;v({x:Math.floor(M.anchorX*hu),y:Math.floor(M.anchorY*hu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(L.positions.length>128){const M=new l.au(L.positions.length,16,Uint16Array);for(const{x:R,y:z}of L.positions)M.add(R,z);M.finish(),delete L.positions,L.index=M}this._symbolsByKey[v]=L}}getScaledCoordinates(s,f){const{x:m,y:g,z:v}=this.tileID.canonical,{x:C,y:L,z:M}=f.canonical,R=hu/Math.pow(2,M-v),z=(L*l.W+s.anchorY)*R,F=g*l.W*hu;return{x:Math.floor((C*l.W+s.anchorX)*R-m*l.W*hu),y:Math.floor(z-F)}}findMatches(s,f,m){const g=this.tileID.canonical.zs)}}class ni{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class nc{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const m in this.indexes){const g=this.indexes[m],v={};for(const C in g){const L=g[C];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+f),v[L.tileID.key]=L}this.indexes[m]=v}this.lng=s}addBucket(s,f,m){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const L in C){const M=C[L];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,g)}else{const L=C[s.scaledTo(Number(v)).key];L&&L.findMatches(f.symbolInstances,s,g)}}for(let v=0;v{f[m]=!0});for(const m in this.layerIndexes)f[m]||delete this.layerIndexes[m]}}const yr=(y,s)=>l.t(y,s&&s.filter(f=>f.identifier!=="source.canvas")),ih=l.av();class No extends l.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const g=this.sourceCaches[m].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[m].reload()}},this.map=s,this.dispatcher=new ir(Bn(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,g)=>this.getGlyphs(m,g)),this.dispatcher.registerMessageHandler("GI",(m,g)=>this.getImages(m,g)),this.imageManager=new Ye,this.imageManager.setEventedParent(this),this.glyphManager=new Ne(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Ht(256,512),this.crossTileSymbolIndex=new Xa,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ax()),lt().on(ki,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const g=this.sourceCaches[m.sourceId];if(!g)return;const v=g.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const L=this._layers[C];L.source===v.id&&this._validateLayer(L)}})}loadURL(s,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,l.h(g,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,m)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new l.j(v))})}loadJSON(s,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(ih,{validate:!1})}_load(s,f,m){var g;const v=f.transformStyle?f.transformStyle(m,s):s;if(!f.validate||!yr(this,l.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new Gt(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const s=l.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const m=l.az(f);m.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=m}}_loadSprite(s,f=!1,m=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,L,M){return l._(this,void 0,void 0,function*(){const R=Le(v),z=L>1?"@2x":"",F={},Z={};for(const{id:ae,url:se}of R){const pe=C.transformRequest(C.normalizeSpriteURL(se,z,".json"),"SpriteJSON");F[ae]=l.h(pe,M);const te=C.transformRequest(C.normalizeSpriteURL(se,z,".png"),"SpriteImage");Z[ae]=q.getImage(te,M)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(ae,se){return l._(this,void 0,void 0,function*(){const pe={};for(const te in ae){pe[te]={};const we=I.getImageCanvasContext((yield se[te]).data),Ve=(yield ae[te]).data;for(const me in Ve){const{width:Me,height:Ue,x:qe,y:Ze,sdf:nt,pixelRatio:et,stretchX:ct,stretchY:mt,content:sn}=Ve[me];pe[te][me]={data:null,pixelRatio:et,sdf:nt,stretchX:ct,stretchY:mt,content:sn,spriteData:{width:Me,height:Ue,x:qe,y:Ze,context:we}}}}return pe})}(F,Z)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const L=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of L)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const R=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,v[C][M],!1):this.imageManager.addImage(R,v[C][M]),f&&(this._changedImages[R]=!0)}}}).catch(v=>{this._spriteRequest=null,g=v,this.fire(new l.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const m=s.sourceLayer;if(!m)return;const g=f.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const m=[];for(const g of s)f[g]&&m.push(f[g]);return m}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const m of f){const g=this._layers[m];g.type!=="custom"&&(s[m]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const g=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(g.length||v.length)&&this._updateWorkerLayers(g,v);for(const C in this._updatedSources){const L=this._updatedSources[C];if(L==="reload")this._reloadSource(C);else{if(L!=="clear")throw new Error(`Invalid action ${L}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const m={};for(const g in this.sourceCaches){const v=this.sourceCaches[g];m[g]=v.used,v.used=!1}for(const g of this._order){const v=this._layers[g];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const g in m){const v=this.sourceCaches[g];!!m[g]!=!!v.used&&v.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var m;this._checkLoaded();const g=this.serialize();if(s=f.transformStyle?f.transformStyle(g,s):s,((m=f.validate)===null||m===void 0||m)&&yr(this,l.x(s)))return!1;(s=l.aA(s)).layers=l.ay(s.layers);const v=l.aB(g,s),C=this._getOperationsToPerform(v);if(C.unimplemented.length>0)throw new Error(`Unimplemented: ${C.unimplemented.join(", ")}.`);if(C.operations.length===0)return!1;for(const L of C.operations)L();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],m=[];for(const g of s)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":f.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":f.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":f.push(()=>{});break;default:m.push(g.command)}return{operations:f,unimplemented:m}}addImage(s,f){if(this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,m={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(l.x.source,`sources.${s}`,f,null,m))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[s]=new ei(s,f,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===s)return this.fire(new l.j(new Error(`Source "${s}" cannot be removed while layer "${m}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const m=this.sourceCaches[s].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,m={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new l.j(new Error(`Layer "${g}" already exists on this map.`)));let v;if(s.type==="custom"){if(yr(this,l.aC(s)))return;v=l.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=l.aA(s),s=l.e(s,{source:g})),this._validate(l.x.layer,`layers.${g}`,s,{arrayIndex:-1},m))return;v=l.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:g}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new l.j(new Error(`Cannot add layer "${g}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,g),this._layerOrderChanged=!0,this._layers[g]=v,this._removedLayers[g]&&v.source&&v.type!=="custom"){const L=this._removedLayers[g];delete this._removedLayers[g],L.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new l.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const m=this._order.indexOf(s);this._order.splice(m,1);const g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new l.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const m=this._order.indexOf(s);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,m){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===f&&g.maxzoom===m||(f!=null&&(g.minzoom=f),m!=null&&(g.maxzoom=m),this._updateLayer(g)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,m={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!l.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(l.x.filter,`layers.${g.id}.filter`,f,null,m)||(g.filter=l.aA(f),this._updateLayer(g)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return l.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,m,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getLayoutProperty(f),m)||(v.setLayoutProperty(f,m,g),this._updateLayer(v)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const m=this.getLayer(s);if(m)return m.getLayoutProperty(f);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,m,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getPaintProperty(f),m)||(v.setPaintProperty(f,m,g)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const m=s.source,g=s.sourceLayer,v=this.sourceCaches[m];if(v===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&g?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||g?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(g,s.id,f)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const m=s.source,g=this.sourceCaches[m];if(g===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const v=g.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(C,s.id,f):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,m=s.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||m?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(m,s.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=l.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),m=this.map.getTerrain()||void 0,g=this.stylesheet;return l.aF({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:f,terrain:m},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const f=C=>this._layers[C].type==="fill-extrusion",m={},g=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L)){m[L]=C;for(const M of s){const R=M[L];if(R)for(const z of R)g.push(z)}}}g.sort((C,L)=>L.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L))for(let M=g.length-1;M>=0;M--){const R=g[M].feature;if(m[R.layer.id]{const nt=we.featureSortOrder;if(nt){const et=nt.indexOf(qe.featureIndex);return nt.indexOf(Ze.featureIndex)-et}return Ze.featureIndex-qe.featureIndex});for(const qe of Ue)Me.push(qe)}}for(const we in se)se[we].forEach(Ve=>{const me=Ve.feature,Me=R[L[we].source].getFeatureState(me.layer["source-layer"],me.id);me.source=me.layer.source,me.layer["source-layer"]&&(me.sourceLayer=me.layer["source-layer"]),me.state=Me});return se}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(l.x.filter,"querySourceFeatures.filter",f.filter,null,f);const m=this.sourceCaches[s];return m?function(g,v){const C=g.getRenderableIds().map(R=>g.getTileByID(R)),L=[],M={};for(let R=0;RZ.getTileByID(ae)).sort((ae,se)=>se.tileID.overscaledZ-ae.tileID.overscaledZ||(ae.tileID.isLessThan(se.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(z,M[z.source],s.center.lng);C=C||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new ts(s,this.map.terrain,this._order,v,f,m,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(I.now()),L=!0),C&&this.pauseablePlacement.placement.setStale()),L||C)for(const R of this._order){const z=this._layers[R];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(I.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,f.icons),m})}getGlyphs(s,f){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(f.stacks),g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(l.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,m={},g){this._checkLoaded();const v=[{id:s,url:f}],C=[...Le(this.stylesheet.sprite),...v];this._validate(l.x.sprite,"sprite",C,null,m)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,g))}removeSprite(s){this._checkLoaded();const f=Le(this.stylesheet.sprite);if(f.find(m=>m.id===s)){if(this._spritesImagesIds[s])for(const m of this._spritesImagesIds[s])this.imageManager.removeImage(m),this._changedImages[m]=!0;f.splice(f.findIndex(m=>m.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Le(this.stylesheet.sprite)}setSprite(s,f={},m){this._checkLoaded(),s&&this._validate(l.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,m):(this._unloadSprite(),m&&m(null)))}}var oh=l.X([{name:"a_pos",type:"Int16",components:2}]),Us="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 rc={prelude:qn(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 +);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} +#ifdef TERRAIN3D +uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; +#endif +const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { +#ifdef TERRAIN3D +highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; +#else +return 0.0; +#endif +}`),background:qn(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:qn(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:qn(`varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:qn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:qn(`uniform highp float u_intensity;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +void main(void) { +#pragma mapbox: initialize highp float weight +#pragma mapbox: initialize mediump float radius +vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:qn(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(0.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:qn("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:qn("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:qn("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:qn(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:qn(`varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:qn(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:qn(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:qn(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:qn(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:qn(`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:qn(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:qn(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:qn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),linePattern:qn(`#ifdef GL_ES +precision highp float; +#endif +uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:qn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:qn(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:qn(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:qn(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:qn(`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:qn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Us),terrainDepth:qn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Us),terrainCoords:qn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Us)};function qn(y,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(g):g,L={};return{fragmentSource:y=y.replace(f,(M,R,z,F,Z)=>(L[Z]=!0,R==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +varying ${z} ${F} ${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${Z} + ${z} ${F} ${Z} = u_${Z}; +#endif +`)),vertexSource:s=s.replace(f,(M,R,z,F,Z)=>{const ae=F==="float"?"vec2":"vec4",se=Z.match(/color/)?"color":ae;return L[Z]?R==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +uniform lowp float u_${Z}_t; +attribute ${z} ${ae} a_${Z}; +varying ${z} ${F} ${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:se==="vec4"?` +#ifndef HAS_UNIFORM_u_${Z} + ${Z} = a_${Z}; +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Z} + ${Z} = unpack_mix_${se}(a_${Z}, u_${Z}_t); +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:R==="define"?` +#ifndef HAS_UNIFORM_u_${Z} +uniform lowp float u_${Z}_t; +attribute ${z} ${ae} a_${Z}; +#else +uniform ${z} ${F} u_${Z}; +#endif +`:se==="vec4"?` +#ifndef HAS_UNIFORM_u_${Z} + ${z} ${F} ${Z} = a_${Z}; +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Z} + ${z} ${F} ${Z} = unpack_mix_${se}(a_${Z}, u_${Z}_t); +#else + ${z} ${F} ${Z} = u_${Z}; +#endif +`}),staticAttributes:m,staticUniforms:C}}class sh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,m,g,v,C,L,M,R){this.context=s;let z=this.boundPaintVertexBuffers.length!==g.length;for(let F=0;!z&&F({u_depth:new l.aG(qe,Ze.u_depth),u_terrain:new l.aG(qe,Ze.u_terrain),u_terrain_dim:new l.aH(qe,Ze.u_terrain_dim),u_terrain_matrix:new l.aI(qe,Ze.u_terrain_matrix),u_terrain_unpack:new l.aJ(qe,Ze.u_terrain_unpack),u_terrain_exaggeration:new l.aH(qe,Ze.u_terrain_exaggeration)}))(s,Ue),this.binderUniforms=m?m.getUniforms(s,Ue):[]}draw(s,f,m,g,v,C,L,M,R,z,F,Z,ae,se,pe,te,we,Ve){const me=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(m),s.setStencilMode(g),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(me.TEXTURE2),me.bindTexture(me.TEXTURE_2D,M.depthTexture),s.activeTexture.set(me.TEXTURE3),me.bindTexture(me.TEXTURE_2D,M.texture);for(const Ue in this.terrainUniforms)this.terrainUniforms[Ue].set(M[Ue])}for(const Ue in this.fixedUniforms)this.fixedUniforms[Ue].set(L[Ue]);pe&&pe.setUniforms(s,this.binderUniforms,ae,{zoom:se});let Me=0;switch(f){case me.LINES:Me=2;break;case me.TRIANGLES:Me=3;break;case me.LINE_STRIP:Me=1}for(const Ue of Z.get()){const qe=Ue.vaos||(Ue.vaos={});(qe[R]||(qe[R]=new sh)).bind(s,this,z,pe?pe.getPaintVertexBuffers():[],F,Ue.vertexOffset,te,we,Ve),me.drawElements(f,Ue.primitiveLength*Me,me.UNSIGNED_SHORT,Ue.primitiveOffset*Me*2)}}}function ah(y,s,f){const m=1/Qt(f,1,s.transform.tileZoom),g=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/g,C=v*(f.tileID.canonical.x+f.tileID.wrap*g),L=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[m,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[C>>16,L>>16],u_pixel_coord_lower:[65535&C,65535&L]}}const ic=(y,s,f,m)=>{const g=s.style.light,v=g.properties.get("position"),C=[v.x,v.y,v.z],L=function(){var R=new l.A(9);return l.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();g.properties.get("anchor")==="viewport"&&function(R,z){var F=Math.sin(z),Z=Math.cos(z);R[0]=Z,R[1]=F,R[2]=0,R[3]=-F,R[4]=Z,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(L,-s.transform.angle),function(R,z,F){var Z=z[0],ae=z[1],se=z[2];R[0]=Z*F[0]+ae*F[3]+se*F[6],R[1]=Z*F[1]+ae*F[4]+se*F[7],R[2]=Z*F[2]+ae*F[5]+se*F[8]}(C,C,L);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:C,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:m}},J_=(y,s,f,m,g,v,C)=>l.e(ic(y,s,f,m),ah(v,s,C),{u_height_factor:-Math.pow(2,g.overscaledZ)/C.tileSize/8}),cm=y=>({u_matrix:y}),lh=(y,s,f,m)=>l.e(cm(y),ah(f,s,m)),Q_=(y,s)=>({u_matrix:y,u_world:s}),hm=(y,s,f,m,g)=>l.e(lh(y,s,f,m),{u_world:g}),$_=(y,s,f,m)=>{const g=y.transform;let v,C;if(m.paint.get("circle-pitch-alignment")==="map"){const L=Qt(f,1,g.zoom);v=!0,C=[L,L]}else v=!1,C=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,f,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:C}},fm=(y,s,f)=>{const m=Qt(f,1,s.zoom),g=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[s.pixelsToGLUnits[0]/(m*g),s.pixelsToGLUnits[1]/(m*g)],u_overscale_factor:v}},pm=(y,s,f=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:f}),uh=y=>({u_matrix:y}),dm=(y,s,f,m)=>({u_matrix:y,u_extrude_scale:Qt(s,1,f),u_intensity:m});function mm(y,s){const f=Math.pow(2,s.canonical.z),m=s.canonical.y;return[new l.Y(0,m/f).toLngLat().lat,new l.Y(0,(m+1)/f).toLngLat().lat]}const ch=(y,s,f,m)=>{const g=y.transform;return{u_matrix:oc(y,s,f,m),u_ratio:1/Qt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},gm=(y,s,f,m,g)=>l.e(ch(y,s,f,g),{u_image:0,u_image_height:m}),Pl=(y,s,f,m,g)=>{const v=y.transform,C=Oo(s,v);return{u_matrix:oc(y,s,f,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Qt(s,1,v.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[C,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},hh=(y,s,f,m,g,v)=>{const C=y.lineAtlas,L=Oo(s,y.transform),M=f.layout.get("line-cap")==="round",R=C.getDash(m.from,M),z=C.getDash(m.to,M),F=R.width*g.fromScale,Z=z.width*g.toScale;return l.e(ch(y,s,f,v),{u_patternscale_a:[L/F,-R.height/2],u_patternscale_b:[L/Z,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,Z)*y.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:z.y,u_mix:g.t})};function Oo(y,s){return 1/Qt(y,1,s.tileZoom)}function oc(y,s,f,m){return y.translatePosMatrix(m?m.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const fh=(y,s,f,m,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(C=g.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=g.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:sc(g.paint.get("raster-hue-rotate"))};var v,C};function sc(y){y*=Math.PI/180;const s=Math.sin(y),f=Math.cos(y);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const ac=(y,s,f,m,g,v,C,L,M,R)=>{const z=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:L,u_is_text:+M,u_pitch_with_map:+m,u_texsize:R,u_texture:0}},lc=(y,s,f,m,g,v,C,L,M,R,z)=>{const F=g.transform;return l.e(ac(y,s,f,m,g,v,C,L,M,R),{u_gamma_scale:m?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+z})},uc=(y,s,f,m,g,v,C,L,M,R)=>l.e(lc(y,s,f,m,g,v,C,L,!0,M,!0),{u_texsize_icon:R,u_texture_icon:1}),ey=(y,s,f)=>({u_matrix:y,u_opacity:s,u_color:f}),ty=(y,s,f,m,g,v)=>l.e(function(C,L,M,R){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:Z,height:ae}=M.imageManager.getPixelSize(),se=Math.pow(2,R.tileID.overscaledZ),pe=R.tileSize*Math.pow(2,M.transform.tileZoom)/se,te=pe*(R.tileID.canonical.x+R.tileID.wrap*se),we=pe*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[Z,ae],u_mix:L.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Qt(R,1,M.transform.tileZoom),u_pixel_coord_upper:[te>>16,we>>16],u_pixel_coord_lower:[65535&te,65535&we]}}(m,v,f,g),{u_matrix:y,u_opacity:s}),_m={fillExtrusion:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_opacity:new l.aH(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_height_factor:new l.aH(y,s.u_height_factor),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade),u_opacity:new l.aH(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_scale_with_map:new l.aG(y,s.u_scale_with_map),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_matrix:new l.aI(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(y,s.u_pixels_to_tile_units),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_overscale_factor:new l.aH(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_inv_matrix:new l.aI(y,s.u_inv_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_viewport_size:new l.aL(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new l.aM(y,s.u_color),u_matrix:new l.aI(y,s.u_matrix),u_overlay:new l.aG(y,s.u_overlay),u_overlay_scale:new l.aH(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new l.aH(y,s.u_extrude_scale),u_intensity:new l.aH(y,s.u_intensity),u_matrix:new l.aI(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_color_ramp:new l.aG(y,s.u_color_ramp),u_opacity:new l.aH(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_latrange:new l.aL(y,s.u_latrange),u_light:new l.aL(y,s.u_light),u_shadow:new l.aM(y,s.u_shadow),u_highlight:new l.aM(y,s.u_highlight),u_accent:new l.aM(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_dimension:new l.aL(y,s.u_dimension),u_zoom:new l.aH(y,s.u_zoom),u_unpack:new l.aJ(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_image:new l.aG(y,s.u_image),u_image_height:new l.aH(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texsize:new l.aL(y,s.u_texsize),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_image:new l.aG(y,s.u_image),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_patternscale_a:new l.aL(y,s.u_patternscale_a),u_patternscale_b:new l.aL(y,s.u_patternscale_b),u_sdfgamma:new l.aH(y,s.u_sdfgamma),u_image:new l.aG(y,s.u_image),u_tex_y_a:new l.aH(y,s.u_tex_y_a),u_tex_y_b:new l.aH(y,s.u_tex_y_b),u_mix:new l.aH(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_tl_parent:new l.aL(y,s.u_tl_parent),u_scale_parent:new l.aH(y,s.u_scale_parent),u_buffer_scale:new l.aH(y,s.u_buffer_scale),u_fade_t:new l.aH(y,s.u_fade_t),u_opacity:new l.aH(y,s.u_opacity),u_image0:new l.aG(y,s.u_image0),u_image1:new l.aG(y,s.u_image1),u_brightness_low:new l.aH(y,s.u_brightness_low),u_brightness_high:new l.aH(y,s.u_brightness_high),u_saturation_factor:new l.aH(y,s.u_saturation_factor),u_contrast_factor:new l.aH(y,s.u_contrast_factor),u_spin_weights:new l.aK(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texsize_icon:new l.aL(y,s.u_texsize_icon),u_texture:new l.aG(y,s.u_texture),u_texture_icon:new l.aG(y,s.u_texture_icon),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_color:new l.aM(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_image:new l.aG(y,s.u_image),u_pattern_tl_a:new l.aL(y,s.u_pattern_tl_a),u_pattern_br_a:new l.aL(y,s.u_pattern_br_a),u_pattern_tl_b:new l.aL(y,s.u_pattern_tl_b),u_pattern_br_b:new l.aL(y,s.u_pattern_br_b),u_texsize:new l.aL(y,s.u_texsize),u_mix:new l.aH(y,s.u_mix),u_pattern_size_a:new l.aL(y,s.u_pattern_size_a),u_pattern_size_b:new l.aL(y,s.u_pattern_size_b),u_scale_a:new l.aH(y,s.u_scale_a),u_scale_b:new l.aH(y,s.u_scale_b),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_terrain_coords_id:new l.aH(y,s.u_terrain_coords_id),u_ele_delta:new l.aH(y,s.u_ele_delta)})};class ny{constructor(s,f,m){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ml={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ph{constructor(s,f,m,g){this.length=f.length,this.attributes=m,this.itemSize=f.bytesPerElement,this.dynamicDraw=g,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let m=0;m0){const ct=l.F(),mt=Ze;l.aP(ct,qe.placementInvProjMatrix,y.transform.glCoordMatrix),l.aP(ct,ct,qe.placementViewportMatrix),z.push({circleArray:et,circleOffset:Z,transform:mt,invTransform:ct,coord:Me}),F+=et.length/4,Z=F}nt&&R.draw(L,M.LINES,In.disabled,sr.disabled,y.colorModeForRenderPass(),er.disabled,fm(Ze,y.transform,Ue),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Me),f.id,nt.layoutVertexBuffer,nt.indexBuffer,nt.segments,null,y.transform.zoom,null,null,nt.collisionVertexBuffer)}if(!C||!z.length)return;const ae=y.useProgram("collisionCircle"),se=new l.aQ;se.resize(4*F),se._trim();let pe=0;for(const me of z)for(let Me=0;Me=0&&(se[te.associatedIconIndex]={shiftedAnchor:sn,angle:gt})}else Ke(te.numGlyphs,Z)}if(R){ae.clear();const pe=y.icon.placedSymbolArray;for(let te=0;tey.style.map.terrain.getElevation(nt,rs,oi):null,xr=f.layout.get("text-rotation-alignment")==="map";W(ct,nt.posMatrix,y,g,Fo,Ws,te,R,xr,ii)}const tl=y.translatePosMatrix(nt.posMatrix,et,v,C),Hs=we||g&&qe||Sc?yp:Fo,ri=y.translatePosMatrix(Ws,et,v,C,!0),br=gt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let pr;pr=gt?ct.iconsInText?uc(jt.kind,Xt,Ve,te,y,tl,Hs,ri,pn,li):lc(jt.kind,Xt,Ve,te,y,tl,Hs,ri,g,pn,!0):ac(jt.kind,Xt,Ve,te,y,tl,Hs,ri,g,pn);const ns={program:Cn,buffers:mt,uniformValues:pr,atlasTexture:Lr,atlasTextureIcon:vr,atlasInterpolation:Wn,atlasInterpolationIcon:zo,isSDF:gt,hasHalo:br};if(me&&ct.canOverlap){Me=!0;const ii=mt.segments.get();for(const xr of ii)Ze.push({segments:new l.$([xr]),sortKey:xr.sortKey,state:ns,terrainData:hn})}else Ze.push({segments:mt.segments,sortKey:0,state:ns,terrainData:hn})}Me&&Ze.sort((nt,et)=>nt.sortKey-et.sortKey);for(const nt of Ze){const et=nt.state;if(Z.activeTexture.set(ae.TEXTURE0),et.atlasTexture.bind(et.atlasInterpolation,ae.CLAMP_TO_EDGE),et.atlasTextureIcon&&(Z.activeTexture.set(ae.TEXTURE1),et.atlasTextureIcon&&et.atlasTextureIcon.bind(et.atlasInterpolationIcon,ae.CLAMP_TO_EDGE)),et.isSDF){const ct=et.uniformValues;et.hasHalo&&(ct.u_is_halo=1,Cm(et.buffers,nt.segments,f,y,et.program,Ue,z,F,ct,nt.terrainData)),ct.u_is_halo=0}Cm(et.buffers,nt.segments,f,y,et.program,Ue,z,F,et.uniformValues,nt.terrainData)}}function Cm(y,s,f,m,g,v,C,L,M,R){const z=m.context;g.draw(z,z.gl.TRIANGLES,v,C,L,er.disabled,M,R,f.id,y.layoutVertexBuffer,y.indexBuffer,s,f.paint,m.transform.zoom,y.programConfigurations.get(f.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Eh(y,s,f,m,g){if(!f||!m||!m.imageAtlas)return;const v=m.imageAtlas.patternPositions;let C=v[f.to.toString()],L=v[f.from.toString()];if(!C&&L&&(C=L),!L&&C&&(L=C),!C||!L){const M=g.getPaintProperty(s);C=v[M],L=v[M]}C&&L&&y.setConstantPatternPositions(C,L)}function Tm(y,s,f,m,g,v,C){const L=y.context.gl,M="fill-pattern",R=f.paint.get(M),z=R&&R.constantOr(1),F=f.getCrossfadeParameters();let Z,ae,se,pe,te;C?(ae=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=L.LINES):(ae=z?"fillPattern":"fill",Z=L.TRIANGLES);const we=R.constantOr(null);for(const Ve of m){const me=s.getTile(Ve);if(z&&!me.patternsLoaded())continue;const Me=me.getBucket(f);if(!Me)continue;const Ue=Me.programConfigurations.get(f.id),qe=y.useProgram(ae,Ue),Ze=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ve);z&&(y.context.activeTexture.set(L.TEXTURE0),me.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ue.updatePaintBuffers(F)),Eh(Ue,M,we,me,f);const nt=Ze?Ve:null,et=y.translatePosMatrix(nt?nt.posMatrix:Ve.posMatrix,me,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){pe=Me.indexBuffer2,te=Me.segments2;const ct=[L.drawingBufferWidth,L.drawingBufferHeight];se=ae==="fillOutlinePattern"&&z?hm(et,y,F,me,ct):Q_(et,ct)}else pe=Me.indexBuffer,te=Me.segments,se=z?lh(et,y,F,me):cm(et);qe.draw(y.context,Z,g,y.stencilModeForClipping(Ve),v,er.disabled,se,Ze,f.id,Me.layoutVertexBuffer,pe,te,f.paint,y.transform.zoom,Ue)}}function Ih(y,s,f,m,g,v,C){const L=y.context,M=L.gl,R="fill-extrusion-pattern",z=f.paint.get(R),F=z.constantOr(1),Z=f.getCrossfadeParameters(),ae=f.paint.get("fill-extrusion-opacity"),se=z.constantOr(null);for(const pe of m){const te=s.getTile(pe),we=te.getBucket(f);if(!we)continue;const Ve=y.style.map.terrain&&y.style.map.terrain.getTerrainData(pe),me=we.programConfigurations.get(f.id),Me=y.useProgram(F?"fillExtrusionPattern":"fillExtrusion",me);F&&(y.context.activeTexture.set(M.TEXTURE0),te.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),me.updatePaintBuffers(Z)),Eh(me,R,se,te,f);const Ue=y.translatePosMatrix(pe.posMatrix,te,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),qe=f.paint.get("fill-extrusion-vertical-gradient"),Ze=F?J_(Ue,y,qe,ae,pe,Z,te):ic(Ue,y,qe,ae);Me.draw(L,L.gl.TRIANGLES,g,v,C,er.backCCW,Ze,Ve,f.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,f.paint,y.transform.zoom,me,y.style.map.terrain&&we.centroidVertexBuffer)}}function Ch(y,s,f,m,g,v,C){const L=y.context,M=L.gl,R=f.fbo;if(!R)return;const z=y.useProgram("hillshade"),F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,R.colorAttachment.get()),z.draw(L,M.TRIANGLES,g,v,C,er.disabled,((Z,ae,se,pe)=>{const te=se.paint.get("hillshade-shadow-color"),we=se.paint.get("hillshade-highlight-color"),Ve=se.paint.get("hillshade-accent-color");let me=se.paint.get("hillshade-illumination-direction")*(Math.PI/180);se.paint.get("hillshade-illumination-anchor")==="viewport"&&(me-=Z.transform.angle);const Me=!Z.options.moving;return{u_matrix:pe?pe.posMatrix:Z.transform.calculatePosMatrix(ae.tileID.toUnwrapped(),Me),u_image:0,u_latrange:mm(0,ae.tileID),u_light:[se.paint.get("hillshade-exaggeration"),me],u_shadow:te,u_highlight:we,u_accent:Ve}})(y,f,m,F?s:null),F,m.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function vp(y,s,f,m,g,v){const C=y.context,L=C.gl,M=s.dem;if(M&&M.data){const R=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(L.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(z),s.demTexture){const ae=s.demTexture;ae.update(F,{premultiply:!1}),ae.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else s.demTexture=new X(C,F,L.RGBA,{premultiply:!1}),s.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);C.activeTexture.set(L.TEXTURE0);let Z=s.fbo;if(!Z){const ae=new X(C,{width:R,height:R,data:null},L.RGBA);ae.bind(L.LINEAR,L.CLAMP_TO_EDGE),Z=s.fbo=C.createFramebuffer(R,R,!0,!1),Z.colorAttachment.set(ae.texture)}C.bindFramebuffer.set(Z.framebuffer),C.viewport.set([0,0,R,R]),y.useProgram("hillshadePrepare").draw(C,L.TRIANGLES,m,g,v,er.disabled,((ae,se)=>{const pe=se.stride,te=l.F();return l.aN(te,0,l.W,-l.W,0,0,1),l.H(te,te,[0,-l.W,0]),{u_matrix:te,u_image:1,u_dimension:[pe,pe],u_zoom:ae.overscaledZ,u_unpack:se.getUnpackVector()}})(s.tileID,M),null,f.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Lm(y,s,f,m,g,v){const C=m.paint.get("raster-fade-duration");if(!v&&C>0){const L=I.now(),M=(L-y.timeAdded)/C,R=s?(L-s.timeAdded)/C:-1,z=f.getSource(),F=g.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),Z=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(y.tileID.overscaledZ-F),ae=Z&&y.refreshedUponExpiration?1:l.ac(Z?M:1-R,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-ae}:{opacity:ae,mix:0}}return{opacity:1,mix:0}}const Pm=new l.aO(1,0,0,1),Th=new l.aO(0,1,0,1),bp=new l.aO(0,0,1,1),hy=new l.aO(1,0,1,1),Mm=new l.aO(0,1,1,1);function Cr(y,s,f,m){ro(y,0,s+f/2,y.transform.width,f,m)}function Ka(y,s,f,m){ro(y,s-f/2,0,f,y.transform.height,m)}function ro(y,s,f,m,g,v){const C=y.context,L=C.gl;L.enable(L.SCISSOR_TEST),L.scissor(s*y.pixelRatio,f*y.pixelRatio,m*y.pixelRatio,g*y.pixelRatio),C.clear({color:v}),L.disable(L.SCISSOR_TEST)}function xp(y,s,f){const m=y.context,g=m.gl,v=f.posMatrix,C=y.useProgram("debug"),L=In.disabled,M=sr.disabled,R=y.colorModeForRenderPass(),z="$debug",F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(f);m.activeTexture.set(g.TEXTURE0);const Z=s.getTileByID(f.key).latestRawTileData,ae=Math.floor((Z&&Z.byteLength||0)/1024),se=s.getTile(f).tileSize,pe=512/Math.min(se,512)*(f.overscaledZ/y.transform.zoom)*.5;let te=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(te+=` => ${f.overscaledZ}`),function(we,Ve){we.initDebugOverlayCanvas();const me=we.debugOverlayCanvas,Me=we.context.gl,Ue=we.debugOverlayCanvas.getContext("2d");Ue.clearRect(0,0,me.width,me.height),Ue.shadowColor="white",Ue.shadowBlur=2,Ue.lineWidth=1.5,Ue.strokeStyle="white",Ue.textBaseline="top",Ue.font="bold 36px Open Sans, sans-serif",Ue.fillText(Ve,5,5),Ue.strokeText(Ve,5,5),we.debugOverlayTexture.update(me),we.debugOverlayTexture.bind(Me.LINEAR,Me.CLAMP_TO_EDGE)}(y,`${te} ${ae}kB`),C.draw(m,g.TRIANGLES,L,M,Ur.alphaBlended,er.disabled,pm(v,l.aO.transparent,pe),null,z,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),C.draw(m,g.LINE_STRIP,L,M,R,er.disabled,pm(v,l.aO.red),F,z,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Lh(y,s,f){const m=y.context,g=m.gl,v=y.colorModeForRenderPass(),C=new In(g.LEQUAL,In.ReadWrite,y.depthRangeFor3D),L=y.useProgram("terrain"),M=s.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,y.width,y.height]);for(const R of f){const z=y.renderToTexture.getTexture(R),F=s.getTerrainData(R.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,z.texture);const Z={u_matrix:y.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};L.draw(m,g.TRIANGLES,C,sr.disabled,v,er.backCCW,Z,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Am{constructor(s,f){this.context=new cy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ei.maxUnderzooming+ei.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xa}resize(s,f,m){if(this.width=Math.floor(s*m),this.height=Math.floor(f*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,f=new l.aV;f.emplaceBack(0,0),f.emplaceBack(l.W,0),f.emplaceBack(0,l.W),f.emplaceBack(l.W,l.W),this.tileExtentBuffer=s.createVertexBuffer(f,oh.members),this.tileExtentSegments=l.$.simpleSegment(0,0,4,2);const m=new l.aV;m.emplaceBack(0,0),m.emplaceBack(l.W,0),m.emplaceBack(0,l.W),m.emplaceBack(l.W,l.W),this.debugBuffer=s.createVertexBuffer(m,oh.members),this.debugSegments=l.$.simpleSegment(0,0,4,5);const g=new l.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(l.W,0,l.W,0),g.emplaceBack(0,l.W,0,l.W),g.emplaceBack(l.W,l.W,l.W,l.W),this.rasterBoundsBuffer=s.createVertexBuffer(g,fn.members),this.rasterBoundsSegments=l.$.simpleSegment(0,0,4,2);const v=new l.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,oh.members),this.viewportSegments=l.$.simpleSegment(0,0,4,2);const C=new l.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const L=new l.aX;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(L);const M=this.context.gl;this.stencilClearMode=new sr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.F();l.aN(m,0,this.width,this.height,0,0,1),l.J(m,m,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,In.disabled,this.stencilClearMode,Ur.disabled,er.disabled,uh(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const m=this.context,g=m.gl;this.nextStencilID+f.length>256&&this.clearStencil(),m.setColorMode(Ur.disabled),m.setDepthMode(In.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const L=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(m,g.TRIANGLES,In.disabled,new sr({func:g.ALWAYS,mask:0},L,255,g.KEEP,g.KEEP,g.REPLACE),Ur.disabled,er.disabled,uh(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new sr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new sr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,m=s.sort((C,L)=>L.overscaledZ-C.overscaledZ),g=m[m.length-1].overscaledZ,v=m[0].overscaledZ-g+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let L=0;L=0;this.currentLayer--){const M=this.style._layers[m[this.currentLayer]],R=g[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,R,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerte.source&&!te.isHidden(z)?[R.sourceCaches[te.source]]:[]),ae=Z.filter(te=>te.getSource().type==="vector"),se=Z.filter(te=>te.getSource().type!=="vector"),pe=te=>{(!F||F.getSource().maxzoompe(te)),F||se.forEach(te=>pe(te)),F}(this.style,this.transform.zoom);M&&function(R,z,F){for(let Z=0;Z0),g&&(l.a_(f,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.sourceCache.getRenderableTiles(),ae=v.useProgram("terrainDepth");L.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1});for(const se of Z){const pe=C.getTerrainData(se.tileID),te={u_matrix:v.transform.calculatePosMatrix(se.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ae.draw(L,M.TRIANGLES,z,sr.disabled,R,er.backCCW,te,pe,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.getCoordsTexture(),ae=C.sourceCache.getRenderableTiles(),se=v.useProgram("terrainCoords");L.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1}),C.coordsIndex=[];for(const pe of ae){const te=C.getTerrainData(pe.tileID);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,Z.texture);const we={u_matrix:v.transform.calculatePosMatrix(pe.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};se.draw(L,M.TRIANGLES,z,sr.disabled,R,er.backCCW,we,te,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(pe.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(v,C,L,M,R){if(v.renderPass!=="translucent")return;const z=sr.disabled,F=v.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,ae,se,pe,te,we,Ve){const me=ae.transform,Me=te==="map",Ue=we==="map";for(const qe of Z){const Ze=pe.getTile(qe),nt=Ze.getBucket(se);if(!nt||!nt.text||!nt.text.segments.get().length)continue;const et=l.ag(nt.textSizeData,me.zoom),ct=Qt(Ze,1,ae.transform.zoom),mt=tn(qe.posMatrix,Ue,Me,ae.transform,ct),sn=se.layout.get("icon-text-fit")!=="none"&&nt.hasIconData();if(et){const gt=Math.pow(2,me.zoom-Ze.tileID.overscaledZ);xh(nt,Me,Ue,Ve,me,mt,qe.posMatrix,gt,et,sn,ae.style.map.terrain?(jt,an)=>ae.style.map.terrain.getElevation(qe,jt,an):null)}}}(M,v,L,C,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),R),L.paint.get("icon-opacity").constantOr(1)!==0&&Sh(v,C,L,M,!1,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),L.layout.get("icon-rotation-alignment"),L.layout.get("icon-pitch-alignment"),L.layout.get("icon-keep-upright"),z,F),L.paint.get("text-opacity").constantOr(1)!==0&&Sh(v,C,L,M,!0,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(bh(v,C,L,M,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),!0),bh(v,C,L,M,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),!1))})(s,f,m,g,this.style.placement.variableOffsets);break;case"circle":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("circle-opacity"),z=L.paint.get("circle-stroke-width"),F=L.paint.get("circle-stroke-opacity"),Z=!L.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const ae=v.context,se=ae.gl,pe=v.depthModeForSublayer(0,In.ReadOnly),te=sr.disabled,we=v.colorModeForRenderPass(),Ve=[];for(let me=0;meme.sortKey-Me.sortKey);for(const me of Ve){const{programConfiguration:Me,program:Ue,layoutVertexBuffer:qe,indexBuffer:Ze,uniformValues:nt,terrainData:et}=me.state;Ue.draw(ae,se.TRIANGLES,pe,te,we,er.disabled,nt,et,L.id,qe,Ze,me.segments,L.paint,v.transform.zoom,Me)}})(s,f,m,g);break;case"heatmap":(function(v,C,L,M){if(L.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,z=R.gl,F=sr.disabled,Z=new Ur([z.ONE,z.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(ae,se,pe){const te=ae.gl;ae.activeTexture.set(te.TEXTURE1),ae.viewport.set([0,0,se.width/4,se.height/4]);let we=pe.heatmapFbo;if(we)te.bindTexture(te.TEXTURE_2D,we.colorAttachment.get()),ae.bindFramebuffer.set(we.framebuffer);else{const Ve=te.createTexture();te.bindTexture(te.TEXTURE_2D,Ve),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_WRAP_S,te.CLAMP_TO_EDGE),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_WRAP_T,te.CLAMP_TO_EDGE),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_MIN_FILTER,te.LINEAR),te.texParameteri(te.TEXTURE_2D,te.TEXTURE_MAG_FILTER,te.LINEAR),we=pe.heatmapFbo=ae.createFramebuffer(se.width/4,se.height/4,!1,!1),function(me,Me,Ue,qe){var Ze,nt;const et=me.gl,ct=(Ze=me.HALF_FLOAT)!==null&&Ze!==void 0?Ze:et.UNSIGNED_BYTE,mt=(nt=me.RGBA16F)!==null&&nt!==void 0?nt:et.RGBA;et.texImage2D(et.TEXTURE_2D,0,mt,Me.width/4,Me.height/4,0,et.RGBA,ct,null),qe.colorAttachment.set(Ue)}(ae,se,Ve,we)}})(R,v,L),R.clear({color:l.aO.transparent});for(let ae=0;ae{const me=l.F();l.aN(me,0,pe.width,pe.height,0,0,1);const Me=pe.context.gl;return{u_matrix:me,u_world:[Me.drawingBufferWidth,Me.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:te.paint.get("heatmap-opacity")}})(R,z),null,z.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,z.paint,R.transform.zoom)}(v,L))})(s,f,m,g);break;case"line":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("line-opacity"),z=L.paint.get("line-width");if(R.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,In.ReadOnly),Z=v.colorModeForRenderPass(),ae=L.paint.get("line-dasharray"),se=L.paint.get("line-pattern"),pe=se.constantOr(1),te=L.paint.get("line-gradient"),we=L.getCrossfadeParameters(),Ve=pe?"linePattern":ae?"lineSDF":te?"lineGradient":"line",me=v.context,Me=me.gl;let Ue=!0;for(const qe of M){const Ze=C.getTile(qe);if(pe&&!Ze.patternsLoaded())continue;const nt=Ze.getBucket(L);if(!nt)continue;const et=nt.programConfigurations.get(L.id),ct=v.context.program.get(),mt=v.useProgram(Ve,et),sn=Ue||mt.program!==ct,gt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(qe),jt=se.constantOr(null);if(jt&&Ze.imageAtlas){const Xt=Ze.imageAtlas,hn=Xt.patternPositions[jt.to.toString()],pn=Xt.patternPositions[jt.from.toString()];hn&&pn&&et.setConstantPatternPositions(hn,pn)}const an=gt?qe:null,Cn=pe?Pl(v,Ze,L,we,an):ae?hh(v,Ze,L,ae,we,an):te?gm(v,Ze,L,nt.lineClipsArray.length,an):ch(v,Ze,L,an);if(pe)me.activeTexture.set(Me.TEXTURE0),Ze.imageAtlasTexture.bind(Me.LINEAR,Me.CLAMP_TO_EDGE),et.updatePaintBuffers(we);else if(ae&&(sn||v.lineAtlas.dirty))me.activeTexture.set(Me.TEXTURE0),v.lineAtlas.bind(me);else if(te){const Xt=nt.gradients[L.id];let hn=Xt.texture;if(L.gradientVersion!==Xt.version){let pn=256;if(L.stepInterpolant){const Lr=C.getSource().maxzoom,Wn=qe.canonical.z===Lr?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),m=this.imageManager.getPattern(s.to.toString());return!f||!m}useProgram(s,f){this.cache=this.cache||{};const m=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new Ya(this.context,rc[s],f,_m[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new X(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class Ja{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,m){const g=Math.pow(2,m),v=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(L=>{const M=1/(L=l.af([],L,s))[3]/f*g;return l.a$(L,L,[M,M,1/L[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const M=function(Z,ae){var se=ae[0],pe=ae[1],te=ae[2],we=se*se+pe*pe+te*te;return we>0&&(we=1/Math.sqrt(we)),Z[0]=ae[0]*we,Z[1]=ae[1]*we,Z[2]=ae[2]*we,Z}([],function(Z,ae,se){var pe=ae[0],te=ae[1],we=ae[2],Ve=se[0],me=se[1],Me=se[2];return Z[0]=te*Me-we*me,Z[1]=we*Ve-pe*Me,Z[2]=pe*me-te*Ve,Z}([],ie([],v[L[0]],v[L[1]]),ie([],v[L[2]],v[L[1]]))),R=-((z=M)[0]*(F=v[L[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(R)});return new Ja(v,C)}}class Qa{constructor(s,f){this.min=s,this.max=f,this.center=function(m,g,v){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,v){return m[0]=g[0]+v[0],m[1]=g[1]+v[1],m[2]=g[2]+v[2],m}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],m=fe(this.min),g=fe(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let L=0;Lthis.max[g]-this.min[g])return 0}return 1}}class _u{constructor(s=0,f=0,m=0,g=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=m,this.right=g}interpolate(s,f,m){return f.top!=null&&s.top!=null&&(this.top=l.z.number(s.top,f.top,m)),f.bottom!=null&&s.bottom!=null&&(this.bottom=l.z.number(s.bottom,f.bottom,m)),f.left!=null&&s.left!=null&&(this.left=l.z.number(s.left,f.left,m)),f.right!=null&&s.right!=null&&(this.right=l.z.number(s.right,f.right,m)),this}getCenter(s,f){const m=l.ac((this.left+s-this.right)/2,0,s),g=l.ac((this.top+f-this.bottom)/2,0,f);return new l.P(m,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new _u(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const wp=85.051129;class Ph{constructor(s,f,m,g,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=m??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new _u,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new Ph(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-l.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,v){var C=g[0],L=g[1],M=g[2],R=g[3],z=Math.sin(v),F=Math.cos(v);m[0]=C*F+M*z,m[1]=L*F+R*z,m[2]=C*-z+M*F,m[3]=L*-z+R*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=l.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,m){this._unmodified=!1,this._edgeInsets.interpolate(s,f,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new l.b2(0,s)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),g=this.pointCoordinate(new l.P(this.width,0)),v=this.pointCoordinate(new l.P(this.width,this.height)),C=this.pointCoordinate(new l.P(0,this.height)),L=Math.floor(Math.min(m.x,g.x,v.x,C.x)),M=Math.floor(Math.max(m.x,g.x,v.x,C.x)),R=1;for(let z=L-R;z<=M+R;z++)z!==0&&f.push(new l.b2(z,s))}return f}coveringTiles(s){var f,m;let g=this.coveringZoomLevel(s);const v=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),L=l.Y.fromLngLat(this.center),M=Math.pow(2,g),R=[M*C.x,M*C.y,0],z=[M*L.x,M*L.y,0],F=Ja.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let Z=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=g);const ae=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,se=me=>({aabb:new Qa([me*M,0,0],[(me+1)*M,M,0]),zoom:0,x:0,y:0,wrap:me,fullyVisible:!1}),pe=[],te=[],we=g,Ve=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let me=1;me<=3;me++)pe.push(se(-me)),pe.push(se(me));for(pe.push(se(0));pe.length>0;){const me=pe.pop(),Me=me.x,Ue=me.y;let qe=me.fullyVisible;if(!qe){const mt=me.aabb.intersects(F);if(mt===0)continue;qe=mt===2}const Ze=s.terrain?R:z,nt=me.aabb.distanceX(Ze),et=me.aabb.distanceY(Ze),ct=Math.max(Math.abs(nt),Math.abs(et));if(me.zoom===we||ct>ae+(1<=Z){const mt=we-me.zoom,sn=R[0]-.5-(Me<>1),jt=me.zoom+1;let an=me.aabb.quadrant(mt);if(s.terrain){const Cn=new l.Q(jt,me.wrap,jt,sn,gt),Xt=s.terrain.getMinMaxElevation(Cn),hn=(f=Xt.minElevation)!==null&&f!==void 0?f:this.elevation,pn=(m=Xt.maxElevation)!==null&&m!==void 0?m:this.elevation;an=new Qa([an.min[0],an.min[1],hn],[an.max[0],an.max[1],pn])}pe.push({aabb:an,zoom:jt,x:sn,y:gt,wrap:me.wrap,fullyVisible:qe})}}return te.sort((me,Me)=>me.distanceSq-Me.distanceSq).map(me=>me.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=l.ac(s.lat,-85.051129,wp);return new l.P(l.N(s.lng)*this.worldSize,l.O(f)*this.worldSize)}unproject(s){return new l.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-v))return;const C=m+f-v,L=Math.cos(this._pitch)*this.cameraToCenterDistance/C/l.b3(1,g.lat),M=this.scaleZoom(L/this.tileSize);this._elevation=v,this._center=g,this.zoom=M}setLocationAtPoint(s,f){const m=this.pointCoordinate(f),g=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new l.Y(v.x-(m.x-g.x),v.y-(m.y-g.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return l.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const Z=f.pointCoordinate(s);if(Z!=null)return Z}const m=[s.x,s.y,0,1],g=[s.x,s.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(g,g,this.pixelMatrixInverse);const v=m[3],C=g[3],L=m[1]/v,M=g[1]/C,R=m[2]/v,z=g[2]/C,F=R===z?0:(0-R)/(z-R);return new l.Y(l.z.number(m[0]/v,g[0]/C,F)/this.worldSize,l.z.number(L,M,F)/this.worldSize)}coordinatePoint(s,f=0,m=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,f,1];return l.af(g,g,m),new l.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ce([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,wp])}calculatePosMatrix(s,f=!1){const m=s.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),L=v.x+Math.pow(2,v.z)*s.wrap,M=l.an(new Float64Array(16));return l.H(M,M,[L*C,v.y*C,0]),l.J(M,M,[C/l.W,C/l.W,1]),l.K(M,f?this.alignedProjMatrix:this.projMatrix,M),g[m]=new Float32Array(M),g[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=l.ac(+f,this.minZoom,this.maxZoom);const m={center:new l.M(s.lng,s.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const me=179.9999999999;g=[-me,me]}const v=this.tileSize*this.zoomScale(m.zoom);let C=0,L=v,M=0,R=v,z=0,F=0;const{x:Z,y:ae}=this.size;if(this.latRange){const me=this.latRange;C=l.O(me[1])*v,L=l.O(me[0])*v,L-CL&&(we=L-me)}if(g){const me=(M+R)/2;let Me=se;this._renderWorldCopies&&(Me=l.b1(se,me-v/2,me+v/2));const Ue=Z/2;Me-UeR&&(te=R-Ue)}if(te!==void 0||we!==void 0){const me=new l.P(te??se,we??pe);m.center=this.unproject.call({worldSize:v},me).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=m,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b3(1,this.center.lat)*this.worldSize;let g=l.an(new Float64Array(16));l.J(g,g,[this.width/2,-this.height/2,1]),l.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=l.an(new Float64Array(16)),l.J(g,g,[1,-1,1]),l.H(g,g,[-1,-1,0]),l.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),L=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?L:v,R=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(l.ac(Math.PI-R-z,.01,Math.PI-.01)),Z=this.getHorizon(),ae=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+s.y/(2*Z)),se=Math.sin(ae)*M/Math.sin(l.ac(Math.PI-R-ae,.01,Math.PI-.01)),pe=Math.min(F,se),te=1.01*(Math.cos(Math.PI/2-this._pitch)*pe+M),we=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,we,te),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,l.J(g,g,[1,-1,1]),l.H(g,g,[0,0,-this.cameraToCenterDistance]),l.b5(g,g,this._pitch),l.ad(g,g,this.angle),l.H(g,g,[-f,-m,0]),this.mercatorMatrix=l.J([],g,[this.worldSize,this.worldSize,this.worldSize]),l.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.K(new Float64Array(16),this.labelPlaneMatrix,g),l.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=l.ar([],g),this.pixelMatrix3D=l.K(new Float64Array(16),this.labelPlaneMatrix,g);const Ve=this.width%2/2,me=this.height%2/2,Me=Math.cos(this.angle),Ue=Math.sin(this.angle),qe=f-Math.round(f)+Me*Ve+Ue*me,Ze=m-Math.round(m)+Me*me+Ue*Ve,nt=new Float64Array(g);if(l.H(nt,nt,[qe>.5?qe-1:qe,Ze>.5?Ze-1:Ze,0]),this.alignedProjMatrix=nt,g=l.ar(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let m=f.x,g=f.y,v=f.x,C=f.y;for(const L of s)m=Math.min(m,L.x),g=Math.min(g,L.y),v=Math.max(v,L.x),C=Math.max(C,L.y);return[new l.P(m,g),new l.P(v,g),new l.P(v,C),new l.P(m,C),new l.P(m,g)]}}lngLatToCameraDepth(s,f){const m=this.locationCoordinate(s),g=[m.x*this.worldSize,m.y*this.worldSize,f,1];return l.af(g,g,this.projMatrix),g[2]/g[3]}}function Sp(y,s){let f,m=!1,g=null,v=null;const C=()=>{g=null,m&&(y.apply(v,f),g=setTimeout(C,s),m=!1)};return(...L)=>(m=!0,v=this,f=L,g||C(),g)}class Ep{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let m;return f.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:m,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=Sp(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,g),C=Math.round(f.lng*v)/v,L=Math.round(f.lat*v)/v,M=this._map.getBearing(),R=this._map.getPitch();let z="";if(z+=s?`/${C}/${L}/${m}`:`${m}/${L}/${C}`,(M||R)&&(z+="/"+Math.round(10*M)/10),R&&(z+=`/${Math.round(R)}`),this._hashName){const F=this._hashName;let Z=!1;const ae=window.location.hash.slice(1).split("&").map(se=>{const pe=se.split("=")[0];return pe===F?(Z=!0,`${pe}=${z}`):se}).filter(se=>se);return Z||ae.push(`${F}=${z}`),`#${ae.join("&")}`}return`#${z}`}}const hc={linearity:.3,easing:l.b6(0,0,.3,1)},Dl=l.e({deceleration:2500,maxSpeed:1400},hc),km=l.e({deceleration:20,maxSpeed:1400},hc),Dm=l.e({deceleration:1e3,maxSpeed:360},hc),Rm=l.e({deceleration:1e3,maxSpeed:90},hc);class Nm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:I.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=I.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(f.pan.mag()){const v=pc(f.pan.mag(),m,l.e({},Dl,s||{}));g.offset=f.pan.mult(v.amount/f.pan.mag()),g.center=this._map.transform.center,fc(g,v)}if(f.zoom){const v=pc(f.zoom,m,km);g.zoom=this._map.transform.zoom+v.amount,fc(g,v)}if(f.bearing){const v=pc(f.bearing,m,Dm);g.bearing=this._map.transform.bearing+l.ac(v.amount,-179,179),fc(g,v)}if(f.pitch){const v=pc(f.pitch,m,Rm);g.pitch=this._map.transform.pitch+v.amount,fc(g,v)}if(g.zoom||g.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;g.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),l.e(g,{noMoveStart:!0})}}function fc(y,s){(!y.duration||y.durationf.unproject(M)),L=v.reduce((M,R,z,F)=>M.add(R.div(F.length)),new l.P(0,0));super(s,{points:v,point:L,lngLats:C,lngLat:f.unproject(L),originalEvent:m}),this._defaultPrevented=!1}}class Ip extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,m){super(s,{originalEvent:m}),this._defaultPrevented=!1}}class ys{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Ip(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new yo(s.type,this._map,s))}mouseup(s){this._map.fire(new yo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new yo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new yo(s.type,this._map,s))}mouseover(s){this._map.fire(new yo(s.type,this._map,s))}mouseout(s){this._map.fire(new yo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Gs(s.type,this._map,s))}touchmove(s){this._map.fire(new Gs(s.type,this._map,s))}touchend(s){this._map.fire(new Gs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Gs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class js{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new yo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new yo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new yo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class vs{constructor(s,f){this._map=s,this._tr=new yu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(T.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const m=f;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)v.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new l.k(s,{originalEvent:f}))}}function Rl(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const f={};for(let m=0;mthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const v=new l.P(0,0);for(const C of g)v._add(C);return v.div(g.length)}(f),this.touches=Rl(m,f)))}touchmove(s,f,m){if(this.aborted||!this.centroid)return;const g=Rl(m,f);for(const v in this.touches){const C=g[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,m){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Cp{constructor(s){this.singleTap=new fy(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,m){this.singleTap.touchstart(s,f,m)}touchmove(s,f,m){this.singleTap.touchmove(s,f,m)}touchend(s,f,m){const g=this.singleTap.touchend(s,f,m);if(g){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(g)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class py{constructor(s){this._tr=new yu(s),this._zoomIn=new Cp({numTouches:1,numTaps:2}),this._zoomOut=new Cp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,m){this._zoomIn.touchstart(s,f,m),this._zoomOut.touchstart(s,f,m)}touchmove(s,f,m){this._zoomIn.touchmove(s,f,m),this._zoomOut.touchmove(s,f,m)}touchend(s,f,m){const g=this._zoomIn.touchend(s,f,m),v=this._zoomOut.touchend(s,f,m),C=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class vu{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=f.length?f[0]:f;return!this._moved&&g.dist(m){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},bu=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const m=new qs({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new vu({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*f}),moveStateManager:m,enable:y,assignEvents:Mh})},xu=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const m=new qs({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new vu({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*f}),moveStateManager:m,enable:y,assignEvents:Mh})};class Om{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,m){return this._calculateTransform(s,f,m)}touchmove(s,f,m){if(this._active&&!(m.length0&&(this._active=!0);const g=Rl(m,f),v=new l.P(0,0),C=new l.P(0,0);let L=0;for(const R in g){const z=g[R],F=this._touches[R];F&&(v._add(z),C._add(z.sub(F)),L++,g[R]=z)}if(this._touches=g,LMath.abs(y.x)}class Bm extends wt{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,m){super.touchstart(s,f,m),this._currentTouchCount=m.length}_start(s){this._lastPoints=s,kh(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,v,m.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,m){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,v=f.mag()>=2;if(!g&&!v)return;if(!g||!v)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return kh(s)&&kh(f)&&C}}const dy={panStep:100,bearingStep:15,pitchStep:10};class $a{constructor(s){this._tr=new yu(s);const f=dy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,m=0,g=0,v=0,C=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?m=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?m=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:L=>{const M=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:fr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+m*this._bearingStep,pitch:M.pitch+g*this._pitchStep,offset:[-v*this._panStep,-C*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function fr(y){return y*(2-y)}const mc=4.000244140625;class Dh{constructor(s,f){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=s,this._tr=new yu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const m=I.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,f!==0&&f%mc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const f=T.mousePos(this._map.getCanvas(),s),m=this._tr;this._around=f.y>m.transform.height/2-m.transform.getHorizon()?l.M.convert(this._aroundCenter?m.center:m.unproject(f)):l.M.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const L=this._type==="wheel"&&Math.abs(this._delta)>mc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&M!==0&&(M=1/M);const R=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(R*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,m=this._startZoom,g=this._easing;let v,C=!1;if(this._type==="wheel"&&m&&g){const L=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=g(L);v=l.z.number(m,f,M),L<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=l.b7;if(this._prevEase){const m=this._prevEase,g=(I.now()-m.start)/m.duration,v=m.easing(g+.01)-m.easing(g),C=.27/Math.sqrt(v*v+1e-4)*.01,L=Math.sqrt(.0729-C*C);f=l.b6(C,L,.25,1)}return this._prevEase={start:I.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Lp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Vm{constructor(s){this._tr=new yu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Um{constructor(){this._tap=new Cp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,m){if(!this._swipePoint)if(this._tapTime){const g=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(g)<30;v&&C?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(s,f,m)}touchmove(s,f,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=f[0],v=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,m)}touchend(s,f,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(s,f,m);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gm{constructor(s,f,m){this._el=s,this._mousePan=f,this._touchPan=m}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class bs{constructor(s,f,m){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=m}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class gc{constructor(s,f,m,g){this._el=s,this._touchZoom=f,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Rt{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=T.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=f,this._container.appendChild(g);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=m,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(T.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Vt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Rh extends l.k{}function _c(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Pp{constructor(s,f){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,v)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=g.type==="renderFrame"?void 0:g,L={needsRenderFrame:!1},M={},R={},z=g.touches,F=z?this._getMapTouches(z):void 0,Z=F?T.touchPos(this._map.getCanvas(),F):T.mousePos(this._map.getCanvas(),g);for(const{handlerName:pe,handler:te,allowed:we}of this._handlers){if(!te.isEnabled())continue;let Ve;this._blockedByActive(R,we,pe)?te.reset():te[v||g.type]&&(Ve=te[v||g.type](g,Z,F),this.mergeHandlerResult(L,M,Ve,pe,C),Ve&&Ve.needsRenderFrame&&this._triggerRenderFrame()),(Ve||te.isActive())&&(R[pe]=te)}const ae={};for(const pe in this._previousActiveHandlers)R[pe]||(ae[pe]=C);this._previousActiveHandlers=R,(Object.keys(ae).length||_c(L))&&(this._changes.push([L,M,ae]),this._triggerRenderFrame()),(Object.keys(R).length||_c(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:se}=L;se&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],se(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Nm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,v,C]of this._listeners)T.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,m]of this._listeners)T.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(s){const f=this._map,m=f.getCanvasContainer();this._add("mapEvent",new ys(f,s));const g=f.boxZoom=new vs(f,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const v=f.cooperativeGestures=new Rt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new py(f),L=new Vm(f);f.doubleClickZoom=new Lp(L,C),this._add("tapZoom",C),this._add("clickZoom",L),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Um;this._add("tapDragZoom",M);const R=f.touchPitch=new Bm(f);this._add("touchPitch",R),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=bu(s),F=xu(s);f.dragRotate=new bs(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const Z=(({enable:Ve,clickTolerance:me})=>{const Me=new qs({checkCorrectEvent:Ue=>T.mouseButton(Ue)===0&&!Ue.ctrlKey});return new vu({clickTolerance:me,move:(Ue,qe)=>({around:qe,panDelta:qe.sub(Ue)}),activateOnStart:!0,moveStateManager:Me,enable:Ve,assignEvents:Mh})})(s),ae=new Om(s,f);f.dragPan=new Gm(m,Z,ae),this._add("mousePan",Z),this._add("touchPan",ae,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const se=new Tp,pe=new Fm;f.touchZoomRotate=new gc(m,pe,se,M),this._add("touchRotate",se,["touchPan","touchZoom"]),this._add("touchZoom",pe,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const te=f.scrollZoom=new Dh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",te,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const we=f.keyboard=new $a(f);this._add("keyboard",we),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new js(f))}_add(s,f,m){this._handlers.push({handlerName:s,handler:f,allowed:m}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vt(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,m){for(const g in s)if(g!==m&&(!f||f.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const m of s)this._el.contains(m.target)&&f.push(m);return f}mergeHandlerResult(s,f,m,g,v){if(!m)return;l.e(s,m);const C={handlerName:g,originalEvent:m.originalEvent||v};m.zoomDelta!==void 0&&(f.zoom=C),m.panDelta!==void 0&&(f.drag=C),m.pitchDelta!==void 0&&(f.pitch=C),m.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},m={};for(const[g,v,C]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),l.e(f,v),l.e(m,C);this._updateMapTransform(s,f,m),this._changes=[]}_updateMapTransform(s,f,m){const g=this._map,v=g._getTransformForUpdate(),C=g.terrain;if(!(_c(s)||C&&this._terrainMovement))return this._fireEvents(f,m,!0);let{panDelta:L,zoomDelta:M,bearingDelta:R,pitchDelta:z,around:F,pinchAround:Z}=s;Z!==void 0&&(F=Z),g._stop(!0),F=F||g.transform.centerPoint;const ae=v.pointLocation(L?F.sub(L):F);R&&(v.bearing+=R),z&&(v.pitch+=z),M&&(v.zoom+=M),C?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(L)):v.setLocationAtPoint(ae,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(ae,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(g.terrain)})):v.setLocationAtPoint(ae,F),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,m,!0)}_fireEvents(s,f,m){const g=Vt(this._eventsInProgress),v=Vt(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!g&&v&&this._fireEvent("movestart",v.originalEvent);for(const z in C)this._fireEvent(z,C[z]);v&&this._fireEvent("move",v.originalEvent);for(const z in s){const{originalEvent:F}=s[z];this._fireEvent(z,F)}const L={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:Z}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||Z,L[`${z}end`]=M)}for(const z in L)this._fireEvent(z,L[z]);const R=Vt(this._eventsInProgress);if(m&&(g||v)&&!R){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=Z=>Z!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Rh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class vo extends l.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const m=Math.min((I.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,m){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},f),m)}panTo(s,f,m){return this.easeTo(l.e({center:s},f),m)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,m){return this.easeTo(l.e({zoom:s},f),m)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,m){return this.easeTo(l.e({bearing:s},f),m)}resetNorth(s,f){return this.rotateTo(0,l.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=l.z.number(v,te,Ze)),this._rotating&&(g.bearing=l.z.number(C,R,Ze)),this._pitching&&(g.pitch=l.z.number(L,z,Ze)),this._padding&&(g.interpolatePadding(M,F,Ze),ae=g.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Ze),Me)g.setLocationAtPoint(Me,Ue);else{const nt=g.zoomScale(g.zoom-v),et=te>v?Math.min(2,me):Math.max(.5,me),ct=Math.pow(et,1-Ze),mt=g.unproject(we.add(Ve.mult(Ze*ct)).mult(nt));g.setLocationAtPoint(g.renderWorldCopies?mt.wrap():mt,ae)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},Ze=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Ze)},s),this}_prepareEase(s,f,m={}){this._moving=!0,f||m.moving||this.fire(new l.k("movestart",s)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(m-(f-(m*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=l.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:m,zoom:g,pitch:v,bearing:C,elevation:L}=this.transformCameraUpdate(f);m&&(f.center=m),g!==void 0&&(f.zoom=g),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),L!==void 0&&(f.elevation=L),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const m=this._zooming,g=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",s)),g&&this.fire(new l.k("rotateend",s)),v&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,f){var m;if(!s.essential&&I.prefersReducedMotion){const Cn=l.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Cn,f)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b7},s);const g=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),L=this.getPitch(),M=this.getPadding(),R="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:L,F="padding"in s?s.padding:g.padding,Z=l.P.convert(s.offset);let ae=g.centerPoint.add(Z);const se=g.pointLocation(ae),{center:pe,zoom:te}=g.getConstrained(l.M.convert(s.center||se),(m=s.zoom)!==null&&m!==void 0?m:v);this._normalizeCenter(pe);const we=g.zoomScale(te-v),Ve=g.project(se),me=g.project(pe).sub(Ve);let Me=s.curve;const Ue=Math.max(g.width,g.height),qe=Ue/we,Ze=me.mag();if("minZoom"in s){const Cn=l.ac(Math.min(s.minZoom,v,te),g.minZoom,g.maxZoom),Xt=Ue/g.zoomScale(Cn-v);Me=Math.sqrt(Xt/Ze*2)}const nt=Me*Me;function et(Cn){const Xt=(qe*qe-Ue*Ue+(Cn?-1:1)*nt*nt*Ze*Ze)/(2*(Cn?qe:Ue)*nt*Ze);return Math.log(Math.sqrt(Xt*Xt+1)-Xt)}function ct(Cn){return(Math.exp(Cn)-Math.exp(-Cn))/2}function mt(Cn){return(Math.exp(Cn)+Math.exp(-Cn))/2}const sn=et(!1);let gt=function(Cn){return mt(sn)/mt(sn+Me*Cn)},jt=function(Cn){return Ue*((mt(sn)*(ct(Xt=sn+Me*Cn)/mt(Xt))-ct(sn))/nt)/Ze;var Xt},an=(et(!0)-sn)/Me;if(Math.abs(Ze)<1e-6||!isFinite(an)){if(Math.abs(Ue-qe)<1e-6)return this.easeTo(s,f);const Cn=qes.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==R,this._pitching=z!==L,this._padding=!g.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(pe),this._ease(Cn=>{const Xt=Cn*an,hn=1/gt(Xt);g.zoom=Cn===1?te:v+g.scaleZoom(hn),this._rotating&&(g.bearing=l.z.number(C,R,Cn)),this._pitching&&(g.pitch=l.z.number(L,z,Cn)),this._padding&&(g.interpolatePadding(M,F,Cn),ae=g.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Cn);const pn=Cn===1?pe:g.unproject(Ve.add(me.mult(jt(Xt))).mult(hn));g.setLocationAtPoint(g.renderWorldCopies?pn.wrap():pn,ae),this._applyUpdatedTransform(g),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,f)}if(!s){const m=this.handlers;m&&m.stop(!1)}return this}_ease(s,f,m){m.animate===!1||m.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=m,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=l.b1(s,-180,180);const m=Math.abs(s-f);return Math.abs(s-360-f)180?-360:m<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Mp={compact:!0,customAttribution:'MapLibre'};class xs{constructor(s=Mp){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const m=this._map._getUIString(`AttributionControl.${f}`);s.title=m,s.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const f=this._map.style.sourceCaches;for(const g in f){const v=f[g];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,v)=>g.length-v.length),s=s.filter((g,v)=>{for(let C=v+1;C=0)return!1;return!0});const m=s.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,s.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class jm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const m=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const f=T.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class yc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,m=f?this._queue.concat(f):this._queue;for(const g of m)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const m of f)if(!m.cancelled&&(m.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Tr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class Gr extends l.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const m={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),l.aN(g.posMatrix,0,l.W,0,l.W,0,1),this._tiles[g.key]=new Qo(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(s){for(const f in this._tiles){const m=this._tiles[f];(!s||m.tileID.equals(s)||m.tileID.isChildOf(s)||s.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),l.aN(v.posMatrix,0,l.W,0,l.W,0,1),f[m]=v}else if(g.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=g.canonical.z-s.canonical.z,L=g.canonical.x-(g.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,R,0,R,0,1),l.H(v.posMatrix,v.posMatrix,[-L*R,-M*R,0]),f[m]=v}else if(s.canonical.isChildOf(g.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-g.canonical.z,L=s.canonical.x-(s.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,l.W,0,l.W,0,1),l.H(v.posMatrix,v.posMatrix,[L*R,M*R,0]),l.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[m]=v}}return f}getSourceTile(s,f){const m=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g=m.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(g--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class qm{constructor(s,f,m){this.painter=s,this.sourceCache=new Gr(f),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,m,g=l.W){var v;if(!(f>=0&&f=0&&ms.canonical.z&&(s.canonical.z>=g?v=s.canonical.z-g:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new X(s,m,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),m=this.painter.context,g=m.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,L-C-1,1,1,g.RGBA,g.UNSIGNED_BYTE,f),m.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),R=f[1]+((15&f[2])<<8),z=this.coordsIndex[255-f[3]],F=z&&this.sourceCache.getTileByID(z);if(!F)return null;const Z=this._coordsTextureSize,ae=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const xa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ap{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new vc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(m=>!s._layers[m].isHidden(f)),this._coordsDescendingInv={};for(const m in s.sourceCaches){this._coordsDescendingInv[m]={};const g=s.sourceCaches[m].getVisibleCoordinates();for(const v of g){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const L in C)this._coordsDescendingInv[m][L]||(this._coordsDescendingInv[m][L]=[]),this._coordsDescendingInv[m][L].push(C[L])}}this._coordsDescendingInvStr={};for(const m of s._order){const g=s._layers[m],v=g.source;if(xa[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(L=>L.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[g][m.tileID.key];v&&v!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(xa[f]&&(this._prevType&&xa[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(xa[this._prevType]||xa[f]&&g){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(Lh(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[v]){const R=this.pool.getObjectForId(L.rtt[v].id);if(R.stamp===L.rtt[v].stamp){this.pool.useObject(R);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),L.rtt[v]={id:M.id,stamp:M.stamp},m.context.bindFramebuffer.set(M.fbo.framebuffer),m.context.clear({color:l.aO.transparent,stencil:0}),m.currentStencilSource=void 0;for(let R=0;R{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Rp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Np{constructor(s,f,m=!1){this.mousedown=C=>{this.startMouse(l.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),T.mousePos(this.element,C)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,T.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=T.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=T.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=bu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:L,bearingDegreesPerPixelMoved:M=.8})=>{const R=new Ct;return new vu({clickTolerance:L,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:R,enable:C,assignEvents:Nh})})({clickTolerance:g,enable:!0}),this.map=s,m&&(this.mousePitch=xu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:L,pitchDegreesPerPixelMoved:M=-.5})=>{const R=new Ct;return new vu({clickTolerance:L,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:R,enable:C,assignEvents:Nh})})({clickTolerance:v,enable:!0})),T.addEventListener(f,"mousedown",this.mousedown),T.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),T.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),T.disableDrag()}moveMouse(s,f){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&m.setPitch(m.getPitch()+v)}}moveTouch(s,f){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&m.setPitch(m.getPitch()+v)}}off(){const s=this.element;T.removeEventListener(s,"mousedown",this.mousedown),T.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let wa;function Oh(y,s,f){const m=new l.M(y.lng,y.lat);if(y=new l.M(y.lng,y.lat),s){const g=new l.M(y.lng-360,y.lat),v=new l.M(y.lng+360,y.lat),C=f.locationPoint(y).distSqr(s);f.locationPoint(g).distSqr(s)180;){const g=f.locationPoint(y);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;y.lng>f.center.lng?y.lng-=360:y.lng+=360}return y.lng!==m.lng&&f.locationPoint(y).y>f.height/2-f.getHorizon()?y:m}const xc={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 zh(y,s,f){const m=y.classList;for(const g in xc)m.remove(`maplibregl-${f}-anchor-${g}`);m.add(`maplibregl-${f}-anchor-${s}`)}class wc extends l.E{constructor(s){if(super(),this._onKeyPress=f=>{const m=f.code,g=f.charCode||f.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=f=>{const m=f.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=f=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Oh(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),T.setTransform(this._element,`${xc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),I.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=f.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div"),this._element.setAttribute("aria-label","Map marker");const f=T.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${m}px`),f.setAttributeNS(null,"width",`${g}px`),f.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const v=T.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=T.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const we of M){const Ve=T.createNS("http://www.w3.org/2000/svg","ellipse");Ve.setAttributeNS(null,"opacity","0.04"),Ve.setAttributeNS(null,"cx","10.5"),Ve.setAttributeNS(null,"cy","5.80029008"),Ve.setAttributeNS(null,"rx",we.rx),Ve.setAttributeNS(null,"ry",we.ry),L.appendChild(Ve)}const R=T.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const z=T.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),R.appendChild(z);const F=T.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Z=T.createNS("http://www.w3.org/2000/svg","path");Z.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(Z);const ae=T.createNS("http://www.w3.org/2000/svg","g");ae.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ae.setAttributeNS(null,"fill","#FFFFFF");const se=T.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"transform","translate(8.0, 8.0)");const pe=T.createNS("http://www.w3.org/2000/svg","circle");pe.setAttributeNS(null,"fill","#000000"),pe.setAttributeNS(null,"opacity","0.25"),pe.setAttributeNS(null,"cx","5.5"),pe.setAttributeNS(null,"cy","5.5"),pe.setAttributeNS(null,"r","5.4999962");const te=T.createNS("http://www.w3.org/2000/svg","circle");te.setAttributeNS(null,"fill","#FFFFFF"),te.setAttributeNS(null,"cx","5.5"),te.setAttributeNS(null,"cy","5.5"),te.setAttributeNS(null,"r","5.4999962"),se.appendChild(pe),se.appendChild(te),C.appendChild(L),C.appendChild(R),C.appendChild(F),C.appendChild(ae),C.appendChild(se),f.appendChild(C),f.setAttributeNS(null,"height",m*this._scale+"px"),f.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(f),this._offset=l.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),zh(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,m;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const g=this._map,v=g.terrain.depthAtPoint(this._pos),C=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/g.transform._pixelPerMeter,M=Math.sin(g.getPitch()*Math.PI/180)*L,R=g.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),z=g.transform.lngLatToCameraDepth(this._lngLat,C+M)-R>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const Fh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Su=0,Nl=!1;const Bh={maxWidth:100,unit:"metric"};function Vh(y,s,f){const m=f&&f.maxWidth||100,g=y._container.clientHeight/2,v=y.unproject([0,g]),C=y.unproject([m,g]),L=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*L;M>5280?Ol(s,m,M/5280,y._getUIString("ScaleControl.Miles")):Ol(s,m,M,y._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Ol(s,m,L/1852,y._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Ol(s,m,L/1e3,y._getUIString("ScaleControl.Kilometers")):Ol(s,m,L,y._getUIString("ScaleControl.Meters"))}function Ol(y,s,f,m){const g=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let L=v/C;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(M){const R=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*R)/R}(L),C*L}(f);y.style.width=s*(g/f)+"px",y.innerHTML=`${g} ${m}`}const Op={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},zp=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Uh(y){if(y){if(typeof y=="number"){const s=Math.round(Math.abs(y)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,y),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-y),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(y,0),right:new l.P(-y,0)}}if(y instanceof l.P||Array.isArray(y)){const s=l.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(y.center||[0,0]),top:l.P.convert(y.top||[0,0]),"top-left":l.P.convert(y["top-left"]||[0,0]),"top-right":l.P.convert(y["top-right"]||[0,0]),bottom:l.P.convert(y.bottom||[0,0]),"bottom-left":l.P.convert(y["bottom-left"]||[0,0]),"bottom-right":l.P.convert(y["bottom-right"]||[0,0]),left:l.P.convert(y.left||[0,0]),right:l.P.convert(y.right||[0,0])}}return Uh(new l.P(0,0))}const Wm=d;c.AJAXError=l.be,c.Evented=l.E,c.LngLat=l.M,c.MercatorCoordinate=l.Y,c.Point=l.P,c.addProtocol=l.bf,c.config=l.a,c.removeProtocol=l.bg,c.AttributionControl=xs,c.BoxZoomHandler=vs,c.CanvasSource=gs,c.CooperativeGesturesHandler=Rt,c.DoubleClickZoomHandler=Lp,c.DragPanHandler=Gm,c.DragRotateHandler=bs,c.EdgeInsets=_u,c.FullscreenControl=class extends l.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=Dr,c.GeolocateControl=class extends l.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new l.M(s.coords.longitude,s.coords.latitude),m=s.coords.accuracy,g=this._map.getBearing(),v=l.e({bearing:g},this.options.fitBoundsOptions),C=Ce.fromLngLat(f,m);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new l.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Nl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new wc({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new wc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")))})}},this.options=l.e({},Fh,y)}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(s=!1){if(wa!==void 0&&!s)return wa;if(window.navigator.permissions===void 0)return wa=!!window.navigator.geolocation,wa;try{wa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{wa=!!window.navigator.geolocation}return wa})}().then(s=>this._setupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Su=0,Nl=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),f=y.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const y=this._map.getBounds(),s=y.getSouthEast(),f=y.getNorthEast(),m=s.distanceTo(f),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Su--,Nl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Su++,Su>1?(y={maximumAge:6e5,timeout:0},Nl=!0):(y=this.options.positionOptions,Nl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.Hash=Ep,c.ImageSource=tr,c.KeyboardHandler=$a,c.LngLatBounds=Ce,c.LogoControl=jm,c.Map=class extends vo{constructor(y){if(l.bc.mark(l.bd.create),(y=l.e({},bc,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ph(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new yc,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},kp,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=q.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=Sp(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{s?f(m):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Pp(this,y),this._hash=y.hash&&new Ep(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,l.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new xs(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new jm,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new l.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new l.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new l.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=y.onAdd(this);this._controls.push(y);const m=this._controlPositions[s];return s.indexOf("bottom")!==-1?m.insertBefore(f,m.firstChild):m.appendChild(f),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,f,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,f,m)}resize(y){var s;const f=this._containerDimensions(),m=f[0],g=f[1],v=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,v),this.painter.resize(m,g,v),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const M=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,M),this.painter.resize(m,g,M)}this.transform.resize(m,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(m,g);const C=!this._moving;return C&&(this.stop(),this.fire(new l.k("movestart",y)).fire(new l.k("move",y))),this.fire(new l.k("resize",y)),C&&this.fire(new l.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:f,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),v=y*g,C=s*g;return Math.min(v>f?f/v:1,C>m?m/C:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(Ce.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(l.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(l.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,s,f){if(y==="mouseenter"||y==="mouseover"){let m=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?m||(m=!0,f.call(this,new yo(y,this,v.originalEvent,{features:C}))):m=!1},mouseout:()=>{m=!1}}}}if(y==="mouseleave"||y==="mouseout"){let m=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?m=!0:m&&(m=!1,f.call(this,new yo(y,this,C.originalEvent)))},mouseout:C=>{m&&(m=!1,f.call(this,new yo(y,this,C.originalEvent)))}}}}{const m=g=>{const v=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];v.length&&(g.features=v,f.call(this,g),delete g.features)};return{layer:s,listener:f,delegates:{[y]:m}}}}on(y,s,f){if(f===void 0)return super.on(y,s);const m=this._createDelegatedListener(y,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(y,s,f){if(f===void 0)return super.once(y,s);const m=this._createDelegatedListener(y,s,f);for(const g in m.delegates)this.once(g,m.delegates[g]);return this}off(y,s,f){return f===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(m=>{const g=this._delegatedListeners[y];for(let v=0;vthis._updateStyle(y,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new No(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,f):this.style.loadJSON(y,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new No(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const f=this._requestManager.transformRequest(y,"Style");l.h(f,new AbortController).then(m=>{this._updateDiff(m.data,s)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&this._update(!0)}catch(f){l.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(y,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(y,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const m=this.style._layers[f];m.type==="hillshade"&&m.source===y.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new qm(this.painter,s,y),this.painter.renderToTexture=new Ap(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const f=y[s]._tiles;for(const m in f){const g=f[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,f={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:v,stretchY:C,content:L}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:R,data:z}=s,F=s;return this.style.addImage(y,{data:new l.R({width:M,height:R},new Uint8Array(z)),pixelRatio:m,stretchX:v,stretchY:C,content:L,sdf:g,version:0,userImage:F}),F.onAdd&&F.onAdd(this,y),this}}{const{width:M,height:R,data:z}=I.getImageData(s);this.style.addImage(y,{data:new l.R({width:M,height:R},z),pixelRatio:m,stretchX:v,stretchY:C,content:L,sdf:g,version:0})}}updateImage(y,s){const f=this.style.getImage(y);if(!f)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=s instanceof HTMLImageElement||l.b(s)?I.getImageData(s):s,{width:g,height:v,data:C}=m;if(g===void 0||v===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==f.data.width||v!==f.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(s instanceof HTMLImageElement||l.b(s));return f.data.replace(C,L),this.style.updateImage(y,f),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return q.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,s,f){return this.style.setLayerZoomRange(y,s,f),this._update(!0)}setFilter(y,s,f={}){return this.style.setFilter(y,s,f),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,f,m={}){return this.style.setPaintProperty(y,s,f,m),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,f,m={}){return this.style.setLayoutProperty(y,s,f,m),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,f,m=>{m||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,f=>{f||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=T.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),m=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],m);const g=this._controlContainer=T.create("div","maplibregl-control-container",y),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=T.create("div",`maplibregl-ctrl-${C} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,s,f){this._canvas.width=Math.floor(f*y),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{s={requestedAttributes:y},m&&(s.statusMessage=m.statusMessage,s.type=m.type)},{once:!0});const f=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!f){const m="Failed to initialize WebGL";throw s?(s.message=m,new Error(JSON.stringify(s))):new Error(m)}this.painter=new Am(f,this.transform),k.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,v=I.now();this.style.zoomHistory.update(g,v);const C=new l.a8(g,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=C.crossFadingFactor();L===1&&L===this._crossFadingFactor||(f=!0,this._crossFadingFactor=L),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bc.mark(l.bd.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bc.mark(l.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),q.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bc.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(y=>{l.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return Dp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=yo,c.MapTouchEvent=Gs,c.MapWheelEvent=Ip,c.Marker=wc,c.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),m=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const m=this._map._getUIString(`NavigationControl.${f}`);s.title=m,s.setAttribute("aria-label",m)},this.options=l.e({},Rp,y),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Np(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,s){const f=T.create("button",y,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends l.E{constructor(y){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const L of this.options.className.split(" "))this._container.classList.add(L);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Oh(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const m=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const v=Uh(this.options.offset);if(!g){const L=this._container.offsetWidth,M=this._container.offsetHeight;let R;R=m.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],m.xthis._map.transform.width-L/2&&R.push("right"),g=R.length===0?"bottom":R.join("-")}let C=m.add(v[g]);this.options.subpixelPositioning||(C=C.round()),T.setTransform(this._container,`${xc[g]} translate(${C.x}px,${C.y}px)`),zh(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Op),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=l.M.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const s=document.createDocumentFragment(),f=document.createElement("body");let m;for(f.innerHTML=y;m=f.firstChild,m;)s.appendChild(m);return this.setDOMContent(s)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(zp);y&&y.focus()}},c.RasterDEMTileSource=en,c.RasterTileSource=ze,c.ScaleControl=class{constructor(y){this._onMove=()=>{Vh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Vh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Bh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=Dh,c.Style=No,c.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Bm,c.TwoFingersTouchRotateHandler=Tp,c.TwoFingersTouchZoomHandler=Fm,c.TwoFingersTouchZoomRotateHandler=gc,c.VectorTileSource=xn,c.VideoSource=Do,c.addSourceType=(y,s)=>l._(void 0,void 0,void 0,function*(){if(Za(y))throw new Error(`A source type called "${y}" already exists.`);((f,m)=>{Bs[f]=m})(y,s)}),c.clearPrewarmedResources=function(){const y=bn;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Dt),bn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},c.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return lt().getRTLTextPluginStatus()},c.getVersion=function(){return Wm},c.getWorkerCount=function(){return un.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(y){return $r().broadcast("IS",y)},c.prewarm=function(){Bn().acquire(Dt)},c.setMaxParallelImageRequests=function(y){l.a.MAX_PARALLEL_IMAGE_REQUESTS=y},c.setRTLTextPlugin=function(y,s){return lt().setRTLTextPlugin(y,s)},c.setWorkerCount=function(y){un.workerCount=y},c.setWorkerUrl=function(y){l.a.WORKER_URL=y}});var a=n;return a})})(UI);var xD=UI.exports;const Ts=Rv(xD);var wD=Object.defineProperty,SD=(t,e,n)=>e in t?wD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yw=(t,e,n)=>(SD(t,typeof e!="symbol"?e+"":e,n),n);function kd(){}function jI(t){return t()}function Kw(){return Object.create(null)}function A_(t){t.forEach(jI)}function qI(t){return typeof t=="function"}function ED(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ID(t){return Object.keys(t).length===0}function CD(t,e){t.appendChild(e)}function TD(t,e,n){t.insertBefore(e,n||null)}function WI(t){t.parentNode&&t.parentNode.removeChild(t)}function Jw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Mu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function LD(t){return Array.from(t.childNodes)}function vg(t,e,n){t.classList.toggle(e,!!n)}let n1;function Cd(t){n1=t}const hf=[],Qw=[];let yf=[];const $w=[],PD=Promise.resolve();let ov=!1;function MD(){ov||(ov=!0,PD.then(HI))}function sv(t){yf.push(t)}const I0=new Set;let of=0;function HI(){if(of!==0)return;const t=n1;do{try{for(;oft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),yf=e}const DD=new Set;function RD(t,e){t&&t.i&&(DD.delete(t),t.i(e))}function ND(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),sv(()=>{const a=t.$$.on_mount.map(jI).filter(qI);t.$$.on_destroy?t.$$.on_destroy.push(...a):A_(a),t.$$.on_mount=[]}),i.forEach(sv)}function OD(t,e){const n=t.$$;n.fragment!==null&&(kD(n.after_update),A_(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function zD(t,e){t.$$.dirty[0]===-1&&(hf.push(t),MD(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const D=k.length?k[0]:T;return w.ctx&&i(w.ctx[I],w.ctx[I]=D)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](D),S&&zD(t,I)),T}):[],w.update(),S=!0,A_(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=LD(e.target);w.fragment&&w.fragment.l(I),I.forEach(WI)}else w.fragment&&w.fragment.c();e.intro&&RD(t.$$.fragment),ND(t,e.target,e.anchor),HI()}Cd(d)}class BD{constructor(){Yw(this,"$$"),Yw(this,"$$set")}$destroy(){OD(this,1),this.$destroy=kd}$on(e,n){if(!qI(n))return kd;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!ID(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const VD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(VD);function UD(t){let e,n,r;return{c(){e=Jw("svg"),n=Jw("path"),Mu(n,"stroke-width","4"),Mu(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"),Mu(n,"class","svelte-gzo3ar"),Mu(e,"width",r=t[0]==="list"?20:void 0),Mu(e,"viewBox","0 0 70 85"),Mu(e,"fill","none"),Mu(e,"class","svelte-gzo3ar"),vg(e,"in-map",t[0]!=="list"),vg(e,"list-icon",t[0]==="list")},m(i,a){TD(i,e,a),CD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Mu(e,"width",r),a&1&&vg(e,"in-map",i[0]!=="list"),a&1&&vg(e,"list-icon",i[0]==="list")},i:kd,o:kd,d(i){i&&WI(e)}}}function GD(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class jD extends BD{constructor(e){super(),FD(this,e,GD,UD,ED,{displayIn:0})}}const qD=[{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"}],WD={decimalLatitude:40.123,decimalLongitude:-74.123},HD=[{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}],ZD=[{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 XD(){const t=[];return qD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...WD})}),[...t,...HD,...ZD]}const YD=XD();YD.map(t=>t.verbatimCoordinates);/** + * splaytree v3.1.2 + * Fast Splay tree for Node and browser + * + * @author Alexander Milevski + * @license MIT + * @preserve + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */function KD(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(w){return function(S){return d([w,S])}}function d(w){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=w[0]&2?i.return:w[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,w[1])).done)return a;switch(i=0,a&&(w=[w[0]&2,a.value]),w[0]){case 0:case 1:a=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,i=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!a||w[1]>a[0]&&w[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var l=e.right;if(e.right=l.left,l.left=e,e=l,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,a.left=e.right,e.left=r.right,e.right=r.left,e}function C0(t,e,n,r){var i=new Bu(t,e);if(n===null)return i.left=i.right=null,i;n=Ru(t,n,r);var a=r(t,n.key);return a<0?(i.left=n.left,i.right=n,n.left=null):a>=0&&(i.right=n.right,i.left=n,n.right=null),i}function e2(t,e,n){var r=null,i=null;if(e){e=Ru(t,e,n);var a=n(e.key,t);a===0?(r=e.left,i=e.right):a<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function QD(t,e,n){return e===null?t:(t===null||(e=Ru(t.key,e,n),e.left=t),e)}function av(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` +`);var a=e+(n?" ":"│ ");t.left&&av(t.left,a,!1,r,i),t.right&&av(t.right,a,!0,r,i)}}var r1=function(){function t(e){e===void 0&&(e=JD),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=C0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new Bu(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=Ru(e,this._root,i),c=i(e,a.key);return c===0?this._root=a:(c<0?(r.left=a.left,r.right=a,a.left=null):c>0&&(r.right=a.right,r.left=a,a.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=Ru(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=Ru(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=Ru(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=Ru(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):a=!0;return this},t.prototype.range=function(e,n,r,i){for(var a=[],c=this._comparator,l=this._root,d;a.length!==0||l;)if(l)a.push(l),l=l.left;else{if(l=a.pop(),d=c(l.key,n),d>0)break;if(c(l.key,e)>=0&&r.call(i,l))return this;l=l.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return eR(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,a=this._comparator;if(r&&cv(e,n,0,i-1,a),this._root===null)this._root=lv(e,n,0,i),this._size=i;else{var c=tR(this.toList(),$D(e,n),a);i=this._size+i,this._root=uv({head:c},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return av(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=e2(e,this._root,i),c=a.left,l=a.right;i(e,n)<0?l=C0(n,r,l,i):c=C0(n,r,c,i),this._root=QD(c,l,i)},t.prototype.split=function(e){return e2(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return KD(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function lv(t,e,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),c=t[a],l=e[a],d=new Bu(c,l);return d.left=lv(t,e,n,a),d.right=lv(t,e,a+1,r),d}return null}function $D(t,e){for(var n=new Bu(null,null),r=n,i=0;i0?(e=a=a.next=n.pop(),e=e.right):r=!0;return a.next=null,i.next}function uv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=uv(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=uv(t,i+1,n),c}return null}function tR(t,e,n){for(var r=new Bu(null,null),i=r,a=t,c=e;a!==null&&c!==null;)n(a.key,c.key)<0?(i.next=a,a=a.next):(i.next=c,c=c.next),i=i.next;return a!==null?i.next=a:c!==null&&(i.next=c),r.next}function cv(t,e,n,r,i){if(!(n>=r)){for(var a=t[n+r>>1],c=n-1,l=r+1;;){do c++;while(i(t[c],a)<0);do l--;while(i(t[l],a)>0);if(c>=l)break;var d=t[c];t[c]=t[l],t[l]=d,d=e[c],e[c]=e[l],e[l]=d}cv(t,e,n,l,i),cv(t,e,l+1,r,i)}}function _a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function t2(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){_a(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ho(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r=0&&I>=0?wT?-1:0:d<0&&I<0?wT?1:0:Id?1:0}}}]),t}(),aR=0,c_=function(){Ho(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,a=e.rightSE.point.x,c=n.rightSE.point.x;if(cl&&d>w)return-1;var I=e.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var T=n.comparePoint(e.rightSE.point);return T!==0?T:-1}if(r>i){if(ld&&l>S)return 1;var k=n.comparePoint(e.leftSE.point);if(k!==0)return k;var D=e.comparePoint(n.rightSE.point);return D<0?1:D>0?-1:1}if(ld)return 1;if(ac){var j=e.comparePoint(n.rightSE.point);if(j<0)return 1;if(j>0)return-1}if(a!==c){var $=w-l,B=a-r,q=S-d,J=c-i;if($>B&&qJ)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){_a(this,t),this.id=++aR,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return Ho(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&l.swapEvents(),ul.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var c=n;n=r,r=c}for(var l=0,d=r.rings.length;l0)i=n,a=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var d=new ul(i,!0),w=new ul(a,!1);return new t(d,w,[r],[c])}}]),t}(),s2=function(){function t(e,n,r){if(_a(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=Dd.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,c=1,l=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),a=d)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(c_.fromRing(a,i,this))}return Ho(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return Ho(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return Ho(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n0&&(e=i)}for(var a=e.segment.prevInResult(),c=a?a.prevInResult():null;;){if(!a)return null;if(!c)return a.ringOut;if(c.ringOut!==a.ringOut)return c.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=c.prevInResult(),c=a?a.prevInResult():null}}}]),t}(),l2=function(){function t(e){_a(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ho(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:c_.compare;_a(this,t),this.queue=e,this.tree=new r1(n),this.segments=[]}return Ho(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=i,c=i,l=void 0,d=void 0;l===void 0;)a=this.tree.prev(a),a===null?l=null:a.key.consumedBy===void 0&&(l=a.key);for(;d===void 0;)c=this.tree.next(c),c===null?d=null:c.key.consumedBy===void 0&&(d=c.key);if(e.isLeft){var w=null;if(l){var S=l.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!l.isAnEndpoint(S)))for(var I=this._splitSafely(l,S),T=0,k=I.length;T0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&d){var ie=l.getIntersection(d);if(ie!==null){if(!l.isAnEndpoint(ie))for(var ee=this._splitSafely(l,ie),Le=0,X=ee.length;Leu2)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 hR(D),ce=D.size,fe=D.pop();fe;){var de=fe.key;if(D.size===ce){var ie=de.segment;throw new Error("Unable to pop() ".concat(de.isLeft?"left":"right"," SweepEvent ")+"[".concat(de.point.x,", ").concat(de.point.y,"] from segment #").concat(ie.id," ")+"[".concat(ie.leftSE.point.x,", ").concat(ie.leftSE.point.y,"] -> ")+"[".concat(ie.rightSE.point.x,", ").concat(ie.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(D.size>u2)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(J.segments.length>fR)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var ee=J.process(de),Le=0,X=ee.length;Le1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};Oe.prototype.clone=function(){};Oe.prototype.copy=function(){return new Oe(this)};Oe.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Oe.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)};Oe.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};Oe.prototype.hashCode=function(){var t=17;return t=37*t+Oe.hashCode(this.x),t=37*t+Oe.hashCode(this.y),t};Oe.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};Oe.prototype.interfaces_=function(){return[ds,D_,ms]};Oe.prototype.getClass=function(){return Oe};Oe.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=$t.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Jc.DimensionalComparator.get=function(){return Yl};Jc.serialVersionUID.get=function(){return 6683108902428367e3};Jc.NULL_ORDINATE.get=function(){return $t.NaN};Jc.X.get=function(){return 0};Jc.Y.get=function(){return 1};Jc.Z.get=function(){return 2};Object.defineProperties(Oe,Jc);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 lr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Yl.prototype.compare=function(t,e){var n=t,r=e,i=Yl.compare(n.x,r.x);if(i!==0)return i;var a=Yl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=Yl.compare(n.z,r.z);return c};Yl.prototype.interfaces_=function(){return[If]};Yl.prototype.getClass=function(){return Yl};Yl.compare=function(t,e){return te?1:$t.isNaN(t)?$t.isNaN(e)?0:-1:$t.isNaN(e)?1:0};var Cf=function(){};Cf.prototype.create=function(){};Cf.prototype.interfaces_=function(){return[]};Cf.prototype.getClass=function(){return Cf};var Be=function(){},$d={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Be.prototype.interfaces_=function(){return[]};Be.prototype.getClass=function(){return Be};Be.toLocationSymbol=function(t){switch(t){case Be.EXTERIOR:return"e";case Be.BOUNDARY:return"b";case Be.INTERIOR:return"i";case Be.NONE:return"-"}throw new lr("Unknown location value: "+t)};$d.INTERIOR.get=function(){return 0};$d.BOUNDARY.get=function(){return 1};$d.EXTERIOR.get=function(){return 2};$d.NONE.get=function(){return-1};Object.defineProperties(Be,$d);var Zt=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Zo=function(){},tC={LOG_10:{configurable:!0}};Zo.prototype.interfaces_=function(){return[]};Zo.prototype.getClass=function(){return Zo};Zo.log10=function(t){var e=Math.log(t);return $t.isInfinite(e)||$t.isNaN(e)?e:e/Zo.LOG_10};Zo.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};Zo.wrap=function(t,e){return t<0?e- -t%e:t%e};Zo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3],d=i;return a>d&&(d=a),c>d&&(d=c),l>d&&(d=l),d}};Zo.average=function(t,e){return(t+e)/2};tC.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Zo,tC);var ya=function(t){this.str=t};ya.prototype.append=function(t){this.str+=t};ya.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};ya.prototype.toString=function(t){return this.str};var oa=function(t){this.value=t};oa.prototype.intValue=function(){return this.value};oa.prototype.compareTo=function(t){return this.valuet?1:0};oa.isNaN=function(t){return Number.isNaN(t)};var Rd=function(){};Rd.isWhitespace=function(t){return t<=32&&t>=0||t===127};Rd.toUpperCase=function(t){return t.toUpperCase()};var We=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},zs={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}};We.prototype.le=function(t){return(this._hi9?(S=!0,I="9"):I="0"+w,c.append(I),n=n.subtract(We.valueOf(w)).multiply(We.TEN),S&&n.selfAdd(We.TEN);var T=!0,k=We.magnitude(n._hi);if(k<0&&Math.abs(k)>=l-d&&(T=!1),!T)break}return e[0]=r,c.toString()};We.prototype.sqr=function(){return this.multiply(this)};We.prototype.doubleValue=function(){return this._hi+this._lo};We.prototype.subtract=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};We.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};We.prototype.isZero=function(){return this._hi===0&&this._lo===0};We.prototype.selfSubtract=function(){if(arguments[0]instanceof We){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)}};We.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};We.prototype.min=function(t){return this.le(t)?this:t};We.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof We){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,l=null,d=null,w=null,S=null,I=null;return d=this._hi/n,w=We.SPLIT*d,i=w-d,I=We.SPLIT*n,i=w-i,a=d-i,c=I-n,S=d*n,c=I-c,l=n-c,I=i*c-S+i*l+a*c+a*l,w=(this._hi-S-I+this._lo-d*r)/n,I=d+w,this._hi=I,this._lo=d-I+w,this}};We.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};We.prototype.divide=function(){if(arguments[0]instanceof We){var t=arguments[0],e=null,n=null,r=null,i=null,a=null,c=null,l=null,d=null;a=this._hi/t._hi,c=We.SPLIT*a,e=c-a,d=We.SPLIT*t._hi,e=c-e,n=a-e,r=d-t._hi,l=a*t._hi,r=d-r,i=t._hi-r,d=e*r-l+e*i+n*r+n*i,c=(this._hi-l-d+this._lo-a*t._lo)/t._hi,d=a+c;var w=d,S=a-d+c;return new We(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return $t.isNaN(I)?We.createNaN():We.copy(this).selfDivide(I,0)}};We.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};We.prototype.pow=function(t){if(t===0)return We.valueOf(1);var e=new We(this),n=We.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(e),r/=2,r>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};We.prototype.ceil=function(){if(this.isNaN())return We.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new We(t,e)};We.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};We.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};We.prototype.setValue=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};We.prototype.max=function(t){return this.ge(t)?this:t};We.prototype.sqrt=function(){if(this.isZero())return We.valueOf(0);if(this.isNegative())return We.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=We.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};We.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof We){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,a=null,c=null,l=null;return i=this._hi+e,c=i-this._hi,a=i-c,a=e-c+(this._hi-a),l=a+this._lo,n=i+l,r=l+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],w=arguments[1],S=null,I=null,T=null,k=null,D=null,U=null,j=null,$=null;D=this._hi+d,T=this._lo+w,j=D-this._hi,$=T-this._lo,U=D-j,k=T-$,U=d-j+(this._hi-U),k=w-$+(this._lo-k),j=U+T,S=D+j,I=j+(D-S),j=k+I;var B=S+j,q=j+(S-B);return this._hi=B,this._lo=q,this}};We.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof We){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,l=null,d=null,w=null;d=We.SPLIT*this._hi,i=d-this._hi,w=We.SPLIT*n,i=d-i,a=this._hi-i,c=w-n,d=this._hi*n,c=w-c,l=n-c,w=i*c-d+i*l+a*c+a*l+(this._hi*r+this._lo*n);var S=d+w;i=d-S;var I=w+i;return this._hi=S,this._lo=I,this}};We.prototype.selfSqr=function(){return this.selfMultiply(this)};We.prototype.floor=function(){if(this.isNaN())return We.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new We(t,e)};We.prototype.negate=function(){return this.isNaN()?this:new We(-this._hi,-this._lo)};We.prototype.clone=function(){};We.prototype.multiply=function(){if(arguments[0]instanceof We){var t=arguments[0];return t.isNaN()?We.createNaN():We.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return $t.isNaN(e)?We.createNaN():We.copy(this).selfMultiply(e,0)}};We.prototype.isNaN=function(){return $t.isNaN(this._hi)};We.prototype.intValue=function(){return Math.trunc(this._hi)};We.prototype.toString=function(){var t=We.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};We.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+We.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=We.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};We.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,a=null,c=null,l=null;i=1/this._hi,a=We.SPLIT*i,t=a-i,l=We.SPLIT*this._hi,t=a-t,e=i-t,n=l-this._hi,c=i*this._hi,n=l-n,r=this._hi-n,l=t*n-c+t*r+e*n+e*r,a=(1-c-l-i*this._lo)/this._hi;var d=i+a,w=i-d+a;return new We(d,w)};We.prototype.toSciNotation=function(){if(this.isZero())return We.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=We.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};We.prototype.abs=function(){return this.isNaN()?We.NaN:this.isNegative()?this.negate():new We(this)};We.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};We.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};We.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};We.prototype.trunc=function(){return this.isNaN()?We.NaN:this.isPositive()?this.floor():this.ceil()};We.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};We.prototype.interfaces_=function(){return[ms,ds,D_]};We.prototype.getClass=function(){return We};We.sqr=function(t){return We.valueOf(t).selfMultiply(t)};We.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return We.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new We(e)}};We.sqrt=function(t){return We.valueOf(t).sqrt()};We.parse=function(t){for(var e=0,n=t.length;Rd.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,Rd.isDigit(w)){var S=w-"0";a.selfMultiply(We.TEN),a.selfAdd(S),c++;continue}if(w==="."){l=c;continue}if(w==="e"||w==="E"){var I=t.substring(e);try{d=oa.parseInt(I)}catch(j){throw j instanceof Error?new Error("Invalid exponent "+I+" in string "+t):j}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var T=a,k=c-l-d;if(k===0)T=a;else if(k>0){var D=We.TEN.pow(k);T=a.divide(D)}else if(k<0){var U=We.TEN.pow(-k);T=a.multiply(U)}return r?T.negate():T};We.createNaN=function(){return new We($t.NaN,$t.NaN)};We.copy=function(t){return new We(t)};We.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=e&&(r+=1),r};We.stringOfChar=function(t,e){for(var n=new ya,r=0;r0){if(a<=0)return co.signum(c);r=i+a}else if(i<0){if(a>=0)return co.signum(c);r=-i-a}else return co.signum(c);var l=co.DP_SAFE_EPSILON*r;return c>=l||-c>=l?co.signum(c):2};co.signum=function(t){return t>0?1:t<0?-1:0};nC.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(co,nC);var Tn=function(){},em={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};em.X.get=function(){return 0};em.Y.get=function(){return 1};em.Z.get=function(){return 2};em.M.get=function(){return 3};Tn.prototype.setOrdinate=function(t,e,n){};Tn.prototype.size=function(){};Tn.prototype.getOrdinate=function(t,e){};Tn.prototype.getCoordinate=function(){};Tn.prototype.getCoordinateCopy=function(t){};Tn.prototype.getDimension=function(){};Tn.prototype.getX=function(t){};Tn.prototype.clone=function(){};Tn.prototype.expandEnvelope=function(t){};Tn.prototype.copy=function(){};Tn.prototype.getY=function(t){};Tn.prototype.toCoordinateArray=function(){};Tn.prototype.interfaces_=function(){return[D_]};Tn.prototype.getClass=function(){return Tn};Object.defineProperties(Tn,em);var rC=function(){},Jf=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}(rC),Ti=function(){};Ti.arraycopy=function(t,e,n,r,i){for(var a=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Ot.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ot){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};Ot.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};Ot.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Ot.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Ot.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Ot.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Ot.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Ot.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()}};Ot.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ot){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof Oe){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Ot.prototype.centre=function(){return this.isNull()?null:new Oe((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Ot.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Oe){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Ot){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Ot.prototype.hashCode=function(){var t=17;return t=37*t+Oe.hashCode(this._minx),t=37*t+Oe.hashCode(this._maxx),t=37*t+Oe.hashCode(this._miny),t=37*t+Oe.hashCode(this._maxy),t};Ot.prototype.interfaces_=function(){return[ds,ms]};Ot.prototype.getClass=function(){return Ot};Ot.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3],l=Math.min(a.x,c.x),d=Math.max(a.x,c.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>d||Sd)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};mr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};mr.prototype.setPrecisionModel=function(t){this._precisionModel=t};mr.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ni?a=r:a=i;else{var c=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y);r>i?a=c:a=l,a===0&&!t.equals(e)&&(a=Math.max(c,l))}return ln.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};mr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return ln.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};Qc.DONT_INTERSECT.get=function(){return 0};Qc.DO_INTERSECT.get=function(){return 1};Qc.COLLINEAR.get=function(){return 2};Qc.NO_INTERSECTION.get=function(){return 0};Qc.POINT_INTERSECTION.get=function(){return 1};Qc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(mr,Qc);var $u=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new Ot(this._inputLines[0][0],this._inputLines[0][1]),i=new Ot(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Ot.intersects(r,i,n)&&It.orientationIndex(r,i,n)===0&&It.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,a,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,a.x-=c.x,a.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,a){var c=null;try{c=Ls.intersection(n,r,i,a)}catch(l){if(l instanceof Jf)c=e.nearestEndpoint(n,r,i,a);else throw l}finally{}return c},e.prototype.intersection=function(n,r,i,a){var c=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(c)||(c=new Oe(e.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c},e.prototype.smallestInAbsValue=function(n,r,i,a){var c=n,l=Math.abs(c);return Math.abs(r)1e-4&&Ti.out.println("Distance = "+c.distance(l))},e.prototype.intersectionWithNormalization=function(n,r,i,a){var c=new Oe(n),l=new Oe(r),d=new Oe(i),w=new Oe(a),S=new Oe;this.normalizeToEnvCentre(c,l,d,w,S);var I=this.safeHCoordinateIntersection(c,l,d,w);return I.x+=S.x,I.y+=S.y,I},e.prototype.computeCollinearIntersection=function(n,r,i,a){var c=Ot.intersects(n,r,i),l=Ot.intersects(n,r,a),d=Ot.intersects(i,a,n),w=Ot.intersects(i,a,r);return c&&l?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):d&&w?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&d?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!l&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!l&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&d?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!c&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!c&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,a,c){var l=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,D=i.y>a.y?i.y:a.y,U=l>I?l:I,j=wT?d:T,B=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var d=It.orientationIndex(i,a,n),w=It.orientationIndex(i,a,r);if(d>0&&w>0||d<0&&w<0)return t.NO_INTERSECTION;var S=c===0&&l===0&&d===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(c===0||l===0||d===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(a)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(a)?this._intPt[0]=r:c===0?this._intPt[0]=new Oe(i):l===0?this._intPt[0]=new Oe(a):d===0?this._intPt[0]=new Oe(n):w===0&&(this._intPt[0]=new Oe(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,a){var c=n,l=It.distancePointLine(n,i,a),d=It.distancePointLine(r,i,a);return d0?n>0?-i:i:n>0?i:-i;if(e===0||n===0)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,a=t,t=n,n=a,a=e,e=r,r=a):e<=-r?(i=-i,n=-n,r=-r):(a=t,t=-n,n=a,a=e,e=-r,r=a):r>0?-e<=r?(i=-i,t=-t,e=-e):(a=-t,t=n,n=a,a=-e,e=r,r=a):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,a=-t,t=-n,n=a,a=-e,e=-r,r=a),t>0)if(n>0){if(!(t<=n))return i}else return i;else{if(n>0)return-i;if(t>=n)i=-i,t=-t,n=-n;else return-i}for(;;){if(c=Math.floor(n/t),n=n-c*t,r=r-c*e,r<0)return-i;if(r>e)return i;if(t>n+n){if(er+r)return-i;n=t-n,r=e-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(c=Math.floor(t/n),t=t-c*n,e=e-c*r,e<0))return i;if(e>r)return-i;if(n>t+t){if(re+e)return i;t=n-t,e=r-e,i=-i}if(e===0)return t===0?0:i;if(t===0)return-i}};var ra=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ra.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,a=t.y-this._p.y,c=e.x-this._p.x,l=e.y-this._p.y,d=Dc.signOfDet2x2(i,a,c,l);if(d===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};ra.prototype.isPointInPolygon=function(){return this.getLocation()!==Be.EXTERIOR};ra.prototype.getLocation=function(){return this._isPointOnSegment?Be.BOUNDARY:this._crossingCount%2===1?Be.INTERIOR:Be.EXTERIOR};ra.prototype.isOnSegment=function(){return this._isPointOnSegment};ra.prototype.interfaces_=function(){return[]};ra.prototype.getClass=function(){return ra};ra.locatePointInRing=function(){if(arguments[0]instanceof Oe&&Zt(arguments[1],Tn)){for(var t=arguments[0],e=arguments[1],n=new ra(t),r=new Oe,i=new Oe,a=1;a1||d<0||d>1)&&(i=!0)}}return i?Zo.min(It.distancePointLine(t,n,r),It.distancePointLine(e,n,r),It.distancePointLine(n,t,e),It.distancePointLine(r,t,e)):0};It.isPointInRing=function(t,e){return It.locatePointInRing(t,e)!==Be.EXTERIOR};It.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Oe;t.getCoordinate(0,r);for(var i=r.x,a=r.y,c=1;cn.y&&(n=a,r=i)}var c=r;do c=c-1,c<0&&(c=e);while(t[c].equals2D(n)&&c!==r);var l=r;do l=(l+1)%e;while(t[l].equals2D(n)&&l!==r);var d=t[c],w=t[l];if(d.equals2D(n)||w.equals2D(n)||d.equals2D(w))return!1;var S=It.computeOrientation(d,n,w),I=!1;return S===0?I=d.x>w.x:I=S>0,I};It.locatePointInRing=function(t,e){return ra.locatePointInRing(t,e)};It.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};It.computeOrientation=function(t,e,n){return It.orientationIndex(t,e,n)};It.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new lr("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return a.distance(l);var S=((c.y-a.y)*(l.x-c.x)-(c.x-a.x)*(l.y-c.y))/d;return Math.abs(S)*Math.sqrt(d)}};It.isOnLine=function(t,e){for(var n=new $u,r=1;r0};Lf.prototype.interfaces_=function(){return[hs]};Lf.prototype.getClass=function(){return Lf};var Pf=function(){};Pf.prototype.isInBoundary=function(t){return t>1};Pf.prototype.interfaces_=function(){return[hs]};Pf.prototype.getClass=function(){return Pf};var Mf=function(){};Mf.prototype.isInBoundary=function(t){return t===1};Mf.prototype.interfaces_=function(){return[hs]};Mf.prototype.getClass=function(){return Mf};var qr=function(){};qr.prototype.add=function(){};qr.prototype.addAll=function(){};qr.prototype.isEmpty=function(){};qr.prototype.iterator=function(){};qr.prototype.size=function(){};qr.prototype.toArray=function(){};qr.prototype.remove=function(){};function o1(t){this.message=t||""}o1.prototype=new Error;o1.prototype.name="IndexOutOfBoundsException";var Qf=function(){};Qf.prototype.hasNext=function(){};Qf.prototype.next=function(){};Qf.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}(qr);function $f(t){this.message=t||""}$f.prototype=new Error;$f.prototype.name="NoSuchElementException";var yt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof qr&&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,qr]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},e.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},e.prototype.iterator=function(){return new SR(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new o1;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(l))return null}t.prototype.add.call(this,l)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],I=arguments[1];return this.add(S,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var T=arguments[0],k=arguments[1],D=arguments[2];if(D)for(var U=0;U=0;j--)r.add(T[j],k);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Oe){var $=arguments[0],B=arguments[1],q=arguments[2];if(!q){var J=this.size();if(J>0){if($>0){var ce=this.get($-1);if(ce.equals2D(B))return null}if($Le&&(X=-1);for(var le=ee;le!==Le;le+=X)r.add(de[le],ie);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Oe(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(yt),vn=function(){},N_={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};N_.ForwardComparator.get=function(){return Nd};N_.BidirectionalComparator.get=function(){return Af};N_.coordArrayType.get=function(){return new Array(0).fill(null)};vn.prototype.interfaces_=function(){return[]};vn.prototype.getClass=function(){return vn};vn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};vn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};vn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};vn.extract=function(t,e,n){e=Zo.clamp(e,0,t.length),n=Zo.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=vn.compare(n,r),a=vn.isEqualReversed(n,r);return a?0:i};Af.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=vn.increasingDirection(n),a=vn.increasingDirection(r),c=i>0?0:n.length-1,l=a>0?0:n.length-1,d=0;d0)e=e.right;else return e.value}return null};Ni.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:cl,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var a=n.value;return n.value=e,a}while(n!==null);var c={key:t,left:null,right:null,value:e,parent:r,color:cl,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};Ni.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Au;t!=null&&t!==this.root_&&t.parent.color===Au;)if(Jn(t)===T0(Jn(Jn(t)))){var n=p2(Jn(Jn(t)));f2(n)===Au?(ol(Jn(t),cl),ol(n,cl),ol(Jn(Jn(t)),Au),t=Jn(Jn(t))):(t===p2(Jn(t))&&(t=Jn(t),e.rotateLeft(t)),ol(Jn(t),cl),ol(Jn(Jn(t)),Au),e.rotateRight(Jn(Jn(t))))}else{var r=T0(Jn(Jn(t)));f2(r)===Au?(ol(Jn(t),cl),ol(r,cl),ol(Jn(Jn(t)),Au),t=Jn(Jn(t))):(t===T0(Jn(t))&&(t=Jn(t),e.rotateRight(t)),ol(Jn(t),cl),ol(Jn(Jn(t)),Au),e.rotateLeft(Jn(Jn(t))))}this.root_.color=cl};Ni.prototype.values=function(){var t=new yt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Ni.successor(e))!==null;)t.add(e.value);return t};Ni.prototype.entrySet=function(){var t=new s1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Ni.successor(e))!==null;)t.add(e);return t};Ni.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}};Ni.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}};Ni.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Ni.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Ni.prototype.size=function(){return this.size_};var Od=function(){};Od.prototype.interfaces_=function(){return[]};Od.prototype.getClass=function(){return Od};function oC(){}oC.prototype=new O_;function sa(){this.array_=[],arguments[0]instanceof qr&&this.addAll(arguments[0])}sa.prototype=new oC;sa.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var c=i.substring(0,a);r.add(c),i=i.substring(a+n),a=i.indexOf(e)}i.length>0&&r.add(i);for(var l=new Array(r.size()).fill(null),d=0;d0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(as.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Ar.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Ar.createClosedRing(t,e,4);var r=e.getOrdinate(0,Tn.X)===e.getOrdinate(n-1,Tn.X)&&e.getOrdinate(0,Tn.Y)===e.getOrdinate(n-1,Tn.Y);return r?e:Ar.createClosedRing(t,e,n+1)};Ar.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Ar.copy(e,0,r,0,i);for(var a=i;a0&&Ar.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?kn.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 It.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Ar.reverse(r);var i=this.getFactory().createLineString(r);return i},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,c=0,l=0;c= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=this,a=0;a=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}(Sr),Da=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 qt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};Bd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Bd.prototype.getClass=function(){return Bd};var Vd=function(){};Vd.prototype.edit=function(t,e){return t instanceof za?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Sr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Po?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Vd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Vd.prototype.getClass=function(){return Vd};var Pr=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 ya(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Pr(n):new Pr(n,r)}};Fa.prototype.interfaces_=function(){return[Cf,ms]};Fa.prototype.getClass=function(){return Fa};Fa.instance=function(){return Fa.instanceObject};l1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};l1.instanceObject.get=function(){return new Fa};Object.defineProperties(Fa,l1);var aC=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new yt,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new s1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(eh),Rn=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 la){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},u1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Rn.prototype.equals=function(t){if(!(t instanceof Rn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Rn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new oa(n).compareTo(new oa(r))};Rn.prototype.getScale=function(){return this._scale};Rn.prototype.isFloating=function(){return this._modelType===Rn.FLOATING||this._modelType===Rn.FLOATING_SINGLE};Rn.prototype.getType=function(){return this._modelType};Rn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Rn.FLOATING?t="Floating":this._modelType===Rn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Rn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Rn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if($t.isNaN(t))return t;if(this._modelType===Rn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Rn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Oe){var n=arguments[0];if(this._modelType===Rn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Rn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Rn.FLOATING?t=16:this._modelType===Rn.FLOATING_SINGLE?t=6:this._modelType===Rn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Rn.prototype.setScale=function(t){this._scale=Math.abs(t)};Rn.prototype.interfaces_=function(){return[ms,ds]};Rn.prototype.getClass=function(){return Rn};Rn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};u1.serialVersionUID.get=function(){return 7777263578777804e3};u1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Rn,u1);var la=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},c1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};la.prototype.readResolve=function(){return la.nameToTypeMap.get(this._name)};la.prototype.toString=function(){return this._name};la.prototype.interfaces_=function(){return[ms]};la.prototype.getClass=function(){return la};c1.serialVersionUID.get=function(){return-552860263173159e4};c1.nameToTypeMap.get=function(){return new aC};Object.defineProperties(la,c1);Rn.Type=la;Rn.FIXED=new la("FIXED");Rn.FLOATING=new la("FLOATING");Rn.FLOATING_SINGLE=new la("FLOATING SINGLE");var yn=function t(){this._precisionModel=new Rn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Zt(arguments[0],Cf)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Rn&&(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]))},lC={serialVersionUID:{configurable:!0}};yn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Oe(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Oe(t.getMinX(),t.getMinY()),new Oe(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Oe(t.getMinX(),t.getMinY()),new Oe(t.getMinX(),t.getMaxY()),new Oe(t.getMaxX(),t.getMaxY()),new Oe(t.getMaxX(),t.getMinY()),new Oe(t.getMinX(),t.getMinY())]),null)};yn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Sr(this.getCoordinateSequenceFactory().create(t),this);if(Zt(t,Tn))return new Sr(t,this)}else return new Sr(this.getCoordinateSequenceFactory().create([]),this)};yn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Vu(null,this);if(arguments.length===1){var t=arguments[0];return new Vu(t,this)}};yn.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var a=i.next(),c=a.getClass();e===null&&(e=c),c!==e&&(n=!0),a.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(yn.toGeometryArray(t));var l=t.iterator().next(),d=t.size()>1;if(d){if(l instanceof Qr)return this.createMultiPolygon(yn.toPolygonArray(t));if(l instanceof Sr)return this.createMultiLineString(yn.toLineStringArray(t));if(l instanceof Po)return this.createMultiPoint(yn.toPointArray(t));ln.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};yn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};yn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Oe){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Zt(arguments[0],Tn)){var e=arguments[0];return new Po(e,this)}}};yn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};yn.prototype.createPolygon=function(){if(arguments.length===0)return new Qr(null,null,this);if(arguments.length===1){if(Zt(arguments[0],Tn)){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 za){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Qr(r,i,this)}};yn.prototype.getSRID=function(){return this._SRID};yn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Ki(null,this);if(arguments.length===1){var t=arguments[0];return new Ki(t,this)}};yn.prototype.createGeometry=function(t){var e=new fs(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};yn.prototype.getPrecisionModel=function(){return this._precisionModel};yn.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(Zt(arguments[0],Tn)){var e=arguments[0];return new za(e,this)}}};yn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Da(null,this);if(arguments.length===1){var t=arguments[0];return new Da(t,this)}};yn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new kf(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new kf(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Zt(arguments[0],Tn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[t]};va.prototype.push=function(t){return this.array_.push(t),t};va.prototype.pop=function(t){if(this.array_.length===0)throw new U_;return this.array_.pop()};va.prototype.peek=function(){if(this.array_.length===0)throw new U_;return this.array_[this.array_.length-1]};va.prototype.empty=function(){return this.array_.length===0};va.prototype.isEmpty=function(){return this.empty()};va.prototype.search=function(t){return this.array_.indexOf(t)};va.prototype.size=function(){return this.array_.length};va.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===It.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ua.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var i=ut.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};ua.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)};ua.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}ln.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===ut.LEFT&&(this._orientedDe=this._minDe.getSym())};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};var vl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new Oe(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(_l),G_=function(){this.array_=[]};G_.prototype.addLast=function(t){this.array_.push(t)};G_.prototype.removeFirst=function(){return this.array_.shift()};G_.prototype.isEmpty=function(){return this.array_.length===0};var Ji=function(){this._finder=null,this._dirEdgeList=new yt,this._nodes=new yt,this._rightMostCoord=null,this._env=null,this._finder=new ua};Ji.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Ji.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Ji.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new vl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var a=t.getEdges().iterator();a.hasNext();){var c=a.next();c.setVisited(!0),e.copySymDepths(c)}};Ji.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(ut.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Ji.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Ji.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(ut.RIGHT)>=1&&e.getDepth(ut.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Ji.prototype.computeDepths=function(t){var e=this,n=new s1,r=new G_,i=t.getNode();for(r.addLast(i),n.add(i),t.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),e.computeNodeDepth(a);for(var c=a.getEdges().iterator();c.hasNext();){var l=c.next(),d=l.getSym();if(!d.isVisited()){var w=d.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Ji.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Ji.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Ot,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[ut.ON]=this.location[ut.ON],n[ut.LEFT]=Be.NONE,n[ut.RIGHT]=Be.NONE,this.location=n}for(var r=0;r1&&t.append(Be.toLocationSymbol(this.location[ut.LEFT])),t.append(Be.toLocationSymbol(this.location[ut.ON])),this.location.length>1&&t.append(Be.toLocationSymbol(this.location[ut.RIGHT])),t.toString()};Qn.prototype.setLocations=function(t,e,n){this.location[ut.ON]=t,this.location[ut.LEFT]=e,this.location[ut.RIGHT]=n};Qn.prototype.get=function(t){return t1};Qn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};Br.prototype.addPoints=function(t,e,n){var r=this,i=t.getCoordinates();if(e){var a=1;n&&(a=0);for(var c=a;c=0;d--)r._pts.add(i[d])}};Br.prototype.isHole=function(){return this._isHole};Br.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Br.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!It.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};Br.prototype.addHole=function(t){this._holes.add(t)};Br.prototype.isShell=function(){return this._shell===null};Br.prototype.getLabel=function(){return this._label};Br.prototype.getEdges=function(){return this._edges};Br.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Br.prototype.getShell=function(){return this._shell};Br.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,ut.RIGHT);if(r===Be.NONE)return null;if(this._label.getLocation(n)===Be.NONE)return this._label.setLocation(n,r),null}};Br.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Br.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};Xo.prototype.isInResult=function(){return this._isInResult};Xo.prototype.isVisited=function(){return this._isVisited};Xo.prototype.interfaces_=function(){return[]};Xo.prototype.getClass=function(){return Xo};var j_=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Vn(0,Be.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var i=Be.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==Be.BOUNDARY&&(i=a)}return i},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Vn(n,r):this._label.setLocation(n,r)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Vn)for(var i=arguments[0],a=0;a<2;a++){var c=n.computeMergedLocation(i,a),l=n._label.getLocation(a);l===Be.NONE&&n._label.setLocation(a,c)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=Be.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Be.BOUNDARY:i=Be.INTERIOR;break;case Be.INTERIOR:i=Be.BOUNDARY;break;default:i=Be.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xo),ca=function(){this.nodeMap=new Ni,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ca.prototype.find=function(t){return this.nodeMap.get(t)};ca.prototype.addNode=function(){if(arguments[0]instanceof Oe){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 j_){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ca.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};ca.prototype.iterator=function(){return this.nodeMap.values().iterator()};ca.prototype.values=function(){return this.nodeMap.values()};ca.prototype.getBoundaryNodes=function(t){for(var e=new yt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Be.BOUNDARY&&e.add(r)}return e};ca.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};var Un=function(){},rm={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Un.prototype.interfaces_=function(){return[]};Un.prototype.getClass=function(){return Un};Un.isNorthern=function(t){return t===Un.NE||t===Un.NW};Un.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Un.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var r=te?t:e;return r===0&&i===3?3:r};Un.isInHalfPlane=function(t,e){return e===Un.SE?t===Un.SE||t===Un.SW:t===e||t===e+1};Un.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 lr("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Un.NE:Un.SE:e>=0?Un.NW:Un.SW}else if(arguments[0]instanceof Oe&&arguments[1]instanceof Oe){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new lr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Un.NE:Un.SE:r.y>=n.y?Un.NW:Un.SW}};rm.NE.get=function(){return 0};rm.NW.get=function(){return 1};rm.SW.get=function(){return 2};rm.SE.get=function(){return 3};Object.defineProperties(Un,rm);var Oi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],l=arguments[2],d=arguments[3];this._edge=a,this.init(c,l),this._label=d}};Oi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var l=c.buildMinimalRings(),d=r.findShell(l);d!==null?(r.placePolygonHoles(d,l),e.add(d)):n.addAll(l)}else i.add(c)}return i};Mo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Mo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new yt,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new RR(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};Mo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Mo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Mo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,c=null,l=e.iterator();l.hasNext();){var d=l.next(),w=d.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(c=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&It.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||c.contains(S))&&(a=d)}return a};Mo.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return ln.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Mo.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];gr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new yt,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Mo.prototype.interfaces_=function(){return[]};Mo.prototype.getClass=function(){return Mo};var Rf=function(){};Rf.prototype.getBounds=function(){};Rf.prototype.interfaces_=function(){return[]};Rf.prototype.getClass=function(){return Rf};var ks=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};ks.prototype.getItem=function(){return this._item};ks.prototype.getBounds=function(){return this._bounds};ks.prototype.interfaces_=function(){return[Rf,ms]};ks.prototype.getClass=function(){return ks};var bl=function(){this._size=null,this._items=null,this._size=0,this._items=new yt,this._items.add(null)};bl.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};bl.prototype.size=function(){return this._size};bl.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)};bl.prototype.clear=function(){this._size=0,this._items.clear()};bl.prototype.isEmpty=function(){return this._size===0};bl.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)};bl.prototype.interfaces_=function(){return[]};bl.prototype.getClass=function(){return bl};var nu=function(){};nu.prototype.visitItem=function(t){};nu.prototype.interfaces_=function(){return[]};nu.prototype.getClass=function(){return nu};var Rc=function(){};Rc.prototype.insert=function(t,e){};Rc.prototype.remove=function(t,e){};Rc.prototype.query=function(){};Rc.prototype.interfaces_=function(){return[]};Rc.prototype.getClass=function(){return Rc};var Zr=function(){if(this._childBoundables=new yt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},cC={serialVersionUID:{configurable:!0}};Zr.prototype.getLevel=function(){return this._level};Zr.prototype.size=function(){return this._childBoundables.size()};Zr.prototype.getChildBoundables=function(){return this._childBoundables};Zr.prototype.addChildBoundable=function(t){ln.isTrue(this._bounds===null),this._childBoundables.add(t)};Zr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Zr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Zr.prototype.interfaces_=function(){return[Rf,ms]};Zr.prototype.getClass=function(){return Zr};cC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Zr,cC);var Ds=function(){};Ds.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ds.min=function(t){return Ds.sort(t),t.get(0)};Ds.sort=function(t,e){var n=t.toArray();e?zu.sort(n,e):zu.sort(n);for(var r=t.iterator(),i=0,a=n.length;iOr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new lr("neither boundable is composite")};Or.prototype.isLeaves=function(){return!(Or.isComposite(this._boundable1)||Or.isComposite(this._boundable2))};Or.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Or.prototype.expand=function(t,e,n,r){for(var i=this,a=t.getChildBoundables(),c=a.iterator();c.hasNext();){var l=c.next(),d=new Or(l,e,i._itemDistance);d.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},q_={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};vi.prototype.getNodeCapacity=function(){return this._nodeCapacity};vi.prototype.lastNode=function(t){return t.get(t.size()-1)};vi.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Zr?n+=t.size(i):i instanceof ks&&(n+=1)}return n}};vi.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof ks&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};vi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new yt:e}else if(arguments.length===1){for(var n=arguments[0],r=new yt,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Zr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof ks?r.add(a.getItem()):ln.shouldNeverReachHere()}return r.size()<=0?null:r}};vi.prototype.insert=function(t,e){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ks(t,e))};vi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new yt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(ln.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var l=c.next();l instanceof Zr?t.boundablesAtLevel(r,l,a):(ln.isTrue(l instanceof ks),r===-1&&a.add(l))}return null}};vi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new yt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Zt(arguments[2],nu)&&arguments[0]instanceof Object&&arguments[1]instanceof Zr)for(var a=arguments[0],c=arguments[1],l=arguments[2],d=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};vi.prototype.createParentBoundables=function(t,e){var n=this;ln.isTrue(!t.isEmpty());var r=new yt;r.add(this.createNode(e));var i=new yt(t);Ds.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var c=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};vi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};vi.prototype.interfaces_=function(){return[ms]};vi.prototype.getClass=function(){return vi};vi.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new yt,l=0;l0;){var D=k.poll(),U=D.getDistance();if(U>=I)break;D.isLeaves()?(I=U,T=D):D.expandToQueue(k,I)}return[T.getBoundable(0).getItem(),T.getBoundable(1).getItem()]}}else if(arguments.length===3){var j=arguments[0],$=arguments[1],B=arguments[2],q=new ks(j,$),J=new Or(this.getRoot(),q,B);return this.nearestNeighbour(J)[0]}},e.prototype.interfaces_=function(){return[Rc,ms]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return d2},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[If]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[If]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(vi),d2=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Ot(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zr),lo=function(){};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};lo.relativeSign=function(t,e){return te?1:0};lo.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=lo.relativeSign(e.x,n.x),i=lo.relativeSign(e.y,n.y);switch(t){case 0:return lo.compareValue(r,i);case 1:return lo.compareValue(i,r);case 2:return lo.compareValue(i,-r);case 3:return lo.compareValue(-r,i);case 4:return lo.compareValue(-r,-i);case 5:return lo.compareValue(-i,-r);case 6:return lo.compareValue(-i,r);case 7:return lo.compareValue(r,-i)}return ln.shouldNeverReachHere("invalid octant value"),0};lo.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var ru=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new Oe(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};ru.prototype.getCoordinate=function(){return this.coord};ru.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};ru.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:lo.compare(this._segmentOctant,this.coord,e.coord)};ru.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};ru.prototype.isInterior=function(){return this._isInterior};ru.prototype.interfaces_=function(){return[ds]};ru.prototype.getClass=function(){return ru};var Qi=function(){this._nodeMap=new Ni,this._edge=null;var t=arguments[0];this._edge=t};Qi.prototype.getSplitCoordinates=function(){var t=this,e=new tm;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();t.addEdgeCoordinates(r,i,e),r=i}return e.toCoordinateArray()};Qi.prototype.addCollapsedNodes=function(){var t=this,e=new yt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};Qi.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Qi.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Oe&&arguments[1]instanceof Oe){var i=arguments[0],a=arguments[1],c=a.x-i.x,l=a.y-i.y;if(c===0&&l===0)throw new lr("Cannot compute the octant for two identical points "+i);return Nc.octant(c,l)}};var Ba=function(){};Ba.prototype.getCoordinates=function(){};Ba.prototype.size=function(){};Ba.prototype.getCoordinate=function(t){};Ba.prototype.isClosed=function(){};Ba.prototype.setData=function(t){};Ba.prototype.getData=function(){};Ba.prototype.interfaces_=function(){return[]};Ba.prototype.getClass=function(){return Ba};var Ud=function(){};Ud.prototype.addIntersection=function(t,e){};Ud.prototype.interfaces_=function(){return[Ba]};Ud.prototype.getClass=function(){return Ud};var kr=function(){this._nodeList=new Qi(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};kr.prototype.getCoordinates=function(){return this._pts};kr.prototype.size=function(){return this._pts.length};kr.prototype.getCoordinate=function(t){return this._pts[t]};kr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};kr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};kr.prototype.setData=function(t){this._data=t};kr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Nc.octant(t,e)};kr.prototype.getData=function(){return this._data};kr.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],a=new Oe(n.getIntersection(i));this.addIntersection(a,r)}};kr.prototype.toString=function(){return Ms.toLineString(new Pr(this._pts))};kr.prototype.getNodeList=function(){return this._nodeList};kr.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof Oe){var r=arguments[0];return It.orientationIndex(this.p0,this.p1,r)}};zt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};zt.prototype.isVertical=function(){return this.p0.x===this.p1.x};zt.prototype.equals=function(t){if(!(t instanceof zt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};zt.prototype.intersection=function(t){var e=new $u;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};zt.prototype.project=function(){if(arguments[0]instanceof Oe){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Oe(t);var e=this.projectionFactor(t),n=new Oe;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 zt){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var c=this.project(r.p0);i<0&&(c=this.p0),i>1&&(c=this.p1);var l=this.project(r.p1);return a<0&&(l=this.p0),a>1&&(l=this.p1),new zt(c,l)}};zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};zt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};zt.prototype.distancePerpendicular=function(t){return It.distancePointLinePerpendicular(t,this.p0,this.p1)};zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};zt.prototype.midPoint=function(){return zt.midPoint(this.p0,this.p1)};zt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return $t.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};zt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=$t.MAX_VALUE,i=null,a=this.closestPoint(t.p0);r=a.distance(t.p0),n[0]=a,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||$t.isNaN(e))&&(e=1),e};zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};zt.prototype.distance=function(){if(arguments[0]instanceof zt){var t=arguments[0];return It.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Oe){var e=arguments[0];return It.distancePointLine(e,this.p0,this.p1)}};zt.prototype.pointAlong=function(t){var e=new Oe;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};zt.prototype.hashCode=function(){var t=$t.doubleToLongBits(this.p0.x);t^=$t.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=$t.doubleToLongBits(this.p1.x);n^=$t.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};zt.prototype.interfaces_=function(){return[ds,ms]};zt.prototype.getClass=function(){return zt};zt.midPoint=function(t,e){return new Oe((t.x+e.x)/2,(t.y+e.y)/2)};fC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(zt,fC);var Gd=function(){this.tempEnv1=new Ot,this.tempEnv2=new Ot,this._overlapSeg1=new zt,this._overlapSeg2=new zt};Gd.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Gd.prototype.interfaces_=function(){return[]};Gd.prototype.getClass=function(){return Gd};var Ao=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Ao.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Ao.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],a=this._pts[n];if(r.tempEnv1.init(i,a),n-e===1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var c=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=Un.quadrant(t[n],t[n+1]),i=e+1;ic.getId()&&(c.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return m2},Object.defineProperties(e,n),e}(jd),m2=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3],c=n.getContext(),l=i.getContext();this._si.processIntersections(c,r,l,a)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Gd),Dn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(c),this.setMitreLimit(l)}}},Cl={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}};Dn.prototype.getEndCapStyle=function(){return this._endCapStyle};Dn.prototype.isSingleSided=function(){return this._isSingleSided};Dn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Dn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Dn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Dn.JOIN_ROUND&&(this._quadrantSegments=Dn.DEFAULT_QUADRANT_SEGMENTS)};Dn.prototype.getJoinStyle=function(){return this._joinStyle};Dn.prototype.setJoinStyle=function(t){this._joinStyle=t};Dn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Dn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Dn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Dn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Dn.prototype.getMitreLimit=function(){return this._mitreLimit};Dn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Dn.prototype.setSingleSided=function(t){this._isSingleSided=t};Dn.prototype.interfaces_=function(){return[]};Dn.prototype.getClass=function(){return Dn};Dn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Cl.CAP_ROUND.get=function(){return 1};Cl.CAP_FLAT.get=function(){return 2};Cl.CAP_SQUARE.get=function(){return 3};Cl.JOIN_ROUND.get=function(){return 1};Cl.JOIN_MITRE.get=function(){return 2};Cl.JOIN_BEVEL.get=function(){return 3};Cl.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Cl.DEFAULT_MITRE_LIMIT.get=function(){return 5};Cl.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Dn,Cl);var Er=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=It.COUNTERCLOCKWISE,this._inputLine=t||null},im={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Er.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],a=this._inputLine[e],c=this._inputLine[n];return!this.isConcave(i,a,c)||!this.isShallow(i,a,c,r)?!1:this.isShallowSampled(i,a,t,n,r)};Er.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};Yo.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-=Sn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Sn.PI_TIMES_2;return t};Sn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}};Sn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,l=r*a+i*c;return l>0};Sn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,l=r*a+i*c;return l<0};Sn.interiorAngle=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Math.abs(i-r)};Sn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Sn.PI_TIMES_2;t>=Sn.PI_TIMES_2&&(t=0)}else{for(;t>=Sn.PI_TIMES_2;)t-=Sn.PI_TIMES_2;t<0&&(t=0)}return t};Sn.angleBetween=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Sn.diff(r,i)};Sn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Sn.toRadians=function(t){return t*Math.PI/180};Sn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Sn.COUNTERCLOCKWISE:n<0?Sn.CLOCKWISE:Sn.NONE};Sn.angleBetweenOriented=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n),a=i-r;return a<=-Math.PI?a+Sn.PI_TIMES_2:a>Math.PI?a-Sn.PI_TIMES_2:a};th.PI_TIMES_2.get=function(){return 2*Math.PI};th.PI_OVER_2.get=function(){return Math.PI/2};th.PI_OVER_4.get=function(){return Math.PI/4};th.COUNTERCLOCKWISE.get=function(){return It.COUNTERCLOCKWISE};th.CLOCKWISE.get=function(){return It.CLOCKWISE};th.NONE.get=function(){return It.COLLINEAR};Object.defineProperties(Sn,th);var nr=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 zt,this._seg1=new zt,this._offset0=new zt,this._offset1=new zt,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new $u,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Dn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},om={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}};nr.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=It.computeOrientation(this._s0,this._s1,this._s2),r=n===It.CLOCKWISE&&this._side===ut.LEFT||n===It.COUNTERCLOCKWISE&&this._side===ut.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};nr.prototype.addLineEndCap=function(t,e){var n=new zt(t,e),r=new zt;this.computeOffsetSegment(n,ut.LEFT,this._distance,r);var i=new zt;this.computeOffsetSegment(n,ut.RIGHT,this._distance,i);var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a);switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,It.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Dn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Dn.CAP_SQUARE:var d=new Oe;d.x=Math.abs(this._distance)*Math.cos(l),d.y=Math.abs(this._distance)*Math.sin(l);var w=new Oe(r.p1.x+d.x,r.p1.y+d.y),S=new Oe(i.p1.x+d.x,i.p1.y+d.y);this._segList.addPt(w),this._segList.addPt(S);break}};nr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};nr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Ls.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:a.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(l){if(l instanceof Jf)a=new Oe(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};nr.prototype.addFilletCorner=function(t,e,n,r,i){var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a),d=n.x-t.x,w=n.y-t.y,S=Math.atan2(w,d);r===It.CLOCKWISE?l<=S&&(l+=2*Math.PI):l>=S&&(l-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,l,S,r,i),this._segList.addPt(n)};nr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Oe((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new Oe((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};nr.prototype.createCircle=function(t){var e=new Oe(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};nr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};nr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Yo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*nr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};nr.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()===Dn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Dn.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,It.CLOCKWISE,this._distance))};nr.prototype.closeRing=function(){this._segList.closeRing()};nr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};nr.prototype.interfaces_=function(){return[]};nr.prototype.getClass=function(){return nr};om.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};om.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};om.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};om.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(nr,om);var ho=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};ho.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var a=i.getCoordinates();return n&&vn.reverse(a),a};ho.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Er.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ut.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var l=Er.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],ut.LEFT),n.addFirstSegment();for(var w=2;w<=d;w++)n.addNextSegment(l[w],!0)}n.addLastSegment(),n.closeRing()};ho.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===ut.RIGHT&&(r=-r);var i=Er.simplify(t,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],e);for(var c=1;c<=a;c++){var l=c!==1;n.addNextSegment(i[c],l)}n.closeRing()};ho.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Er.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],ut.LEFT);for(var a=2;a<=i;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=Er.simplify(t,-n),l=c.length-1;e.initSideSegments(c[l],c[l-1],ut.LEFT);for(var d=l-2;d>=0;d--)e.addNextSegment(c[d],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};ho.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:e.createCircle(t);break;case Dn.CAP_SQUARE:e.createSquare(t);break}};ho.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);var a=r.getCoordinates();return a};ho.prototype.getBufferParameters=function(){return this._bufParams};ho.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};ho.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return ho.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};ho.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Er.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],ut.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var l=Er.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],ut.LEFT),n.addFirstSegment();for(var w=2;w<=d;w++)n.addNextSegment(l[w],!0)}n.addLastSegment()};ho.prototype.getSegGen=function(t){return new nr(this._precisionModel,this._bufParams,t)};ho.prototype.interfaces_=function(){return[]};ho.prototype.getClass=function(){return ho};ho.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;na.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Zt(arguments[2],Ps)&&arguments[0]instanceof Oe&&arguments[1]instanceof mv)for(var c=arguments[0],l=arguments[1],d=arguments[2],w=l.getEdge().getCoordinates(),S=0;St._seg.p1.y&&t._seg.reverse();var I=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(It._seg.p1.y)&&It.computeOrientation(t._seg.p0,t._seg.p1,c)!==It.RIGHT){var T=l.getDepth(ut.LEFT);t._seg.p0.equals(w[S])||(T=l.getDepth(ut.RIGHT));var k=new Gu(t._seg,T);d.add(k)}}else if(Zt(arguments[2],Ps)&&arguments[0]instanceof Oe&&Zt(arguments[1],Ps))for(var D=arguments[0],U=arguments[1],j=arguments[2],$=U.iterator();$.hasNext();){var B=$.next();B.isForward()&&t.findStabbedSegments(D,B,j)}}};Oc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ds.min(e);return n._leftDepth};Oc.prototype.interfaces_=function(){return[]};Oc.prototype.getClass=function(){return Oc};dC.DepthSegment.get=function(){return Gu};Object.defineProperties(Oc,dC);var Gu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new zt(t),this._leftDepth=e};Gu.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)};Gu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Gu.prototype.toString=function(){return this._upwardSeg.toString()};Gu.prototype.interfaces_=function(){return[ds]};Gu.prototype.getClass=function(){return Gu};var Nn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Nn.prototype.area=function(){return Nn.area(this.p0,this.p1,this.p2)};Nn.prototype.signedArea=function(){return Nn.signedArea(this.p0,this.p1,this.p2)};Nn.prototype.interpolateZ=function(t){if(t===null)throw new lr("Supplied point is null.");return Nn.interpolateZ(t,this.p0,this.p1,this.p2)};Nn.prototype.longestSideLength=function(){return Nn.longestSideLength(this.p0,this.p1,this.p2)};Nn.prototype.isAcute=function(){return Nn.isAcute(this.p0,this.p1,this.p2)};Nn.prototype.circumcentre=function(){return Nn.circumcentre(this.p0,this.p1,this.p2)};Nn.prototype.area3D=function(){return Nn.area3D(this.p0,this.p1,this.p2)};Nn.prototype.centroid=function(){return Nn.centroid(this.p0,this.p1,this.p2)};Nn.prototype.inCentre=function(){return Nn.inCentre(this.p0,this.p1,this.p2)};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.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)};Nn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};Nn.det=function(t,e,n,r){return t*r-e*n};Nn.interpolateZ=function(t,e,n,r){var i=e.x,a=e.y,c=n.x-i,l=r.x-i,d=n.y-a,w=r.y-a,S=c*w-l*d,I=t.x-i,T=t.y-a,k=(w*I-l*T)/S,D=(-d*I+c*T)/S,U=e.z+k*(n.z-e.z)+D*(r.z-e.z);return U};Nn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),a=n.distance(t),c=r;return i>c&&(c=i),a>c&&(c=a),c};Nn.isAcute=function(t,e,n){return!(!Sn.isAcute(t,e,n)||!Sn.isAcute(e,n,t)||!Sn.isAcute(n,t,e))};Nn.circumcentre=function(t,e,n){var r=n.x,i=n.y,a=t.x-r,c=t.y-i,l=e.x-r,d=e.y-i,w=2*Nn.det(a,c,l,d),S=Nn.det(c,a*a+c*c,d,l*l+d*d),I=Nn.det(a,a*a+c*c,l,l*l+d*d),T=r-S/w,k=i+I/w;return new Oe(T,k)};Nn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Ls(t.x+n/2,t.y+r/2,1),a=new Ls(t.x-r+n/2,t.y+n+r/2,1);return new Ls(i,a)};Nn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),a=r/(r+i),c=n.x-t.x,l=n.y-t.y,d=new Oe(t.x+a*c,t.y+a*l);return d};Nn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,a=e.z-t.z,c=n.x-t.x,l=n.y-t.y,d=n.z-t.z,w=i*d-a*l,S=a*c-r*d,I=r*l-i*c,T=w*w+S*S+I*I,k=Math.sqrt(T)/2;return k};Nn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Oe(r,i)};Nn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),a=t.distance(e),c=r+i+a,l=(r*t.x+i*e.x+a*n.x)/c,d=(r*t.y+i*e.y+a*n.y)/c;return new Oe(l,d)};var ps=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new yt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};ps.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Be.EXTERIOR,Be.INTERIOR)};ps.prototype.addPolygon=function(t){var e=this,n=this._distance,r=ut.LEFT;this._distance<0&&(n=-this._distance,r=ut.RIGHT);var i=t.getExteriorRing(),a=vn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,Be.EXTERIOR,Be.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(l,-e._distance)||e.addPolygonRing(d,n,ut.opposite(r),Be.INTERIOR,Be.EXTERIOR)}};ps.prototype.isTriangleErodedCompletely=function(t,e){var n=new Nn(t[0],t[1],t[2]),r=n.inCentre(),i=It.distancePointLine(r,n.p0,n.p1);return i=za.MINIMUM_VALID_SIZE&&It.isCCW(t)&&(a=i,c=r,n=ut.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,a,c)};ps.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Qr?this.addPolygon(t):t instanceof Sr?this.addLineString(t):t instanceof Po?this.addPoint(t):t instanceof kf?this.addCollection(t):t instanceof Vu?this.addCollection(t):t instanceof Da?this.addCollection(t):t instanceof Ki&&this.addCollection(t)};ps.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};ps.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new $f;var t=this._parent.getGeometryN(this._index++);return t instanceof Ki?(this._subcollectionIterator=new Ra(t),this._subcollectionIterator.next()):t};Ra.prototype.remove=function(){throw new Error(this.getClass().getName())};Ra.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)};Ra.prototype.interfaces_=function(){return[Qf]};Ra.prototype.getClass=function(){return Ra};Ra.isAtomic=function(t){return!(t instanceof Ki)};var Wo=function(){this._geom=null;var t=arguments[0];this._geom=t};Wo.prototype.locate=function(t){return Wo.locate(t,this._geom)};Wo.prototype.interfaces_=function(){return[Of]};Wo.prototype.getClass=function(){return Wo};Wo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?It.isPointInRing(t,e.getCoordinates()):!1};Wo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Wo.isPointInRing(t,n))return!1;for(var r=0;r=0;a--){var c=n._edgeList.get(a),l=c.getSym();i===null&&(i=l),r!==null&&l.setNext(r),r=c}i.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(ut.LEFT),c=r.getDepth(ut.RIGHT),l=this.computeDepths(i+1,this._edgeList.size(),a),d=this.computeDepths(0,i,l);if(d!==c)throw new vl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],T=I,k=w;k=0;l--){var d=r._resultAreaEdgeList.get(l),w=d.getSym();switch(i===null&&d.getEdgeRing()===n&&(i=d),c){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;a=w,c=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(d.getEdgeRing()!==n)continue;a.setNextMin(d),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(ln.isTrue(i!==null,"found null for first outgoing dirEdge"),ln.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],c=0,l=this.iterator();l.hasNext();){var d=l.next();d.getEdgeRing()===a&&c++}return c}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Be.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Be.INTERIOR;break}if(a.isInResult()){n=Be.EXTERIOR;break}}}if(n===Be.NONE)return null;for(var c=n,l=this.iterator();l.hasNext();){var d=l.next(),w=d.getSym();d.isLineEdge()?d.getEdge().setCovered(c===Be.INTERIOR):(d.isInResult()&&(c=Be.EXTERIOR),w.isInResult()&&(c=Be.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new Vn(Be.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getEdge(),l=c.getLabel(),d=0;d<2;d++){var w=l.getLocation(d);(w===Be.INTERIOR||w===Be.BOUNDARY)&&r._label.setLocation(d,Be.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zi),mC=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 j_(n,new OR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Df),iu=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};iu.prototype.compareTo=function(t){var e=t,n=iu.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};iu.prototype.interfaces_=function(){return[ds]};iu.prototype.getClass=function(){return iu};iu.orientation=function(t){return vn.increasingDirection(t)===1};iu.compareOriented=function(t,e,n,r){for(var i=e?1:-1,a=r?1:-1,c=e?t.length:-1,l=r?n.length:-1,d=e?0:t.length-1,w=r?0:n.length-1;;){var S=t[d].compareTo(n[w]);if(S!==0)return S;d+=i,w+=a;var I=d===c,T=w===l;if(I&&!T)return-1;if(!I&&T)return 1;if(I&&T)return 0}};var Rs=function(){this._edges=new yt,this._ocaMap=new Ni};Rs.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),a=0;a0&&t.print(","),t.print(i[a].x+" "+i[a].y);t.println(")")}t.print(") ")};Rs.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};Rs.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),l=0;c[l++]=new Oe(t.coord);for(var d=t.segmentIndex+1;d<=e.segmentIndex;d++)c[l++]=n.edge.pts[d];return a&&(c[l]=e.coord),new d_(c,new Vn(this.edge._label))};Va.prototype.add=function(t,e,n){var r=new ha(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Va.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Va.prototype.interfaces_=function(){return[]};Va.prototype.getClass=function(){return Va};var qu=function(){};qu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new yt;r.add(new oa(n));do{var i=e.findChainEnd(t,n);r.add(new oa(i)),n=i}while(nn?e:n};xl.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ci.prototype.getDelta=function(t){return this._depth[t][ut.RIGHT]-this._depth[t][ut.LEFT]};Ci.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Be.EXTERIOR:Be.INTERIOR};Ci.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ci.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===Be.EXTERIOR||i===Be.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ci.depthAtLocation(i):t._depth[n][r]+=Ci.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],l=arguments[2];l===Be.INTERIOR&&this._depth[a][c]++}};Ci.prototype.interfaces_=function(){return[]};Ci.prototype.getClass=function(){return Ci};Ci.depthAtLocation=function(t){return t===Be.EXTERIOR?0:t===Be.INTERIOR?1:Ci.NULL_VALUE};gC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ci,gC);var d_=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Va(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ci,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,Vn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,c=!0,l=this.pts.length,d=0;d0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new xl(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Ot;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(c)return!1;var l=this.intersectsToleranceSquare(t,e);return ln.isTrue(!(c&&l),"Found bad envelope test"),l};fo.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 Oe(this._maxx,this._maxy),this._corner[1]=new Oe(this._minx,this._maxy),this._corner[2]=new Oe(this._minx,this._miny),this._corner[3]=new Oe(this._maxx,this._miny)};fo.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))};fo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};fo.prototype.getCoordinate=function(){return this._originalPt};fo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};fo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=fo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ot(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};fo.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()))};fo.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||t.equals(this._pt)||e.equals(this._pt))};fo.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return this.intersects(n,r)?(t.addIntersection(this.getCoordinate(),e),!0):!1};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};yC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(fo,yC);var qd=function(){this.tempEnv1=new Ot,this.selectedSegment=new zt};qd.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)}};qd.prototype.interfaces_=function(){return[]};qd.prototype.getClass=function(){return qd};var zf=function(){this._index=null;var t=arguments[0];this._index=t},vC={HotPixelSnapAction:{configurable:!0}};zf.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),a=new bC(e,n,r);return this._index.query(i,{interfaces_:function(){return[nu]},visitItem:function(c){var l=c;l.select(i,a)}}),a.isNodeAdded()}};zf.prototype.interfaces_=function(){return[]};zf.prototype.getClass=function(){return zf};vC.HotPixelSnapAction.get=function(){return bC};Object.defineProperties(zf,vC);var bC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(qd),zc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new yt};zc.prototype.processIntersections=function(t,e,n,r){var i=this;if(t===n&&e===r)return null;var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(a){if(a instanceof vl)t._saveException=a;else throw a}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=Ei.precisionScaleFactor(this._argGeom,this._distance,n),i=new Rn(r);this.bufferFixedPrecision(i)}};Ei.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Rn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Ei.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Ei.prototype.bufferOriginalPrecision=function(){try{var t=new Zi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof _l)this._saveException=e;else throw e}finally{}};Ei.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Ei.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Ei.prototype.interfaces_=function(){return[]};Ei.prototype.getClass=function(){return Ei};Ei.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Ei(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof qt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],l=new Ei(i);l.setQuadrantSegments(c);var d=l.getResultGeometry(a);return d}else if(arguments[2]instanceof Dn&&arguments[0]instanceof qt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],T=new Ei(w,I),k=T.getResultGeometry(S);return k}}else if(arguments.length===4){var D=arguments[0],U=arguments[1],j=arguments[2],$=arguments[3],B=new Ei(D);B.setQuadrantSegments(j),B.setEndCapStyle($);var q=B.getResultGeometry(U);return q}};Ei.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Zo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=e>0?e:0,c=i+2*a,l=Math.trunc(Math.log(c)/Math.log(10)+1),d=n-l,w=Math.pow(10,d);return w};ep.CAP_ROUND.get=function(){return Dn.CAP_ROUND};ep.CAP_BUTT.get=function(){return Dn.CAP_FLAT};ep.CAP_FLAT.get=function(){return Dn.CAP_FLAT};ep.CAP_SQUARE.get=function(){return Dn.CAP_SQUARE};ep.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Ei,ep);var qi=function(){this._pt=[new Oe,new Oe],this._distance=$t.NaN,this._isNull=!0};qi.prototype.getCoordinates=function(){return this._pt};qi.prototype.getCoordinate=function(t){return this._pt[t]};qi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};var Pa=function(){};Pa.prototype.interfaces_=function(){return[]};Pa.prototype.getClass=function(){return Pa};Pa.computeDistance=function(){if(arguments[2]instanceof qi&&arguments[0]instanceof Sr&&arguments[1]instanceof Oe)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new zt,a=0;a0||this._isIn?Be.INTERIOR:Be.EXTERIOR)};Ns.prototype.interfaces_=function(){return[]};Ns.prototype.getClass=function(){return Ns};var Wi=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},xC={INSIDE_AREA:{configurable:!0}};Wi.prototype.isInsideArea=function(){return this._segIndex===Wi.INSIDE_AREA};Wi.prototype.getCoordinate=function(){return this._pt};Wi.prototype.getGeometryComponent=function(){return this._component};Wi.prototype.getSegmentIndex=function(){return this._segIndex};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};xC.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Wi,xC);var Ql=function(t){this._pts=t||null};Ql.prototype.filter=function(t){t instanceof Po&&this._pts.add(t)};Ql.prototype.interfaces_=function(){return[aa]};Ql.prototype.getClass=function(){return Ql};Ql.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Po?Ds.singletonList(t):Ql.getPoints(t,new yt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Po?n.add(e):e instanceof Ki&&e.apply(new Ql(n)),n}};var Bc=function(){this._locations=null;var t=arguments[0];this._locations=t};Bc.prototype.filter=function(t){(t instanceof Po||t instanceof Sr||t instanceof Qr)&&this._locations.add(new Wi(t,0,t.getCoordinate()))};Bc.prototype.interfaces_=function(){return[aa]};Bc.prototype.getClass=function(){return Bc};Bc.getLocations=function(t){var e=new yt;return t.apply(new Bc(e)),e};var Li=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ns,this._minDistanceLocation=null,this._minDistance=$t.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Li.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=ml.getPolygons(this._geom[n]);if(a.size()>0){var c=Bc.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Zt(arguments[0],Ps)&&Zt(arguments[1],Ps)){for(var l=arguments[0],d=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=e.getCoordinates(),a=n.getCoordinate(),c=0;cthis._minDistance)return null;for(var k=S.getCoordinates(),D=I.getCoordinates(),U=0;Uthis._distance&&this.initialize(e,n,r)}};Ri.prototype.interfaces_=function(){return[]};Ri.prototype.getClass=function(){return Ri};var ea=function(){};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};ea.computeDistance=function(){if(arguments[2]instanceof Ri&&arguments[0]instanceof Sr&&arguments[1]instanceof Oe)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new zt,i=t.getCoordinates(),a=0;a1||t<=0)throw new lr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ls.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ls.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ls.prototype.computeOrientedDistance=function(t,e,n){var r=new Vc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new au(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ls.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ls.prototype.interfaces_=function(){return[]};ls.prototype.getClass=function(){return ls};ls.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ls(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ls(r,i);return c.setDensifyFraction(a),c.distance()}};d1.MaxPointDistanceFilter.get=function(){return Vc};d1.MaxDensifiedByFractionDistanceFilter.get=function(){return au};Object.defineProperties(ls,d1);var Vc=function(){this._maxPtDist=new Ri,this._minPtDist=new Ri,this._euclideanDist=new ea,this._geom=null;var t=arguments[0];this._geom=t};Vc.prototype.filter=function(t){this._minPtDist.initialize(),ea.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Vc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Vc.prototype.interfaces_=function(){return[Oa]};Vc.prototype.getClass=function(){return Vc};var au=function(){this._maxPtDist=new Ri,this._minPtDist=new Ri,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};au.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),a=(i.x-r.x)/this._numSubSegs,c=(i.y-r.y)/this._numSubSegs,l=0;ln){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ms.toLineString(i[0],i[1])+")"}};Co.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Co.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(),Co.VERBOSE&&Ti.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Co.prototype.checkNegativeValid=function(){if(!(this._input instanceof Qr||this._input instanceof Da||this._input instanceof Ki))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)};Co.prototype.getErrorIndicator=function(){return this._errorIndicator};Co.prototype.checkMinimumDistance=function(t,e,n){var r=new Li(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Pi.prototype.report=function(t){if(!Pi.VERBOSE)return null;Ti.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Pi.prototype.getErrorMessage=function(){return this._errorMsg};Pi.prototype.interfaces_=function(){return[]};Pi.prototype.getClass=function(){return Pi};Pi.isValidMsg=function(t,e,n){var r=new Pi(t,e,n);return r.isValid()?null:r.getErrorMessage()};Pi.isValid=function(t,e,n){var r=new Pi(t,e,n);return!!r.isValid()};g1.VERBOSE.get=function(){return!1};g1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Pi,g1);var pa=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};pa.prototype.getCoordinates=function(){return this._pts};pa.prototype.size=function(){return this._pts.length};pa.prototype.getCoordinate=function(t){return this._pts[t]};pa.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};pa.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Nc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};pa.prototype.setData=function(t){this._data=t};pa.prototype.getData=function(){return this._data};pa.prototype.toString=function(){return Ms.toLineString(new Pr(this._pts))};pa.prototype.interfaces_=function(){return[Ba]};pa.prototype.getClass=function(){return pa};var bi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new yt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};bi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};bi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};bi.prototype.getIntersectionSegments=function(){return this._intSegments};bi.prototype.count=function(){return this._intersectionCount};bi.prototype.getIntersections=function(){return this._intersections};bi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};bi.prototype.setKeepIntersections=function(t){this._keepIntersections=t};bi.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(t,e)||this.isEndSegment(n,r);if(!i)return null}var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];this._li.computeIntersection(a,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=c,this._intSegments[2]=l,this._intSegments[3]=d,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};bi.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};bi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};bi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};bi.prototype.interfaces_=function(){return[ju]};bi.prototype.getClass=function(){return bi};bi.createAllIntersectionsFinder=function(t){var e=new bi(t);return e.setFindAllIntersections(!0),e};bi.createAnyIntersectionFinder=function(t){return new bi(t)};bi.createIntersectionCounter=function(t){var e=new bi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Os=function(){this._li=new $u,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Os.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Os.prototype.getIntersections=function(){return this._segInt.getIntersections()};Os.prototype.isValid=function(){return this.execute(),this._isValid};Os.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Os.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new bi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new f1;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Os.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new vl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Os.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ms.toLineString(t[0],t[1])+" and "+Ms.toLineString(t[2],t[3])};Os.prototype.interfaces_=function(){return[]};Os.prototype.getClass=function(){return Os};Os.computeIntersections=function(t){var e=new Os(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Hu=function t(){this._nv=null;var e=arguments[0];this._nv=new Os(t.toSegmentStrings(e))};Hu.prototype.checkValid=function(){this._nv.checkValid()};Hu.prototype.interfaces_=function(){return[]};Hu.prototype.getClass=function(){return Hu};Hu.toSegmentStrings=function(t){for(var e=new yt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new pa(r.getCoordinates(),r))}return e};Hu.checkValid=function(t){var e=new Hu(t);e.checkValid()};var Uc=function(t){this._mapOp=t};Uc.prototype.map=function(t){for(var e=this,n=new yt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};po.prototype.interfaces_=function(){return[]};po.prototype.getClass=function(){return po};var Ga=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new zt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Sr&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Ga.prototype.snapVertices=function(t,e){for(var n=this,r=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(c+1,new Oe(a),!1)}};Ga.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=$t.MAX_VALUE,i=-1,a=0;ae&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Mr.computeOverlaySnapTolerance(i),Mr.computeOverlaySnapTolerance(a))}};Mr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Mr.SNAP_PRECISION_FACTOR;return r};Mr.snapToSelf=function(t,e,n){var r=new Mr(t);return r.snapToSelf(e,n)};wC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Mr,wC);var SC=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var i=new Ga(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),a=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(po),ji=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ji.prototype.getCommon=function(){return $t.longBitsToDouble(this._commonBits)};ji.prototype.add=function(t){var e=$t.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=ji.signExpBits(this._commonBits),this._isFirst=!1,null;var n=ji.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=ji.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=ji.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};ji.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=$t.longBitsToDouble(t),n=$t.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return a}};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};ji.getBit=function(t,e){var n=1<>52};ji.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(ji.getBit(t,r)!==ji.getBit(e,r))return n;n++}return 52};var lu=function(){this._commonCoord=null,this._ccFilter=new jc},_1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};lu.prototype.addCommonBits=function(t){var e=new uu(this._commonCoord);t.apply(e),t.geometryChanged()};lu.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new Oe(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new uu(e);return t.apply(n),t.geometryChanged(),t};lu.prototype.getCommonCoordinate=function(){return this._commonCoord};lu.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};lu.prototype.interfaces_=function(){return[]};lu.prototype.getClass=function(){return lu};_1.CommonCoordinateFilter.get=function(){return jc};_1.Translater.get=function(){return uu};Object.defineProperties(lu,_1);var jc=function(){this._commonBitsX=new ji,this._commonBitsY=new ji};jc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};jc.prototype.getCommonCoordinate=function(){return new Oe(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};jc.prototype.interfaces_=function(){return[Oa]};jc.prototype.getClass=function(){return jc};var uu=function(){this.trans=null;var t=arguments[0];this.trans=t};uu.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)};uu.prototype.isDone=function(){return!1};uu.prototype.isGeometryChanged=function(){return!0};uu.prototype.interfaces_=function(){return[As]};uu.prototype.getClass=function(){return uu};var xi=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()};xi.prototype.selfSnap=function(t){var e=new Mr(t),n=e.snapTo(t,this._snapTolerance);return n};xi.prototype.removeCommonBits=function(t){this._cbr=new lu,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};xi.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};xi.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=rn.overlayOp(e[0],e[1],t);return this.prepareResult(n)};xi.prototype.checkValid=function(t){t.isValid()||Ti.out.println("Snapped geometry is invalid")};xi.prototype.computeSnapTolerance=function(){this._snapTolerance=Mr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};xi.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Mr.snap(e[0],e[1],this._snapTolerance);return n};xi.prototype.interfaces_=function(){return[]};xi.prototype.getClass=function(){return xi};xi.overlayOp=function(t,e,n){var r=new xi(t,e);return r.getResultGeometry(n)};xi.union=function(t,e){return xi.overlayOp(t,e,rn.UNION)};xi.intersection=function(t,e){return xi.overlayOp(t,e,rn.INTERSECTION)};xi.symDifference=function(t,e){return xi.overlayOp(t,e,rn.SYMDIFFERENCE)};xi.difference=function(t,e){return xi.overlayOp(t,e,rn.DIFFERENCE)};var $i=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};$i.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=rn.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof _l)r=a;else throw a}finally{}if(!n)try{e=xi.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof _l?r:a}finally{}return e};$i.prototype.interfaces_=function(){return[]};$i.prototype.getClass=function(){return $i};$i.overlayOp=function(t,e,n){var r=new $i(t,e);return r.getResultGeometry(n)};$i.union=function(t,e){return $i.overlayOp(t,e,rn.UNION)};$i.intersection=function(t,e){return $i.overlayOp(t,e,rn.INTERSECTION)};$i.symDifference=function(t,e){return $i.overlayOp(t,e,rn.SYMDIFFERENCE)};$i.difference=function(t,e){return $i.overlayOp(t,e,rn.DIFFERENCE)};var Wd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Wd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};Wd.prototype.interfaces_=function(){return[]};Wd.prototype.getClass=function(){return Wd};var ko=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=a}},y1={INSERT:{configurable:!0},DELETE:{configurable:!0}};ko.prototype.isDelete=function(){return this._eventType===ko.DELETE};ko.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};ko.prototype.getObject=function(){return this._obj};ko.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};ko.prototype.getInsertEvent=function(){return this._insertEvent};ko.prototype.isInsert=function(){return this._eventType===ko.INSERT};ko.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};ko.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};ko.prototype.interfaces_=function(){return[ds]};ko.prototype.getClass=function(){return ko};y1.INSERT.get=function(){return 1};y1.DELETE.get=function(){return 2};Object.defineProperties(ko,y1);var m_=function(){};m_.prototype.interfaces_=function(){return[]};m_.prototype.getClass=function(){return m_};var Mi=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};Mi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Mi.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Mi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Mi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Mi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Mi.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Mi.prototype.hasProperIntersection=function(){return this._hasProper};Mi.prototype.hasIntersection=function(){return this._hasIntersection};Mi.prototype.isDone=function(){return this._isDone};Mi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Mi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Mi.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],a=t.getCoordinates()[e+1],c=n.getCoordinates()[r],l=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,c,l),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Mi.prototype.interfaces_=function(){return[]};Mi.prototype.getClass=function(){return Mi};Mi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var zR=function(t){function e(){t.call(this),this.events=new yt,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;Ds.sort(this.events);for(var r=0;re||this._maxa?1:0};Hd.prototype.interfaces_=function(){return[If]};Hd.prototype.getClass=function(){return Hd};var FR=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ja),BR=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ja),qa=function(){this._leaves=new yt,this._root=null,this._level=0};qa.prototype.buildTree=function(){var t=this;Ds.sort(this._leaves,new ja.NodeComparator);for(var e=this._leaves,n=null,r=new yt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};qa.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new FR(t,e,n))};qa.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};qa.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};qa.prototype.printNode=function(t){Ti.out.println(Ms.toLineString(new Oe(t._min,this._level),new Oe(t._max,this._level)))};qa.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};qa.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,a=n.iterator();a.hasNext();){var c=a.next();r[i++]=c.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===Be.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},e.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var a=vn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,l=i;It.isCCW(a)&&(c=i,l=r);var d=new d_(a,new Vn(this._argIndex,Be.BOUNDARY,c,l));this._lineEdgeMap.put(n,d),this.insertEdge(d),this.insertPoint(this._argIndex,a[0],Be.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),c=a.getLabel();c===null?a._label=new Vn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new zR},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),c=a.getLabel().getLocation(n),l=a.eiList.iterator();l.hasNext();){var d=l.next();r.addSelfIntersectionNode(n,d.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Da&&(this._useBoundaryDeterminationRule=!1),n instanceof Qr)this.addPolygon(n);else if(n instanceof Sr)this.addLineString(n);else if(n instanceof Po)this.addPoint(n);else if(n instanceof kf)this.addCollection(n);else if(n instanceof Vu)this.addCollection(n);else if(n instanceof Da)this.addCollection(n);else if(n instanceof Ki)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Bf(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?Be.BOUNDARY:Be.INTERIOR},e}(gr),Uf=function(){if(this._li=new $u,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 cd(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=hs.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 cd(0,e,r),this._arg[1]=new cd(1,n,r)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new cd(0,i,c),this._arg[1]=new cd(1,a,c)}};Uf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Uf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Uf.prototype.interfaces_=function(){return[]};Uf.prototype.getClass=function(){return Uf};var Fu=function(){};Fu.prototype.interfaces_=function(){return[]};Fu.prototype.getClass=function(){return Fu};Fu.map=function(){if(arguments[0]instanceof qt&&Zt(arguments[1],Fu.MapOp)){for(var t=arguments[0],e=arguments[1],n=new yt,r=0;r=t.size()?null:t.get(e)};Fr.union=function(t){var e=new Fr(t);return e.union()};CC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Fr,CC);var g_=function(){};g_.prototype.interfaces_=function(){return[]};g_.prototype.getClass=function(){return g_};g_.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return rn.createEmptyResult(rn.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),$i.overlayOp(t,e,rn.UNION)};function ec(){return new __}function __(){this.reset()}__.prototype={constructor:__,reset:function(){this.s=this.t=0},add:function(t){g2(bg,t,this.t),g2(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new __;function g2(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var wr=1e-6,Hn=Math.PI,dl=Hn/2,_2=Hn/4,wl=Hn*2,ku=180/Hn,Ks=Hn/180,Hi=Math.abs,VR=Math.atan,jf=Math.atan2,Wr=Math.cos,Hr=Math.sin,tp=Math.sqrt;function TC(t){return t>1?0:t<-1?Hn:Math.acos(t)}function qc(t){return t>1?dl:t<-1?-dl:Math.asin(t)}function vd(){}function y_(t,e){t&&v2.hasOwnProperty(t.type)&&v2[t.type](t,e)}var y2={Feature:function(t,e){y_(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rHn?t-wl:t<-Hn?t+wl:t,e]}vv.invert=vv;function GR(t,e,n){return(t%=wl)?e||n?LC(w2(t),S2(e,n)):w2(t):e||n?S2(e,n):vv}function x2(t){return function(e,n){return e+=t,[e>Hn?e-wl:e<-Hn?e+wl:e,n]}}function w2(t){var e=x2(t);return e.invert=x2(-t),e}function S2(t,e){var n=Wr(t),r=Hr(t),i=Wr(e),a=Hr(e);function c(l,d){var w=Wr(d),S=Wr(l)*w,I=Hr(l)*w,T=Hr(d),k=T*n+S*r;return[jf(I*i-k*a,S*n-T*r),qc(k*i+I*a)]}return c.invert=function(l,d){var w=Wr(d),S=Wr(l)*w,I=Hr(l)*w,T=Hr(d),k=T*i-I*a;return[jf(I*i+T*a,S*n+k*r),qc(k*n-S*r)]},c}function jR(t,e,n,r,i,a){if(n){var c=Wr(e),l=Hr(e),d=r*n;i==null?(i=e+r*wl,a=e-d/2):(i=E2(c,i),a=E2(c,a),(r>0?ia)&&(i+=r*wl));for(var w,S=i;r>0?S>a:S1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function qR(t,e,n,r,i,a){var c=t[0],l=t[1],d=e[0],w=e[1],S=0,I=1,T=d-c,k=w-l,D;if(D=n-c,!(!T&&D>0)){if(D/=T,T<0){if(D0){if(D>I)return;D>S&&(S=D)}if(D=i-c,!(!T&&D<0)){if(D/=T,T<0){if(D>I)return;D>S&&(S=D)}else if(T>0){if(D0)){if(D/=k,k<0){if(D0){if(D>I)return;D>S&&(S=D)}if(D=a-l,!(!k&&D<0)){if(D/=k,k<0){if(D>I)return;D>S&&(S=D)}else if(k>0){if(D0&&(t[0]=c+S*T,t[1]=l+S*k),I<1&&(e[0]=c+I*T,e[1]=l+I*k),!0}}}}}function Fg(t,e){return Hi(t[0]-e[0])=0;--l)i.point((I=S[l])[0],I[1]);else r(T.x,T.p.x,-1,i);T=T.p}T=T.o,S=T.z,k=!k}while(!T.v);i.lineEnd()}}}function I2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function WR(t){return t.length===1&&(t=HR(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function HR(t){return function(e,n){return AC(t(e),n)}}WR(AC);function kC(t){for(var e=t.length,n,r=-1,i=0,a,c;++r=0;)for(c=t[e],n=c.length;--n>=0;)a[--i]=c[n];return a}var bd=1e9,Eg=-bd;function ZR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,I,T){var k=0,D=0;if(w==null||(k=c(w,I))!==(D=c(S,I))||d(w,S)<0^I>0)do T.point(k===0||k===3?t:n,k>1?r:e);while((k=(k+I+4)%4)!==D);else T.point(S[0],S[1])}function c(w,S){return Hi(w[0]-t)0?0:3:Hi(w[0]-n)0?2:1:Hi(w[1]-e)0?1:0:S>0?3:2}function l(w,S){return d(w.x,S.x)}function d(w,S){var I=c(w,1),T=c(S,1);return I!==T?I-T:I===0?S[1]-w[1]:I===1?w[0]-S[0]:I===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,I=PC(),T,k,D,U,j,$,B,q,J,ce,fe,de={point:ie,lineStart:le,lineEnd:Ye,polygonStart:Le,polygonEnd:X};function ie(Ge,Xe){i(Ge,Xe)&&S.point(Ge,Xe)}function ee(){for(var Ge=0,Xe=0,Ne=k.length;Xer&&(Fn-Dt)*(r-un)>(bn-un)*(t-Dt)&&++Ge:bn<=r&&(Fn-Dt)*(r-un)<(bn-un)*(t-Dt)&&--Ge;return Ge}function Le(){S=I,T=[],k=[],fe=!0}function X(){var Ge=ee(),Xe=fe&&Ge,Ne=(T=kC(T)).length;(Xe||Ne)&&(w.polygonStart(),Xe&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),Ne&&MC(T,l,Ge,a,w),w.polygonEnd()),S=w,T=k=D=null}function le(){de.point=xe,k&&k.push(D=[]),ce=!0,J=!1,B=q=NaN}function Ye(){T&&(xe(U,j),$&&J&&I.rejoin(),T.push(I.result())),de.point=ie,J&&S.lineEnd()}function xe(Ge,Xe){var Ne=i(Ge,Xe);if(k&&D.push([Ge,Xe]),ce)U=Ge,j=Xe,$=Ne,ce=!1,Ne&&(S.lineStart(),S.point(Ge,Xe));else if(Ne&&J)S.point(Ge,Xe);else{var $e=[B=Math.max(Eg,Math.min(bd,B)),q=Math.max(Eg,Math.min(bd,q))],ht=[Ge=Math.max(Eg,Math.min(bd,Ge)),Xe=Math.max(Eg,Math.min(bd,Xe))];qR($e,ht,t,e,n,r)?(J||(S.lineStart(),S.point($e[0],$e[1])),S.point(ht[0],ht[1]),Ne||S.lineEnd(),fe=!1):Ne&&(S.lineStart(),S.point(Ge,Xe),fe=!1)}B=Ge,q=Xe,J=Ne}return de}}var P0=ec();function XR(t,e){var n=e[0],r=e[1],i=[Hr(n),-Wr(n),0],a=0,c=0;P0.reset();for(var l=0,d=t.length;l=0?1:-1,ie=de*fe,ee=ie>Hn,Le=D*J;if(P0.add(jf(Le*de*Hr(ie),U*ce+Le*Wr(ie))),a+=ee?fe+de*wl:fe,ee^T>=n^B>=n){var X=v_(qf(I),qf($));yv(X);var le=v_(i,X);yv(le);var Ye=(ee^fe>=0?-1:1)*qc(le[2]);(r>Ye||r===Ye&&(X[0]||X[1]))&&(c+=ee^fe>=0?1:-1)}}return(a<-wr||aZd&&(Zd=t),ex_&&(x_=e)}ec();function DC(t,e,n,r){return function(i,a){var c=e(a),l=i.invert(r[0],r[1]),d=PC(),w=e(d),S=!1,I,T,k,D={point:U,lineStart:$,lineEnd:B,polygonStart:function(){D.point=q,D.lineStart=J,D.lineEnd=ce,T=[],I=[]},polygonEnd:function(){D.point=U,D.lineStart=$,D.lineEnd=B,T=kC(T);var fe=XR(I,l);T.length?(S||(a.polygonStart(),S=!0),MC(T,JR,fe,n,a)):fe&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),T=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function U(fe,de){var ie=i(fe,de);t(fe=ie[0],de=ie[1])&&a.point(fe,de)}function j(fe,de){var ie=i(fe,de);c.point(ie[0],ie[1])}function $(){D.point=j,c.lineStart()}function B(){D.point=U,c.lineEnd()}function q(fe,de){k.push([fe,de]);var ie=i(fe,de);w.point(ie[0],ie[1])}function J(){w.lineStart(),k=[]}function ce(){q(k[0][0],k[0][1]),w.lineEnd();var fe=w.clean(),de=d.result(),ie,ee=de.length,Le,X,le;if(k.pop(),I.push(k),k=null,!!ee){if(fe&1){if(X=de[0],(Le=X.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),ie=0;ie1&&fe&2&&de.push(de.pop().concat(de.shift())),T.push(de.filter(KR))}}return D}}function KR(t){return t.length>1}function JR(t,e){return((t=t.x)[0]<0?t[1]-dl-wr:dl-t[1])-((e=e.x)[0]<0?e[1]-dl-wr:dl-e[1])}const L2=DC(function(){return!0},QR,eN,[-Hn,-dl]);function QR(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,c){var l=a>0?Hn:-Hn,d=Hi(a-e);Hi(d-Hn)0?dl:-dl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(a,n),i=0):r!==l&&d>=Hn&&(Hi(e-r)wr?VR((Hr(e)*(a=Wr(r))*Hr(n)-Hr(r)*(i=Wr(e))*Hr(t))/(i*a*c)):(e+r)/2}function eN(t,e,n,r){var i;if(t==null)i=n*dl,r.point(-Hn,i),r.point(0,i),r.point(Hn,i),r.point(Hn,0),r.point(Hn,-i),r.point(0,-i),r.point(-Hn,-i),r.point(-Hn,0),r.point(-Hn,i);else if(Hi(t[0]-e[0])>wr){var a=t[0]0,i=Hi(n)>wr;function a(S,I,T,k){jR(k,t,e,T,S,I)}function c(S,I){return Wr(S)*Wr(I)>n}function l(S){var I,T,k,D,U;return{lineStart:function(){D=k=!1,U=1},point:function(j,$){var B=[j,$],q,J=c(j,$),ce=r?J?0:w(j,$):J?w(j+(j<0?Hn:-Hn),$):0;if(!I&&(D=k=J)&&S.lineStart(),J!==k&&(q=d(I,B),(!q||Fg(I,q)||Fg(B,q))&&(B[0]+=wr,B[1]+=wr,J=c(B[0],B[1]))),J!==k)U=0,J?(S.lineStart(),q=d(B,I),S.point(q[0],q[1])):(q=d(I,B),S.point(q[0],q[1]),S.lineEnd()),I=q;else if(i&&I&&r^J){var fe;!(ce&T)&&(fe=d(B,I,!0))&&(U=0,r?(S.lineStart(),S.point(fe[0][0],fe[0][1]),S.point(fe[1][0],fe[1][1]),S.lineEnd()):(S.point(fe[1][0],fe[1][1]),S.lineEnd(),S.lineStart(),S.point(fe[0][0],fe[0][1])))}J&&(!I||!Fg(I,B))&&S.point(B[0],B[1]),I=B,k=J,T=ce},lineEnd:function(){k&&S.lineEnd(),I=null},clean:function(){return U|(D&&k)<<1}}}function d(S,I,T){var k=qf(S),D=qf(I),U=[1,0,0],j=v_(k,D),$=xg(j,j),B=j[0],q=$-B*B;if(!q)return!T&&S;var J=n*$/q,ce=-n*B/q,fe=v_(U,j),de=wg(U,J),ie=wg(j,ce);L0(de,ie);var ee=fe,Le=xg(de,ee),X=xg(ee,ee),le=Le*Le-X*(xg(de,de)-1);if(!(le<0)){var Ye=tp(le),xe=wg(ee,(-Le-Ye)/X);if(L0(xe,de),xe=_v(xe),!T)return xe;var Ge=S[0],Xe=I[0],Ne=S[1],$e=I[1],ht;Xe0^xe[1]<(Hi(xe[0]-Ge)Hn^(Ge<=xe[0]&&xe[0]<=Xe)){var un=wg(ee,(-Le+Ye)/X);return L0(un,de),[xe,_v(un)]}}}function w(S,I){var T=r?t:Hn-t,k=0;return S<-T?k|=1:S>T&&(k|=2),I<-T?k|=4:I>T&&(k|=8),k}return DC(c,l,a,r?[0,-t]:[-Hn,t-Hn])}function RC(t){return function(e){var n=new bv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function bv(){}bv.prototype={constructor:bv,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 NC(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),a!=null&&t.clipExtent(null),UR(n,t.stream(T2));var c=T2.result(),l=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),d=+e[0][0]+(r-l*(c[1][0]+c[0][0]))/2,w=+e[0][1]+(i-l*(c[1][1]+c[0][1]))/2;return a!=null&&t.clipExtent(a),t.scale(l*150).translate([d,w])}function nN(t,e,n){return NC(t,[[0,0],e],n)}var P2=16,rN=Wr(30*Ks);function M2(t,e){return+e?oN(t,e):iN(t)}function iN(t){return RC({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function oN(t,e){function n(r,i,a,c,l,d,w,S,I,T,k,D,U,j){var $=w-r,B=S-i,q=$*$+B*B;if(q>4*e&&U--){var J=c+T,ce=l+k,fe=d+D,de=tp(J*J+ce*ce+fe*fe),ie=qc(fe/=de),ee=Hi(Hi(fe)-1)e||Hi(($*Ye+B*xe)/q-.5)>.3||c*T+l*k+d*D2?xe[2]%360*Ks:0,le()):[w*ku,S*ku,I*ku]},ee.precision=function(xe){return arguments.length?(fe=M2(X,ce=xe*xe),Ye()):tp(ce)},ee.fitExtent=function(xe,Ge){return NC(ee,xe,Ge)},ee.fitSize=function(xe,Ge){return nN(ee,xe,Ge)};function le(){k=LC(T=GR(w,S,I),e);var xe=e(l,d);return a=r-xe[0]*n,c=i+xe[1]*n,Ye()}function Ye(){return de=ie=null,ee}return function(){return e=t.apply(this,arguments),ee.invert=e.invert&&Le,le()}}function OC(t){return function(e,n){var r=Wr(e),i=Wr(n),a=t(r*i);return[a*i*Hr(e),a*Hr(n)]}}function zC(t){return function(e,n){var r=tp(e*e+n*n),i=t(r),a=Hr(i),c=Wr(i);return[jf(e*a,r*c),qc(r&&n*a/r)]}}var uN=OC(function(t){return tp(2/(1+t))});uN.invert=zC(function(t){return 2*qc(t/2)});var FC=OC(function(t){return(t=TC(t))&&t/Hr(t)});FC.invert=zC(function(t){return t});function cN(){return aN(FC).scale(79.4188).clipAngle(180-.001)}function A2(t,e){return[t,e]}A2.invert=A2;function hN(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var a=[];switch(t.type){case"GeometryCollection":return $I(t,function(c){var l=Bg(c,e,r,i);l&&a.push(l)}),pv(a);case"FeatureCollection":return h2(t,function(c){var l=Bg(c,e,r,i);l&&h2(l,function(d){d&&a.push(d)})}),pv(a)}return Bg(t,e,r,i)}function Bg(t,e,n,r){var i=t.properties||{},a=t.type==="Feature"?t.geometry:t;if(a.type==="GeometryCollection"){var c=[];return $I(t,function(U){var j=Bg(U,e,n,r);j&&c.push(j)}),pv(c)}var l=fN(a),d={type:a.type,coordinates:VC(a.coordinates,l)},w=new h1,S=w.read(d),I=vR(bR(e,n),"meters"),T=Ei.bufferOp(S,I,r),k=new uC;if(T=k.write(T),!BC(T.coordinates)){var D={type:T.type,coordinates:UC(T.coordinates,l)};return k_(D,i)}}function BC(t){return Array.isArray(t[0])?BC(t[0]):isNaN(t[0])}function VC(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return VC(n,e)})}function UC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return UC(n,e)})}function fN(t){var e=wR(t).geometry.coordinates,n=[-e[0],-e[1]];return cN().rotate(n).scale(jo)}function pN(t,e){var n=h_(t),r=h_(e),i=t.properties||{},a=XI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?KI(a[0],i):JI(a,i)}function k2(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 D2(t,e){const n=pN({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=hN(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)k2(i);else for(const i of r.geometry.coordinates)for(const a of i)k2(a);e({type:"FeatureCollection",features:[r,n]})}let R2={type:"FeatureCollection",features:[]};function dN(t,e,n=!0,r=!0,i={},a={},c={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let l,d=[],w,S;function I(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:R2}),c!=null&&c.fill&&t.addLayer({...c==null?void 0:c.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),c!=null&&c.line&&t.addLayer({...c==null?void 0:c.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?I():t.once("load",()=>{I()});const T=D=>{l==null||l({type:"mapClick",coordinates:[D.lngLat.lng,D.lngLat.lat]})};function k(D=!1){if(!e)throw new Error;const U=document.createElement("div");return D&&U.classList.add("marker-interactive"),new jD({props:{displayIn:"maplibre"},target:U}),new e.Marker({element:U,offset:[1,-13]})}return{setEventHandler(D){D?(l=D,t.on("click",T)):(l=void 0,t.off("click",T))},flyTo(D,U){t.flyTo({center:D,zoom:U,...i})},fitBounds(D,U,j){t.fitBounds([[D[0],D[1]],[D[2],D[3]]],{padding:U,maxZoom:j,...a})},indicateReverse(D){t.getCanvasContainer().style.cursor=D?"crosshair":""},setReverseMarker(D){!e||!n||(S?D?S.setLngLat(D):(S.remove(),S=void 0):D&&(S=(typeof n=="object"?new e.Marker(n):k()).setLngLat(D).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(D,U){if(!n)return;function j($){var B;(B=t.getSource("full-geom"))==null||B.setData($)}for(const $ of d)$.remove();if(d.length=0,j(R2),!!e){if(U){let $=!1;if(U.geometry.type==="GeometryCollection"){const B=U.geometry.geometries.filter(q=>q.type==="Polygon"||q.type==="MultiPolygon");if(B.length>0){let q=B.pop();for(const J of B)q=xR(q,J);D2({...U,geometry:q},j),$=!0}else{const q=U.geometry.geometries.filter(J=>J.type==="LineString"||J.type==="MultiLineString");q.length>0&&(j({...U,geometry:{type:"GeometryCollection",geometries:q}}),$=!0)}}if(!$){if(U.geometry.type==="Polygon"||U.geometry.type==="MultiPolygon")D2(U,j);else if(U.geometry.type==="LineString"||U.geometry.type==="MultiLineString"){j(U);return}}n&&d.push((typeof n=="object"?new e.Marker(n):k()).setLngLat(U.center).addTo(t))}if(r)for(const $ of D??[]){if($===U)continue;const B=(typeof r=="object"?new e.Marker(r):k(!0)).setLngLat($.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText($.place_type[0]==="reverse"?$.place_name:$.place_name.replace(/,.*/,""))).addTo(t),q=B.getElement();q.addEventListener("click",J=>{J.stopPropagation(),l==null||l({type:"markerClick",id:$.id})}),q.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:$.id}),B.togglePopup()}),q.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:$.id}),B.togglePopup()}),d.push(B)}}},setSelectedMarker(D){w&&w.getElement().classList.toggle("marker-selected",!1),w=D>-1?d[D]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const D=t.getCenter();return[t.getZoom(),D.lng,D.lat]}}}function mN(t){let e,n;return{c(){e=Jl("svg"),n=Jl("path"),Fe(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"),Fe(e,"viewBox","0 0 14 14"),Fe(e,"width","13"),Fe(e,"height","13"),Fe(e,"class","svelte-en2qvf")},m(r,i){Ae(r,e,i),be(e,n)},p:tt,i:tt,o:tt,d(r){r&&Pe(e)}}}class GC extends Jt{constructor(e){super(),Kt(this,e,null,mN,Wt,{})}}function gN(t){let e,n;return{c(){e=Jl("svg"),n=Jl("path"),Fe(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"),Fe(e,"viewBox","0 0 30 30"),Fe(e,"fill","none"),Fe(e,"xmlns","http://www.w3.org/2000/svg"),Fe(e,"class","svelte-d2loi5")},m(r,i){Ae(r,e,i),be(e,n)},p:tt,i:tt,o:tt,d(r){r&&Pe(e)}}}class jC extends Jt{constructor(e){super(),Kt(this,e,null,gN,Wt,{})}}function _N(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"area.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"area.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function yN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"reverse.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"reverse.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function vN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"poi.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"poi.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function bN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"postal_code.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"postal_code.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function xN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"street.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"street.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function wN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"road.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"road.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function SN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"housenumber.svg")||Fe(e,"src",n),Fe(e,"alt",t[6]),Fe(e,"class","svelte-ltkwvy")},m(r,i){Ae(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"housenumber.svg")&&Fe(e,"src",n),i&64&&Fe(e,"alt",r[6])},d(r){r&&Pe(e)}}}function EN(t){let e,n,r,i;return{c(){e=ke("img"),To(e.src,n=t[5])||Fe(e,"src",n),Fe(e,"alt",t[4]),Fe(e,"class","svelte-ltkwvy")},m(a,c){Ae(a,e,c),r||(i=Ut(e,"error",t[14]),r=!0)},p(a,c){c&32&&!To(e.src,n=a[5])&&Fe(e,"src",n),c&16&&Fe(e,"alt",a[4])},d(a){a&&Pe(e),r=!1,i()}}}function N2(t){let e,n;return{c(){e=ke("span"),n=xt(t[6]),Fe(e,"class","secondary svelte-ltkwvy")},m(r,i){Ae(r,e,i),be(e,n)},p(r,i){i&64&&An(n,r[6])},d(r){r&&Pe(e)}}}function IN(t){var de,ie;let e,n,r,i,a,c,l,d,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,I,T=t[2]==="always"||t[2]&&!t[0].address&&((de=t[0].properties)==null?void 0:de.kind)!=="road"&&((ie=t[0].properties)==null?void 0:ie.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],k,D,U=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",j,$,B;function q(ee,Le){var X,le;return Le&1&&(n=null),Le&1&&(r=null),Le&1&&(i=null),ee[5]?EN:ee[0].address?SN:((X=ee[0].properties)==null?void 0:X.kind)==="road"||((le=ee[0].properties)==null?void 0:le.kind)==="road_relation"?wN:(n==null&&(n=!!ee[0].id.startsWith("address.")),n?xN:(r==null&&(r=!!ee[0].id.startsWith("postal_code.")),r?bN:(i==null&&(i=!!ee[0].id.startsWith("poi.")),i?vN:ee[7]?yN:_N)))}let J=q(t,-1),ce=J(t),fe=T&&N2(t);return{c(){e=ke("li"),ce.c(),a=rt(),c=ke("span"),l=ke("span"),d=ke("span"),S=xt(w),I=rt(),fe&&fe.c(),k=rt(),D=ke("span"),j=xt(U),Fe(d,"class","primary svelte-ltkwvy"),Fe(l,"class","svelte-ltkwvy"),Fe(D,"class","line2 svelte-ltkwvy"),Fe(c,"class","texts svelte-ltkwvy"),Fe(e,"tabindex","0"),Fe(e,"data-selected",t[1]),Fe(e,"class","svelte-ltkwvy"),fl(e,"selected",t[1])},m(ee,Le){Ae(ee,e,Le),ce.m(e,null),be(e,a),be(e,c),be(c,l),be(l,d),be(d,S),be(l,I),fe&&fe.m(l,null),be(c,k),be(c,D),be(D,j),$||(B=[Ut(e,"mouseenter",t[12]),Ut(e,"focus",t[13])],$=!0)},p(ee,[Le]){var X,le;J===(J=q(ee,Le))&&ce?ce.p(ee,Le):(ce.d(1),ce=J(ee),ce&&(ce.c(),ce.m(e,a))),Le&1&&w!==(w=(ee[7]?ee[0].place_name:ee[0].place_name.replace(/,.*/,""))+"")&&An(S,w),Le&37&&(T=ee[2]==="always"||ee[2]&&!ee[0].address&&((X=ee[0].properties)==null?void 0:X.kind)!=="road"&&((le=ee[0].properties)==null?void 0:le.kind)!=="road_relation"&&!ee[0].id.startsWith("address.")&&!ee[0].id.startsWith("postal_code.")&&(!ee[0].id.startsWith("poi.")||!ee[5])&&!ee[7]),T?fe?fe.p(ee,Le):(fe=N2(ee),fe.c(),fe.m(l,null)):fe&&(fe.d(1),fe=null),Le&1&&U!==(U=(ee[7]?"":ee[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&An(j,U),Le&2&&Fe(e,"data-selected",ee[1]),Le&2&&fl(e,"selected",ee[1])},i:tt,o:tt,d(ee){ee&&Pe(e),ce.d(),fe&&fe.d(),$=!1,Ai(B)}}}function CN(t,e,n){var q;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:d}=e,{iconsBaseUrl:w}=e;const S=(q=a.properties)==null?void 0:q.categories;let I,T,k=0,D=a.place_type[0]==="reverse";function U(J){T&&d.add(T),n(10,k++,k)}function j(J){dn.call(this,t,J)}function $(J){dn.call(this,t,J)}const B=J=>U(J.currentTarget);return t.$$set=J=>{"feature"in J&&n(0,a=J.feature),"selected"in J&&n(1,c=J.selected),"showPlaceType"in J&&n(2,l=J.showPlaceType),"missingIconsCache"in J&&n(9,d=J.missingIconsCache),"iconsBaseUrl"in J&&n(3,w=J.iconsBaseUrl)},t.$$.update=()=>{var J,ce,fe,de;if(t.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,T=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!T||d.has(T)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(ce=(J=a.properties)==null?void 0:J.categories)==null?void 0:ce.join(", "):((de=(fe=a.properties)==null?void 0:fe.place_type_name)==null?void 0:de[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,c,l,w,I,T,i,D,U,d,k,r,j,$,B]}class TN extends Jt{constructor(e){super(),Kt(this,e,CN,IN,Wt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function LN(t){let e;return{c(){e=ke("div"),e.innerHTML='',Fe(e,"class","svelte-7cmwmc")},m(n,r){Ae(n,e,r)},p:tt,i:tt,o:tt,d(n){n&&Pe(e)}}}class PN extends Jt{constructor(e){super(),Kt(this,e,null,LN,Wt,{})}}function MN(t){let e,n;return{c(){e=Jl("svg"),n=Jl("path"),Fe(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"),Fe(e,"viewBox","0 0 60.006 21.412"),Fe(e,"width","14"),Fe(e,"height","20"),Fe(e,"class","svelte-en2qvf")},m(r,i){Ae(r,e,i),be(e,n)},p:tt,i:tt,o:tt,d(r){r&&Pe(e)}}}class AN extends Jt{constructor(e){super(),Kt(this,e,null,MN,Wt,{})}}function kN(t){let e,n,r;return{c(){e=Jl("svg"),n=Jl("circle"),r=Jl("path"),Fe(n,"cx","4.789"),Fe(n,"cy","4.787"),Fe(n,"r","3.85"),Ii(n,"stroke-width","1.875"),Ii(n,"fill","none"),Fe(r,"d","M12.063 12.063 7.635 7.635"),Ii(r,"stroke-width","1.875"),Ii(r,"stroke-linecap","round"),Fe(e,"xmlns","http://www.w3.org/2000/svg"),Fe(e,"width","13"),Fe(e,"height","13"),Fe(e,"viewBox","0 0 13 13"),Fe(e,"class","svelte-1bpbt60")},m(i,a){Ae(i,e,a),be(e,n),be(e,r)},p:tt,i:tt,o:tt,d(i){i&&Pe(e)}}}class DN extends Jt{constructor(e){super(),Kt(this,e,null,kN,Wt,{})}}function RN(t,e,n){const r=e[1],i=e[0],a=r-i;return t===r&&n?t:((t-i)%a+a)%a+i}function O2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!hd.coords)break e;return hd.coords}let a;try{return a=await new Promise((c,l)=>{n.signal.addEventListener("abort",()=>{l(Error("aborted"))}),navigator.geolocation.getCurrentPosition(d=>{c([d.coords.longitude,d.coords.latitude].map(w=>w.toFixed(6)).join(","))},d=>{l(d)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(hd={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const z2=/(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,F2=/(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,B2=/(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,V2=/(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 ON(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(c=>Number(c.trim()));let n=U2(e[0],t),r=U2(e[1],t);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=e[0]>=0?" N":" S",a=e[1]>=0?" E":" W";return`${n+i}, ${r+a}`}else throw new Error("no decimal coordinates to convert")}function U2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=zN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${l}'`}let a=Math.floor(i),c=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${c}"`}function zN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function b1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],l=!1;if(z2.test(t))if(c=z2.exec(t),l=Ig(c),l){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(i=c[1],a=c[5]):c[4]&&(i=c[4],a=c[8])}else throw new Error("invalid decimal coordinate format");else if(F2.test(t))if(c=F2.exec(t),l=Ig(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6].replace(",",".")/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(i=c[1],a=c[8]):c[7]&&(i=c[7],a=c[14]);else throw new Error("invalid DMS coordinates format");else if(B2.test(t))if(c=B2.exec(t),l=Ig(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid DMS coordinates format");else if(V2.test(t))if(c=V2.exec(t),l=Ig(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid coordinates format");if(l){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let d=/S|SOUTH/i;d.test(i)&&n>0&&(n=-1*n),d=/W|WEST/i,d.test(a)&&r>0&&(r=-1*r);const w=c[0].trim();let S,I;const T=/[,/;\u0020]/g,k=w.match(T);if(k==null){const j=Math.floor(t.length/2);S=w.substring(0,j).trim(),I=w.substring(j).trim()}else{let j;k.length%2==1?j=Math.floor(k.length/2):j=k.length/2-1;let $=0;if(j==0)$=w.indexOf(k[0]),S=w.substring(0,$).trim(),I=w.substring($+1).trim();else{let B=0,q=0;for(;B<=j;)$=w.indexOf(k[B],q),q=$+1,B++;S=w.substring(0,$).trim(),I=w.substring($+1).trim()}}const D=S.split(".");if(D.length==2&&D[1]==0&&D[1].length!=2)throw new Error("invalid coordinates format");const U=I.split(".");if(U.length==2&&U[1]==0&&U[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(I))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(e)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:I,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:FN,toCoordinateFormat:ON})}else throw new Error("coordinates pattern match failed")}function Ig(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=e.length/2;for(let a=0;a{e.decimalLatitude?t.push(e):t.push({...e,...UN})}),[...t,...GN,...jN]}const WN=qN();b1.formats=WN.map(t=>t.verbatimCoordinates);const HN=b1;function j2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function q2(t){let e,n;return e=new PN({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function W2(t){let e,n,r,i,a;return n=new AN({}),{c(){e=ke("button"),st(n.$$.fragment),Fe(e,"type","button"),Fe(e,"title",t[9]),Fe(e,"class","svelte-zh3kmv"),fl(e,"active",t[0])},m(c,l){Ae(c,e,l),it(n,e,null),r=!0,i||(a=Ut(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Fe(e,"title",c[9]),(!r||l[0]&1)&&fl(e,"active",c[0])},i(c){r||(_e(n.$$.fragment,c),r=!0)},o(c){Se(n.$$.fragment,c),r=!1},d(c){c&&Pe(e),ot(n),i=!1,a()}}}function ZN(t){let e,n=[],r=new Map,i,a,c,l=zr(t[14]);const d=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{de=null}),Pn()),(!q||Ge[0]&2)&&fl(w,"displayable",xe[1]!==""),xe[5]===!0?ie?(ie.p(xe,Ge),Ge[0]&32&&_e(ie,1)):(ie=W2(xe),ie.c(),_e(ie,1),ie.m(r,D)):ie&&(Ln(),Se(ie,1,1,()=>{ie=null}),Pn()),Le&&Le.p&&(!q||Ge[1]&134217728)&&Kr(Le,ee,xe,xe[58],q?Yr(ee,xe[58],Ge,null):Jr(xe[58]),null);let Xe=j;j=Ye(xe),j===Xe?~j&&le[j].p(xe,Ge):($&&(Ln(),Se(le[Xe],1,1,()=>{le[Xe]=null}),Pn()),~j?($=le[j],$?$.p(xe,Ge):($=le[j]=X[j](xe),$.c()),_e($,1),$.m(n,null)):$=null),(!q||Ge[0]&4&&B!==(B=Vg(xe[2])+" svelte-zh3kmv"))&&Fe(n,"class",B),(!q||Ge[0]&22)&&fl(n,"can-collapse",xe[4]&&xe[1]==="")},i(xe){q||(_e(fe),_e(a.$$.fragment,xe),_e(I.$$.fragment,xe),_e(de),_e(ie),_e(Le,xe),_e($),q=!0)},o(xe){Se(fe),Se(a.$$.fragment,xe),Se(I.$$.fragment,xe),Se(de),Se(ie),Se(Le,xe),Se($),q=!1},d(xe){xe&&(Pe(e),Pe(n)),ot(a),t[61](null),ot(I),de&&de.d(),ie&&ie.d(),Le&&Le.d(xe),~j&&le[j].d(),J=!1,Ai(ce)}}}function QN(t,e,n){let r,{$$slots:i={},$$scope:a}=e,{class:c=void 0}=e,{apiKey:l}=e,{bbox:d=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:I=!1}=e,{country:T=void 0}=e,{debounceSearch:k=200}=e,{enableReverse:D=!1}=e,{errorMessage:U="Something went wrong…"}=e,{filter:j=()=>!0}=e,{flyTo:$=!0}=e,{fuzzyMatch:B=!0}=e,{language:q=void 0}=e,{limit:J=void 0}=e,{mapController:ce=void 0}=e,{minLength:fe=2}=e,{noResultsMessage:de="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:ie="Search"}=e,{proximity:ee=[{type:"server-geolocation"}]}=e,{reverseActive:Le=D==="always"}=e,{reverseButtonTitle:X="toggle reverse geocoding"}=e,{searchValue:le=""}=e,{showFullGeometry:Ye=!0}=e,{showPlaceType:xe="ifNeeded"}=e,{showResultsWhileTyping:Ge=!0}=e,{selectFirst:Xe=!0}=e,{flyToSelected:Ne=!1}=e,{markerOnSelected:$e=!0}=e,{types:ht=void 0}=e,{excludeTypes:Gt=!1}=e,{zoom:Ht=16}=e,{maxZoom:Dt=18}=e,{apiUrl:un="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Fn={}}=e,{iconsBaseUrl:bn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:mn=Q=>{}}=e;function Bn(){ze.focus()}function ir(){ze.blur()}function $r(Q,Ie=!0){n(1,le=Q),Ie?(n(15,en=-1),Tl()):(ei(),setTimeout(()=>{ze.focus(),ze.select()}))}function _r(){n(14,re=void 0),n(55,vt=void 0),n(15,en=-1)}function cr(){n(54,Ce=[]),n(55,vt=void 0)}let or=!1,re,Ce,vt,xn="",ze,en=-1,Dr,fn=[],tr,Do,gs,Bs;const Za=new Set,ki=Ku();us(()=>{ce&&(ce.setEventHandler(void 0),ce.indicateReverse(!1),ce.setSelectedMarker(-1),ce.setMarkers(void 0,void 0))});function Tl(Q){if(Do&&(clearTimeout(Do),Do=void 0),en>-1&&re)n(55,vt=re[en]),n(1,le=vt.place_type[0]==="reverse"?vt.place_name:vt.place_name.replace(/,.*/,"")),n(18,Dr=void 0),n(54,Ce=void 0),n(15,en=-1);else if(le){const Ie=Q||!_s(le);lt(le,{exact:!0}).then(()=>{n(54,Ce=re),n(55,vt=void 0),Ie&&Qo()}).catch(ye=>n(18,Dr=ye))}}function _s(Q){try{return HN(Q,6)}catch{return!1}}async function lt(Q,{byId:Ie=!1,exact:ye=!1}={}){n(18,Dr=void 0),tr==null||tr.abort();const De=new AbortController;n(19,tr=De);try{const je=_s(Q),He=new URLSearchParams;if(q!==void 0&&He.set("language",Array.isArray(q)?q.join(","):q??""),ht&&He.set("types",ht.join(",")),Gt&&He.set("excludeTypes",String(Gt)),d&&He.set("bbox",d.map(Yt=>Yt.toFixed(6)).join(",")),T&&He.set("country",Array.isArray(T)?T.join(","):T),!Ie&&!je){const Yt=await NN(ce,ee,De);Yt&&He.set("proximity",Yt),(ye||!Ge)&&He.set("autocomplete","false"),He.set("fuzzyMatch",String(B))}J!==void 0&&(!je||(ht==null?void 0:ht.length)===1)&&He.set("limit",String(J)),He.set("key",l),mn(He);const Ke=un+"/"+encodeURIComponent(je?je.decimalLongitude+","+je.decimalLatitude:Q)+".json?"+He.toString();if(Ke===xn){Ie?(n(14,re=void 0),n(55,vt=fn[0])):n(14,re=fn);return}xn=Ke;const At=await fetch(Ke,{signal:De.signal,...Fn});if(!At.ok)throw new Error(await At.text());const Nt=await At.json();ki("response",{url:Ke,featureCollection:Nt}),Ie?(n(14,re=void 0),n(55,vt=Nt.features[0]),fn=[vt]):(n(14,re=Nt.features.filter(j)),je&&re.unshift({type:"Feature",properties:{},id:"reverse_"+je.decimalLongitude+"_"+je.decimalLatitude,text:je.decimalLatitude+", "+je.decimalLongitude,place_name:je.decimalLatitude+", "+je.decimalLongitude,place_type:["reverse"],center:[je.decimalLongitude,je.decimalLatitude],bbox:[je.decimalLongitude,je.decimalLatitude,je.decimalLongitude,je.decimalLatitude],geometry:{type:"Point",coordinates:[je.decimalLongitude,je.decimalLatitude]}}),fn=re,je&&ze.focus())}catch(je){if(je&&typeof je=="object"&&"name"in je&&je.name==="AbortError")return;throw je}finally{De===tr&&n(19,tr=void 0)}}function Qo(){var ye;if(!(Ce!=null&&Ce.length)||!$)return;const Q=[180,90,-180,-90],Ie=!Ce.some(De=>!De.matching_text);for(const De of Ce)if(Ie||!De.matching_text)for(const je of[0,1,2,3])Q[je]=Math[je<2?"min":"max"](Q[je],((ye=De.bbox)==null?void 0:ye[je])??De.center[je%2]);ce&&Ce.length>0&&(vt&&Q[0]===Q[2]&&Q[1]===Q[3]?ce.flyTo(vt.center,Ht):ce.fitBounds(O2(Q),50,Dt))}function eo(Q){n(0,Le=D==="always"),n(14,re=void 0),n(55,vt=void 0),n(15,en=-1),$r(Q[1].toFixed(6)+", "+RN(Q[0],[-180,180],!0).toFixed(6),!1)}function Ll(Q){if(!re)return;let Ie=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;Ie&&(en===(Xe?0:-1)&&Ie===-1&&n(15,en=re.length),n(15,en+=Ie),en>=re.length&&n(15,en=-1),en<0&&Xe&&n(15,en=0),Q.preventDefault())}function ei(Q=!0){if(n(18,Dr=void 0),Ge){if(Do&&clearTimeout(Do),le.length{lt(Ie).catch(ye=>n(18,Dr=ye))},Q?k:0)}else n(14,re=void 0),n(18,Dr=void 0)}function dt(Q){n(55,vt=Q),n(1,le=Q.place_name),n(15,en=-1)}const on=()=>ze.focus();function nn(Q){Gn[Q?"unshift":"push"](()=>{ze=Q,n(17,ze)})}function Rr(){le=this.value,n(1,le),n(13,or),n(27,S)}const $o=()=>n(13,or=!0),tn=()=>n(13,or=!1),ba=()=>ei(),Vr=()=>{n(1,le=""),ze.focus()},he=()=>n(0,Le=!Le),V=()=>n(18,Dr=void 0),W=Q=>n(15,en=Q),K=Q=>dt(Q),oe=()=>{Xe||n(15,en=-1)},Ee=()=>{};return t.$$set=Q=>{"class"in Q&&n(2,c=Q.class),"apiKey"in Q&&n(25,l=Q.apiKey),"bbox"in Q&&n(26,d=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,I=Q.collapsed),"country"in Q&&n(28,T=Q.country),"debounceSearch"in Q&&n(29,k=Q.debounceSearch),"enableReverse"in Q&&n(5,D=Q.enableReverse),"errorMessage"in Q&&n(6,U=Q.errorMessage),"filter"in Q&&n(30,j=Q.filter),"flyTo"in Q&&n(31,$=Q.flyTo),"fuzzyMatch"in Q&&n(32,B=Q.fuzzyMatch),"language"in Q&&n(33,q=Q.language),"limit"in Q&&n(34,J=Q.limit),"mapController"in Q&&n(35,ce=Q.mapController),"minLength"in Q&&n(36,fe=Q.minLength),"noResultsMessage"in Q&&n(7,de=Q.noResultsMessage),"placeholder"in Q&&n(8,ie=Q.placeholder),"proximity"in Q&&n(37,ee=Q.proximity),"reverseActive"in Q&&n(0,Le=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,X=Q.reverseButtonTitle),"searchValue"in Q&&n(1,le=Q.searchValue),"showFullGeometry"in Q&&n(38,Ye=Q.showFullGeometry),"showPlaceType"in Q&&n(10,xe=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,Ge=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,Xe=Q.selectFirst),"flyToSelected"in Q&&n(40,Ne=Q.flyToSelected),"markerOnSelected"in Q&&n(41,$e=Q.markerOnSelected),"types"in Q&&n(42,ht=Q.types),"excludeTypes"in Q&&n(43,Gt=Q.excludeTypes),"zoom"in Q&&n(44,Ht=Q.zoom),"maxZoom"in Q&&n(45,Dt=Q.maxZoom),"apiUrl"in Q&&n(46,un=Q.apiUrl),"fetchParameters"in Q&&n(47,Fn=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,bn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,mn=Q.adjustUrlQuery),"$$scope"in Q&&n(58,a=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,gs=or),S&&!or&&n(1,le="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&le.lengthn(18,Dr=Q)),t.$$.dirty[1]&50356241&&(ce&&vt&&vt.id!==Bs&&$&&(!vt.bbox||vt.bbox[0]===vt.bbox[2]&&vt.bbox[1]===vt.bbox[3]?ce.flyTo(vt.center,vt.id.startsWith("poi.")||vt.id.startsWith("address.")?Dt:Ht):ce.fitBounds(O2(vt.bbox),50,Dt),n(14,re=void 0),n(54,Ce=void 0),n(15,en=-1)),n(56,Bs=vt==null?void 0:vt.id)),t.$$.dirty[0]&18432&&Xe&&re!=null&&re.length&&n(15,en=0),t.$$.dirty[0]&2050&&(Xe||n(15,en=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Ce!==re&&n(54,Ce=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&ce&&ce.setEventHandler(Q=>{switch(Q.type){case"mapClick":Le&&eo(Q.coordinates);break;case"markerClick":{const Ie=re==null?void 0:re.find(ye=>ye.id===Q.id);Ie&&dt(Ie)}break;case"markerMouseEnter":Ce&&n(15,en=gs?(re==null?void 0:re.findIndex(Ie=>Ie.id===Q.id))??-1:-1);break;case"markerMouseLeave":Ce&&n(15,en=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=re==null?void 0:re[en]),t.$$.dirty[1]&67133969&&ce&&r&&$&&Ne&&ce.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Dt:Ht),t.$$.dirty[1]&1040&&($e||ce==null||ce.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&ce&&$e&&!Ce&&(ce.setMarkers(r?[r]:void 0,void 0),ce.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&ce&&ce.setMarkers(Ce,vt),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Ce&&ce&&ce.setSelectedMarker(en),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&ce){const Q=_s(le);ce.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&ki("select",r),t.$$.dirty[1]&16777216&&ki("pick",vt),t.$$.dirty[0]&81920&&ki("optionsVisibilityChange",gs&&!!re),t.$$.dirty[0]&16384&&ki("featuresListed",re),t.$$.dirty[1]&8388608&&ki("featuresMarked",Ce),t.$$.dirty[0]&1&&ki("reverseToggle",Le),t.$$.dirty[0]&2&&ki("queryChange",le),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&ce&&ce.indicateReverse(Le)},[Le,le,c,w,I,D,U,de,ie,X,xe,Xe,bn,or,re,en,gs,ze,Dr,tr,Za,Tl,Ll,ei,dt,l,d,S,T,k,j,$,B,q,J,ce,fe,ee,Ye,Ge,Ne,$e,ht,Gt,Ht,Dt,un,Fn,mn,Bn,ir,$r,_r,cr,Ce,vt,Bs,r,a,i,on,nn,Rr,$o,tn,ba,Vr,he,V,W,K,oe,Ee]}class $N extends Jt{constructor(e){super(),Kt(this,e,QN,JN,Wt,{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 Z2(t){let e,n,r;return n=new $N({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"class","svelte-ixhnie")},m(i,a){Ae(i,e,a),it(n,e,null),r=!0},p(i,a){const c={};a&2&&(c.mapController=i[1]),a&1&&(c.apiKey=i[0]),n.$set(c)},i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),ot(n)}}}function eO(t){let e,n,r=t[1]&&Z2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&_e(r,1)):(r=Z2(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function tO(t,e,n){let r,{apiKey:i}=e,{map:a}=e;return t.$$set=c=>{"apiKey"in c&&n(0,i=c.apiKey),"map"in c&&n(2,a=c.map)},t.$$.update=()=>{t.$$.dirty&4&&n(1,r=a?dN(a,Ts):null)},[i,r,a]}class nO extends Jt{constructor(e){super(),Kt(this,e,tO,eO,Wt,{apiKey:0,map:2})}}const rO=Symbol.for("svelte-maplibre");function iO(){return Cv(rO)}function oO(t){return"layerType"in t&&t.layerType==="deckgl"}var Wc=sO;function sO(t){var e,n,r;if(t){if(Array.isArray(t)){for(e=[],n=t.length,r=0;r({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),Y2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function K2(t){let e,n,r=(t[4]||t[3]instanceof Ts.Marker)&&J2(t);return{c(){e=ke("div"),r&&r.c()},m(i,a){Ae(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Ts.Marker?r?(r.p(i,a),a[0]&24&&_e(r,1)):(r=J2(i),r.c(),_e(r,1),r.m(e,null)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(),t[32](null)}}}function J2(t){let e;const n=t[30].default,r=Xr(n,t,t[29],Y2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[0]&536870933)&&Kr(r,n,i,i[29],e?Yr(n,i[29],a,uO):Jr(i[29]),Y2)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function cO(t){let e,n,r=t[9].default&&K2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&_e(r,1)):(r=K2(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function hO(t,e,n){let r,i,a,c,l,d,{$$slots:w={},$$scope:S}=e;const I=aP(w);let{closeButton:T=void 0}=e,{closeOnClickOutside:k=!0}=e,{closeOnClickInside:D=!1}=e,{closeOnMove:U=!1}=e,{openOn:j="click"}=e,{openIfTopMost:$=!0}=e,{focusAfterOpen:B=!0}=e,{anchor:q=void 0}=e,{offset:J=void 0}=e,{popupClass:ce=void 0}=e,{maxWidth:fe=void 0}=e,{lngLat:de=void 0}=e,{html:ie=void 0}=e,{open:ee=!1}=e;const Le=Ku(),{map:X,popupTarget:le,layerEvent:Ye,layer:xe,eventTopMost:Ge}=iO();Lt(t,X,Ce=>n(2,a=Ce)),Lt(t,le,Ce=>n(3,l=Ce)),Lt(t,Ye,Ce=>n(28,c=Ce)),Lt(t,xe,Ce=>n(35,d=Ce));const Xe=["click","dblclick","contextmenu"];let Ne,$e=!1,ht;function Gt(){if(!Ne)return;let Ce=Ne.getElement();!Ce||Ce===ht||(ht=Ce,j==="hover"&&(ht.style.pointerEvents="none"),ht.addEventListener("mouseenter",()=>{n(24,$e=!0)},{passive:!0}),ht.addEventListener("mouseleave",()=>{n(24,$e=!1)},{passive:!0}),ht.addEventListener("click",()=>{D&&n(0,ee=!1)},{passive:!0}))}Yu(()=>{if(a)return a.on("click",_r),a.on("contextmenu",_r),typeof l=="string"&&(a.on("click",l,Fn),a.on("dblclick",l,Fn),a.on("contextmenu",l,Fn),a.on("mousemove",l,$r),a.on("mouseleave",l,ir),a.on("touchstart",l,mn),a.on("touchend",l,Bn)),()=>{a!=null&&a.loaded()&&(Ne==null||Ne.remove(),a.off("click",_r),a.off("contextmenu",_r),l instanceof Ts.Marker?l.getPopup()===Ne&&l.setPopup(void 0):typeof l=="string"&&(a.off("click",l,Fn),a.off("dblclick",l,Fn),a.off("contextmenu",l,Fn),a.off("mousemove",l,$r),a.off("mouseleave",l,ir),a.off("touchstart",l,mn),a.off("touchend",l,Bn)))}});function Ht(Ce){return $?!("marker"in Ce)&&!oO(Ce)&&Ge(Ce)!==d:!1}let Dt=null,un="normal";function Fn(Ce){Ce.type===j&&(Ht(Ce)||("layerType"in Ce?Ce.layerType==="deckgl"?(n(10,de=Ce.coordinate),n(4,Dt=Ce.object?[Ce.object]:null)):(n(10,de=Ce.lngLat),n(4,Dt=Ce.features??[])):(n(10,de=Ce.lngLat),n(4,Dt=Ce.features??[])),setTimeout(()=>n(0,ee=!0))))}let bn=null;function mn(Ce){bn=Ce.point}function Bn(Ce){if(!bn||j!=="hover")return;let vt=bn.dist(Ce.point);bn=null,vt<3&&(n(10,de=Ce.lngLat),n(4,Dt=Ce.features??[]),Ne.isOpen()?n(25,un="justOpened"):(n(25,un="opening"),n(0,ee=!0)))}function ir(Ce){j!=="hover"||bn||un!=="normal"||(n(0,ee=!1),n(4,Dt=null))}function $r(Ce){if(!(j!=="hover"||bn||un!=="normal")){if(Ht(Ce)){n(0,ee=!1),n(4,Dt=null);return}n(0,ee=!0),n(4,Dt=Ce.features??[]),n(10,de=Ce.lngLat)}}function _r(Ce){if(un==="justOpened"){n(25,un="normal");return}if(!k)return;let vt=[ht,l instanceof Ts.Marker?l==null?void 0:l.getElement():null];ee&&Ne.isOpen()&&!vt.some(xn=>xn==null?void 0:xn.contains(Ce.originalEvent.target))&&(Ce.type==="contextmenu"&&j==="contextmenu"||Ce.type!=="contextmenu")&&n(0,ee=!1)}us(()=>{a&&(Ne!=null&&Ne.isOpen())&&Ne.remove()});let cr;const or=()=>n(0,ee=!1);function re(Ce){Gn[Ce?"unshift":"push"](()=>{cr=Ce,n(1,cr)})}return t.$$set=Ce=>{"closeButton"in Ce&&n(11,T=Ce.closeButton),"closeOnClickOutside"in Ce&&n(12,k=Ce.closeOnClickOutside),"closeOnClickInside"in Ce&&n(13,D=Ce.closeOnClickInside),"closeOnMove"in Ce&&n(14,U=Ce.closeOnMove),"openOn"in Ce&&n(15,j=Ce.openOn),"openIfTopMost"in Ce&&n(16,$=Ce.openIfTopMost),"focusAfterOpen"in Ce&&n(17,B=Ce.focusAfterOpen),"anchor"in Ce&&n(18,q=Ce.anchor),"offset"in Ce&&n(19,J=Ce.offset),"popupClass"in Ce&&n(20,ce=Ce.popupClass),"maxWidth"in Ce&&n(21,fe=Ce.maxWidth),"lngLat"in Ce&&n(10,de=Ce.lngLat),"html"in Ce&&n(22,ie=Ce.html),"open"in Ce&&n(0,ee=Ce.open),"$$scope"in Ce&&n(29,S=Ce.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=T??(!k&&!D)),t.$$.dirty[0]&146685952&&(Ne||(n(23,Ne=new Ts.Popup({closeButton:r,closeOnClick:!1,closeOnMove:U,focusAfterOpen:B,maxWidth:fe,className:ce,anchor:q,offset:J})),ht=Ne.getElement(),Ne.on("open",()=>{n(0,ee=!0),Gt(),Le("open",Ne)}),Ne.on("close",()=>{n(0,ee=!1),Le("close",Ne)}),Ne.on("hover",()=>{Le("hover",Ne)}))),t.$$.dirty[0]&8421384&&Ne&&l instanceof Ts.Marker&&(j==="click"?l.setPopup(Ne):l.getPopup()===Ne&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&Xe.includes(j)&&(c==null?void 0:c.type)===j&&(Fn(c),Xn(Ye,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=j==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&j==="hover"&&Ye&&(i&&c&&(c.layerType==="deckgl"?(n(10,de=c.coordinate),n(4,Dt=c.object?[c.object]:null)):(n(10,de=c.lngLat),n(4,Dt=c.features??[]))),n(0,ee=(i||$e)??!1)),t.$$.dirty[0]&12582914&&(cr?Ne.setDOMContent(cr):ie&&Ne.setHTML(ie)),t.$$.dirty[0]&8389632&&de&&Ne.setLngLat(de),t.$$.dirty[0]&41943045&&a){let Ce=Ne.isOpen();ee&&!Ce?(Ne.addTo(a),un==="opening"&&n(25,un="justOpened")):!ee&&Ce&&Ne.remove()}},[ee,cr,a,l,Dt,X,le,Ye,xe,I,de,T,k,D,U,j,$,B,q,J,ce,fe,ie,Ne,$e,un,i,r,c,S,w,or,re]}class fO extends Jt{constructor(e){super(),Kt(this,e,hO,cO,Wt,{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])}}var sm=Uint8Array,qC=Uint16Array,pO=Int32Array,dO=new sm([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]),mO=new sm([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]),WC=function(t,e){for(var n=new qC(31),r=0;r<31;++r)n[r]=e+=1<>1|($n&21845)<<1,ql=(ql&52428)>>2|(ql&13107)<<2,ql=(ql&61680)>>4|(ql&3855)<<4,yO[$n]=((ql&65280)>>8|(ql&255)<<8)>>1;var ql,$n,W_=new sm(288);for($n=0;$n<144;++$n)W_[$n]=8;var $n;for($n=144;$n<256;++$n)W_[$n]=9;var $n;for($n=256;$n<280;++$n)W_[$n]=7;var $n;for($n=280;$n<288;++$n)W_[$n]=8;var $n,vO=new sm(32);for($n=0;$n<32;++$n)vO[$n]=5;var $n,bO=new sm(0),xO=typeof TextDecoder<"u"&&new TextDecoder,wO=0;try{xO.decode(bO,{stream:!0}),wO=1}catch{}const SO=t=>({props:t&8}),Q2=t=>({props:CO(t[3])});function EO(t){let e;const n=t[1].default,r=Xr(n,t,t[2],Q2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&Kr(r,n,i,i[2],e?Yr(n,i[2],a,SO):Jr(i[2]),Q2)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function IO(t){let e,n;return e=new fO({props:{openOn:t[0],$$slots:{default:[EO,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function CO(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function TO(t,e,n){let{$$slots:r={},$$scope:i}=e,{openOn:a="hover"}=e;return t.$$set=c=>{"openOn"in c&&n(0,a=c.openOn),"$$scope"in c&&n(2,i=c.$$scope)},[a,r,i]}class nh extends Jt{constructor(e){super(),Kt(this,e,TO,IO,Wt,{openOn:0})}}const LO=["==",["geometry-type"],"Polygon"],PO=["==",["geometry-type"],"LineString"];function w1(t,e,n){let r=["match",t];for(let[i,a]of Object.entries(e))r.push(i),r.push(a);return r.push(n),r}function Kl(t,e,n){let r=["step",t];for(let i=1;i{var c;let r=e.get(n.originalEvent);if(r!==void 0)return r;let a=(c=n.target.queryRenderedFeatures(n.point).find(l=>{var d;return(d=t.get(l.layer.id))==null?void 0:d.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,a),a}}function kO(){let t=new Map;return Iv(S1,{map:Zn(null),source:r0(null),layer:r0(null),popupTarget:r0(null),cluster:Zn(),loadedImages:Zn(new Set),minzoom:Zn(0),maxzoom:Zn(24),layerEvent:Zn(null),layerInfo:t,eventTopMost:AO(t)})}function $2(t){return{subscribe:t.subscribe}}function E1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=rp(),a=Zn(null),c=$2(a),l={...i,[t]:$2(a)};if(e&&(l.popupTarget=c),r){let d=Zn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Zn()),Iv(S1,l),{...i,self:a}}function DO(){return E1({key:"source",setCluster:!0})}function RO(t=!0){return E1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function NO(){return E1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function eS(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],a=n[r];i!==a&&t(r,a,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function OO(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function zO(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Hc(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function tS(t){let e=t[0],n,r,i=nS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Ae(a,n,c),r=!0},p(a,c){c[0]&1&&Wt(e,e=a[0])?(Ln(),Se(i,1,1,tt),Pn(),i=nS(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function nS(t){let e;const n=t[36].default,r=Xr(n,t,t[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[1]&16)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function FO(t){let e,n,r=t[0]&&tS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&_e(r,1)):(r=tS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function BO(t,e,n){let r,i,a,c,l,d,w,S,I,T,k,D,{$$slots:U={},$$scope:j}=e,{id:$=np("layer")}=e,{source:B=void 0}=e,{sourceLayer:q=void 0}=e,{beforeId:J=void 0}=e,{beforeLayerType:ce=void 0}=e,{type:fe}=e,{paint:de=void 0}=e,{layout:ie=void 0}=e,{filter:ee=void 0}=e,{applyToClusters:Le=void 0}=e,{minzoom:X=void 0}=e,{maxzoom:le=void 0}=e,{manageHoverState:Ye=!1}=e,{hovered:xe=null}=e,{interactive:Ge=!0}=e,{hoverCursor:Xe=void 0}=e,{eventsIfTopMost:Ne=!1}=e;const $e=Ku(),{map:ht,source:Gt,self:Ht,minzoom:Dt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=RO();Lt(t,ht,re=>n(31,I=re)),Lt(t,Gt,re=>n(32,T=re)),Lt(t,Ht,re=>n(0,S=re)),Lt(t,Dt,re=>n(34,D=re)),Lt(t,un,re=>n(33,k=re)),us(()=>{S&&I&&(bn.delete(S),I==null||I.removeLayer(S))});let mn;function Bn(re){var ze,en;if(!Ge||!S||!I||Ne&&Fn(re)!==S)return;let Ce=re.features??[],vt=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn={event:re,map:I,clusterId:vt,layer:S,source:l,features:Ce};$e(re.type,xn)}function ir(re){var ze,en;if(!Ge||!S||!I||Ne&&Fn(re)!==S)return;Xe&&(I.getCanvas().style.cursor=Xe);let Ce=re.features??[];n(6,xe=Ce[0]??null);let vt=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id;$e("mouseenter",{event:re,map:I,clusterId:vt,layer:S,source:l,features:Ce})}function $r(re){var ze,en,Dr;if(!Ge||!I)return;if(Ne&&Fn(re)!==S){n(6,xe=null),Ye&&mn!==void 0&&(I==null||I.setFeatureState({source:l,sourceLayer:q,id:mn},{hover:!1}),mn=void 0);return}I.getCanvas().style.cursor=Xe;let Ce=re.features??[],vt=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn=(Dr=Ce[0])==null?void 0:Dr.id;xn!==mn&&(Ye&&(mn!==void 0&&(I==null||I.setFeatureState({source:l,id:mn,sourceLayer:q},{hover:!1})),I==null||I.setFeatureState({source:l,id:xn,sourceLayer:q},{hover:!0})),mn=xn,n(6,xe=Ce[0]??null)),$e("mousemove",{event:re,map:I,clusterId:vt,layer:S,source:l,features:Ce})}function _r(re){if(!(!Ge||!S||!I)){if(Xe&&(I.getCanvas().style.cursor=""),n(6,xe=null),Ye&&mn!==void 0){const Ce={source:l,id:mn,sourceLayer:q};I==null||I.setFeatureState(Ce,{hover:!1}),mn=void 0}$e("mouseleave",{map:I,layer:S,source:l})}}let cr=!0;function or(re){I&&(I.off("click",re,Bn),I.off("dblclick",re,Bn),I.off("contextmenu",re,Bn),I.off("mouseenter",re,ir),I.off("mousemove",re,$r),I.off("mouseleave",re,_r))}return us(()=>{I&&S&&or(S)}),t.$$set=re=>{"id"in re&&n(7,$=re.id),"source"in re&&n(8,B=re.source),"sourceLayer"in re&&n(9,q=re.sourceLayer),"beforeId"in re&&n(10,J=re.beforeId),"beforeLayerType"in re&&n(11,ce=re.beforeLayerType),"type"in re&&n(12,fe=re.type),"paint"in re&&n(13,de=re.paint),"layout"in re&&n(14,ie=re.layout),"filter"in re&&n(15,ee=re.filter),"applyToClusters"in re&&n(16,Le=re.applyToClusters),"minzoom"in re&&n(17,X=re.minzoom),"maxzoom"in re&&n(18,le=re.maxzoom),"manageHoverState"in re&&n(19,Ye=re.manageHoverState),"hovered"in re&&n(6,xe=re.hovered),"interactive"in re&&n(20,Ge=re.interactive),"hoverCursor"in re&&n(21,Xe=re.hoverCursor),"eventsIfTopMost"in re&&n(22,Ne=re.eventsIfTopMost),"$$scope"in re&&n(35,j=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=zO(Le)),t.$$.dirty[0]&1073774592&&n(24,i=OO("all",r,ee)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=X??D),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=le??k),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==$&&l){S&&(or(S),bn.delete(S));let re=J;if(!J&&ce){let Ce=I.getStyle().layers,vt=typeof ce=="function"?ce:ze=>ze.type===ce,xn=Ce==null?void 0:Ce.find(vt);xn&&(re=xn.id)}Xn(Ht,S=$,S),I.addLayer(Wc({id:S,type:fe,source:l,"source-layer":q,filter:i,paint:de,layout:ie,minzoom:a,maxzoom:c}),re),n(23,cr=!0),I.on("click",S,Bn),I.on("dblclick",S,Bn),I.on("contextmenu",S,Bn),I.on("mouseenter",S,ir),I.on("mousemove",S,$r),I.on("mouseleave",S,_r)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Ge}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?eS((re,Ce)=>I==null?void 0:I.setPaintProperty(S,re,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?eS((re,Ce)=>I==null?void 0:I.setLayoutProperty(S,re,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(de)),t.$$.dirty[0]&134234112&&(w==null||w(ie)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(cr?n(23,cr=!1):I==null||I.setFilter(S,i))},[S,ht,Gt,Ht,Dt,un,xe,$,B,q,J,ce,fe,de,ie,ee,Le,X,le,Ye,Ge,Xe,Ne,cr,i,c,a,w,d,l,r,I,T,k,D,j,U]}let H_=class extends Jt{constructor(e){super(),Kt(this,e,BO,FO,Wt,{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 VO(t){let e;const n=t[16].default,r=Xr(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function UO(t){let e,n,r;function i(c){t[17](c)}let a={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:[VO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function GO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:$=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:q=!1}=e,{interactive:J=!0}=e;function ce(le){B=le,n(0,B)}function fe(le){dn.call(this,t,le)}function de(le){dn.call(this,t,le)}function ie(le){dn.call(this,t,le)}function ee(le){dn.call(this,t,le)}function Le(le){dn.call(this,t,le)}function X(le){dn.call(this,t,le)}return t.$$set=le=>{"id"in le&&n(1,a=le.id),"source"in le&&n(2,c=le.source),"sourceLayer"in le&&n(3,l=le.sourceLayer),"beforeId"in le&&n(4,d=le.beforeId),"beforeLayerType"in le&&n(5,w=le.beforeLayerType),"paint"in le&&n(6,S=le.paint),"layout"in le&&n(7,I=le.layout),"filter"in le&&n(8,T=le.filter),"applyToClusters"in le&&n(9,k=le.applyToClusters),"minzoom"in le&&n(10,D=le.minzoom),"maxzoom"in le&&n(11,U=le.maxzoom),"hoverCursor"in le&&n(12,j=le.hoverCursor),"manageHoverState"in le&&n(13,$=le.manageHoverState),"hovered"in le&&n(0,B=le.hovered),"eventsIfTopMost"in le&&n(14,q=le.eventsIfTopMost),"interactive"in le&&n(15,J=le.interactive),"$$scope"in le&&n(24,i=le.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,j,$,q,J,r,ce,fe,de,ie,ee,Le,X,i]}let Z_=class extends Jt{constructor(e){super(),Kt(this,e,GO,UO,Wt,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}};function jO(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function qO(t){let e,n,r;function i(c){t[16](c)}let a={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:[jO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function WO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:q=!0}=e;function J(X){$=X,n(0,$)}function ce(X){dn.call(this,t,X)}function fe(X){dn.call(this,t,X)}function de(X){dn.call(this,t,X)}function ie(X){dn.call(this,t,X)}function ee(X){dn.call(this,t,X)}function Le(X){dn.call(this,t,X)}return t.$$set=X=>{"id"in X&&n(1,a=X.id),"source"in X&&n(2,c=X.source),"sourceLayer"in X&&n(3,l=X.sourceLayer),"beforeId"in X&&n(4,d=X.beforeId),"beforeLayerType"in X&&n(5,w=X.beforeLayerType),"paint"in X&&n(6,S=X.paint),"layout"in X&&n(7,I=X.layout),"filter"in X&&n(8,T=X.filter),"minzoom"in X&&n(9,k=X.minzoom),"maxzoom"in X&&n(10,D=X.maxzoom),"hoverCursor"in X&&n(11,U=X.hoverCursor),"manageHoverState"in X&&n(12,j=X.manageHoverState),"hovered"in X&&n(0,$=X.hovered),"eventsIfTopMost"in X&&n(13,B=X.eventsIfTopMost),"interactive"in X&&n(14,q=X.interactive),"$$scope"in X&&n(23,i=X.$$scope)},[$,a,c,l,d,w,S,I,T,k,D,U,j,B,q,r,J,ce,fe,de,ie,ee,Le,i]}let I1=class extends Jt{constructor(e){super(),Kt(this,e,WO,qO,Wt,{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 HO(t,e,n){let r;const{map:i}=rp();Lt(t,i,d=>n(4,r=d));let{position:a="top-left"}=e,{container:c=void 0}=e,l=null;return us(()=>{r!=null&&r.loaded()&&l&&r.removeControl(l)}),t.$$set=d=>{"position"in d&&n(1,a=d.position),"container"in d&&n(2,c=d.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!l){let d;typeof c=="string"?d=document.querySelector(c)??void 0:d=c,n(3,l=new Ts.FullscreenControl({container:d})),r.addControl(l,a)}},[i,a,c,l,r]}class ZO extends Jt{constructor(e){super(),Kt(this,e,HO,null,Wt,{position:1,container:2})}}function XO(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function YO(t,e,n){xE().then(()=>{let r=gE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function rS(t){let e=t[0],n,r,i=iS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Ae(a,n,c),r=!0},p(a,c){c&1&&Wt(e,e=a[0])?(Ln(),Se(i,1,1,tt),Pn(),i=iS(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function iS(t){let e;const n=t[19].default,r=Xr(n,t,t[18],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&262144)&&Kr(r,n,i,i[18],e?Yr(n,i[18],a,null):Jr(i[18]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function KO(t){let e,n,r=t[0]&&rS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=rS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function JO(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:d=np("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:T=void 0}=e,{lineMetrics:k=void 0}=e,{cluster:D=void 0}=e,{maxzoom:U=void 0}=e,{attribution:j=void 0}=e,{buffer:$=void 0}=e,{tolerance:B=void 0}=e;const{map:q,cluster:J,self:ce}=DO();Lt(t,q,ie=>n(17,i=ie)),Lt(t,J,ie=>n(20,a=ie)),Lt(t,ce,ie=>n(0,r=ie));let fe,de=!0;return us(()=>{r&&fe&&i&&(YO(q,r,fe),Xn(ce,r=null,r),n(15,fe=void 0))}),t.$$set=ie=>{"id"in ie&&n(4,d=ie.id),"data"in ie&&n(5,w=ie.data),"generateId"in ie&&n(6,S=ie.generateId),"promoteId"in ie&&n(7,I=ie.promoteId),"filter"in ie&&n(8,T=ie.filter),"lineMetrics"in ie&&n(9,k=ie.lineMetrics),"cluster"in ie&&n(10,D=ie.cluster),"maxzoom"in ie&&n(11,U=ie.maxzoom),"attribution"in ie&&n(12,j=ie.attribution),"buffer"in ie&&n(13,$=ie.buffer),"tolerance"in ie&&n(14,B=ie.tolerance),"$$scope"in ie&&n(18,l=ie.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Xn(J,a=D,a),t.$$.dirty&196593&&i&&r!==d&&(Xn(ce,r=d,r),XO(i,r,Wc({type:"geojson",data:w,filter:T,lineMetrics:k,generateId:S,promoteId:I,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties,maxzoom:U,attribution:j,buffer:$,tolerance:B}),ie=>i&&ie===r,()=>{r&&(n(15,fe=i==null?void 0:i.getSource(r)),n(16,de=!0))})),t.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,fe=i==null?void 0:i.getSource(d))})),t.$$.dirty&98336&&fe&&(de?n(16,de=!1):fe.setData(w)),t.$$.dirty&33792&&(fe==null||fe.setClusterOptions(Wc({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[r,q,J,ce,d,w,S,I,T,k,D,U,j,$,B,fe,de,i,l,c]}let Wa=class extends Jt{constructor(e){super(),Kt(this,e,JO,KO,Wt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function QO(t,e,n){let r;const{map:i}=rp();Lt(t,i,T=>n(8,r=T));let{position:a="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:l=void 0}=e,{trackUserLocation:d=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:S=!0}=e,{control:I=null}=e;return us(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),t.$$set=T=>{"position"in T&&n(2,a=T.position),"positionOptions"in T&&n(3,c=T.positionOptions),"fitBoundsOptions"in T&&n(4,l=T.fitBoundsOptions),"trackUserLocation"in T&&n(5,d=T.trackUserLocation),"showAccuracyCircle"in T&&n(6,w=T.showAccuracyCircle),"showUserLocation"in T&&n(7,S=T.showUserLocation),"control"in T&&n(1,I=T.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!I&&(n(1,I=new Ts.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:d,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,I,a,c,l,d,w,S,r]}class $O extends Jt{constructor(e){super(),Kt(this,e,QO,null,Wt,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function e5(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function t5(t){let e,n,r;function i(c){t[16](c)}let a={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:[e5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function n5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:q=!0}=e;function J(X){$=X,n(0,$)}function ce(X){dn.call(this,t,X)}function fe(X){dn.call(this,t,X)}function de(X){dn.call(this,t,X)}function ie(X){dn.call(this,t,X)}function ee(X){dn.call(this,t,X)}function Le(X){dn.call(this,t,X)}return t.$$set=X=>{"id"in X&&n(1,a=X.id),"source"in X&&n(2,c=X.source),"sourceLayer"in X&&n(3,l=X.sourceLayer),"beforeId"in X&&n(4,d=X.beforeId),"beforeLayerType"in X&&n(5,w=X.beforeLayerType),"paint"in X&&n(6,S=X.paint),"layout"in X&&n(7,I=X.layout),"filter"in X&&n(8,T=X.filter),"minzoom"in X&&n(9,k=X.minzoom),"maxzoom"in X&&n(10,D=X.maxzoom),"hoverCursor"in X&&n(11,U=X.hoverCursor),"manageHoverState"in X&&n(12,j=X.manageHoverState),"hovered"in X&&n(0,$=X.hovered),"eventsIfTopMost"in X&&n(13,B=X.eventsIfTopMost),"interactive"in X&&n(14,q=X.interactive),"$$scope"in X&&n(23,i=X.$$scope)},[$,a,c,l,d,w,S,I,T,k,D,U,j,B,q,r,J,ce,fe,de,ie,ee,Le,i]}let cu=class extends Jt{constructor(e){super(),Kt(this,e,n5,t5,Wt,{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 r5(t,e,n){let r;const i=Ku();let{layer:a=void 0}=e;const{map:c}=rp();Lt(t,c,S=>n(2,r=S));function l(S){i(S.type,{...S,map:c})}const d=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return us(()=>{if(r)if(a)for(const S of d)r.off(S,a,l);else for(const S of w)r.off(S,l)}),t.$$set=S=>{"layer"in S&&n(1,a=S.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(a)for(const S of d)r.on(S,a,l);else for(const S of w)r.on(S,l)},[c,a,r]}class i5 extends Jt{constructor(e){super(),Kt(this,e,r5,null,Wt,{layer:1})}}function o5(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(e.lat*i)/i,c=Math.round(e.lng*i)/i,l=`${n}/${a}/${c}`,d=t.getBearing(),w=t.getPitch();return(d||w)&&(l+=`/${Math.round(d*10)/10}`),w&&(l+=`/${Math.round(w)}`),`#${l}`}function s5(t){return t.replace("#","").split("/").map(parseFloat)}function a5(t,e,n){let r;const{map:i}=rp();Lt(t,i,S=>n(6,r=S));let{position:a="top-left"}=e,{showCompass:c=!0}=e,{showZoom:l=!0}=e,{visualizePitch:d=!1}=e,w=null;return us(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),t.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,l=S.showZoom),"visualizePitch"in S&&n(4,d=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Ts.NavigationControl({showCompass:c,showZoom:l,visualizePitch:d})),r.addControl(w,a))},[i,a,c,l,d,w,r]}class l5 extends Jt{constructor(e){super(),Kt(this,e,a5,null,Wt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function u5(t,e,n){let r;const{map:i}=rp();Lt(t,i,w=>n(5,r=w));let{position:a="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:l="metric"}=e,d=null;return us(()=>{r!=null&&r.loaded()&&d&&r.removeControl(d)}),t.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,c=w.maxWidth),"unit"in w&&n(3,l=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!d&&(n(4,d=new Ts.ScaleControl({maxWidth:c,unit:l})),r.addControl(d,a))},[i,a,c,l,d,r]}class c5 extends Jt{constructor(e){super(),Kt(this,e,u5,null,Wt,{position:1,maxWidth:2,unit:3})}}const{window:h5}=lP,f5=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),oS=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function sS(t){let e,n,r=t[3]&&aS(t);const i=t[40].default,a=Xr(i,t,t[39],oS);return{c(){r&&r.c(),e=rt(),a&&a.c()},m(c,l){r&&r.m(c,l),Ae(c,e,l),a&&a.m(c,l),n=!0},p(c,l){c[3]?r?(r.p(c,l),l[0]&8&&_e(r,1)):(r=aS(c),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn()),a&&a.p&&(!n||l[0]&112|l[1]&256)&&Kr(a,i,c,c[39],n?Yr(i,c[39],l,f5):Jr(c[39]),oS)},i(c){n||(_e(r),_e(a,c),n=!0)},o(c){Se(r),Se(a,c),n=!1},d(c){c&&Pe(e),r&&r.d(c),a&&a.d(c)}}}function aS(t){let e,n,r,i,a,c,l,d;return e=new l5({props:{position:t[7]}}),r=new $O({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new ZO({props:{position:t[7]}}),l=new c5({props:{position:t[7]}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment),c=rt(),st(l.$$.fragment)},m(w,S){it(e,w,S),Ae(w,n,S),it(r,w,S),Ae(w,i,S),it(a,w,S),Ae(w,c,S),it(l,w,S),d=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),e.$set(I);const T={};S[0]&128&&(T.position=w[7]),r.$set(T);const k={};S[0]&128&&(k.position=w[7]),a.$set(k);const D={};S[0]&128&&(D.position=w[7]),l.$set(D)},i(w){d||(_e(e.$$.fragment,w),_e(r.$$.fragment,w),_e(a.$$.fragment,w),_e(l.$$.fragment,w),d=!0)},o(w){Se(e.$$.fragment,w),Se(r.$$.fragment,w),Se(a.$$.fragment,w),Se(l.$$.fragment,w),d=!1},d(w){w&&(Pe(n),Pe(i),Pe(c)),ot(e,w),ot(r,w),ot(a,w),ot(l,w)}}}function p5(t){let e,n,r,i,a,c=t[4]&&t[0]&&sS(t);return{c(){e=ke("div"),c&&c.c(),Fe(e,"class",n=Vg(t[2])+" svelte-p00lfq"),Fe(e,"data-testid","map-container"),fl(e,"expand-map",!t[2])},m(l,d){Ae(l,e,d),c&&c.m(e,null),t[41](e),r=!0,i||(a=[Ut(h5,"hashchange",t[11]),A0(t[10].call(null,e))],i=!0)},p(l,d){l[4]&&l[0]?c?(c.p(l,d),d[0]&17&&_e(c,1)):(c=sS(l),c.c(),_e(c,1),c.m(e,null)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),(!r||d[0]&4&&n!==(n=Vg(l[2])+" svelte-p00lfq"))&&Fe(e,"class",n),(!r||d[0]&4)&&fl(e,"expand-map",!l[2])},i(l){r||(_e(c),r=!0)},o(l){Se(c),r=!1},d(l){l&&Pe(e),c&&c.d(),t[41](null),i=!1,Ai(a)}}}function d5(t,e,n){let r,i,a,c,{$$slots:l={},$$scope:d}=e,{map:w=null}=e,{mapContainer:S=void 0}=e,{class:I=void 0}=e,{style:T}=e,{diffStyleUpdates:k=!1}=e,{center:D=void 0}=e,{zoom:U=void 0}=e,{pitch:j=0}=e,{bearing:$=0}=e,{bounds:B=void 0}=e,{hash:q=!1}=e,{updateHash:J=re=>{window.history.replaceState(window.history.state,"",re)}}=e,{loaded:ce=!1}=e,{minZoom:fe=0}=e,{maxZoom:de=22}=e,{antialias:ie=void 0}=e,{zoomOnDoubleClick:ee=!0}=e,{locale:Le=void 0}=e,{interactive:X=!0}=e,{attributionControl:le=!0}=e,{cooperativeGestures:Ye=!1}=e,{preserveDrawingBuffer:xe=!1}=e,{maxBounds:Ge=void 0}=e,{images:Xe=[]}=e,{standardControls:Ne=!1}=e,{filterLayers:$e=void 0}=e,{transformRequest:ht=void 0}=e;const Gt=Ku(),{map:Ht,loadedImages:Dt}=kO();Lt(t,Ht,re=>n(4,a=re)),Lt(t,Dt,re=>n(5,c=re));let un=new Set;async function Fn(re,Ce=!1){if(a&&!(!a.loaded()&&!Ce))if("url"in re){un.add(re.id);try{let vt=await a.loadImage(re.url);a==null||a.addImage(re.id,vt.data,re.options),c.add(re.id),Dt.set(c)}catch(vt){Gt("error",vt)}finally{un.delete(re.id)}}else a.addImage(re.id,re.data,re.options),c.add(re.id),Dt.set(c)}let bn,mn,Bn,ir;function $r(re){return cr(),Xn(Ht,a=new Ts.Map(Wc({container:re,style:T,locale:Le,center:D,zoom:U,pitch:j,bearing:$,minZoom:fe,maxZoom:de,antialias:ie,interactive:X,preserveDrawingBuffer:xe,maxBounds:Ge,bounds:B,attributionControl:le,transformRequest:ht,cooperativeGestures:Ye})),a),a.on("load",Ce=>{Ce.target.getContainer().setAttribute("data-testid","map"),Ce.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,ce=!0),Gt("load",a)}),a.on("error",Ce=>Gt("error",{...Ce,map:a})),a.on("movestart",Ce=>Gt("movestart",{...Ce,map:a})),a.on("moveend",Ce=>{if(n(12,D=Ce.target.getCenter()),n(13,U=Ce.target.getZoom()),n(14,j=Ce.target.getPitch()),n(15,$=Ce.target.getBearing()),n(16,B=Ce.target.getBounds()),Gt("moveend",{...Ce,map:a}),q){let vt=new URL(window.location.href.replace(/(#.+)?$/,o5(a)));J(vt)}}),a.on("click",Ce=>Gt("click",{...Ce,map:a})),a.on("dblclick",Ce=>Gt("dblclick",{...Ce,map:a})),a.on("contextmenu",Ce=>Gt("contextmenu",{...Ce,map:a})),a.on("zoomstart",Ce=>Gt("zoomstart",{...Ce,map:a})),a.on("zoom",Ce=>{Gt("zoom",{...Ce,map:a})}),a.on("zoomend",Ce=>{Gt("zoomend",{...Ce,map:a})}),a.on("style.load",()=>{if(a){const Ce=a.getStyle();if(n(36,bn=Ce.layers.map(vt=>vt.id)),n(37,mn=Object.keys(Ce.sources)),ir)for(const[vt,xn]of Object.entries(ir))a.addSource(vt,xn);if(Bn)for(const vt of Bn)a.addLayer(vt);for(const vt of Xe)Fn(vt,!0)}}),a.on("styledata",Ce=>{if(a&&$e){const vt=a.getStyle().layers;if(vt)for(let xn of vt)$e(xn)||a.setLayoutProperty(xn.id,"visibility","none")}Gt("styledata",{...Ce,map:a})}),{destroy(){n(0,ce=!1),a==null||a.remove(),Xn(Ht,a=null,a)}}}let _r=T;function cr(){if(q){let re=s5(window.location.hash);re.length>=3&&(n(13,U=re[0]),n(12,D=[re[2],re[1]])),re.length==5&&(n(15,$=re[3]),n(14,j=re[4]))}}function or(re){Gn[re?"unshift":"push"](()=>{S=re,n(1,S)})}return t.$$set=re=>{"map"in re&&n(17,w=re.map),"mapContainer"in re&&n(1,S=re.mapContainer),"class"in re&&n(2,I=re.class),"style"in re&&n(18,T=re.style),"diffStyleUpdates"in re&&n(19,k=re.diffStyleUpdates),"center"in re&&n(12,D=re.center),"zoom"in re&&n(13,U=re.zoom),"pitch"in re&&n(14,j=re.pitch),"bearing"in re&&n(15,$=re.bearing),"bounds"in re&&n(16,B=re.bounds),"hash"in re&&n(20,q=re.hash),"updateHash"in re&&n(21,J=re.updateHash),"loaded"in re&&n(0,ce=re.loaded),"minZoom"in re&&n(22,fe=re.minZoom),"maxZoom"in re&&n(23,de=re.maxZoom),"antialias"in re&&n(24,ie=re.antialias),"zoomOnDoubleClick"in re&&n(25,ee=re.zoomOnDoubleClick),"locale"in re&&n(26,Le=re.locale),"interactive"in re&&n(27,X=re.interactive),"attributionControl"in re&&n(28,le=re.attributionControl),"cooperativeGestures"in re&&n(29,Ye=re.cooperativeGestures),"preserveDrawingBuffer"in re&&n(30,xe=re.preserveDrawingBuffer),"maxBounds"in re&&n(31,Ge=re.maxBounds),"images"in re&&n(32,Xe=re.images),"standardControls"in re&&n(3,Ne=re.standardControls),"filterLayers"in re&&n(33,$e=re.filterLayers),"transformRequest"in re&&n(34,ht=re.transformRequest),"$$scope"in re&&n(39,d=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof Ne=="boolean"?void 0:Ne),t.$$.dirty[0]&16&&n(17,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&a&&!sf(T,_r)){const re=a.getStyle();if(bn&&(Bn=re.layers.filter(Ce=>!bn.includes(Ce.id))),mn){const Ce=Object.keys(re.sources).filter(vt=>!mn.includes(vt));ir={};for(const vt of Ce)ir[vt]=re.sources[vt]}n(38,_r=T),a.setStyle(T,{diff:k}),Xn(Dt,c=new Set,c),n(35,un=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&ce&&a!=null&&a.loaded())for(let re of Xe)!c.has(re.id)&&!un.has(re.id)&&!a.hasImage(re.id)&&Fn(re);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,i=Xe.every(re=>c.has(re.id))),t.$$.dirty[0]&61456&&a){let re={};D!=null&&!sf(D,a==null?void 0:a.getCenter())&&(re.center=D),U!=null&&!sf(U,a==null?void 0:a.getZoom())&&(re.zoom=U),$!=null&&!sf($,a==null?void 0:a.getBearing())&&(re.bearing=$),j!=null&&!sf(j,a==null?void 0:a.getPitch())&&(re.pitch=j),Object.keys(re).length&&a.easeTo(re)}t.$$.dirty[0]&65552&&B&&!sf(B,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(B)),t.$$.dirty[0]&33554448&&(ee?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[ce,S,I,Ne,a,c,i,r,Ht,Dt,$r,cr,D,U,j,$,B,w,T,k,q,J,fe,de,ie,ee,Le,X,le,Ye,xe,Ge,Xe,$e,ht,un,bn,mn,_r,d,l,or]}class m5 extends Jt{constructor(e){super(),Kt(this,e,d5,p5,Wt,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const g5=t=>({marker:t&8}),lS=t=>({marker:t[3]});function _5(t){let e,n,r,i,a,c,l;const d=t[19].default,w=Xr(d,t,t[18],lS);return{c(){e=ke("div"),w&&w.c(),Fe(e,"tabindex",n=t[1]?0:void 0),Fe(e,"role",r=t[1]?"button":void 0),Ii(e,"z-index",t[2])},m(S,I){Ae(S,e,I),w&&w.m(e,null),a=!0,c||(l=[A0(t[7].call(null,e)),A0(i=y5.call(null,e,t[0])),Ut(e,"click",t0(t[20])),Ut(e,"dblclick",t0(t[21])),Ut(e,"contextmenu",t0(t[22])),Ut(e,"mouseenter",t[23]),Ut(e,"mouseleave",t[24]),Ut(e,"mousemove",t[25]),Ut(e,"keydown",t[8])],c=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&Kr(w,d,S,S[18],a?Yr(d,S[18],I,g5):Jr(S[18]),lS),(!a||I&2&&n!==(n=S[1]?0:void 0))&&Fe(e,"tabindex",n),(!a||I&2&&r!==(r=S[1]?"button":void 0))&&Fe(e,"role",r),i&&E_(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Ii(e,"z-index",S[2])},i(S){a||(_e(w,S),a=!0)},o(S){Se(w,S),a=!1},d(S){S&&Pe(e),w&&w.d(S),c=!1,Ai(l)}}}function y5(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function v5(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{marker:d=void 0}=e,{lngLat:w}=e,{class:S=void 0}=e,{interactive:I=!0}=e,{asButton:T=!1}=e,{draggable:k=!1}=e,{feature:D=null}=e,{offset:U=void 0}=e,{zIndex:j=void 0}=e,{rotation:$=0}=e,{opacity:B=1}=e;const q=Ku(),{map:J,layerEvent:ce,self:fe}=NO();Lt(t,J,Ne=>n(27,a=Ne)),Lt(t,ce,Ne=>n(26,r=Ne)),Lt(t,fe,Ne=>n(3,i=Ne));function de(Ne){Xn(fe,i=new Ts.Marker({element:Ne,rotation:$,draggable:k,offset:U,opacity:B.toString()}).setLngLat(w).addTo(a),i),n(11,d=i);const $e=()=>Le("dragstart"),ht=()=>{ie(),Le("drag")},Gt=()=>{ie(),Le("dragend")};return k&&(i.on("dragstart",$e),i.on("drag",ht),i.on("dragend",Gt)),{destroy(){k&&(i==null||i.off("dragstart",$e),i==null||i.off("drag",ht),i==null||i.off("dragend",Gt)),n(11,d=void 0),i==null||i.remove()}}}function ie(){let Ne=i==null?void 0:i.getLngLat();Ne&&(Array.isArray(w)?n(10,w=[Ne.lng,Ne.lat]):w&&"lon"in w?n(10,w={lon:Ne.lng,lat:Ne.lat}):n(10,w=Ne))}function ee(Ne){Ne.key===" "&&(Ne.preventDefault(),Ne.stopPropagation(),Le("click"))}function Le(Ne){if(!I)return;let $e=i==null?void 0:i.getLngLat();if(!$e)return;const ht=[$e.lng,$e.lat];let Gt={map:a,marker:i,lngLat:ht,features:[{type:"Feature",properties:(D==null?void 0:D.properties)??{},geometry:{type:"Point",coordinates:ht}}]};Xn(ce,r={...Gt,layerType:"marker",type:Ne},r),q(Ne,Gt)}const X=()=>Le("click"),le=()=>Le("dblclick"),Ye=()=>Le("contextmenu"),xe=Ne=>{Le("mouseenter")},Ge=()=>{Le("mouseleave")},Xe=()=>Le("mousemove");return t.$$set=Ne=>{"marker"in Ne&&n(11,d=Ne.marker),"lngLat"in Ne&&n(10,w=Ne.lngLat),"class"in Ne&&n(0,S=Ne.class),"interactive"in Ne&&n(12,I=Ne.interactive),"asButton"in Ne&&n(1,T=Ne.asButton),"draggable"in Ne&&n(13,k=Ne.draggable),"feature"in Ne&&n(14,D=Ne.feature),"offset"in Ne&&n(15,U=Ne.offset),"zIndex"in Ne&&n(2,j=Ne.zIndex),"rotation"in Ne&&n(16,$=Ne.rotation),"opacity"in Ne&&n(17,B=Ne.opacity),"$$scope"in Ne&&n(18,l=Ne.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(w)),t.$$.dirty&32776&&(i==null||i.setOffset(U??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation($)),t.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,T,j,i,J,ce,fe,de,ee,Le,w,d,I,k,D,U,$,B,l,c,X,le,Ye,xe,Ge,Xe]}class Xd extends Jt{constructor(e){super(),Kt(this,e,v5,_5,Wt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function b5(t){let e;const n=t[16].default,r=Xr(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function x5(t){let e,n,r;function i(c){t[17](c)}let a={id:t[1],type:"symbol",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[b5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function w5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=np("symbol")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S=void 0}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:$=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:q=!1}=e,{interactive:J=!0}=e;function ce(le){B=le,n(0,B)}function fe(le){dn.call(this,t,le)}function de(le){dn.call(this,t,le)}function ie(le){dn.call(this,t,le)}function ee(le){dn.call(this,t,le)}function Le(le){dn.call(this,t,le)}function X(le){dn.call(this,t,le)}return t.$$set=le=>{"id"in le&&n(1,a=le.id),"source"in le&&n(2,c=le.source),"sourceLayer"in le&&n(3,l=le.sourceLayer),"beforeId"in le&&n(4,d=le.beforeId),"beforeLayerType"in le&&n(5,w=le.beforeLayerType),"paint"in le&&n(6,S=le.paint),"layout"in le&&n(7,I=le.layout),"filter"in le&&n(8,T=le.filter),"applyToClusters"in le&&n(9,k=le.applyToClusters),"minzoom"in le&&n(10,D=le.minzoom),"maxzoom"in le&&n(11,U=le.maxzoom),"hoverCursor"in le&&n(12,j=le.hoverCursor),"manageHoverState"in le&&n(13,$=le.manageHoverState),"hovered"in le&&n(0,B=le.hovered),"eventsIfTopMost"in le&&n(14,q=le.eventsIfTopMost),"interactive"in le&&n(15,J=le.interactive),"$$scope"in le&&n(24,i=le.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,j,$,q,J,r,ce,fe,de,ie,ee,Le,X,i]}class S5 extends Jt{constructor(e){super(),Kt(this,e,w5,x5,Wt,{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 E5=t=>({}),uS=t=>({}),I5=t=>({}),cS=t=>({}),C5=t=>({}),hS=t=>({});function T5(t){let e,n,r,i,a,c;const l=t[1].top,d=Xr(l,t,t[0],hS),w=t[1].left,S=Xr(w,t,t[0],cS),I=t[1].main,T=Xr(I,t,t[0],uS);return{c(){e=ke("div"),d&&d.c(),n=rt(),r=ke("div"),S&&S.c(),i=rt(),a=ke("div"),T&&T.c(),Fe(e,"class","top svelte-mpick2"),Fe(r,"class","left svelte-mpick2"),Fe(a,"class","main svelte-mpick2")},m(k,D){Ae(k,e,D),d&&d.m(e,null),Ae(k,n,D),Ae(k,r,D),S&&S.m(r,null),Ae(k,i,D),Ae(k,a,D),T&&T.m(a,null),c=!0},p(k,[D]){d&&d.p&&(!c||D&1)&&Kr(d,l,k,k[0],c?Yr(l,k[0],D,C5):Jr(k[0]),hS),S&&S.p&&(!c||D&1)&&Kr(S,w,k,k[0],c?Yr(w,k[0],D,I5):Jr(k[0]),cS),T&&T.p&&(!c||D&1)&&Kr(T,I,k,k[0],c?Yr(I,k[0],D,E5):Jr(k[0]),uS)},i(k){c||(_e(d,k),_e(S,k),_e(T,k),c=!0)},o(k){Se(d,k),Se(S,k),Se(T,k),c=!1},d(k){k&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a)),d&&d.d(k),S&&S.d(k),T&&T.d(k)}}}function L5(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class P5 extends Jt{constructor(e){super(),Kt(this,e,L5,T5,Wt,{})}}const M5=t=>({}),fS=t=>({}),A5=t=>({}),pS=t=>({}),k5=t=>({}),dS=t=>({});function D5(t){let e,n,r,i,a,c;const l=t[4].top,d=Xr(l,t,t[3],dS),w=t[4].sidebar,S=Xr(w,t,t[3],pS),I=t[4].map,T=Xr(I,t,t[3],fS);return{c(){e=ke("div"),d&&d.c(),n=rt(),r=ke("div"),S&&S.c(),i=rt(),a=ke("div"),T&&T.c()},m(k,D){Ae(k,e,D),d&&d.m(e,null),t[5](e),Ae(k,n,D),Ae(k,r,D),S&&S.m(r,null),t[6](r),Ae(k,i,D),Ae(k,a,D),T&&T.m(a,null),t[7](a),c=!0},p(k,[D]){d&&d.p&&(!c||D&8)&&Kr(d,l,k,k[3],c?Yr(l,k[3],D,k5):Jr(k[3]),dS),S&&S.p&&(!c||D&8)&&Kr(S,w,k,k[3],c?Yr(w,k[3],D,A5):Jr(k[3]),pS),T&&T.p&&(!c||D&8)&&Kr(T,I,k,k[3],c?Yr(I,k[3],D,M5):Jr(k[3]),fS)},i(k){c||(_e(d,k),_e(S,k),_e(T,k),c=!0)},o(k){Se(d,k),Se(S,k),Se(T,k),c=!1},d(k){k&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a)),d&&d.d(k),t[5](null),S&&S.d(k),t[6](null),T&&T.d(k),t[7](null)}}}function R5(t,e,n){let r,i,a;Lt(t,xv,I=>n(0,r=I)),Lt(t,wv,I=>n(1,i=I)),Lt(t,Sv,I=>n(2,a=I));let{$$slots:c={},$$scope:l}=e;function d(I){Gn[I?"unshift":"push"](()=>{r=I,xv.set(r)})}function w(I){Gn[I?"unshift":"push"](()=>{i=I,wv.set(i)})}function S(I){Gn[I?"unshift":"push"](()=>{a=I,Sv.set(a)})}return t.$$set=I=>{"$$scope"in I&&n(3,l=I.$$scope)},[r,i,a,l,c,d,w,S]}class ip extends Jt{constructor(e){super(),Kt(this,e,R5,D5,Wt,{})}}let xv=Zn(null),wv=Zn(null),Sv=Zn(null);function mS(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[N5,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&48&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function N5(t){let e,n;return e=new Mv({props:{properties:t[4]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.properties=r[4]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function O5(t){let e,n,r=t[1]&&mS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,a){i[1]?r?(r.p(i,a),a&2&&_e(r,1)):(r=mS(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function z5(t){let e,n,r;function i(c){t[2](c)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Hc("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[O5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Z_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[3]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&34&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function F5(t,e,n){let{hovered:r=null}=e,{popups:i=!1}=e;function a(l){r=l,n(0,r)}const c=l=>window.open(cs(l.detail.features[0].properties).osm_id,"_blank");return t.$$set=l=>{"hovered"in l&&n(0,r=l.hovered),"popups"in l&&n(1,i=l.popups)},[r,i,a,c]}class ZC extends Jt{constructor(e){super(),Kt(this,e,F5,z5,Wt,{hovered:0,popups:1})}}function gS(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function _S(t,e,n){const r=t.slice();return r[6]=e[n],r}function yS(t){let e,n,r=Zg(t[6])+"",i,a,c;return{c(){e=ke("li"),n=ke("a"),i=xt(r),c=rt(),Fe(n,"href",a=t[6].properties.osm_id),Fe(n,"target","_blank")},m(l,d){Ae(l,e,d),be(e,n),be(n,i),be(e,c)},p(l,d){d&1&&r!==(r=Zg(l[6])+"")&&An(i,r),d&1&&a!==(a=l[6].properties.osm_id)&&Fe(n,"href",a)},d(l){l&&Pe(e)}}}function vS(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",l,d,w,S,I,T=zr(t[3]),k=[];for(let D=0;Di[1].length-r[1].length),n}function V5(t,e,n){let r,{gj:i}=e;return t.$$set=a=>{"gj"in a&&n(1,i=a.gj)},t.$$.update=()=>{t.$$.dirty&2&&n(0,r=i.features.filter(a=>"amenity_kind"in a.properties))},[r,i]}class XC extends Jt{constructor(e){super(),Kt(this,e,V5,B5,Wt,{gj:1})}}function xS(t,e,n){const r=t.slice();return r[3]=e[n],r}function wS(t){let e,n,r=zr(t[0]),i=[];for(let a=0;a0&&wS(t);return{c(){n&&n.c(),e=ur()},m(r,i){n&&n.m(r,i),Ae(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=wS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:tt,o:tt,d(r){r&&Pe(e),n&&n.d(r)}}}function G5(t,e,n){let{loading:r}=e,i;function a(c){Gn[c?"unshift":"push"](()=>{i=c,n(1,i),n(0,r)})}return t.$$set=c=>{"loading"in c&&n(0,r=c.loading)},t.$$.update=()=>{t.$$.dirty&3&&r.length>0&&i&&n(1,i.scrollTop=i.scrollHeight,i)},[r,i,a]}class YC extends Jt{constructor(e){super(),Kt(this,e,G5,U5,Wt,{loading:0})}}function j5(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,j,$,B,q,J,ce,fe,de,ie,ee,Le,X,le,Ye,xe;return{c(){e=ke("nav"),n=ke("ul"),r=ke("li"),i=ke("button"),i.textContent="Change study area",a=rt(),c=ke("li"),l=ke("button"),d=xt("Isochrone"),S=rt(),I=ke("li"),T=ke("button"),k=xt("Route"),U=rt(),j=ke("li"),$=ke("button"),B=xt("Score"),J=rt(),ce=ke("li"),fe=ke("button"),de=xt("Debug network"),ee=rt(),Le=ke("label"),X=ke("input"),le=xt("Population"),l.disabled=w=t[0].kind=="isochrone",T.disabled=D=t[0].kind=="route",$.disabled=q=t[0].kind=="score",fe.disabled=ie=t[0].kind=="debug",Fe(X,"type","checkbox")},m(Ge,Xe){Ae(Ge,e,Xe),be(e,n),be(n,r),be(r,i),be(n,a),be(n,c),be(c,l),be(l,d),be(n,S),be(n,I),be(I,T),be(T,k),be(n,U),be(n,j),be(j,$),be($,B),be(n,J),be(n,ce),be(ce,fe),be(fe,de),be(e,ee),be(e,Le),be(Le,X),X.checked=t[1],be(Le,le),Ye||(xe=[Ut(i,"click",t[2]),Ut(l,"click",t[3]),Ut(T,"click",t[4]),Ut($,"click",t[5]),Ut(fe,"click",t[6]),Ut(X,"change",t[7])],Ye=!0)},p(Ge,[Xe]){Xe&1&&w!==(w=Ge[0].kind=="isochrone")&&(l.disabled=w),Xe&1&&D!==(D=Ge[0].kind=="route")&&(T.disabled=D),Xe&1&&q!==(q=Ge[0].kind=="score")&&($.disabled=q),Xe&1&&ie!==(ie=Ge[0].kind=="debug")&&(fe.disabled=ie),Xe&2&&(X.checked=Ge[1])},i:tt,o:tt,d(Ge){Ge&&Pe(e),Ye=!1,Ai(xe)}}}function q5(t,e,n){let r,i;Lt(t,$s,I=>n(0,r=I)),Lt(t,z0,I=>n(1,i=I));const a=()=>Xn($s,r={kind:"title"},r),c=()=>Xn($s,r={kind:"isochrone"},r),l=()=>Xn($s,r={kind:"route"},r),d=()=>Xn($s,r={kind:"score"},r),w=()=>Xn($s,r={kind:"debug"},r);function S(){i=this.checked,z0.set(i)}return[r,i,a,c,l,d,w,S]}class X_ extends Jt{constructor(e){super(),Kt(this,e,q5,j5,Wt,{})}}function ES(t,e,n){const r=t.slice();return r[10]=e[n][0],r[11]=e[n][1],r[12]=e,r[13]=n,r}function W5(t){let e,n,r=t[0].join(", ")+"",i,a,c,l,d;return{c(){e=ke("p"),n=xt("Amenities: "),i=xt(r),a=rt(),c=ke("button"),c.textContent="Choose"},m(w,S){Ae(w,e,S),be(e,n),be(e,i),Ae(w,a,S),Ae(w,c,S),l||(d=Ut(c,"click",t[6]),l=!0)},p(w,S){S&1&&r!==(r=w[0].join(", ")+"")&&An(i,r)},i:tt,o:tt,d(w){w&&(Pe(e),Pe(a),Pe(c)),l=!1,d()}}}function H5(t){let e,n;return e=new Pv({props:{$$slots:{default:[Z5,({dialog:r})=>({9:r}),({dialog:r})=>r?512:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&16898&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function IS(t){let e,n,r,i=t[10]+"",a,c,l=t[11].num+"",d,w,S,I;function T(){t[3].call(n,t[12],t[13])}return{c(){e=ke("label"),n=ke("input"),r=rt(),a=xt(i),c=xt(" ("),d=xt(l),w=xt(`) + `),Fe(n,"type","checkbox")},m(k,D){Ae(k,e,D),be(e,n),n.checked=t[11].enabled,be(e,r),be(e,a),be(e,c),be(e,d),be(e,w),S||(I=Ut(n,"change",T),S=!0)},p(k,D){t=k,D&2&&(n.checked=t[11].enabled),D&2&&i!==(i=t[10]+"")&&An(a,i),D&2&&l!==(l=t[11].num+"")&&An(d,l)},d(k){k&&Pe(e),S=!1,I()}}}function Z5(t){let e,n,r,i,a,c,l,d,w,S,I=zr(t[1].entries()),T=[];for(let D=0;D{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),_e(n,1),n.m(r.parentNode,r))},i(d){i||(_e(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Pe(r),c[e].d(d)}}}function Y5(t,e){let n=[...t.entries()];n.sort((i,a)=>e(a[1])-e(i[1]));let r=new Map;for(let[i,a]of n)r.set(i,a);return r}function K5(t,e,n){let r;Lt(t,eu,T=>n(7,r=T));let i=new Map,a=!1,{enabled:c}=e;Yu(async()=>{let T=await r.renderAmenities();for(let k of T.features){let D=k.properties.amenity_kind;i.has(D)?i.get(D).num+=1:i.set(D,{enabled:!1,num:1})}n(1,i=Y5(i,k=>k.num))});function l(T){return[...i.entries()].filter(k=>k[1].enabled).map(k=>k[0])}function d(T,k){T[k][1].enabled=this.checked,n(1,i)}const w=T=>cs(T).close(),S=()=>n(2,a=!1),I=()=>n(2,a=!0);return t.$$set=T=>{"enabled"in T&&n(0,c=T.enabled)},t.$$.update=()=>{t.$$.dirty&2&&n(0,c=l())},[c,i,a,d,w,S,I]}class J5 extends Jt{constructor(e){super(),Kt(this,e,K5,X5,Wt,{enabled:0})}}function Q5(t){let e,n,r,i,a,c,l,d,w;return{c(){e=ke("label"),n=xt(`Mode: + `),r=ke("select"),i=ke("option"),i.textContent="Car",a=ke("option"),a.textContent="Bicycle",c=ke("option"),c.textContent="Foot",l=ke("option"),l.textContent="Public transit",i.__value="car",yi(i,i.__value),a.__value="bicycle",yi(a,a.__value),c.__value="foot",yi(c,c.__value),l.__value="transit",yi(l,l.__value),t[0]===void 0&&Pd(()=>t[1].call(r))},m(S,I){Ae(S,e,I),be(e,n),be(e,r),be(r,i),be(r,a),be(r,c),be(r,l),Ug(r,t[0],!0),d||(w=Ut(r,"change",t[1]),d=!0)},p(S,[I]){I&1&&Ug(r,S[0])},i:tt,o:tt,d(S){S&&Pe(e),d=!1,w()}}}function $5(t,e,n){let{travelMode:r}=e;function i(){r=yE(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class C1 extends Jt{constructor(e){super(),Kt(this,e,$5,Q5,Wt,{travelMode:0})}}const Aa=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],ez=["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"];function tz(t){let e=t[2].population.toLocaleString()+"",n,r,i=Math.round(t[2].density).toLocaleString()+"",a,c;return{c(){n=xt(e),r=xt(" people live here ("),a=xt(i),c=xt(" people / square kilometer)")},m(l,d){Ae(l,n,d),Ae(l,r,d),Ae(l,a,d),Ae(l,c,d)},p(l,d){d&4&&e!==(e=l[2].population.toLocaleString()+"")&&An(n,e),d&4&&i!==(i=Math.round(l[2].density).toLocaleString()+"")&&An(a,i)},d(l){l&&(Pe(n),Pe(r),Pe(a),Pe(c))}}}function nz(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[tz,({props:r})=>({2:r}),({props:r})=>r?4:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function rz(t){let e,n,r,i;return e=new I1({props:{manageHoverState:!0,paint:{"fill-color":Kl(["get","density"],t[1],ez),"fill-opacity":Hc(.2,.8)},$$slots:{default:[nz]},$$scope:{ctx:t}}}),r=new cu({props:{paint:{"line-color":"black","line-width":1}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment)},m(a,c){it(e,a,c),Ae(a,n,c),it(r,a,c),i=!0},p(a,c){const l={};c&8&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){i||(_e(e.$$.fragment,a),_e(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Pe(n),ot(e,a),ot(r,a)}}}function iz(t){let e,n;return e=new Wa({props:{data:t[0],generateId:!0,$$slots:{default:[rz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&8&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function oz(t,e,n){let{gj:r}=e,i=Array.from(Array(6).keys()).map(a=>r.max_density/(6-1)*a);return t.$$set=a=>{"gj"in a&&n(0,r=a.gj)},[r,i]}class sz extends Jt{constructor(e){super(),Kt(this,e,oz,iz,Wt,{gj:0})}}function CS(t,e,n){const r=t.slice();return r[3]=e[n],r}function az(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=xt(e),r=xt(" has "),a=xt(i),c=xt(" next steps (arrivals)")},m(l,d){Ae(l,n,d),Ae(l,r,d),Ae(l,a,d),Ae(l,c,d)},p(l,d){d&64&&e!==(e=l[6].name+"")&&An(n,e),d&64&&i!==(i=JSON.parse(l[6].next_steps).length+"")&&An(a,i)},d(l){l&&(Pe(n),Pe(r),Pe(a),Pe(c))}}}function lz(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[az,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function TS(t){let e,n;return e=new Pv({props:{$$slots:{default:[uz]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function LS(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=ke("p"),r=xt(n)},m(i,a){Ae(i,e,a),be(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&An(r,n)},d(i){i&&Pe(e)}}}function uz(t){let e,n=zr(t[0]),r=[];for(let i=0;i{a=null}),Pn())},i(c){i||(_e(e.$$.fragment,c),_e(a),i=!0)},o(c){Se(e.$$.fragment,c),Se(a),i=!1},d(c){c&&(Pe(n),Pe(r)),ot(e,c),a&&a.d(c)}}}function hz(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(cs(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class fz extends Jt{constructor(e){super(),Kt(this,e,hz,cz,Wt,{})}}function pz(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"slot","top")},m(i,a){Ae(i,e,a),it(n,e,null),r=!0},p:tt,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),ot(n)}}}function PS(t){let e,n;return e=new XC({props:{gj:t[0]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function dz(t){let e,n,r,i,a,c,l,d,w;function S(k){t[3](k)}let I={};t[1]!==void 0&&(I.travelMode=t[1]),c=new C1({props:I}),Gn.push(()=>Yi(c,"travelMode",S));let T=t[0]&&PS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debug mode",r=rt(),i=ke("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=rt(),st(c.$$.fragment),d=rt(),T&&T.c(),Fe(e,"slot","sidebar")},m(k,D){Ae(k,e,D),be(e,n),be(e,r),be(e,i),be(e,a),it(c,e,null),be(e,d),T&&T.m(e,null),w=!0},p(k,D){const U={};!l&&D&2&&(l=!0,U.travelMode=k[1],Xi(()=>l=!1)),c.$set(U),k[0]?T?(T.p(k,D),D&1&&_e(T,1)):(T=PS(k),T.c(),_e(T,1),T.m(e,null)):T&&(Ln(),Se(T,1,1,()=>{T=null}),Pn())},i(k){w||(_e(c.$$.fragment,k),_e(T),w=!0)},o(k){Se(c.$$.fragment,k),Se(T),w=!1},d(k){k&&Pe(e),ot(c),T&&T.d()}}}function MS(t){let e,n;return e=new Wa({props:{data:t[0],generateId:!0,$$slots:{default:[_z]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.data=r[0]),i&66&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function mz(t){let e,n;return e=new Mv({props:{properties:t[5]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function gz(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[mz,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function _z(t){let e,n,r,i,a,c;return e=new cu({props:{id:"network",paint:{"line-width":Hc(5,7),"line-color":"black"},filter:xx(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[gz]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new ZC({props:{popups:!0}}),a=new fz({}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment)},m(l,d){it(e,l,d),Ae(l,n,d),it(r,l,d),Ae(l,i,d),it(a,l,d),c=!0},p(l,d){const w={};d&2&&(w.filter=xx(l[1])),d&64&&(w.$$scope={dirty:d,ctx:l}),e.$set(w)},i(l){c||(_e(e.$$.fragment,l),_e(r.$$.fragment,l),_e(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Pe(n),Pe(i)),ot(e,l),ot(r,l),ot(a,l)}}}function yz(t){let e,n,r=t[0]&&MS(t);return{c(){e=ke("div"),r&&r.c(),Fe(e,"slot","map")},m(i,a){Ae(i,e,a),r&&r.m(e,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=MS(i),r.c(),_e(r,1),r.m(e,null)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d()}}}function vz(t){let e,n;return e=new ip({props:{$$slots:{map:[yz],sidebar:[dz],top:[pz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function bz(t,e,n){let r,i;Lt(t,eu,d=>n(4,r=d)),Lt(t,bf,d=>n(1,i=d));let a=null;Yu(async()=>{n(0,a=await r.renderDebug())});const c=d=>window.open(cs(d.detail.features[0].properties).way,"_blank");function l(d){i=d,bf.set(i)}return[a,i,c,l]}class xz extends Jt{constructor(e){super(),Kt(this,e,bz,vz,Wt,{})}}function wz(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"slot","top")},m(i,a){Ae(i,e,a),it(n,e,null),r=!0},p:tt,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),ot(n)}}}function AS(t){let e,n=Zg(t[2])+"",r,i,a=t[2].properties.amenity_kind+"",c,l;return{c(){e=ke("span"),r=xt(n),i=xt(" ("),c=xt(a),l=xt(")")},m(d,w){Ae(d,e,w),be(e,r),be(e,i),be(e,c),be(e,l)},p(d,w){w&4&&n!==(n=Zg(d[2])+"")&&An(r,n),w&4&&a!==(a=d[2].properties.amenity_kind+"")&&An(c,a)},d(d){d&&Pe(e)}}}function kS(t){let e,n;return{c(){e=ke("p"),n=xt(t[8])},m(r,i){Ae(r,e,i),be(e,n)},p(r,i){i&256&&An(n,r[8])},d(r){r&&Pe(e)}}}function DS(t){let e,n;return e=new XC({props:{gj:t[6]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.gj=r[6]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Sz(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,j,$,B,q,J,ce,fe,de,ie,ee,Le,X,le,Ye=t[2]&&AS(t);function xe($e){t[12]($e)}let Ge={};t[5]!==void 0&&(Ge.travelMode=t[5]),l=new C1({props:Ge}),Gn.push(()=>Yi(l,"travelMode",xe)),de=new Av({props:{colorScale:Aa,limits:t[9].map(FS)}});let Xe=t[8]&&kS(t),Ne=t[6]&&DS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Isochrone mode",r=rt(),i=ke("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time + in seconds.`,a=rt(),Ye&&Ye.c(),c=rt(),st(l.$$.fragment),w=rt(),S=ke("label"),I=xt(`Start time (PT only) + `),T=ke("input"),D=rt(),U=ke("label"),j=ke("input"),$=xt("Contours"),B=rt(),q=ke("label"),J=xt(`Minutes away + `),ce=ke("input"),fe=rt(),st(de.$$.fragment),ie=rt(),Xe&&Xe.c(),ee=rt(),Ne&&Ne.c(),Fe(T,"type","time"),T.disabled=k=t[5]!="transit",Fe(j,"type","checkbox"),Fe(ce,"type","number"),Fe(ce,"min","1"),Fe(ce,"max","30"),Fe(e,"slot","sidebar")},m($e,ht){Ae($e,e,ht),be(e,n),be(e,r),be(e,i),be(e,a),Ye&&Ye.m(e,null),be(e,c),it(l,e,null),be(e,w),be(e,S),be(S,I),be(S,T),yi(T,t[4]),be(e,D),be(e,U),be(U,j),j.checked=t[1],be(U,$),be(e,B),be(e,q),be(q,J),be(q,ce),yi(ce,t[3]),be(e,fe),it(de,e,null),be(e,ie),Xe&&Xe.m(e,null),be(e,ee),Ne&&Ne.m(e,null),Le=!0,X||(le=[Ut(T,"input",t[13]),Ut(j,"change",t[14]),Ut(ce,"input",t[15])],X=!0)},p($e,ht){$e[2]?Ye?Ye.p($e,ht):(Ye=AS($e),Ye.c(),Ye.m(e,c)):Ye&&(Ye.d(1),Ye=null);const Gt={};!d&&ht&32&&(d=!0,Gt.travelMode=$e[5],Xi(()=>d=!1)),l.$set(Gt),(!Le||ht&32&&k!==(k=$e[5]!="transit"))&&(T.disabled=k),ht&16&&yi(T,$e[4]),ht&2&&(j.checked=$e[1]),ht&8&&Xc(ce.value)!==$e[3]&&yi(ce,$e[3]);const Ht={};ht&512&&(Ht.limits=$e[9].map(FS)),de.$set(Ht),$e[8]?Xe?Xe.p($e,ht):(Xe=kS($e),Xe.c(),Xe.m(e,ee)):Xe&&(Xe.d(1),Xe=null),$e[6]?Ne?(Ne.p($e,ht),ht&64&&_e(Ne,1)):(Ne=DS($e),Ne.c(),_e(Ne,1),Ne.m(e,null)):Ne&&(Ln(),Se(Ne,1,1,()=>{Ne=null}),Pn())},i($e){Le||(_e(l.$$.fragment,$e),_e(de.$$.fragment,$e),_e(Ne),Le=!0)},o($e){Se(l.$$.fragment,$e),Se(de.$$.fragment,$e),Se(Ne),Le=!1},d($e){$e&&Pe(e),Ye&&Ye.d(),ot(l),ot(de),Xe&&Xe.d(),Ne&&Ne.d(),X=!1,Ai(le)}}}function RS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[Ez]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Xd({props:a}),Gn.push(()=>Yi(e,"lngLat",i)),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,l){const d={};l&1048576&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.lngLat=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function Ez(t){let e;return{c(){e=ke("span"),e.textContent="X",Fe(e,"class","dot svelte-1ej0v4r")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function NS(t){let e,n;return e=new Wa({props:{data:t[6],generateId:!0,$$slots:{default:[Tz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&1049092&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Iz(t){let e=(t[19].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=xt(e),r=xt(" minutes away")},m(i,a){Ae(i,n,a),Ae(i,r,a)},p(i,a){a&524288&&e!==(e=(i[19].cost_seconds/60).toFixed(1)+"")&&An(n,e)},d(i){i&&(Pe(n),Pe(r))}}}function Cz(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[Iz,({props:r})=>({19:r}),({props:r})=>r?524288:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&1572864&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Tz(t){let e,n,r,i,a,c,l;e=new cu({props:{id:"isochrone",filter:PO,paint:{"line-width":2,"line-color":Kl(["get","cost_seconds"],t[9],Aa),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[Cz]},$$scope:{ctx:t}}}),r=new I1({props:{id:"isochrone-contours",filter:LO,paint:{"fill-color":Kl(["get","min_seconds"],t[9],Aa),"fill-opacity":.5}}});function d(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new ZC({props:w}),Gn.push(()=>Yi(a,"hovered",d)),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment)},m(S,I){it(e,S,I),Ae(S,n,I),it(r,S,I),Ae(S,i,I),it(a,S,I),l=!0},p(S,I){const T={};I&512&&(T.paint={"line-width":2,"line-color":Kl(["get","cost_seconds"],S[9],Aa),"line-opacity":.5}),I&1048576&&(T.$$scope={dirty:I,ctx:S}),e.$set(T);const k={};I&512&&(k.paint={"fill-color":Kl(["get","min_seconds"],S[9],Aa),"fill-opacity":.5}),r.$set(k);const D={};!c&&I&4&&(c=!0,D.hovered=S[2],Xi(()=>c=!1)),a.$set(D)},i(S){l||(_e(e.$$.fragment,S),_e(r.$$.fragment,S),_e(a.$$.fragment,S),l=!0)},o(S){Se(e.$$.fragment,S),Se(r.$$.fragment,S),Se(a.$$.fragment,S),l=!1},d(S){S&&(Pe(n),Pe(i)),ot(e,S),ot(r,S),ot(a,S)}}}function OS(t){let e,n;return e=new Wa({props:{data:t[7],$$slots:{default:[Lz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&128&&(a.data=r[7]),i&1048576&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Lz(t){let e,n;return e=new cu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Pz(t){let e,n,r,i,a=t[0]&&RS(t),c=t[6]&&NS(t),l=t[7]&&OS(t);return{c(){e=ke("div"),a&&a.c(),n=rt(),c&&c.c(),r=rt(),l&&l.c(),Fe(e,"slot","map")},m(d,w){Ae(d,e,w),a&&a.m(e,null),be(e,n),c&&c.m(e,null),be(e,r),l&&l.m(e,null),i=!0},p(d,w){d[0]?a?(a.p(d,w),w&1&&_e(a,1)):(a=RS(d),a.c(),_e(a,1),a.m(e,n)):a&&(Ln(),Se(a,1,1,()=>{a=null}),Pn()),d[6]?c?(c.p(d,w),w&64&&_e(c,1)):(c=NS(d),c.c(),_e(c,1),c.m(e,r)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),d[7]?l?(l.p(d,w),w&128&&_e(l,1)):(l=OS(d),l.c(),_e(l,1),l.m(e,null)):l&&(Ln(),Se(l,1,1,()=>{l=null}),Pn())},i(d){i||(_e(a),_e(c),_e(l),i=!0)},o(d){Se(a),Se(c),Se(l),i=!1},d(d){d&&Pe(e),a&&a.d(),c&&c.d(),l&&l.d()}}}function Mz(t){let e,n;return e=new ip({props:{$$slots:{map:[Pz],sidebar:[Sz],top:[wz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&1049599&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function zS(t,e,n){return e+t*(n-e)}const FS=t=>t/60;function Az(t,e,n){let r,i,a,c,l;Lt(t,Ex,fe=>n(3,i=fe)),Lt(t,Hg,fe=>n(4,a=fe)),Lt(t,bf,fe=>n(5,c=fe)),Lt(t,eu,fe=>n(16,l=fe));let d=null;Yu(async()=>{let fe=await l.getBounds();n(0,d={lng:zS(.5,fe[0],fe[2]),lat:zS(.5,fe[1],fe[3])})});let w=!1,S=null,I=null,T="",k;async function D(fe,de,ie,ee,Le){if(d)try{n(6,S=await l.isochrone({start:d,mode:c,contours:w,startTime:a,maxSeconds:60*i})),n(8,T="")}catch(X){n(6,S=null),X=X.toString()}}async function U(fe,de,ie){if(d&&k)try{n(7,I=await l.route({start:d,end:k.geometry.coordinates,mode:c,debugSearch:!1,useHeuristic:!1,startTime:a})),n(8,T="")}catch(ee){n(7,I=null),ee=ee.toString()}else n(7,I=null)}function j(fe){d=fe,n(0,d)}function $(fe){k=fe,n(2,k)}function B(fe){c=fe,bf.set(c)}function q(){a=this.value,Hg.set(a)}function J(){w=this.checked,n(1,w)}function ce(){i=Xc(this.value),Ex.set(i)}return t.$$.update=()=>{t.$$.dirty&59&&D(),t.$$.dirty&21&&U(),t.$$.dirty&8&&n(9,r=Array.from(Array(6).keys()).map(fe=>i*60/(6-1)*fe))},[d,w,k,i,a,c,S,I,T,r,j,$,B,q,J,ce]}class kz extends Jt{constructor(e){super(),Kt(this,e,Az,Mz,Wt,{})}}function BS(t,e,n){const r=t.slice();r[23]=e[n];const i=cs(r[23].properties);return r[22]=i,r}function Dz(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"slot","top")},m(i,a){Ae(i,e,a),it(n,e,null),r=!0},p:tt,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),ot(n)}}}function VS(t){let e,n;return e=new Av({props:{colorScale:Aa,limits:t[9].map(qS)}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&512&&(a.limits=r[9].map(qS)),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Rz(t){let e,n,r,i,a,c,l,d=!t[6]&&US(t);return{c(){e=ke("button"),n=xt("Watch how this route was found (PT only)"),i=rt(),d&&d.c(),a=ur(),e.disabled=r=t[5]!="transit"},m(w,S){Ae(w,e,S),be(e,n),Ae(w,i,S),d&&d.m(w,S),Ae(w,a,S),c||(l=Ut(e,"click",t[11]),c=!0)},p(w,S){S&32&&r!==(r=w[5]!="transit")&&(e.disabled=r),w[6]?d&&(d.d(1),d=null):d?d.p(w,S):(d=US(w),d.c(),d.m(a.parentNode,a))},d(w){w&&(Pe(e),Pe(i),Pe(a)),d&&d.d(w),c=!1,l()}}}function Nz(t){let e,n;return{c(){e=ke("p"),n=xt(t[8])},m(r,i){Ae(r,e,i),be(e,n)},p(r,i){i&256&&An(n,r[8])},d(r){r&&Pe(e)}}}function US(t){let e,n=zr(t[7].features),r=[];for(let i=0;iYi(i,"travelMode",le));let xe=t[6]&&VS(t);function Ge($e,ht){if($e[8])return Nz;if($e[7])return Rz}let Xe=Ge(t),Ne=Xe&&Xe(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Route mode",r=rt(),st(i.$$.fragment),c=rt(),l=ke("label"),d=ke("input"),S=xt(` + Use heuristic (PT only)`),I=rt(),T=ke("label"),k=xt(`Start time (PT only) + `),D=ke("input"),j=rt(),$=ke("label"),B=ke("input"),q=xt(` + Buffer around route (minutes) + `),J=ke("input"),ce=rt(),xe&&xe.c(),fe=rt(),de=ke("p"),de.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to + set the first pin somewhere.)`,ie=rt(),Ne&&Ne.c(),Fe(d,"type","checkbox"),d.disabled=w=t[5]!="transit",Fe(D,"type","time"),D.disabled=U=t[5]!="transit",Fe(B,"type","checkbox"),Fe(J,"type","number"),Fe(J,"min","1"),Fe(J,"max","30"),Fe(e,"slot","sidebar")},m($e,ht){Ae($e,e,ht),be(e,n),be(e,r),it(i,e,null),be(e,c),be(e,l),be(l,d),d.checked=t[4],be(l,S),be(e,I),be(e,T),be(T,k),be(T,D),yi(D,t[3]),be(e,j),be(e,$),be($,B),B.checked=t[6],be($,q),be($,J),yi(J,t[0]),be(e,ce),xe&&xe.m(e,null),be(e,fe),be(e,de),be(e,ie),Ne&&Ne.m(e,null),ee=!0,Le||(X=[Ut(d,"change",t[15]),Ut(D,"input",t[16]),Ut(B,"change",t[17]),Ut(J,"input",t[18])],Le=!0)},p($e,ht){const Gt={};!a&&ht&32&&(a=!0,Gt.travelMode=$e[5],Xi(()=>a=!1)),i.$set(Gt),(!ee||ht&32&&w!==(w=$e[5]!="transit"))&&(d.disabled=w),ht&16&&(d.checked=$e[4]),(!ee||ht&32&&U!==(U=$e[5]!="transit"))&&(D.disabled=U),ht&8&&yi(D,$e[3]),ht&64&&(B.checked=$e[6]),ht&1&&Xc(J.value)!==$e[0]&&yi(J,$e[0]),$e[6]?xe?(xe.p($e,ht),ht&64&&_e(xe,1)):(xe=VS($e),xe.c(),_e(xe,1),xe.m(e,fe)):xe&&(Ln(),Se(xe,1,1,()=>{xe=null}),Pn()),Xe===(Xe=Ge($e))&&Ne?Ne.p($e,ht):(Ne&&Ne.d(1),Ne=Xe&&Xe($e),Ne&&(Ne.c(),Ne.m(e,null)))},i($e){ee||(_e(i.$$.fragment,$e),_e(xe),ee=!0)},o($e){Se(i.$$.fragment,$e),Se(xe),ee=!1},d($e){$e&&Pe(e),ot(i),xe&&xe.d(),Ne&&Ne.d(),Le=!1,Ai(X)}}}function Uz(t){let e;return{c(){e=ke("span"),e.textContent="A",Fe(e,"class","dot svelte-1ej0v4r")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function Gz(t){let e;return{c(){e=ke("span"),e.textContent="B",Fe(e,"class","dot svelte-1ej0v4r")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function jS(t){let e,n;return e=new Wa({props:{data:t[7],generateId:!0,$$slots:{default:[Jz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&128&&(a.data=r[7]),i&67109440&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function jz(t){let e,n;return e=new cu({props:{id:"route",paint:{"line-width":20,"line-color":w1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Hc(.5,1)},manageHoverState:!0,$$slots:{default:[Hz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&67108864&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function qz(t){let e,n;return e=new cu({props:{paint:{"line-width":["case",["==",["get","kind"],"route"],20,3],"line-color":["case",["==",["get","kind"],"route"],"red",Kl(["get","cost_seconds"],t[9],Aa)],"line-opacity":.5},$$slots:{default:[Kz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&512&&(a.paint={"line-width":["case",["==",["get","kind"],"route"],20,3],"line-color":["case",["==",["get","kind"],"route"],"red",Kl(["get","cost_seconds"],r[9],Aa)],"line-opacity":.5}),i&67108864&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Wz(t){let e,n;return e=new Mv({props:{properties:t[22]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&4194304&&(a.properties=r[22]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Hz(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[Wz,({props:r})=>({22:r}),({props:r})=>r?4194304:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&71303168&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Zz(t){let e;return{c(){e=xt("part of the route")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function Xz(t){let e=(t[22].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=xt(e),r=xt(" minutes away")},m(i,a){Ae(i,n,a),Ae(i,r,a)},p(i,a){a&4194304&&e!==(e=(i[22].cost_seconds/60).toFixed(1)+"")&&An(n,e)},d(i){i&&(Pe(n),Pe(r))}}}function Yz(t){let e;function n(a,c){return a[22].kind=="buffer"?Xz:Zz}let r=n(t),i=r(t);return{c(){i.c(),e=ur()},m(a,c){i.m(a,c),Ae(a,e,c)},p(a,c){r===(r=n(a))&&i?i.p(a,c):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&Pe(e),i.d(a)}}}function Kz(t){let e,n;return e=new nh({props:{openOn:"hover",$$slots:{default:[Yz,({props:r})=>({22:r}),({props:r})=>r?4194304:0]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&71303168&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function Jz(t){let e,n,r,i;const a=[qz,jz],c=[];function l(d,w){return d[6]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=ur()},m(d,w){c[e].m(d,w),Ae(d,r,w),i=!0},p(d,w){let S=e;e=l(d),e===S?c[e].p(d,w):(Ln(),Se(c[S],1,1,()=>{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),_e(n,1),n.m(r.parentNode,r))},i(d){i||(_e(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Pe(r),c[e].d(d)}}}function Qz(t){let e,n,r,i,a,c,l,d,w,S;n=new i5({}),n.$on("contextmenu",t[10]);function I(j){t[12](j)}let T={draggable:!0,$$slots:{default:[Uz]},$$scope:{ctx:t}};t[2]!==void 0&&(T.lngLat=t[2]),i=new Xd({props:T}),Gn.push(()=>Yi(i,"lngLat",I));function k(j){t[13](j)}let D={draggable:!0,$$slots:{default:[Gz]},$$scope:{ctx:t}};t[1]!==void 0&&(D.lngLat=t[1]),l=new Xd({props:D}),Gn.push(()=>Yi(l,"lngLat",k));let U=t[7]&&jS(t);return{c(){e=ke("div"),st(n.$$.fragment),r=rt(),st(i.$$.fragment),c=rt(),st(l.$$.fragment),w=rt(),U&&U.c(),Fe(e,"slot","map")},m(j,$){Ae(j,e,$),it(n,e,null),be(e,r),it(i,e,null),be(e,c),it(l,e,null),be(e,w),U&&U.m(e,null),S=!0},p(j,$){const B={};$&67108864&&(B.$$scope={dirty:$,ctx:j}),!a&&$&4&&(a=!0,B.lngLat=j[2],Xi(()=>a=!1)),i.$set(B);const q={};$&67108864&&(q.$$scope={dirty:$,ctx:j}),!d&&$&2&&(d=!0,q.lngLat=j[1],Xi(()=>d=!1)),l.$set(q),j[7]?U?(U.p(j,$),$&128&&_e(U,1)):(U=jS(j),U.c(),_e(U,1),U.m(e,null)):U&&(Ln(),Se(U,1,1,()=>{U=null}),Pn())},i(j){S||(_e(n.$$.fragment,j),_e(i.$$.fragment,j),_e(l.$$.fragment,j),_e(U),S=!0)},o(j){Se(n.$$.fragment,j),Se(i.$$.fragment,j),Se(l.$$.fragment,j),Se(U),S=!1},d(j){j&&Pe(e),ot(n),ot(i),ot(l),U&&U.d()}}}function $z(t){let e,n;return e=new ip({props:{$$slots:{map:[Qz],sidebar:[Vz],top:[Dz]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&67109887&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}const qS=t=>t/60;function e6(t,e,n){let r,i,a,c,l,d,w,S,I,T;Lt(t,Ix,ee=>n(0,i=ee)),Lt(t,xf,ee=>n(1,a=ee)),Lt(t,Pc,ee=>n(2,c=ee)),Lt(t,$s,ee=>n(19,l=ee)),Lt(t,Hg,ee=>n(3,d=ee)),Lt(t,wx,ee=>n(4,w=ee)),Lt(t,bf,ee=>n(5,S=ee)),Lt(t,eu,ee=>n(20,I=ee)),Lt(t,Sx,ee=>n(6,T=ee));let k=null,D="";async function U(ee,Le,X,le,Ye,xe,Ge){try{T?n(7,k=await I.bufferRoute({start:c,end:[a.lng,a.lat],mode:S,useHeuristic:w,startTime:d,maxSeconds:i*60})):n(7,k=await I.route({start:ee,end:[Le.lng,Le.lat],mode:X,debugSearch:!1,useHeuristic:w,startTime:d})),n(8,D="")}catch(Xe){n(7,k=null),n(8,D=Xe.toString())}}function j(ee){Xn(Pc,c=ee.detail.lngLat,c)}async function $(){try{let ee=await I.route({start:c,end:[a.lng,a.lat],mode:S,debugSearch:!0,useHeuristic:w,startTime:d});Xn($s,l={kind:"debug-route",debugGj:ee,start:c,end:a,routeGj:k},l)}catch(ee){n(8,D=ee.toString())}}function B(ee){c=ee,Pc.set(c)}function q(ee){a=ee,xf.set(a)}function J(ee){S=ee,bf.set(S)}function ce(){w=this.checked,wx.set(w)}function fe(){d=this.value,Hg.set(d)}function de(){T=this.checked,Sx.set(T)}function ie(){i=Xc(this.value),Ix.set(i)}return t.$$.update=()=>{t.$$.dirty&127&&U(c,a,S),t.$$.dirty&1&&n(9,r=Array.from(Array(6).keys()).map(ee=>i*60/(6-1)*ee))},[i,a,c,d,w,S,T,k,D,r,j,$,B,q,J,ce,fe,de,ie]}class t6 extends Jt{constructor(e){super(),Kt(this,e,e6,$z,Wt,{})}}function n6(t){let e,n,r,i;return{c(){e=ke("div"),n=ke("button"),n.textContent="Back",Fe(e,"slot","top")},m(a,c){Ae(a,e,c),be(e,n),r||(i=Ut(n,"click",t[10]),r=!0)},p:tt,d(a){a&&Pe(e),r=!1,i()}}}function r6(t){let e,n,r,i,a,c,l,d,w,S=cs(t[4].features[t[4].features.length-1].properties).time+"",I,T,k;return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debugging a route",r=rt(),i=ke("p"),i.textContent=`${t[6]} total nodes searched`,a=rt(),c=ke("input"),l=rt(),d=ke("p"),w=xt("Search is currently at "),I=xt(S),Fe(c,"type","range"),Fe(c,"min","1"),Fe(c,"max",t[6]),Fe(e,"slot","sidebar")},m(D,U){Ae(D,e,U),be(e,n),be(e,r),be(e,i),be(e,a),be(e,c),yi(c,t[3]),be(e,l),be(e,d),be(d,w),be(d,I),T||(k=[Ut(c,"change",t[9]),Ut(c,"input",t[9])],T=!0)},p(D,U){U&8&&yi(c,D[3]),U&16&&S!==(S=cs(D[4].features[D[4].features.length-1].properties).time+"")&&An(I,S)},d(D){D&&Pe(e),T=!1,Ai(k)}}}function i6(t){let e;return{c(){e=ke("span"),e.textContent="A",Fe(e,"class","dot svelte-1ej0v4r")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function o6(t){let e;return{c(){e=ke("span"),e.textContent="B",Fe(e,"class","dot svelte-1ej0v4r")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function s6(t){let e,n;return e=new cu({props:{paint:{"line-width":20,"line-color":w1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function a6(t){let e,n,r,i;return e=new Z_({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new cu({props:{paint:{"line-width":5,"line-color":w1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment)},m(a,c){it(e,a,c),Ae(a,n,c),it(r,a,c),i=!0},p:tt,i(a){i||(_e(e.$$.fragment,a),_e(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Pe(n),ot(e,a),ot(r,a)}}}function l6(t){let e,n,r,i,a,c,l,d,w;return n=new Xd({props:{lngLat:t[0],$$slots:{default:[i6]},$$scope:{ctx:t}}}),i=new Xd({props:{lngLat:t[1],$$slots:{default:[o6]},$$scope:{ctx:t}}}),c=new Wa({props:{data:t[2],$$slots:{default:[s6]},$$scope:{ctx:t}}}),d=new Wa({props:{data:t[4],generateId:!0,$$slots:{default:[a6]},$$scope:{ctx:t}}}),{c(){e=ke("div"),st(n.$$.fragment),r=rt(),st(i.$$.fragment),a=rt(),st(c.$$.fragment),l=rt(),st(d.$$.fragment),Fe(e,"slot","map")},m(S,I){Ae(S,e,I),it(n,e,null),be(e,r),it(i,e,null),be(e,a),it(c,e,null),be(e,l),it(d,e,null),w=!0},p(S,I){const T={};I&1&&(T.lngLat=S[0]),I&4096&&(T.$$scope={dirty:I,ctx:S}),n.$set(T);const k={};I&2&&(k.lngLat=S[1]),I&4096&&(k.$$scope={dirty:I,ctx:S}),i.$set(k);const D={};I&4&&(D.data=S[2]),I&4096&&(D.$$scope={dirty:I,ctx:S}),c.$set(D);const U={};I&16&&(U.data=S[4]),I&4096&&(U.$$scope={dirty:I,ctx:S}),d.$set(U)},i(S){w||(_e(n.$$.fragment,S),_e(i.$$.fragment,S),_e(c.$$.fragment,S),_e(d.$$.fragment,S),w=!0)},o(S){Se(n.$$.fragment,S),Se(i.$$.fragment,S),Se(c.$$.fragment,S),Se(d.$$.fragment,S),w=!1},d(S){S&&Pe(e),ot(n),ot(i),ot(c),ot(d)}}}function u6(t){let e,n,r,i;return e=new ip({props:{$$slots:{map:[l6],sidebar:[r6],top:[n6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(a,c){it(e,a,c),n=!0,r||(i=Ut(window,"keydown",t[7]),r=!0)},p(a,[c]){const l={};c&4159&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){n||(_e(e.$$.fragment,a),n=!0)},o(a){Se(e.$$.fragment,a),n=!1},d(a){ot(e,a),r=!1,i()}}}function c6(t,e,n){let r,i,a;Lt(t,I_,U=>n(11,i=U)),Lt(t,$s,U=>n(5,a=U));let{debugGj:c}=e,{start:l}=e,{end:d}=e,{routeGj:w}=e,S=c.features.length/2,I=1;function T(U){U.key=="ArrowLeft"&&I>1&&(U.stopPropagation(),n(3,I--,I)),U.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),us(()=>{i==null||i.keyboard.enable()});function k(){I=Xc(this.value),n(3,I)}const D=()=>Xn($s,a={kind:"route"},a);return t.$$set=U=>{"debugGj"in U&&n(8,c=U.debugGj),"start"in U&&n(0,l=U.start),"end"in U&&n(1,d=U.end),"routeGj"in U&&n(2,w=U.routeGj)},t.$$.update=()=>{t.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:c.features.slice(0,2*I)})},[l,d,w,I,r,a,S,T,c,k,D]}class h6 extends Jt{constructor(e){super(),Kt(this,e,c6,u6,Wt,{debugGj:8,start:0,end:1,routeGj:2})}}function WS(t){let e,n;return e=new YC({props:{loading:t[3]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.loading=r[3]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function f6(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"slot","top")},m(i,a){Ae(i,e,a),it(n,e,null),r=!0},p:tt,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),ot(n)}}}function HS(t){let e,n,r=t[2].properties.poi+"",i,a,c=t[2].properties.cost+"",l,d;return{c(){e=ke("span"),n=xt("From "),i=xt(r),a=xt(", it's "),l=xt(c),d=xt(" seconds to the nearest parking")},m(w,S){Ae(w,e,S),be(e,n),be(e,i),be(e,a),be(e,l),be(e,d)},p(w,S){S&4&&r!==(r=w[2].properties.poi+"")&&An(i,r),S&4&&c!==(c=w[2].properties.cost+"")&&An(l,c)},d(w){w&&Pe(e)}}}function p6(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,j,$,B,q,J,ce,fe,de,ie=t[2]&&HS(t);function ee(X){t[10](X)}let Le={};return t[1]!==void 0&&(Le.enabled=t[1]),a=new J5({props:Le}),Gn.push(()=>Yi(a,"enabled",ee)),d=new Av({props:{colorScale:Aa,limits:t[7]}}),{c(){e=ke("div"),n=ke("h2"),n.textContent="Score mode",r=rt(),ie&&ie.c(),i=rt(),st(a.$$.fragment),l=rt(),st(d.$$.fragment),w=rt(),S=ke("label"),I=ke("input"),T=xt(` + Max time (seconds)`),k=rt(),D=ke("label"),U=ke("input"),j=xt(` + Show parking`),$=rt(),B=ke("p"),B.textContent=`This is an early experiment of a mode to show an "access score". Right + now, it's starting from every POI chosen and walking up to some time to + the nearest bicycle parking. This is a simple way of showing POIs without + any nearby parking. Note the granularity of results is poor; the search + begins and ends at the nearest intersection, and the time to walk doesn't + take into account the side of the road or walking partly down some road.`,q=rt(),J=ke("p"),J.innerHTML='Parking icon from OpenStreetMap Carto',Fe(I,"type","number"),Fe(U,"type","checkbox"),Fe(e,"slot","sidebar")},m(X,le){Ae(X,e,le),be(e,n),be(e,r),ie&&ie.m(e,null),be(e,i),it(a,e,null),be(e,l),it(d,e,null),be(e,w),be(e,S),be(S,I),yi(I,t[0]),be(S,T),be(e,k),be(e,D),be(D,U),U.checked=t[4],be(D,j),be(e,$),be(e,B),be(e,q),be(e,J),ce=!0,fe||(de=[Ut(I,"input",t[11]),Ut(U,"change",t[12])],fe=!0)},p(X,le){X[2]?ie?ie.p(X,le):(ie=HS(X),ie.c(),ie.m(e,i)):ie&&(ie.d(1),ie=null);const Ye={};!c&&le&2&&(c=!0,Ye.enabled=X[1],Xi(()=>c=!1)),a.$set(Ye);const xe={};le&128&&(xe.limits=X[7]),d.$set(xe),le&1&&Xc(I.value)!==X[0]&&yi(I,X[0]),le&16&&(U.checked=X[4])},i(X){ce||(_e(a.$$.fragment,X),_e(d.$$.fragment,X),ce=!0)},o(X){Se(a.$$.fragment,X),Se(d.$$.fragment,X),ce=!1},d(X){X&&Pe(e),ie&&ie.d(),ot(a),ot(d),fe=!1,Ai(de)}}}function ZS(t){let e,n;return e=new Wa({props:{data:t[5],generateId:!0,$$slots:{default:[d6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&131204&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function d6(t){let e,n,r;function i(c){t[9](c)}let a={paint:{"circle-radius":15,"circle-color":Kl(["get","cost"],t[7],Aa),"circle-stroke-width":Hc(1,3),"circle-stroke-color":"black"},manageHoverState:!0};return t[2]!==void 0&&(a.hovered=t[2]),e=new Z_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,l){const d={};l&128&&(d.paint={"circle-radius":15,"circle-color":Kl(["get","cost"],c[7],Aa),"circle-stroke-width":Hc(1,3),"circle-stroke-color":"black"}),!n&&l&4&&(n=!0,d.hovered=c[2],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function XS(t){let e,n;return e=new Wa({props:{data:t[6],$$slots:{default:[m6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&131072&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function m6(t){let e,n;return e=new cu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function g6(t){return{c:tt,m:tt,p:tt,i:tt,o:tt,d:tt}}function _6(t){let e,n;return e=new Wa({props:{data:t[16],$$slots:{default:[y6]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&256&&(a.data=r[16]),i&131088&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function y6(t){let e,n;return e=new S5({props:{filter:["==",["get","amenity_kind"],"bicycle_parking"],layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:t[4]?"visible":"none"}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.layout={"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[4]?"visible":"none"}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function v6(t){return{c:tt,m:tt,p:tt,i:tt,o:tt,d:tt}}function b6(t){let e,n,r,i,a,c=t[5]&&ZS(t),l=t[6]&&XS(t),d={ctx:t,current:null,token:null,hasCatch:!1,pending:v6,then:_6,catch:g6,value:16,blocks:[,,,]};return vf(i=cs(t[8]).renderAmenities(),d),{c(){e=ke("div"),c&&c.c(),n=rt(),l&&l.c(),r=rt(),d.block.c(),Fe(e,"slot","map")},m(w,S){Ae(w,e,S),c&&c.m(e,null),be(e,n),l&&l.m(e,null),be(e,r),d.block.m(e,d.anchor=null),d.mount=()=>e,d.anchor=null,a=!0},p(w,S){t=w,t[5]?c?(c.p(t,S),S&32&&_e(c,1)):(c=ZS(t),c.c(),_e(c,1),c.m(e,n)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),t[6]?l?(l.p(t,S),S&64&&_e(l,1)):(l=XS(t),l.c(),_e(l,1),l.m(e,r)):l&&(Ln(),Se(l,1,1,()=>{l=null}),Pn()),d.ctx=t,S&256&&i!==(i=cs(t[8]).renderAmenities())&&vf(i,d)||Lv(d,t,S)},i(w){a||(_e(c),_e(l),_e(d.block),a=!0)},o(w){Se(c),Se(l);for(let S=0;S<3;S+=1){const I=d.blocks[S];Se(I)}a=!1},d(w){w&&Pe(e),c&&c.d(),l&&l.d(),d.block.d(),d.token=null,d=null}}}function x6(t){let e,n,r,i=t[5]==null&&WS(t);return n=new ip({props:{$$slots:{map:[b6],sidebar:[p6],top:[f6]},$$scope:{ctx:t}}}),{c(){i&&i.c(),e=rt(),st(n.$$.fragment)},m(a,c){i&&i.m(a,c),Ae(a,e,c),it(n,a,c),r=!0},p(a,[c]){a[5]==null?i?(i.p(a,c),c&32&&_e(i,1)):(i=WS(a),i.c(),_e(i,1),i.m(e.parentNode,e)):i&&(Ln(),Se(i,1,1,()=>{i=null}),Pn());const l={};c&131575&&(l.$$scope={dirty:c,ctx:a}),n.$set(l)},i(a){r||(_e(i),_e(n.$$.fragment,a),r=!0)},o(a){Se(i),Se(n.$$.fragment,a),r=!1},d(a){a&&Pe(e),i&&i.d(a),ot(n,a)}}}function w6(t,e,n){let r,i;Lt(t,eu,q=>n(8,i=q));let a=[],c=600,l=[],d=!0,w=null;async function S(q,J){n(3,a=[...a,"Calculating scores"]),n(5,w=await i.score({poiKinds:l,maxSeconds:c},Dv(I))),n(3,a=[])}function I(q){n(3,a=[...a,q])}let T=null,k;async function D(q){if(k)try{n(6,T=await i.route({start:{lng:k.geometry.coordinates[0],lat:k.geometry.coordinates[1]},end:[k.properties.closest_lon,k.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(J){console.log(`No route: ${J}`),n(6,T=null)}else n(6,T=null)}function U(q){k=q,n(2,k)}function j(q){l=q,n(1,l)}function $(){c=Xc(this.value),n(0,c)}function B(){d=this.checked,n(4,d)}return t.$$.update=()=>{t.$$.dirty&3&&S(),t.$$.dirty&1&&n(7,r=Array.from(Array(6).keys()).map(q=>c/(6-1)*q)),t.$$.dirty&4&&D()},[c,l,k,a,d,w,T,r,i,U,j,$,B]}class S6 extends Jt{constructor(e){super(),Kt(this,e,w6,x6,Wt,{})}}var Io=63710088e-1,T1={centimeters:Io*100,centimetres:Io*100,degrees:Io/111325,feet:Io*3.28084,inches:Io*39.37,kilometers:Io/1e3,kilometres:Io/1e3,meters:Io,metres:Io,miles:Io/1609.344,millimeters:Io*1e3,millimetres:Io*1e3,nauticalmiles:Io/1852,radians:1,yards:Io*1.0936},E6={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/Io,yards:1.0936133},Ev={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 ma(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function I6(t,e,n){switch(t){case"Point":return os(e).geometry;case"LineString":return ta(e).geometry;case"Polygon":return L1(e).geometry;case"MultiPoint":return JC(e).geometry;case"MultiLineString":return KC(e).geometry;case"MultiPolygon":return QC(e).geometry;default:throw new Error(t+" is invalid")}}function os(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(!w_(t[0])||!w_(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ma(r,e,n)}function C6(t,e,n){return n===void 0&&(n={}),Zc(t.map(function(r){return os(r,e)}),n)}function L1(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function P1(t,e){e===void 0&&(e="kilometers");var n=T1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function Y_(t,e){e===void 0&&(e="kilometers");var n=T1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function A6(t,e){return Yd(Y_(t,e))}function k6(t){var e=t%360;return e<0&&(e+=360),e}function Yd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function na(t){var e=t%360;return e*Math.PI/180}function D6(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 P1(Y_(t,e),n)}function R6(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=Ev[e];if(!r)throw new Error("invalid original units");var i=Ev[n];if(!i)throw new Error("invalid final units");return t/r*i}function w_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function M1(t){return!!t&&t.constructor===Object}function N6(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(!w_(e))throw new Error("bbox must only contain numbers")})}function O6(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}const z6=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Ev,bearingToAzimuth:k6,convertArea:R6,convertLength:D6,degreesToRadians:na,earthRadius:Io,factors:T1,feature:ma,featureCollection:Zc,geometry:I6,geometryCollection:P6,isNumber:w_,isObject:M1,lengthToDegrees:A6,lengthToRadians:Y_,lineString:ta,lineStrings:L6,multiLineString:KC,multiPoint:JC,multiPolygon:QC,point:os,points:C6,polygon:L1,polygons:T6,radiansToDegrees:Yd,radiansToLength:P1,round:M6,unitsFactors:E6,validateBBox:N6,validateId:O6},Symbol.toStringTag,{value:"Module"}));function Kd(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 Hf(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 $C(t,e,n){if(n===void 0&&(n={}),n.final===!0)return F6(t,e);var r=Kd(t),i=Kd(e),a=na(r[0]),c=na(i[0]),l=na(r[1]),d=na(i[1]),w=Math.sin(c-a)*Math.cos(d),S=Math.cos(l)*Math.sin(d)-Math.sin(l)*Math.cos(d)*Math.cos(c-a);return Yd(Math.atan2(w,S))}function F6(t,e){var n=$C(e,t);return n=(n+180)%360,n}function fd(t,e,n){n===void 0&&(n={});var r=Kd(t),i=Kd(e),a=na(i[1]-r[1]),c=na(i[0]-r[0]),l=na(r[1]),d=na(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return P1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function YS(t,e,n,r){r===void 0&&(r={});var i=Kd(t),a=na(i[0]),c=na(i[1]),l=na(n),d=Y_(e,r.units),w=Math.asin(Math.sin(c)*Math.cos(d)+Math.cos(c)*Math.sin(d)*Math.cos(l)),S=a+Math.atan2(Math.sin(l)*Math.sin(d)*Math.cos(c),Math.cos(d)-Math.sin(c)*Math.sin(w)),I=Yd(S),T=Yd(w);return os([I,T],r.properties)}function am(t,e,n){if(t!==null)for(var r,i,a,c,l,d,w,S=0,I=0,T,k=t.type,D=k==="FeatureCollection",U=k==="Feature",j=D?t.features.length:1,$=0;$d||D>w||U>S){l=I,d=r,w=D,S=U,a=0;return}var j=ta([l,I],n.properties);if(e(j,r,i,U,a)===!1)return!1;a++,l=I})===!1)return!1}}})}function W6(t,e,n){var r=n,i=!1;return tT(t,function(a,c,l,d,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,d,w),i=!0}),r}function nT(t,e){if(!t)throw new Error("geojson is required");op(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;li?n:i,w=r>a?r:a;return[c,l,d,w]}var k1={exports:{}},rT={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Jd,function(){function n(B,q,J,ce,fe){(function de(ie,ee,Le,X,le){for(;X>Le;){if(X-Le>600){var Ye=X-Le+1,xe=ee-Le+1,Ge=Math.log(Ye),Xe=.5*Math.exp(2*Ge/3),Ne=.5*Math.sqrt(Ge*Xe*(Ye-Xe)/Ye)*(xe-Ye/2<0?-1:1),$e=Math.max(Le,Math.floor(ee-xe*Xe/Ye+Ne)),ht=Math.min(X,Math.floor(ee+(Ye-xe)*Xe/Ye+Ne));de(ie,ee,$e,ht,le)}var Gt=ie[ee],Ht=Le,Dt=X;for(r(ie,Le,ee),le(ie[X],Gt)>0&&r(ie,Le,X);Ht0;)Dt--}le(ie[Le],Gt)===0?r(ie,Le,Dt):r(ie,++Dt,X),Dt<=ee&&(Le=Dt+1),ee<=Dt&&(X=Dt-1)}})(B,q,J||0,ce||B.length-1,fe||i)}function r(B,q,J){var ce=B[q];B[q]=B[J],B[J]=ce}function i(B,q){return Bq?1:0}var a=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(B,q,J){if(!J)return q.indexOf(B);for(var ce=0;ce=B.minX&&q.maxY>=B.minY}function j(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function $(B,q,J,ce,fe){for(var de=[q,J];de.length;)if(!((J=de.pop())-(q=de.pop())<=ce)){var ie=q+Math.ceil((J-q)/ce/2)*ce;n(B,ie,q,J,fe),de.push(q,ie,ie,J)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(B){var q=this.data,J=[];if(!U(B,q))return J;for(var ce=this.toBBox,fe=[];q;){for(var de=0;de=0&&fe[q].children.length>this._maxEntries;)this._split(fe,q),q--;this._adjustParentBBoxes(ce,fe,q)},a.prototype._split=function(B,q){var J=B[q],ce=J.children.length,fe=this._minEntries;this._chooseSplitAxis(J,fe,ce);var de=this._chooseSplitIndex(J,fe,ce),ie=j(J.children.splice(de,J.children.length-de));ie.height=J.height,ie.leaf=J.leaf,l(J,this.toBBox),l(ie,this.toBBox),q?B[q-1].children.push(ie):this._splitRoot(J,ie)},a.prototype._splitRoot=function(B,q){this.data=j([B,q]),this.data.height=B.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(B,q,J){for(var ce,fe,de,ie,ee,Le,X,le=1/0,Ye=1/0,xe=q;xe<=J-q;xe++){var Ge=d(B,0,xe,this.toBBox),Xe=d(B,xe,J,this.toBBox),Ne=(fe=Ge,de=Xe,ie=void 0,ee=void 0,Le=void 0,X=void 0,ie=Math.max(fe.minX,de.minX),ee=Math.max(fe.minY,de.minY),Le=Math.min(fe.maxX,de.maxX),X=Math.min(fe.maxY,de.maxY),Math.max(0,Le-ie)*Math.max(0,X-ee)),$e=T(Ge)+T(Xe);Ne=q;le--){var Ye=B.children[le];w(ie,B.leaf?fe(Ye):Ye),ee+=k(ie)}return ee},a.prototype._adjustParentBBoxes=function(B,q,J){for(var ce=J;ce>=0;ce--)w(q[ce],B)},a.prototype._condense=function(B){for(var q=B.length-1,J=void 0;q>=0;q--)B[q].children.length===0?q>0?(J=B[q-1].children).splice(J.indexOf(B[q]),1):this.clear():l(B[q],this.toBBox)},a})})(rT);var $6=rT.exports;const eF=C_(z6),tF=C_(Y6),nF=C_(bD);var sl=$6,iT=eF,oT=tF,af=nF.default,rF=oT.featureEach;oT.coordEach;iT.polygon;var JS=iT.featureCollection;function sT(t){var e=new sl(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:af(n),sl.prototype.insert.call(this,n)},e.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:af(i),r.push(i)}):rF(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:af(i),r.push(i)}),sl.prototype.load.call(this,r)},e.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:af(n),sl.prototype.remove.call(this,n,r)},e.clear=function(){return sl.prototype.clear.call(this)},e.search=function(n){var r=sl.prototype.search.call(this,this.toBBox(n));return JS(r)},e.collides=function(n){return sl.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=sl.prototype.all.call(this);return JS(n)},e.toJSON=function(){return sl.prototype.toJSON.call(this)},e.fromJSON=function(n){return sl.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=af(n);else if(n.type==="FeatureCollection")r=af(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}k1.exports=sT;k1.exports.default=sT;var iF=k1.exports;const oF=Rv(iF);function sF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=ma(t)),e.type==="LineString"&&(e=ma(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 i=QS(t,e);return i&&r.push(i),Zc(r)}var a=oF();return a.load(KS(e)),S_(KS(t),function(c){S_(a.search(c),function(l){var d=QS(c,l);if(d){var w=Hf(d).join(",");n[w]||(n[w]=!0,r.push(d))}})}),Zc(r)}function QS(t,e){var n=Hf(t),r=Hf(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],c=n[1][0],l=n[1][1],d=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],T=(I-w)*(c-i)-(S-d)*(l-a),k=(S-d)*(a-w)-(I-w)*(i-d),D=(c-i)*(a-w)-(l-a)*(i-d);if(T===0)return null;var U=k/T,j=D/T;if(U>=0&&U<=1&&j>=0&&j<=1){var $=i+U*(c-i),B=a+U*(l-a);return os([$,B])}return null}function aF(t,e,n){n===void 0&&(n={});var r=os([1/0,1/0],{dist:1/0}),i=0;return op(t,function(a){for(var c=Hf(a),l=0;l0&&(j=U.features[0],j.properties.dist=fd(e,j,n),j.properties.location=i+fd(d,j,n)),d.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,r=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});gi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if($S(this.points).forEach((r,i)=>{n.push([i+1,aF(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});gi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=M0(e.lngLat.toArray()),this.onClick(e),this.finish())});gi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});gi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});gi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});gi(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((i,a)=>{let c=M0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat($S(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),lT.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,uT.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=M0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(aT),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>hF&&this.previousStates.shift()}}function $S(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 pF(t){let e,n,r;return{c(){e=xt("Undo ("),n=xt(t[1]),r=xt(")")},m(i,a){Ae(i,e,a),Ae(i,n,a),Ae(i,r,a)},p(i,a){a&2&&An(n,i[1])},d(i){i&&(Pe(e),Pe(n),Pe(r))}}}function dF(t){let e;return{c(){e=xt("Undo")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function mF(t){let e,n,r,i,a,c,l,d,w,S,I;function T(U,j){return U[1]==0?dF:pF}let k=T(t),D=k(t);return{c(){e=ke("div"),n=ke("button"),n.textContent="Finish",r=rt(),i=ke("button"),i.textContent="Cancel",a=rt(),c=ke("button"),D.c(),d=rt(),w=ke("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 + to undo your last change
  • Press Enter + or + double click + to finish
  • Press Escape + to cancel
  • `,c.disabled=l=t[1]==0,Ii(e,"display","flex"),Ii(e,"justify-content","space-between")},m(U,j){Ae(U,e,j),be(e,n),be(e,r),be(e,i),be(e,a),be(e,c),D.m(c,null),Ae(U,d,j),Ae(U,w,j),S||(I=[Ut(n,"click",t[2]),Ut(i,"click",t[3]),Ut(c,"click",t[4])],S=!0)},p(U,[j]){k===(k=T(U))&&D?D.p(U,j):(D.d(1),D=k(U),D&&(D.c(),D.m(c,null))),j&2&&l!==(l=U[1]==0)&&(c.disabled=l)},i:tt,o:tt,d(U){U&&(Pe(e),Pe(d),Pe(w)),D.d(),S=!1,Ai(I)}}}function gF(t,e,n){let r;Lt(t,uT,d=>n(1,r=d));let{polygonTool:i}=e;const a=()=>i.finish(),c=()=>i.cancel(),l=()=>i.undo();return t.$$set=d=>{"polygonTool"in d&&n(0,i=d.polygonTool)},[i,r,a,c,l]}class _F extends Jt{constructor(e){super(),Kt(this,e,gF,mF,Wt,{polygonTool:0})}}let yF=Date.now();function lm(t){return`${t}-${yF++}`}const cT=Symbol.for("svelte-maplibre");function vF(){return Cv(cT)}function eE(t){return{subscribe:t.subscribe}}function hT({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=vF(),a=Zn(null),c=eE(a),l={...i,[t]:eE(a)};if(e&&(l.popupTarget=c),r){let d=Zn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Zn()),Iv(cT,l),{...i,self:a}}function bF(){return hT({key:"source",setCluster:!0})}function xF(t=!0){return hT({key:"layer",setPopupTarget:t,setMouseEvent:t})}function tE(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],a=n[r];i!==a&&t(r,a,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function wF(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function SF(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function nE(t){let e=t[0],n,r,i=rE(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Ae(a,n,c),r=!0},p(a,c){c[0]&1&&Wt(e,e=a[0])?(Ln(),Se(i,1,1,tt),Pn(),i=rE(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function rE(t){let e;const n=t[36].default,r=Xr(n,t,t[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[1]&16)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function EF(t){let e,n,r=t[0]&&nE(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&_e(r,1)):(r=nE(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function IF(t,e,n){let r,i,a,c,l,d,w,S,I,T,k,D,{$$slots:U={},$$scope:j}=e,{id:$=lm("layer")}=e,{source:B=void 0}=e,{sourceLayer:q=void 0}=e,{beforeId:J=void 0}=e,{beforeLayerType:ce=void 0}=e,{type:fe}=e,{paint:de=void 0}=e,{layout:ie=void 0}=e,{filter:ee=void 0}=e,{applyToClusters:Le=void 0}=e,{minzoom:X=void 0}=e,{maxzoom:le=void 0}=e,{manageHoverState:Ye=!1}=e,{hovered:xe=null}=e,{interactive:Ge=!0}=e,{hoverCursor:Xe=void 0}=e,{eventsIfTopMost:Ne=!1}=e;const $e=Ku(),{map:ht,source:Gt,self:Ht,minzoom:Dt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=xF();Lt(t,ht,re=>n(31,I=re)),Lt(t,Gt,re=>n(32,T=re)),Lt(t,Ht,re=>n(0,S=re)),Lt(t,Dt,re=>n(34,D=re)),Lt(t,un,re=>n(33,k=re)),us(()=>{S&&I&&(bn.delete(S),I==null||I.removeLayer(S))});let mn;function Bn(re){var ze,en;if(!Ge||!S||!I||Ne&&Fn(re)!==S)return;let Ce=re.features??[],vt=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn={event:re,map:I,clusterId:vt,layer:S,source:l,features:Ce};$e(re.type,xn)}function ir(re){var ze,en;if(!Ge||!S||!I||Ne&&Fn(re)!==S)return;Xe&&(I.getCanvas().style.cursor=Xe);let Ce=re.features??[];n(6,xe=Ce[0]??null);let vt=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id;$e("mouseenter",{event:re,map:I,clusterId:vt,layer:S,source:l,features:Ce})}function $r(re){var ze,en,Dr;if(!Ge||!I)return;if(Ne&&Fn(re)!==S){n(6,xe=null),Ye&&mn!==void 0&&(I==null||I.setFeatureState({source:l,sourceLayer:q,id:mn},{hover:!1}),mn=void 0);return}I.getCanvas().style.cursor=Xe;let Ce=re.features??[],vt=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn=(Dr=Ce[0])==null?void 0:Dr.id;xn!==mn&&(Ye&&(mn!==void 0&&(I==null||I.setFeatureState({source:l,id:mn,sourceLayer:q},{hover:!1})),I==null||I.setFeatureState({source:l,id:xn,sourceLayer:q},{hover:!0})),mn=xn,n(6,xe=Ce[0]??null)),$e("mousemove",{event:re,map:I,clusterId:vt,layer:S,source:l,features:Ce})}function _r(re){if(!(!Ge||!S||!I)){if(Xe&&(I.getCanvas().style.cursor=""),n(6,xe=null),Ye&&mn!==void 0){const Ce={source:l,id:mn,sourceLayer:q};I==null||I.setFeatureState(Ce,{hover:!1}),mn=void 0}$e("mouseleave",{map:I,layer:S,source:l})}}let cr=!0;function or(re){I&&(I.off("click",re,Bn),I.off("dblclick",re,Bn),I.off("contextmenu",re,Bn),I.off("mouseenter",re,ir),I.off("mousemove",re,$r),I.off("mouseleave",re,_r))}return us(()=>{I&&S&&or(S)}),t.$$set=re=>{"id"in re&&n(7,$=re.id),"source"in re&&n(8,B=re.source),"sourceLayer"in re&&n(9,q=re.sourceLayer),"beforeId"in re&&n(10,J=re.beforeId),"beforeLayerType"in re&&n(11,ce=re.beforeLayerType),"type"in re&&n(12,fe=re.type),"paint"in re&&n(13,de=re.paint),"layout"in re&&n(14,ie=re.layout),"filter"in re&&n(15,ee=re.filter),"applyToClusters"in re&&n(16,Le=re.applyToClusters),"minzoom"in re&&n(17,X=re.minzoom),"maxzoom"in re&&n(18,le=re.maxzoom),"manageHoverState"in re&&n(19,Ye=re.manageHoverState),"hovered"in re&&n(6,xe=re.hovered),"interactive"in re&&n(20,Ge=re.interactive),"hoverCursor"in re&&n(21,Xe=re.hoverCursor),"eventsIfTopMost"in re&&n(22,Ne=re.eventsIfTopMost),"$$scope"in re&&n(35,j=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=SF(Le)),t.$$.dirty[0]&1073774592&&n(24,i=wF("all",r,ee)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=X??D),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=le??k),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==$&&l){S&&(or(S),bn.delete(S));let re=J;if(!J&&ce){let Ce=I.getStyle().layers,vt=typeof ce=="function"?ce:ze=>ze.type===ce,xn=Ce==null?void 0:Ce.find(vt);xn&&(re=xn.id)}Xn(Ht,S=$,S),I.addLayer(Wc({id:S,type:fe,source:l,"source-layer":q,filter:i,paint:de,layout:ie,minzoom:a,maxzoom:c}),re),n(23,cr=!0),I.on("click",S,Bn),I.on("dblclick",S,Bn),I.on("contextmenu",S,Bn),I.on("mouseenter",S,ir),I.on("mousemove",S,$r),I.on("mouseleave",S,_r)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Ge}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?tE((re,Ce)=>I==null?void 0:I.setPaintProperty(S,re,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?tE((re,Ce)=>I==null?void 0:I.setLayoutProperty(S,re,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(de)),t.$$.dirty[0]&134234112&&(w==null||w(ie)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(cr?n(23,cr=!1):I==null||I.setFilter(S,i))},[S,ht,Gt,Ht,Dt,un,xe,$,B,q,J,ce,fe,de,ie,ee,Le,X,le,Ye,Ge,Xe,Ne,cr,i,c,a,w,d,l,r,I,T,k,D,j,U]}class D1 extends Jt{constructor(e){super(),Kt(this,e,IF,EF,Wt,{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 CF(t){let e;const n=t[16].default,r=Xr(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function TF(t){let e,n,r;function i(c){t[17](c)}let a={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:[CF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new D1({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function LF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:j=void 0}=e,{manageHoverState:$=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:q=!1}=e,{interactive:J=!0}=e;function ce(le){B=le,n(0,B)}function fe(le){dn.call(this,t,le)}function de(le){dn.call(this,t,le)}function ie(le){dn.call(this,t,le)}function ee(le){dn.call(this,t,le)}function Le(le){dn.call(this,t,le)}function X(le){dn.call(this,t,le)}return t.$$set=le=>{"id"in le&&n(1,a=le.id),"source"in le&&n(2,c=le.source),"sourceLayer"in le&&n(3,l=le.sourceLayer),"beforeId"in le&&n(4,d=le.beforeId),"beforeLayerType"in le&&n(5,w=le.beforeLayerType),"paint"in le&&n(6,S=le.paint),"layout"in le&&n(7,I=le.layout),"filter"in le&&n(8,T=le.filter),"applyToClusters"in le&&n(9,k=le.applyToClusters),"minzoom"in le&&n(10,D=le.minzoom),"maxzoom"in le&&n(11,U=le.maxzoom),"hoverCursor"in le&&n(12,j=le.hoverCursor),"manageHoverState"in le&&n(13,$=le.manageHoverState),"hovered"in le&&n(0,B=le.hovered),"eventsIfTopMost"in le&&n(14,q=le.eventsIfTopMost),"interactive"in le&&n(15,J=le.interactive),"$$scope"in le&&n(24,i=le.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,j,$,q,J,r,ce,fe,de,ie,ee,Le,X,i]}class PF extends Jt{constructor(e){super(),Kt(this,e,LF,TF,Wt,{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 MF(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function AF(t){let e,n,r;function i(c){t[16](c)}let a={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:[MF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new D1({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function kF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:q=!0}=e;function J(X){$=X,n(0,$)}function ce(X){dn.call(this,t,X)}function fe(X){dn.call(this,t,X)}function de(X){dn.call(this,t,X)}function ie(X){dn.call(this,t,X)}function ee(X){dn.call(this,t,X)}function Le(X){dn.call(this,t,X)}return t.$$set=X=>{"id"in X&&n(1,a=X.id),"source"in X&&n(2,c=X.source),"sourceLayer"in X&&n(3,l=X.sourceLayer),"beforeId"in X&&n(4,d=X.beforeId),"beforeLayerType"in X&&n(5,w=X.beforeLayerType),"paint"in X&&n(6,S=X.paint),"layout"in X&&n(7,I=X.layout),"filter"in X&&n(8,T=X.filter),"minzoom"in X&&n(9,k=X.minzoom),"maxzoom"in X&&n(10,D=X.maxzoom),"hoverCursor"in X&&n(11,U=X.hoverCursor),"manageHoverState"in X&&n(12,j=X.manageHoverState),"hovered"in X&&n(0,$=X.hovered),"eventsIfTopMost"in X&&n(13,B=X.eventsIfTopMost),"interactive"in X&&n(14,q=X.interactive),"$$scope"in X&&n(23,i=X.$$scope)},[$,a,c,l,d,w,S,I,T,k,D,U,j,B,q,r,J,ce,fe,de,ie,ee,Le,i]}class DF extends Jt{constructor(e){super(),Kt(this,e,kF,AF,Wt,{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 RF(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function NF(t,e,n){xE().then(()=>{let r=gE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function iE(t){let e=t[0],n,r,i=oE(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Ae(a,n,c),r=!0},p(a,c){c&1&&Wt(e,e=a[0])?(Ln(),Se(i,1,1,tt),Pn(),i=oE(a),i.c(),_e(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(_e(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Pe(n),i.d(a)}}}function oE(t){let e;const n=t[15].default,r=Xr(n,t,t[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16384)&&Kr(r,n,i,i[14],e?Yr(n,i[14],a,null):Jr(i[14]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function OF(t){let e,n,r=t[0]&&iE(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Ae(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&_e(r,1)):(r=iE(i),r.c(),_e(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(_e(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Pe(e),r&&r.d(i)}}}function zF(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:d=lm("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:T=void 0}=e,{lineMetrics:k=void 0}=e,{cluster:D=void 0}=e;const{map:U,cluster:j,self:$}=bF();Lt(t,U,J=>n(13,i=J)),Lt(t,j,J=>n(16,a=J)),Lt(t,$,J=>n(0,r=J));let B,q=!0;return us(()=>{r&&B&&i&&(NF(U,r,B),Xn($,r=null,r),n(11,B=void 0))}),t.$$set=J=>{"id"in J&&n(4,d=J.id),"data"in J&&n(5,w=J.data),"generateId"in J&&n(6,S=J.generateId),"promoteId"in J&&n(7,I=J.promoteId),"filter"in J&&n(8,T=J.filter),"lineMetrics"in J&&n(9,k=J.lineMetrics),"cluster"in J&&n(10,D=J.cluster),"$$scope"in J&&n(14,l=J.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Xn(j,a=D,a),t.$$.dirty&12273&&i&&r!==d&&(Xn($,r=d,r),RF(i,r,Wc({type:"geojson",data:w,filter:T,lineMetrics:k,generateId:S,promoteId:I,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),J=>i&&J===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,q=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(d))})),t.$$.dirty&6176&&B&&(q?n(12,q=!1):B.setData(w)),t.$$.dirty&3072&&(B==null||B.setClusterOptions(Wc({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[r,U,j,$,d,w,S,I,T,k,D,B,q,i,l,c]}class FF extends Jt{constructor(e){super(),Kt(this,e,zF,OF,Wt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function BF(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(_e(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function VF(t){let e,n,r;function i(c){t[16](c)}let a={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:[BF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new D1({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){st(e.$$.fragment)},m(c,l){it(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(_e(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){ot(e,c)}}}function UF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:j=!1}=e,{hovered:$=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:q=!0}=e;function J(X){$=X,n(0,$)}function ce(X){dn.call(this,t,X)}function fe(X){dn.call(this,t,X)}function de(X){dn.call(this,t,X)}function ie(X){dn.call(this,t,X)}function ee(X){dn.call(this,t,X)}function Le(X){dn.call(this,t,X)}return t.$$set=X=>{"id"in X&&n(1,a=X.id),"source"in X&&n(2,c=X.source),"sourceLayer"in X&&n(3,l=X.sourceLayer),"beforeId"in X&&n(4,d=X.beforeId),"beforeLayerType"in X&&n(5,w=X.beforeLayerType),"paint"in X&&n(6,S=X.paint),"layout"in X&&n(7,I=X.layout),"filter"in X&&n(8,T=X.filter),"minzoom"in X&&n(9,k=X.minzoom),"maxzoom"in X&&n(10,D=X.maxzoom),"hoverCursor"in X&&n(11,U=X.hoverCursor),"manageHoverState"in X&&n(12,j=X.manageHoverState),"hovered"in X&&n(0,$=X.hovered),"eventsIfTopMost"in X&&n(13,B=X.eventsIfTopMost),"interactive"in X&&n(14,q=X.interactive),"$$scope"in X&&n(23,i=X.$$scope)},[$,a,c,l,d,w,S,I,T,k,D,U,j,B,q,r,J,ce,fe,de,ie,ee,Le,i]}class GF extends Jt{constructor(e){super(),Kt(this,e,UF,VF,Wt,{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 jF(t){let e,n,r,i,a,c;return e=new DF({props:{id:"edit-polygon-fill",filter:lF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new GF({props:{id:"edit-polygon-lines",filter:uF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new PF({props:{id:"edit-polygon-vertices",filter:cF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment),i=rt(),st(a.$$.fragment)},m(l,d){it(e,l,d),Ae(l,n,d),it(r,l,d),Ae(l,i,d),it(a,l,d),c=!0},p:tt,i(l){c||(_e(e.$$.fragment,l),_e(r.$$.fragment,l),_e(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Pe(n),Pe(i)),ot(e,l),ot(r,l),ot(a,l)}}}function qF(t){let e,n;return e=new FF({props:{data:t[0],$$slots:{default:[jF]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function WF(t,e,n){let r;return Lt(t,lT,i=>n(0,r=i)),[r]}class HF extends Jt{constructor(e){super(),Kt(this,e,WF,qF,Wt,{})}}function ZF(t){let e,n,r,i,a,c,l;return{c(){e=ke("button"),e.textContent="Import current view",n=rt(),r=ke("i"),r.textContent="or...",i=rt(),a=ke("button"),a.textContent="Draw an area to import on the map",Fe(e,"type","button"),Fe(a,"type","button")},m(d,w){Ae(d,e,w),Ae(d,n,w),Ae(d,r,w),Ae(d,i,w),Ae(d,a,w),c||(l=[Ut(e,"click",t[1]),Ut(a,"click",t[2])],c=!0)},p:tt,i:tt,o:tt,d(d){d&&(Pe(e),Pe(n),Pe(r),Pe(i),Pe(a)),c=!1,Ai(l)}}}function XF(t){let e,n;return e=new _F({props:{polygonTool:t[0]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function YF(t){let e,n,r,i;const a=[XF,ZF],c=[];function l(d,w){return d[0]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=ur()},m(d,w){c[e].m(d,w),Ae(d,r,w),i=!0},p(d,[w]){let S=e;e=l(d),e===S?c[e].p(d,w):(Ln(),Se(c[S],1,1,()=>{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),_e(n,1),n.m(r.parentNode,r))},i(d){i||(_e(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Pe(r),c[e].d(d)}}}function pd(t){return[t.lng,t.lat]}function KF(t,e,n){let{map:r}=e;const i=Ku();let a=null;async function c(S){try{i("loading","Loading from Overpass");let T=await(await fetch(QF(S))).text();i("gotXml",T)}catch(I){i("error",I.toString())}}function l(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[pd(S.getSouthWest()),pd(S.getNorthWest()),pd(S.getNorthEast()),pd(S.getSouthEast()),pd(S.getSouthWest())]],type:"Polygon"}}}async function d(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await c(l())}}function w(){r&&(n(0,a=new fF(r)),a.startNew(),a.addEventListenerSuccess(async S=>{n(0,a=null),await c(S)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}return t.$$set=S=>{"map"in S&&n(3,r=S.map)},[a,d,w,r]}class JF extends Jt{constructor(e){super(),Kt(this,e,KF,YF,Wt,{map:3})}}function QF(t){let e='poly:"';for(let[r,i]of t.geometry.coordinates[0])e+=`${i} ${r} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function sE(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function aE(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function lE(t){let e,n=t[26]+"",r,i;return{c(){e=ke("option"),r=xt(n),e.__value=i=t[25],yi(e,e.__value)},m(a,c){Ae(a,e,c),be(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&An(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,yi(e,e.__value))},d(a){a&&Pe(e)}}}function uE(t){let e,n,r=zr(t[22]),i=[];for(let a=0;at[9].call(c)),Fe(D,"type","file"),Fe(ee,"type","file")},m(Ge,Xe){it(e,Ge,Xe),Ae(Ge,n,Xe),Ae(Ge,r,Xe),be(r,i),be(i,a),be(i,c),be(c,l);for(let Ne=0;Nen(15,r=ie)),Lt(t,eu,ie=>n(16,i=ie)),Lt(t,I_,ie=>n(5,a=ie));let c="",l=[],d=!1,w=[];Yu(async()=>{try{let ie=await fetch("/osm/areas.json");if(ie.ok)d=!0,console.log("Using local cache, not od2net.org"),n(2,w=await ie.json());else{let ee=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await ee.json())}}catch{}});let S;async function I(ie){try{await D(await S.files[0].arrayBuffer()),n(0,c="")}catch(ee){window.alert(`Couldn't open this file: ${ee}`)}n(1,l=[])}let T;async function k(ie){try{n(1,l=["Loading pre-built file"]);let ee=await T.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array(ee)),console.timeEnd("load"),Xn(gf,r=!0,r),n(0,c="")}catch(ee){window.alert(`Couldn't open this file: ${ee}`)}n(1,l=[])}async function D(ie){let ee=d?`http://${window.location.host}/15m/gtfs.gmd`:"https://assets.od2net.org/gtfs.gmd",Le=d?`http://${window.location.host}/15m/population.fgb`:"https://assets.od2net.org/population.fgb";n(1,l=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(ie),ee,Le,Dv(U)),console.timeEnd("load"),Xn(gf,r=!0,r)}function U(ie){n(1,l=[...l,ie])}async function j(ie){try{await D(new TextEncoder().encode(ie.detail)),n(0,c="")}catch(ee){window.alert(`Couldn't import from Overpass: ${ee}`)}n(1,l=[])}async function $(ie){ie!=""&&(d?await B(`/osm/${ie}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${ie}.pbf`))}async function B(ie){try{n(1,l=[`Downloading ${ie}`]);let ee=await fetch(ie);await D(await ee.arrayBuffer())}catch(ee){window.alert(`Couldn't open from URL ${ie}: ${ee}`)}n(1,l=[])}function q(){c=yE(this),n(0,c),n(2,w)}function J(ie){Gn[ie?"unshift":"push"](()=>{S=ie,n(3,S)})}const ce=ie=>n(1,l=[...l,ie.detail]),fe=ie=>window.alert(ie.detail);function de(ie){Gn[ie?"unshift":"push"](()=>{T=ie,n(4,T)})}return t.$$.update=()=>{t.$$.dirty&1&&$(c)},[c,l,w,S,T,a,I,k,j,q,J,ce,fe,de]}class tB extends Jt{constructor(e){super(),Kt(this,e,eB,$F,Wt,{})}}function nB(t){let e;return{c(){e=ke("div"),Fe(e,"slot","top")},m(n,r){Ae(n,e,r)},p:tt,d(n){n&&Pe(e)}}}function rB(t){let e;return{c(){e=ke("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Ae(n,e,r)},i:tt,o:tt,d(n){n&&Pe(e)}}}function iB(t){let e,n;return e=new tB({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function oB(t){let e,n,r,i,a,c;const l=[iB,rB],d=[];function w(S,I){return S[0]?0:1}return i=w(t),a=d[i]=l[i](t),{c(){e=ke("div"),n=ke("h2"),n.textContent="Choose your study area",r=rt(),a.c(),Fe(e,"slot","sidebar")},m(S,I){Ae(S,e,I),be(e,n),be(e,r),d[i].m(e,null),c=!0},p(S,I){let T=i;i=w(S),i!==T&&(Ln(),Se(d[T],1,1,()=>{d[T]=null}),Pn(),a=d[i],a||(a=d[i]=l[i](S),a.c()),_e(a,1),a.m(e,null))},i(S){c||(_e(a),c=!0)},o(S){Se(a),c=!1},d(S){S&&Pe(e),d[i].d()}}}function sB(t){let e,n,r;return n=new HF({}),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"slot","map")},m(i,a){Ae(i,e,a),it(n,e,null),r=!0},p:tt,i(i){r||(_e(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Pe(e),ot(n)}}}function aB(t){let e,n;return e=new ip({props:{$$slots:{map:[sB],sidebar:[oB],top:[nB]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,[i]){const a={};i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function lB(t,e,n){let r,i,a,c,l;return Lt(t,xf,d=>n(1,r=d)),Lt(t,Pc,d=>n(2,i=d)),Lt(t,eu,d=>n(3,a=d)),Lt(t,gf,d=>n(4,c=d)),Lt(t,I_,d=>n(0,l=d)),Yu(async()=>{Xn(gf,c=!1,c),await a.unset(),Xn(Pc,i=null,i),Xn(xf,r=null,r)}),[l]}class uB extends Jt{constructor(e){super(),Kt(this,e,lB,aB,Wt,{})}}function cB(){return new Worker("/15m/assets/worker-7536a087.js")}function hB(t){let e,n,r,i,a,c;return{c(){e=ke("div"),n=ke("button"),n.innerHTML=`A/B Street logo`,r=rt(),i=ke("span"),Fe(n,"class","outline"),Ii(i,"width","100%"),Fe(e,"slot","top"),Ii(e,"display","flex")},m(l,d){Ae(l,e,d),be(e,n),be(e,r),be(e,i),t[18](i),a||(c=Ut(n,"click",t[17]),a=!0)},p:tt,d(l){l&&Pe(e),t[18](null),a=!1,c()}}}function cE(t){let e,n,r,i,a,c;return{c(){e=ke("hr"),n=rt(),r=ke("div"),i=ke("button"),i.textContent="Zoom to fit"},m(l,d){Ae(l,e,d),Ae(l,n,d),Ae(l,r,d),be(r,i),a||(c=Ut(i,"click",t[9]),a=!0)},p:tt,d(l){l&&(Pe(e),Pe(n),Pe(r)),a=!1,c()}}}function fB(t){let e,n,r,i,a,c=t[5].kind!="title"&&cE(t);return{c(){e=ke("div"),n=ke("h1"),n.textContent="15-minute neighbourhood tool",r=rt(),i=ke("div"),a=rt(),c&&c.c(),Fe(e,"slot","left")},m(l,d){Ae(l,e,d),be(e,n),be(e,r),be(e,i),t[16](i),be(e,a),c&&c.m(e,null)},p(l,d){l[5].kind!="title"?c?c.p(l,d):(c=cE(l),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(l){l&&Pe(e),t[16](null),c&&c.d()}}}function hE(t){let e,n;return e=new uB({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function fE(t){let e,n,r,i,a,c,l,d={ctx:t,current:null,token:null,hasCatch:!1,pending:gB,then:dB,catch:pB,value:23,blocks:[,,,]};vf(e=cs(t[6]).getInvertedBoundary(),d);const w=[xB,bB,vB,yB,_B],S=[];function I(k,D){return k[5].kind=="debug"?0:k[5].kind=="isochrone"?1:k[5].kind=="route"?2:k[5].kind=="score"?3:k[5].kind=="debug-route"?4:-1}~(r=I(t))&&(i=S[r]=w[r](t));let T=t[7]&&pE(t);return{c(){d.block.c(),n=rt(),i&&i.c(),a=rt(),T&&T.c(),c=ur()},m(k,D){d.block.m(k,d.anchor=D),d.mount=()=>n.parentNode,d.anchor=n,Ae(k,n,D),~r&&S[r].m(k,D),Ae(k,a,D),T&&T.m(k,D),Ae(k,c,D),l=!0},p(k,D){t=k,d.ctx=t,D&64&&e!==(e=cs(t[6]).getInvertedBoundary())&&vf(e,d)||Lv(d,t,D);let U=r;r=I(t),r===U?~r&&S[r].p(t,D):(i&&(Ln(),Se(S[U],1,1,()=>{S[U]=null}),Pn()),~r?(i=S[r],i?i.p(t,D):(i=S[r]=w[r](t),i.c()),_e(i,1),i.m(a.parentNode,a)):i=null),t[7]?T?(T.p(t,D),D&128&&_e(T,1)):(T=pE(t),T.c(),_e(T,1),T.m(c.parentNode,c)):T&&(Ln(),Se(T,1,1,()=>{T=null}),Pn())},i(k){l||(_e(d.block),_e(i),_e(T),l=!0)},o(k){for(let D=0;D<3;D+=1){const U=d.blocks[D];Se(U)}Se(i),Se(T),l=!1},d(k){k&&(Pe(n),Pe(a),Pe(c)),d.block.d(k),d.token=null,d=null,~r&&S[r].d(k),T&&T.d(k)}}}function pB(t){return{c:tt,m:tt,p:tt,i:tt,o:tt,d:tt}}function dB(t){let e,n;return e=new Wa({props:{data:t[23],$$slots:{default:[mB]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[23]),i&16777216&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function mB(t){let e,n;return e=new I1({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function gB(t){return{c:tt,m:tt,p:tt,i:tt,o:tt,d:tt}}function _B(t){let e,n;return e=new h6({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.debugGj=r[5].debugGj),i&32&&(a.start=r[5].start),i&32&&(a.end=r[5].end),i&32&&(a.routeGj=r[5].routeGj),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function yB(t){let e,n;return e=new S6({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function vB(t){let e,n;return e=new t6({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function bB(t){let e,n;return e=new kz({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function xB(t){let e,n;return e=new xz({}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p:tt,i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function pE(t){let e,n,r,i={ctx:t,current:null,token:null,hasCatch:!1,pending:EB,then:SB,catch:wB,value:22,blocks:[,,,]};return vf(n=cs(t[6]).renderZones(),i),{c(){e=ur(),i.block.c()},m(a,c){Ae(a,e,c),i.block.m(a,i.anchor=c),i.mount=()=>e.parentNode,i.anchor=e,r=!0},p(a,c){t=a,i.ctx=t,c&64&&n!==(n=cs(t[6]).renderZones())&&vf(n,i)||Lv(i,t,c)},i(a){r||(_e(i.block),r=!0)},o(a){for(let c=0;c<3;c+=1){const l=i.blocks[c];Se(l)}r=!1},d(a){a&&Pe(e),i.block.d(a),i.token=null,i=null}}}function wB(t){return{c:tt,m:tt,p:tt,i:tt,o:tt,d:tt}}function SB(t){let e,n;return e=new sz({props:{gj:t[22]}}),{c(){st(e.$$.fragment)},m(r,i){it(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.gj=r[22]),e.$set(a)},i(r){n||(_e(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){ot(e,r)}}}function EB(t){return{c:tt,m:tt,p:tt,i:tt,o:tt,d:tt}}function IB(t){let e,n,r,i,a,c,l;e=new nO({props:{map:t[0],apiKey:AE}});let d=t[5].kind=="title"&&hE(),w=t[4]&&fE(t);return{c(){st(e.$$.fragment),n=rt(),r=ke("div"),i=rt(),d&&d.c(),a=rt(),w&&w.c(),c=ur()},m(S,I){it(e,S,I),Ae(S,n,I),Ae(S,r,I),t[13](r),Ae(S,i,I),d&&d.m(S,I),Ae(S,a,I),w&&w.m(S,I),Ae(S,c,I),l=!0},p(S,I){const T={};I&1&&(T.map=S[0]),e.$set(T),S[5].kind=="title"?d?I&32&&_e(d,1):(d=hE(),d.c(),_e(d,1),d.m(a.parentNode,a)):d&&(Ln(),Se(d,1,1,()=>{d=null}),Pn()),S[4]?w?(w.p(S,I),I&16&&_e(w,1)):(w=fE(S),w.c(),_e(w,1),w.m(c.parentNode,c)):w&&(Ln(),Se(w,1,1,()=>{w=null}),Pn())},i(S){l||(_e(e.$$.fragment,S),_e(d),_e(w),l=!0)},o(S){Se(e.$$.fragment,S),Se(d),Se(w),l=!1},d(S){S&&(Pe(n),Pe(r),Pe(i),Pe(a),Pe(c)),ot(e,S),t[13](null),d&&d.d(S),w&&w.d(S)}}}function CB(t){let e,n,r,i;function a(l){t[14](l)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${AE}`,standardControls:!0,hash:!0,images:[{id:"cycle_parking",url:yP}],$$slots:{default:[IB]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new m5({props:c}),Gn.push(()=>Yi(n,"map",a)),n.$on("error",t[15]),{c(){e=ke("div"),st(n.$$.fragment),Fe(e,"slot","main"),Ii(e,"position","relative"),Ii(e,"width","100%"),Ii(e,"height","100vh")},m(l,d){Ae(l,e,d),it(n,e,null),i=!0},p(l,d){const w={};d&16777465&&(w.$$scope={dirty:d,ctx:l}),!r&&d&1&&(r=!0,w.map=l[0],Xi(()=>r=!1)),n.$set(w)},i(l){i||(_e(n.$$.fragment,l),i=!0)},o(l){Se(n.$$.fragment,l),i=!1},d(l){l&&Pe(e),ot(n)}}}function TB(t){let e,n,r,i;return e=new tM({}),r=new P5({props:{$$slots:{main:[CB],left:[fB],top:[hB]},$$scope:{ctx:t}}}),{c(){st(e.$$.fragment),n=rt(),st(r.$$.fragment)},m(a,c){it(e,a,c),Ae(a,n,c),it(r,a,c),i=!0},p(a,[c]){const l={};c&16777727&&(l.$$scope={dirty:c,ctx:a}),r.$set(l)},i(a){i||(_e(e.$$.fragment,a),_e(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Pe(n),ot(e,a),ot(r,a)}}}function Cg(t,e,n){return e+t*(n-e)}function LB(t,e,n){let r,i,a,c,l,d,w,S,I,T;Lt(t,Sv,ee=>n(10,r=ee)),Lt(t,wv,ee=>n(11,i=ee)),Lt(t,xv,ee=>n(12,a=ee)),Lt(t,gf,ee=>n(4,c=ee)),Lt(t,$s,ee=>n(5,l=ee)),Lt(t,xf,ee=>n(19,d=ee)),Lt(t,Pc,ee=>n(20,w=ee)),Lt(t,eu,ee=>n(6,S=ee)),Lt(t,z0,ee=>n(7,I=ee)),Lt(t,Wg,ee=>n(8,T=ee)),Yu(async()=>{const ee=CE(new cB);let Le=await new ee;eu.set(Le)});let k;async function D(){k&&c&&k.fitBounds(await S.getBounds(),{animate:!1})}async function U(ee){if(ee){console.log("New map model loaded");let Le=await S.getBounds();Xn(Pc,w={lng:Cg(.4,Le[0],Le[2]),lat:Cg(.4,Le[1],Le[3])},w),Xn(xf,d={lng:Cg(.6,Le[0],Le[2]),lat:Cg(.6,Le[1],Le[3])},d),await D(),Xn($s,l={kind:"isochrone"},l)}}let j,$,B;function q(ee){Gn[ee?"unshift":"push"](()=>{B=ee,n(3,B),n(10,r)})}function J(ee){k=ee,n(0,k)}const ce=ee=>{console.log(ee.detail.error)};function fe(ee){Gn[ee?"unshift":"push"](()=>{$=ee,n(2,$),n(11,i)})}const de=()=>Xn(Wg,T=!0,T);function ie(ee){Gn[ee?"unshift":"push"](()=>{j=ee,n(1,j),n(12,a)})}return t.$$.update=()=>{t.$$.dirty&1&&k&&I_.set(k),t.$$.dirty&16&&U(c),t.$$.dirty&4098&&j&&a&&(n(1,j.innerHTML="",j),j.appendChild(a)),t.$$.dirty&2052&&$&&i&&(n(2,$.innerHTML="",$),$.appendChild(i)),t.$$.dirty&1032&&B&&r&&(n(3,B.innerHTML="",B),B.appendChild(r))},[k,j,$,B,c,l,S,I,T,D,r,i,a,q,J,ce,fe,de,ie]}class PB extends Jt{constructor(e){super(),Kt(this,e,LB,TB,Wt,{})}}new PB({target:document.getElementById("app")}); diff --git a/assets/main-f1e451e9.js b/assets/main-f1e451e9.js deleted file mode 100644 index 852d767..0000000 --- a/assets/main-f1e451e9.js +++ /dev/null @@ -1,646 +0,0 @@ -var QL=Object.defineProperty;var $L=(t,e,n)=>e in t?QL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gi=(t,e,n)=>($L(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function et(){}function eP(t,e){for(const n in e)t[n]=e[n];return t}function tP(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function uE(t){return t()}function lx(){return Object.create(null)}function Mi(t){t.forEach(uE)}function E_(t){return typeof t=="function"}function qt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let dg;function To(t,e){return t===e?!0:(dg||(dg=document.createElement("a")),dg.href=e,t===dg.href)}function nP(t){return Object.keys(t).length===0}function cE(t,...e){if(t==null){for(const r of e)r(void 0);return et}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function hE(t){let e;return cE(t,n=>e=n)(),e}function Ct(t,e,n){t.$$.on_destroy.push(cE(e,n))}function Xr(t,e,n,r){if(t){const i=fE(t,e,n,r);return t[0](i)}}function fE(t,e,n,r){return t[1]&&r?eP(n.ctx.slice(),t[1](r(e))):n.ctx}function Yr(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const a=[],c=Math.max(e.dirty.length,i.length);for(let l=0;l32){const e=[],n=t.ctx.length/32;for(let r=0;rt.removeEventListener(e,n,r)}function oP(t){return function(e){return e.preventDefault(),t.call(this,e)}}function t0(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function Ve(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Kd(t){return t===""?null:+t}function sP(t){return Array.from(t.childNodes)}function An(t,e){e=""+e,t.data!==e&&(t.data=e)}function Di(t,e){t.value=e??""}function Ei(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Ug(t,e,n){for(let r=0;r{const i=t.$$.callbacks[e];if(i){const a=aP(e,n,{cancelable:r});return i.slice().forEach(c=>{c.call(t,a)}),!a.defaultPrevented}return!0}}function Iv(t,e){return Hf().$$.context.set(t,e),e}function Cv(t){return Hf().$$.context.get(t)}function dn(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const af=[],Gn=[];let df=[];const k0=[],dE=Promise.resolve();let D0=!1;function mE(){D0||(D0=!0,dE.then(Tv))}function gE(){return mE(),dE}function Ld(t){df.push(t)}function Xi(t){k0.push(t)}const n0=new Set;let $h=0;function Tv(){if($h!==0)return;const t=Td;do{try{for(;$ht.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),df=e}const Tg=new Set;let Tc;function Ln(){Tc={r:0,c:[],p:Tc}}function Pn(){Tc.r||Mi(Tc.c),Tc=Tc.p}function ye(t,e){t&&t.i&&(Tg.delete(t),t.i(e))}function Se(t,e,n,r){if(t&&t.o){if(Tg.has(t))return;Tg.add(t),Tc.c.push(()=>{Tg.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function yf(t,e){const n=e.token={};function r(i,a,c,l){if(e.token!==n)return;e.resolved=l;let d=e.ctx;c!==void 0&&(d=d.slice(),d[c]=l);const w=i&&(e.current=i)(d);let S=!1;e.block&&(e.blocks?e.blocks.forEach((I,T)=>{T!==a&&I&&(Ln(),Se(I,1,1,()=>{e.blocks[T]===I&&(e.blocks[T]=null)}),Pn())}):e.block.d(1),w.c(),ye(w,1),w.m(e.mount(),e.anchor),S=!0),e.block=w,e.blocks&&(e.blocks[a]=w),S&&Tv()}if(tP(t)){const i=Hf();if(t.then(a=>{Hl(i),r(e.then,1,e.value,a),Hl(null)},a=>{if(Hl(i),r(e.catch,2,e.error,a),Hl(null),!e.hasCatch)throw a}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function Lv(t,e,n){const r=e.slice(),{resolved:i}=t;t.current===t.then&&(r[t.value]=i),t.current===t.catch&&(r[t.error]=i),t.block.p(r,n)}function zr(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function cP(t,e){Se(t,1,1,()=>{e.delete(t.key)})}function hP(t,e,n,r,i,a,c,l,d,w,S,I){let T=t.length,k=a.length,D=T;const U={};for(;D--;)U[t[D].key]=D;const q=[],ee=new Map,B=new Map,j=[];for(D=k;D--;){const de=I(i,a,D),te=n(de);let $=c.get(te);$?r&&j.push(()=>$.p(de,e)):($=w(te,de),$.c()),ee.set(te,q[D]=$),te in U&&B.set(te,Math.abs(D-U[te]))}const J=new Set,ae=new Set;function me(de){ye(de,1),de.m(l,S),c.set(de.key,de),S=de.first,k--}for(;T&&k;){const de=q[k-1],te=t[T-1],$=de.key,Ae=te.key;de===te?(S=de.first,T--,k--):ee.has(Ae)?!c.has($)||J.has($)?me(de):ae.has(Ae)?T--:B.get($)>B.get(Ae)?(ae.add($),me(de)):(J.add(Ae),T--):(d(te,c),T--)}for(;T--;){const de=t[T];ee.has(de.key)||d(de,c)}for(;k;)me(q[k-1]);return Mi(j),q}function Yi(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function ot(t){t&&t.c()}function rt(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Ld(()=>{const a=t.$$.on_mount.map(uE).filter(E_);t.$$.on_destroy?t.$$.on_destroy.push(...a):Mi(a),t.$$.on_mount=[]}),i.forEach(Ld)}function it(t,e){const n=t.$$;n.fragment!==null&&(uP(n.after_update),Mi(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function fP(t,e){t.$$.dirty[0]===-1&&(af.push(t),mE(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const D=k.length?k[0]:T;return w.ctx&&i(w.ctx[I],w.ctx[I]=D)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](D),S&&fP(t,I)),T}):[],w.update(),S=!0,Mi(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=sP(e.target);w.fragment&&w.fragment.l(I),I.forEach(Le)}else w.fragment&&w.fragment.c();e.intro&&ye(t.$$.fragment),rt(t,e.target,e.anchor),Tv()}Hl(d)}class Jt{constructor(){gi(this,"$$");gi(this,"$$set")}$destroy(){it(this,1),this.$destroy=et}$on(e,n){if(!E_(n))return et;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!nP(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const pP="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(pP);const dP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAAmJLR0QA/4ePzL8AAACgSURBVBjTY2D4D4cvGHoY2BlQwH8U2I4pCQKsDHFg3VglGRjEgazvmJLlQNjIcAnIOobbztcM5piSHUBYzxDNwMfAgMtOGKjHJpnJ8IwhhcGFYREDM6ZkCMMqoPHXGC4zBKEa5cPwBKioAAiXMIQz/GZ4yuCFkHzC4MjgxPCNoZaBjeE+kOXEcB0h+RjIdWG4AGU7w9lg4A0UesBgj8oGAP6nSFElh0b7AAAAAElFTkSuQmCC",mP="/15m/assets/logo_dark-ed08d841.svg";const gP=t=>({dialog:t&1}),ux=t=>({dialog:t[0]});function _P(t){let e,n,r,i,a;const c=t[4].default,l=Xr(c,t,t[3],ux);return{c(){e=ke("dialog"),n=ke("article"),l&&l.c(),e.open=!0},m(d,w){Me(d,e,w),xe(e,n),l&&l.m(n,null),t[6](e),r=!0,i||(a=[Gt(window,"click",t[1]),Gt(window,"keydown",t[2]),Gt(e,"close",t[5])],i=!0)},p(d,[w]){l&&l.p&&(!r||w&9)&&Kr(l,c,d,d[3],r?Yr(c,d[3],w,gP):Jr(d[3]),ux)},i(d){r||(ye(l,d),r=!0)},o(d){Se(l,d),r=!1},d(d){d&&Le(e),l&&l.d(d),t[6](null),i=!1,Mi(a)}}}function yP(t,e,n){let{$$slots:r={},$$scope:i}=e,a;function c(S){a.open&&S.target==a&&a.close()}function l(S){(S.key=="Escape"||S.key=="Enter")&&(S.stopPropagation(),a.close())}function d(S){dn.call(this,t,S)}function w(S){Gn[S?"unshift":"push"](()=>{a=S,n(0,a)})}return t.$$set=S=>{"$$scope"in S&&n(3,i=S.$$scope)},[a,c,l,i,r,d,w]}class Pv extends Jt{constructor(e){super(),Kt(this,e,yP,_P,qt,{})}}function cx(t,e,n){const r=t.slice();return r[1]=e[n][0],r[2]=e[n][1],r}function hx(t){let e,n,r=t[1]+"",i,a,c,l=t[2]+"",d,w;return{c(){e=ke("tr"),n=ke("td"),i=vt(r),a=nt(),c=ke("td"),d=vt(l),w=nt()},m(S,I){Me(S,e,I),xe(e,n),xe(n,i),xe(e,a),xe(e,c),xe(c,d),xe(e,w)},p(S,I){I&1&&r!==(r=S[1]+"")&&An(i,r),I&1&&l!==(l=S[2]+"")&&An(d,l)},d(S){S&&Le(e)}}}function vP(t){let e,n,r=zr(Object.entries(t[0])),i=[];for(let a=0;a{"properties"in i&&n(0,r=i.properties)},[r]}class Mv extends Jt{constructor(e){super(),Kt(this,e,bP,vP,qt,{properties:0})}}function fx(t,e,n){const r=t.slice();return r[3]=e[n],r}function px(t,e,n){const r=t.slice();return r[6]=e[n],r}function dx(t){let e,n;return{c(){e=ke("span"),n=vt(`  - `),Ei(e,"background",t[6]),Ei(e,"width","100%"),Ei(e,"border","1px solid black")},m(r,i){Me(r,e,i),xe(e,n)},p(r,i){i&1&&Ei(e,"background",r[6])},d(r){r&&Le(e)}}}function xP(t){let e,n=t[3]+"",r;return{c(){e=ke("span"),r=vt(n)},m(i,a){Me(i,e,a),xe(e,r)},p(i,a){a&2&&n!==(n=i[3]+"")&&An(r,n)},d(i){i&&Le(e)}}}function wP(t){let e,n=t[3].toFixed(t[2])+"",r;return{c(){e=ke("span"),r=vt(n)},m(i,a){Me(i,e,a),xe(e,r)},p(i,a){a&6&&n!==(n=i[3].toFixed(i[2])+"")&&An(r,n)},d(i){i&&Le(e)}}}function mx(t){let e;function n(a,c){return a[2]>0?wP:xP}let r=n(t),i=r(t);return{c(){i.c(),e=ur()},m(a,c){i.m(a,c),Me(a,e,c)},p(a,c){r===(r=n(a))&&i?i.p(a,c):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&Le(e),i.d(a)}}}function SP(t){let e,n,r,i=zr(t[0]),a=[];for(let d=0;d{"colorScale"in c&&n(0,r=c.colorScale),"limits"in c&&n(1,i=c.limits),"decimalPlaces"in c&&n(2,a=c.decimalPlaces)},[r,i,a]}class _E extends Jt{constructor(e){super(),Kt(this,e,EP,SP,qt,{colorScale:0,limits:1,decimalPlaces:2})}}function cs(t){if(t==null||t==null)throw new Error("Oops, notNull given something null");return t}const ef=[];function r0(t,e){return{subscribe:Qn(t,e).subscribe}}function Qn(t,e=et){let n;const r=new Set;function i(l){if(qt(t,l)&&(t=l,n)){const d=!ef.length;for(const w of r)w[1](),ef.push(w,t);if(d){for(let w=0;w{r.delete(w),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:c}}/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */const yE=Symbol("Comlink.proxy"),IP=Symbol("Comlink.endpoint"),CP=Symbol("Comlink.releaseProxy"),i0=Symbol("Comlink.finalizer"),Lg=Symbol("Comlink.thrown"),vE=t=>typeof t=="object"&&t!==null||typeof t=="function",TP={canHandle:t=>vE(t)&&t[yE],serialize(t){const{port1:e,port2:n}=new MessageChannel;return Av(t,e),[n,[n]]},deserialize(t){return t.start(),wE(t)}},LP={canHandle:t=>vE(t)&&Lg in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},bE=new Map([["proxy",TP],["throw",LP]]);function PP(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function Av(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!PP(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:c,path:l}=Object.assign({path:[]},i.data),d=(i.data.argumentList||[]).map(Cc);let w;try{const S=l.slice(0,-1).reduce((T,k)=>T[k],t),I=l.reduce((T,k)=>T[k],t);switch(c){case"GET":w=I;break;case"SET":S[l.slice(-1)[0]]=Cc(i.data.value),w=!0;break;case"APPLY":w=I.apply(S,d);break;case"CONSTRUCT":{const T=new I(...d);w=kv(T)}break;case"ENDPOINT":{const{port1:T,port2:k}=new MessageChannel;Av(t,k),w=RP(T,[T])}break;case"RELEASE":w=void 0;break;default:return}}catch(S){w={value:S,[Lg]:0}}Promise.resolve(w).catch(S=>({value:S,[Lg]:0})).then(S=>{const[I,T]=qg(S);e.postMessage(Object.assign(Object.assign({},I),{id:a}),T),c==="RELEASE"&&(e.removeEventListener("message",r),xE(e),i0 in t&&typeof t[i0]=="function"&&t[i0]())}).catch(S=>{const[I,T]=qg({value:new TypeError("Unserializable return value"),[Lg]:0});e.postMessage(Object.assign(Object.assign({},I),{id:a}),T)})}),e.start&&e.start()}function MP(t){return t.constructor.name==="MessagePort"}function xE(t){MP(t)&&t.close()}function wE(t,e){return R0(t,[],e)}function mg(t){if(t)throw new Error("Proxy has been released and is not useable")}function SE(t){return lf(t,{type:"RELEASE"}).then(()=>{xE(t)})}const Gg=new WeakMap,jg="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Gg.get(t)||0)-1;Gg.set(t,e),e===0&&SE(t)});function AP(t,e){const n=(Gg.get(e)||0)+1;Gg.set(e,n),jg&&jg.register(t,e,t)}function kP(t){jg&&jg.unregister(t)}function R0(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(a,c){if(mg(r),c===CP)return()=>{kP(i),SE(t),r=!0};if(c==="then"){if(e.length===0)return{then:()=>i};const l=lf(t,{type:"GET",path:e.map(d=>d.toString())}).then(Cc);return l.then.bind(l)}return R0(t,[...e,c])},set(a,c,l){mg(r);const[d,w]=qg(l);return lf(t,{type:"SET",path:[...e,c].map(S=>S.toString()),value:d},w).then(Cc)},apply(a,c,l){mg(r);const d=e[e.length-1];if(d===IP)return lf(t,{type:"ENDPOINT"}).then(Cc);if(d==="bind")return R0(t,e.slice(0,-1));const[w,S]=gx(l);return lf(t,{type:"APPLY",path:e.map(I=>I.toString()),argumentList:w},S).then(Cc)},construct(a,c){mg(r);const[l,d]=gx(c);return lf(t,{type:"CONSTRUCT",path:e.map(w=>w.toString()),argumentList:l},d).then(Cc)}});return AP(i,t),i}function DP(t){return Array.prototype.concat.apply([],t)}function gx(t){const e=t.map(qg);return[e.map(n=>n[0]),DP(e.map(n=>n[1]))]}const EE=new WeakMap;function RP(t,e){return EE.set(t,e),t}function kv(t){return Object.assign(t,{[yE]:!0})}function qg(t){for(const[e,n]of bE)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},EE.get(t)||[]]}function Cc(t){switch(t.type){case"HANDLER":return bE.get(t.name).deserialize(t.value);case"RAW":return t.value}}function lf(t,e,n){return new Promise(r=>{const i=NP();t.addEventListener("message",function a(c){!c.data||!c.data.id||c.data.id!==i||(t.removeEventListener("message",a),r(c.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)})}function NP(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let Lt;const Wl=new Array(128).fill(void 0);Wl.push(void 0,null,!0,!1);function ht(t){return Wl[t]}let bd=Wl.length;function OP(t){t<132||(Wl[t]=bd,bd=t)}function La(t){const e=ht(t);return OP(t),e}let fl=0,pd=null;function xd(){return(pd===null||pd.byteLength===0)&&(pd=new Uint8Array(Lt.memory.buffer)),pd}const Pg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},zP=typeof Pg.encodeInto=="function"?function(t,e){return Pg.encodeInto(t,e)}:function(t,e){const n=Pg.encode(t);return e.set(n),{read:t.length,written:n.length}};function hf(t,e,n){if(n===void 0){const l=Pg.encode(t),d=e(l.length,1)>>>0;return xd().subarray(d,d+l.length).set(l),fl=l.length,d}let r=t.length,i=e(r,1)>>>0;const a=xd();let c=0;for(;c127)break;a[i+c]=l}if(c!==r){c!==0&&(t=t.slice(c)),i=n(i,r,r=c+t.length*3,1)>>>0;const l=xd().subarray(i+c,i+r),d=zP(t,l);c+=d.written,i=n(i,r,c,1)>>>0}return fl=c,i}function Js(t){return t==null}let dd=null;function _n(){return(dd===null||dd.byteLength===0)&&(dd=new Int32Array(Lt.memory.buffer)),dd}function Ft(t){bd===Wl.length&&Wl.push(Wl.length+1);const e=bd;return bd=Wl[e],Wl[e]=t,e}const IE=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&IE.decode();function uo(t,e){return t=t>>>0,IE.decode(xd().subarray(t,t+e))}let md=null;function CE(){return(md===null||md.byteLength===0)&&(md=new Float64Array(Lt.memory.buffer)),md}let gd=null;function FP(){return(gd===null||gd.byteLength===0)&&(gd=new BigInt64Array(Lt.memory.buffer)),gd}function N0(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){const i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let a="[";i>0&&(a+=N0(t[0]));for(let c=1;c1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:r}const _x=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{Lt.__wbindgen_export_2.get(t.dtor)(t.a,t.b)});function yx(t,e,n,r){const i={a:t,b:e,cnt:1,dtor:n},a=(...c)=>{i.cnt++;const l=i.a;i.a=0;try{return r(l,i.b,...c)}finally{--i.cnt===0?(Lt.__wbindgen_export_2.get(i.dtor)(l,i.b),_x.unregister(i)):i.a=l}};return a.original=i,_x.register(a,i,i),a}function BP(t,e,n){Lt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha0b106c86a4071f7(t,e,Ft(n))}function VP(t,e,n){Lt._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a3a4bb5c4c0b039(t,e,Ft(n))}function UP(t,e){const n=e(t.length*1,1)>>>0;return xd().set(t,n/1),fl=t.length,n}function GP(t,e){return t=t>>>0,CE().subarray(t/8,t/8+e)}function _i(t,e){try{return t.apply(this,e)}catch(n){Lt.__wbindgen_exn_store(Ft(n))}}function jP(t,e,n,r){Lt.wasm_bindgen__convert__closures__invoke2_mut__h5b77cba7b0f68717(t,e,Ft(n),Ft(r))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingbytesource_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingsink_free(t>>>0));typeof FinalizationRegistry>"u"||new FinalizationRegistry(t=>Lt.__wbg_intounderlyingsource_free(t>>>0));const vx=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Lt.__wbg_mapmodel_free(t>>>0));class Pd{static __wrap(e){e=e>>>0;const n=Object.create(Pd.prototype);return n.__wbg_ptr=e,vx.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,vx.unregister(this),e}free(){const e=this.__destroy_into_raw();Lt.__wbg_mapmodel_free(e)}constructor(e,n,r,i,a){const c=UP(e,Lt.__wbindgen_malloc),l=fl;var d=Js(r)?0:hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),w=fl,S=Js(i)?0:hf(i,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),I=fl;const T=Lt.mapmodel_new(c,l,n,d,w,S,I,Js(a)?0:Ft(a));return La(T)}renderDebug(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderDebug(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}renderAmenities(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderAmenities(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}getInvertedBoundary(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_getInvertedBoundary(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}getBounds(){try{const i=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_getBounds(i,this.__wbg_ptr);var e=_n()[i/4+0],n=_n()[i/4+1],r=GP(e,n).slice();return Lt.__wbindgen_free(e,n*8,8),r}finally{Lt.__wbindgen_add_to_stack_pointer(16)}}renderZones(){let e,n;try{const w=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_renderZones(w,this.__wbg_ptr);var r=_n()[w/4+0],i=_n()[w/4+1],a=_n()[w/4+2],c=_n()[w/4+3],l=r,d=i;if(c)throw l=0,d=0,La(a);return e=l,n=d,uo(l,d)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(e,n,1)}}isochrone(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_isochrone(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,uo(d,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}route(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_route(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,uo(d,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}bufferRoute(e){let n,r;try{const S=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_bufferRoute(S,this.__wbg_ptr,Ft(e));var i=_n()[S/4+0],a=_n()[S/4+1],c=_n()[S/4+2],l=_n()[S/4+3],d=i,w=a;if(l)throw d=0,w=0,La(c);return n=d,r=w,uo(d,w)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(n,r,1)}}score(e,n){let r,i;try{const I=Lt.__wbindgen_add_to_stack_pointer(-16);Lt.mapmodel_score(I,this.__wbg_ptr,Ft(e),Js(n)?0:Ft(n));var a=_n()[I/4+0],c=_n()[I/4+1],l=_n()[I/4+2],d=_n()[I/4+3],w=a,S=c;if(d)throw w=0,S=0,La(l);return r=w,i=S,uo(w,S)}finally{Lt.__wbindgen_add_to_stack_pointer(16),Lt.__wbindgen_free(r,i,1)}}}async function qP(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function WP(){const t={};return t.wbg={},t.wbg.__wbindgen_object_drop_ref=function(e){La(e)},t.wbg.__wbg_mapmodel_new=function(e){const n=Pd.__wrap(e);return Ft(n)},t.wbg.__wbindgen_string_get=function(e,n){const r=ht(n),i=typeof r=="string"?r:void 0;var a=Js(i)?0:hf(i,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),c=fl;_n()[e/4+1]=c,_n()[e/4+0]=a},t.wbg.__wbindgen_boolean_get=function(e){const n=ht(e);return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_bigint=function(e){return typeof ht(e)=="bigint"},t.wbg.__wbindgen_bigint_from_u64=function(e){const n=BigInt.asUintN(64,e);return Ft(n)},t.wbg.__wbindgen_jsval_eq=function(e,n){return ht(e)===ht(n)},t.wbg.__wbindgen_error_new=function(e,n){const r=new Error(uo(e,n));return Ft(r)},t.wbg.__wbindgen_string_new=function(e,n){const r=uo(e,n);return Ft(r)},t.wbg.__wbindgen_is_object=function(e){const n=ht(e);return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return ht(e)===void 0},t.wbg.__wbindgen_in=function(e,n){return ht(e)in ht(n)},t.wbg.__wbindgen_number_get=function(e,n){const r=ht(n),i=typeof r=="number"?r:void 0;CE()[e/8+1]=Js(i)?0:i,_n()[e/4+0]=!Js(i)},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return ht(e)==ht(n)},t.wbg.__wbindgen_object_clone_ref=function(e){const n=ht(e);return Ft(n)},t.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,n){const r=ht(e)[ht(n)];return Ft(r)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return Ft(e)},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=ht(n).stack,i=hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,i;try{r=e,i=n,console.error(uo(e,n))}finally{Lt.__wbindgen_free(r,i,1)}},t.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const n=ht(e).performance;return Ft(n)},t.wbg.__wbg_now_abd80e969af37148=function(e){return ht(e).now()},t.wbg.__wbindgen_cb_drop=function(e){const n=La(e).original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){const n=fetch(ht(e));return Ft(n)},t.wbg.__wbg_done_2ffa852272310e47=function(e){return ht(e).done},t.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return _i(function(e){const n=ht(e).getReader();return Ft(n)},arguments)},t.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){const n=ht(e).value;return Ft(n)},t.wbg.__wbg_fetch_1e4e8ed1f64c7e28=function(e){const n=fetch(ht(e));return Ft(n)},t.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){const n=ht(e).queueMicrotask;return Ft(n)},t.wbg.__wbindgen_is_function=function(e){return typeof ht(e)=="function"},t.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(ht(e))},t.wbg.__wbg_fetch_693453ca3f88c055=function(e,n){const r=ht(e).fetch(ht(n));return Ft(r)},t.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(ht(e))},t.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(ht(e))},t.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(ht(e))},t.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(ht(e))},t.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(ht(e))},t.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03=function(){return _i(function(e,n,r){const i=new Request(uo(e,n),ht(r));return Ft(i)},arguments)},t.wbg.__wbg_instanceof_Response_4c3b1446206114d1=function(e){let n;try{n=ht(e)instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_83a6a4f65f7a2b38=function(e,n){const r=ht(n).url,i=hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbg_status_d6d47ad2837621eb=function(e){return ht(e).status},t.wbg.__wbg_headers_24def508a7518df9=function(e){const n=ht(e).headers;return Ft(n)},t.wbg.__wbg_body_69be35dff3d68d53=function(e){const n=ht(e).body;return Js(n)?0:Ft(n)},t.wbg.__wbg_arrayBuffer_5b2688e3dd873fed=function(){return _i(function(e){const n=ht(e).arrayBuffer();return Ft(n)},arguments)},t.wbg.__wbg_signal_3c701f5f40a5f08d=function(e){const n=ht(e).signal;return Ft(n)},t.wbg.__wbg_new_0ae46f44b7485bb2=function(){return _i(function(){const e=new AbortController;return Ft(e)},arguments)},t.wbg.__wbg_abort_2c4fb490d878d2b2=function(e){ht(e).abort()},t.wbg.__wbg_byobRequest_05466bb0cacd89fa=function(e){const n=ht(e).byobRequest;return Js(n)?0:Ft(n)},t.wbg.__wbg_close_d29a75e8efc5fa94=function(){return _i(function(e){ht(e).close()},arguments)},t.wbg.__wbg_view_1fe68975176283b3=function(e){const n=ht(e).view;return Js(n)?0:Ft(n)},t.wbg.__wbg_respond_6272b341f88864a2=function(){return _i(function(e,n){ht(e).respond(n>>>0)},arguments)},t.wbg.__wbg_read_79c1f6a58844174c=function(e){const n=ht(e).read();return Ft(n)},t.wbg.__wbg_releaseLock_6eb6fa75435874b8=function(e){ht(e).releaseLock()},t.wbg.__wbg_cancel_ef8b2c6f99da9cde=function(e){const n=ht(e).cancel();return Ft(n)},t.wbg.__wbg_new_7a20246daa6eec7e=function(){return _i(function(){const e=new Headers;return Ft(e)},arguments)},t.wbg.__wbg_append_aa3f462f9e2b5ff2=function(){return _i(function(e,n,r,i,a){ht(e).append(uo(n,r),uo(i,a))},arguments)},t.wbg.__wbg_close_79df9bcee94a607c=function(){return _i(function(e){ht(e).close()},arguments)},t.wbg.__wbg_enqueue_e8019641f9877e27=function(){return _i(function(e,n){ht(e).enqueue(ht(n))},arguments)},t.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,n){const r=ht(e)[n>>>0];return Ft(r)},t.wbg.__wbg_length_cd7af8117672b8b8=function(e){return ht(e).length},t.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,n){const r=new Function(uo(e,n));return Ft(r)},t.wbg.__wbg_next_40fc327bfc8770e6=function(e){const n=ht(e).next;return Ft(n)},t.wbg.__wbg_next_196c84450b364254=function(){return _i(function(e){const n=ht(e).next();return Ft(n)},arguments)},t.wbg.__wbg_done_298b57d23c0fc80c=function(e){return ht(e).done},t.wbg.__wbg_value_d93c65011f51a456=function(e){const n=ht(e).value;return Ft(n)},t.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return Ft(Symbol.iterator)},t.wbg.__wbg_get_e3c254076557e348=function(){return _i(function(e,n){const r=Reflect.get(ht(e),ht(n));return Ft(r)},arguments)},t.wbg.__wbg_call_27c0f87801dedf93=function(){return _i(function(e,n){const r=ht(e).call(ht(n));return Ft(r)},arguments)},t.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return Ft(e)},t.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return _i(function(){const e=self.self;return Ft(e)},arguments)},t.wbg.__wbg_window_c6fb939a7f436783=function(){return _i(function(){const e=window.window;return Ft(e)},arguments)},t.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return _i(function(){const e=globalThis.globalThis;return Ft(e)},arguments)},t.wbg.__wbg_global_207b558942527489=function(){return _i(function(){const e=global.global;return Ft(e)},arguments)},t.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(ht(e))},t.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let n;try{n=ht(e)instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_new_28c511d9baebfa89=function(e,n){const r=new Error(uo(e,n));return Ft(r)},t.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return _i(function(e,n,r){const i=ht(e).call(ht(n),ht(r));return Ft(i)},arguments)},t.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(ht(e))},t.wbg.__wbg_new_81740750da40724f=function(e,n){try{var r={a:e,b:n},i=(c,l)=>{const d=r.a;r.a=0;try{return jP(d,r.b,c,l)}finally{r.a=d}};const a=new Promise(i);return Ft(a)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_b0083a7967828ec8=function(e){const n=Promise.resolve(ht(e));return Ft(n)},t.wbg.__wbg_catch_0260e338d10f79ae=function(e,n){const r=ht(e).catch(ht(n));return Ft(r)},t.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,n){const r=ht(e).then(ht(n));return Ft(r)},t.wbg.__wbg_then_a73caa9a87991566=function(e,n,r){const i=ht(e).then(ht(n),ht(r));return Ft(i)},t.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const n=ht(e).buffer;return Ft(n)},t.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,n,r){const i=new Uint8Array(ht(e),n>>>0,r>>>0);return Ft(i)},t.wbg.__wbg_new_63b92bc8671ed464=function(e){const n=new Uint8Array(ht(e));return Ft(n)},t.wbg.__wbg_set_a47bac70306a19a7=function(e,n,r){ht(e).set(ht(n),r>>>0)},t.wbg.__wbg_length_c20a40f15020d68a=function(e){return ht(e).length},t.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let n;try{n=ht(e)instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){const n=ht(e).buffer;return Ft(n)},t.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return ht(e).byteLength},t.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return ht(e).byteOffset},t.wbg.__wbg_has_0af94d20077affa2=function(){return _i(function(e,n){return Reflect.has(ht(e),ht(n))},arguments)},t.wbg.__wbg_set_1f9b04f170055d33=function(){return _i(function(e,n,r){return Reflect.set(ht(e),ht(n),ht(r))},arguments)},t.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return _i(function(e){const n=JSON.stringify(ht(e));return Ft(n)},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=ht(n),i=typeof r=="bigint"?r:void 0;FP()[e/8+1]=Js(i)?BigInt(0):i,_n()[e/4+0]=!Js(i)},t.wbg.__wbindgen_debug_string=function(e,n){const r=N0(ht(n)),i=hf(r,Lt.__wbindgen_malloc,Lt.__wbindgen_realloc),a=fl;_n()[e/4+1]=a,_n()[e/4+0]=i},t.wbg.__wbindgen_throw=function(e,n){throw new Error(uo(e,n))},t.wbg.__wbindgen_memory=function(){const e=Lt.memory;return Ft(e)},t.wbg.__wbindgen_closure_wrapper1726=function(e,n,r){const i=yx(e,n,623,BP);return Ft(i)},t.wbg.__wbindgen_closure_wrapper2715=function(e,n,r){const i=yx(e,n,762,VP);return Ft(i)},t}function HP(t,e){return Lt=t.exports,O0.__wbindgen_wasm_module=e,gd=null,md=null,dd=null,pd=null,Lt}async function O0(t){if(Lt!==void 0)return Lt;typeof t>"u"&&(t="/15m/assets/backend_bg.wasm");const e=WP();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await qP(await t,e);return HP(n,r)}class ZP{constructor(){gi(this,"inner");this.inner=null}async loadOsmFile(e,n,r,i){await O0(),this.inner=await new Pd(e,!0,n,r,i)}async loadGraphFile(e){await O0(),this.inner=await new Pd(e,!1,void 0,void 0,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}renderAmenities(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderAmenities())}renderZones(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderZones())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}bufferRoute(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.bufferRoute({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,use_heuristic:e.useHeuristic,start_time:e.startTime,max_seconds:e.maxSeconds}))}score(e,n){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds,max_seconds:e.maxSeconds},n))}}Av(ZP);let TE="MZEJTanw3WpxRvt7qDfo",$s=Qn({kind:"title"}),I_=Qn(null),Wg=Qn(!0),z0=Qn(!1);function bx(t){return["!=",["get",`access_${t}`],"None"]}let vf=Qn("foot"),Hg=Qn("07:00"),Lc=Qn(null),bf=Qn(null),xx=Qn(!0),wx=Qn(!1),Sx=Qn(5),Ql=Qn(null),mf=Qn(!1);function Zg(t){let e=t.properties.name||`a ${t.properties.amenity_kind}`;return t.properties.brand&&(e+=` (${t.properties.brand})`),t.properties.cuisine&&(e+=` (${t.properties.cuisine})`),e}function Ex(t){let e,n;return e=new Pv({props:{$$slots:{default:[XP,({dialog:r})=>({3:r}),({dialog:r})=>r?8:0]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&24&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function XP(t){let e,n,r,i,a,c,l,d,w,S;function I(){return t[1](t[3])}return{c(){e=ke("h1"),e.textContent="15-minute neighborhood tool",n=nt(),r=ke("p"),r.textContent="TODO. Extremely early in development.",i=nt(),a=ke("p"),a.innerHTML=`This open source - tool is created by - Dustin Carlino - and relies heavily on - OpenStreetMap data.`,c=nt(),l=ke("center"),d=ke("button"),d.textContent="Start!"},m(T,k){Me(T,e,k),Me(T,n,k),Me(T,r,k),Me(T,i,k),Me(T,a,k),Me(T,c,k),Me(T,l,k),xe(l,d),w||(S=Gt(d,"click",I),w=!0)},p(T,k){t=T},d(T){T&&(Le(e),Le(n),Le(r),Le(i),Le(a),Le(c),Le(l)),w=!1,S()}}}function YP(t){let e,n,r=t[0]&&Ex(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ye(r,1)):(r=Ex(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function KP(t,e,n){let r;return Ct(t,Wg,c=>n(0,r=c)),[r,c=>cs(c).close(),()=>Zn(Wg,r=!1,r)]}class JP extends Jt{constructor(e){super(),Kt(this,e,KP,YP,qt,{})}}var Jd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function C_(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Ix=Object.prototype.toString,LE=function(e){var n=Ix.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ix.call(e.callee)==="[object Function]"),r},o0,Cx;function QP(){if(Cx)return o0;Cx=1;var t;if(!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=LE,i=Object.prototype.propertyIsEnumerable,a=!i.call({toString:null},"toString"),c=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(T){var k=T.constructor;return k&&k.prototype===T},w={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},S=function(){if(typeof window>"u")return!1;for(var T in window)try{if(!w["$"+T]&&e.call(window,T)&&window[T]!==null&&typeof window[T]=="object")try{d(window[T])}catch{return!0}}catch{return!0}return!1}(),I=function(T){if(typeof window>"u"||!S)return d(T);try{return d(T)}catch{return!1}};t=function(k){var D=k!==null&&typeof k=="object",U=n.call(k)==="[object Function]",q=r(k),ee=D&&n.call(k)==="[object String]",B=[];if(!D&&!U&&!q)throw new TypeError("Object.keys called on a non-object");var j=c&&U;if(ee&&k.length>0&&!e.call(k,0))for(var J=0;J0)for(var ae=0;ae"u"||!Gi?zn:Gi(Uint8Array),Mc={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?zn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?zn:ArrayBuffer,"%ArrayIteratorPrototype%":tf&&Gi?Gi([][Symbol.iterator]()):zn,"%AsyncFromSyncIteratorPrototype%":zn,"%AsyncFunction%":uf,"%AsyncGenerator%":uf,"%AsyncGeneratorFunction%":uf,"%AsyncIteratorPrototype%":uf,"%Atomics%":typeof Atomics>"u"?zn:Atomics,"%BigInt%":typeof BigInt>"u"?zn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?zn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?zn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?zn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":bM,"%eval%":eval,"%EvalError%":xM,"%Float32Array%":typeof Float32Array>"u"?zn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?zn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?zn:FinalizationRegistry,"%Function%":AE,"%GeneratorFunction%":uf,"%Int8Array%":typeof Int8Array>"u"?zn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?zn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?zn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tf&&Gi?Gi(Gi([][Symbol.iterator]())):zn,"%JSON%":typeof JSON=="object"?JSON:zn,"%Map%":typeof Map>"u"?zn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tf||!Gi?zn:Gi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?zn:Promise,"%Proxy%":typeof Proxy>"u"?zn:Proxy,"%RangeError%":wM,"%ReferenceError%":SM,"%Reflect%":typeof Reflect>"u"?zn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?zn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tf||!Gi?zn:Gi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?zn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tf&&Gi?Gi(""[Symbol.iterator]()):zn,"%Symbol%":tf?Symbol:zn,"%SyntaxError%":xf,"%ThrowTypeError%":IM,"%TypedArray%":TM,"%TypeError%":gf,"%Uint8Array%":typeof Uint8Array>"u"?zn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?zn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?zn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?zn:Uint32Array,"%URIError%":EM,"%WeakMap%":typeof WeakMap>"u"?zn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?zn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?zn:WeakSet};if(Gi)try{null.error}catch(t){var LM=Gi(Gi(t));Mc["%Error.prototype%"]=LM}var PM=function t(e){var n;if(e==="%AsyncFunction%")n=a0("async function () {}");else if(e==="%GeneratorFunction%")n=a0("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=a0("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Gi&&(n=Gi(i.prototype))}return Mc[e]=n,n},Ax={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qd=Ov,Xg=ME,MM=Qd.call(Function.call,Array.prototype.concat),AM=Qd.call(Function.apply,Array.prototype.splice),kx=Qd.call(Function.call,String.prototype.replace),Yg=Qd.call(Function.call,String.prototype.slice),kM=Qd.call(Function.call,RegExp.prototype.exec),DM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,RM=/\\(\\)?/g,NM=function(e){var n=Yg(e,0,1),r=Yg(e,-1);if(n==="%"&&r!=="%")throw new xf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new xf("invalid intrinsic syntax, expected opening `%`");var i=[];return kx(e,DM,function(a,c,l,d){i[i.length]=l?kx(d,RM,"$1"):c||a}),i},OM=function(e,n){var r=e,i;if(Xg(Ax,r)&&(i=Ax[r],r="%"+i[0]+"%"),Xg(Mc,r)){var a=Mc[r];if(a===uf&&(a=PM(r)),typeof a>"u"&&!n)throw new gf("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new xf("intrinsic "+e+" does not exist!")},wl=function(e,n){if(typeof e!="string"||e.length===0)throw new gf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new gf('"allowMissing" argument must be a boolean');if(kM(/^%?[^%]*%?$/,e)===null)throw new xf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=NM(e),i=r.length>0?r[0]:"",a=OM("%"+i+"%",n),c=a.name,l=a.value,d=!1,w=a.alias;w&&(i=w[0],AM(r,MM([0,1],w)));for(var S=1,I=!0;S=r.length){var U=Pc(l,T);I=!!U,I&&"get"in U&&!("originalValue"in U.get)?l=U.get:l=l[T]}else I=Xg(l,T),l=l[T];I&&!d&&(Mc[c]=l)}}return l},u0,Dx;function zv(){if(Dx)return u0;Dx=1;var t=wl,e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return u0=e,u0}var zM=wl,Ag=zM("%Object.getOwnPropertyDescriptor%",!0);if(Ag)try{Ag([],"length")}catch{Ag=null}var Fv=Ag,Rx=zv(),FM=PE,nf=Ku,Nx=Fv,Bv=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new nf("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new nf("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new nf("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new nf("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new nf("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new nf("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,d=!!Nx&&Nx(e,n);if(Rx)Rx(e,n,{configurable:c===null&&d?d.configurable:!c,enumerable:i===null&&d?d.enumerable:!i,value:r,writable:a===null&&d?d.writable:!a});else if(l||!i&&!a&&!c)e[n]=r;else throw new FM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},F0=zv(),kE=function(){return!!F0};kE.hasArrayLengthDefineBug=function(){if(!F0)return null;try{return F0([],"length",{value:1}).length!==1}catch{return!0}};var Vv=kE,BM=Rv,VM=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",UM=Object.prototype.toString,GM=Array.prototype.concat,Ox=Bv,jM=function(t){return typeof t=="function"&&UM.call(t)==="[object Function]"},DE=Vv(),qM=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!jM(r)||!r())return}DE?Ox(t,e,n,!0):Ox(t,e,n)},RE=function(t,e){var n=arguments.length>2?arguments[2]:{},r=BM(e);VM&&(r=GM.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||ZM(n)!==n)throw new Bx("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&Fx){var c=Fx(e,"length");c&&!c.configurable&&(i=!1),c&&!c.writable&&(a=!1)}return(i||a||!r)&&(HM?zx(e,"length",n,!0,!0):zx(e,"length",n)),e};(function(t){var e=Ov,n=wl,r=XM,i=Ku,a=n("%Function.prototype.apply%"),c=n("%Function.prototype.call%"),l=n("%Reflect.apply%",!0)||e.call(c,a),d=zv(),w=n("%Math.max%");t.exports=function(T){if(typeof T!="function")throw new i("a function is required");var k=l(e,c,arguments);return r(k,1+w(0,T.length-(arguments.length-1)),!0)};var S=function(){return l(e,a,arguments)};d?d(t.exports,"apply",{value:S}):t.exports.apply=S})(NE);var Zf=NE.exports,OE=wl,zE=Zf,YM=zE(OE("String.prototype.indexOf")),ga=function(e,n){var r=OE(e,!!n);return typeof r=="function"&&YM(e,".prototype.")>-1?zE(r):r},KM=Rv,FE=T_(),BE=ga,Vx=Object,JM=BE("Array.prototype.push"),Ux=BE("Object.prototype.propertyIsEnumerable"),QM=FE?Object.getOwnPropertySymbols:null,VE=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=Vx(e);if(arguments.length===1)return r;for(var i=1;i2&&!!arguments[2];return(!r||pA)&&(fA?Gx(e,"name",n,!0,!0):Gx(e,"name",n)),e},gA=mA,_A=Ku,yA=Object,qE=gA(function(){if(this==null||this!==yA(this))throw new _A("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0),vA=qE,bA=Xc.supportsDescriptors,xA=Object.getOwnPropertyDescriptor,WE=function(){if(bA&&/a/mig.flags==="gim"){var e=xA(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),n==="dy")return e.get}}return vA},wA=Xc.supportsDescriptors,SA=WE,EA=Object.getOwnPropertyDescriptor,IA=Object.defineProperty,CA=TypeError,jx=Object.getPrototypeOf,TA=/a/,LA=function(){if(!wA||!jx)throw new CA("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=SA(),n=jx(TA),r=EA(n,"flags");return(!r||r.get!==e)&&IA(n,"flags",{configurable:!0,enumerable:!1,get:e}),e},PA=Xc,MA=Zf,AA=qE,HE=WE,kA=LA,ZE=MA(HE());PA(ZE,{getPolyfill:HE,implementation:AA,shim:kA});var DA=ZE,kg={exports:{}},RA=T_,Yc=function(){return RA()&&!!Symbol.toStringTag},NA=Yc(),OA=ga,B0=OA("Object.prototype.toString"),L_=function(e){return NA&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:B0(e)==="[object Arguments]"},XE=function(e){return L_(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&B0(e)!=="[object Array]"&&B0(e.callee)==="[object Function]"},zA=function(){return L_(arguments)}();L_.isLegacyArguments=XE;var YE=zA?L_:XE;const FA={},BA=Object.freeze(Object.defineProperty({__proto__:null,default:FA},Symbol.toStringTag,{value:"Module"})),VA=C_(BA);var Uv=typeof Map=="function"&&Map.prototype,h0=Object.getOwnPropertyDescriptor&&Uv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Kg=Uv&&h0&&typeof h0.get=="function"?h0.get:null,qx=Uv&&Map.prototype.forEach,Gv=typeof Set=="function"&&Set.prototype,f0=Object.getOwnPropertyDescriptor&&Gv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Jg=Gv&&f0&&typeof f0.get=="function"?f0.get:null,Wx=Gv&&Set.prototype.forEach,UA=typeof WeakMap=="function"&&WeakMap.prototype,Sd=UA?WeakMap.prototype.has:null,GA=typeof WeakSet=="function"&&WeakSet.prototype,Ed=GA?WeakSet.prototype.has:null,jA=typeof WeakRef=="function"&&WeakRef.prototype,Hx=jA?WeakRef.prototype.deref:null,qA=Boolean.prototype.valueOf,WA=Object.prototype.toString,HA=Function.prototype.toString,ZA=String.prototype.match,jv=String.prototype.slice,Du=String.prototype.replace,XA=String.prototype.toUpperCase,Zx=String.prototype.toLowerCase,KE=RegExp.prototype.test,Xx=Array.prototype.concat,cl=Array.prototype.join,YA=Array.prototype.slice,Yx=Math.floor,V0=typeof BigInt=="function"?BigInt.prototype.valueOf:null,p0=Object.getOwnPropertySymbols,U0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,wf=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Lo=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===wf||"symbol")?Symbol.toStringTag:null,JE=Object.prototype.propertyIsEnumerable,Kx=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Jx(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||KE.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Yx(-t):Yx(t);if(r!==t){var i=String(r),a=jv.call(e,i.length+1);return Du.call(i,n,"$&_")+"."+Du.call(Du.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Du.call(e,n,"$&_")}var G0=VA,Qx=G0.custom,$x=$E(Qx)?Qx:null,KA=function t(e,n,r,i){var a=n||{};if(Au(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Au(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var c=Au(a,"customInspect")?a.customInspect:!0;if(typeof c!="boolean"&&c!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Au(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Au(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return tI(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var d=String(e);return l?Jx(e,d):d}if(typeof e=="bigint"){var w=String(e)+"n";return l?Jx(e,w):w}var S=typeof a.depth>"u"?5:a.depth;if(typeof r>"u"&&(r=0),r>=S&&S>0&&typeof e=="object")return j0(e)?"[Array]":"[Object]";var I=dk(a,r);if(typeof i>"u")i=[];else if(eI(i,e)>=0)return"[Circular]";function T(Ye,ve,Oe){if(ve&&(i=YA.call(i),i.push(ve)),Oe){var He={depth:a.depth};return Au(a,"quoteStyle")&&(He.quoteStyle=a.quoteStyle),t(Ye,He,r+1,i)}return t(Ye,a,r+1,i)}if(typeof e=="function"&&!ew(e)){var k=ok(e),D=gg(e,T);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(D.length>0?" { "+cl.call(D,", ")+" }":"")}if($E(e)){var U=wf?Du.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):U0.call(e);return typeof e=="object"&&!wf?od(U):U}if(hk(e)){for(var q="<"+Zx.call(String(e.nodeName)),ee=e.attributes||[],B=0;B",q}if(j0(e)){if(e.length===0)return"[]";var j=gg(e,T);return I&&!pk(j)?"["+q0(j,I)+"]":"[ "+cl.call(j,", ")+" ]"}if($A(e)){var J=gg(e,T);return!("cause"in Error.prototype)&&"cause"in e&&!JE.call(e,"cause")?"{ ["+String(e)+"] "+cl.call(Xx.call("[cause]: "+T(e.cause),J),", ")+" }":J.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+cl.call(J,", ")+" }"}if(typeof e=="object"&&c){if($x&&typeof e[$x]=="function"&&G0)return G0(e,{depth:S-r});if(c!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(sk(e)){var ae=[];return qx&&qx.call(e,function(Ye,ve){ae.push(T(ve,e,!0)+" => "+T(Ye,e))}),tw("Map",Kg.call(e),ae,I)}if(uk(e)){var me=[];return Wx&&Wx.call(e,function(Ye){me.push(T(Ye,e))}),tw("Set",Jg.call(e),me,I)}if(ak(e))return d0("WeakMap");if(ck(e))return d0("WeakSet");if(lk(e))return d0("WeakRef");if(tk(e))return od(T(Number(e)));if(rk(e))return od(T(V0.call(e)));if(nk(e))return od(qA.call(e));if(ek(e))return od(T(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===Jd)return"{ [object globalThis] }";if(!QA(e)&&!ew(e)){var de=gg(e,T),te=Kx?Kx(e)===Object.prototype:e instanceof Object||e.constructor===Object,$=e instanceof Object?"":"null prototype",Ae=!te&&Lo&&Object(e)===e&&Lo in e?jv.call(Ju(e),8,-1):$?"Object":"",Y=te||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",oe=Y+(Ae||$?"["+cl.call(Xx.call([],Ae||[],$||[]),": ")+"] ":"");return de.length===0?oe+"{}":I?oe+"{"+q0(de,I)+"}":oe+"{ "+cl.call(de,", ")+" }"}return String(e)};function QE(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function JA(t){return Du.call(String(t),/"/g,""")}function j0(t){return Ju(t)==="[object Array]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function QA(t){return Ju(t)==="[object Date]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function ew(t){return Ju(t)==="[object RegExp]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function $A(t){return Ju(t)==="[object Error]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function ek(t){return Ju(t)==="[object String]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function tk(t){return Ju(t)==="[object Number]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function nk(t){return Ju(t)==="[object Boolean]"&&(!Lo||!(typeof t=="object"&&Lo in t))}function $E(t){if(wf)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!U0)return!1;try{return U0.call(t),!0}catch{}return!1}function rk(t){if(!t||typeof t!="object"||!V0)return!1;try{return V0.call(t),!0}catch{}return!1}var ik=Object.prototype.hasOwnProperty||function(t){return t in this};function Au(t,e){return ik.call(t,e)}function Ju(t){return WA.call(t)}function ok(t){if(t.name)return t.name;var e=ZA.call(HA.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function eI(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return tI(jv.call(t,0,e.maxStringLength),e)+r}var i=Du.call(Du.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,fk);return QE(i,"single",e)}function fk(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+XA.call(e.toString(16))}function od(t){return"Object("+t+")"}function d0(t){return t+" { ? }"}function tw(t,e,n,r){var i=r?q0(n,r):cl.call(n,", ");return t+" ("+e+") {"+i+"}"}function pk(t){for(var e=0;e=0)return!1;return!0}function dk(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=cl.call(Array(t.indent+1)," ");else return null;return{base:n,prev:cl.call(Array(e+1),n)}}function q0(t,e){if(t.length===0)return"";var n=` -`+e.prev+e.base;return n+cl.call(t,","+n)+` -`+e.prev}function gg(t,e){var n=j0(t),r=[];if(n){r.length=t.length;for(var i=0;i=r)return n+1;var i=uw(e,n);if(i<55296||i>56319)return n+1;var a=uw(e,n+1);return a<56320||a>57343?n+1:n+2},g0=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},cw=function(e,n){if(Fk(e)||ow(e))return g0(e);if(Bk(e)){var r=0;return{next:function(){var a=jk(e,r),c=Gk(e,r,a);return r=a,{done:a>e.length,value:c}}}}if(n&&typeof e["_es6-shim iterator_"]<"u")return e["_es6-shim iterator_"]()};if(!Vk&&!Uk)kg.exports=function(e){if(e!=null)return cw(e,!0)};else{var qk=aI,Wk=uI,hw=Ta("Map.prototype.forEach",!0),fw=Ta("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var pw=Ta("Map.prototype.iterator",!0),dw=Ta("Set.prototype.iterator",!0);var mw=Ta("Map.prototype.@@iterator",!0)||Ta("Map.prototype._es6-shim iterator_",!0),gw=Ta("Set.prototype.@@iterator",!0)||Ta("Set.prototype._es6-shim iterator_",!0),Hk=function(e){if(qk(e)){if(pw)return sw(pw(e));if(mw)return mw(e);if(hw){var n=[];return hw(e,function(i,a){lw(n,[a,i])}),g0(n)}}if(Wk(e)){if(dw)return sw(dw(e));if(gw)return gw(e);if(fw){var r=[];return fw(e,function(i){lw(r,i)}),g0(r)}}};kg.exports=function(e){return Hk(e)||cw(e)}}}var Zk=kg.exports,_w=function(t){return t!==t},cI=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||_w(e)&&_w(n))},Xk=cI,hI=function(){return typeof Object.is=="function"?Object.is:Xk},Yk=hI,Kk=Xc,Jk=function(){var e=Yk();return Kk(Object,{is:e},{is:function(){return Object.is!==e}}),e},Qk=Xc,$k=Zf,e3=cI,fI=hI,t3=Jk,pI=$k(fI(),Object);Qk(pI,{getPolyfill:fI,implementation:e3,shim:t3});var n3=pI,r3=Zf,dI=ga,i3=wl,W0=i3("%ArrayBuffer%",!0),Dg=dI("ArrayBuffer.prototype.byteLength",!0),o3=dI("Object.prototype.toString"),yw=!!W0&&!Dg&&new W0(0).slice,vw=!!yw&&r3(yw),mI=Dg||vw?function(e){if(!e||typeof e!="object")return!1;try{return Dg?Dg(e):vw(e,0),!0}catch{return!1}}:W0?function(e){return o3(e)==="[object ArrayBuffer]"}:function(e){return!1},s3=Date.prototype.getDay,a3=function(e){try{return s3.call(e),!0}catch{return!1}},l3=Object.prototype.toString,u3="[object Date]",c3=Yc(),h3=function(e){return typeof e!="object"||e===null?!1:c3?a3(e):l3.call(e)===u3},H0=ga,gI=Yc(),_I,yI,Z0,X0;if(gI){_I=H0("Object.prototype.hasOwnProperty"),yI=H0("RegExp.prototype.exec"),Z0={};var _0=function(){throw Z0};X0={toString:_0,valueOf:_0},typeof Symbol.toPrimitive=="symbol"&&(X0[Symbol.toPrimitive]=_0)}var f3=H0("Object.prototype.toString"),p3=Object.getOwnPropertyDescriptor,d3="[object RegExp]",m3=gI?function(e){if(!e||typeof e!="object")return!1;var n=p3(e,"lastIndex"),r=n&&_I(n,"value");if(!r)return!1;try{yI(e,X0)}catch(i){return i===Z0}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:f3(e)===d3},g3=ga,bw=g3("SharedArrayBuffer.prototype.byteLength",!0),_3=bw?function(e){if(!e||typeof e!="object")return!1;try{return bw(e),!0}catch{return!1}}:function(e){return!1},y3=Number.prototype.toString,v3=function(e){try{return y3.call(e),!0}catch{return!1}},b3=Object.prototype.toString,x3="[object Number]",w3=Yc(),S3=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:w3?v3(e):b3.call(e)===x3},vI=ga,E3=vI("Boolean.prototype.toString"),I3=vI("Object.prototype.toString"),C3=function(e){try{return E3(e),!0}catch{return!1}},T3="[object Boolean]",L3=Yc(),P3=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:L3&&Symbol.toStringTag in e?C3(e):I3(e)===T3},Y0={exports:{}},M3=Object.prototype.toString,A3=Nv();if(A3){var k3=Symbol.prototype.toString,D3=/^Symbol\(.*\)$/,R3=function(e){return typeof e.valueOf()!="symbol"?!1:D3.test(k3.call(e))};Y0.exports=function(e){if(typeof e=="symbol")return!0;if(M3.call(e)!=="[object Symbol]")return!1;try{return R3(e)}catch{return!1}}}else Y0.exports=function(e){return!1};var N3=Y0.exports,K0={exports:{}},xw=typeof BigInt<"u"&&BigInt,O3=function(){return typeof xw=="function"&&typeof BigInt=="function"&&typeof xw(42)=="bigint"&&typeof BigInt(42)=="bigint"},z3=O3();if(z3){var F3=BigInt.prototype.valueOf,B3=function(e){try{return F3.call(e),!0}catch{}return!1};K0.exports=function(e){return e===null||typeof e>"u"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:B3(e)}}else K0.exports=function(e){return!1};var V3=K0.exports,U3=oI,G3=S3,j3=P3,q3=N3,W3=V3,H3=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(U3(e))return"String";if(G3(e))return"Number";if(j3(e))return"Boolean";if(q3(e))return"Symbol";if(W3(e))return"BigInt"},e_=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,ww=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,t_;e_||(t_=function(e){return!1});var J0=e_?e_.prototype.has:null,y0=ww?ww.prototype.has:null;!t_&&!J0&&(t_=function(e){return!1});var Z3=t_||function(e){if(!e||typeof e!="object")return!1;try{if(J0.call(e,J0),y0)try{y0.call(e,y0)}catch{return!0}return e instanceof e_}catch{}return!1},Q0={exports:{}},X3=wl,bI=ga,Y3=X3("%WeakSet%",!0),v0=bI("WeakSet.prototype.has",!0);if(v0){var b0=bI("WeakMap.prototype.has",!0);Q0.exports=function(e){if(!e||typeof e!="object")return!1;try{if(v0(e,v0),b0)try{b0(e,b0)}catch{return!0}return e instanceof Y3}catch{}return!1}}else Q0.exports=function(e){return!1};var K3=Q0.exports,J3=aI,Q3=uI,$3=Z3,e4=K3,t4=function(e){if(e&&typeof e=="object"){if(J3(e))return"Map";if(Q3(e))return"Set";if($3(e))return"WeakMap";if(e4(e))return"WeakSet"}return!1},xI=Function.prototype.toString,ff=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,$0,Rg;if(typeof ff=="function"&&typeof Object.defineProperty=="function")try{$0=Object.defineProperty({},"length",{get:function(){throw Rg}}),Rg={},ff(function(){throw 42},null,$0)}catch(t){t!==Rg&&(ff=null)}else ff=null;var n4=/^\s*class\b/,ev=function(e){try{var n=xI.call(e);return n4.test(n)}catch{return!1}},x0=function(e){try{return ev(e)?!1:(xI.call(e),!0)}catch{return!1}},Ng=Object.prototype.toString,r4="[object Object]",i4="[object Function]",o4="[object GeneratorFunction]",s4="[object HTMLAllCollection]",a4="[object HTML document.all class]",l4="[object HTMLCollection]",u4=typeof Symbol=="function"&&!!Symbol.toStringTag,c4=!(0 in[,]),tv=function(){return!1};if(typeof document=="object"){var h4=document.all;Ng.call(h4)===Ng.call(document.all)&&(tv=function(e){if((c4||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Ng.call(e);return(n===s4||n===a4||n===l4||n===r4)&&e("")==null}catch{}return!1})}var f4=ff?function(e){if(tv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ff(e,null,$0)}catch(n){if(n!==Rg)return!1}return!ev(e)&&x0(e)}:function(e){if(tv(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(u4)return x0(e);if(ev(e))return!1;var n=Ng.call(e);return n!==i4&&n!==o4&&!/^\[object HTML/.test(n)?!1:x0(e)},p4=f4,d4=Object.prototype.toString,wI=Object.prototype.hasOwnProperty,m4=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),d4.call(e)==="[object Array]"?m4(e,n,i):typeof e=="string"?g4(e,n,i):_4(e,n,i)},v4=y4,b4=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],w0=b4,x4=typeof globalThis>"u"?Jd:globalThis,w4=function(){for(var e=[],n=0;n"u"?Jd:globalThis,nv=S4(),Yv=Xv("String.prototype.slice"),S0=Object.getPrototypeOf,I4=Xv("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:T4(e)}return Og?C4(e):null},P4=ga,Iw=P4("ArrayBuffer.prototype.byteLength",!0),M4=mI,A4=function(e){return M4(e)?Iw?Iw(e):e.byteLength:NaN},EI=uA,Sl=ga,Cw=DA,k4=wl,Sf=Zk,D4=rI,Tw=n3,Lw=YE,Pw=iI,Mw=mI,Aw=h3,kw=m3,Dw=_3,Rw=Rv,Nw=H3,Ow=t4,zw=L4,Fw=A4,Bw=Sl("SharedArrayBuffer.prototype.byteLength",!0),Vw=Sl("Date.prototype.getTime"),E0=Object.getPrototypeOf,Uw=Sl("Object.prototype.toString"),i_=k4("%Set%",!0),rv=Sl("Map.prototype.has",!0),o_=Sl("Map.prototype.get",!0),Gw=Sl("Map.prototype.size",!0),s_=Sl("Set.prototype.add",!0),II=Sl("Set.prototype.delete",!0),a_=Sl("Set.prototype.has",!0),zg=Sl("Set.prototype.size",!0);function jw(t,e,n,r){for(var i=Sf(t),a;(a=i.next())&&!a.done;)if(Aa(e,a.value,n,r))return II(t,a.value),!0;return!1}function CI(t){if(typeof t>"u")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function R4(t,e,n,r,i,a){var c=CI(n);if(c!=null)return c;var l=o_(e,c),d=EI({},i,{strict:!1});return typeof l>"u"&&!rv(e,c)||!Aa(r,l,d,a)?!1:!rv(t,c)&&Aa(r,l,d,a)}function N4(t,e,n){var r=CI(n);return r??(a_(e,r)&&!a_(t,r))}function qw(t,e,n,r,i,a){for(var c=Sf(t),l,d;(l=c.next())&&!l.done;)if(d=l.value,Aa(n,d,i,a)&&Aa(r,o_(e,d),i,a))return II(t,d),!0;return!1}function Aa(t,e,n,r){var i=n||{};if(i.strict?Tw(t,e):t===e)return!0;var a=Nw(t),c=Nw(e);if(a!==c)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Tw(t,e):t==e;var l=r.has(t),d=r.has(e),w;if(l&&d){if(r.get(t)===r.get(e))return!0}else w={};return l||r.set(t,w),d||r.set(e,w),F4(t,e,i,r)}function Ww(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function O4(t,e,n,r){if(zg(t)!==zg(e))return!1;for(var i=Sf(t),a=Sf(e),c,l,d;(c=i.next())&&!c.done;)if(c.value&&typeof c.value=="object")d||(d=new i_),s_(d,c.value);else if(!a_(e,c.value)){if(n.strict||!N4(t,e,c.value))return!1;d||(d=new i_),s_(d,c.value)}if(d){for(;(l=a.next())&&!l.done;)if(l.value&&typeof l.value=="object"){if(!jw(d,l.value,n.strict,r))return!1}else if(!n.strict&&!a_(t,l.value)&&!jw(d,l.value,n.strict,r))return!1;return zg(d)===0}return!0}function z4(t,e,n,r){if(Gw(t)!==Gw(e))return!1;for(var i=Sf(t),a=Sf(e),c,l,d,w,S,I;(c=i.next())&&!c.done;)if(w=c.value[0],S=c.value[1],w&&typeof w=="object")d||(d=new i_),s_(d,w);else if(I=o_(e,w),typeof I>"u"&&!rv(e,w)||!Aa(S,I,n,r)){if(n.strict||!R4(t,e,w,S,n,r))return!1;d||(d=new i_),s_(d,w)}if(d){for(;(l=a.next())&&!l.done;)if(w=l.value[0],I=l.value[1],w&&typeof w=="object"){if(!qw(d,t,w,I,n,r))return!1}else if(!n.strict&&(!t.has(w)||!Aa(o_(t,w),I,n,r))&&!qw(d,t,w,I,EI({},n,{strict:!1}),r))return!1;return zg(d)===0}return!0}function F4(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||Uw(t)!==Uw(e)||Lw(t)!==Lw(e))return!1;var c=Pw(t),l=Pw(e);if(c!==l)return!1;var d=t instanceof Error,w=e instanceof Error;if(d!==w||(d||w)&&(t.name!==e.name||t.message!==e.message))return!1;var S=kw(t),I=kw(e);if(S!==I||(S||I)&&(t.source!==e.source||Cw(t)!==Cw(e)))return!1;var T=Aw(t),k=Aw(e);if(T!==k||(T||k)&&Vw(t)!==Vw(e)||n.strict&&E0&&E0(t)!==E0(e))return!1;var D=zw(t),U=zw(e);if(D!==U)return!1;if(D||U){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(me[i]!=de[i])return!1;for(i=me.length-1;i>=0;i--)if(a=me[i],!Aa(t[a],e[a],n,r))return!1;var te=Ow(t),$=Ow(e);return te!==$?!1:te==="Set"||$==="Set"?O4(t,e,n,r):te==="Map"?z4(t,e,n,r):!0}var B4=function(e,n,r){return Aa(e,n,r,D4())};const V4=Dv(B4);var U4=Object.defineProperty,rr=(t,e)=>U4(t,"name",{value:e,configurable:!0}),G4=class{constructor(e){this.direction=!1,this.compareProperties=!0;var n,r,i;this.precision=10**-((n=e==null?void 0:e.precision)!=null?n:17),this.direction=(r=e==null?void 0:e.direction)!=null?r:!1,this.compareProperties=(i=e==null?void 0:e.compareProperties)!=null?i:!0}compare(e,n){if(e.type!==n.type||!_d(e,n))return!1;switch(e.type){case"Point":return this.compareCoord(e.coordinates,n.coordinates);case"LineString":return this.compareLine(e.coordinates,n.coordinates);case"Polygon":return this.comparePolygon(e,n);case"GeometryCollection":return this.compareGeometryCollection(e,n);case"Feature":return this.compareFeature(e,n);case"FeatureCollection":return this.compareFeatureCollection(e,n);default:if(e.type.startsWith("Multi")){const r=iv(e),i=iv(n);return r.every(a=>i.some(c=>this.compare(a,c)))}}return!1}compareCoord(e,n){return e.length===n.length&&e.every((r,i)=>Math.abs(r-n[i])=0&&(r=[].concat(e.slice(i,e.length),e.slice(1,i+1))),r}comparePath(e,n){return e.every((r,i)=>this.compareCoord(r,n[i]))}comparePolygon(e,n){if(this.compareLine(e.coordinates[0],n.coordinates[0],1,!0)){const r=e.coordinates.slice(1,e.coordinates.length),i=n.coordinates.slice(1,n.coordinates.length);return r.every(a=>i.some(c=>this.compareLine(a,c,1,!0)))}return!1}compareGeometryCollection(e,n){return _d(e.geometries,n.geometries)&&this.compareBBox(e,n)&&e.geometries.every((r,i)=>this.compare(r,n.geometries[i]))}compareFeature(e,n){return e.id===n.id&&(this.compareProperties?V4(e.properties,n.properties):!0)&&this.compareBBox(e,n)&&this.compare(e.geometry,n.geometry)}compareFeatureCollection(e,n){return _d(e.features,n.features)&&this.compareBBox(e,n)&&e.features.every((r,i)=>this.compare(r,n.features[i]))}compareBBox(e,n){return!e.bbox&&!n.bbox||(e.bbox&&n.bbox?this.compareCoord(e.bbox,n.bbox):!1)}};rr(G4,"GeojsonEquality");function _d(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}rr(_d,"sameLength");function iv(t){return t.coordinates.map(e=>({type:t.type.replace("Multi",""),coordinates:e}))}rr(iv,"explode");var Cs=63710088e-1,TI={centimeters:Cs*100,centimetres:Cs*100,degrees:360/(2*Math.PI),feet:Cs*3.28084,inches:Cs*39.37,kilometers:Cs/1e3,kilometres:Cs/1e3,meters:Cs,metres:Cs,miles:Cs/1609.344,millimeters:Cs*1e3,millimetres:Cs*1e3,nauticalmiles:Cs/1852,radians:1,yards:Cs*1.0936},Hw={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function ml(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}rr(ml,"feature");function j4(t,e,n={}){switch(t){case"Point":return ql(e).geometry;case"LineString":return Zl(e).geometry;case"Polygon":return Kv(e).geometry;case"MultiPoint":return PI(e).geometry;case"MultiLineString":return LI(e).geometry;case"MultiPolygon":return MI(e).geometry;default:throw new Error(t+" is invalid")}}rr(j4,"geometry");function ql(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!l_(t[0])||!l_(t[1]))throw new Error("coordinates must contain numbers");return ml({type:"Point",coordinates:t},e,n)}rr(ql,"point");function q4(t,e,n={}){return P_(t.map(r=>ql(r,e)),n)}rr(q4,"points");function Kv(t,e,n={}){for(const i of t){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let a=0;aKv(r,e)),n)}rr(W4,"polygons");function Zl(t,e,n={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return ml({type:"LineString",coordinates:t},e,n)}rr(Zl,"lineString");function H4(t,e,n={}){return P_(t.map(r=>Zl(r,e)),n)}rr(H4,"lineStrings");function P_(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}rr(P_,"featureCollection");function LI(t,e,n={}){return ml({type:"MultiLineString",coordinates:t},e,n)}rr(LI,"multiLineString");function PI(t,e,n={}){return ml({type:"MultiPoint",coordinates:t},e,n)}rr(PI,"multiPoint");function MI(t,e,n={}){return ml({type:"MultiPolygon",coordinates:t},e,n)}rr(MI,"multiPolygon");function Z4(t,e,n={}){return ml({type:"GeometryCollection",geometries:t},e,n)}rr(Z4,"geometryCollection");function X4(t,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");const n=Math.pow(10,e||0);return Math.round(t*n)/n}rr(X4,"round");function AI(t,e="kilometers"){const n=TI[e];if(!n)throw new Error(e+" units is invalid");return t*n}rr(AI,"radiansToLength");function Jv(t,e="kilometers"){const n=TI[e];if(!n)throw new Error(e+" units is invalid");return t/n}rr(Jv,"lengthToRadians");function Y4(t,e){return kI(Jv(t,e))}rr(Y4,"lengthToDegrees");function K4(t){let e=t%360;return e<0&&(e+=360),e}rr(K4,"bearingToAzimuth");function kI(t){return t%(2*Math.PI)*180/Math.PI}rr(kI,"radiansToDegrees");function J4(t){return t%360*Math.PI/180}rr(J4,"degreesToRadians");function Q4(t,e="kilometers",n="kilometers"){if(!(t>=0))throw new Error("length must be a positive number");return AI(Jv(t,e),n)}rr(Q4,"convertLength");function $4(t,e="meters",n="kilometers"){if(!(t>=0))throw new Error("area must be a positive number");const r=Hw[e];if(!r)throw new Error("invalid original units");const i=Hw[n];if(!i)throw new Error("invalid final units");return t/r*i}rr($4,"convertArea");function l_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}rr(l_,"isNumber");function Qv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}rr(Qv,"isObject");function eD(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(e=>{if(!l_(e))throw new Error("bbox must only contain numbers")})}rr(eD,"validateBBox");function tD(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")}rr(tD,"validateId");var nD=Object.defineProperty,mo=(t,e)=>nD(t,"name",{value:e,configurable:!0});function Yf(t,e,n){if(t!==null)for(var r,i,a,c,l,d,w,S=0,I=0,T,k=t.type,D=k==="FeatureCollection",U=k==="Feature",q=D?t.features.length:1,ee=0;eed||D>w||U>S){l=I,d=r,w=D,S=U,a=0;return}var q=Zl([l,I],n.properties);if(e(q,r,i,U,a)===!1)return!1;a++,l=I})===!1)return!1}}})}mo(NI,"segmentEach");function uD(t,e,n){var r=n,i=!1;return NI(t,function(a,c,l,d,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,d,w),i=!0}),r}mo(uD,"segmentReduce");function OI(t,e){if(!t)throw new Error("geojson is required");M_(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;lpD(t,"name",{value:e,configurable:!0});function e1(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Yf(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]1)return 1;for(var h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var D=d(T);let U,q;function ee(){return U==null&&(U=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),U}function B(){if(q==null&&(q=!1,ee())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const _=4*p;o.fillStyle=`rgb(${_},${_+1},${_+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){q=!0;break}}}return q||!1}function j(u,o,h,p){const _=new D(u,o,h,p);return function(b){return _.solve(b)}}const J=j(.25,.1,.25,1);function ae(u,o,h){return Math.min(h,Math.max(o,u))}function me(u,o,h){const p=h-o,_=((u-o)%p+p)%p+o;return _===o?h:_}function de(u,...o){for(const h of o)for(const p in h)u[p]=h[p];return u}let te=1;function $(u,o,h){const p={};for(const _ in u)p[_]=o.call(h||this,u[_],_,u);return p}function Ae(u,o,h){const p={};for(const _ in u)o.call(h||this,u[_],_,u)&&(p[_]=u[_]);return p}function Y(u){return Array.isArray(u)?u.map(Y):typeof u=="object"&&u?$(u,Y):u}const oe={};function Ye(u){oe[u]||(typeof console<"u"&&console.warn(u),oe[u]=!0)}function ve(u,o,h){return(h.y-u.y)*(o.x-u.x)>(o.y-u.y)*(h.x-u.x)}function Oe(u){let o=0;for(let h,p,_=0,b=u.length,x=b-1;_"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(u,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),P=new Uint8ClampedArray(p*_*4);if(yield b.copyTo(P,function(A,N,O,G,H){const X=4*Math.max(-N,0),re=(Math.max(0,O)-O)*G*4+X,ce=4*G,ge=Math.max(0,N),Re=Math.max(0,O);return{rect:{x:ge,y:Re,width:Math.min(A.width,N+G)-ge,height:Math.min(A.height,O+H)-Re},layout:[{offset:re,stride:ce}]}}(u,o,h,p,_)),E)for(let A=0;AHe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,_r=function(u,o){if(/:\/\//.test(u.url)&&!/^https?:|^file:/.test(u.url)){const p=mn(u.url);if(p)return p(u,o);if(He(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,targetMapId:Bn},o)}if(!(/^file:/.test(h=u.url)||/^file:/.test($r())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(this,void 0,void 0,function*(){const b=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:$r(),signal:_.signal});p.type==="json"&&b.headers.set("Accept","application/json");const x=yield fetch(b);if(!x.ok){const A=yield x.blob();throw new ir(x.status,x.statusText,p.url,A)}let E;E=p.type==="arrayBuffer"||p.type==="image"?x.arrayBuffer():p.type==="json"?x.json():x.text();const P=yield E;if(_.signal.aborted)throw Fn();return{data:P,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(u,o);if(He(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:u,mustQueue:!0,targetMapId:Bn},o)}var h;return function(p,_){return new Promise((b,x)=>{const E=new XMLHttpRequest;E.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(E.responseType="arraybuffer");for(const P in p.headers)E.setRequestHeader(P,p.headers[P]);p.type==="json"&&(E.responseType="text",E.setRequestHeader("Accept","application/json")),E.withCredentials=p.credentials==="include",E.onerror=()=>{x(new Error(E.statusText))},E.onload=()=>{if(!_.signal.aborted)if((E.status>=200&&E.status<300||E.status===0)&&E.response!==null){let P=E.response;if(p.type==="json")try{P=JSON.parse(E.response)}catch(A){return void x(A)}b({data:P,cacheControl:E.getResponseHeader("Cache-Control"),expires:E.getResponseHeader("Expires")})}else{const P=new Blob([E.response],{type:E.getResponseHeader("Content-Type")});x(new ir(E.status,E.statusText,p.url,P))}},_.signal.addEventListener("abort",()=>{E.abort(),x(Fn())}),E.send(p.body)})}(u,o)};function cr(u){if(!u||u.indexOf("://")<=0||u.indexOf("data:image/")===0||u.indexOf("blob:")===0)return!0;const o=new URL(u),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function or(u,o,h){h[u]&&h[u].indexOf(o)!==-1||(h[u]=h[u]||[],h[u].push(o))}function ie(u,o,h){if(h&&h[u]){const p=h[u].indexOf(o);p!==-1&&h[u].splice(p,1)}}class Ce{constructor(o,h={}){de(this,h),this.type=o}}class _t extends Ce{constructor(o,h={}){super("error",de({error:o},h))}}class xn{on(o,h){return this._listeners=this._listeners||{},or(o,h,this._listeners),this}off(o,h){return ie(o,h,this._listeners),ie(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},or(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Ce(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const E of _)E.call(this,o);const b=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const E of b)ie(p,E,this._oneTimeListeners),E.call(this,o);const x=this._eventedParent;x&&(de(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(o))}else o instanceof _t&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,h){return this._eventedParent=o,this._eventedParentData=h,this}}var ze={$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 en=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Dr(u,o){const h={};for(const p in u)p!=="ref"&&(h[p]=u[p]);return en.forEach(p=>{p in o&&(h[p]=o[p])}),h}function fn(u,o){if(Array.isArray(u)){if(!Array.isArray(o)||u.length!==o.length)return!1;for(let h=0;h`:u.itemType.kind==="value"?"array":`array<${o}>`}return u.kind}const Ee=[ei,ft,on,nn,Rr,Vr,$o,K(tn),he,V,W];function Q(u,o){if(o.kind==="error")return null;if(u.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!Q(u.itemType,o.itemType))&&(typeof u.N!="number"||u.N===o.N))return null}else{if(u.kind===o.kind)return null;if(u.kind==="value"){for(const h of Ee)if(!Q(h,o))return null}}return`Expected ${se(u)} but found ${se(o)} instead.`}function Ie(u,o){return o.some(h=>h.kind===u.kind)}function _e(u,o){return o.some(h=>h==="null"?u===null:h==="array"?Array.isArray(u):h==="object"?u&&!Array.isArray(u)&&typeof u=="object":h===typeof u)}function De(u,o){return u.kind==="array"&&o.kind==="array"?u.itemType.kind===o.itemType.kind&&typeof u.N=="number":u.kind===o.kind}const je=.96422,Ze=.82521,Ke=4/29,Mt=6/29,Nt=3*Mt*Mt,Yt=Mt*Mt*Mt,Qt=Math.PI/180,En=180/Math.PI;function Xn(u){return(u%=360)<0&&(u+=360),u}function hr([u,o,h,p]){let _,b;const x=cn((.2225045*(u=ti(u))+.7168786*(o=ti(o))+.0606169*(h=ti(h)))/1);u===o&&o===h?_=b=x:(_=cn((.4360747*u+.3850649*o+.1430804*h)/je),b=cn((.0139322*u+.0971045*o+.7141733*h)/Ze));const E=116*x-16;return[E<0?0:E,500*(_-x),200*(x-b),p]}function ti(u){return u<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function cn(u){return u>Yt?Math.pow(u,1/3):u/Nt+Ke}function Ir([u,o,h,p]){let _=(u+16)/116,b=isNaN(o)?_:_+o/500,x=isNaN(h)?_:_-h/200;return _=1*to(_),b=je*to(b),x=Ze*to(x),[ai(3.1338561*b-1.6168667*_-.4906146*x),ai(-.9787684*b+1.9161415*_+.033454*x),ai(.0719453*b-.2289914*_+1.4052427*x),p]}function ai(u){return(u=u<=.00304?12.92*u:1.055*Math.pow(u,1/2.4)-.055)<0?0:u>1?1:u}function to(u){return u>Mt?u*u*u:Nt*(u-Ke)}function go(u){return parseInt(u.padEnd(2,u),16)/255}function xi(u,o){return Vs(o?u/100:u,0,1)}function Vs(u,o,h){return Math.min(Math.max(o,u),h)}function um(u){return!u.some(Number.isNaN)}const K_={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 jn{constructor(o,h,p,_=1,b=!0){this.r=o,this.g=h,this.b=p,this.a=_,b||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[o,h,p,_]))}static parse(o){if(o instanceof jn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=K_[p];if(_){const[x,E,P]=_;return[x/255,E/255,P/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const x=p.length<6?1:2;let E=1;return[go(p.slice(E,E+=x)),go(p.slice(E,E+=x)),go(p.slice(E,E+=x)),go(p.slice(E,E+x)||"ff")]}if(p.startsWith("rgb")){const x=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,P,A,N,O,G,H,X,re,ce,ge,Re]=x,be=[N||" ",H||" ",ce].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Te=[A,G,re].join(""),Je=Te==="%%%"?100:Te===""?255:0;if(Je){const Qe=[Vs(+P/Je,0,1),Vs(+O/Je,0,1),Vs(+X/Je,0,1),ge?xi(+ge,Re):1];if(um(Qe))return Qe}}return}}const b=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,P,A,N,O,G,H,X]=b,re=[P||" ",N||" ",G].join("");if(re===" "||re===" /"||re===",,"||re===",,,"){const ce=[+E,Vs(+A,0,100),Vs(+O,0,100),H?xi(+H,X):1];if(um(ce))return function([ge,Re,be,Te]){function Je(Qe){const wt=(Qe+ge/30)%12,Tt=Re*Math.min(be,1-be);return be-Tt*Math.max(-1,Math.min(wt-3,9-wt,1))}return ge=Xn(ge),Re/=100,be/=100,[Je(0),Je(8),Je(4),Te]}(ce)}}}(o);return h?new jn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:_}=this,b=_||1/0;return this.overwriteGetter("rgb",[o/b,h/b,p/b,_])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,_,b]=hr(o),x=Math.sqrt(p*p+_*_);return[Math.round(1e4*x)?Xn(Math.atan2(_,p)*En):NaN,x,h,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",hr(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,_]=this.rgb;return`rgba(${[o,h,p].map(b=>Math.round(255*b)).join(",")},${_})`}}jn.black=new jn(0,0,0,1),jn.white=new jn(1,1,1,1),jn.transparent=new jn(0,0,0,0),jn.red=new jn(1,0,0,1);class op{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class sp{constructor(o,h,p,_,b){this.text=o,this.image=h,this.scale=p,this.fontStack=_,this.textColor=b}}class Ro{constructor(o){this.sections=o}static fromString(o){return new Ro([new sp(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof Ro?o:Ro.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class _o{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof _o)return o;if(typeof o=="number")return new _o([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new _o(o)}}toString(){return JSON.stringify(this.values)}}const ec=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class es{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof es)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h=0&&u<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,o,h,p]:[u,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function nh(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof jn||u instanceof op||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts)return!0;if(Array.isArray(u)){for(const o of u)if(!nh(o))return!1;return!0}if(typeof u=="object"){for(const o in u)if(!nh(u[o]))return!1;return!0}return!1}function ni(u){if(u===null)return ei;if(typeof u=="string")return on;if(typeof u=="boolean")return nn;if(typeof u=="number")return ft;if(u instanceof jn)return Rr;if(u instanceof op)return ba;if(u instanceof Ro)return Vr;if(u instanceof _o)return he;if(u instanceof es)return W;if(u instanceof ts)return V;if(Array.isArray(u)){const o=u.length;let h;for(const p of u){const _=ni(p);if(h){if(h===_)continue;h=tn;break}h=_}return K(h||tn,o)}return $o}function tc(u){const o=typeof u;return u===null?"":o==="string"||o==="number"||o==="boolean"?String(u):u instanceof jn||u instanceof Ro||u instanceof _o||u instanceof es||u instanceof ts?u.toString():JSON.stringify(u)}class Za{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!nh(o[1]))return h.error("invalid value");const p=o[1];let _=ni(p);const b=h.expectedType;return _.kind!=="array"||_.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(_=b),new Za(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class yr{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const rh={string:on,number:ft,boolean:nn,object:$o};class No{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,_=1;const b=o[0];if(b==="array"){let E,P;if(o.length>2){const A=o[1];if(typeof A!="string"||!(A in rh)||A==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);E=rh[A],_++}else E=tn;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);P=o[2],_++}p=K(E,P)}else{if(!rh[b])throw new Error(`Types doesn't contain name = ${b}`);p=rh[b]}const x=[];for(;_o.outputDefined())}}const ih={"to-boolean":nn,"to-color":Rr,"to-number":ft,"to-string":on};class Us{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!ih[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const _=ih[p],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:uu(h[0],h[1],h[2],h[3]),!p))return new jn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new yr(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const _=_o.parse(h);if(_)return _}throw new yr(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const _=es.parse(h);if(_)return _}throw new yr(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new yr(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return Ro.fromString(tc(this.args[0].evaluate(o)));case"resolvedImage":return ts.fromString(tc(this.args[0].evaluate(o)));default:return tc(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const nc=["Unknown","Point","LineString","Polygon"];class qn{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"?nc[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(o){let h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=jn.parse(o)),h}}class oh{constructor(o,h,p=[],_,b=new Tl,x=[]){this.registry=o,this.path=p,this.key=p.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=_,this._isConstant=h}parse(o,h,p,_,b={}){return h?this.concat(h,p,_)._parse(o,b):this._parse(o,b)}_parse(o,h){function p(_,b,x){return x==="assert"?new No(b,[_]):x==="coerce"?new Us(b,[_]):_}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const _=o[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[_];if(b){let x=b.parse(o,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,P=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||P.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(E.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(E,P))return null}else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"coerce");else x=p(x,E,h.typeAnnotation||"assert")}if(!(x instanceof Za)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new qn;try{x=new Za(x.type,x.evaluate(E))}catch(P){return this.error(P.message),null}}return x}return this.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,h,p){const _=typeof o=="number"?this.path.concat(o):this.path,b=p?this.scope.concat(p):this.scope;return new oh(this.registry,this._isConstant,_,h||null,b,this.errors)}error(o,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new eo(p,o))}checkSubtype(o,h){const p=Q(o,h);return p&&this.error(p),p}}class cu{constructor(o,h,p){this.type=ba,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,nn);if(!_)return null;const b=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,nn);if(!b)return null;let x=null;return p.locale&&(x=h.parse(p.locale,1,on),!x)?null:new cu(_,b,x)}evaluate(o){return new op(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}const Xa=8192;function sh(u,o){u[0]=Math.min(u[0],o[0]),u[1]=Math.min(u[1],o[1]),u[2]=Math.max(u[2],o[0]),u[3]=Math.max(u[3],o[1])}function rc(u,o){return!(u[0]<=o[0]||u[2]>=o[2]||u[1]<=o[1]||u[3]>=o[3])}function J_(u,o){const h=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,_=Math.pow(2,o.z);return[Math.round(h*_*Xa),Math.round(p*_*Xa)]}function cm(u,o,h){const p=u[0]-o[0],_=u[1]-o[1],b=u[0]-h[0],x=u[1]-h[1];return p*x-b*_==0&&p*b<=0&&_*x<=0}function ah(u,o){let h=!1;for(let x=0,E=o.length;x(p=u)[1]!=(b=P[A+1])[1]>p[1]&&p[0]<(b[0]-_[0])*(p[1]-_[1])/(b[1]-_[1])+_[0]&&(h=!h)}}var p,_,b;return h}function Q_(u,o){for(let h=0;h0&&E<0||x<0&&E>0}function $_(u,o,h){for(const A of h)for(let N=0;Nh[2]){const _=.5*p;let b=u[0]-h[0]>_?-p:h[0]-u[0]>_?p:0;b===0&&(b=u[0]-h[2]>_?-p:h[2]-u[0]>_?p:0),u[0]+=b}sh(o,u)}function uh(u,o,h,p){const _=Math.pow(2,p.z)*Xa,b=[p.x*Xa,p.y*Xa],x=[];for(const E of u)for(const P of E){const A=[P.x+b[0],P.y+b[1]];mm(A,o,h,_),x.push(A)}return x}function gm(u,o,h,p){const _=Math.pow(2,p.z)*Xa,b=[p.x*Xa,p.y*Xa],x=[];for(const P of u){const A=[];for(const N of P){const O=[N.x+b[0],N.y+b[1]];sh(o,O),A.push(O)}x.push(A)}if(o[2]-o[0]<=_/2){(E=o)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const P of x)for(const A of P)mm(A,o,h,_)}var E;return x}class Ll{constructor(o,h){this.type=nn,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(nh(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const _=[];for(const b of p.features){const{type:x,coordinates:E}=b.geometry;x==="Polygon"&&_.push(E),x==="MultiPolygon"&&_.push(...E)}if(_.length)return new Ll(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Ll(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Ll(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const E=lh(p.coordinates,b,x),P=uh(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!ah(A,E))return!1}if(p.type==="MultiPolygon"){const E=dm(p.coordinates,b,x),P=uh(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!Q_(A,E))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],b=[1/0,1/0,-1/0,-1/0],x=h.canonicalID();if(p.type==="Polygon"){const E=lh(p.coordinates,b,x),P=gm(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!fm(A,E))return!1}if(p.type==="MultiPolygon"){const E=dm(p.coordinates,b,x),P=gm(h.geometry(),_,b,x);if(!rc(_,b))return!1;for(const A of P)if(!pm(A,E))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ch{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new ch(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Oo{constructor(o,h,p,_){this.name=o,this.type=h,this._evaluate=p,this.args=_}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],_=Oo.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const b=Array.isArray(_)?_[0]:_.type,x=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,E=x.filter(([A])=>!Array.isArray(A)||A.length===o.length-1);let P=null;for(const[A,N]of E){P=new oh(h.registry,ic,h.path,null,h.scope);const O=[];let G=!1;for(let H=1;H{return G=O,Array.isArray(G)?`(${G.map(se).join(", ")})`:`(${se(G.type)}...)`;var G}).join(" | "),N=[];for(let O=1;O{h=o?h&&ic(p):h&&p instanceof Za}),!!h&&hh(u)&&sc(u,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function hh(u){if(u instanceof Oo&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof Ll)return!1;let o=!0;return u.eachChild(h=>{o&&!hh(h)&&(o=!1)}),o}function oc(u){if(u instanceof Oo&&u.name==="feature-state")return!1;let o=!0;return u.eachChild(h=>{o&&!oc(h)&&(o=!1)}),o}function sc(u,o){if(u instanceof Oo&&o.indexOf(u.name)>=0)return!1;let h=!0;return u.eachChild(p=>{h&&!sc(p,o)&&(h=!1)}),h}function ac(u,o){const h=u.length-1;let p,_,b=0,x=h,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),p=u[E],_=u[E+1],p<=o){if(E===h||o<_)return E;b=E+1}else{if(!(p>o))throw new yr("Input is not a number.");x=E-1}return 0}class lc{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,b]of p)this.labels.push(_),this.outputs.push(b)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,ft);if(!p)return null;const _=[];let b=null;h.expectedType&&h.expectedType.kind!=="value"&&(b=h.expectedType);for(let x=1;x=E)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const O=h.parse(P,N,b);if(!O)return null;b=b||O.type,_.push([E,O])}return new lc(b,p,_)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;return _>=h[b-1]?p[b-1].evaluate(o):p[ac(h,_)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function ey(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var ty=_m;function _m(u,o,h,p){this.cx=3*u,this.bx=3*(h-u)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=u,this.p1y=o,this.p2x=h,this.p2y=p}_m.prototype={sampleCurveX:function(u){return((this.ax*u+this.bx)*u+this.cx)*u},sampleCurveY:function(u){return((this.ay*u+this.by)*u+this.cy)*u},sampleCurveDerivativeX:function(u){return(3*this.ax*u+2*this.bx)*u+this.cx},solveCurveX:function(u,o){if(o===void 0&&(o=1e-6),u<0)return 0;if(u>1)return 1;for(var h=u,p=0;p<8;p++){var _=this.sampleCurveX(h)-u;if(Math.abs(_)_?x=h:E=h,h=.5*(E-x)+x;return h},solve:function(u,o){return this.sampleCurveY(this.solveCurveX(u,o))}};var ny=ey(ty);function Pl(u,o,h){return u+h*(o-u)}function fh(u,o,h){return u.map((p,_)=>Pl(p,o[_],h))}const no={number:Pl,color:function(u,o,h,p="rgb"){switch(p){case"rgb":{const[_,b,x,E]=fh(u.rgb,o.rgb,h);return new jn(_,b,x,E,!1)}case"hcl":{const[_,b,x,E]=u.hcl,[P,A,N,O]=o.hcl;let G,H;if(isNaN(_)||isNaN(P))isNaN(_)?isNaN(P)?G=NaN:(G=P,x!==1&&x!==0||(H=A)):(G=_,N!==1&&N!==0||(H=b));else{let Re=P-_;P>_&&Re>180?Re-=360:P<_&&_-P>180&&(Re+=360),G=_+h*Re}const[X,re,ce,ge]=function([Re,be,Te,Je]){return Re=isNaN(Re)?0:Re*Qt,Ir([Te,Math.cos(Re)*be,Math.sin(Re)*be,Je])}([G,H??Pl(b,A,h),Pl(x,N,h),Pl(E,O,h)]);return new jn(X,re,ce,ge,!1)}case"lab":{const[_,b,x,E]=Ir(fh(u.lab,o.lab,h));return new jn(_,b,x,E,!1)}}},array:fh,padding:function(u,o,h){return new _o(fh(u.values,o.values,h))},variableAnchorOffsetCollection:function(u,o,h){const p=u.values,_=o.values;if(p.length!==_.length)throw new yr(`Cannot interpolate values of different length. from: ${u.toString()}, to: ${o.toString()}`);const b=[];for(let x=0;xtypeof N!="number"||N<0||N>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:A}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(b=h.parse(b,2,ft),!b)return null;const E=[];let P=null;p==="interpolate-hcl"||p==="interpolate-lab"?P=Rr:h.expectedType&&h.expectedType.kind!=="value"&&(P=h.expectedType);for(let A=0;A=N)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',G);const X=h.parse(O,H,P);if(!X)return null;P=P||X.type,E.push([N,X])}return De(P,ft)||De(P,Rr)||De(P,he)||De(P,W)||De(P,K(ft))?new Fi(P,p,_,b,E):h.error(`Type ${se(P)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const _=this.input.evaluate(o);if(_<=h[0])return p[0].evaluate(o);const b=h.length;if(_>=h[b-1])return p[b-1].evaluate(o);const x=ac(h,_),E=Fi.interpolationFactor(this.interpolation,_,h[x],h[x+1]),P=p[x].evaluate(o),A=p[x+1].evaluate(o);switch(this.operator){case"interpolate":return no[this.type.kind](P,A,E);case"interpolate-hcl":return no.color(P,A,E,"hcl");case"interpolate-lab":return no.color(P,A,E,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function On(u,o,h,p){const _=p-h,b=u-h;return _===0?0:o===1?b/_:(Math.pow(o,b)-1)/(Math.pow(o,_)-1)}class ph{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const _=h.expectedType;_&&_.kind!=="value"&&(p=_);const b=[];for(const E of o.slice(1)){const P=h.parse(E,1+b.length,p,void 0,{typeAnnotation:"omit"});if(!P)return null;p=p||P.type,b.push(P)}if(!p)throw new Error("No output type");const x=_&&b.some(E=>Q(_,E.type));return new ph(x?tn:p,b)}evaluate(o){let h,p=null,_=0;for(const b of this.args)if(_++,p=b.evaluate(o),p&&p instanceof ts&&!p.available&&(h||(h=p.name),p=null,_===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}class dh{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let b=1;b=p.length)throw new yr(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new yr(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class lp{constructor(o,h){this.type=nn,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,tn),_=h.parse(o[2],2,tn);return p&&_?Ie(p.type,[nn,on,ft,ei,tn])?new lp(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${se(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!_e(h,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${se(ni(h))} instead.`);if(!_e(p,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${se(ni(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class mh{constructor(o,h,p){this.type=ft,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,tn),_=h.parse(o[2],2,tn);if(!p||!_)return null;if(!Ie(p.type,[nn,on,ft,ei,tn]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${se(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new mh(p,_,b):null}return new mh(p,_)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!_e(h,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${se(ni(h))} instead.`);if(!_e(p,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${se(ni(p))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(o);return p.indexOf(h,_)}return p.indexOf(h)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class up{constructor(o,h,p,_,b,x){this.inputType=o,this.type=h,this.input=p,this.cases=_,this.outputs=b,this.otherwise=x}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const b={},x=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return G.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof X=="number"&&Math.floor(X)!==X)return G.error("Numeric branch labels must be integer values.");if(p){if(G.checkSubtype(p,ni(X)))return null}else p=ni(X);if(b[String(X)]!==void 0)return G.error("Branch labels must be unique.");b[String(X)]=x.length}const H=h.parse(O,A,_);if(!H)return null;_=_||H.type,x.push(H)}const E=h.parse(o[1],1,tn);if(!E)return null;const P=h.parse(o[o.length-1],o.length-1,_);return P?E.type.kind!=="value"&&h.concat(1).checkSubtype(p,E.type)?null:new up(p,_,E,b,x,P):null}evaluate(o){const h=this.input.evaluate(o);return(ni(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class cp{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const _=[];for(let x=1;xh.outputDefined())&&this.otherwise.outputDefined()}}class gh{constructor(o,h,p,_){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=_}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,tn),_=h.parse(o[2],2,ft);if(!p||!_)return null;if(!Ie(p.type,[K(tn),on,tn]))return h.error(`Expected first argument to be of type array or string, but found ${se(p.type)} instead`);if(o.length===4){const b=h.parse(o[3],3,ft);return b?new gh(p.type,p,_,b):null}return new gh(p.type,p,_)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);if(!_e(h,["string","array"]))throw new yr(`Expected first argument to be of type array or string, but found ${se(ni(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(o);return h.slice(p,_)}return h.slice(p)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function ym(u,o){return u==="=="||u==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function vm(u,o,h,p){return p.compare(o,h)===0}function hu(u,o,h){const p=u!=="=="&&u!=="!=";return class FI{constructor(b,x,E){this.type=nn,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let P=x.parse(b[1],1,tn);if(!P)return null;if(!ym(E,P.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${se(P.type)}'.`);let A=x.parse(b[2],2,tn);if(!A)return null;if(!ym(E,A.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${se(A.type)}'.`);if(P.type.kind!==A.type.kind&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error(`Cannot compare types '${se(P.type)}' and '${se(A.type)}'.`);p&&(P.type.kind==="value"&&A.type.kind!=="value"?P=new No(A.type,[P]):P.type.kind!=="value"&&A.type.kind==="value"&&(A=new No(P.type,[A])));let N=null;if(b.length===4){if(P.type.kind!=="string"&&A.type.kind!=="string"&&P.type.kind!=="value"&&A.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,ba),!N)return null}return new FI(P,A,N)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(p&&this.hasUntypedArgument){const P=ni(x),A=ni(E);if(P.kind!==A.kind||P.kind!=="string"&&P.kind!=="number")throw new yr(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${P.kind}, ${A.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const P=ni(x),A=ni(E);if(P.kind!=="string"||A.kind!=="string")return o(b,x,E)}return this.collator?h(b,x,E,this.collator.evaluate(b)):o(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const ry=hu("==",function(u,o,h){return o===h},vm),iy=hu("!=",function(u,o,h){return o!==h},function(u,o,h,p){return!vm(0,o,h,p)}),oy=hu("<",function(u,o,h){return o",function(u,o,h){return o>h},function(u,o,h,p){return p.compare(o,h)>0}),ay=hu("<=",function(u,o,h){return o<=h},function(u,o,h,p){return p.compare(o,h)<=0}),ly=hu(">=",function(u,o,h){return o>=h},function(u,o,h,p){return p.compare(o,h)>=0});class hp{constructor(o,h,p,_,b){this.type=on,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=b}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ft);if(!p)return null;const _=o[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let b=null;if(_.locale&&(b=h.parse(_.locale,1,on),!b))return null;let x=null;if(_.currency&&(x=h.parse(_.currency,1,on),!x))return null;let E=null;if(_["min-fraction-digits"]&&(E=h.parse(_["min-fraction-digits"],1,ft),!E))return null;let P=null;return _["max-fraction-digits"]&&(P=h.parse(_["max-fraction-digits"],1,ft),!P)?null:new hp(p,b,x,E,P)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class _h{constructor(o){this.type=Vr,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const _=[];let b=!1;for(let x=1;x<=o.length-1;++x){const E=o[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let P=null;if(E["font-scale"]&&(P=h.parse(E["font-scale"],1,ft),!P))return null;let A=null;if(E["text-font"]&&(A=h.parse(E["text-font"],1,K(on)),!A))return null;let N=null;if(E["text-color"]&&(N=h.parse(E["text-color"],1,Rr),!N))return null;const O=_[_.length-1];O.scale=P,O.font=A,O.textColor=N}else{const P=h.parse(o[x],1,tn);if(!P)return null;const A=P.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,_.push({content:P,scale:null,font:null,textColor:null})}}return new _h(_)}evaluate(o){return new Ro(this.sections.map(h=>{const p=h.content.evaluate(o);return ni(p)===V?new sp("",p,null,null,null):new sp(tc(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class fp{constructor(o){this.type=V,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,on);return p?new fp(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=ts.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class pp{constructor(o){this.type=ft,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${se(p.type)} instead.`):new pp(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string"||Array.isArray(h))return h.length;throw new yr(`Expected value to be of type string or array, but found ${se(ni(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const fu={"==":ry,"!=":iy,">":sy,"<":oy,">=":ly,"<=":ay,array:No,at:ap,boolean:No,case:cp,coalesce:ph,collator:cu,format:_h,image:fp,in:lp,"index-of":mh,interpolate:Fi,"interpolate-hcl":Fi,"interpolate-lab":Fi,length:pp,let:dh,literal:Za,match:up,number:No,"number-format":hp,object:No,slice:gh,step:lc,string:No,"to-boolean":Us,"to-color":Us,"to-number":Us,"to-string":Us,var:ch,within:Ll};function bm(u,[o,h,p,_]){o=o.evaluate(u),h=h.evaluate(u),p=p.evaluate(u);const b=_?_.evaluate(u):1,x=uu(o,h,p,b);if(x)throw new yr(x);return new jn(o/255,h/255,p/255,b,!1)}function xm(u,o){return u in o}function dp(u,o){const h=o[u];return h===void 0?null:h}function Ml(u){return{type:u}}function wm(u){return{result:"success",value:u}}function pu(u){return{result:"error",value:u}}function du(u){return u["property-type"]==="data-driven"||u["property-type"]==="cross-faded-data-driven"}function Sm(u){return!!u.expression&&u.expression.parameters.indexOf("zoom")>-1}function mp(u){return!!u.expression&&u.expression.interpolated}function Mn(u){return u instanceof Number?"number":u instanceof String?"string":u instanceof Boolean?"boolean":Array.isArray(u)?"array":u===null?"null":typeof u}function yh(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function uy(u){return u}function Em(u,o){const h=o.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",_=p||!(p||u.property!==void 0),b=u.type||(mp(o)?"exponential":"interval");if(h||o.type==="padding"){const N=h?jn.parse:_o.parse;(u=Qo({},u)).stops&&(u.stops=u.stops.map(O=>[O[0],N(O[1])])),u.default=N(u.default?u.default:o.default)}if(u.colorSpace&&(x=u.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${u.colorSpace}"`);var x;let E,P,A;if(b==="exponential")E=In;else if(b==="interval")E=cy;else if(b==="categorical"){E=Ur,P=Object.create(null);for(const N of u.stops)P[N[0]]=N[1];A=typeof u.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=gp}if(p){const N={},O=[];for(let X=0;XX[0]),evaluate:({zoom:X},re)=>In({stops:G,base:u.base},o,X).evaluate(X,re)}}if(_){const N=b==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:Fi.interpolationFactor.bind(void 0,N),zoomStops:u.stops.map(O=>O[0]),evaluate:({zoom:O})=>E(u,o,O,P,A)}}return{kind:"source",evaluate(N,O){const G=O&&O.properties?O.properties[u.property]:void 0;return G===void 0?uc(u.default,o.default):E(u,o,G,P,A)}}}function uc(u,o,h){return u!==void 0?u:o!==void 0?o:h!==void 0?h:void 0}function Ur(u,o,h,p,_){return uc(typeof h===_?p[h]:void 0,u.default,o.default)}function cy(u,o,h){if(Mn(h)!=="number")return uc(u.default,o.default);const p=u.stops.length;if(p===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[p-1][0])return u.stops[p-1][1];const _=ac(u.stops.map(b=>b[0]),h);return u.stops[_][1]}function In(u,o,h){const p=u.base!==void 0?u.base:1;if(Mn(h)!=="number")return uc(u.default,o.default);const _=u.stops.length;if(_===1||h<=u.stops[0][0])return u.stops[0][1];if(h>=u.stops[_-1][0])return u.stops[_-1][1];const b=ac(u.stops.map(N=>N[0]),h),x=function(N,O,G,H){const X=H-G,re=N-G;return X===0?0:O===1?re/X:(Math.pow(O,re)-1)/(Math.pow(O,X)-1)}(h,p,u.stops[b][0],u.stops[b+1][0]),E=u.stops[b][1],P=u.stops[b+1][1],A=no[o.type]||uy;return typeof E.evaluate=="function"?{evaluate(...N){const O=E.evaluate.apply(void 0,N),G=P.evaluate.apply(void 0,N);if(O!==void 0&&G!==void 0)return A(O,G,x,u.colorSpace)}}:A(E,P,x,u.colorSpace)}function gp(u,o,h){switch(o.type){case"color":h=jn.parse(h);break;case"formatted":h=Ro.fromString(h.toString());break;case"resolvedImage":h=ts.fromString(h.toString());break;case"padding":h=_o.parse(h);break;default:Mn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return uc(h,u.default,o.default)}Oo.register(fu,{error:[{kind:"error"},[on],(u,[o])=>{throw new yr(o.evaluate(u))}],typeof:[on,[tn],(u,[o])=>se(ni(o.evaluate(u)))],"to-rgba":[K(ft,4),[Rr],(u,[o])=>{const[h,p,_,b]=o.evaluate(u).rgb;return[255*h,255*p,255*_,b]}],rgb:[Rr,[ft,ft,ft],bm],rgba:[Rr,[ft,ft,ft,ft],bm],has:{type:nn,overloads:[[[on],(u,[o])=>xm(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>xm(o.evaluate(u),h.evaluate(u))]]},get:{type:tn,overloads:[[[on],(u,[o])=>dp(o.evaluate(u),u.properties())],[[on,$o],(u,[o,h])=>dp(o.evaluate(u),h.evaluate(u))]]},"feature-state":[tn,[on],(u,[o])=>dp(o.evaluate(u),u.featureState||{})],properties:[$o,[],u=>u.properties()],"geometry-type":[on,[],u=>u.geometryType()],id:[tn,[],u=>u.id()],zoom:[ft,[],u=>u.globals.zoom],"heatmap-density":[ft,[],u=>u.globals.heatmapDensity||0],"line-progress":[ft,[],u=>u.globals.lineProgress||0],accumulated:[tn,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[ft,Ml(ft),(u,o)=>{let h=0;for(const p of o)h+=p.evaluate(u);return h}],"*":[ft,Ml(ft),(u,o)=>{let h=1;for(const p of o)h*=p.evaluate(u);return h}],"-":{type:ft,overloads:[[[ft,ft],(u,[o,h])=>o.evaluate(u)-h.evaluate(u)],[[ft],(u,[o])=>-o.evaluate(u)]]},"/":[ft,[ft,ft],(u,[o,h])=>o.evaluate(u)/h.evaluate(u)],"%":[ft,[ft,ft],(u,[o,h])=>o.evaluate(u)%h.evaluate(u)],ln2:[ft,[],()=>Math.LN2],pi:[ft,[],()=>Math.PI],e:[ft,[],()=>Math.E],"^":[ft,[ft,ft],(u,[o,h])=>Math.pow(o.evaluate(u),h.evaluate(u))],sqrt:[ft,[ft],(u,[o])=>Math.sqrt(o.evaluate(u))],log10:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))/Math.LN10],ln:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))],log2:[ft,[ft],(u,[o])=>Math.log(o.evaluate(u))/Math.LN2],sin:[ft,[ft],(u,[o])=>Math.sin(o.evaluate(u))],cos:[ft,[ft],(u,[o])=>Math.cos(o.evaluate(u))],tan:[ft,[ft],(u,[o])=>Math.tan(o.evaluate(u))],asin:[ft,[ft],(u,[o])=>Math.asin(o.evaluate(u))],acos:[ft,[ft],(u,[o])=>Math.acos(o.evaluate(u))],atan:[ft,[ft],(u,[o])=>Math.atan(o.evaluate(u))],min:[ft,Ml(ft),(u,o)=>Math.min(...o.map(h=>h.evaluate(u)))],max:[ft,Ml(ft),(u,o)=>Math.max(...o.map(h=>h.evaluate(u)))],abs:[ft,[ft],(u,[o])=>Math.abs(o.evaluate(u))],round:[ft,[ft],(u,[o])=>{const h=o.evaluate(u);return h<0?-Math.round(-h):Math.round(h)}],floor:[ft,[ft],(u,[o])=>Math.floor(o.evaluate(u))],ceil:[ft,[ft],(u,[o])=>Math.ceil(o.evaluate(u))],"filter-==":[nn,[on,tn],(u,[o,h])=>u.properties()[o.value]===h.value],"filter-id-==":[nn,[tn],(u,[o])=>u.id()===o.value],"filter-type-==":[nn,[on],(u,[o])=>u.geometryType()===o.value],"filter-<":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[nn,[on,tn],(u,[o,h])=>{const p=u.properties()[o.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[nn,[tn],(u,[o])=>{const h=u.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[nn,[tn],(u,[o])=>o.value in u.properties()],"filter-has-id":[nn,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[nn,[K(on)],(u,[o])=>o.value.indexOf(u.geometryType())>=0],"filter-id-in":[nn,[K(tn)],(u,[o])=>o.value.indexOf(u.id())>=0],"filter-in-small":[nn,[on,K(tn)],(u,[o,h])=>h.value.indexOf(u.properties()[o.value])>=0],"filter-in-large":[nn,[on,K(tn)],(u,[o,h])=>function(p,_,b,x){for(;b<=x;){const E=b+x>>1;if(_[E]===p)return!0;_[E]>p?x=E-1:b=E+1}return!1}(u.properties()[o.value],h.value,0,h.value.length-1)],all:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)&&h.evaluate(u)],[Ml(nn),(u,o)=>{for(const h of o)if(!h.evaluate(u))return!1;return!0}]]},any:{type:nn,overloads:[[[nn,nn],(u,[o,h])=>o.evaluate(u)||h.evaluate(u)],[Ml(nn),(u,o)=>{for(const h of o)if(h.evaluate(u))return!0;return!1}]]},"!":[nn,[nn],(u,[o])=>!o.evaluate(u)],"is-supported-script":[nn,[on],(u,[o])=>{const h=u.globals&&u.globals.isSupportedScript;return!h||h(o.evaluate(u))}],upcase:[on,[on],(u,[o])=>o.evaluate(u).toUpperCase()],downcase:[on,[on],(u,[o])=>o.evaluate(u).toLowerCase()],concat:[on,Ml(tn),(u,o)=>o.map(h=>tc(h.evaluate(u))).join("")],"resolved-locale":[on,[ba],(u,[o])=>o.evaluate(u).resolvedLocale()]});class sr{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new qn,this._defaultValue=h?(p=h).type==="color"&&yh(p.default)?new jn(0,0,0,0):p.type==="color"?jn.parse(p.default)||null:p.type==="padding"?_o.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?es.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,_,b,x){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new yr(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function er(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in fu}function Al(u,o){const h=new oh(fu,ic,[],o?function(_){const b={color:Rr,string:on,number:ft,enum:on,boolean:nn,formatted:Vr,padding:he,resolvedImage:V,variableAnchorOffsetCollection:W};return _.type==="array"?K(b[_.value]||tn,_.length):b[_.type]}(o):void 0),p=h.parse(u,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?wm(new sr(p,o)):pu(h.errors)}class vh{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!oc(h.expression)}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}}class _p{constructor(o,h,p,_){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!oc(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(o,h,p,_,b,x){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,_,b,x)}evaluate(o,h,p,_,b,x){return this._styleExpression.evaluate(o,h,p,_,b,x)}interpolationFactor(o,h,p){return this.interpolationType?Fi.interpolationFactor(this.interpolationType,o,h,p):0}}function Im(u,o){const h=Al(u,o);if(h.result==="error")return h;const p=h.value.expression,_=hh(p);if(!_&&!du(o))return pu([new eo("","data expressions not supported")]);const b=sc(p,["zoom"]);if(!b&&!Sm(o))return pu([new eo("","zoom expressions not supported")]);const x=xh(p);return x||b?x instanceof eo?pu([x]):x instanceof Fi&&!mp(o)?pu([new eo("",'"interpolate" expressions cannot be used with this property')]):wm(x?new _p(_?"camera":"composite",h.value,x.labels,x instanceof Fi?x.interpolation:void 0):new vh(_?"constant":"source",h.value)):pu([new eo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class bh{constructor(o,h){this._parameters=o,this._specification=h,Qo(this,Em(this._parameters,this._specification))}static deserialize(o){return new bh(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function xh(u){let o=null;if(u instanceof dh)o=xh(u.result);else if(u instanceof ph){for(const h of u.args)if(o=xh(h),o)break}else(u instanceof lc||u instanceof Fi)&&u.input instanceof Oo&&u.input.name==="zoom"&&(o=u);return o instanceof eo||u.eachChild(h=>{const p=xh(h);p instanceof eo?o=p:!o&&p?o=new eo("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new eo("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function wh(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const o of u.slice(1))if(!wh(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const Cm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Sh(u){if(u==null)return{filter:()=>!0,needGeometry:!1};wh(u)||(u=Ih(u));const o=Al(u,Cm);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>o.value.evaluate(h,p,{},_),needGeometry:Eh(u)}}function Tm(u,o){return uo?1:0}function Eh(u){if(!Array.isArray(u))return!1;if(u[0]==="within")return!0;for(let o=1;o"||o==="<="||o===">="?yp(u[1],u[2],o):o==="any"?(h=u.slice(1),["any"].concat(h.map(Ih))):o==="all"?["all"].concat(u.slice(1).map(Ih)):o==="none"?["all"].concat(u.slice(1).map(Ih).map(Ch)):o==="in"?Lm(u[1],u.slice(2)):o==="!in"?Ch(Lm(u[1],u.slice(2))):o==="has"?Pm(u[1]):o==="!has"?Ch(Pm(u[1])):o!=="within"||u;var h}function yp(u,o,h){switch(u){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,u,o]}}function Lm(u,o){if(o.length===0)return!1;switch(u){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(h=>typeof h!=typeof o[0])?["filter-in-large",u,["literal",o.sort(Tm)]]:["filter-in-small",u,["literal",o]]}}function Pm(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function Ch(u){return["!",u]}function vp(u){const o=typeof u;if(o==="number"||o==="boolean"||o==="string"||u==null)return JSON.stringify(u);if(Array.isArray(u)){let _="[";for(const b of u)_+=`${vp(b)},`;return`${_}]`}const h=Object.keys(u).sort();let p="{";for(let _=0;_p.maximum?[new at(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function Am(u){const o=u.valueSpec,h=Cr(u.value.type);let p,_,b,x={};const E=h!=="categorical"&&u.value.property===void 0,P=!E,A=Mn(u.value.stops)==="array"&&Mn(u.value.stops[0])==="array"&&Mn(u.value.stops[0][0])==="object",N=ro({key:u.key,value:u.value,valueSpec:u.styleSpec.function,validateSpec:u.validateSpec,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(H){if(h==="identity")return[new at(H.key,H.value,'identity function may not have a "stops" property')];let X=[];const re=H.value;return X=X.concat(bp({key:H.key,value:re,valueSpec:H.valueSpec,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:O})),Mn(re)==="array"&&re.length===0&&X.push(new at(H.key,re,"array must have at least one stop")),X},default:function(H){return H.validateSpec({key:H.key,value:H.value,valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec})}}});return h==="identity"&&E&&N.push(new at(u.key,u.value,'missing required property "property"')),h==="identity"||u.value.stops||N.push(new at(u.key,u.value,'missing required property "stops"')),h==="exponential"&&u.valueSpec.expression&&!mp(u.valueSpec)&&N.push(new at(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(P&&!du(u.valueSpec)?N.push(new at(u.key,u.value,"property functions not supported")):E&&!Sm(u.valueSpec)&&N.push(new at(u.key,u.value,"zoom functions not supported"))),h!=="categorical"&&!A||u.value.property!==void 0||N.push(new at(u.key,u.value,'"property" property is required')),N;function O(H){let X=[];const re=H.value,ce=H.key;if(Mn(re)!=="array")return[new at(ce,re,`array expected, ${Mn(re)} found`)];if(re.length!==2)return[new at(ce,re,`array length 2 expected, length ${re.length} found`)];if(A){if(Mn(re[0])!=="object")return[new at(ce,re,`object expected, ${Mn(re[0])} found`)];if(re[0].zoom===void 0)return[new at(ce,re,"object stop key must have zoom")];if(re[0].value===void 0)return[new at(ce,re,"object stop key must have value")];if(b&&b>Cr(re[0].zoom))return[new at(ce,re[0].zoom,"stop zoom values must appear in ascending order")];Cr(re[0].zoom)!==b&&(b=Cr(re[0].zoom),_=void 0,x={}),X=X.concat(ro({key:`${ce}[0]`,value:re[0],valueSpec:{zoom:{}},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{zoom:Th,value:G}}))}else X=X.concat(G({key:`${ce}[0]`,value:re[0],valueSpec:{},validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec},re));return er(Ya(re[1]))?X.concat([new at(`${ce}[1]`,re[1],"expressions are not allowed in function stops.")]):X.concat(H.validateSpec({key:`${ce}[1]`,value:re[1],valueSpec:o,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec}))}function G(H,X){const re=Mn(H.value),ce=Cr(H.value),ge=H.value!==null?H.value:X;if(p){if(re!==p)return[new at(H.key,ge,`${re} stop domain type must match previous stop domain type ${p}`)]}else p=re;if(re!=="number"&&re!=="string"&&re!=="boolean")return[new at(H.key,ge,"stop domain value must be a number, string, or boolean")];if(re!=="number"&&h!=="categorical"){let Re=`number expected, ${re} found`;return du(o)&&h===void 0&&(Re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(H.key,ge,Re)]}return h!=="categorical"||re!=="number"||isFinite(ce)&&Math.floor(ce)===ce?h!=="categorical"&&re==="number"&&_!==void 0&&ce<_?[new at(H.key,ge,"stop domain values must appear in ascending order")]:(_=ce,h==="categorical"&&ce in x?[new at(H.key,ge,"stop domain values must be unique")]:(x[ce]=!0,[])):[new at(H.key,ge,`integer expected, found ${ce}`)]}}function Ka(u){const o=(u.expressionContext==="property"?Im:Al)(Ya(u.value),u.valueSpec);if(o.result==="error")return o.value.map(p=>new at(`${u.key}${p.key}`,u.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!h.outputDefined())return[new at(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!oc(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter"&&!oc(h))return[new at(u.key,u.value,'"feature-state" data expressions are not supported with filters.')];if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!sc(h,["zoom","feature-state"]))return[new at(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!hh(h))return[new at(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ja(u){const o=u.key,h=u.value,p=u.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(Cr(h))===-1&&_.push(new at(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Cr(h))===-1&&_.push(new at(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function mu(u){return wh(Ya(u.value))?Ka(Qo({},u,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xp(u)}function xp(u){const o=u.value,h=u.key;if(Mn(o)!=="array")return[new at(h,o,`array expected, ${Mn(o)} found`)];const p=u.styleSpec;let _,b=[];if(o.length<1)return[new at(h,o,"filter array must have at least 1 element")];switch(b=b.concat(Ja({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:u.style,styleSpec:u.styleSpec})),Cr(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Cr(o[1])==="$type"&&b.push(new at(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&b.push(new at(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(_=Mn(o[1]),_!=="string"&&b.push(new at(`${h}[1]`,o[1],`string expected, ${_} found`)));for(let x=2;x{A in h&&o.push(new at(p,h[A],`"${A}" is prohibited for ref layers`))}),_.layers.forEach(A=>{Cr(A.id)===E&&(P=A)}),P?P.ref?o.push(new at(p,h.ref,"ref cannot reference another ref layer")):x=Cr(P.type):o.push(new at(p,h.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(h.source){const P=_.sources&&_.sources[h.source],A=P&&Cr(P.type);P?A==="vector"&&x==="raster"?o.push(new at(p,h.source,`layer "${h.id}" requires a raster source`)):A!=="raster-dem"&&x==="hillshade"?o.push(new at(p,h.source,`layer "${h.id}" requires a raster-dem source`)):A==="raster"&&x!=="raster"?o.push(new at(p,h.source,`layer "${h.id}" requires a vector source`)):A!=="vector"||h["source-layer"]?A==="raster-dem"&&x!=="hillshade"?o.push(new at(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!h.paint||!h.paint["line-gradient"]||A==="geojson"&&P.lineMetrics||o.push(new at(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new at(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new at(p,h.source,`source "${h.source}" not found`))}else o.push(new at(p,h,'missing required property "source"'));return o=o.concat(ro({key:p,value:h,valueSpec:b.layer,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":()=>[],type:()=>u.validateSpec({key:`${p}.type`,value:h.type,valueSpec:b.layer.type,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,object:h,objectKey:"type"}),filter:mu,layout:P=>ro({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Sp(Qo({layerType:x},A))}}),paint:P=>ro({layer:h,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>wp(Qo({layerType:x},A))}})}})),o}function kl(u){const o=u.value,h=u.key,p=Mn(o);return p!=="string"?[new at(h,o,`string expected, ${p} found`)]:[]}const km={promoteId:function({key:u,value:o}){if(Mn(o)==="string")return kl({key:u,value:o});{const h=[];for(const p in o)h.push(...kl({key:`${u}.${p}`,value:o[p]}));return h}}};function Dm(u){const o=u.value,h=u.key,p=u.styleSpec,_=u.style,b=u.validateSpec;if(!o.type)return[new at(h,o,'"type" is required')];const x=Cr(o.type);let E;switch(x){case"vector":case"raster":return E=ro({key:h,value:o,valueSpec:p[`source_${x.replace("-","_")}`],style:u.style,styleSpec:p,objectElementValidators:km,validateSpec:b}),E;case"raster-dem":return E=function(P){var A;const N=(A=P.sourceName)!==null&&A!==void 0?A:"",O=P.value,G=P.styleSpec,H=G.source_raster_dem,X=P.style;let re=[];const ce=Mn(O);if(O===void 0)return re;if(ce!=="object")return re.push(new at("source_raster_dem",O,`object expected, ${ce} found`)),re;const ge=Cr(O.encoding)==="custom",Re=["redFactor","greenFactor","blueFactor","baseShift"],be=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Te in O)!ge&&Re.includes(Te)?re.push(new at(Te,O[Te],`In "${N}": "${Te}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):H[Te]?re=re.concat(P.validateSpec({key:Te,value:O[Te],valueSpec:H[Te],validateSpec:P.validateSpec,style:X,styleSpec:G})):re.push(new at(Te,O[Te],`unknown property "${Te}"`));return re}({sourceName:h,value:o,style:u.style,styleSpec:p,validateSpec:b}),E;case"geojson":if(E=ro({key:h,value:o,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:b,objectElementValidators:km}),o.cluster)for(const P in o.clusterProperties){const[A,N]=o.clusterProperties[P],O=typeof A=="string"?[A,["accumulated"],["get",P]]:A;E.push(...Ka({key:`${h}.${P}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),E.push(...Ka({key:`${h}.${P}.reduce`,value:O,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return ro({key:h,value:o,valueSpec:p.source_video,style:_,validateSpec:b,styleSpec:p});case"image":return ro({key:h,value:o,valueSpec:p.source_image,style:_,validateSpec:b,styleSpec:p});case"canvas":return[new at(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ja({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:b,styleSpec:p})}}function Rm(u){const o=u.value,h=u.styleSpec,p=h.light,_=u.style;let b=[];const x=Mn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new at("light",o,`object expected, ${x} found`)]),b;for(const E in o){const P=E.match(/^(.*)-transition$/);b=b.concat(P&&p[P[1]]&&p[P[1]].transition?u.validateSpec({key:E,value:o[E],valueSpec:h.transition,validateSpec:u.validateSpec,style:_,styleSpec:h}):p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new at(E,o[E],`unknown property "${E}"`)])}return b}function Nm(u){const o=u.value,h=u.styleSpec,p=h.sky,_=u.style,b=Mn(o);if(o===void 0)return[];if(b!=="object")return[new at("sky",o,`object expected, ${b} found`)];let x=[];for(const E in o)x=x.concat(p[E]?Gs({key:E,value:o[E],valueSpec:p[E],style:_,styleSpec:h}):[new at(E,o[E],`unknown property "${E}"`)]);return x}function hc(u){const o=u.value,h=u.styleSpec,p=h.terrain,_=u.style;let b=[];const x=Mn(o);if(o===void 0)return b;if(x!=="object")return b=b.concat([new at("terrain",o,`object expected, ${x} found`)]),b;for(const E in o)b=b.concat(p[E]?u.validateSpec({key:E,value:o[E],valueSpec:p[E],validateSpec:u.validateSpec,style:_,styleSpec:h}):[new at(E,o[E],`unknown property "${E}"`)]);return b}function fc(u){let o=[];const h=u.value,p=u.key;if(Array.isArray(h)){const _=[],b=[];for(const x in h)h[x].id&&_.includes(h[x].id)&&o.push(new at(p,h,`all the sprites' ids must be unique, but ${h[x].id} is duplicated`)),_.push(h[x].id),h[x].url&&b.includes(h[x].url)&&o.push(new at(p,h,`all the sprites' URLs must be unique, but ${h[x].url} is duplicated`)),b.push(h[x].url),o=o.concat(ro({key:`${p}[${x}]`,value:h[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:u.validateSpec}));return o}return kl({key:p,value:h})}const yo={"*":()=>[],array:bp,boolean:function(u){const o=u.value,h=u.key,p=Mn(o);return p!=="boolean"?[new at(h,o,`boolean expected, ${p} found`)]:[]},number:Th,color:function(u){const o=u.key,h=u.value,p=Mn(h);return p!=="string"?[new at(o,h,`color expected, ${p} found`)]:jn.parse(String(h))?[]:[new at(o,h,`color expected, "${h}" found`)]},constants:Mm,enum:Ja,filter:mu,function:Am,layer:cc,object:ro,source:Dm,light:Rm,sky:Nm,terrain:hc,string:kl,formatted:function(u){return kl(u).length===0?[]:Ka(u)},resolvedImage:function(u){return kl(u).length===0?[]:Ka(u)},padding:function(u){const o=u.key,h=u.value;if(Mn(h)==="array"){if(h.length<1||h.length>4)return[new at(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let b=0;b[]}})),u.constants&&(h=h.concat(Mm({key:"constants",value:u.constants,style:u,styleSpec:o,validateSpec:Gs}))),gu(h)}function js(u){return function(o){return u({...o,validateSpec:Gs})}}function gu(u){return[].concat(u).sort((o,h)=>o.line-h.line)}function vs(u){return function(...o){return gu(u.apply(this,o))}}ys.source=vs(js(Dm)),ys.sprite=vs(js(fc)),ys.glyphs=vs(js(Ep)),ys.light=vs(js(Rm)),ys.sky=vs(js(Nm)),ys.terrain=vs(js(hc)),ys.layer=vs(js(cc)),ys.filter=vs(js(mu)),ys.paintProperty=vs(js(wp)),ys.layoutProperty=vs(js(Sp));const Dl=ys,fy=Dl.light,Ip=Dl.paintProperty,py=Dl.layoutProperty;function _u(u,o){let h=!1;if(o&&o.length)for(const p of o)u.fire(new _t(new Error(p.message))),h=!0;return h}class pc{constructor(o,h,p){const _=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const x=new Int32Array(this.arrayBuffer);o=x[0],this.d=(h=x[1])+2*(p=x[2]);for(let P=0;P=O[X+0]&&_>=O[X+1])?(E[H]=!0,x.push(N[H])):E[H]=!1}}}}_forEachCell(o,h,p,_,b,x,E,P){const A=this._convertToCellCoord(o),N=this._convertToCellCoord(h),O=this._convertToCellCoord(p),G=this._convertToCellCoord(_);for(let H=A;H<=O;H++)for(let X=N;X<=G;X++){const re=this.d*X+H;if((!P||P(this._convertFromCellCoord(H),this._convertFromCellCoord(X),this._convertFromCellCoord(H+1),this._convertFromCellCoord(X+1)))&&b.call(this,o,h,p,_,re,x,E,P))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,h=3+this.cells.length+1+1;let p=0;for(let x=0;x=0)continue;const x=u[b];_[b]=qs[p].shallow.indexOf(b)>=0?x:yu(x,o)}u instanceof Error&&(_.message=u.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(_.$name=p),_}throw new Error("can't serialize object of type "+typeof u)}function vu(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||u instanceof Blob||u instanceof Error||Ph(u)||Rt(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(vu);if(typeof u=="object"){const o=u.$name||"Object";if(!qs[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=qs[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(u);const p=Object.create(h.prototype);for(const _ of Object.keys(u)){if(_==="$name")continue;const b=u[_];p[_]=qs[o].shallow.indexOf(_)>=0?b:vu(b)}return p}throw new Error("can't deserialize object of type "+typeof u)}class Om{constructor(){this.first=!0}update(o,h){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoomu>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519};function bu(u){for(const o of u)if(Mh(o.charCodeAt(0)))return!0;return!1}function zm(u){for(const o of u)if(!Fm(o.charCodeAt(0)))return!1;return!0}function Fm(u){return!(bt.Arabic(u)||bt["Arabic Supplement"](u)||bt["Arabic Extended-A"](u)||bt["Arabic Presentation Forms-A"](u)||bt["Arabic Presentation Forms-B"](u))}function Mh(u){return!(u!==746&&u!==747&&(u<4352||!(bt["Bopomofo Extended"](u)||bt.Bopomofo(u)||bt["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||bt["CJK Compatibility Ideographs"](u)||bt["CJK Compatibility"](u)||bt["CJK Radicals Supplement"](u)||bt["CJK Strokes"](u)||!(!bt["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||bt["CJK Unified Ideographs Extension A"](u)||bt["CJK Unified Ideographs"](u)||bt["Enclosed CJK Letters and Months"](u)||bt["Hangul Compatibility Jamo"](u)||bt["Hangul Jamo Extended-A"](u)||bt["Hangul Jamo Extended-B"](u)||bt["Hangul Jamo"](u)||bt["Hangul Syllables"](u)||bt.Hiragana(u)||bt["Ideographic Description Characters"](u)||bt.Kanbun(u)||bt["Kangxi Radicals"](u)||bt["Katakana Phonetic Extensions"](u)||bt.Katakana(u)&&u!==12540||!(!bt["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!bt["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||bt["Unified Canadian Aboriginal Syllabics"](u)||bt["Unified Canadian Aboriginal Syllabics Extended"](u)||bt["Vertical Forms"](u)||bt["Yijing Hexagram Symbols"](u)||bt["Yi Syllables"](u)||bt["Yi Radicals"](u))))}function Cp(u){return!(Mh(u)||function(o){return!!(bt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||bt["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||bt["Letterlike Symbols"](o)||bt["Number Forms"](o)||bt["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||bt["Control Pictures"](o)&&o!==9251||bt["Optical Character Recognition"](o)||bt["Enclosed Alphanumerics"](o)||bt["Geometric Shapes"](o)||bt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||bt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||bt["CJK Symbols and Punctuation"](o)||bt.Katakana(o)||bt["Private Use Area"](o)||bt["CJK Compatibility Forms"](o)||bt["Small Form Variants"](o)||bt["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(u))}function Ah(u){return u>=1424&&u<=2303||bt["Arabic Presentation Forms-A"](u)||bt["Arabic Presentation Forms-B"](u)}function Bm(u,o){return!(!o&&Ah(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||bt.Khmer(u))}function dy(u){for(const o of u)if(Ah(o.charCodeAt(0)))return!0;return!1}const Qa=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(u){this.pluginStatus=u.pluginStatus,this.pluginURL=u.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(u){this.applyArabicShaping=u.applyArabicShaping,this.processBidirectionalText=u.processBidirectionalText,this.processStyledBidirectionalText=u.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class fr{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Om,this.transition={})}isSupportedScript(o){return function(h,p){for(const _ of h)if(!Bm(_.charCodeAt(0),p))return!1;return!0}(o,Qa.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class dc{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,_){if(yh(p))return new bh(p,_);if(er(p)){const b=Im(p,_);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=p;return _.type==="color"&&typeof p=="string"?b=jn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(b=es.parse(p)):b=_o.parse(p),{kind:"constant",evaluate:()=>b}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class kh{constructor(o){this.property=o,this.value=new dc(o,void 0)}transitioned(o,h){return new Vm(this.property,this.value,h,de({},o.transition,this.transition),o.now)}untransitioned(){return new Vm(this.property,this.value,null,{},0)}}class Tp{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return Y(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new kh(this._values[o].property)),this._values[o].value=new dc(this._values[o].property,h===null?void 0:Y(h))}getTransition(o){return Y(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new kh(this._values[o].property)),this._values[o].transition=Y(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const _=this.getTransition(h);_!==void 0&&(o[`${h}-transition`]=_)}return o}transitioned(o,h){const p=new Um(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(o,h._values[_]);return p}untransitioned(){const o=new Um(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Vm{constructor(o,h,p,_,b){this.property=o,this.value=h,this.begin=b+_.delay||0,this.end=this.begin+_.duration||0,o.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const _=o.now||0,b=this.value.possiblyEvaluate(o,h,p),x=this.prior;if(x){if(_>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(_=1)return 1;const A=P*P,N=A*P;return 4*(P<.5?N:3*(P-A)+N-.75)}(E))}}return b}}class Um{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const _=new mc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Gm{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return Y(this._values[o].value)}setValue(o,h){this._values[o]=new dc(this._values[o].property,h===null?void 0:Y(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const _=new mc(this._properties);for(const b of Object.keys(this._values))_._values[b]=this._values[b].possiblyEvaluate(o,h,p);return _}}class bs{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,_){return this.property.evaluate(this.value,this.parameters,o,h,p,_)}}class mc{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class Dt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const _=no[this.specification.type];return _?_(o,h,p):o}}class Vt{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,_){return new bs(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,_)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new bs(this,{kind:"constant",value:void 0},o.parameters);const _=no[this.specification.type];if(_){const b=_(o.value.value,h.value.value,p);return new bs(this,{kind:"constant",value:b},o.parameters)}return o}evaluate(o,h,p,_,b,x){return o.kind==="constant"?o.value:o.evaluate(h,p,_,b,x)}}class Dh extends Vt{possiblyEvaluate(o,h,p,_){if(o.value===void 0)return new bs(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_),x=o.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,h);return new bs(this,{kind:"constant",value:E},h)}if(o.expression.kind==="camera"){const b=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new bs(this,{kind:"constant",value:b},h)}return new bs(this,o.expression,h)}evaluate(o,h,p,_,b,x){if(o.kind==="source"){const E=o.evaluate(h,p,_,b,x);return this._calculate(E,E,E,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,_),o.evaluate({zoom:Math.floor(h.zoom)},p,_),o.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):o.value}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class gc{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){if(o.value!==void 0){if(o.expression.kind==="constant"){const b=o.expression.evaluate(h,null,{},p,_);return this._calculate(b,b,b,h)}return this._calculate(o.expression.evaluate(new fr(Math.floor(h.zoom-1),h)),o.expression.evaluate(new fr(Math.floor(h.zoom),h)),o.expression.evaluate(new fr(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Lp{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,_){return!!o.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class vo{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new dc(p,void 0),b=this.defaultTransitionablePropertyValues[h]=new kh(p);this.defaultTransitioningPropertyValues[h]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}Et("DataDrivenProperty",Vt),Et("DataConstantProperty",Dt),Et("CrossFadedDataDrivenProperty",Dh),Et("CrossFadedProperty",gc),Et("ColorRampProperty",Lp);const Pp="-transition";class xs extends xn{constructor(o,h){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),h.layout&&(this._unevaluatedLayout=new Gm(h.layout)),h.paint)){this._transitionablePaint=new Tp(h.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new mc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(py,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(Pp)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(Ip,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(Pp))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[o],b=_.property.specification["property-type"]==="cross-faded-data-driven",x=_.value.isDataDriven(),E=_.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const P=this._transitionablePaint._values[o].value;return P.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(o,E,P)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){return!1}isHidden(o){return!!(this.minzoom&&o=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}serialize(){const o={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Ae(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,_,b={}){return(!b||b.validate!==!1)&&_u(this,o.call(Dl,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:ze,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof bs&&du(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const jm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class _c{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Tr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Gr(u,o=1){let h=0,p=0;return{members:u.map(_=>{const b=jm[_.type].BYTES_PER_ELEMENT,x=h=qm(h,Math.max(o,b)),E=_.components||1;return p=Math.max(p,b),h+=b*E,{name:_.name,type:_.type,components:E,offset:x}}),size:qm(h,Math.max(p,o)),alignment:o}}function qm(u,o){return Math.ceil(u/o)*o}class yc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.int16[_+0]=h,this.int16[_+1]=p,o}}yc.prototype.bytesPerElement=4,Et("StructArrayLayout2i4",yc);class xa extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.int16[b+0]=h,this.int16[b+1]=p,this.int16[b+2]=_,o}}xa.prototype.bytesPerElement=6,Et("StructArrayLayout3i6",xa);class Mp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.int16[x+0]=h,this.int16[x+1]=p,this.int16[x+2]=_,this.int16[x+3]=b,o}}Mp.prototype.bytesPerElement=8,Et("StructArrayLayout4i8",Mp);class Ap extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,o}}Ap.prototype.bytesPerElement=12,Et("StructArrayLayout2i4i12",Ap);class kp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=4*o,A=8*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.uint8[A+4]=_,this.uint8[A+5]=b,this.uint8[A+6]=x,this.uint8[A+7]=E,o}}kp.prototype.bytesPerElement=8,Et("StructArrayLayout2i4ub8",kp);class vc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.float32[_+0]=h,this.float32[_+1]=p,o}}vc.prototype.bytesPerElement=8,Et("StructArrayLayout2f8",vc);class Rh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N){const O=this.length;return this.resize(O+1),this.emplace(O,o,h,p,_,b,x,E,P,A,N)}emplace(o,h,p,_,b,x,E,P,A,N,O){const G=10*o;return this.uint16[G+0]=h,this.uint16[G+1]=p,this.uint16[G+2]=_,this.uint16[G+3]=b,this.uint16[G+4]=x,this.uint16[G+5]=E,this.uint16[G+6]=P,this.uint16[G+7]=A,this.uint16[G+8]=N,this.uint16[G+9]=O,o}}Rh.prototype.bytesPerElement=20,Et("StructArrayLayout10ui20",Rh);class Dp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G){const H=this.length;return this.resize(H+1),this.emplace(H,o,h,p,_,b,x,E,P,A,N,O,G)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H){const X=12*o;return this.int16[X+0]=h,this.int16[X+1]=p,this.int16[X+2]=_,this.int16[X+3]=b,this.uint16[X+4]=x,this.uint16[X+5]=E,this.uint16[X+6]=P,this.uint16[X+7]=A,this.int16[X+8]=N,this.int16[X+9]=O,this.int16[X+10]=G,this.int16[X+11]=H,o}}Dp.prototype.bytesPerElement=24,Et("StructArrayLayout4i4ui4i24",Dp);class Rp extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.float32[b+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Rp.prototype.bytesPerElement=12,Et("StructArrayLayout3f12",Rp);class wa extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}wa.prototype.bytesPerElement=4,Et("StructArrayLayout1ul4",wa);class Nh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,_,b,x,E,P,A)}emplace(o,h,p,_,b,x,E,P,A,N){const O=10*o,G=5*o;return this.int16[O+0]=h,this.int16[O+1]=p,this.int16[O+2]=_,this.int16[O+3]=b,this.int16[O+4]=x,this.int16[O+5]=E,this.uint32[G+3]=P,this.uint16[O+8]=A,this.uint16[O+9]=N,o}}Nh.prototype.bytesPerElement=20,Et("StructArrayLayout6i1ul2ui20",Nh);class bc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,o,h,p,_,b,x)}emplace(o,h,p,_,b,x,E){const P=6*o;return this.int16[P+0]=h,this.int16[P+1]=p,this.int16[P+2]=_,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,o}}bc.prototype.bytesPerElement=12,Et("StructArrayLayout2i2i2i12",bc);class Oh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b){const x=this.length;return this.resize(x+1),this.emplace(x,o,h,p,_,b)}emplace(o,h,p,_,b,x){const E=4*o,P=8*o;return this.float32[E+0]=h,this.float32[E+1]=p,this.float32[E+2]=_,this.int16[P+6]=b,this.int16[P+7]=x,o}}Oh.prototype.bytesPerElement=16,Et("StructArrayLayout2f1f2i16",Oh);class xc extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=12*o,E=3*o;return this.uint8[x+0]=h,this.uint8[x+1]=p,this.float32[E+1]=_,this.float32[E+2]=b,o}}xc.prototype.bytesPerElement=12,Et("StructArrayLayout2ub2f12",xc);class zh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[b+0]=h,this.uint16[b+1]=p,this.uint16[b+2]=_,o}}zh.prototype.bytesPerElement=6,Et("StructArrayLayout3ui6",zh);class xu extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G,H,X,re,ce,ge){const Re=this.length;return this.resize(Re+1),this.emplace(Re,o,h,p,_,b,x,E,P,A,N,O,G,H,X,re,ce,ge)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H,X,re,ce,ge,Re){const be=24*o,Te=12*o,Je=48*o;return this.int16[be+0]=h,this.int16[be+1]=p,this.uint16[be+2]=_,this.uint16[be+3]=b,this.uint32[Te+2]=x,this.uint32[Te+3]=E,this.uint32[Te+4]=P,this.uint16[be+10]=A,this.uint16[be+11]=N,this.uint16[be+12]=O,this.float32[Te+7]=G,this.float32[Te+8]=H,this.uint8[Je+36]=X,this.uint8[Je+37]=re,this.uint8[Je+38]=ce,this.uint32[Te+10]=ge,this.int16[be+22]=Re,o}}xu.prototype.bytesPerElement=48,Et("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xu);class Rl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_,b,x,E,P,A,N,O,G,H,X,re,ce,ge,Re,be,Te,Je,Qe,wt,Tt,xt,yt,ct,It){const mt=this.length;return this.resize(mt+1),this.emplace(mt,o,h,p,_,b,x,E,P,A,N,O,G,H,X,re,ce,ge,Re,be,Te,Je,Qe,wt,Tt,xt,yt,ct,It)}emplace(o,h,p,_,b,x,E,P,A,N,O,G,H,X,re,ce,ge,Re,be,Te,Je,Qe,wt,Tt,xt,yt,ct,It,mt){const st=32*o,Bt=16*o;return this.int16[st+0]=h,this.int16[st+1]=p,this.int16[st+2]=_,this.int16[st+3]=b,this.int16[st+4]=x,this.int16[st+5]=E,this.int16[st+6]=P,this.int16[st+7]=A,this.uint16[st+8]=N,this.uint16[st+9]=O,this.uint16[st+10]=G,this.uint16[st+11]=H,this.uint16[st+12]=X,this.uint16[st+13]=re,this.uint16[st+14]=ce,this.uint16[st+15]=ge,this.uint16[st+16]=Re,this.uint16[st+17]=be,this.uint16[st+18]=Te,this.uint16[st+19]=Je,this.uint16[st+20]=Qe,this.uint16[st+21]=wt,this.uint16[st+22]=Tt,this.uint32[Bt+12]=xt,this.float32[Bt+13]=yt,this.float32[Bt+14]=ct,this.uint16[st+30]=It,this.uint16[st+31]=mt,o}}Rl.prototype.bytesPerElement=64,Et("StructArrayLayout8i15ui1ul2f2ui64",Rl);class Fh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Fh.prototype.bytesPerElement=4,Et("StructArrayLayout1f4",Fh);class Bh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=3*o;return this.uint16[6*o+0]=h,this.float32[b+1]=p,this.float32[b+2]=_,o}}Bh.prototype.bytesPerElement=12,Et("StructArrayLayout1ui2f12",Bh);class Nl extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,o,h,p)}emplace(o,h,p,_){const b=4*o;return this.uint32[2*o+0]=h,this.uint16[b+2]=p,this.uint16[b+3]=_,o}}Nl.prototype.bytesPerElement=8,Et("StructArrayLayout1ul2ui8",Nl);class Np extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const _=2*o;return this.uint16[_+0]=h,this.uint16[_+1]=p,o}}Np.prototype.bytesPerElement=4,Et("StructArrayLayout2ui4",Np);class Op extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}Op.prototype.bytesPerElement=2,Et("StructArrayLayout1ui2",Op);class Vh extends Tr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,_){const b=this.length;return this.resize(b+1),this.emplace(b,o,h,p,_)}emplace(o,h,p,_,b){const x=4*o;return this.float32[x+0]=h,this.float32[x+1]=p,this.float32[x+2]=_,this.float32[x+3]=b,o}}Vh.prototype.bytesPerElement=16,Et("StructArrayLayout4f16",Vh);class Wm extends _c{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 I(this.anchorPointX,this.anchorPointY)}}Wm.prototype.size=20;class y extends Nh{get(o){return new Wm(this,o)}}Et("CollisionBoxArray",y);class s extends _c{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}s.prototype.size=48;class f extends xu{get(o){return new s(this,o)}}Et("PlacedSymbolArray",f);class m extends _c{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(o){this._structArray.uint32[this._pos4+12]=o}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}m.prototype.size=64;class g extends Rl{get(o){return new m(this,o)}}Et("SymbolInstanceArray",g);class v extends Fh{getoffsetX(o){return this.float32[1*o+0]}}Et("GlyphOffsetArray",v);class C extends xa{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}Et("SymbolLineVertexArray",C);class L extends _c{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 M extends Bh{get(o){return new L(this,o)}}Et("TextAnchorOffsetArray",M);class R extends _c{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 Nl{get(o){return new R(this,o)}}Et("FeatureIndexArray",z);class F extends yc{}class Z extends yc{}class ue extends yc{}class le extends Ap{}class fe extends kp{}class ne extends vc{}class we extends Rh{}class Be extends Dp{}class pe extends Rp{}class Pe extends wa{}class Ue extends bc{}class qe extends xc{}class Xe extends zh{}class tt extends Np{}const $e=Gr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ut}=$e;class pt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,_){let b=this.segments[this.segments.length-1];return o>pt.MAX_VERTEX_ARRAY_LENGTH&&Ye(`Max vertices per segment is ${pt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!b||b.vertexLength+o>pt.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==_)&&(b={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(b.sortKey=_),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,_){return new pt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function sn(u,o){return 256*(u=ae(Math.floor(u),0,255))+ae(Math.floor(o),0,255)}pt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Et("SegmentVector",pt);const dt=Gr([{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 Ut={exports:{}},an={exports:{}};an.exports=function(u,o){var h,p,_,b,x,E,P,A;for(p=u.length-(h=3&u.length),_=o,x=3432918353,E=461845907,A=0;A>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(P=0,h){case 3:P^=(255&u.charCodeAt(A+2))<<16;case 2:P^=(255&u.charCodeAt(A+1))<<8;case 1:_^=P=(65535&(P=(P=(65535&(P^=255&u.charCodeAt(A)))*x+(((P>>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295}return _^=u.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var Cn=an.exports,Ht={exports:{}};Ht.exports=function(u,o){for(var h,p=u.length,_=o^p,b=0;p>=4;)h=1540483477*(65535&(h=255&u.charCodeAt(b)|(255&u.charCodeAt(++b))<<8|(255&u.charCodeAt(++b))<<16|(255&u.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++b;switch(p){case 3:_^=(255&u.charCodeAt(b+2))<<16;case 2:_^=(255&u.charCodeAt(b+1))<<8;case 1:_=1540483477*(65535&(_^=255&u.charCodeAt(b)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var hn=Cn,pn=Ht.exports;Ut.exports=hn,Ut.exports.murmur3=hn,Ut.exports.murmur2=pn;var Lr=d(Ut.exports);class Wn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,_){this.ids.push(zo(o)),this.positions.push(h,p,_)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zo(o);let p=0,_=this.ids.length-1;for(;p<_;){const x=p+_>>1;this.ids[x]>=h?_=x:p=x+1}const b=[];for(;this.ids[p]===h;)b.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return b}static serialize(o,h){const p=new Float64Array(o.ids),_=new Uint32Array(o.positions);return li(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(o){const h=new Wn;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function zo(u){const o=+u;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Lr(String(u))}function li(u,o,h,p){for(;h>1];let b=h-1,x=p+1;for(;;){do b++;while(u[b]<_);do x--;while(u[x]>_);if(b>=x)break;vr(u,b,x),vr(o,3*b,3*x),vr(o,3*b+1,3*x+1),vr(o,3*b+2,3*x+2)}x-h`u_${_}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new $a(o,h):new Fo(o,h)}}class ri{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,_){const b=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&o.set(b)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new Ws(o,h):new Fo(o,h)}}class br{constructor(o,h,p,_){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(b=>({name:`a_${b}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(o,h,p,_,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new fr(0),h,{},_,[],b);this.paintVertexArray.resize(o),this._setPaintValue(x,o,E)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(o,h,b)}_setPaintValue(o,h,p){if(this.type==="color"){const _=el(p);for(let b=o;b`u_${E}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=h.map(E=>({name:`a_${E}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(o,h,p,_,b){const x=this.expression.evaluate(new fr(this.zoom),h,{},_,[],b),E=this.expression.evaluate(new fr(this.zoom+1),h,{},_,[],b),P=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(P,o,x,E)}updatePaintArray(o,h,p,_){const b=this.expression.evaluate({zoom:this.zoom},p,_),x=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(o,h,b,x)}_setPaintValue(o,h,p,_){if(this.type==="color"){const b=el(p),x=el(_);for(let E=o;E`#define HAS_UNIFORM_${_}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof br||p instanceof pr)for(let _=0;_!0){this.programConfigurations={};for(const _ of o)this.programConfigurations[_.id]=new ii(_,h,p);this.needsUpload=!1,this._featureMap=new Wn,this._bufferOffset=0}populatePaintArrays(o,h,p,_,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(o,h,_,b,x);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,_){for(const b of p)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(o,this._featureMap,h,b,_)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function rs(u,o){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[u]||[u.replace(`${o}-`,"").replace(/-/g,"_")]}function oi(u,o,h){const p={color:{source:vc,composite:Vh},number:{source:Fh,composite:vc}},_=function(b){return{"line-pattern":{source:we,composite:we},"fill-pattern":{source:we,composite:we},"fill-extrusion-pattern":{source:we,composite:we}}[b]}(u);return _&&_[h]||p[o][h]}Et("ConstantBinder",Hs),Et("CrossFadedConstantBinder",ri),Et("SourceExpressionBinder",br),Et("CrossFadedCompositeBinder",ns),Et("CompositeExpressionBinder",pr),Et("ProgramConfiguration",ii,{omit:["_buffers"]}),Et("ProgramConfigurationSet",xr);const Nr=8192,zp=Math.pow(2,14)-1,Hm=-zp-1;function Ol(u){const o=Nr/u.extent,h=u.loadGeometry();for(let p=0;px.x+1||Px.y+1)&&Ye("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function zl(u,o){return{type:u.type,id:u.id,properties:u.properties,geometry:o?Ol(u):[]}}function Uh(u,o,h,p,_){u.emplaceBack(2*o+(p+1)/2,2*h+(_+1)/2)}class tl{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Z,this.indexArray=new Xe,this.segments=new pt,this.programConfigurations=new xr(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const _=this.layers[0],b=[];let x=null,E=!1;_.type==="circle"&&(x=_.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:P,id:A,index:N,sourceLayerIndex:O}of o){const G=this.layers[0]._featureFilter.needGeometry,H=zl(P,G);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),H,p))continue;const X=E?x.evaluate(H,{},p):void 0,re={id:A,properties:P.properties,type:P.type,sourceLayerIndex:O,index:N,geometry:G?H.geometry:Ol(P),patterns:{},sortKey:X};b.push(re)}E&&b.sort((P,A)=>P.sortKey-A.sortKey);for(const P of b){const{geometry:A,index:N,sourceLayerIndex:O}=P,G=o[N].feature;this.addFeature(P,A,N,p),h.featureIndex.insert(G,A,N,O,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,ut),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,h,p,_){for(const b of h)for(const x of b){const E=x.x,P=x.y;if(E<0||E>=Nr||P<0||P>=Nr)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),N=A.vertexLength;Uh(this.layoutVertexArray,E,P,-1,-1),Uh(this.layoutVertexArray,E,P,1,-1),Uh(this.layoutVertexArray,E,P,1,1),Uh(this.layoutVertexArray,E,P,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},_)}}function Fp(u,o){for(let h=0;h1){if(Gh(u,o))return!0;for(let p=0;p1?h:h.sub(o)._mult(_)._add(o))}function R1(u,o){let h,p,_,b=!1;for(let x=0;xo.y!=_.y>o.y&&o.x<(_.x-p.x)*(o.y-p.y)/(_.y-p.y)+p.x&&(b=!b)}return b}function jh(u,o){let h=!1;for(let p=0,_=u.length-1;po.y!=x.y>o.y&&o.x<(x.x-b.x)*(o.y-b.y)/(x.y-b.y)+b.x&&(h=!h)}return h}function lT(u,o,h){const p=h[0],_=h[2];if(u.x_.x&&o.x>_.x||u.y_.y&&o.y>_.y)return!1;const b=ve(u,o,h[0]);return b!==ve(u,o,h[1])||b!==ve(u,o,h[2])||b!==ve(u,o,h[3])}function Gp(u,o,h){const p=o.paint.get(u).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(u)}function Xm(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Ym(u,o,h,p,_){if(!o[0]&&!o[1])return u;const b=I.convert(o)._mult(_);h==="viewport"&&b._rotate(-p);const x=[];for(let E=0;EF1(ce,re))}(A,P),H=O?N*E:N;for(const X of _)for(const re of X){const ce=O?re:F1(re,P);let ge=H;const Re=Km([],[re.x,re.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ge*=Re[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ge*=x.cameraToCenterDistance/Re[3]),Zm(G,ce,ge))return!0}return!1}}function F1(u,o){const h=Km([],[u.x,u.y,0,1],o);return new I(h[0]/h[3],h[1]/h[3])}class B1 extends tl{}let V1;Et("HeatmapBucket",B1,{omit:["layers"]});var fT={get paint(){return V1=V1||new vo({"heatmap-radius":new Vt(ze.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Vt(ze.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Dt(ze.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Lp(ze.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Dt(ze.paint_heatmap["heatmap-opacity"])})}};function _y(u,{width:o,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${o*h*p}`)}else _=new Uint8Array(o*h*p);return u.width=o,u.height=h,u.data=_,u}function U1(u,{width:o,height:h},p){if(o===u.width&&h===u.height)return;const _=_y({},{width:o,height:h},p);yy(u,_,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,o),height:Math.min(u.height,h)},p),u.width=o,u.height=h,u.data=_.data}function yy(u,o,h,p,_,b){if(_.width===0||_.height===0)return o;if(_.width>u.width||_.height>u.height||h.x>u.width-_.width||h.y>u.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>o.width||_.height>o.height||p.x>o.width-_.width||p.y>o.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const x=u.data,E=o.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<_.height;P++){const A=((h.y+P)*u.width+h.x)*b,N=((p.y+P)*o.width+p.x)*b;for(let O=0;O<_.width*b;O++)E[N+O]=x[A+O]}return o}class qp{constructor(o,h){_y(this,o,1,h)}resize(o){U1(this,o,1)}clone(){return new qp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){yy(o,h,p,_,b,1)}}class ws{constructor(o,h){_y(this,o,4,h)}resize(o){U1(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new ws({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,_,b){yy(o,h,p,_,b,4)}}function G1(u){const o={},h=u.resolution||256,p=u.clips?u.clips.length:1,_=u.image||new ws({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const b=(x,E,P)=>{o[u.evaluationKey]=P;const A=u.expression.evaluate(o);_.data[x+E+0]=Math.floor(255*A.r/A.a),_.data[x+E+1]=Math.floor(255*A.g/A.a),_.data[x+E+2]=Math.floor(255*A.b/A.a),_.data[x+E+3]=Math.floor(255*A.a)};if(u.clips)for(let x=0,E=0;x80*h){p=b=u[0],_=x=u[1];for(var X=h;Xb&&(b=E),P>x&&(x=P);A=(A=Math.max(b-p,x-_))!==0?32767/A:0}return Wp(G,H,h,p,_,A,0),H}function q1(u,o,h,p,_){var b,x;if(_===wy(u,o,h,p)>0)for(b=o;b=o;b-=p)x=Z1(b,u[b],u[b+1],x);return x&&Qm(x,x.next)&&(Zp(x),x=x.next),x}function Sc(u,o){if(!u)return u;o||(o=u);var h,p=u;do if(h=!1,p.steiner||!Qm(p,p.next)&&jr(p.prev,p,p.next)!==0)p=p.next;else{if(Zp(p),(p=o=p.prev)===p.next)break;h=!0}while(h||p!==o);return o}function Wp(u,o,h,p,_,b,x){if(u){!x&&b&&function(N,O,G,H){var X=N;do X.z===0&&(X.z=by(X.x,X.y,O,G,H)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==N);X.prevZ.nextZ=null,X.prevZ=null,function(re){var ce,ge,Re,be,Te,Je,Qe,wt,Tt=1;do{for(ge=re,re=null,Te=null,Je=0;ge;){for(Je++,Re=ge,Qe=0,ce=0;ce0||wt>0&ℜ)Qe!==0&&(wt===0||!Re||ge.z<=Re.z)?(be=ge,ge=ge.nextZ,Qe--):(be=Re,Re=Re.nextZ,wt--),Te?Te.nextZ=be:re=be,be.prevZ=Te,Te=be;ge=Re}Te.nextZ=null,Tt*=2}while(Je>1)}(X)}(u,p,_,b);for(var E,P,A=u;u.prev!==u.next;)if(E=u.prev,P=u.next,b?vT(u,p,_,b):yT(u))o.push(E.i/h|0),o.push(u.i/h|0),o.push(P.i/h|0),Zp(u),u=P.next,A=P.next;else if((u=P)===A){x?x===1?Wp(u=bT(Sc(u),o,h),o,h,p,_,b,2):x===2&&xT(u,o,h,p,_,b):Wp(Sc(u),o,h,p,_,b,1);break}}}function yT(u){var o=u.prev,h=u,p=u.next;if(jr(o,h,p)>=0)return!1;for(var _=o.x,b=h.x,x=p.x,E=o.y,P=h.y,A=p.y,N=_b?_>x?_:x:b>x?b:x,H=E>P?E>A?E:A:P>A?P:A,X=p.next;X!==o;){if(X.x>=N&&X.x<=G&&X.y>=O&&X.y<=H&&Wh(_,E,b,P,x,A,X.x,X.y)&&jr(X.prev,X,X.next)>=0)return!1;X=X.next}return!0}function vT(u,o,h,p){var _=u.prev,b=u,x=u.next;if(jr(_,b,x)>=0)return!1;for(var E=_.x,P=b.x,A=x.x,N=_.y,O=b.y,G=x.y,H=EP?E>A?E:A:P>A?P:A,ce=N>O?N>G?N:G:O>G?O:G,ge=by(H,X,o,h,p),Re=by(re,ce,o,h,p),be=u.prevZ,Te=u.nextZ;be&&be.z>=ge&&Te&&Te.z<=Re;){if(be.x>=H&&be.x<=re&&be.y>=X&&be.y<=ce&&be!==_&&be!==x&&Wh(E,N,P,O,A,G,be.x,be.y)&&jr(be.prev,be,be.next)>=0||(be=be.prevZ,Te.x>=H&&Te.x<=re&&Te.y>=X&&Te.y<=ce&&Te!==_&&Te!==x&&Wh(E,N,P,O,A,G,Te.x,Te.y)&&jr(Te.prev,Te,Te.next)>=0))return!1;Te=Te.nextZ}for(;be&&be.z>=ge;){if(be.x>=H&&be.x<=re&&be.y>=X&&be.y<=ce&&be!==_&&be!==x&&Wh(E,N,P,O,A,G,be.x,be.y)&&jr(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Te&&Te.z<=Re;){if(Te.x>=H&&Te.x<=re&&Te.y>=X&&Te.y<=ce&&Te!==_&&Te!==x&&Wh(E,N,P,O,A,G,Te.x,Te.y)&&jr(Te.prev,Te,Te.next)>=0)return!1;Te=Te.nextZ}return!0}function bT(u,o,h){var p=u;do{var _=p.prev,b=p.next.next;!Qm(_,b)&&W1(_,p,p.next,b)&&Hp(_,b)&&Hp(b,_)&&(o.push(_.i/h|0),o.push(p.i/h|0),o.push(b.i/h|0),Zp(p),Zp(p.next),p=u=b),p=p.next}while(p!==u);return Sc(p)}function xT(u,o,h,p,_,b){var x=u;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&CT(x,E)){var P=H1(x,E);return x=Sc(x,x.next),P=Sc(P,P.next),Wp(x,o,h,p,_,b,0),void Wp(P,o,h,p,_,b,0)}E=E.next}x=x.next}while(x!==u)}function wT(u,o){return u.x-o.x}function ST(u,o){var h=function(_,b){var x,E=b,P=_.x,A=_.y,N=-1/0;do{if(A<=E.y&&A>=E.next.y&&E.next.y!==E.y){var O=E.x+(A-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if(O<=P&&O>N&&(N=O,x=E.x=E.x&&E.x>=X&&P!==E.x&&Wh(Ax.x||E.x===x.x&&ET(x,E)))&&(x=E,ce=G)),E=E.next;while(E!==H);return x}(u,o);if(!h)return o;var p=H1(h,u);return Sc(p,p.next),Sc(h,h.next)}function ET(u,o){return jr(u.prev,u,o.prev)<0&&jr(o.next,u,u.next)<0}function by(u,o,h,p,_){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-h)*_|0)|u<<8))|u<<4))|u<<2))|u<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*_|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function IT(u){var o=u,h=u;do(o.x=(u-x)*(b-E)&&(u-x)*(p-E)>=(h-x)*(o-E)&&(h-x)*(b-E)>=(_-x)*(p-E)}function CT(u,o){return u.next.i!==o.i&&u.prev.i!==o.i&&!function(h,p){var _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&W1(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(u,o)&&(Hp(u,o)&&Hp(o,u)&&function(h,p){var _=h,b=!1,x=(h.x+p.x)/2,E=(h.y+p.y)/2;do _.y>E!=_.next.y>E&&_.next.y!==_.y&&x<(_.next.x-_.x)*(E-_.y)/(_.next.y-_.y)+_.x&&(b=!b),_=_.next;while(_!==h);return b}(u,o)&&(jr(u.prev,u,o.prev)||jr(u,o.prev,o))||Qm(u,o)&&jr(u.prev,u,u.next)>0&&jr(o.prev,o,o.next)>0)}function jr(u,o,h){return(o.y-u.y)*(h.x-o.x)-(o.x-u.x)*(h.y-o.y)}function Qm(u,o){return u.x===o.x&&u.y===o.y}function W1(u,o,h,p){var _=eg(jr(u,o,h)),b=eg(jr(u,o,p)),x=eg(jr(h,p,u)),E=eg(jr(h,p,o));return _!==b&&x!==E||!(_!==0||!$m(u,h,o))||!(b!==0||!$m(u,p,o))||!(x!==0||!$m(h,u,p))||!(E!==0||!$m(h,o,p))}function $m(u,o,h){return o.x<=Math.max(u.x,h.x)&&o.x>=Math.min(u.x,h.x)&&o.y<=Math.max(u.y,h.y)&&o.y>=Math.min(u.y,h.y)}function eg(u){return u>0?1:u<0?-1:0}function Hp(u,o){return jr(u.prev,u,u.next)<0?jr(u,o,u.next)>=0&&jr(u,u.prev,o)>=0:jr(u,o,u.prev)<0||jr(u,u.next,o)<0}function H1(u,o){var h=new xy(u.i,u.x,u.y),p=new xy(o.i,o.x,o.y),_=u.next,b=o.prev;return u.next=o,o.prev=u,h.next=_,_.prev=h,p.next=h,h.prev=p,b.next=p,p.prev=b,p}function Z1(u,o,h,p){var _=new xy(u,o,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function Zp(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function xy(u,o,h){this.i=u,this.x=o,this.y=h,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function wy(u,o,h,p){for(var _=0,b=o,x=h-p;b0&&h.holes.push(p+=u[_-1].length)}return h};var X1=d(vy.exports);function TT(u,o,h,p,_){Y1(u,o,h||0,p||u.length-1,_||LT)}function Y1(u,o,h,p,_){for(;p>h;){if(p-h>600){var b=p-h+1,x=o-h+1,E=Math.log(b),P=.5*Math.exp(2*E/3),A=.5*Math.sqrt(E*P*(b-P)/b)*(x-b/2<0?-1:1);Y1(u,o,Math.max(h,Math.floor(o-x*P/b+A)),Math.min(p,Math.floor(o+(b-x)*P/b+A)),_)}var N=u[o],O=h,G=p;for(Xp(u,h,o),_(u[p],N)>0&&Xp(u,h,p);O0;)G--}_(u[h],N)===0?Xp(u,h,G):Xp(u,++G,p),G<=o&&(h=G+1),o<=G&&(p=G-1)}}function Xp(u,o,h){var p=u[o];u[o]=u[h],u[h]=p}function LT(u,o){return uo?1:0}function Sy(u,o){const h=u.length;if(h<=1)return[u];const p=[];let _,b;for(let x=0;x1)for(let x=0;xh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ue,this.indexArray=new Xe,this.indexArray2=new tt,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new pt,this.segments2=new pt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Ey("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),b=!_.isConstant(),x=[];for(const{feature:E,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=zl(E,O);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),G,p))continue;const H=b?_.evaluate(G,{},p,h.availableImages):void 0,X={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Ol(E),patterns:{},sortKey:H};x.push(X)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:A,sourceLayerIndex:N}=E;if(this.hasPattern){const O=Iy("fill",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,_T),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(o,h,p,_,b){for(const x of Sy(h,500)){let E=0;for(const H of x)E+=H.length;const P=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),A=P.vertexLength,N=[],O=[];for(const H of x){if(H.length===0)continue;H!==x[0]&&O.push(N.length/2);const X=this.segments2.prepareSegment(H.length,this.layoutVertexArray,this.indexArray2),re=X.vertexLength;this.layoutVertexArray.emplaceBack(H[0].x,H[0].y),this.indexArray2.emplaceBack(re+H.length-1,re),N.push(H[0].x),N.push(H[0].y);for(let ce=1;ce>3}if(_--,p===1||p===2)b+=u.readSVarint(),x+=u.readSVarint(),p===1&&(o&&E.push(o),o=[]),o.push(new NT(b,x));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&E.push(o),E},Hh.prototype.bbox=function(){var u=this._pbf;u.pos=this._geometry;for(var o=u.readVarint()+u.pos,h=1,p=0,_=0,b=0,x=1/0,E=-1/0,P=1/0,A=-1/0;u.pos>3}if(p--,h===1||h===2)(_+=u.readSVarint())E&&(E=_),(b+=u.readSVarint())A&&(A=b);else if(h!==7)throw new Error("unknown command "+h)}return[x,P,E,A]},Hh.prototype.toGeoJSON=function(u,o,h){var p,_,b=this.extent*Math.pow(2,h),x=this.extent*u,E=this.extent*o,P=this.loadGeometry(),A=Hh.types[this.type];function N(H){for(var X=0;X>3;_=x===1?p.readString():x===2?p.readFloat():x===3?p.readDouble():x===4?p.readVarint64():x===5?p.readVarint():x===6?p.readSVarint():x===7?p.readBoolean():null}return _}(h))}eb.prototype.feature=function(u){if(u<0||u>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[u];var o=this._pbf.readVarint()+this._pbf.pos;return new FT(this._pbf,o,this.extent,this._keys,this._values)};var VT=$1;function UT(u,o,h){if(u===3){var p=new VT(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}wu.VectorTile=function(u,o){this.layers=u.readFields(UT,{},o)},wu.VectorTileFeature=Q1,wu.VectorTileLayer=$1;const GT=wu.VectorTileFeature.types,Ty=Math.pow(2,13);function Yp(u,o,h,p,_,b,x,E){u.emplaceBack(o,h,2*Math.floor(p*Ty)+x,_*Ty*2,b*Ty*2,Math.round(E))}class Ly{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new le,this.centroidVertexArray=new F,this.indexArray=new Xe,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new pt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=Ey("fill-extrusion",this.layers,h);for(const{feature:_,id:b,index:x,sourceLayerIndex:E}of o){const P=this.layers[0]._featureFilter.needGeometry,A=zl(_,P);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),A,p))continue;const N={id:b,sourceLayerIndex:E,index:x,geometry:P?A.geometry:Ol(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(Iy("fill-extrusion",this.layers,N,this.zoom,h)):this.addFeature(N,N.geometry,x,p,{}),h.featureIndex.insert(_,N.geometry,x,E,this.index,!0)}}addFeatures(o,h,p){for(const _ of this.features){const{geometry:b}=_;this.addFeature(_,b,_.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,RT),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,DT.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,h,p,_,b){const x={x:0,y:0,vertexCount:0};for(const E of Sy(h,500)){let P=0;for(const X of E)P+=X.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const X of E){if(X.length===0||qT(X))continue;let re=0;for(let ce=0;ce=1){const Re=X[ce-1];if(!jT(ge,Re)){A.vertexLength+4>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=ge.sub(Re)._perp()._unit(),Te=Re.dist(ge);re+Te>32768&&(re=0),Yp(this.layoutVertexArray,ge.x,ge.y,be.x,be.y,0,0,re),Yp(this.layoutVertexArray,ge.x,ge.y,be.x,be.y,0,1,re),x.x+=2*ge.x,x.y+=2*ge.y,x.vertexCount+=2,re+=Te,Yp(this.layoutVertexArray,Re.x,Re.y,be.x,be.y,0,0,re),Yp(this.layoutVertexArray,Re.x,Re.y,be.x,be.y,0,1,re),x.x+=2*Re.x,x.y+=2*Re.y,x.vertexCount+=2;const Je=A.vertexLength;this.indexArray.emplaceBack(Je,Je+2,Je+1),this.indexArray.emplaceBack(Je+1,Je+2,Je+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+P>pt.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),GT[o.type]!=="Polygon")continue;const N=[],O=[],G=A.vertexLength;for(const X of E)if(X.length!==0){X!==E[0]&&O.push(N.length/2);for(let re=0;reNr)||u.y===o.y&&(u.y<0||u.y>Nr)}function qT(u){return u.every(o=>o.x<0)||u.every(o=>o.x>Nr)||u.every(o=>o.y<0)||u.every(o=>o.y>Nr)}let tb;Et("FillExtrusionBucket",Ly,{omit:["layers","features"]});var WT={get paint(){return tb=tb||new vo({"fill-extrusion-opacity":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Dh(ze["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Vt(ze["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Dt(ze["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class HT extends xs{constructor(o){super(o,WT)}createBucket(o){return new Ly(o)}queryRadius(){return Xm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,_,b,x,E,P){const A=Ym(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),N=this.paint.get("fill-extrusion-height").evaluate(h,p),O=this.paint.get("fill-extrusion-base").evaluate(h,p),G=function(X,re,ce,ge){const Re=[];for(const be of X){const Te=[be.x,be.y,0,1];Km(Te,Te,re),Re.push(new I(Te[0]/Te[3],Te[1]/Te[3]))}return Re}(A,P),H=function(X,re,ce,ge){const Re=[],be=[],Te=ge[8]*re,Je=ge[9]*re,Qe=ge[10]*re,wt=ge[11]*re,Tt=ge[8]*ce,xt=ge[9]*ce,yt=ge[10]*ce,ct=ge[11]*ce;for(const It of X){const mt=[],st=[];for(const Bt of It){const At=Bt.x,gn=Bt.y,ar=ge[0]*At+ge[4]*gn+ge[12],dr=ge[1]*At+ge[5]*gn+ge[13],hi=ge[2]*At+ge[6]*gn+ge[14],is=ge[3]*At+ge[7]*gn+ge[15],xo=hi+Qe,si=is+wt,ki=ar+Tt,Vi=dr+xt,wo=hi+yt,So=is+ct,fi=new I((ar+Te)/si,(dr+Je)/si);fi.z=xo/si,mt.push(fi);const pi=new I(ki/So,Vi/So);pi.z=wo/So,st.push(pi)}Re.push(mt),be.push(st)}return[Re,be]}(_,O,N,P);return function(X,re,ce){let ge=1/0;Bp(ce,re)&&(ge=nb(ce,re[0]));for(let Re=0;Reh.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new fe,this.layoutVertexArray2=new ne,this.indexArray=new Xe,this.programConfigurations=new xr(o.layers,o.zoom),this.segments=new pt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=Ey("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),b=!_.isConstant(),x=[];for(const{feature:E,id:P,index:A,sourceLayerIndex:N}of o){const O=this.layers[0]._featureFilter.needGeometry,G=zl(E,O);if(!this.layers[0]._featureFilter.filter(new fr(this.zoom),G,p))continue;const H=b?_.evaluate(G,{},p):void 0,X={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:A,geometry:O?G.geometry:Ol(E),patterns:{},sortKey:H};x.push(X)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:A,sourceLayerIndex:N}=E;if(this.hasPattern){const O=Iy("line",this.layers,E,this.zoom,h);this.patternFeatures.push(O)}else this.addFeature(E,P,A,p,{});h.featureIndex.insert(o[A].feature,P,A,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,KT)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,XT),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,h,p,_,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(o,{}),P=x.get("line-cap"),A=x.get("line-miter-limit"),N=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const O of h)this.addLine(O,o,E,P,A,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,b,_)}addLine(o,h,p,_,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ge=0;ge=2&&o[P-1].equals(o[P-2]);)P--;let A=0;for(;A0;if(wt&&ge>A){const ct=G.dist(H);if(ct>2*N){const It=G.sub(G.sub(H)._mult(N/ct)._round());this.updateDistance(H,It),this.addCurrentVertex(It,re,0,0,O),H=It}}const xt=H&&X;let yt=xt?p:E?"butt":_;if(xt&&yt==="round"&&(Jeb&&(yt="bevel"),yt==="bevel"&&(Je>2&&(yt="flipbevel"),Je100)Re=ce.mult(-1);else{const ct=Je*re.add(ce).mag()/re.sub(ce).mag();Re._perp()._mult(ct*(Tt?-1:1))}this.addCurrentVertex(G,Re,0,0,O),this.addCurrentVertex(G,Re.mult(-1),0,0,O)}else if(yt==="bevel"||yt==="fakeround"){const ct=-Math.sqrt(Je*Je-1),It=Tt?ct:0,mt=Tt?0:ct;if(H&&this.addCurrentVertex(G,re,It,mt,O),yt==="fakeround"){const st=Math.round(180*Qe/Math.PI/20);for(let Bt=1;Bt2*N){const It=G.add(X.sub(G)._mult(N/ct)._round());this.updateDistance(G,It),this.addCurrentVertex(It,ce,0,0,O),G=It}}}}addCurrentVertex(o,h,p,_,b,x=!1){const E=h.y*_-h.x,P=-h.y-h.x*_;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,x,!1,p,b),this.addHalfVertex(o,E,P,x,!0,-_,b),this.distance>rb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,_,b,x))}addHalfVertex({x:o,y:h},p,_,b,x,E,P){const A=.5*(this.lineClips?this.scaledDistance*(rb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(b?1:0),(h<<1)+(x?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(E===0?0:E<0?-1:1)|(63&A)<<2,A>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const N=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),P.primitiveLength++),x?this.e2=N:this.e1=N}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let ib,ob;Et("LineBucket",Py,{omit:["layers","patternFeatures"]});var sb={get paint(){return ob=ob||new vo({"line-opacity":new Vt(ze.paint_line["line-opacity"]),"line-color":new Vt(ze.paint_line["line-color"]),"line-translate":new Dt(ze.paint_line["line-translate"]),"line-translate-anchor":new Dt(ze.paint_line["line-translate-anchor"]),"line-width":new Vt(ze.paint_line["line-width"]),"line-gap-width":new Vt(ze.paint_line["line-gap-width"]),"line-offset":new Vt(ze.paint_line["line-offset"]),"line-blur":new Vt(ze.paint_line["line-blur"]),"line-dasharray":new gc(ze.paint_line["line-dasharray"]),"line-pattern":new Dh(ze.paint_line["line-pattern"]),"line-gradient":new Lp(ze.paint_line["line-gradient"])})},get layout(){return ib=ib||new vo({"line-cap":new Dt(ze.layout_line["line-cap"]),"line-join":new Vt(ze.layout_line["line-join"]),"line-miter-limit":new Dt(ze.layout_line["line-miter-limit"]),"line-round-limit":new Dt(ze.layout_line["line-round-limit"]),"line-sort-key":new Vt(ze.layout_line["line-sort-key"])})}};class $T extends Vt{possiblyEvaluate(o,h){return h=new fr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,_){return h=de({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,_)}}let tg;class eL extends xs{constructor(o){super(o,sb),this.gradientVersion=0,tg||(tg=new $T(sb.paint.properties["line-width"].specification),tg.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof lc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=tg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new Py(o)}queryRadius(o){const h=o,p=ab(Gp("line-width",this,h),Gp("line-gap-width",this,h)),_=Gp("line-offset",this,h);return p/2+Math.abs(_)+Xm(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,_,b,x,E){const P=Ym(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),A=E/2*ab(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),N=this.paint.get("line-offset").evaluate(h,p);return N&&(_=function(O,G){const H=[];for(let X=0;X=3){for(let ce=0;ce0?o+2*u:u}const tL=Gr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),nL=Gr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Gr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const rL=Gr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Gr([{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 lb=Gr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iL=Gr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function oL(u,o,h){return u.sections.forEach(p=>{p.text=function(_,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?_=_.toLocaleUpperCase():E==="lowercase"&&(_=_.toLocaleLowerCase()),Qa.applyArabicShaping&&(_=Qa.applyArabicShaping(_)),_}(p.text,o,h)}),u}Gr([{name:"triangle",components:3,type:"Uint16"}]),Gr([{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"}]),Gr([{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"}]),Gr([{type:"Float32",name:"offsetX"}]),Gr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Gr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Jp={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ci=24,ub=Yn,cb=function(u,o,h,p,_){var b,x,E=8*_-p-1,P=(1<>1,N=-7,O=h?_-1:0,G=h?-1:1,H=u[o+O];for(O+=G,b=H&(1<<-N)-1,H>>=-N,N+=E;N>0;b=256*b+u[o+O],O+=G,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=p;N>0;x=256*x+u[o+O],O+=G,N-=8);if(b===0)b=1-A;else{if(b===P)return x?NaN:1/0*(H?-1:1);x+=Math.pow(2,p),b-=A}return(H?-1:1)*x*Math.pow(2,b-p)},hb=function(u,o,h,p,_,b){var x,E,P,A=8*b-_-1,N=(1<>1,G=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=p?0:b-1,X=p?1:-1,re=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(E=isNaN(o)?1:0,x=N):(x=Math.floor(Math.log(o)/Math.LN2),o*(P=Math.pow(2,-x))<1&&(x--,P*=2),(o+=x+O>=1?G/P:G*Math.pow(2,1-O))*P>=2&&(x++,P/=2),x+O>=N?(E=0,x=N):x+O>=1?(E=(o*P-1)*Math.pow(2,_),x+=O):(E=o*Math.pow(2,O-1)*Math.pow(2,_),x=0));_>=8;u[h+H]=255&E,H+=X,E/=256,_-=8);for(x=x<<_|E,A+=_;A>0;u[h+H]=255&x,H+=X,x/=256,A-=8);u[h+H-X]|=128*re};function Yn(u){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(u)?u:new Uint8Array(u||0),this.pos=0,this.type=0,this.length=this.buf.length}Yn.Varint=0,Yn.Fixed64=1,Yn.Bytes=2,Yn.Fixed32=5;var My=4294967296,fb=1/My,pb=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Fl(u){return u.type===Yn.Bytes?u.readVarint()+u.pos:u.pos+1}function Zh(u,o,h){return h?4294967296*o+(u>>>0):4294967296*(o>>>0)+(u>>>0)}function db(u,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=u;_--)h.buf[_+p]=h.buf[_]}function sL(u,o){for(var h=0;h>>8,u[h+2]=o>>>16,u[h+3]=o>>>24}function mb(u,o){return(u[o]|u[o+1]<<8|u[o+2]<<16)+(u[o+3]<<24)}Yn.prototype={destroy:function(){this.buf=null},readFields:function(u,o,h){for(h=h||this.length;this.pos>3,b=this.pos;this.type=7&p,u(_,o,this),this.pos===b&&this.skip(p)}return o},readMessage:function(u,o){return this.readFields(u,o,this.readVarint()+this.pos)},readFixed32:function(){var u=ng(this.buf,this.pos);return this.pos+=4,u},readSFixed32:function(){var u=mb(this.buf,this.pos);return this.pos+=4,u},readFixed64:function(){var u=ng(this.buf,this.pos)+ng(this.buf,this.pos+4)*My;return this.pos+=8,u},readSFixed64:function(){var u=ng(this.buf,this.pos)+mb(this.buf,this.pos+4)*My;return this.pos+=8,u},readFloat:function(){var u=cb(this.buf,this.pos,!0,23,4);return this.pos+=4,u},readDouble:function(){var u=cb(this.buf,this.pos,!0,52,8);return this.pos+=8,u},readVarint:function(u){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(_,b,x){var E,P,A=x.buf;if(E=(112&(P=A[x.pos++]))>>4,P<128||(E|=(127&(P=A[x.pos++]))<<3,P<128)||(E|=(127&(P=A[x.pos++]))<<10,P<128)||(E|=(127&(P=A[x.pos++]))<<17,P<128)||(E|=(127&(P=A[x.pos++]))<<24,P<128)||(E|=(1&(P=A[x.pos++]))<<31,P<128))return Zh(_,E,b);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,u,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var u=this.readVarint();return u%2==1?(u+1)/-2:u/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var u=this.readVarint()+this.pos,o=this.pos;return this.pos=u,u-o>=12&&pb?function(h,p,_){return pb.decode(h.subarray(p,_))}(this.buf,o,u):function(h,p,_){for(var b="",x=p;x<_;){var E,P,A,N=h[x],O=null,G=N>239?4:N>223?3:N>191?2:1;if(x+G>_)break;G===1?N<128&&(O=N):G===2?(192&(E=h[x+1]))==128&&(O=(31&N)<<6|63&E)<=127&&(O=null):G===3?(P=h[x+2],(192&(E=h[x+1]))==128&&(192&P)==128&&((O=(15&N)<<12|(63&E)<<6|63&P)<=2047||O>=55296&&O<=57343)&&(O=null)):G===4&&(P=h[x+2],A=h[x+3],(192&(E=h[x+1]))==128&&(192&P)==128&&(192&A)==128&&((O=(15&N)<<18|(63&E)<<12|(63&P)<<6|63&A)<=65535||O>=1114112)&&(O=null)),O===null?(O=65533,G=1):O>65535&&(O-=65536,b+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),b+=String.fromCharCode(O),x+=G}return b}(this.buf,o,u)},readBytes:function(){var u=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,u);return this.pos=u,o},readPackedVarint:function(u,o){if(this.type!==Yn.Bytes)return u.push(this.readVarint(o));var h=Fl(this);for(u=u||[];this.pos127;);else if(o===Yn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Yn.Fixed32)this.pos+=4;else{if(o!==Yn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(u,o){this.writeVarint(u<<3|o)},realloc:function(u){for(var o=this.length||16;o268435455||u<0?function(o,h){var p,_;if(o>=0?(p=o%4294967296|0,_=o/4294967296|0):(_=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,_=_+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(p,0,h),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(_,h)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))},writeSVarint:function(u){this.writeVarint(u<0?2*-u-1:2*u)},writeBoolean:function(u){this.writeVarint(!!u)},writeString:function(u){u=String(u),this.realloc(4*u.length),this.pos++;var o=this.pos;this.pos=function(p,_,b){for(var x,E,P=0;P<_.length;P++){if((x=_.charCodeAt(P))>55295&&x<57344){if(!E){x>56319||P+1===_.length?(p[b++]=239,p[b++]=191,p[b++]=189):E=x;continue}if(x<56320){p[b++]=239,p[b++]=191,p[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(p[b++]=239,p[b++]=191,p[b++]=189,E=null);x<128?p[b++]=x:(x<2048?p[b++]=x>>6|192:(x<65536?p[b++]=x>>12|224:(p[b++]=x>>18|240,p[b++]=x>>12&63|128),p[b++]=x>>6&63|128),p[b++]=63&x|128)}return b}(this.buf,u,this.pos);var h=this.pos-o;h>=128&&db(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(u){this.realloc(4),hb(this.buf,u,this.pos,!0,23,4),this.pos+=4},writeDouble:function(u){this.realloc(8),hb(this.buf,u,this.pos,!0,52,8),this.pos+=8},writeBytes:function(u){var o=u.length;this.writeVarint(o),this.realloc(o);for(var h=0;h=128&&db(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(u,o,h){this.writeTag(u,Yn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(u,o){o.length&&this.writeMessage(u,sL,o)},writePackedSVarint:function(u,o){o.length&&this.writeMessage(u,aL,o)},writePackedBoolean:function(u,o){o.length&&this.writeMessage(u,cL,o)},writePackedFloat:function(u,o){o.length&&this.writeMessage(u,lL,o)},writePackedDouble:function(u,o){o.length&&this.writeMessage(u,uL,o)},writePackedFixed32:function(u,o){o.length&&this.writeMessage(u,hL,o)},writePackedSFixed32:function(u,o){o.length&&this.writeMessage(u,fL,o)},writePackedFixed64:function(u,o){o.length&&this.writeMessage(u,pL,o)},writePackedSFixed64:function(u,o){o.length&&this.writeMessage(u,dL,o)},writeBytesField:function(u,o){this.writeTag(u,Yn.Bytes),this.writeBytes(o)},writeFixed32Field:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(u,o){this.writeTag(u,Yn.Varint),this.writeVarint(o)},writeSVarintField:function(u,o){this.writeTag(u,Yn.Varint),this.writeSVarint(o)},writeStringField:function(u,o){this.writeTag(u,Yn.Bytes),this.writeString(o)},writeFloatField:function(u,o){this.writeTag(u,Yn.Fixed32),this.writeFloat(o)},writeDoubleField:function(u,o){this.writeTag(u,Yn.Fixed64),this.writeDouble(o)},writeBooleanField:function(u,o){this.writeVarintField(u,!!o)}};var Ay=d(ub);const ky=3;function mL(u,o,h){u===1&&h.readMessage(gL,o)}function gL(u,o,h){if(u===3){const{id:p,bitmap:_,width:b,height:x,left:E,top:P,advance:A}=h.readMessage(_L,{});o.push({id:p,bitmap:new qp({width:b+2*ky,height:x+2*ky},_),metrics:{width:b,height:x,left:E,top:P,advance:A}})}}function _L(u,o,h){u===1?o.id=h.readVarint():u===2?o.bitmap=h.readBytes():u===3?o.width=h.readVarint():u===4?o.height=h.readVarint():u===5?o.left=h.readSVarint():u===6?o.top=h.readSVarint():u===7&&(o.advance=h.readVarint())}const gb=ky;function _b(u){let o=0,h=0;for(const x of u)o+=x.w*x.h,h=Math.max(h,x.w);u.sort((x,E)=>E.h-x.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let _=0,b=0;for(const x of u)for(let E=p.length-1;E>=0;E--){const P=p[E];if(!(x.w>P.w||x.h>P.h)){if(x.x=P.x,x.y=P.y,b=Math.max(b,x.y+x.h),_=Math.max(_,x.x+x.w),x.w===P.w&&x.h===P.h){const A=p.pop();E=0&&p>=o&&ig[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new Yh;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push($p.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function rg(u,o,h,p,_,b,x,E,P,A,N,O,G,H,X,re){const ce=Yh.fromFeature(u,_);let ge;O===c.ah.vertical&&ce.verticalizePunctuation();const{processBidirectionalText:Re,processStyledBidirectionalText:be}=Qa;if(Re&&ce.sections.length===1){ge=[];const Qe=Re(ce.toString(),Ry(ce,A,b,o,p,H,X));for(const wt of Qe){const Tt=new Yh;Tt.text=wt,Tt.sections=ce.sections;for(let xt=0;xt0&&Vl>Vo&&(Vo=Vl)}else{const Es=Tt[wn.fontStack],Go=Es&&Es[Ui];if(Go&&Go.rect)Sa=Go.rect,Zs=Go.metrics;else{const Vl=wt[wn.fontStack],id=Vl&&Vl[Ui];if(!id)continue;Zs=id.metrics}mi=(pi-wn.scale)*ci}Xs?(Qe.verticalizable=!0,oo.push({glyph:Ui,imageName:Ea,x:ar,y:dr+mi,vertical:Xs,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:so,metrics:Zs,rect:Sa}),ar+=Bl*wn.scale+Bt):(oo.push({glyph:Ui,imageName:Ea,x:ar,y:dr+mi,vertical:Xs,scale:wn.scale,fontStack:wn.fontStack,sectionIndex:so,metrics:Zs,rect:Sa}),ar+=Zs.advance*wn.scale+Bt)}oo.length!==0&&(hi=Math.max(ar-Bt,hi),bL(oo,0,oo.length-1,xo,Vo)),ar=0;const Uo=ct*pi+Vo;Eo.lineOffset=Math.max(Vo,io),dr+=Uo,is=Math.max(Uo,is),++si}var ki;const Vi=dr-Qp,{horizontalAlign:wo,verticalAlign:So}=Ny(It);(function(fi,pi,io,Eo,oo,Vo,Uo,di,wn){const so=(pi-io)*oo;let Ui=0;Ui=Vo!==Uo?-di*Eo-Qp:(-Eo*wn+.5)*Uo;for(const mi of fi)for(const Zs of mi.positionedGlyphs)Zs.x+=so,Zs.y+=Ui})(Qe.positionedLines,xo,wo,So,hi,is,ct,Vi,yt.length),Qe.top+=-So*Vi,Qe.bottom=Qe.top+Vi,Qe.left+=-wo*hi,Qe.right=Qe.left+hi}(Je,o,h,p,ge,x,E,P,O,A,G,re),!function(Qe){for(const wt of Qe)if(wt.positionedGlyphs.length!==0)return!1;return!0}(Te)&&Je}const ig={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},yL={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 vb(u,o,h,p,_,b){if(o.imageName){const x=p[o.imageName];return x?x.displaySize[0]*o.scale*ci/b+_:0}{const x=h[o.fontStack],E=x&&x[u];return E?E.metrics.advance*o.scale+_:0}}function bb(u,o,h,p){const _=Math.pow(u-o,2);return p?u=0;let N=0;for(let G=0;Gx.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=gy([]),this.placementViewportMatrix=gy([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Eb(this.zoom,h["text-size"]),this.iconSizeData=Eb(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),b=p.get("symbol-z-order");this.canOverlap=Oy(p,"text-overlap","text-allow-overlap")!=="never"||Oy(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(x=>c.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=o.sourceID}createArrays(){this.text=new Fy(new xr(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new Fy(new xr(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new v,this.lineVertexArray=new C,this.symbolInstances=new g,this.textAnchorOffsets=new M}calculateGlyphDependencies(o,h,p,_,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,O=b.get("symbol-sort-key");if(this.features=[],!A&&!N)return;const G=h.iconDependencies,H=h.glyphDependencies,X=h.availableImages,re=new fr(this.zoom);for(const{feature:ce,id:ge,index:Re,sourceLayerIndex:be}of o){const Te=_._featureFilter.needGeometry,Je=zl(ce,Te);if(!_._featureFilter.filter(re,Je,p))continue;let Qe,wt;if(Te||(Je.geometry=Ol(ce)),A){const xt=_.getValueAndResolveTokens("text-field",Je,p,X),yt=Ro.factory(xt),ct=this.hasRTLText=this.hasRTLText||EL(yt);(!ct||Qa.getRTLTextPluginStatus()==="unavailable"||ct&&Qa.isParsed())&&(Qe=oL(yt,_,Je))}if(N){const xt=_.getValueAndResolveTokens("icon-image",Je,p,X);wt=xt instanceof ts?xt:ts.fromString(xt)}if(!Qe&&!wt)continue;const Tt=this.sortFeaturesByKey?O.evaluate(Je,{},p):void 0;if(this.features.push({id:ge,text:Qe,icon:wt,index:Re,sourceLayerIndex:be,geometry:Je.geometry,properties:ce.properties,type:wL[ce.type],sortKey:Tt}),wt&&(G[wt.name]=!0),Qe){const xt=x.evaluate(Je,{},p).join(","),yt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ah.vertical)>=0;for(const ct of Qe.sections)if(ct.image)G[ct.image.name]=!0;else{const It=bu(Qe.toString()),mt=ct.fontStack||xt,st=H[mt]=H[mt]||{};this.calculateGlyphDependencies(ct.text,st,yt,this.allowVerticalPlacement,It)}}}b.get("symbol-placement")==="line"&&(this.features=function(ce){const ge={},Re={},be=[];let Te=0;function Je(xt){be.push(ce[xt]),Te++}function Qe(xt,yt,ct){const It=Re[xt];return delete Re[xt],Re[yt]=It,be[It].geometry[0].pop(),be[It].geometry[0]=be[It].geometry[0].concat(ct[0]),It}function wt(xt,yt,ct){const It=ge[yt];return delete ge[yt],ge[xt]=It,be[It].geometry[0].shift(),be[It].geometry[0]=ct[0].concat(be[It].geometry[0]),It}function Tt(xt,yt,ct){const It=ct?yt[0][yt[0].length-1]:yt[0][0];return`${xt}:${It.x}:${It.y}`}for(let xt=0;xtxt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ce,ge)=>ce.sortKey-ge.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(o,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let _=o.dist(h[o.segment+1]),b=o.dist(h[o.segment]);const x={};for(let E=o.segment+1;E=0;E--)x[E]={x:h[E].x,y:h[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=h[E-1].dist(h[E]));for(let E=0;E0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(o,h){const p=o.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let b=p.vertexStartIndex;b<_;b+=4)o.indexArray.emplaceBack(b,b+1,b+2),o.indexArray.emplaceBack(b+1,b+2,b+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),_=[],b=[],x=[];for(let E=0;E_[E]-_[P]||b[P]-b[E]),x}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,b,x)=>{_>=0&&x.indexOf(_)===b&&this.addIndicesForPlacedSymbol(this.text,_)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ib,Cb;Et("SymbolBucket",Kh,{omit:["layers","collisionBoxArray","features","compareText"]}),Kh.MAX_GLYPHS=65535,Kh.addDynamicAttributes=zy;var Vy={get paint(){return Cb=Cb||new vo({"icon-opacity":new Vt(ze.paint_symbol["icon-opacity"]),"icon-color":new Vt(ze.paint_symbol["icon-color"]),"icon-halo-color":new Vt(ze.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vt(ze.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vt(ze.paint_symbol["icon-halo-blur"]),"icon-translate":new Dt(ze.paint_symbol["icon-translate"]),"icon-translate-anchor":new Dt(ze.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vt(ze.paint_symbol["text-opacity"]),"text-color":new Vt(ze.paint_symbol["text-color"],{runtimeType:Rr,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Vt(ze.paint_symbol["text-halo-color"]),"text-halo-width":new Vt(ze.paint_symbol["text-halo-width"]),"text-halo-blur":new Vt(ze.paint_symbol["text-halo-blur"]),"text-translate":new Dt(ze.paint_symbol["text-translate"]),"text-translate-anchor":new Dt(ze.paint_symbol["text-translate-anchor"])})},get layout(){return Ib=Ib||new vo({"symbol-placement":new Dt(ze.layout_symbol["symbol-placement"]),"symbol-spacing":new Dt(ze.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Dt(ze.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vt(ze.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Dt(ze.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Dt(ze.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Dt(ze.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Dt(ze.layout_symbol["icon-ignore-placement"]),"icon-optional":new Dt(ze.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Dt(ze.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vt(ze.layout_symbol["icon-size"]),"icon-text-fit":new Dt(ze.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Dt(ze.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vt(ze.layout_symbol["icon-image"]),"icon-rotate":new Vt(ze.layout_symbol["icon-rotate"]),"icon-padding":new Vt(ze.layout_symbol["icon-padding"]),"icon-keep-upright":new Dt(ze.layout_symbol["icon-keep-upright"]),"icon-offset":new Vt(ze.layout_symbol["icon-offset"]),"icon-anchor":new Vt(ze.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Dt(ze.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Dt(ze.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Dt(ze.layout_symbol["text-rotation-alignment"]),"text-field":new Vt(ze.layout_symbol["text-field"]),"text-font":new Vt(ze.layout_symbol["text-font"]),"text-size":new Vt(ze.layout_symbol["text-size"]),"text-max-width":new Vt(ze.layout_symbol["text-max-width"]),"text-line-height":new Dt(ze.layout_symbol["text-line-height"]),"text-letter-spacing":new Vt(ze.layout_symbol["text-letter-spacing"]),"text-justify":new Vt(ze.layout_symbol["text-justify"]),"text-radial-offset":new Vt(ze.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Dt(ze.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Vt(ze.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Vt(ze.layout_symbol["text-anchor"]),"text-max-angle":new Dt(ze.layout_symbol["text-max-angle"]),"text-writing-mode":new Dt(ze.layout_symbol["text-writing-mode"]),"text-rotate":new Vt(ze.layout_symbol["text-rotate"]),"text-padding":new Dt(ze.layout_symbol["text-padding"]),"text-keep-upright":new Dt(ze.layout_symbol["text-keep-upright"]),"text-transform":new Vt(ze.layout_symbol["text-transform"]),"text-offset":new Vt(ze.layout_symbol["text-offset"]),"text-allow-overlap":new Dt(ze.layout_symbol["text-allow-overlap"]),"text-overlap":new Dt(ze.layout_symbol["text-overlap"]),"text-ignore-placement":new Dt(ze.layout_symbol["text-ignore-placement"]),"text-optional":new Dt(ze.layout_symbol["text-optional"])})}};class Tb{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:ei,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Et("FormatSectionOverride",Tb,{omit:["defaultValue"]});class sg extends xs{constructor(o){super(o,Vy)}recalculate(o,h){if(super.recalculate(o,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const p=this.layout.get("text-writing-mode");if(p){const _=[];for(const b of p)_.indexOf(b)<0&&_.push(b);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,_){const b=this.layout.get(o).evaluate(h,{},p,_),x=this._unevaluatedLayout._values[o];return x.isDataDriven()||er(x.value)||!b?b:function(E,P){return P.replace(/{([^{}]+)}/g,(A,N)=>E&&N in E?String(E[N]):"")}(h.properties,b)}createBucket(o){return new Kh(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of Vy.paint.overridableProperties){if(!sg.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new Tb(h),_=new sr(p,h.property.specification);let b=null;b=h.value.kind==="constant"||h.value.kind==="source"?new vh("source",_):new _p("composite",_,h.value.zoomStops),this.paint._values[o]=new bs(h.property,b,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&sg.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),_=Vy.paint.properties[h];let b=!1;const x=E=>{for(const P of E)if(_.overrides&&_.overrides.hasOverride(P))return void(b=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Ro)x(p.value.value.sections);else if(p.value.kind==="source"){const E=A=>{b||(A instanceof Za&&ni(A.value)===Vr?x(A.value.sections):A instanceof _h?x(A.sections):A.eachChild(E))},P=p.value;P._styleExpression&&E(P._styleExpression.expression)}return b}}let Lb;var IL={get paint(){return Lb=Lb||new vo({"background-color":new Dt(ze.paint_background["background-color"]),"background-pattern":new gc(ze.paint_background["background-pattern"]),"background-opacity":new Dt(ze.paint_background["background-opacity"])})}};class CL extends xs{constructor(o){super(o,IL)}}let Pb;var TL={get paint(){return Pb=Pb||new vo({"raster-opacity":new Dt(ze.paint_raster["raster-opacity"]),"raster-hue-rotate":new Dt(ze.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Dt(ze.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Dt(ze.paint_raster["raster-brightness-max"]),"raster-saturation":new Dt(ze.paint_raster["raster-saturation"]),"raster-contrast":new Dt(ze.paint_raster["raster-contrast"]),"raster-resampling":new Dt(ze.paint_raster["raster-resampling"]),"raster-fade-duration":new Dt(ze.paint_raster["raster-fade-duration"])})}};class LL extends xs{constructor(o){super(o,TL)}}class PL extends xs{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=o}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class ML{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Uy=63710088e-1;class Iu{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Iu(me(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,_=o.lat*h,b=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((o.lng-this.lng)*h);return Uy*Math.acos(Math.min(b,1))}static convert(o){if(o instanceof Iu)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new Iu(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new Iu(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const Mb=2*Math.PI*Uy;function Ab(u){return Mb*Math.cos(u*Math.PI/180)}function kb(u){return(180+u)/360}function Db(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function Rb(u,o){return u/Ab(o)}function Gy(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}class ag{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=Iu.convert(o);return new ag(kb(p.lng),Db(p.lat),Rb(h,p.lat))}toLngLat(){return new Iu(360*this.x-180,Gy(this.y))}toAltitude(){return this.z*Ab(Gy(this.y))}meterInMercatorCoordinateUnits(){return 1/Mb*(o=Gy(this.y),1/Math.cos(o*Math.PI/180));var o}}function Nb(u,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[u*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class jy{constructor(o,h,p){if(o<0||o>25||p<0||p>=Math.pow(2,o)||h<0||h>=Math.pow(2,o))throw new Error(`x=${h}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=h,this.y=p,this.key=td(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const _=(x=this.y,E=this.z,P=Nb(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),A=Nb(256*(b+1),256*(x+1),E),P[0]+","+P[1]+","+A[0]+","+A[1]);var b,x,E,P,A;const N=function(O,G,H){let X,re="";for(let ce=O;ce>0;ce--)X=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,_)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new I((o.x*h-this.x)*Nr,(o.y*h-this.y)*Nr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ob{constructor(o,h){this.wrap=o,this.canonical=h,this.key=td(o,h.z,h.z,h.x,h.y)}}class Ss{constructor(o,h,p,_,b){if(o= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new jy(p,+_,+b),this.key=td(h,o,p,_,b)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-o;return o>this.canonical.z?new Ss(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?td(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):td(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new Ss(h,this.wrap,h,p,_),new Ss(h,this.wrap,h,p+1,_),new Ss(h,this.wrap,h,p,_+1),new Ss(h,this.wrap,h,p+1,_+1)]}isLessThan(o){return this.wrapo.wrap)&&(this.overscaledZo.overscaledZ)&&(this.canonical.xo.canonical.x)&&this.canonical.ythis.max&&(this.max=O),O=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new ws({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,b=h*this.dim+this.dim,x=p*this.dim,E=p*this.dim+this.dim;switch(h){case-1:_=b-1;break;case 1:b=_+1}switch(p){case-1:x=E-1;break;case 1:E=x+1}const P=-h*this.dim,A=-p*this.dim;for(let N=x;N=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class Bb{constructor(o,h,p,_,b){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=_,this.properties=o.properties,this.id=b}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class Vb{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new pc(Nr,16,0),this.grid3D=new pc(Nr,16,0),this.featureIndexArray=new z,this.promoteId=h}insert(o,h,p,_,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,b);const P=x?this.grid3D:this.grid;for(let A=0;A=0&&O[3]>=0&&P.insert(E,O[0],O[1],O[2],O[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new wu.VectorTile(new Ay(this.rawTileData)).layers,this.sourceLayerCoder=new Fb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,_){this.loadVTLayers();const b=o.params||{},x=Nr/o.tileSize/o.scale,E=Sh(b.filter),P=o.queryGeometry,A=o.queryPadding*x,N=Gb(P),O=this.grid.query(N.minX-A,N.minY-A,N.maxX+A,N.maxY+A),G=Gb(o.cameraQueryGeometry),H=this.grid3D.query(G.minX-A,G.minY-A,G.maxX+A,G.maxY+A,(ce,ge,Re,be)=>function(Te,Je,Qe,wt,Tt){for(const yt of Te)if(Je<=yt.x&&Qe<=yt.y&&wt>=yt.x&&Tt>=yt.y)return!0;const xt=[new I(Je,Qe),new I(Je,Tt),new I(wt,Tt),new I(wt,Qe)];if(Te.length>2){for(const yt of xt)if(jh(Te,yt))return!0}for(let yt=0;yt(be||(be=Ol(Te)),Je.queryIntersectsFeature(P,Te,Qe,be,this.z,o.transform,x,o.pixelPosMatrix)))}return X}loadMatchingFeature(o,h,p,_,b,x,E,P,A,N,O){const G=this.bucketLayerIDs[h];if(x&&!function(ce,ge){for(let Re=0;Re=0)return!0;return!1}(x,G))return;const H=this.sourceLayerCoder.decode(p),X=this.vtLayers[H].feature(_);if(b.needGeometry){const ce=zl(X,!0);if(!b.filter(new fr(this.tileID.overscaledZ),ce,this.tileID.canonical))return}else if(!b.filter(new fr(this.tileID.overscaledZ),X))return;const re=this.getId(X,H);for(let ce=0;ce{const E=o instanceof mc?o.get(x):null;return E&&E.evaluate?E.evaluate(h,p,_):E})}function Gb(u){let o=1/0,h=1/0,p=-1/0,_=-1/0;for(const b of u)o=Math.min(o,b.x),h=Math.min(h,b.y),p=Math.max(p,b.x),_=Math.max(_,b.y);return{minX:o,minY:h,maxX:p,maxY:_}}function AL(u,o){return o-u}function jb(u,o,h,p,_){const b=[];for(let x=0;x=p&&O.x>=p||(N.x>=p?N=new I(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round():O.x>=p&&(O=new I(p,N.y+(p-N.x)/(O.x-N.x)*(O.y-N.y))._round()),N.y>=_&&O.y>=_||(N.y>=_?N=new I(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round():O.y>=_&&(O=new I(N.x+(_-N.y)/(O.y-N.y)*(O.x-N.x),_)._round()),P&&N.equals(P[P.length-1])||(P=[N],b.push(P)),P.push(O)))))}}return b}Et("FeatureIndex",Vb,{omit:["rawTileData","sourceLayerCoder"]});class Cu extends I{constructor(o,h,p,_){super(o,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new Cu(this.x,this.y,this.angle,this.segment)}}function qb(u,o,h,p,_){if(o.segment===void 0||h===0)return!0;let b=o,x=o.segment+1,E=0;for(;E>-h/2;){if(x--,x<0)return!1;E-=u[x].dist(b),b=u[x]}E+=u[x].dist(u[x+1]),x++;const P=[];let A=0;for(;Ep;)A-=P.shift().angleDelta;if(A>_)return!1;x++,E+=N.dist(O)}return!0}function Wb(u){let o=0;for(let h=0;hA){const X=(A-P)/H,re=no.number(O.x,G.x,X),ce=no.number(O.y,G.y,X),ge=new Cu(re,ce,G.angleTo(O),N);return ge._round(),!x||qb(u,ge,E,x,o)?ge:void 0}P+=H}}function DL(u,o,h,p,_,b,x,E,P){const A=Hb(p,b,x),N=Zb(p,_),O=N*x,G=u[0].x===0||u[0].x===P||u[0].y===0||u[0].y===P;return o-O=0&&Te=0&&Je=0&&G+A<=N){const Qe=new Cu(Te,Je,Re,X);Qe._round(),p&&!qb(u,Qe,b,p,_)||H.push(Qe)}}O+=ge}return E||H.length||x||(H=Xb(u,O/2,h,p,_,b,x,!0,P)),H}Et("Anchor",Cu);const Jh=Bo;function Yb(u,o,h,p){const _=[],b=u.image,x=b.pixelRatio,E=b.paddedRect.w-2*Jh,P=b.paddedRect.h-2*Jh,A=u.right-u.left,N=u.bottom-u.top,O=b.stretchX||[[0,E]],G=b.stretchY||[[0,P]],H=(ct,It)=>ct+It[1]-It[0],X=O.reduce(H,0),re=G.reduce(H,0),ce=E-X,ge=P-re;let Re=0,be=X,Te=0,Je=re,Qe=0,wt=ce,Tt=0,xt=ge;if(b.content&&p){const ct=b.content;Re=lg(O,0,ct[0]),Te=lg(G,0,ct[1]),be=lg(O,ct[0],ct[2]),Je=lg(G,ct[1],ct[3]),Qe=ct[0]-Re,Tt=ct[1]-Te,wt=ct[2]-ct[0]-be,xt=ct[3]-ct[1]-Je}const yt=(ct,It,mt,st)=>{const Bt=ug(ct.stretch-Re,be,A,u.left),At=cg(ct.fixed-Qe,wt,ct.stretch,X),gn=ug(It.stretch-Te,Je,N,u.top),ar=cg(It.fixed-Tt,xt,It.stretch,re),dr=ug(mt.stretch-Re,be,A,u.left),hi=cg(mt.fixed-Qe,wt,mt.stretch,X),is=ug(st.stretch-Te,Je,N,u.top),xo=cg(st.fixed-Tt,xt,st.stretch,re),si=new I(Bt,gn),ki=new I(dr,gn),Vi=new I(dr,is),wo=new I(Bt,is),So=new I(At/x,ar/x),fi=new I(hi/x,xo/x),pi=o*Math.PI/180;if(pi){const oo=Math.sin(pi),Vo=Math.cos(pi),Uo=[Vo,-oo,oo,Vo];si._matMult(Uo),ki._matMult(Uo),wo._matMult(Uo),Vi._matMult(Uo)}const io=ct.stretch+ct.fixed,Eo=It.stretch+It.fixed;return{tl:si,tr:ki,bl:wo,br:Vi,tex:{x:b.paddedRect.x+Jh+io,y:b.paddedRect.y+Jh+Eo,w:mt.stretch+mt.fixed-io,h:st.stretch+st.fixed-Eo},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:So,pixelOffsetBR:fi,minFontScaleX:wt/x/A,minFontScaleY:xt/x/N,isSDF:h}};if(p&&(b.stretchX||b.stretchY)){const ct=Kb(O,ce,X),It=Kb(G,ge,re);for(let mt=0;mt0&&(X=Math.max(10,X),this.circleDiameter=X)}else{let O=x.top*E-P[0],G=x.bottom*E+P[2],H=x.left*E-P[3],X=x.right*E+P[1];const re=x.collisionPadding;if(re&&(H-=re[0]*E,O-=re[1]*E,X+=re[2]*E,G+=re[3]*E),N){const ce=new I(H,O),ge=new I(X,O),Re=new I(H,G),be=new I(X,G),Te=N*Math.PI/180;ce._rotate(Te),ge._rotate(Te),Re._rotate(Te),be._rotate(Te),H=Math.min(ce.x,ge.x,Re.x,be.x),X=Math.max(ce.x,ge.x,Re.x,be.x),O=Math.min(ce.y,ge.y,Re.y,be.y),G=Math.max(ce.y,ge.y,Re.y,be.y)}o.emplaceBack(h.x,h.y,H,O,X,G,p,_,b)}this.boxEndIndex=o.length}}class RL{constructor(o=[],h=NL){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return this.length--,this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,_=h[o];for(;o>0;){const b=o-1>>1,x=h[b];if(p(_,x)>=0)break;h[o]=x,o=b}h[o]=_}_down(o){const{data:h,compare:p}=this,_=this.length>>1,b=h[o];for(;o<_;){let x=1+(o<<1),E=h[x];const P=x+1;if(P=0)break;h[o]=E,o=x}h[o]=b}}function NL(u,o){return uo?1:0}function OL(u,o=1,h=!1){let p=1/0,_=1/0,b=-1/0,x=-1/0;const E=u[0];for(let H=0;Hb)&&(b=X.x),(!H||X.y>x)&&(x=X.y)}const P=Math.min(b-p,x-_);let A=P/2;const N=new RL([],zL);if(P===0)return new I(p,_);for(let H=p;HO.d||!O.d)&&(O=H,h&&console.log("found best %d after %d probes",Math.round(1e4*H.d)/1e4,G)),H.max-O.d<=o||(A=H.h/2,N.push(new Qh(H.p.x-A,H.p.y-A,A,u)),N.push(new Qh(H.p.x+A,H.p.y-A,A,u)),N.push(new Qh(H.p.x-A,H.p.y+A,A,u)),N.push(new Qh(H.p.x+A,H.p.y+A,A,u)),G+=4)}return h&&(console.log(`num probes: ${G}`),console.log(`best distance: ${O.d}`)),O.p}function zL(u,o){return o.max-u.max}function Qh(u,o,h,p){this.p=new I(u,o),this.h=h,this.d=function(_,b){let x=!1,E=1/0;for(let P=0;P_.y!=X.y>_.y&&_.x<(X.x-H.x)*(_.y-H.y)/(X.y-H.y)+H.x&&(x=!x),E=Math.min(E,D1(_,H,X))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Bi;c.ap=void 0,(Bi=c.ap||(c.ap={}))[Bi.center=1]="center",Bi[Bi.left=2]="left",Bi[Bi.right=3]="right",Bi[Bi.top=4]="top",Bi[Bi.bottom=5]="bottom",Bi[Bi["top-left"]=6]="top-left",Bi[Bi["top-right"]=7]="top-right",Bi[Bi["bottom-left"]=8]="bottom-left",Bi[Bi["bottom-right"]=9]="bottom-right";const Tu=7,qy=Number.POSITIVE_INFINITY;function Jb(u,o){return o[1]!==qy?function(h,p,_){let b=0,x=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":x=_-Tu;break;case"bottom-right":case"bottom-left":case"bottom":x=-_+Tu}switch(h){case"top-right":case"bottom-right":case"right":b=-p;break;case"top-left":case"bottom-left":case"left":b=p}return[b,x]}(u,o[0],o[1]):function(h,p){let _=0,b=0;p<0&&(p=0);const x=p/Math.SQRT2;switch(h){case"top-right":case"top-left":b=x-Tu;break;case"bottom-right":case"bottom-left":b=-x+Tu;break;case"bottom":b=-p+Tu;break;case"top":b=p-Tu}switch(h){case"top-right":case"bottom-right":_=-x;break;case"top-left":case"bottom-left":_=x;break;case"left":_=p;break;case"right":_=-p}return[_,b]}(u,o[0])}function Qb(u,o,h){var p;const _=u.layout,b=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(b){const E=b.values,P=[];for(let A=0;AG*ci);N.startsWith("top")?O[1]-=Tu:N.startsWith("bottom")&&(O[1]+=Tu),P[A+1]=O}return new es(P)}const x=_.get("text-variable-anchor");if(x){let E;E=u._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(o,{},h)*ci,qy]:_.get("text-offset").evaluate(o,{},h).map(A=>A*ci);const P=[];for(const A of x)P.push(A,Jb(A,E));return new es(P)}return null}function Wy(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function FL(u,o,h,p,_,b,x,E,P,A,N){let O=b.textMaxSize.evaluate(o,{});O===void 0&&(O=x);const G=u.layers[0].layout,H=G.get("icon-offset").evaluate(o,{},N),X=ex(h.horizontal),re=x/24,ce=u.tilePixelRatio*re,ge=u.tilePixelRatio*O/24,Re=u.tilePixelRatio*E,be=u.tilePixelRatio*G.get("symbol-spacing"),Te=G.get("text-padding")*u.tilePixelRatio,Je=function(st,Bt,At,gn=1){const ar=st.get("icon-padding").evaluate(Bt,{},At),dr=ar&&ar.values;return[dr[0]*gn,dr[1]*gn,dr[2]*gn,dr[3]*gn]}(G,o,N,u.tilePixelRatio),Qe=G.get("text-max-angle")/180*Math.PI,wt=G.get("text-rotation-alignment")!=="viewport"&&G.get("symbol-placement")!=="point",Tt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",xt=G.get("symbol-placement"),yt=be/2,ct=G.get("icon-text-fit");let It;p&&ct!=="none"&&(u.allowVerticalPlacement&&h.vertical&&(It=Sb(p,h.vertical,ct,G.get("icon-text-fit-padding"),H,re)),X&&(p=Sb(p,X,ct,G.get("icon-text-fit-padding"),H,re)));const mt=(st,Bt)=>{Bt.x<0||Bt.x>=Nr||Bt.y<0||Bt.y>=Nr||function(At,gn,ar,dr,hi,is,xo,si,ki,Vi,wo,So,fi,pi,io,Eo,oo,Vo,Uo,di,wn,so,Ui,mi,Zs){const Sa=At.addToLineVertexArray(gn,ar);let Ea,Bl,Xs,Es,Go=0,Vl=0,id=0,ix=0,$y=-1,e0=-1;const Ul={};let ox=Lr("");if(At.allowVerticalPlacement&&dr.vertical){const ao=si.layout.get("text-rotate").evaluate(wn,{},mi)+90;Xs=new hg(ki,gn,Vi,wo,So,dr.vertical,fi,pi,io,ao),xo&&(Es=new hg(ki,gn,Vi,wo,So,xo,oo,Vo,io,ao))}if(hi){const ao=si.layout.get("icon-rotate").evaluate(wn,{}),Is=si.layout.get("icon-text-fit")!=="none",Ec=Yb(hi,ao,Ui,Is),Ca=xo?Yb(xo,ao,Ui,Is):void 0;Bl=new hg(ki,gn,Vi,wo,So,hi,oo,Vo,!1,ao),Go=4*Ec.length;const Ic=At.iconSizeData;let rl=null;Ic.kind==="source"?(rl=[nl*si.layout.get("icon-size").evaluate(wn,{})],rl[0]>Eu&&Ye(`${At.layerIds[0]}: Value for "icon-size" is >= ${ed}. Reduce your "icon-size".`)):Ic.kind==="composite"&&(rl=[nl*so.compositeIconSizes[0].evaluate(wn,{},mi),nl*so.compositeIconSizes[1].evaluate(wn,{},mi)],(rl[0]>Eu||rl[1]>Eu)&&Ye(`${At.layerIds[0]}: Value for "icon-size" is >= ${ed}. Reduce your "icon-size".`)),At.addSymbols(At.icon,Ec,rl,di,Uo,wn,c.ah.none,gn,Sa.lineStartIndex,Sa.lineLength,-1,mi),$y=At.icon.placedSymbolArray.length-1,Ca&&(Vl=4*Ca.length,At.addSymbols(At.icon,Ca,rl,di,Uo,wn,c.ah.vertical,gn,Sa.lineStartIndex,Sa.lineLength,-1,mi),e0=At.icon.placedSymbolArray.length-1)}const sx=Object.keys(dr.horizontal);for(const ao of sx){const Is=dr.horizontal[ao];if(!Ea){ox=Lr(Is.text);const Ca=si.layout.get("text-rotate").evaluate(wn,{},mi);Ea=new hg(ki,gn,Vi,wo,So,Is,fi,pi,io,Ca)}const Ec=Is.positionedLines.length===1;if(id+=$b(At,gn,Is,is,si,io,wn,Eo,Sa,dr.vertical?c.ah.horizontal:c.ah.horizontalOnly,Ec?sx:[ao],Ul,$y,so,mi),Ec)break}dr.vertical&&(ix+=$b(At,gn,dr.vertical,is,si,io,wn,Eo,Sa,c.ah.vertical,["vertical"],Ul,e0,so,mi));const UL=Ea?Ea.boxStartIndex:At.collisionBoxArray.length,GL=Ea?Ea.boxEndIndex:At.collisionBoxArray.length,jL=Xs?Xs.boxStartIndex:At.collisionBoxArray.length,qL=Xs?Xs.boxEndIndex:At.collisionBoxArray.length,WL=Bl?Bl.boxStartIndex:At.collisionBoxArray.length,HL=Bl?Bl.boxEndIndex:At.collisionBoxArray.length,ZL=Es?Es.boxStartIndex:At.collisionBoxArray.length,XL=Es?Es.boxEndIndex:At.collisionBoxArray.length;let Ia=-1;const pg=(ao,Is)=>ao&&ao.circleDiameter?Math.max(ao.circleDiameter,Is):Is;Ia=pg(Ea,Ia),Ia=pg(Xs,Ia),Ia=pg(Bl,Ia),Ia=pg(Es,Ia);const ax=Ia>-1?1:0;ax&&(Ia*=Zs/ci),At.glyphOffsetArray.length>=Kh.MAX_GLYPHS&&Ye("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),wn.sortKey!==void 0&&At.addToSortKeyRanges(At.symbolInstances.length,wn.sortKey);const YL=Qb(si,wn,mi),[KL,JL]=function(ao,Is){const Ec=ao.length,Ca=Is==null?void 0:Is.values;if((Ca==null?void 0:Ca.length)>0)for(let Ic=0;Ic=0?Ul.right:-1,Ul.center>=0?Ul.center:-1,Ul.left>=0?Ul.left:-1,Ul.vertical||-1,$y,e0,ox,UL,GL,jL,qL,WL,HL,ZL,XL,Vi,id,ix,Go,Vl,ax,0,fi,Ia,KL,JL)}(u,Bt,st,h,p,_,It,u.layers[0],u.collisionBoxArray,o.index,o.sourceLayerIndex,u.index,ce,[Te,Te,Te,Te],wt,P,Re,Je,Tt,H,o,b,A,N,x)};if(xt==="line")for(const st of jb(o.geometry,0,0,Nr,Nr)){const Bt=DL(st,be,Qe,h.vertical||X,p,24,ge,u.overscaling,Nr);for(const At of Bt)X&&BL(u,X.text,yt,At)||mt(st,At)}else if(xt==="line-center"){for(const st of o.geometry)if(st.length>1){const Bt=kL(st,Qe,h.vertical||X,p,24,ge);Bt&&mt(st,Bt)}}else if(o.type==="Polygon")for(const st of Sy(o.geometry,0)){const Bt=OL(st,16);mt(st[0],new Cu(Bt.x,Bt.y,0))}else if(o.type==="LineString")for(const st of o.geometry)mt(st,new Cu(st[0].x,st[0].y,0));else if(o.type==="Point")for(const st of o.geometry)for(const Bt of st)mt([Bt],new Cu(Bt.x,Bt.y,0))}function $b(u,o,h,p,_,b,x,E,P,A,N,O,G,H,X){const re=function(Re,be,Te,Je,Qe,wt,Tt,xt){const yt=Je.layout.get("text-rotate").evaluate(wt,{})*Math.PI/180,ct=[];for(const It of be.positionedLines)for(const mt of It.positionedGlyphs){if(!mt.rect)continue;const st=mt.rect||{};let Bt=gb+1,At=!0,gn=1,ar=0;const dr=(Qe||xt)&&mt.vertical,hi=mt.metrics.advance*mt.scale/2;if(xt&&be.verticalizable&&(ar=It.lineOffset/2-(mt.imageName?-(ci-mt.metrics.width*mt.scale)/2:(mt.scale-1)*ci)),mt.imageName){const di=Tt[mt.imageName];At=di.sdf,gn=di.pixelRatio,Bt=Bo/gn}const is=Qe?[mt.x+hi,mt.y]:[0,0];let xo=Qe?[0,0]:[mt.x+hi+Te[0],mt.y+Te[1]-ar],si=[0,0];dr&&(si=xo,xo=[0,0]);const ki=mt.metrics.isDoubleResolution?2:1,Vi=(mt.metrics.left-Bt)*mt.scale-hi+xo[0],wo=(-mt.metrics.top-Bt)*mt.scale+xo[1],So=Vi+st.w/ki*mt.scale/gn,fi=wo+st.h/ki*mt.scale/gn,pi=new I(Vi,wo),io=new I(So,wo),Eo=new I(Vi,fi),oo=new I(So,fi);if(dr){const di=new I(-hi,hi-Qp),wn=-Math.PI/2,so=ci/2-hi,Ui=new I(5-Qp-so,-(mt.imageName?so:0)),mi=new I(...si);pi._rotateAround(wn,di)._add(Ui)._add(mi),io._rotateAround(wn,di)._add(Ui)._add(mi),Eo._rotateAround(wn,di)._add(Ui)._add(mi),oo._rotateAround(wn,di)._add(Ui)._add(mi)}if(yt){const di=Math.sin(yt),wn=Math.cos(yt),so=[wn,-di,di,wn];pi._matMult(so),io._matMult(so),Eo._matMult(so),oo._matMult(so)}const Vo=new I(0,0),Uo=new I(0,0);ct.push({tl:pi,tr:io,bl:Eo,br:oo,tex:st,writingMode:be.writingMode,glyphOffset:is,sectionIndex:mt.sectionIndex,isSDF:At,pixelOffsetTL:Vo,pixelOffsetBR:Uo,minFontScaleX:0,minFontScaleY:0})}return ct}(0,h,E,_,b,x,p,u.allowVerticalPlacement),ce=u.textSizeData;let ge=null;ce.kind==="source"?(ge=[nl*_.layout.get("text-size").evaluate(x,{})],ge[0]>Eu&&Ye(`${u.layerIds[0]}: Value for "text-size" is >= ${ed}. Reduce your "text-size".`)):ce.kind==="composite"&&(ge=[nl*H.compositeTextSizes[0].evaluate(x,{},X),nl*H.compositeTextSizes[1].evaluate(x,{},X)],(ge[0]>Eu||ge[1]>Eu)&&Ye(`${u.layerIds[0]}: Value for "text-size" is >= ${ed}. Reduce your "text-size".`)),u.addSymbols(u.text,re,ge,E,b,x,A,o,P.lineStartIndex,P.lineLength,G,X);for(const Re of N)O[Re]=u.text.placedSymbolArray.length-1;return 4*re.length}function ex(u){for(const o in u)return u[o];return null}function BL(u,o,h,p){const _=u.compareText;if(o in _){const b=_[o];for(let x=b.length-1;x>=0;x--)if(p.dist(b[x])>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const b=tx[15&p];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(o,2,1),[E]=new Uint32Array(o,4,1);return new Hy(E,x,b,o)}constructor(o,h=64,p=Float64Array,_){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const b=tx.indexOf(this.ArrayType),x=2*o*this.ArrayType.BYTES_PER_ELEMENT,E=o*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+P,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+P),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+E+P,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return Zy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,P=[0,b.length-1,0],A=[];for(;P.length;){const N=P.pop()||0,O=P.pop()||0,G=P.pop()||0;if(O-G<=E){for(let ce=G;ce<=O;ce++){const ge=x[2*ce],Re=x[2*ce+1];ge>=o&&ge<=p&&Re>=h&&Re<=_&&A.push(b[ce])}continue}const H=G+O>>1,X=x[2*H],re=x[2*H+1];X>=o&&X<=p&&re>=h&&re<=_&&A.push(b[H]),(N===0?o<=X:h<=re)&&(P.push(G),P.push(H-1),P.push(1-N)),(N===0?p>=X:_>=re)&&(P.push(H+1),P.push(O),P.push(1-N))}return A}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:b,nodeSize:x}=this,E=[0,_.length-1,0],P=[],A=p*p;for(;E.length;){const N=E.pop()||0,O=E.pop()||0,G=E.pop()||0;if(O-G<=x){for(let ce=G;ce<=O;ce++)rx(b[2*ce],b[2*ce+1],o,h)<=A&&P.push(_[ce]);continue}const H=G+O>>1,X=b[2*H],re=b[2*H+1];rx(X,re,o,h)<=A&&P.push(_[H]),(N===0?o-p<=X:h-p<=re)&&(E.push(G),E.push(H-1),E.push(1-N)),(N===0?o+p>=X:h+p>=re)&&(E.push(H+1),E.push(O),E.push(1-N))}return P}}function Zy(u,o,h,p,_,b){if(_-p<=h)return;const x=p+_>>1;nx(u,o,x,p,_,b),Zy(u,o,h,p,x-1,1-b),Zy(u,o,h,x+1,_,1-b)}function nx(u,o,h,p,_,b){for(;_>p;){if(_-p>600){const A=_-p+1,N=h-p+1,O=Math.log(A),G=.5*Math.exp(2*O/3),H=.5*Math.sqrt(O*G*(A-G)/A)*(N-A/2<0?-1:1);nx(u,o,h,Math.max(p,Math.floor(h-N*G/A+H)),Math.min(_,Math.floor(h+(A-N)*G/A+H)),b)}const x=o[2*h+b];let E=p,P=_;for(nd(u,o,p,h),o[2*_+b]>x&&nd(u,o,p,_);Ex;)P--}o[2*p+b]===x?nd(u,o,p,P):(P++,nd(u,o,P,_)),P<=h&&(p=P+1),h<=P&&(_=P-1)}}function nd(u,o,h,p){Xy(u,h,p),Xy(o,2*h,2*p),Xy(o,2*h+1,2*p+1)}function Xy(u,o,h){const p=u[o];u[o]=u[h],u[h]=p}function rx(u,o,h,p){const _=u-h,b=o-p;return _*_+b*b}var Yy;c.bd=void 0,(Yy=c.bd||(c.bd={})).create="create",Yy.load="load",Yy.fullLoad="fullLoad";let fg=null,rd=[];const Ky=1e3/60,Jy="loadTime",Qy="fullLoadTime",VL={mark(u){performance.mark(u)},frame(u){const o=u;fg!=null&&rd.push(o-fg),fg=o},clearMetrics(){fg=null,rd=[],performance.clearMeasures(Jy),performance.clearMeasures(Qy);for(const u in c.bd)performance.clearMarks(c.bd[u])},getPerformanceMetrics(){performance.measure(Jy,c.bd.create,c.bd.load),performance.measure(Qy,c.bd.create,c.bd.fullLoad);const u=performance.getEntriesByName(Jy)[0].duration,o=performance.getEntriesByName(Qy)[0].duration,h=rd.length,p=1/(rd.reduce((b,x)=>b+x,0)/h/1e3),_=rd.filter(b=>b>Ky).reduce((b,x)=>b+(x-Ky)/Ky,0);return{loadTime:u,fullLoadTime:o,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};c.$=pt,c.A=qh,c.B=function(u){if(Ge==null){const o=u.navigator?u.navigator.userAgent:null;Ge=!!u.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Ge},c.C=class{constructor(u,o){this.target=u,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new ML(()=>this.process()),this.subscription=function(h,p,_,b){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=He(self)?u:window}registerMessageHandler(u,o){this.messageHandlers[u]=o}sendAsync(u,o){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const E={id:_,type:"",origin:location.origin,targetMapId:u.targetMapId,sourceMapId:this.mapId};this.target.postMessage(E)},{once:!0});const b=[],x=Object.assign(Object.assign({},u),{id:_,sourceMapId:this.mapId,origin:location.origin,data:yu(u.data,b)});this.target.postMessage(x,{transfer:b})})}receive(u){const o=u.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type===""){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(He(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const u=this.taskQueue.shift(),o=this.tasks[u];delete this.tasks[u],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(u,o)}processTask(u,o){return l(this,void 0,void 0,function*(){if(o.type===""){const _=this.resolveRejects[u];return delete this.resolveRejects[u],_?void(o.error?_.reject(vu(o.error)):_.resolve(vu(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(u,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=vu(o.data),p=new AbortController;this.abortControllers[u]=p;try{const _=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(u,null,_)}catch(_){this.completeTask(u,_)}})}completeTask(u,o,h){const p=[];delete this.abortControllers[u];const _={id:u,type:"",sourceMapId:this.mapId,origin:location.origin,error:o?yu(o):null,data:yu(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},c.D=Dt,c.E=xn,c.F=function(){var u=new qh(16);return qh!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u},c.G=Bn,c.H=function(u,o,h){var p,_,b,x,E,P,A,N,O,G,H,X,re=h[0],ce=h[1],ge=h[2];return o===u?(u[12]=o[0]*re+o[4]*ce+o[8]*ge+o[12],u[13]=o[1]*re+o[5]*ce+o[9]*ge+o[13],u[14]=o[2]*re+o[6]*ce+o[10]*ge+o[14],u[15]=o[3]*re+o[7]*ce+o[11]*ge+o[15]):(_=o[1],b=o[2],x=o[3],E=o[4],P=o[5],A=o[6],N=o[7],O=o[8],G=o[9],H=o[10],X=o[11],u[0]=p=o[0],u[1]=_,u[2]=b,u[3]=x,u[4]=E,u[5]=P,u[6]=A,u[7]=N,u[8]=O,u[9]=G,u[10]=H,u[11]=X,u[12]=p*re+E*ce+O*ge+o[12],u[13]=_*re+P*ce+G*ge+o[13],u[14]=b*re+A*ce+H*ge+o[14],u[15]=x*re+N*ce+X*ge+o[15]),u},c.I=Dy,c.J=function(u,o,h){var p=h[0],_=h[1],b=h[2];return u[0]=o[0]*p,u[1]=o[1]*p,u[2]=o[2]*p,u[3]=o[3]*p,u[4]=o[4]*_,u[5]=o[5]*_,u[6]=o[6]*_,u[7]=o[7]*_,u[8]=o[8]*b,u[9]=o[9]*b,u[10]=o[10]*b,u[11]=o[11]*b,u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15],u},c.K=z1,c.L=function(u,o){const h={};for(let p=0;p{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of u){const _=window.document.createElement("source");cr(p)||(o.crossOrigin="Anonymous"),_.src=p,o.appendChild(_)}})},c.a3=function(){return te++},c.a4=y,c.a5=Kh,c.a6=Sh,c.a7=zl,c.a8=fr,c.a9=Bb,c.aA=Y,c.aB=function(u,o){if(!u)return[{command:"setStyle",args:[o]}];let h=[];try{if(!fn(u.version,o.version))return[{command:"setStyle",args:[o]}];fn(u.center,o.center)||h.push({command:"setCenter",args:[o.center]}),fn(u.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),fn(u.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),fn(u.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),fn(u.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),fn(u.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),fn(u.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),fn(u.light,o.light)||h.push({command:"setLight",args:[o.light]}),fn(u.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),fn(u.sky,o.sky)||h.push({command:"setSky",args:[o.sky]});const p={},_=[];(function(x,E,P,A){let N;for(N in E=E||{},x=x||{})Object.prototype.hasOwnProperty.call(x,N)&&(Object.prototype.hasOwnProperty.call(E,N)||gs(N,P,A));for(N in E)Object.prototype.hasOwnProperty.call(E,N)&&(Object.prototype.hasOwnProperty.call(x,N)?fn(x[N],E[N])||(x[N].type==="geojson"&&E[N].type==="geojson"&&Ha(x,E,N)?tr(P,{command:"setGeoJSONSourceData",args:[N,E[N].data]}):Bs(N,E,P,A)):Do(N,E,P))})(u.sources,o.sources,_,p);const b=[];u.layers&&u.layers.forEach(x=>{"source"in x&&p[x.source]?h.push({command:"removeLayer",args:[x.id]}):b.push(x)}),h=h.concat(_),function(x,E,P){E=E||[];const A=(x=x||[]).map(Cl),N=E.map(Cl),O=x.reduce(_s,{}),G=E.reduce(_s,{}),H=A.slice(),X=Object.create(null);let re,ce,ge,Re,be;for(let Te=0,Je=0;Te@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,b)=>{const x=_||b;return o[p]=!x||x.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},c.ab=function(u,o){const h=[];for(const p in u)p in o||h.push(p);return h},c.ac=ae,c.ad=function(u,o,h){var p=Math.sin(h),_=Math.cos(h),b=o[0],x=o[1],E=o[2],P=o[3],A=o[4],N=o[5],O=o[6],G=o[7];return o!==u&&(u[8]=o[8],u[9]=o[9],u[10]=o[10],u[11]=o[11],u[12]=o[12],u[13]=o[13],u[14]=o[14],u[15]=o[15]),u[0]=b*_+A*p,u[1]=x*_+N*p,u[2]=E*_+O*p,u[3]=P*_+G*p,u[4]=A*_-b*p,u[5]=N*_-x*p,u[6]=O*_-E*p,u[7]=G*_-P*p,u},c.ae=function(u){var o=new qh(16);return o[0]=u[0],o[1]=u[1],o[2]=u[2],o[3]=u[3],o[4]=u[4],o[5]=u[5],o[6]=u[6],o[7]=u[7],o[8]=u[8],o[9]=u[9],o[10]=u[10],o[11]=u[11],o[12]=u[12],o[13]=u[13],o[14]=u[14],o[15]=u[15],o},c.af=Km,c.ag=function(u,o){let h=0,p=0;if(u.kind==="constant")p=u.layoutSize;else if(u.kind!=="source"){const{interpolationType:_,minZoom:b,maxZoom:x}=u,E=_?ae(Fi.interpolationFactor(_,o,b,x),0,1):0;u.kind==="camera"?p=no.number(u.minSize,u.maxSize,E):h=E}return{uSizeT:h,uSize:p}},c.ai=function(u,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:_}){return u.kind==="source"?p/nl:u.kind==="composite"?no.number(p/nl,_/nl,h):o},c.aj=zy,c.ak=function(u,o,h,p){const _=o.y-u.y,b=o.x-u.x,x=p.y-h.y,E=p.x-h.x,P=x*b-E*_;if(P===0)return null;const A=(E*(u.y-h.y)-x*(u.x-h.x))/P;return new I(u.x+A*b,u.y+A*_)},c.al=jb,c.am=Fp,c.an=gy,c.ao=ci,c.aq=Oy,c.ar=function(u,o){var h=o[0],p=o[1],_=o[2],b=o[3],x=o[4],E=o[5],P=o[6],A=o[7],N=o[8],O=o[9],G=o[10],H=o[11],X=o[12],re=o[13],ce=o[14],ge=o[15],Re=h*E-p*x,be=h*P-_*x,Te=h*A-b*x,Je=p*P-_*E,Qe=p*A-b*E,wt=_*A-b*P,Tt=N*re-O*X,xt=N*ce-G*X,yt=N*ge-H*X,ct=O*ce-G*re,It=O*ge-H*re,mt=G*ge-H*ce,st=Re*mt-be*It+Te*ct+Je*yt-Qe*xt+wt*Tt;return st?(u[0]=(E*mt-P*It+A*ct)*(st=1/st),u[1]=(_*It-p*mt-b*ct)*st,u[2]=(re*wt-ce*Qe+ge*Je)*st,u[3]=(G*Qe-O*wt-H*Je)*st,u[4]=(P*yt-x*mt-A*xt)*st,u[5]=(h*mt-_*yt+b*xt)*st,u[6]=(ce*Te-X*wt-ge*be)*st,u[7]=(N*wt-G*Te+H*be)*st,u[8]=(x*It-E*yt+A*Tt)*st,u[9]=(p*yt-h*It-b*Tt)*st,u[10]=(X*Qe-re*Te+ge*Re)*st,u[11]=(O*Te-N*Qe-H*Re)*st,u[12]=(E*xt-x*ct-P*Tt)*st,u[13]=(h*ct-p*xt+_*Tt)*st,u[14]=(re*be-X*Je-ce*Re)*st,u[15]=(N*Je-O*be+G*Re)*st,u):null},c.as=Wy,c.at=Ny,c.au=Hy,c.av=function(){const u={},o=ze.$version;for(const h in ze.$root){const p=ze.$root[h];if(p.required){let _=null;_=h==="version"?o:p.type==="array"?[]:{},_!=null&&(u[h]=_)}}return u},c.aw=Om,c.ax=$r,c.ay=function(u){u=u.slice();const o=Object.create(null);for(let h=0;hst*ci)}let xt=x?"center":h.get("text-justify").evaluate(A,{},u.canonical);const yt=h.get("symbol-placement"),ct=yt==="point"?h.get("text-max-width").evaluate(A,{},u.canonical)*ci:0,It=()=>{u.bucket.allowVerticalPlacement&&bu(Te)&&(X.vertical=rg(re,u.glyphMap,u.glyphPositions,u.imagePositions,N,ct,b,wt,"left",Qe,ge,c.ah.vertical,!0,yt,G,O))};if(!x&&Tt){const mt=new Set;if(xt==="auto")for(let Bt=0;Btl(void 0,void 0,void 0,function*(){if(u.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(u)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),c.e=de,c.f=u=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Pt})},p.onerror=()=>h(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const _=new Blob([new Uint8Array(u)],{type:"image/png"});p.src=u.byteLength?URL.createObjectURL(_):Pt}),c.g=mn,c.h=(u,o)=>_r(de(u,{type:"json"}),o),c.i=He,c.j=_t,c.k=Ce,c.l=(u,o)=>_r(de(u,{type:"arrayBuffer"}),o),c.m=_r,c.n=function(u){return new Ay(u).readFields(mL,[])},c.o=qp,c.p=_b,c.q=vo,c.r=fy,c.s=cr,c.t=_u,c.u=bt,c.v=ze,c.w=Ye,c.x=Dl,c.y=function([u,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:u*Math.cos(o)*Math.sin(h),y:u*Math.sin(o)*Math.sin(h),z:u*Math.cos(h)}},c.z=no}),i("worker",["./shared"],function(c){class l{constructor(V){this.keyCache={},V&&this.replace(V)}replace(V){this._layerConfigs={},this._layers={},this.update(V,[])}update(V,W){for(const se of V){this._layerConfigs[se.id]=se;const Ee=this._layers[se.id]=c.az(se);Ee._featureFilter=c.a6(Ee.filter),this.keyCache[se.id]&&delete this.keyCache[se.id]}for(const se of W)delete this.keyCache[se],delete this._layerConfigs[se],delete this._layers[se];this.familiesBySource={};const K=c.bh(Object.values(this._layerConfigs),this.keyCache);for(const se of K){const Ee=se.map(Ze=>this._layers[Ze.id]),Q=Ee[0];if(Q.visibility==="none")continue;const Ie=Q.source||"";let _e=this.familiesBySource[Ie];_e||(_e=this.familiesBySource[Ie]={});const De=Q.sourceLayer||"_geojsonTileLayer";let je=_e[De];je||(je=_e[De]=[]),je.push(Ee)}}}class d{constructor(V){const W={},K=[];for(const Ie in V){const _e=V[Ie],De=W[Ie]={};for(const je in _e){const Ze=_e[+je];if(!Ze||Ze.bitmap.width===0||Ze.bitmap.height===0)continue;const Ke={x:0,y:0,w:Ze.bitmap.width+2,h:Ze.bitmap.height+2};K.push(Ke),De[je]={rect:Ke,metrics:Ze.metrics}}}const{w:se,h:Ee}=c.p(K),Q=new c.o({width:se||1,height:Ee||1});for(const Ie in V){const _e=V[Ie];for(const De in _e){const je=_e[+De];if(!je||je.bitmap.width===0||je.bitmap.height===0)continue;const Ze=W[Ie][De].rect;c.o.copy(je.bitmap,Q,{x:0,y:0},{x:Ze.x+1,y:Ze.y+1},je.bitmap)}}this.image=Q,this.positions=W}}c.bi("GlyphAtlas",d);class w{constructor(V){this.tileID=new c.Q(V.tileID.overscaledZ,V.tileID.wrap,V.tileID.canonical.z,V.tileID.canonical.x,V.tileID.canonical.y),this.uid=V.uid,this.zoom=V.zoom,this.pixelRatio=V.pixelRatio,this.tileSize=V.tileSize,this.source=V.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=V.showCollisionBoxes,this.collectResourceTiming=!!V.collectResourceTiming,this.returnDependencies=!!V.returnDependencies,this.promoteId=V.promoteId,this.inFlightDependencies=[]}parse(V,W,K,se){return c._(this,void 0,void 0,function*(){this.status="parsing",this.data=V,this.collisionBoxArray=new c.a4;const Ee=new c.bj(Object.keys(V.layers).sort()),Q=new c.bk(this.tileID,this.promoteId);Q.bucketLayerIDs=[];const Ie={},_e={featureIndex:Q,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:K},De=W.familiesBySource[this.source];for(const cn in De){const Ir=V.layers[cn];if(!Ir)continue;Ir.version===1&&c.w(`Vector tile source "${this.source}" layer "${cn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ai=Ee.encode(cn),to=[];for(let go=0;go=xi.maxzoom||xi.visibility!=="none"&&(S(go,this.zoom,K),(Ie[xi.id]=xi.createBucket({index:Q.bucketLayerIDs.length,layers:go,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(to,_e,this.tileID.canonical),Q.bucketLayerIDs.push(go.map(Vs=>Vs.id)))}}const je=c.aE(_e.glyphDependencies,cn=>Object.keys(cn).map(Number));this.inFlightDependencies.forEach(cn=>cn==null?void 0:cn.abort()),this.inFlightDependencies=[];let Ze=Promise.resolve({});if(Object.keys(je).length){const cn=new AbortController;this.inFlightDependencies.push(cn),Ze=se.sendAsync({type:"GG",data:{stacks:je,source:this.source,tileID:this.tileID,type:"glyphs"}},cn)}const Ke=Object.keys(_e.iconDependencies);let Mt=Promise.resolve({});if(Ke.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Mt=se.sendAsync({type:"GI",data:{icons:Ke,source:this.source,tileID:this.tileID,type:"icons"}},cn)}const Nt=Object.keys(_e.patternDependencies);let Yt=Promise.resolve({});if(Nt.length){const cn=new AbortController;this.inFlightDependencies.push(cn),Yt=se.sendAsync({type:"GI",data:{icons:Nt,source:this.source,tileID:this.tileID,type:"patterns"}},cn)}const[Qt,En,Xn]=yield Promise.all([Ze,Mt,Yt]),hr=new d(Qt),ti=new c.bl(En,Xn);for(const cn in Ie){const Ir=Ie[cn];Ir instanceof c.a5?(S(Ir.layers,this.zoom,K),c.bm({bucket:Ir,glyphMap:Qt,glyphPositions:hr.positions,imageMap:En,imagePositions:ti.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ir.hasPattern&&(Ir instanceof c.bn||Ir instanceof c.bo||Ir instanceof c.bp)&&(S(Ir.layers,this.zoom,K),Ir.addFeatures(_e,this.tileID.canonical,ti.patternPositions))}return this.status="done",{buckets:Object.values(Ie).filter(cn=>!cn.isEmpty()),featureIndex:Q,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:hr.image,imageAtlas:ti,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?En:null,glyphPositions:this.returnDependencies?hr.positions:null}})}}function S(he,V,W){const K=new c.a8(V);for(const se of he)se.recalculate(K,W)}class I{constructor(V,W,K){this.actor=V,this.layerIndex=W,this.availableImages=K,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(V,W){return c._(this,void 0,void 0,function*(){const K=yield c.l(V.request,W);try{return{vectorTile:new c.bq.VectorTile(new c.br(K.data)),rawData:K.data,cacheControl:K.cacheControl,expires:K.expires}}catch(se){const Ee=new Uint8Array(K.data);let Q=`Unable to parse the tile at ${V.request.url}, `;throw Q+=Ee[0]===31&&Ee[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${se.messge}`,new Error(Q)}})}loadTile(V){return c._(this,void 0,void 0,function*(){const W=V.uid,K=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request),se=new w(V);this.loading[W]=se;const Ee=new AbortController;se.abort=Ee;try{const Q=yield this.loadVectorTile(V,Ee);if(delete this.loading[W],!Q)return null;const Ie=Q.rawData,_e={};Q.expires&&(_e.expires=Q.expires),Q.cacheControl&&(_e.cacheControl=Q.cacheControl);const De={};if(K){const Ze=K.finish();Ze&&(De.resourceTiming=JSON.parse(JSON.stringify(Ze)))}se.vectorTile=Q.vectorTile;const je=se.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=se,this.fetching[W]={rawTileData:Ie,cacheControl:_e,resourceTiming:De};try{const Ze=yield je;return c.e({rawTileData:Ie.slice(0)},Ze,_e,De)}finally{delete this.fetching[W]}}catch(Q){throw delete this.loading[W],se.status="done",this.loaded[W]=se,Q}})}reloadTile(V){return c._(this,void 0,void 0,function*(){const W=V.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const K=this.loaded[W];if(K.showCollisionBoxes=V.showCollisionBoxes,K.status==="parsing"){const se=yield K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor);let Ee;if(this.fetching[W]){const{rawTileData:Q,cacheControl:Ie,resourceTiming:_e}=this.fetching[W];delete this.fetching[W],Ee=c.e({rawTileData:Q.slice(0)},se,Ie,_e)}else Ee=se;return Ee}if(K.status==="done"&&K.vectorTile)return K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(V){return c._(this,void 0,void 0,function*(){const W=this.loading,K=V.uid;W&&W[K]&&W[K].abort&&(W[K].abort.abort(),delete W[K])})}removeTile(V){return c._(this,void 0,void 0,function*(){this.loaded&&this.loaded[V.uid]&&delete this.loaded[V.uid]})}}class T{constructor(){this.loaded={}}loadTile(V){return c._(this,void 0,void 0,function*(){const{uid:W,encoding:K,rawImageData:se,redFactor:Ee,greenFactor:Q,blueFactor:Ie,baseShift:_e}=V,De=se.width+2,je=se.height+2,Ze=c.b(se)?new c.R({width:De,height:je},yield c.bt(se,-1,-1,De,je)):se,Ke=new c.bu(W,Ze,K,Ee,Q,Ie,_e);return this.loaded=this.loaded||{},this.loaded[W]=Ke,Ke})}removeTile(V){const W=this.loaded,K=V.uid;W&&W[K]&&delete W[K]}}function k(he,V){if(he.length!==0){D(he[0],V);for(var W=1;W=Math.abs(Ie)?W-_e+Ie:Ie-_e+W,W=_e}W+K>=0!=!!V&&he.reverse()}var U=c.bv(function he(V,W){var K,se=V&&V.type;if(se==="FeatureCollection")for(K=0;K>31}function Oe(he,V){for(var W=he.loadGeometry(),K=he.type,se=0,Ee=0,Q=W.length,Ie=0;Iehe},Pt=Math.fround||(Zt=new Float32Array(1),he=>(Zt[0]=+he,Zt[0]));var Zt;const Xt=3,kt=5,un=6;class Fn{constructor(V){this.options=Object.assign(Object.create(Rt),V),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(V){const{log:W,minZoom:K,maxZoom:se}=this.options;W&&console.time("total time");const Ee=`prepare ${V.length} points`;W&&console.time(Ee),this.points=V;const Q=[];for(let _e=0;_e=K;_e--){const De=+Date.now();Ie=this.trees[_e]=this._createTree(this._cluster(Ie,_e)),W&&console.log("z%d: %d clusters in %dms",_e,Ie.numItems,+Date.now()-De)}return W&&console.timeEnd("total time"),this}getClusters(V,W){let K=((V[0]+180)%360+360)%360-180;const se=Math.max(-90,Math.min(90,V[1]));let Ee=V[2]===180?180:((V[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,V[3]));if(V[2]-V[0]>=360)K=-180,Ee=180;else if(K>Ee){const Ze=this.getClusters([K,se,180,Q],W),Ke=this.getClusters([-180,se,Ee,Q],W);return Ze.concat(Ke)}const Ie=this.trees[this._limitZoom(W)],_e=Ie.range(Bn(K),ir(Q),Bn(Ee),ir(se)),De=Ie.data,je=[];for(const Ze of _e){const Ke=this.stride*Ze;je.push(De[Ke+kt]>1?bn(De,Ke,this.clusterProps):this.points[De[Ke+Xt]])}return je}getChildren(V){const W=this._getOriginId(V),K=this._getOriginZoom(V),se="No cluster with the specified id.",Ee=this.trees[K];if(!Ee)throw new Error(se);const Q=Ee.data;if(W*this.stride>=Q.length)throw new Error(se);const Ie=this.options.radius/(this.options.extent*Math.pow(2,K-1)),_e=Ee.within(Q[W*this.stride],Q[W*this.stride+1],Ie),De=[];for(const je of _e){const Ze=je*this.stride;Q[Ze+4]===V&&De.push(Q[Ze+kt]>1?bn(Q,Ze,this.clusterProps):this.points[Q[Ze+Xt]])}if(De.length===0)throw new Error(se);return De}getLeaves(V,W,K){const se=[];return this._appendLeaves(se,V,W=W||10,K=K||0,0),se}getTile(V,W,K){const se=this.trees[this._limitZoom(V)],Ee=Math.pow(2,V),{extent:Q,radius:Ie}=this.options,_e=Ie/Q,De=(K-_e)/Ee,je=(K+1+_e)/Ee,Ze={features:[]};return this._addTileFeatures(se.range((W-_e)/Ee,De,(W+1+_e)/Ee,je),se.data,W,K,Ee,Ze),W===0&&this._addTileFeatures(se.range(1-_e/Ee,De,1,je),se.data,Ee,K,Ee,Ze),W===Ee-1&&this._addTileFeatures(se.range(0,De,_e/Ee,je),se.data,-1,K,Ee,Ze),Ze.features.length?Ze:null}getClusterExpansionZoom(V){let W=this._getOriginZoom(V)-1;for(;W<=this.options.maxZoom;){const K=this.getChildren(V);if(W++,K.length!==1)break;V=K[0].properties.cluster_id}return W}_appendLeaves(V,W,K,se,Ee){const Q=this.getChildren(W);for(const Ie of Q){const _e=Ie.properties;if(_e&&_e.cluster?Ee+_e.point_count<=se?Ee+=_e.point_count:Ee=this._appendLeaves(V,_e.cluster_id,K,se,Ee):Ee1;let je,Ze,Ke;if(De)je=mn(W,_e,this.clusterProps),Ze=W[_e],Ke=W[_e+1];else{const Yt=this.points[W[_e+Xt]];je=Yt.properties;const[Qt,En]=Yt.geometry.coordinates;Ze=Bn(Qt),Ke=ir(En)}const Mt={type:1,geometry:[[Math.round(this.options.extent*(Ze*Ee-K)),Math.round(this.options.extent*(Ke*Ee-se))]],tags:je};let Nt;Nt=De||this.options.generateId?W[_e+Xt]:this.points[W[_e+Xt]].id,Nt!==void 0&&(Mt.id=Nt),Q.features.push(Mt)}}_limitZoom(V){return Math.max(this.options.minZoom,Math.min(Math.floor(+V),this.options.maxZoom+1))}_cluster(V,W){const{radius:K,extent:se,reduce:Ee,minPoints:Q}=this.options,Ie=K/(se*Math.pow(2,W)),_e=V.data,De=[],je=this.stride;for(let Ze=0;Ze<_e.length;Ze+=je){if(_e[Ze+2]<=W)continue;_e[Ze+2]=W;const Ke=_e[Ze],Mt=_e[Ze+1],Nt=V.within(_e[Ze],_e[Ze+1],Ie),Yt=_e[Ze+kt];let Qt=Yt;for(const En of Nt){const Xn=En*je;_e[Xn+2]>W&&(Qt+=_e[Xn+kt])}if(Qt>Yt&&Qt>=Q){let En,Xn=Ke*Yt,hr=Mt*Yt,ti=-1;const cn=((Ze/je|0)<<5)+(W+1)+this.points.length;for(const Ir of Nt){const ai=Ir*je;if(_e[ai+2]<=W)continue;_e[ai+2]=W;const to=_e[ai+kt];Xn+=_e[ai]*to,hr+=_e[ai+1]*to,_e[ai+4]=cn,Ee&&(En||(En=this._map(_e,Ze,!0),ti=this.clusterProps.length,this.clusterProps.push(En)),Ee(En,this._map(_e,ai)))}_e[Ze+4]=cn,De.push(Xn/Qt,hr/Qt,1/0,cn,-1,Qt),Ee&&De.push(ti)}else{for(let En=0;En1)for(const En of Nt){const Xn=En*je;if(!(_e[Xn+2]<=W)){_e[Xn+2]=W;for(let hr=0;hr>5}_getOriginZoom(V){return(V-this.points.length)%32}_map(V,W,K){if(V[W+kt]>1){const Q=this.clusterProps[V[W+un]];return K?Object.assign({},Q):Q}const se=this.points[V[W+Xt]].properties,Ee=this.options.map(se);return K&&Ee===se?Object.assign({},Ee):Ee}}function bn(he,V,W){return{type:"Feature",id:he[V+Xt],properties:mn(he,V,W),geometry:{type:"Point",coordinates:[(K=he[V],360*(K-.5)),$r(he[V+1])]}};var K}function mn(he,V,W){const K=he[V+kt],se=K>=1e4?`${Math.round(K/1e3)}k`:K>=1e3?Math.round(K/100)/10+"k":K,Ee=he[V+un],Q=Ee===-1?{}:Object.assign({},W[Ee]);return Object.assign(Q,{cluster:!0,cluster_id:he[V+Xt],point_count:K,point_count_abbreviated:se})}function Bn(he){return he/360+.5}function ir(he){const V=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+V)/(1-V))/Math.PI;return W<0?0:W>1?1:W}function $r(he){const V=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(V))/Math.PI-90}function _r(he,V,W,K){for(var se,Ee=K,Q=W-V>>1,Ie=W-V,_e=he[V],De=he[V+1],je=he[W],Ze=he[W+1],Ke=V+3;KeEe)se=Ke,Ee=Mt;else if(Mt===Ee){var Nt=Math.abs(Ke-Q);NtK&&(se-V>3&&_r(he,V,se,K),he[se+2]=Ee,W-se>3&&_r(he,se,W,K))}function cr(he,V,W,K,se,Ee){var Q=se-W,Ie=Ee-K;if(Q!==0||Ie!==0){var _e=((he-W)*Q+(V-K)*Ie)/(Q*Q+Ie*Ie);_e>1?(W=se,K=Ee):_e>0&&(W+=Q*_e,K+=Ie*_e)}return(Q=he-W)*Q+(Ie=V-K)*Ie}function or(he,V,W,K){var se={id:he===void 0?null:he,type:V,geometry:W,tags:K,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ee){var Q=Ee.geometry,Ie=Ee.type;if(Ie==="Point"||Ie==="MultiPoint"||Ie==="LineString")ie(Ee,Q);else if(Ie==="Polygon"||Ie==="MultiLineString")for(var _e=0;_e0&&(Q+=K?(se*De-_e*Ee)/2:Math.sqrt(Math.pow(_e-se,2)+Math.pow(De-Ee,2))),se=_e,Ee=De}var je=V.length-3;V[2]=1,_r(V,0,je,W),V[je+2]=1,V.size=Math.abs(Q),V.start=0,V.end=V.size}function ze(he,V,W,K){for(var se=0;se1?1:W}function fn(he,V,W,K,se,Ee,Q,Ie){if(K/=V,Ee>=(W/=V)&&Q=K)return null;for(var _e=[],De=0;De=W&&Nt=K)){var Yt=[];if(Ke==="Point"||Ke==="MultiPoint")tr(Ze,Yt,W,K,se);else if(Ke==="LineString")Do(Ze,Yt,W,K,se,!1,Ie.lineMetrics);else if(Ke==="MultiLineString")Bs(Ze,Yt,W,K,se,!1);else if(Ke==="Polygon")Bs(Ze,Yt,W,K,se,!0);else if(Ke==="MultiPolygon")for(var Qt=0;Qt=W&&Q<=K&&(V.push(he[Ee]),V.push(he[Ee+1]),V.push(he[Ee+2]))}}function Do(he,V,W,K,se,Ee,Q){for(var Ie,_e,De=gs(he),je=se===0?Ai:Cl,Ze=he.start,Ke=0;KeW&&(_e=je(De,Mt,Nt,Qt,En,W),Q&&(De.start=Ze+Ie*_e)):Xn>K?hr=W&&(_e=je(De,Mt,Nt,Qt,En,W),ti=!0),hr>K&&Xn<=K&&(_e=je(De,Mt,Nt,Qt,En,K),ti=!0),!Ee&&ti&&(Q&&(De.end=Ze+Ie*_e),V.push(De),De=gs(he)),Q&&(Ze+=Ie)}var cn=he.length-3;Mt=he[cn],Nt=he[cn+1],Yt=he[cn+2],(Xn=se===0?Mt:Nt)>=W&&Xn<=K&&Ha(De,Mt,Nt,Yt),cn=De.length-3,Ee&&cn>=3&&(De[cn]!==De[0]||De[cn+1]!==De[1])&&Ha(De,De[0],De[1],De[2]),De.length&&V.push(De)}function gs(he){var V=[];return V.size=he.size,V.start=he.start,V.end=he.end,V}function Bs(he,V,W,K,se,Ee){for(var Q=0;QQ.maxX&&(Q.maxX=je),Ze>Q.maxY&&(Q.maxY=Ze)}return Q}function ei(he,V,W,K){var se=V.geometry,Ee=V.type,Q=[];if(Ee==="Point"||Ee==="MultiPoint")for(var Ie=0;Ie0&&V.size<(se?Q:K))W.numPoints+=V.length/3;else{for(var Ie=[],_e=0;_eQ)&&(W.numSimplified++,Ie.push(V[_e]),Ie.push(V[_e+1])),W.numPoints++;se&&function(De,je){for(var Ze=0,Ke=0,Mt=De.length,Nt=Mt-2;Ke0===je)for(Ke=0,Mt=De.length;Ke24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");var K=function(se,Ee){var Q=[];if(se.type==="FeatureCollection")for(var Ie=0;Ie1&&console.time("creation"),Ke=this.tiles[Ze]=Tl(he,V,W,K,_e),this.tileCoords.push({z:V,x:W,y:K}),De)){De>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,W,K,Ke.numFeatures,Ke.numPoints,Ke.numSimplified),console.timeEnd("creation"));var Mt="z"+V;this.stats[Mt]=(this.stats[Mt]||0)+1,this.total++}if(Ke.source=he,se){if(V===_e.maxZoom||V===se)continue;var Nt=1<1&&console.time("clipping");var Yt,Qt,En,Xn,hr,ti,cn=.5*_e.buffer/_e.extent,Ir=.5-cn,ai=.5+cn,to=1+cn;Yt=Qt=En=Xn=null,hr=fn(he,je,W-cn,W+ai,0,Ke.minX,Ke.maxX,_e),ti=fn(he,je,W+Ir,W+to,0,Ke.minX,Ke.maxX,_e),he=null,hr&&(Yt=fn(hr,je,K-cn,K+ai,1,Ke.minY,Ke.maxY,_e),Qt=fn(hr,je,K+Ir,K+to,1,Ke.minY,Ke.maxY,_e),hr=null),ti&&(En=fn(ti,je,K-cn,K+ai,1,Ke.minY,Ke.maxY,_e),Xn=fn(ti,je,K+Ir,K+to,1,Ke.minY,Ke.maxY,_e),ti=null),De>1&&console.timeEnd("clipping"),Ie.push(Yt||[],V+1,2*W,2*K),Ie.push(Qt||[],V+1,2*W,2*K+1),Ie.push(En||[],V+1,2*W+1,2*K),Ie.push(Xn||[],V+1,2*W+1,2*K+1)}}},on.prototype.getTile=function(he,V,W){var K=this.options,se=K.extent,Ee=K.debug;if(he<0||he>24)return null;var Q=1<1&&console.log("drilling down to z%d-%d-%d",he,V,W);for(var _e,De=he,je=V,Ze=W;!_e&&De>0;)De--,je=Math.floor(je/2),Ze=Math.floor(Ze/2),_e=this.tiles[nn(De,je,Ze)];return _e&&_e.source?(Ee>1&&console.log("found parent tile z%d-%d-%d",De,je,Ze),Ee>1&&console.time("drilling down"),this.splitTile(_e.source,De,je,Ze,he,V,W),Ee>1&&console.timeEnd("drilling down"),this.tiles[Ie]?Qo(this.tiles[Ie],se):null):null};class ba extends I{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(V,W){return c._(this,void 0,void 0,function*(){const K=V.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const se=this._geoJSONIndex.getTile(K.z,K.x,K.y);if(!se)return null;const Ee=new class{constructor(Ie){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.W,this.length=Ie.length,this._features=Ie}feature(Ie){return new class{constructor(_e){this._feature=_e,this.extent=c.W,this.type=_e.type,this.properties=_e.tags,"id"in _e&&!isNaN(_e.id)&&(this.id=parseInt(_e.id,10))}loadGeometry(){if(this._feature.type===1){const _e=[];for(const De of this._feature.geometry)_e.push([new c.P(De[0],De[1])]);return _e}{const _e=[];for(const De of this._feature.geometry){const je=[];for(const Ze of De)je.push(new c.P(Ze[0],Ze[1]));_e.push(je)}return _e}}toGeoJSON(_e,De,je){return q.call(this,_e,De,je)}}(this._features[Ie])}}(se.features);let Q=Ge(Ee);return Q.byteOffset===0&&Q.byteLength===Q.buffer.byteLength||(Q=new Uint8Array(Q)),{vectorTile:Ee,rawData:Q.buffer}})}loadData(V){return c._(this,void 0,void 0,function*(){var W;(W=this._pendingRequest)===null||W===void 0||W.abort();const K=!!(V&&V.request&&V.request.collectResourceTiming)&&new c.bs(V.request);this._pendingRequest=new AbortController;try{let se=yield this.loadGeoJSON(V,this._pendingRequest);if(delete this._pendingRequest,typeof se!="object")throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(U(se,!0),V.filter){const Q=c.by(V.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(_e=>`${_e.key}: ${_e.message}`).join(", "));se={type:"FeatureCollection",features:se.features.filter(_e=>Q.value.evaluate({zoom:0},_e))}}this._geoJSONIndex=V.cluster?new Fn(function({superclusterOptions:Q,clusterProperties:Ie}){if(!Ie||!Q)return Q;const _e={},De={},je={accumulated:null,zoom:0},Ze={properties:null},Ke=Object.keys(Ie);for(const Mt of Ke){const[Nt,Yt]=Ie[Mt],Qt=c.by(Yt),En=c.by(typeof Nt=="string"?[Nt,["accumulated"],["get",Mt]]:Nt);_e[Mt]=Qt.value,De[Mt]=En.value}return Q.map=Mt=>{Ze.properties=Mt;const Nt={};for(const Yt of Ke)Nt[Yt]=_e[Yt].evaluate(je,Ze);return Nt},Q.reduce=(Mt,Nt)=>{Ze.properties=Nt;for(const Yt of Ke)je.accumulated=Mt[Yt],Mt[Yt]=De[Yt].evaluate(je,Ze)},Q}(V)).load(se.features):function(Q,Ie){return new on(Q,Ie)}(se,V.geojsonVtOptions),this.loaded={};const Ee={};if(K){const Q=K.finish();Q&&(Ee.resourceTiming={},Ee.resourceTiming[V.source]=JSON.parse(JSON.stringify(Q)))}return Ee}catch(se){if(delete this._pendingRequest,c.bz(se))return{abandoned:!0};throw se}})}reloadTile(V){const W=this.loaded;return W&&W[V.uid]?super.reloadTile(V):this.loadTile(V)}loadGeoJSON(V,W){return c._(this,void 0,void 0,function*(){const{promoteId:K}=V;if(V.request){const se=yield c.h(V.request,W);return this._dataUpdateable=$o(se.data,K)?tn(se.data,K):void 0,se.data}if(typeof V.data=="string")try{const se=JSON.parse(V.data);return this._dataUpdateable=$o(se,K)?tn(se,K):void 0,se}catch{throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`)}if(!V.dataDiff)throw new Error(`Input data given to '${V.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${V.source}`);return function(se,Ee,Q){var Ie,_e,De,je;if(Ee.removeAll&&se.clear(),Ee.remove)for(const Ze of Ee.remove)se.delete(Ze);if(Ee.add)for(const Ze of Ee.add){const Ke=Rr(Ze,Q);Ke!=null&&se.set(Ke,Ze)}if(Ee.update)for(const Ze of Ee.update){let Ke=se.get(Ze.id);if(Ke==null)continue;const Mt=!Ze.removeAllProperties&&(((Ie=Ze.removeProperties)===null||Ie===void 0?void 0:Ie.length)>0||((_e=Ze.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if((Ze.newGeometry||Ze.removeAllProperties||Mt)&&(Ke=Object.assign({},Ke),se.set(Ze.id,Ke),Mt&&(Ke.properties=Object.assign({},Ke.properties))),Ze.newGeometry&&(Ke.geometry=Ze.newGeometry),Ze.removeAllProperties)Ke.properties={};else if(((De=Ze.removeProperties)===null||De===void 0?void 0:De.length)>0)for(const Nt of Ze.removeProperties)Object.prototype.hasOwnProperty.call(Ke.properties,Nt)&&delete Ke.properties[Nt];if(((je=Ze.addOrUpdateProperties)===null||je===void 0?void 0:je.length)>0)for(const{key:Nt,value:Yt}of Ze.addOrUpdateProperties)Ke.properties[Nt]=Yt}}(this._dataUpdateable,V.dataDiff,K),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(V){return c._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(V){return this._geoJSONIndex.getClusterExpansionZoom(V.clusterId)}getClusterChildren(V){return this._geoJSONIndex.getChildren(V.clusterId)}getClusterLeaves(V){return this._geoJSONIndex.getLeaves(V.clusterId,V.limit,V.offset)}}class Vr{constructor(V){this.self=V,this.actor=new c.C(V),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,K)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=K},this.self.addProtocol=c.bf,this.self.removeProtocol=c.bg,this.self.registerRTLTextPlugin=W=>{if(c.bA.isParsed())throw new Error("RTL text plugin already registered.");c.bA.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,K)=>this._getDEMWorkerSource(W,K.source).loadTile(K)),this.actor.registerMessageHandler("RDT",(W,K)=>c._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,K.source).removeTile(K)})),this.actor.registerMessageHandler("GCEZ",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterExpansionZoom(K)})),this.actor.registerMessageHandler("GCC",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterChildren(K)})),this.actor.registerMessageHandler("GCL",(W,K)=>c._(this,void 0,void 0,function*(){return this._getWorkerSource(W,K.type,K.source).getClusterLeaves(K)})),this.actor.registerMessageHandler("LD",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadData(K)),this.actor.registerMessageHandler("LT",(W,K)=>this._getWorkerSource(W,K.type,K.source).loadTile(K)),this.actor.registerMessageHandler("RT",(W,K)=>this._getWorkerSource(W,K.type,K.source).reloadTile(K)),this.actor.registerMessageHandler("AT",(W,K)=>this._getWorkerSource(W,K.type,K.source).abortTile(K)),this.actor.registerMessageHandler("RMT",(W,K)=>this._getWorkerSource(W,K.type,K.source).removeTile(K)),this.actor.registerMessageHandler("RS",(W,K)=>c._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][K.type]||!this.workerSources[W][K.type][K.source])return;const se=this.workerSources[W][K.type][K.source];delete this.workerSources[W][K.type][K.source],se.removeSource!==void 0&&se.removeSource(K)})),this.actor.registerMessageHandler("RM",W=>c._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,K)=>c._(this,void 0,void 0,function*(){this.referrer=K})),this.actor.registerMessageHandler("SRPS",(W,K)=>this._syncRTLPluginState(W,K)),this.actor.registerMessageHandler("IS",(W,K)=>c._(this,void 0,void 0,function*(){this.self.importScripts(K)})),this.actor.registerMessageHandler("SI",(W,K)=>this._setImages(W,K)),this.actor.registerMessageHandler("UL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(K.layers,K.removedIds)})),this.actor.registerMessageHandler("SL",(W,K)=>c._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(K)}))}_setImages(V,W){return c._(this,void 0,void 0,function*(){this.availableImages[V]=W;for(const K in this.workerSources[V]){const se=this.workerSources[V][K];for(const Ee in se)se[Ee].availableImages=W}})}_syncRTLPluginState(V,W){return c._(this,void 0,void 0,function*(){if(c.bA.isParsed())return c.bA.getState();if(W.pluginStatus!=="loading")return c.bA.setState(W),W;const K=W.pluginURL;if(this.self.importScripts(K),c.bA.isParsed()){const se={pluginStatus:"loaded",pluginURL:K};return c.bA.setState(se),se}throw c.bA.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${K}`)})}_getAvailableImages(V){let W=this.availableImages[V];return W||(W=[]),W}_getLayerIndex(V){let W=this.layerIndexes[V];return W||(W=this.layerIndexes[V]=new l),W}_getWorkerSource(V,W,K){if(this.workerSources[V]||(this.workerSources[V]={}),this.workerSources[V][W]||(this.workerSources[V][W]={}),!this.workerSources[V][W][K]){const se={sendAsync:(Ee,Q)=>(Ee.targetMapId=V,this.actor.sendAsync(Ee,Q))};switch(W){case"vector":this.workerSources[V][W][K]=new I(se,this._getLayerIndex(V),this._getAvailableImages(V));break;case"geojson":this.workerSources[V][W][K]=new ba(se,this._getLayerIndex(V),this._getAvailableImages(V));break;default:this.workerSources[V][W][K]=new this.externalWorkerSourceTypes[W](se,this._getLayerIndex(V),this._getAvailableImages(V))}}return this.workerSources[V][W][K]}_getDEMWorkerSource(V,W){return this.demWorkerSources[V]||(this.demWorkerSources[V]={}),this.demWorkerSources[V][W]||(this.demWorkerSources[V][W]=new T),this.demWorkerSources[V][W]}}return c.i(self)&&(self.worker=new Vr(self)),Vr}),i("index",["exports","./shared"],function(c,l){var d="4.1.3";let w,S;const I={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:y=>new Promise((s,f)=>{const m=requestAnimationFrame(s);y.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),f(l.c())})}),getImageData(y,s=0){return this.getImageCanvasContext(y).getImageData(-s,-s,y.width+2*s,y.height+2*s)},getImageCanvasContext(y){const s=window.document.createElement("canvas"),f=s.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return s.width=y.width,s.height=y.height,f.drawImage(y,0,0,y.width,y.height),f},resolveURL:y=>(w||(w=document.createElement("a")),w.href=y,w.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(S==null&&(S=matchMedia("(prefers-reduced-motion: reduce)")),S.matches)}};class T{static testProp(s){if(!T.docStyle)return s[0];for(let f=0;f{window.removeEventListener("click",T.suppressClickInternal,!0)},0)}static getScale(s){const f=s.getBoundingClientRect();return{x:f.width/s.offsetWidth||1,y:f.height/s.offsetHeight||1,boundingClientRect:f}}static getPoint(s,f,m){const g=f.boundingClientRect;return new l.P((m.clientX-g.left)/f.x-s.clientLeft,(m.clientY-g.top)/f.y-s.clientTop)}static mousePos(s,f){const m=T.getScale(s);return T.getPoint(s,m,f)}static touchPos(s,f){const m=[],g=T.getScale(s);for(let v=0;v{s=[],f=0,m=0,g={}},y.addThrottleControl=M=>{const R=m++;return g[R]=M,R},y.removeThrottleControl=M=>{delete g[M],C()},y.getImage=(M,R,z=!0)=>new Promise((F,Z)=>{k.supported&&(M.headers||(M.headers={}),M.headers.accept="image/webp,*/*"),l.e(M,{type:"image"}),s.push({abortController:R,requestParameters:M,supportImageRefresh:z,state:"queued",onError:ue=>{Z(ue)},onSuccess:ue=>{F(ue)}}),C()});const v=M=>l._(this,void 0,void 0,function*(){M.state="running";const{requestParameters:R,supportImageRefresh:z,onError:F,onSuccess:Z,abortController:ue}=M,le=z===!1&&!l.i(self)&&!l.g(R.url)&&(!R.headers||Object.keys(R.headers).reduce((we,Be)=>we&&Be==="accept",!0));f++;const fe=le?L(R,ue):l.m(R,ue);try{const we=yield fe;delete M.abortController,M.state="completed",we.data instanceof HTMLImageElement||l.b(we.data)?Z(we):we.data&&Z({data:yield(ne=we.data,typeof createImageBitmap=="function"?l.d(ne):l.f(ne)),cacheControl:we.cacheControl,expires:we.expires})}catch(we){delete M.abortController,F(we)}finally{f--,C()}var ne}),C=()=>{const M=(()=>{for(const R of Object.keys(g))if(g[R]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let R=f;R0;R++){const z=s.shift();z.abortController.signal.aborted?R--:v(z)}},L=(M,R)=>new Promise((z,F)=>{const Z=new Image,ue=M.url,le=M.credentials;le&&le==="include"?Z.crossOrigin="use-credentials":(le&&le==="same-origin"||!l.s(ue))&&(Z.crossOrigin="anonymous"),R.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,z({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,R.signal.aborted||F(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},Z.src=ue})}(j||(j={})),j.resetRequestQueue();class J{constructor(s){this._transformRequestFn=s}transformRequest(s,f){return this._transformRequestFn&&this._transformRequestFn(s,f)||{url:s}}normalizeSpriteURL(s,f,m){const g=function(v){const C=v.match(ae);if(!C)throw new Error(`Unable to parse URL "${v}"`);return{protocol:C[1],authority:C[2],path:C[3]||"/",params:C[4]?C[4].split("&"):[]}}(s);return g.path+=`${f}${m}`,function(v){const C=v.params.length?`?${v.params.join("&")}`:"";return`${v.protocol}://${v.authority}${v.path}${C}`}(g)}setTransformRequest(s){this._transformRequestFn=s}}const ae=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function me(y){var s=new l.A(3);return s[0]=y[0],s[1]=y[1],s[2]=y[2],s}var de,te=function(y,s,f){return y[0]=s[0]-f[0],y[1]=s[1]-f[1],y[2]=s[2]-f[2],y};de=new l.A(3),l.A!=Float32Array&&(de[0]=0,de[1]=0,de[2]=0);var $=function(y){var s=y[0],f=y[1];return s*s+f*f};function Ae(y){const s=[];if(typeof y=="string")s.push({id:"default",url:y});else if(y&&y.length>0){const f=[];for(const{id:m,url:g}of y){const v=`${m}${g}`;f.indexOf(v)===-1&&(f.push(v),s.push({id:m,url:g}))}}return s}(function(){var y=new l.A(2);l.A!=Float32Array&&(y[0]=0,y[1]=0)})();class Y{constructor(s,f,m,g){this.context=s,this.format=m,this.texture=s.gl.createTexture(),this.update(f,g)}update(s,f,m){const{width:g,height:v}=s,C=!(this.size&&this.size[0]===g&&this.size[1]===v||m),{context:L}=this,{gl:M}=L;if(this.useMipmap=!!(f&&f.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!f||f.premultiply!==!1)),C)this.size=[g,v],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,s):M.texImage2D(M.TEXTURE_2D,0,this.format,g,v,0,this.format,M.UNSIGNED_BYTE,s.data);else{const{x:R,y:z}=m||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?M.texSubImage2D(M.TEXTURE_2D,0,R,z,M.RGBA,M.UNSIGNED_BYTE,s):M.texSubImage2D(M.TEXTURE_2D,0,R,z,g,v,M.RGBA,M.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(s,f,m){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),m!==v.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=v.LINEAR),s!==this.filter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,s),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,m||s),this.filter=s),f!==this.wrap&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,f),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function oe(y){const{userImage:s}=y;return!!(s&&s.render&&s.render())&&(y.data.replace(new Uint8Array(s.data.buffer)),!0)}class Ye extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:f,promiseResolve:m}of this.requestors)m(this._getImagesForIds(f));this.requestors=[]}}getImage(s){const f=this.images[s];if(f&&!f.data&&f.spriteData){const m=f.spriteData;f.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),f.spriteData=null}return f}addImage(s,f){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,f)&&(this.images[s]=f)}_validate(s,f){let m=!0;const g=f.data||f.spriteData;return this._validateStretch(f.stretchX,g&&g.width)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchX" value`))),m=!1),this._validateStretch(f.stretchY,g&&g.height)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchY" value`))),m=!1),this._validateContent(f.content,f)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "content" value`))),m=!1),m}_validateStretch(s,f){if(!s)return!0;let m=0;for(const g of s){if(g[0]{let g=!0;if(!this.isLoaded())for(const v of s)this.images[v]||(g=!1);this.isLoaded()||g?f(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:f})})}_getImagesForIds(s){const f={};for(const m of s){let g=this.getImage(m);g||(this.fire(new l.k("styleimagemissing",{id:m})),g=this.getImage(m)),g?f[m]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:l.w(`Image "${m}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return f}getPixelSize(){const{width:s,height:f}=this.atlasImage;return{width:s,height:f}}getPattern(s){const f=this.patterns[s],m=this.getImage(s);if(!m)return null;if(f&&f.position.version===m.version)return f.position;if(f)f.position.version=m.version;else{const g={w:m.data.width+2,h:m.data.height+2,x:0,y:0},v=new l.I(g,m);this.patterns[s]={bin:g,position:v}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const f=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Y(s,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const v in this.patterns)s.push(this.patterns[v].bin);const{w:f,h:m}=l.p(s),g=this.atlasImage;g.resize({width:f||1,height:m||1});for(const v in this.patterns){const{bin:C}=this.patterns[v],L=C.x+1,M=C.y+1,R=this.getImage(v).data,z=R.width,F=R.height;l.R.copy(R,g,{x:0,y:0},{x:L,y:M},{width:z,height:F}),l.R.copy(R,g,{x:0,y:F-1},{x:L,y:M-1},{width:z,height:1}),l.R.copy(R,g,{x:0,y:0},{x:L,y:M+F},{width:z,height:1}),l.R.copy(R,g,{x:z-1,y:0},{x:L-1,y:M},{width:1,height:F}),l.R.copy(R,g,{x:0,y:0},{x:L+z,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const f of s){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const m=this.getImage(f);m||l.w(`Image with ID: "${f}" was not found`),oe(m)&&this.updateImage(f,m)}}}const ve=1e20;function Oe(y,s,f,m,g,v,C,L,M){for(let R=s;R-1);M++,v[M]=L,C[M]=R,C[M+1]=ve}for(let L=0,M=0;L65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[v])return{stack:s,id:f,glyph:g};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[v]){const L=Ge.loadGlyphRange(s,v,this.url,this.requestManager);m.requests[v]=L}const C=yield m.requests[v];for(const L in C)this._doesCharSupportLocalGlyph(+L)||(m.glyphs[+L]=C[+L]);return m.ranges[v]=!0,{stack:s,id:f,glyph:C[f]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&(l.u["CJK Unified Ideographs"](s)||l.u["Hangul Syllables"](s)||l.u.Hiragana(s)||l.u.Katakana(s))}_tinySDF(s,f,m){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(m))return;let v=s.tinySDF;if(!v){let L="400";/bold/i.test(f)?L="900":/medium/i.test(f)?L="500":/light/i.test(f)&&(L="200"),v=s.tinySDF=new Ge.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:L})}const C=v.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:C.width||60,height:C.height||60},C.data),metrics:{width:C.glyphWidth/2||24,height:C.glyphHeight/2||24,left:C.glyphLeft/2+.5||0,top:C.glyphTop/2-27.5||-8,advance:C.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ge.loadGlyphRange=function(y,s,f,m){return l._(this,void 0,void 0,function*(){const g=256*s,v=g+255,C=m.transformRequest(f.replace("{fontstack}",y).replace("{range}",`${g}-${v}`),"Glyphs"),L=yield l.l(C,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${s}, ${g}-${v}`);const M={};for(const R of l.n(L.data))M[R.id]=R;return M})},Ge.TinySDF=class{constructor({fontSize:y=24,buffer:s=3,radius:f=8,cutoff:m=.25,fontFamily:g="sans-serif",fontWeight:v="normal",fontStyle:C="normal"}={}){this.buffer=s,this.cutoff=m,this.radius=f;const L=this.size=y+4*s,M=this._createCanvas(L),R=this.ctx=M.getContext("2d",{willReadFrequently:!0});R.font=`${C} ${v} ${y}px ${g}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(L*L),this.gridInner=new Float64Array(L*L),this.f=new Float64Array(L),this.z=new Float64Array(L+1),this.v=new Uint16Array(L)}_createCanvas(y){const s=document.createElement("canvas");return s.width=s.height=y,s}draw(y){const{width:s,actualBoundingBoxAscent:f,actualBoundingBoxDescent:m,actualBoundingBoxLeft:g,actualBoundingBoxRight:v}=this.ctx.measureText(y),C=Math.ceil(f),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(v-g))),M=Math.min(this.size-this.buffer,C+Math.ceil(m)),R=L+2*this.buffer,z=M+2*this.buffer,F=Math.max(R*z,0),Z=new Uint8ClampedArray(F),ue={data:Z,width:R,height:z,glyphWidth:L,glyphHeight:M,glyphTop:C,glyphLeft:0,glyphAdvance:s};if(L===0||M===0)return ue;const{ctx:le,buffer:fe,gridInner:ne,gridOuter:we}=this;le.clearRect(fe,fe,L,M),le.fillText(y,fe,fe+C);const Be=le.getImageData(fe,fe,L,M);we.fill(ve,0,F),ne.fill(0,0,F);for(let pe=0;pe0?Xe*Xe:0,ne[qe]=Xe<0?Xe*Xe:0}}Oe(we,0,0,R,z,R,this.f,this.v,this.z),Oe(ne,fe,fe,L,M,R,this.f,this.v,this.z);for(let pe=0;pe1&&(M=s[++L]);const z=Math.abs(R-M.left),F=Math.abs(R-M.right),Z=Math.min(z,F);let ue;const le=v/m*(g+1);if(M.isDash){const fe=g-Math.abs(le);ue=Math.sqrt(Z*Z+fe*fe)}else ue=g-Math.sqrt(Z*Z+le*le);this.data[C+R]=Math.max(0,Math.min(255,ue+128))}}}addRegularDash(s){for(let L=s.length-1;L>=0;--L){const M=s[L],R=s[L+1];M.zeroLength?s.splice(L,1):R&&R.isDash===M.isDash&&(R.left=M.left,s.splice(L,1))}const f=s[0],m=s[s.length-1];f.isDash===m.isDash&&(f.left=m.left-this.width,m.right=f.right+this.width);const g=this.width*this.nextRow;let v=0,C=s[v];for(let L=0;L1&&(C=s[++v]);const M=Math.abs(L-C.left),R=Math.abs(L-C.right),z=Math.min(M,R);this.data[g+L]=Math.max(0,Math.min(255,(C.isDash?z:-z)+128))}}addDash(s,f){const m=f?7:0,g=2*m+1;if(this.nextRow+g>this.height)return l.w("LineAtlas out of space"),null;let v=0;for(let L=0;L{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[kt]}numActive(){return Object.keys(this.active).length}}const Fn=Math.floor(I.hardwareConcurrency/2);let bn,mn;function Bn(){return bn||(bn=new un),bn}un.workerCount=l.B(globalThis)?Math.max(Math.min(Fn,3),1):1;class ir{constructor(s,f){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=f;const m=this.workerPool.acquire(f);for(let g=0;g{f.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,f){for(const m of this.actors)m.registerMessageHandler(s,f)}}function $r(){return mn||(mn=new ir(Bn(),l.G),mn.registerMessageHandler("GR",(y,s,f)=>l.m(s,f))),mn}function _r(y,s){const f=l.F();return l.H(f,f,[1,1,0]),l.J(f,f,[.5*y.width,.5*y.height,1]),l.K(f,f,y.calculatePosMatrix(s.toUnwrapped()))}function cr(y,s,f,m,g,v){const C=function(F,Z,ue){if(F)for(const le of F){const fe=Z[le];if(fe&&fe.source===ue&&fe.type==="fill-extrusion")return!0}else for(const le in Z){const fe=Z[le];if(fe.source===ue&&fe.type==="fill-extrusion")return!0}return!1}(g&&g.layers,s,y.id),L=v.maxPitchScaleFactor(),M=y.tilesIn(m,L,C);M.sort(or);const R=[];for(const F of M)R.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,f,y._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,g,v,L,_r(y.transform,F.tileID))});const z=function(F){const Z={},ue={};for(const le of F){const fe=le.queryResults,ne=le.wrappedTileID,we=ue[ne]=ue[ne]||{};for(const Be in fe){const pe=fe[Be],Pe=we[Be]=we[Be]||{},Ue=Z[Be]=Z[Be]||[];for(const qe of pe)Pe[qe.featureIndex]||(Pe[qe.featureIndex]=!0,Ue.push(qe))}}return Z}(R);for(const F in z)z[F].forEach(Z=>{const ue=Z.feature,le=y.getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=le});return z}function or(y,s){const f=y.tileID,m=s.tileID;return f.overscaledZ-m.overscaledZ||f.canonical.y-m.canonical.y||f.wrap-m.wrap||f.canonical.x-m.canonical.x}function ie(y,s,f){return l._(this,void 0,void 0,function*(){let m=y;if(y.url?m=(yield l.h(s.transformRequest(y.url,"Source"),f)).data:yield I.frameAsync(f),!m)return null;const g=l.L(l.e(m,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(g.vectorLayerIds=m.vector_layers.map(v=>v.id)),g})}class Ce{constructor(s,f){s&&(f?this.setSouthWest(s).setNorthEast(f):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}setSouthWest(s){return this._sw=s instanceof l.M?new l.M(s.lng,s.lat):l.M.convert(s),this}extend(s){const f=this._sw,m=this._ne;let g,v;if(s instanceof l.M)g=s,v=s;else{if(!(s instanceof Ce))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Ce.convert(s)):this.extend(l.M.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(l.M.convert(s)):this;if(g=s._sw,v=s._ne,!g||!v)return this}return f||m?(f.lng=Math.min(g.lng,f.lng),f.lat=Math.min(g.lat,f.lat),m.lng=Math.max(v.lng,m.lng),m.lat=Math.max(v.lat,m.lat)):(this._sw=new l.M(g.lng,g.lat),this._ne=new l.M(v.lng,v.lat)),this}getCenter(){return new l.M((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l.M(this.getWest(),this.getNorth())}getSouthEast(){return new l.M(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(s){const{lng:f,lat:m}=l.M.convert(s);let g=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&g}static convert(s){return s instanceof Ce?s:s&&new Ce(s)}static fromLngLat(s,f=0){const m=360*f/40075017,g=m/Math.cos(Math.PI/180*s.lat);return new Ce(new l.M(s.lng-g,s.lat-m),new l.M(s.lng+g,s.lat+m))}}class _t{constructor(s,f,m){this.bounds=Ce.convert(this.validateBounds(s)),this.minzoom=f||0,this.maxzoom=m||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const f=Math.pow(2,s.z),m=Math.floor(l.N(this.bounds.getWest())*f),g=Math.floor(l.O(this.bounds.getNorth())*f),v=Math.ceil(l.N(this.bounds.getEast())*f),C=Math.ceil(l.O(this.bounds.getSouth())*f);return s.x>=m&&s.x=g&&s.y{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(f,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let g="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((v,C)=>{s.reloadPromise={resolve:v,reject:C}})}else s.actor=this.dispatcher.getActor(),g="LT";s.abortController=new AbortController;try{const v=yield s.actor.sendAsync({type:g,data:m},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,v)}catch(v){if(delete s.abortController,s.aborted)return;if(v&&v.status!==404)throw v;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,f){if(f&&f.resourceTiming&&(s.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&s.setExpiryData(f),s.loadVectorData(f,this.map.painter),s.reloadPromise){const m=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(m.resolve).catch(m.reject)}}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class ze extends l.E{constructor(s,f,m,g){super(),this.id=s,this.dispatcher=m,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},f),l.e(this,l.L(f,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ie(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new _t(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return l.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const m=yield j.getImage(this.map._requestManager.transformRequest(f,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const g=this.map.painter.context,v=g.gl,C=m.data;s.texture=this.map.painter.getTileTexture(C.width),s.texture?s.texture.update(C,{useMipmap:!0}):(s.texture=new Y(g,C,v.RGBA,{useMipmap:!0}),s.texture.bind(v.LINEAR,v.CLAMP_TO_EDGE,v.LINEAR_MIPMAP_NEAREST),g.extTextureFilterAnisotropic&&v.texParameterf(v.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax)),s.state="loaded"}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class en extends ze{constructor(s,f,m,g){super(s,f,m,g),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(f,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const g=yield j.getImage(m,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(g&&g.data){const v=g.data;this.map._refreshExpiredTiles&&g.cacheControl&&g.expires&&s.setExpiryData({cacheControl:g.cacheControl,expires:g.expires});const C=l.b(v)&&l.S()?v:yield this.readImageNow(v),L={type:this.type,uid:s.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const M=yield s.actor.sendAsync({type:"LDT",data:L});s.dem=M,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(g){if(delete s.abortController,s.aborted)s.state="unloaded";else if(g)throw s.state="errored",g}})}readImageNow(s){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.U()){const f=s.width+2,m=s.height+2;try{return new l.R({width:f,height:m},yield l.V(s,-1,-1,f,m))}catch{}}return I.getImageData(s,1)})}_getNeighboringTiles(s){const f=s.canonical,m=Math.pow(2,f.z),g=(f.x-1+m)%m,v=f.x===0?s.wrap-1:s.wrap,C=(f.x+1+m)%m,L=f.x+1===m?s.wrap+1:s.wrap,M={};return M[new l.Q(s.overscaledZ,v,f.z,g,f.y).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y).key]={backfilled:!1},f.y>0&&(M[new l.Q(s.overscaledZ,v,f.z,g,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,s.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},M[new l.Q(s.overscaledZ,L,f.z,C,f.y-1).key]={backfilled:!1}),f.y+10&&l.e(v,{resourceTiming:g}),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},v),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(s){return l._(this,void 0,void 0,function*(){const f=s.actor?"RT":"LT";s.actor=this.actor;const m={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const g=yield this.actor.sendAsync({type:f,data:m},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(g,this.map.painter,f==="RT")})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var fn=l.X([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class tr extends l.E{constructor(s,f,m,g){super(),this.id=s,this.dispatcher=m,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=f}load(s){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield j.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,s&&(this.coordinates=s),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new l.j(f))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const f=s.map(l.Y.fromLngLat);this.tileID=function(g){let v=1/0,C=1/0,L=-1/0,M=-1/0;for(const Z of g)v=Math.min(v,Z.x),C=Math.min(C,Z.y),L=Math.max(L,Z.x),M=Math.max(M,Z.y);const R=Math.max(L-v,M-C),z=Math.max(0,Math.floor(-Math.log(R)/Math.LN2)),F=Math.pow(2,z);return new l.a0(z,Math.floor((v+L)/2*F),Math.floor((C+M)/2*F))}(f),this.minzoom=this.maxzoom=this.tileID.z;const m=f.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new l.Z,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.W,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.W),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.W,l.W),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Y(s,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Do extends tr{constructor(s,f,m,g){super(s,f,m,g),this.roundZoom=!0,this.type="video",this.options=f}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const f of s.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield l.a2(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new l.j(f))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const f=this.video.seekable;sf.end(0)?this.fire(new l.j(new l.a1(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,f=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Y(s,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let m=!1;for(const g in this.tiles){const v=this.tiles[g];v.state!=="loaded"&&(v.state="loaded",v.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class gs extends tr{constructor(s,f,m,g){super(s,f,m,g),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(C=>typeof C!="number"))||this.fire(new l.j(new l.a1(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a1(`sources.${s}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new l.j(new l.a1(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a1(`sources.${s}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.j(new l.a1(`sources.${s}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return l._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,m=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,fn.members)),this.boundsSegments||(this.boundsSegments=l.$.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Y(f,this.canvas,m.RGBA,{premultiply:!0});let g=!1;for(const v in this.tiles){const C=this.tiles[v];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,g=!0)}g&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Bs={},Ha=y=>{switch(y){case"geojson":return Dr;case"image":return tr;case"raster":return ze;case"raster-dem":return en;case"vector":return xn;case"video":return Do;case"canvas":return gs}return Bs[y]},Ai="RTLPluginLoaded";class Cl extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$r()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(f=>{throw this.status="error",f})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return l._(this,arguments,void 0,function*(f,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=I.resolveURL(f),!this.url)throw new Error(`requested url ${f} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ai))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _s=null;function at(){return _s||(_s=new Cl),_s}class Qo{constructor(s,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=l.a3(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(s){const f=s+this.timeAdded;fv.getLayer(R)).filter(Boolean);if(M.length!==0){L.layers=M,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(R=>M.filter(z=>z.id===R)[0]));for(const R of M)C[R.id]=L}}return C}(s.buckets,f.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5){if(this.hasSymbolBuckets=!0,!m)break;v.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const v=this.buckets[g];if(v instanceof l.a5&&v.hasRTLText){this.hasRTLText=!0,at().lazyLoad();break}}this.queryPadding=0;for(const g in this.buckets){const v=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(g).queryRadius(v))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new l.a4}unloadVectorData(){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(s){return this.buckets[s.id]}upload(s){for(const m in this.buckets){const g=this.buckets[m];g.uploadPending()&&g.upload(s)}const f=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Y(s,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Y(s,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,f,m,g,v,C,L,M,R,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:v,scale:C,tileSize:this.tileSize,pixelPosMatrix:z,transform:M,params:L,queryPadding:this.queryPadding*R},s,f,m):{}}querySourceFeatures(s,f){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const g=m.loadVTLayers(),v=f&&f.sourceLayer?f.sourceLayer:"",C=g._geojsonTileLayer||g[v];if(!C)return;const L=l.a6(f&&f.filter),{z:M,x:R,y:z}=this.tileID.canonical,F={z:M,x:R,y:z};for(let Z=0;Zm)g=!1;else if(f)if(this.expirationTime{this.remove(s,v)},m)),this.data[g].push(v),this.order.push(g),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const f=this.data[s].shift();return f.timeout&&clearTimeout(f.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),f.value}getByKey(s){const f=this.data[s];return f?f[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,f){if(!this.has(s))return this;const m=s.wrapped().key,g=f===void 0?0:this.data[m].indexOf(f),v=this.data[m][g];return this.data[m].splice(g,1),v.timeout&&clearTimeout(v.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(v.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(s){const f=[];for(const m in this.data)for(const g of this.data[m])s(g.value)||f.push(g);for(const m of f)this.remove(m.value.tileID,m)}}class Tl{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,f,m){const g=String(f);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][g]=this.stateChanges[s][g]||{},l.e(this.stateChanges[s][g],m),this.deletedStates[s]===null){this.deletedStates[s]={};for(const v in this.state[s])v!==g&&(this.deletedStates[s][v]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][g]===null){this.deletedStates[s][g]={};for(const v in this.state[s][g])m[v]||(this.deletedStates[s][g][v]=null)}else for(const v in m)this.deletedStates[s]&&this.deletedStates[s][g]&&this.deletedStates[s][g][v]===null&&delete this.deletedStates[s][g][v]}removeFeatureState(s,f,m){if(this.deletedStates[s]===null)return;const g=String(f);if(this.deletedStates[s]=this.deletedStates[s]||{},m&&f!==void 0)this.deletedStates[s][g]!==null&&(this.deletedStates[s][g]=this.deletedStates[s][g]||{},this.deletedStates[s][g][m]=null);else if(f!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][g])for(m in this.deletedStates[s][g]={},this.stateChanges[s][g])this.deletedStates[s][g][m]=null;else this.deletedStates[s][g]=null;else this.deletedStates[s]=null}getState(s,f){const m=String(f),g=l.e({},(this.state[s]||{})[m],(this.stateChanges[s]||{})[m]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const v=this.deletedStates[s][f];if(v===null)return{};for(const C in v)delete g[C]}return g}initializeTileState(s,f){s.setFeatureState(this.state,f)}coalesceChanges(s,f){const m={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const v={};for(const C in this.stateChanges[g])this.state[g][C]||(this.state[g][C]={}),l.e(this.state[g][C],this.stateChanges[g][C]),v[C]=this.state[g][C];m[g]=v}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const v={};if(this.deletedStates[g]===null)for(const C in this.state[g])v[C]={},this.state[g][C]={};else for(const C in this.deletedStates[g]){if(this.deletedStates[g][C]===null)this.state[g][C]={};else for(const L of Object.keys(this.deletedStates[g][C]))delete this.state[g][C][L];v[C]=this.state[g][C]}m[g]=m[g]||{},l.e(m[g],v)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const g in s)s[g].setFeatureState(m,f)}}class ei extends l.E{constructor(s,f,m){super(),this.id=s,this.dispatcher=m,this.on("data",g=>this._dataHandler(g)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((g,v,C,L)=>{const M=new(Ha(v.type))(g,v,C,L);if(M.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${M.id}`);return M})(s,f,m,this),this._tiles={},this._cache=new eo(0,g=>this._unloadTile(g)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Tl,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const s in this._tiles){const f=this._tiles[s];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,f,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,f,m)}catch(g){s.state="errored",g.status!==404?this._source.fire(new l.j(g,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new l.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const m=this._tiles[f];m.upload(s),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(ft).map(s=>s.key)}getRenderableIds(s){const f=[];for(const m in this._tiles)this._isIdRenderable(m,s)&&f.push(this._tiles[m]);return s?f.sort((m,g)=>{const v=m.tileID,C=g.tileID,L=new l.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle),M=new l.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return v.overscaledZ-C.overscaledZ||M.y-L.y||M.x-L.x}).map(m=>m.tileID.key):f.map(m=>m.tileID).sort(ft).map(m=>m.key)}hasRenderableParent(s){const f=this.findLoadedParent(s,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(s,f){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(f||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,f){return l._(this,void 0,void 0,function*(){const m=this._tiles[s];m&&(m.state!=="loading"&&(m.state=f),yield this._loadTile(m,s,f))})}_tileLoaded(s,f,m){s.timeAdded=I.now(),m==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(f,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const f=this.getRenderableIds();for(let g=0;g1||(Math.abs(C)>1&&(Math.abs(C+M)===1?C+=M:Math.abs(C-M)===1&&(C-=M)),v.dem&&g.dem&&(g.dem.backfillBorder(v.dem,C,L),g.neighboringTiles&&g.neighboringTiles[R]&&(g.neighboringTiles[R].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,f,m,g){for(const v in this._tiles){let C=this._tiles[v];if(g[v]||!C.hasData()||C.tileID.overscaledZ<=f||C.tileID.overscaledZ>m)continue;let L=C.tileID;for(;C&&C.tileID.overscaledZ>f+1;){const R=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[R.key],C&&C.hasData()&&(L=R)}let M=L;for(;M.overscaledZ>f;)if(M=M.scaledTo(M.overscaledZ-1),s[M.key]){g[L.key]=L;break}}}findLoadedParent(s,f){if(s.key in this._loadedParentTiles){const m=this._loadedParentTiles[s.key];return m&&m.tileID.overscaledZ>=f?m:null}for(let m=s.overscaledZ-1;m>=f;m--){const g=s.scaledTo(m),v=this._getLoadedTile(g);if(v)return v}}_getLoadedTile(s){const f=this._tiles[s.key];return f&&f.hasData()?f:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const f=Math.ceil(s.width/this._source.tileSize)+1,m=Math.ceil(s.height/this._source.tileSize)+1,g=Math.floor(f*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(v)}handleWrapJump(s){const f=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,f){const m={};for(const g in this._tiles){const v=this._tiles[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+f),m[v.tileID.key]=v}this._tiles=m;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(s,f){if(!this._sourceLoaded||this._paused)return;let m;this.transform=s,this.terrain=f,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(z=>new l.Q(z.canonical.z,z.wrap,z.canonical.z,z.canonical.x,z.canonical.y)):(m=s.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:f}),this._source.hasTile&&(m=m.filter(z=>this._source.hasTile(z)))):m=[];const g=s.coveringZoomLevel(this._source),v=Math.max(g-ei.maxOverzooming,this._source.minzoom),C=Math.max(g+ei.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const z={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);z[Z.key]=Z;const ue=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));z[ue.key]=ue}m=m.concat(Object.values(z))}const L=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const M=this._updateRetainedTiles(m,g);if(on(this._source.type)){const z={},F={},Z=Object.keys(M),ue=I.now();for(const le of Z){const fe=M[le],ne=this._tiles[le];if(!ne||ne.fadeEndTime!==0&&ne.fadeEndTime<=ue)continue;const we=this.findLoadedParent(fe,v);we&&(this._addTile(we.tileID),z[we.tileID.key]=we.tileID),F[le]=fe}this._retainLoadedChildren(F,g,C,M);for(const le in z)M[le]||(this._coveredTiles[le]=!0,M[le]=z[le]);if(f){const le={},fe={};for(const ne of m)this._tiles[ne.key].hasData()?le[ne.key]=ne:fe[ne.key]=ne;for(const ne in fe){const we=fe[ne].children(this._source.maxzoom);this._tiles[we[0].key]&&this._tiles[we[1].key]&&this._tiles[we[2].key]&&this._tiles[we[3].key]&&(le[we[0].key]=M[we[0].key]=we[0],le[we[1].key]=M[we[1].key]=we[1],le[we[2].key]=M[we[2].key]=we[2],le[we[3].key]=M[we[3].key]=we[3],delete fe[ne])}for(const ne in fe){const we=this.findLoadedParent(fe[ne],this._source.minzoom);if(we){le[we.tileID.key]=M[we.tileID.key]=we.tileID;for(const Be in le)le[Be].isChildOf(we.tileID)&&delete le[Be]}}for(const ne in this._tiles)le[ne]||(this._coveredTiles[ne]=!0)}}for(const z in M)this._tiles[z].clearFadeHold();const R=l.ab(this._tiles,M);for(const z of R){const F=this._tiles[z];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(z)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,f){const m={},g={},v=Math.max(f-ei.maxOverzooming,this._source.minzoom),C=Math.max(f+ei.maxUnderzooming,this._source.minzoom),L={};for(const M of s){const R=this._addTile(M);m[M.key]=M,R.hasData()||fthis._source.maxzoom){const F=M.children(this._source.maxzoom)[0],Z=this.getTile(F);if(Z&&Z.hasData()){m[F.key]=F;continue}}else{const F=M.children(this._source.maxzoom);if(m[F[0].key]&&m[F[1].key]&&m[F[2].key]&&m[F[3].key])continue}let z=R.wasRequested();for(let F=M.overscaledZ-1;F>=v;--F){const Z=M.scaledTo(F);if(g[Z.key])break;if(g[Z.key]=!0,R=this.getTile(Z),!R&&z&&(R=this._addTile(Z)),R){const ue=R.hasData();if((z||ue)&&(m[Z.key]=Z),z=R.wasRequested(),ue)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const f=[];let m,g=this._tiles[s].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){m=this._loadedParentTiles[g.key];break}f.push(g.key);const v=g.scaledTo(g.overscaledZ-1);if(m=this._getLoadedTile(v),m)break;g=v}for(const v of f)this._loadedParentTiles[v]=m}}_addTile(s){let f=this._tiles[s.key];if(f)return f;f=this._cache.getAndRemove(s),f&&(this._setTileReloadTimer(s.key,f),f.tileID=s,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,f)));const m=f;return f||(f=new Qo(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(f,s.key,f.state)),f.uses++,this._tiles[s.key]=f,m||this._source.fire(new l.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(s,f){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const m=f.getExpiryTimeout();m&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},m))}_removeTile(s){const f=this._tiles[s];f&&(f.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(s){const f=s.sourceDataType;s.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,f,m){const g=[],v=this.transform;if(!v)return g;const C=m?v.getCameraQueryGeometry(s):s,L=s.map(le=>v.pointCoordinate(le,this.terrain)),M=C.map(le=>v.pointCoordinate(le,this.terrain)),R=this.getIds();let z=1/0,F=1/0,Z=-1/0,ue=-1/0;for(const le of M)z=Math.min(z,le.x),F=Math.min(F,le.y),Z=Math.max(Z,le.x),ue=Math.max(ue,le.y);for(let le=0;le=0&&pe[1].y+Be>=0){const Pe=L.map(qe=>ne.getTilePoint(qe)),Ue=M.map(qe=>ne.getTilePoint(qe));g.push({tile:fe,tileID:ne,queryGeometry:Pe,cameraQueryGeometry:Ue,scale:we})}}return g}getVisibleCoordinates(s){const f=this.getRenderableIds(s).map(m=>this._tiles[m].tileID);for(const m of f)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(on(this._source.type)){const s=I.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=s)return!0}return!1}setFeatureState(s,f,m){this._state.updateState(s=s||"_geojsonTileLayer",f,m)}removeFeatureState(s,f,m){this._state.removeFeatureState(s=s||"_geojsonTileLayer",f,m)}getFeatureState(s,f){return this._state.getState(s=s||"_geojsonTileLayer",f)}setDependencies(s,f,m){const g=this._tiles[s];g&&g.setDependencies(f,m)}reloadTilesForDependencies(s,f){for(const m in this._tiles)this._tiles[m].hasDependency(s,f)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(s,f))}}function ft(y,s){const f=Math.abs(2*y.wrap)-+(y.wrap<0),m=Math.abs(2*s.wrap)-+(s.wrap<0);return y.overscaledZ-s.overscaledZ||m-f||s.canonical.y-y.canonical.y||s.canonical.x-y.canonical.x}function on(y){return y==="raster"||y==="image"||y==="video"}ei.maxOverzooming=10,ei.maxUnderzooming=3;class nn{constructor(s,f){this.reset(s,f)}reset(s,f){this.points=s||[],this._distances=[0];for(let m=1;m0?(g-C)/L:0;return this.points[v].mult(1-M).add(this.points[f].mult(M))}}function Rr(y,s){let f=!0;return y==="always"||y!=="never"&&s!=="never"||(f=!1),f}class $o{constructor(s,f,m){const g=this.boxCells=[],v=this.circleCells=[];this.xCellCount=Math.ceil(s/m),this.yCellCount=Math.ceil(f/m);for(let C=0;Cthis.width||g<0||f>this.height)return[];const M=[];if(s<=0&&f<=0&&this.width<=m&&this.height<=g){if(v)return[{key:null,x1:s,y1:f,x2:m,y2:g}];for(let R=0;R0}hitTestCircle(s,f,m,g,v){const C=s-m,L=s+m,M=f-m,R=f+m;if(L<0||C>this.width||R<0||M>this.height)return!1;const z=[];return this._forEachCell(C,M,L,R,this._queryCellCircle,z,{hitTest:!0,overlapMode:g,circle:{x:s,y:f,radius:m},seenUids:{box:{},circle:{}}},v),z.length>0}_queryCell(s,f,m,g,v,C,L,M){const{seenUids:R,hitTest:z,overlapMode:F}=L,Z=this.boxCells[v];if(Z!==null){const le=this.bboxes;for(const fe of Z)if(!R.box[fe]){R.box[fe]=!0;const ne=4*fe,we=this.boxKeys[fe];if(s<=le[ne+2]&&f<=le[ne+3]&&m>=le[ne+0]&&g>=le[ne+1]&&(!M||M(we))&&(!z||!Rr(F,we.overlapMode))&&(C.push({key:we,x1:le[ne],y1:le[ne+1],x2:le[ne+2],y2:le[ne+3]}),z))return!0}}const ue=this.circleCells[v];if(ue!==null){const le=this.circles;for(const fe of ue)if(!R.circle[fe]){R.circle[fe]=!0;const ne=3*fe,we=this.circleKeys[fe];if(this._circleAndRectCollide(le[ne],le[ne+1],le[ne+2],s,f,m,g)&&(!M||M(we))&&(!z||!Rr(F,we.overlapMode))){const Be=le[ne],pe=le[ne+1],Pe=le[ne+2];if(C.push({key:we,x1:Be-Pe,y1:pe-Pe,x2:Be+Pe,y2:pe+Pe}),z)return!0}}}return!1}_queryCellCircle(s,f,m,g,v,C,L,M){const{circle:R,seenUids:z,overlapMode:F}=L,Z=this.boxCells[v];if(Z!==null){const le=this.bboxes;for(const fe of Z)if(!z.box[fe]){z.box[fe]=!0;const ne=4*fe,we=this.boxKeys[fe];if(this._circleAndRectCollide(R.x,R.y,R.radius,le[ne+0],le[ne+1],le[ne+2],le[ne+3])&&(!M||M(we))&&!Rr(F,we.overlapMode))return C.push(!0),!0}}const ue=this.circleCells[v];if(ue!==null){const le=this.circles;for(const fe of ue)if(!z.circle[fe]){z.circle[fe]=!0;const ne=3*fe,we=this.circleKeys[fe];if(this._circlesCollide(le[ne],le[ne+1],le[ne+2],R.x,R.y,R.radius)&&(!M||M(we))&&!Rr(F,we.overlapMode))return C.push(!0),!0}}}_forEachCell(s,f,m,g,v,C,L,M){const R=this._convertToXCellCoord(s),z=this._convertToYCellCoord(f),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(g);for(let ue=R;ue<=F;ue++)for(let le=z;le<=Z;le++)if(v.call(this,s,f,m,g,this.xCellCount*le+ue,C,L,M))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,f,m,g,v,C){const L=g-s,M=v-f,R=m+C;return R*R>L*L+M*M}_circleAndRectCollide(s,f,m,g,v,C,L){const M=(C-g)/2,R=Math.abs(s-(g+M));if(R>M+m)return!1;const z=(L-v)/2,F=Math.abs(f-(v+z));if(F>z+m)return!1;if(R<=M||F<=z)return!0;const Z=R-M,ue=F-z;return Z*Z+ue*ue<=m*m}}function tn(y,s,f,m,g){const v=l.F();return s?(l.J(v,v,[1/g,1/g,1]),f||l.ad(v,v,m.angle)):l.K(v,m.labelPlaneMatrix,y),v}function ba(y,s,f,m,g){if(s){const v=l.ae(y);return l.J(v,v,[g,g,1]),f||l.ad(v,v,-m.angle),v}return m.glCoordMatrix}function Vr(y,s,f){let m;f?(m=[y.x,y.y,f(y.x,y.y),1],l.af(m,m,s)):(m=[y.x,y.y,0,1],Mt(m,m,s));const g=m[3];return{point:new l.P(m[0]/g,m[1]/g),signedDistanceFromCamera:g}}function he(y,s){return .5+y/s*.5}function V(y,s){const f=y[0]/y[3],m=y[1]/y[3];return f>=-s[0]&&f<=s[0]&&m>=-s[1]&&m<=s[1]}function W(y,s,f,m,g,v,C,L,M,R){const z=m?y.textSizeData:y.iconSizeData,F=l.ag(z,f.transform.zoom),Z=[256/f.width*2+1,256/f.height*2+1],ue=m?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;ue.clear();const le=y.lineVertexArray,fe=m?y.text.placedSymbolArray:y.icon.placedSymbolArray,ne=f.transform.width/f.transform.height;let we=!1;for(let Be=0;BeMath.abs(f.x-s.x)*m?{useVertical:!0}:(y===l.ah.vertical?s.yf.x)?{needsFlipping:!0}:null}function Ee(y,s,f,m,g,v,C,L,M,R,z,F,Z,ue,le,fe){const ne=s/24,we=y.lineOffsetX*ne,Be=y.lineOffsetY*ne;let pe;if(y.numGlyphs>1){const Pe=y.glyphStartIndex+y.numGlyphs,Ue=y.lineStartIndex,qe=y.lineStartIndex+y.lineLength,Xe=K(ne,L,we,Be,f,z,F,y,M,v,Z,le,fe);if(!Xe)return{notEnoughRoom:!0};const tt=Vr(Xe.first.point,C,fe).point,$e=Vr(Xe.last.point,C,fe).point;if(m&&!f){const ut=se(y.writingMode,tt,$e,ue);if(ut)return ut}pe=[Xe.first];for(let ut=y.glyphStartIndex+1;ut0?tt.point:Q(F,Xe,Ue,1,g,fe),ut=se(y.writingMode,Ue,$e,ue);if(ut)return ut}const Pe=je(ne*L.getoffsetX(y.glyphStartIndex),we,Be,f,z,F,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,M,v,Z,le,fe);if(!Pe)return{notEnoughRoom:!0};pe=[Pe]}for(const Pe of pe)l.aj(R,Pe.point,Pe.angle);return{}}function Q(y,s,f,m,g,v){const C=Vr(y.add(y.sub(s)._unit()),g,v).point,L=f.sub(C);return f.add(L._mult(m/L.mag()))}function Ie(y,s){const{projectionCache:f,lineVertexArray:m,labelPlaneMatrix:g,tileAnchorPoint:v,distanceFromAnchor:C,getElevation:L,previousVertex:M,direction:R,absOffsetX:z}=s;if(f.projections[y])return f.projections[y];const F=new l.P(m.getx(y),m.gety(y)),Z=Vr(F,g,L);if(Z.signedDistanceFromCamera>0)return f.projections[y]=Z.point,Z.point;const ue=y-R;return Q(C===0?v:new l.P(m.getx(ue),m.gety(ue)),F,M,z-C+1,g,L)}function _e(y,s,f){return y._unit()._perp()._mult(s*f)}function De(y,s,f,m,g,v,C,L){const{projectionCache:M,direction:R}=L;if(M.offsets[y])return M.offsets[y];const z=f.add(s);if(y+R=g)return M.offsets[y]=z,z;const F=Ie(y+R,L),Z=_e(F.sub(f),C,R),ue=f.add(Z),le=F.add(Z);return M.offsets[y]=l.ak(v,z,ue,le)||z,M.offsets[y]}function je(y,s,f,m,g,v,C,L,M,R,z,F,Z,ue){const le=m?y-s:y+s;let fe=le>0?1:-1,ne=0;m&&(fe*=-1,ne=Math.PI),fe<0&&(ne+=Math.PI);let we,Be,pe=fe>0?L+C:L+C+1,Pe=g,Ue=g,qe=0,Xe=0;const tt=Math.abs(le),$e=[];let ut;for(;qe+Xe<=tt;){if(pe+=fe,pe=M)return null;qe+=Xe,Ue=Pe,Be=we;const dt={projectionCache:F,lineVertexArray:R,labelPlaneMatrix:z,tileAnchorPoint:v,distanceFromAnchor:qe,getElevation:ue,previousVertex:Ue,direction:fe,absOffsetX:tt};if(Pe=Ie(pe,dt),f===0)$e.push(Ue),ut=Pe.sub(Ue);else{let Ut;const an=Pe.sub(Ue);Ut=an.mag()===0?_e(Ie(pe+fe,dt).sub(Pe),f,fe):_e(an,f,fe),Be||(Be=Ue.add(Ut)),we=De(pe,Ut,Pe,L,M,Be,f,dt),$e.push(Be),ut=we.sub(Be)}Xe=ut.mag()}const pt=ut._mult((tt-qe)/Xe)._add(Be||Ue),sn=ne+Math.atan2(Pe.y-Ue.y,Pe.x-Ue.x);return $e.push(pt),{point:pt,angle:Z?sn:0,path:$e}}const Ze=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ke(y,s){for(let f=0;f=1;hn--)an.push(dt.path[hn]);for(let hn=1;hnVr(pn,M,le));an=hn.some(pn=>pn.signedDistanceFromCamera<=0)?[]:hn.map(pn=>pn.point)}let Ht=[];if(an.length>0){const hn=an[0].clone(),pn=an[0].clone();for(let Lr=1;Lr=ut.x&&pn.x<=pt.x&&hn.y>=ut.y&&pn.y<=pt.y?[an]:pn.xpt.x||pn.ypt.y?[]:l.al([an],ut.x,ut.y,pt.x,pt.y)}for(const hn of Ht){sn.reset(hn,.25*$e);let pn=0;pn=sn.length<=.5*$e?1:Math.ceil(sn.paddedLength/Cn)+1;for(let Lr=0;Lr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(s,f,m,g){return m>=0&&s=0&&fm.collisionGroupID===f}}return this.collisionGroups[s]}}function ai(y,s,f,m,g){const{horizontalAlign:v,verticalAlign:C}=l.at(y);return new l.P(-(v-.5)*s+m[0]*g,-(C-.5)*f+m[1]*g)}function to(y,s,f,m,g,v){const{x1:C,x2:L,y1:M,y2:R,anchorPointX:z,anchorPointY:F}=y,Z=new l.P(s,f);return m&&Z._rotate(g?v:-v),{x1:C+Z.x,y1:M+Z.y,x2:L+Z.x,y2:R+Z.y,anchorPointX:z,anchorPointY:F}}class go{constructor(s,f,m,g,v){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new Yt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Ir(g),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,f,m,g){const v=m.getBucket(f),C=m.latestFeatureIndex;if(!v||!C||f.id!==v.layerIds[0])return;const L=m.collisionBoxArray,M=v.layers[0].layout,R=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),z=m.tileSize/l.W,F=this.transform.calculatePosMatrix(m.tileID.toUnwrapped()),Z=M.get("text-pitch-alignment")==="map",ue=M.get("text-rotation-alignment")==="map",le=Qt(m,1,this.transform.zoom),fe=tn(F,Z,ue,this.transform,le);let ne=null;if(Z){const Be=ba(F,Z,ue,this.transform,le);ne=l.K([],this.transform.labelPlaneMatrix,Be)}this.retainedQueryData[v.bucketInstanceId]=new cn(v.bucketInstanceId,C,v.sourceLayerIndex,v.index,m.tileID);const we={bucket:v,layout:M,posMatrix:F,textLabelPlaneMatrix:fe,labelToScreenMatrix:ne,scale:R,textPixelRatio:z,holdingForFade:m.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:l.ag(v.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(v.sourceID)};if(g)for(const Be of v.sortKeyRanges){const{sortKey:pe,symbolInstanceStart:Pe,symbolInstanceEnd:Ue}=Be;s.push({sortKey:pe,symbolInstanceStart:Pe,symbolInstanceEnd:Ue,parameters:we})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:v.symbolInstances.length,parameters:we})}attemptAnchorPlacement(s,f,m,g,v,C,L,M,R,z,F,Z,ue,le,fe,ne){const we=l.ap[s.textAnchor],Be=[s.textOffset0,s.textOffset1],pe=ai(we,m,g,Be,v),Pe=this.collisionIndex.placeCollisionBox(to(f,pe.x,pe.y,C,L,this.transform.angle),F,M,R,z.predicate,ne);if((!fe||this.collisionIndex.placeCollisionBox(to(fe,pe.x,pe.y,C,L,this.transform.angle),F,M,R,z.predicate,ne).box.length!==0)&&Pe.box.length>0){let Ue;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Ue=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:Be,width:m,height:g,anchor:we,textBoxScale:v,prevAnchor:Ue},this.markUsedJustification(ue,we,Z,le),ue.allowVerticalPlacement&&(this.markUsedOrientation(ue,le,Z),this.placedOrientations[Z.crossTileID]=le),{shift:pe,placedGlyphBoxes:Pe}}}placeLayerBucketPart(s,f,m){const{bucket:g,layout:v,posMatrix:C,textLabelPlaneMatrix:L,labelToScreenMatrix:M,textPixelRatio:R,holdingForFade:z,collisionBoxArray:F,partiallyEvaluatedTextSize:Z,collisionGroup:ue}=s.parameters,le=v.get("text-optional"),fe=v.get("icon-optional"),ne=l.aq(v,"text-overlap","text-allow-overlap"),we=ne==="always",Be=l.aq(v,"icon-overlap","icon-allow-overlap"),pe=Be==="always",Pe=v.get("text-rotation-alignment")==="map",Ue=v.get("text-pitch-alignment")==="map",qe=v.get("icon-text-fit")!=="none",Xe=v.get("symbol-z-order")==="viewport-y",tt=we&&(pe||!g.hasIconData()||fe),$e=pe&&(we||!g.hasTextData()||le);!g.collisionArrays&&F&&g.deserializeCollisionBoxes(F);const ut=this.retainedQueryData[g.bucketInstanceId].tileID,pt=this.terrain?(dt,Ut)=>this.terrain.getElevation(ut,dt,Ut):null,sn=(dt,Ut)=>{var an,Cn;if(f[dt.crossTileID])return;if(z)return void(this.placements[dt.crossTileID]=new hr(!1,!1,!1));let Ht=!1,hn=!1,pn=!0,Lr=null,Wn={box:null,offscreen:null},zo={box:null,offscreen:null},li=null,vr=null,ui=null,Fo=0,Ws=0,$a=0;Ut.textFeatureIndex?Fo=Ut.textFeatureIndex:dt.useRuntimeCollisionCircles&&(Fo=dt.featureIndex),Ut.verticalTextFeatureIndex&&(Ws=Ut.verticalTextFeatureIndex);const wc=Ut.textBox;if(wc){const ri=ii=>{let xr=l.ah.horizontal;if(g.allowVerticalPlacement&&!ii&&this.prevPlacement){const rs=this.prevPlacement.placedOrientations[dt.crossTileID];rs&&(this.placedOrientations[dt.crossTileID]=rs,xr=rs,this.markUsedOrientation(g,xr,dt))}return xr},br=(ii,xr)=>{if(g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&Ut.verticalTextBox){for(const rs of g.writingModes)if(rs===l.ah.vertical?(Wn=xr(),zo=Wn):Wn=ii(),Wn&&Wn.box&&Wn.box.length)break}else Wn=ii()},pr=dt.textAnchorOffsetStartIndex,ns=dt.textAnchorOffsetEndIndex;if(ns===pr){const ii=(xr,rs)=>{const oi=this.collisionIndex.placeCollisionBox(xr,ne,R,C,ue.predicate,pt);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(g,rs,dt),this.placedOrientations[dt.crossTileID]=rs),oi};br(()=>ii(wc,l.ah.horizontal),()=>{const xr=Ut.verticalTextBox;return g.allowVerticalPlacement&&dt.numVerticalGlyphVertices>0&&xr?ii(xr,l.ah.vertical):{box:null,offscreen:null}}),ri(Wn&&Wn.box&&Wn.box.length)}else{let ii=l.ap[(Cn=(an=this.prevPlacement)===null||an===void 0?void 0:an.variableOffsets[dt.crossTileID])===null||Cn===void 0?void 0:Cn.anchor];const xr=(oi,Nr,zp)=>{const Hm=oi.x2-oi.x1,Ol=oi.y2-oi.y1,zl=dt.textBoxScale,Uh=qe&&Be==="never"?Nr:null;let tl={box:[],offscreen:!1},Fp=ne==="never"?1:2,Zm="never";ii&&Fp++;for(let Bp=0;Bpxr(wc,Ut.iconBox,l.ah.horizontal),()=>{const oi=Ut.verticalTextBox;return g.allowVerticalPlacement&&!(Wn&&Wn.box&&Wn.box.length)&&dt.numVerticalGlyphVertices>0&&oi?xr(oi,Ut.verticalIconBox,l.ah.vertical):{box:null,offscreen:null}}),Wn&&(Ht=Wn.box,pn=Wn.offscreen);const rs=ri(Wn&&Wn.box);if(!Ht&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[dt.crossTileID];oi&&(this.variableOffsets[dt.crossTileID]=oi,this.markUsedJustification(g,oi.anchor,dt,rs))}}}if(li=Wn,Ht=li&&li.box&&li.box.length>0,pn=li&&li.offscreen,dt.useRuntimeCollisionCircles){const ri=g.text.placedSymbolArray.get(dt.centerJustifiedTextSymbolIndex),br=l.ai(g.textSizeData,Z,ri),pr=v.get("text-padding");vr=this.collisionIndex.placeCollisionCircles(ne,ri,g.lineVertexArray,g.glyphOffsetArray,br,C,L,M,m,Ue,ue.predicate,dt.collisionCircleDiameter,pr,pt),vr.circles.length&&vr.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Ht=we||vr.circles.length>0&&!vr.collisionDetected,pn=pn&&vr.offscreen}if(Ut.iconFeatureIndex&&($a=Ut.iconFeatureIndex),Ut.iconBox){const ri=br=>{const pr=qe&&Lr?to(br,Lr.x,Lr.y,Pe,Ue,this.transform.angle):br;return this.collisionIndex.placeCollisionBox(pr,Be,R,C,ue.predicate,pt)};zo&&zo.box&&zo.box.length&&Ut.verticalIconBox?(ui=ri(Ut.verticalIconBox),hn=ui.box.length>0):(ui=ri(Ut.iconBox),hn=ui.box.length>0),pn=pn&&ui.offscreen}const el=le||dt.numHorizontalGlyphVertices===0&&dt.numVerticalGlyphVertices===0,Hs=fe||dt.numIconVertices===0;if(el||Hs?Hs?el||(hn=hn&&Ht):Ht=hn&&Ht:hn=Ht=hn&&Ht,Ht&&li&&li.box&&this.collisionIndex.insertCollisionBox(li.box,ne,v.get("text-ignore-placement"),g.bucketInstanceId,zo&&zo.box&&Ws?Ws:Fo,ue.ID),hn&&ui&&this.collisionIndex.insertCollisionBox(ui.box,Be,v.get("icon-ignore-placement"),g.bucketInstanceId,$a,ue.ID),vr&&(Ht&&this.collisionIndex.insertCollisionCircles(vr.circles,ne,v.get("text-ignore-placement"),g.bucketInstanceId,Fo,ue.ID),m)){const ri=g.bucketInstanceId;let br=this.collisionCircleArrays[ri];br===void 0&&(br=this.collisionCircleArrays[ri]=new ti);for(let pr=0;pr=0;--Ut){const an=dt[Ut];sn(g.symbolInstances.get(an),g.collisionArrays[an])}}else for(let dt=s.symbolInstanceStart;dt=0&&(s.text.placedSymbolArray.get(L).crossTileID=v>=0&&L!==v?0:m.crossTileID)}markUsedOrientation(s,f,m){const g=f===l.ah.horizontal||f===l.ah.horizontalOnly?f:0,v=f===l.ah.vertical?f:0,C=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const L of C)s.text.placedSymbolArray.get(L).placedOrientation=g;m.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=v)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let m=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const g=f?f.symbolFadeChange(s):1,v=f?f.opacities:{},C=f?f.variableOffsets:{},L=f?f.placedOrientations:{};for(const M in this.placements){const R=this.placements[M],z=v[M];z?(this.opacities[M]=new Xn(z,g,R.text,R.icon),m=m||R.text!==z.text.placed||R.icon!==z.icon.placed):(this.opacities[M]=new Xn(null,g,R.text,R.icon,R.skipFade),m=m||R.text||R.icon)}for(const M in v){const R=v[M];if(!this.opacities[M]){const z=new Xn(R,g,!1,!1);z.isHidden()||(this.opacities[M]=z,m=m||R.text.placed||R.icon.placed)}}for(const M in C)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=C[M]);for(const M in L)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=L[M]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:s)}updateLayerOpacities(s,f){const m={};for(const g of f){const v=g.getBucket(s);v&&g.latestFeatureIndex&&s.id===v.layerIds[0]&&this.updateBucketOpacities(v,m,g.collisionBoxArray)}}updateBucketOpacities(s,f,m){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const g=s.layers[0],v=g.layout,C=new Xn(null,0,!1,!1,!0),L=v.get("text-allow-overlap"),M=v.get("icon-allow-overlap"),R=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=v.get("text-rotation-alignment")==="map",F=v.get("text-pitch-alignment")==="map",Z=v.get("icon-text-fit")!=="none",ue=new Xn(null,0,L&&(M||!s.hasIconData()||v.get("icon-optional")),M&&(L||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&m&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(m);const le=(fe,ne,we)=>{for(let Be=0;Be0,qe=this.placedOrientations[ne.crossTileID],Xe=qe===l.ah.vertical,tt=qe===l.ah.horizontal||qe===l.ah.horizontalOnly;if(we>0||Be>0){const $e=_o(Pe.text);le(s.text,we,Xe?ec:$e),le(s.text,Be,tt?ec:$e);const ut=Pe.text.isHidden();[ne.rightJustifiedTextSymbolIndex,ne.centerJustifiedTextSymbolIndex,ne.leftJustifiedTextSymbolIndex].forEach(dt=>{dt>=0&&(s.text.placedSymbolArray.get(dt).hidden=ut||Xe?1:0)}),ne.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(ne.verticalPlacedTextSymbolIndex).hidden=ut||tt?1:0);const pt=this.variableOffsets[ne.crossTileID];pt&&this.markUsedJustification(s,pt.anchor,ne,qe);const sn=this.placedOrientations[ne.crossTileID];sn&&(this.markUsedJustification(s,"left",ne,sn),this.markUsedOrientation(s,sn,ne))}if(Ue){const $e=_o(Pe.icon),ut=!(Z&&ne.verticalPlacedIconSymbolIndex&&Xe);ne.placedIconSymbolIndex>=0&&(le(s.icon,ne.numIconVertices,ut?$e:ec),s.icon.placedSymbolArray.get(ne.placedIconSymbolIndex).hidden=Pe.icon.isHidden()),ne.verticalPlacedIconSymbolIndex>=0&&(le(s.icon,ne.numVerticalIconVertices,ut?ec:$e),s.icon.placedSymbolArray.get(ne.verticalPlacedIconSymbolIndex).hidden=Pe.icon.isHidden())}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const $e=s.collisionArrays[fe];if($e){let ut=new l.P(0,0);if($e.textBox||$e.verticalTextBox){let sn=!0;if(R){const dt=this.variableOffsets[pe];dt?(ut=ai(dt.anchor,dt.width,dt.height,dt.textOffset,dt.textBoxScale),z&&ut._rotate(F?this.transform.angle:-this.transform.angle)):sn=!1}$e.textBox&&xi(s.textCollisionBox.collisionVertexArray,Pe.text.placed,!sn||Xe,ut.x,ut.y),$e.verticalTextBox&&xi(s.textCollisionBox.collisionVertexArray,Pe.text.placed,!sn||tt,ut.x,ut.y)}const pt=!!(!tt&&$e.verticalIconBox);$e.iconBox&&xi(s.iconCollisionBox.collisionVertexArray,Pe.icon.placed,pt,Z?ut.x:0,Z?ut.y:0),$e.verticalIconBox&&xi(s.iconCollisionBox.collisionVertexArray,Pe.icon.placed,!pt,Z?ut.x:0,Z?ut.y:0)}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const fe=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=fe.invProjMatrix,s.placementViewportMatrix=fe.viewportMatrix,s.collisionCircleArray=fe.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function xi(y,s,f,m,g){y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0),y.emplaceBack(s?1:0,f?1:0,m||0,g||0)}const Vs=Math.pow(2,25),um=Math.pow(2,24),K_=Math.pow(2,17),jn=Math.pow(2,16),op=Math.pow(2,9),sp=Math.pow(2,8),Ro=Math.pow(2,1);function _o(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const s=y.placed?1:0,f=Math.floor(127*y.opacity);return f*Vs+s*um+f*K_+s*jn+f*op+s*sp+f*Ro+s}const ec=0;class es{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,f,m,g,v){const C=this._bucketParts;for(;this._currentTileIndexL.sortKey-M.sortKey));this._currentPartIndex!this._forceFullPlacement&&I.now()-g>2;for(;this._currentPlacementIndex>=0;){const C=f[s[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(C.type==="symbol"&&(!C.minzoom||C.minzoom<=L)&&(!C.maxzoom||C.maxzoom>L)){if(this._inProgressLayer||(this._inProgressLayer=new es(C)),this._inProgressLayer.continuePlacement(m[C.source],this.placement,this._showCollisionBoxes,C,v))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const uu=512/l.W/2;class nh{constructor(s,f,m){this.tileID=s,this.bucketInstanceId=m,this._symbolsByKey={};const g=new Map;for(let v=0;v({x:Math.floor(M.anchorX*uu),y:Math.floor(M.anchorY*uu)})),crossTileIDs:C.map(M=>M.crossTileID)};if(L.positions.length>128){const M=new l.au(L.positions.length,16,Uint16Array);for(const{x:R,y:z}of L.positions)M.add(R,z);M.finish(),delete L.positions,L.index=M}this._symbolsByKey[v]=L}}getScaledCoordinates(s,f){const{x:m,y:g,z:v}=this.tileID.canonical,{x:C,y:L,z:M}=f.canonical,R=uu/Math.pow(2,M-v),z=(L*l.W+s.anchorY)*R,F=g*l.W*uu;return{x:Math.floor((C*l.W+s.anchorX)*R-m*l.W*uu),y:Math.floor(z-F)}}findMatches(s,f,m){const g=this.tileID.canonical.zs)}}class ni{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tc{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const f=Math.round((s-this.lng)/360);if(f!==0)for(const m in this.indexes){const g=this.indexes[m],v={};for(const C in g){const L=g[C];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+f),v[L.tileID.key]=L}this.indexes[m]=v}this.lng=s}addBucket(s,f,m){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let v=0;vs.overscaledZ)for(const L in C){const M=C[L];M.tileID.isChildOf(s)&&M.findMatches(f.symbolInstances,s,g)}else{const L=C[s.scaledTo(Number(v)).key];L&&L.findMatches(f.symbolInstances,s,g)}}for(let v=0;v{f[m]=!0});for(const m in this.layerIndexes)f[m]||delete this.layerIndexes[m]}}const yr=(y,s)=>l.t(y,s&&s.filter(f=>f.identifier!=="source.canvas")),rh=l.av();class No extends l.E{constructor(s,f={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const g=this.sourceCaches[m].getSource().type;g!=="vector"&&g!=="geojson"||this.sourceCaches[m].reload()}},this.map=s,this.dispatcher=new ir(Bn(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,g)=>this.getGlyphs(m,g)),this.dispatcher.registerMessageHandler("GI",(m,g)=>this.getImages(m,g)),this.imageManager=new Ye,this.imageManager.setEventedParent(this),this.glyphManager=new Ge(s._requestManager,f.localIdeographFontFamily),this.lineAtlas=new Xt(256,512),this.crossTileSymbolIndex=new Za,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.aw,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ax()),at().on(Ai,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const g=this.sourceCaches[m.sourceId];if(!g)return;const v=g.getSource();if(v&&v.vectorLayerIds)for(const C in this._layers){const L=this._layers[C];L.source===v.id&&this._validateLayer(L)}})}loadURL(s,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const g=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController,l.h(g,this._loadStyleRequest).then(v=>{this._loadStyleRequest=null,this._load(v.data,f,m)}).catch(v=>{this._loadStyleRequest=null,v&&this.fire(new l.j(v))})}loadJSON(s,f={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(s,f,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(rh,{validate:!1})}_load(s,f,m){var g;const v=f.transformStyle?f.transformStyle(m,s):s;if(!f.validate||!yr(this,l.x(v))){this._loaded=!0,this.stylesheet=v;for(const C in v.sources)this.addSource(C,v.sources[C],{validate:!1});v.sprite?this._loadSprite(v.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(v.glyphs),this._createLayers(),this.light=new Zt(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const s=l.ay(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(f=>f.id),this._layers={},this._serializedLayers=null;for(const f of s){const m=l.az(f);m.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=m}}_loadSprite(s,f=!1,m=void 0){let g;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(v,C,L,M){return l._(this,void 0,void 0,function*(){const R=Ae(v),z=L>1?"@2x":"",F={},Z={};for(const{id:ue,url:le}of R){const fe=C.transformRequest(C.normalizeSpriteURL(le,z,".json"),"SpriteJSON");F[ue]=l.h(fe,M);const ne=C.transformRequest(C.normalizeSpriteURL(le,z,".png"),"SpriteImage");Z[ue]=j.getImage(ne,M)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(ue,le){return l._(this,void 0,void 0,function*(){const fe={};for(const ne in ue){fe[ne]={};const we=I.getImageCanvasContext((yield le[ne]).data),Be=(yield ue[ne]).data;for(const pe in Be){const{width:Pe,height:Ue,x:qe,y:Xe,sdf:tt,pixelRatio:$e,stretchX:ut,stretchY:pt,content:sn}=Be[pe];fe[ne][pe]={data:null,pixelRatio:$e,sdf:tt,stretchX:ut,stretchY:pt,content:sn,spriteData:{width:Pe,height:Ue,x:qe,y:Xe,context:we}}}}return fe})}(F,Z)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(v=>{if(this._spriteRequest=null,v)for(const C in v){this._spritesImagesIds[C]=[];const L=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(M=>!(M in v)):[];for(const M of L)this.imageManager.removeImage(M),this._changedImages[M]=!0;for(const M in v[C]){const R=C==="default"?M:`${C}:${M}`;this._spritesImagesIds[C].push(R),R in this.imageManager.images?this.imageManager.updateImage(R,v[C][M],!1):this.imageManager.addImage(R,v[C][M]),f&&(this._changedImages[R]=!0)}}}).catch(v=>{this._spriteRequest=null,g=v,this.fire(new l.j(g))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(g)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(s){const f=this.sourceCaches[s.source];if(!f)return;const m=s.sourceLayer;if(!m)return;const g=f.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${g.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(f);const m=[];for(const g of s)f[g]&&m.push(f[g]);return m}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const f=Object.keys(this._layers);for(const m of f){const g=this._layers[m];g.type!=="custom"&&(s[m]=g.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const f=this._changed;if(f){const g=Object.keys(this._updatedLayers),v=Object.keys(this._removedLayers);(g.length||v.length)&&this._updateWorkerLayers(g,v);for(const C in this._updatedSources){const L=this._updatedSources[C];if(L==="reload")this._reloadSource(C);else{if(L!=="clear")throw new Error(`Invalid action ${L}`);this._clearSource(C)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const C in this._updatedPaintProps)this._layers[C].updateTransitions(s);this.light.updateTransitions(s),this._resetUpdates()}const m={};for(const g in this.sourceCaches){const v=this.sourceCaches[g];m[g]=v.used,v.used=!1}for(const g of this._order){const v=this._layers[g];v.recalculate(s,this._availableImages),!v.isHidden(s.zoom)&&v.source&&(this.sourceCaches[v.source].used=!0)}for(const g in m){const v=this.sourceCaches[g];!!m[g]!=!!v.used&&v.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(s),this.z=s.zoom,f&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,f={}){var m;this._checkLoaded();const g=this.serialize();if(s=f.transformStyle?f.transformStyle(g,s):s,((m=f.validate)===null||m===void 0||m)&&yr(this,l.x(s)))return!1;(s=l.aA(s)).layers=l.ay(s.layers);const v=l.aB(g,s),C=this._getOperationsToPerform(v);if(C.unimplemented.length>0)throw new Error(`Unimplemented: ${C.unimplemented.join(", ")}.`);if(C.operations.length===0)return!1;for(const L of C.operations)L();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const f=[],m=[];for(const g of s)switch(g.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push(()=>this.addLayer.apply(this,g.args));break;case"removeLayer":f.push(()=>this.removeLayer.apply(this,g.args));break;case"setPaintProperty":f.push(()=>this.setPaintProperty.apply(this,g.args));break;case"setLayoutProperty":f.push(()=>this.setLayoutProperty.apply(this,g.args));break;case"setFilter":f.push(()=>this.setFilter.apply(this,g.args));break;case"addSource":f.push(()=>this.addSource.apply(this,g.args));break;case"removeSource":f.push(()=>this.removeSource.apply(this,g.args));break;case"setLayerZoomRange":f.push(()=>this.setLayerZoomRange.apply(this,g.args));break;case"setLight":f.push(()=>this.setLight.apply(this,g.args));break;case"setGeoJSONSourceData":f.push(()=>this.setGeoJSONSourceData.apply(this,g.args));break;case"setGlyphs":f.push(()=>this.setGlyphs.apply(this,g.args));break;case"setSprite":f.push(()=>this.setSprite.apply(this,g.args));break;case"setTerrain":f.push(()=>this.map.setTerrain.apply(this,g.args));break;case"setTransition":f.push(()=>{});break;default:m.push(g.command)}return{operations:f,unimplemented:m}}addImage(s,f){if(this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,f),this._afterImageUpdated(s)}updateImage(s,f){this.imageManager.updateImage(s,f)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,f,m={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(l.x.source,`sources.${s}`,f,null,m))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const g=this.sourceCaches[s]=new ei(s,f,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:s})),g.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===s)return this.fire(new l.j(new Error(`Source "${s}" cannot be removed while layer "${m}" is using it.`)));const f=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],f.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,f){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const m=this.sourceCaches[s].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(f),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,f,m={}){this._checkLoaded();const g=s.id;if(this.getLayer(g))return void this.fire(new l.j(new Error(`Layer "${g}" already exists on this map.`)));let v;if(s.type==="custom"){if(yr(this,l.aC(s)))return;v=l.az(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(g,s.source),s=l.aA(s),s=l.e(s,{source:g})),this._validate(l.x.layer,`layers.${g}`,s,{arrayIndex:-1},m))return;v=l.az(s),this._validateLayer(v),v.setEventedParent(this,{layer:{id:g}})}const C=f?this._order.indexOf(f):this._order.length;if(f&&C===-1)this.fire(new l.j(new Error(`Cannot add layer "${g}" before non-existing layer "${f}".`)));else{if(this._order.splice(C,0,g),this._layerOrderChanged=!0,this._layers[g]=v,this._removedLayers[g]&&v.source&&v.type!=="custom"){const L=this._removedLayers[g];delete this._removedLayers[g],L.type!==v.type?this._updatedSources[v.source]="clear":(this._updatedSources[v.source]="reload",this.sourceCaches[v.source].pause())}this._updateLayer(v),v.onAdd&&v.onAdd(this.map)}}moveLayer(s,f){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new l.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===f)return;const m=this._order.indexOf(s);this._order.splice(m,1);const g=f?this._order.indexOf(f):this._order.length;f&&g===-1?this.fire(new l.j(new Error(`Cannot move layer "${s}" before non-existing layer "${f}".`))):(this._order.splice(g,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const f=this._layers[s];if(!f)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${s}".`)));f.setEventedParent(null);const m=this._order.indexOf(s);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=f,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],f.onRemove&&f.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,f,m){this._checkLoaded();const g=this.getLayer(s);g?g.minzoom===f&&g.maxzoom===m||(f!=null&&(g.minzoom=f),m!=null&&(g.maxzoom=m),this._updateLayer(g)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,f,m={}){this._checkLoaded();const g=this.getLayer(s);if(g){if(!l.aD(g.filter,f))return f==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(l.x.filter,`layers.${g.id}.filter`,f,null,m)||(g.filter=l.aA(f),this._updateLayer(g)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return l.aA(this.getLayer(s).filter)}setLayoutProperty(s,f,m,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getLayoutProperty(f),m)||(v.setLayoutProperty(f,m,g),this._updateLayer(v)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,f){const m=this.getLayer(s);if(m)return m.getLayoutProperty(f);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,f,m,g={}){this._checkLoaded();const v=this.getLayer(s);v?l.aD(v.getPaintProperty(f),m)||(v.setPaintProperty(f,m,g)&&this._updateLayer(v),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,f){return this.getLayer(s).getPaintProperty(f)}setFeatureState(s,f){this._checkLoaded();const m=s.source,g=s.sourceLayer,v=this.sourceCaches[m];if(v===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const C=v.getSource().type;C==="geojson"&&g?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||g?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),v.setFeatureState(g,s.id,f)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,f){this._checkLoaded();const m=s.source,g=this.sourceCaches[m];if(g===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const v=g.getSource().type,C=v==="vector"?s.sourceLayer:void 0;v!=="vector"||C?f&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(C,s.id,f):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const f=s.source,m=s.sourceLayer,g=this.sourceCaches[f];if(g!==void 0)return g.getSource().type!=="vector"||m?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),g.getFeatureState(m,s.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=l.aE(this.sourceCaches,v=>v.serialize()),f=this._serializeByIds(this._order),m=this.map.getTerrain()||void 0,g=this.stylesheet;return l.aF({version:g.version,name:g.name,metadata:g.metadata,light:g.light,center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch,sprite:g.sprite,glyphs:g.glyphs,transition:g.transition,sources:s,layers:f,terrain:m},v=>v!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const f=C=>this._layers[C].type==="fill-extrusion",m={},g=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L)){m[L]=C;for(const M of s){const R=M[L];if(R)for(const z of R)g.push(z)}}}g.sort((C,L)=>L.intersectionZ-C.intersectionZ);const v=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(f(L))for(let M=g.length-1;M>=0;M--){const R=g[M].feature;if(m[R.layer.id]{const tt=we.featureSortOrder;if(tt){const $e=tt.indexOf(qe.featureIndex);return tt.indexOf(Xe.featureIndex)-$e}return Xe.featureIndex-qe.featureIndex});for(const qe of Ue)Pe.push(qe)}}for(const we in le)le[we].forEach(Be=>{const pe=Be.feature,Pe=R[L[we].source].getFeatureState(pe.layer["source-layer"],pe.id);pe.source=pe.layer.source,pe.layer["source-layer"]&&(pe.sourceLayer=pe.layer["source-layer"]),pe.state=Pe});return le}(this._layers,C,this.sourceCaches,s,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(v)}querySourceFeatures(s,f){f&&f.filter&&this._validate(l.x.filter,"querySourceFeatures.filter",f.filter,null,f);const m=this.sourceCaches[s];return m?function(g,v){const C=g.getRenderableIds().map(R=>g.getTileByID(R)),L=[],M={};for(let R=0;RZ.getTileByID(ue)).sort((ue,le)=>le.tileID.overscaledZ-ue.tileID.overscaledZ||(ue.tileID.isLessThan(le.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(z,M[z.source],s.center.lng);C=C||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((v=v||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(I.now(),s.zoom))&&(this.pauseablePlacement=new ts(s,this.map.terrain,this._order,v,f,m,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(I.now()),L=!0),C&&this.pauseablePlacement.placement.setStale()),L||C)for(const R of this._order){const z=this._layers[R];z.type==="symbol"&&this.placement.updateLayerOpacities(z,M[z.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(I.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,f){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,f.icons),m})}getGlyphs(s,f){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(f.stacks),g=this.sourceCaches[f.source];return g&&g.setDependencies(f.tileID.key,f.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,f={}){this._checkLoaded(),s&&this._validate(l.x.glyphs,"glyphs",s,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,f,m={},g){this._checkLoaded();const v=[{id:s,url:f}],C=[...Ae(this.stylesheet.sprite),...v];this._validate(l.x.sprite,"sprite",C,null,m)||(this.stylesheet.sprite=C,this._loadSprite(v,!0,g))}removeSprite(s){this._checkLoaded();const f=Ae(this.stylesheet.sprite);if(f.find(m=>m.id===s)){if(this._spritesImagesIds[s])for(const m of this._spritesImagesIds[s])this.imageManager.removeImage(m),this._changedImages[m]=!0;f.splice(f.findIndex(m=>m.id===s),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ae(this.stylesheet.sprite)}setSprite(s,f={},m){this._checkLoaded(),s&&this._validate(l.x.sprite,"sprite",s,null,f)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,m):(this._unloadSprite(),m&&m(null)))}}var ih=l.X([{name:"a_pos",type:"Int16",components:2}]),Us="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 nc={prelude:qn(`#ifdef GL_ES -precision mediump float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -`,`#ifdef GL_ES -precision highp float; -#else -#if !defined(lowp) -#define lowp -#endif -#if !defined(mediump) -#define mediump -#endif -#if !defined(highp) -#define highp -#endif -#endif -vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 -);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} -#ifdef TERRAIN3D -uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; -#endif -const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { -#ifdef TERRAIN3D -highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); -#else -return 1.0; -#endif -}float calculate_visibility(vec4 pos) { -#ifdef TERRAIN3D -vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; -#else -return 1.0; -#endif -}float ele(vec2 pos) { -#ifdef TERRAIN3D -vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; -#else -return 0.0; -#endif -}float get_elevation(vec2 pos) { -#ifdef TERRAIN3D -vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; -#else -return 0.0; -#endif -}`),background:qn(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:qn(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:qn(`varying vec3 v_data;varying float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define mediump float radius -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define highp vec4 stroke_color -#pragma mapbox: define mediump float stroke_width -#pragma mapbox: define lowp float stroke_opacity -void main(void) { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize mediump float radius -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize highp vec4 stroke_color -#pragma mapbox: initialize mediump float stroke_width -#pragma mapbox: initialize lowp float stroke_opacity -vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:qn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:qn(`uniform highp float u_intensity;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#define GAUSS_COEF 0.3989422804014327 -void main() { -#pragma mapbox: initialize highp float weight -float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; -#pragma mapbox: define highp float weight -#pragma mapbox: define mediump float radius -const highp float ZERO=1.0/255.0/16.0; -#define GAUSS_COEF 0.3989422804014327 -void main(void) { -#pragma mapbox: initialize highp float weight -#pragma mapbox: initialize mediump float radius -vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:qn(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(0.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:qn("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:qn("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:qn("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:qn(`#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_FragColor=color*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:qn(`varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:qn(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:qn(`#ifdef GL_ES -precision highp float; -#endif -uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:qn(`varying vec4 v_color;void main() {gl_FragColor=v_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec4 v_color; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -vec3 normal=a_normal_ed.xyz; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:qn(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; -#ifdef TERRAIN3D -attribute vec2 a_centroid; -#endif -varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; -#ifdef TERRAIN3D -float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); -#else -float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; -#endif -base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 -? a_pos -: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:qn(`#ifdef GL_ES -precision highp float; -#endif -uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:qn(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; -#define PI 3.141592653589793 -void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:qn(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_width2=vec2(outset,inset);}`),lineGradient:qn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_width2=vec2(outset,inset);}`),linePattern:qn(`#ifdef GL_ES -precision highp float; -#endif -uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:qn(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; -#ifdef TERRAIN3D -v_gamma_scale=1.0; -#else -float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; -#endif -v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:qn(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:qn(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:qn(`#define SDF_PX 8.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:qn(`#define SDF_PX 8.0 -#define SDF 1.0 -#define ICON 0.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:qn("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Us),terrainDepth:qn("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Us),terrainCoords:qn("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Us)};function qn(y,s){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,m=s.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=s.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=v?v.concat(g):g,L={};return{fragmentSource:y=y.replace(f,(M,R,z,F,Z)=>(L[Z]=!0,R==="define"?` -#ifndef HAS_UNIFORM_u_${Z} -varying ${z} ${F} ${Z}; -#else -uniform ${z} ${F} u_${Z}; -#endif -`:` -#ifdef HAS_UNIFORM_u_${Z} - ${z} ${F} ${Z} = u_${Z}; -#endif -`)),vertexSource:s=s.replace(f,(M,R,z,F,Z)=>{const ue=F==="float"?"vec2":"vec4",le=Z.match(/color/)?"color":ue;return L[Z]?R==="define"?` -#ifndef HAS_UNIFORM_u_${Z} -uniform lowp float u_${Z}_t; -attribute ${z} ${ue} a_${Z}; -varying ${z} ${F} ${Z}; -#else -uniform ${z} ${F} u_${Z}; -#endif -`:le==="vec4"?` -#ifndef HAS_UNIFORM_u_${Z} - ${Z} = a_${Z}; -#else - ${z} ${F} ${Z} = u_${Z}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${Z} - ${Z} = unpack_mix_${le}(a_${Z}, u_${Z}_t); -#else - ${z} ${F} ${Z} = u_${Z}; -#endif -`:R==="define"?` -#ifndef HAS_UNIFORM_u_${Z} -uniform lowp float u_${Z}_t; -attribute ${z} ${ue} a_${Z}; -#else -uniform ${z} ${F} u_${Z}; -#endif -`:le==="vec4"?` -#ifndef HAS_UNIFORM_u_${Z} - ${z} ${F} ${Z} = a_${Z}; -#else - ${z} ${F} ${Z} = u_${Z}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${Z} - ${z} ${F} ${Z} = unpack_mix_${le}(a_${Z}, u_${Z}_t); -#else - ${z} ${F} ${Z} = u_${Z}; -#endif -`}),staticAttributes:m,staticUniforms:C}}class oh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(s,f,m,g,v,C,L,M,R){this.context=s;let z=this.boundPaintVertexBuffers.length!==g.length;for(let F=0;!z&&F({u_depth:new l.aG(qe,Xe.u_depth),u_terrain:new l.aG(qe,Xe.u_terrain),u_terrain_dim:new l.aH(qe,Xe.u_terrain_dim),u_terrain_matrix:new l.aI(qe,Xe.u_terrain_matrix),u_terrain_unpack:new l.aJ(qe,Xe.u_terrain_unpack),u_terrain_exaggeration:new l.aH(qe,Xe.u_terrain_exaggeration)}))(s,Ue),this.binderUniforms=m?m.getUniforms(s,Ue):[]}draw(s,f,m,g,v,C,L,M,R,z,F,Z,ue,le,fe,ne,we,Be){const pe=s.gl;if(this.failedToCreate)return;if(s.program.set(this.program),s.setDepthMode(m),s.setStencilMode(g),s.setColorMode(v),s.setCullFace(C),M){s.activeTexture.set(pe.TEXTURE2),pe.bindTexture(pe.TEXTURE_2D,M.depthTexture),s.activeTexture.set(pe.TEXTURE3),pe.bindTexture(pe.TEXTURE_2D,M.texture);for(const Ue in this.terrainUniforms)this.terrainUniforms[Ue].set(M[Ue])}for(const Ue in this.fixedUniforms)this.fixedUniforms[Ue].set(L[Ue]);fe&&fe.setUniforms(s,this.binderUniforms,ue,{zoom:le});let Pe=0;switch(f){case pe.LINES:Pe=2;break;case pe.TRIANGLES:Pe=3;break;case pe.LINE_STRIP:Pe=1}for(const Ue of Z.get()){const qe=Ue.vaos||(Ue.vaos={});(qe[R]||(qe[R]=new oh)).bind(s,this,z,fe?fe.getPaintVertexBuffers():[],F,Ue.vertexOffset,ne,we,Be),pe.drawElements(f,Ue.primitiveLength*Pe,pe.UNSIGNED_SHORT,Ue.primitiveOffset*Pe*2)}}}function sh(y,s,f){const m=1/Qt(f,1,s.transform.tileZoom),g=Math.pow(2,f.tileID.overscaledZ),v=f.tileSize*Math.pow(2,s.transform.tileZoom)/g,C=v*(f.tileID.canonical.x+f.tileID.wrap*g),L=v*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[m,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[C>>16,L>>16],u_pixel_coord_lower:[65535&C,65535&L]}}const rc=(y,s,f,m)=>{const g=s.style.light,v=g.properties.get("position"),C=[v.x,v.y,v.z],L=function(){var R=new l.A(9);return l.A!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[5]=0,R[6]=0,R[7]=0),R[0]=1,R[4]=1,R[8]=1,R}();g.properties.get("anchor")==="viewport"&&function(R,z){var F=Math.sin(z),Z=Math.cos(z);R[0]=Z,R[1]=F,R[2]=0,R[3]=-F,R[4]=Z,R[5]=0,R[6]=0,R[7]=0,R[8]=1}(L,-s.transform.angle),function(R,z,F){var Z=z[0],ue=z[1],le=z[2];R[0]=Z*F[0]+ue*F[3]+le*F[6],R[1]=Z*F[1]+ue*F[4]+le*F[7],R[2]=Z*F[2]+ue*F[5]+le*F[8]}(C,C,L);const M=g.properties.get("color");return{u_matrix:y,u_lightpos:C,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+f,u_opacity:m}},J_=(y,s,f,m,g,v,C)=>l.e(rc(y,s,f,m),sh(v,s,C),{u_height_factor:-Math.pow(2,g.overscaledZ)/C.tileSize/8}),cm=y=>({u_matrix:y}),ah=(y,s,f,m)=>l.e(cm(y),sh(f,s,m)),Q_=(y,s)=>({u_matrix:y,u_world:s}),hm=(y,s,f,m,g)=>l.e(ah(y,s,f,m),{u_world:g}),$_=(y,s,f,m)=>{const g=y.transform;let v,C;if(m.paint.get("circle-pitch-alignment")==="map"){const L=Qt(f,1,g.zoom);v=!0,C=[L,L]}else v=!1,C=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(s.posMatrix,f,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+v,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:C}},fm=(y,s,f)=>{const m=Qt(f,1,s.zoom),g=Math.pow(2,s.zoom-f.tileID.overscaledZ),v=f.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:s.cameraToCenterDistance,u_pixels_to_tile_units:m,u_extrude_scale:[s.pixelsToGLUnits[0]/(m*g),s.pixelsToGLUnits[1]/(m*g)],u_overscale_factor:v}},pm=(y,s,f=1)=>({u_matrix:y,u_color:s,u_overlay:0,u_overlay_scale:f}),lh=y=>({u_matrix:y}),dm=(y,s,f,m)=>({u_matrix:y,u_extrude_scale:Qt(s,1,f),u_intensity:m});function mm(y,s){const f=Math.pow(2,s.canonical.z),m=s.canonical.y;return[new l.Y(0,m/f).toLngLat().lat,new l.Y(0,(m+1)/f).toLngLat().lat]}const uh=(y,s,f,m)=>{const g=y.transform;return{u_matrix:ic(y,s,f,m),u_ratio:1/Qt(s,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},gm=(y,s,f,m,g)=>l.e(uh(y,s,f,g),{u_image:0,u_image_height:m}),Ll=(y,s,f,m,g)=>{const v=y.transform,C=Oo(s,v);return{u_matrix:ic(y,s,f,g),u_texsize:s.imageAtlasTexture.size,u_ratio:1/Qt(s,1,v.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[C,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]]}},ch=(y,s,f,m,g,v)=>{const C=y.lineAtlas,L=Oo(s,y.transform),M=f.layout.get("line-cap")==="round",R=C.getDash(m.from,M),z=C.getDash(m.to,M),F=R.width*g.fromScale,Z=z.width*g.toScale;return l.e(uh(y,s,f,v),{u_patternscale_a:[L/F,-R.height/2],u_patternscale_b:[L/Z,-z.height/2],u_sdfgamma:C.width/(256*Math.min(F,Z)*y.pixelRatio)/2,u_image:0,u_tex_y_a:R.y,u_tex_y_b:z.y,u_mix:g.t})};function Oo(y,s){return 1/Qt(y,1,s.tileZoom)}function ic(y,s,f,m){return y.translatePosMatrix(m?m.posMatrix:s.tileID.posMatrix,s,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const hh=(y,s,f,m,g)=>{return{u_matrix:y,u_tl_parent:s,u_scale_parent:f,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(C=g.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(v=g.paint.get("raster-contrast"),v>0?1/(1-v):1+v),u_spin_weights:oc(g.paint.get("raster-hue-rotate"))};var v,C};function oc(y){y*=Math.PI/180;const s=Math.sin(y),f=Math.cos(y);return[(2*f+1)/3,(-Math.sqrt(3)*s-f+1)/3,(Math.sqrt(3)*s-f+1)/3]}const sc=(y,s,f,m,g,v,C,L,M,R)=>{const z=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:z.cameraToCenterDistance,u_pitch:z.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:z.width/z.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:v,u_label_plane_matrix:C,u_coord_matrix:L,u_is_text:+M,u_pitch_with_map:+m,u_texsize:R,u_texture:0}},ac=(y,s,f,m,g,v,C,L,M,R,z)=>{const F=g.transform;return l.e(sc(y,s,f,m,g,v,C,L,M,R),{u_gamma_scale:m?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+z})},lc=(y,s,f,m,g,v,C,L,M,R)=>l.e(ac(y,s,f,m,g,v,C,L,!0,M,!0),{u_texsize_icon:R,u_texture_icon:1}),ey=(y,s,f)=>({u_matrix:y,u_opacity:s,u_color:f}),ty=(y,s,f,m,g,v)=>l.e(function(C,L,M,R){const z=M.imageManager.getPattern(C.from.toString()),F=M.imageManager.getPattern(C.to.toString()),{width:Z,height:ue}=M.imageManager.getPixelSize(),le=Math.pow(2,R.tileID.overscaledZ),fe=R.tileSize*Math.pow(2,M.transform.tileZoom)/le,ne=fe*(R.tileID.canonical.x+R.tileID.wrap*le),we=fe*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:z.tl,u_pattern_br_a:z.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[Z,ue],u_mix:L.t,u_pattern_size_a:z.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Qt(R,1,M.transform.tileZoom),u_pixel_coord_upper:[ne>>16,we>>16],u_pixel_coord_lower:[65535&ne,65535&we]}}(m,v,f,g),{u_matrix:y,u_opacity:s}),_m={fillExtrusion:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_opacity:new l.aH(y,s.u_opacity)}),fillExtrusionPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_lightpos:new l.aK(y,s.u_lightpos),u_lightintensity:new l.aH(y,s.u_lightintensity),u_lightcolor:new l.aK(y,s.u_lightcolor),u_vertical_gradient:new l.aH(y,s.u_vertical_gradient),u_height_factor:new l.aH(y,s.u_height_factor),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade),u_opacity:new l.aH(y,s.u_opacity)}),fill:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),fillPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),fillOutline:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world)}),fillOutlinePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_texsize:new l.aL(y,s.u_texsize),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),circle:(y,s)=>({u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_scale_with_map:new l.aG(y,s.u_scale_with_map),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_matrix:new l.aI(y,s.u_matrix)}),collisionBox:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pixels_to_tile_units:new l.aH(y,s.u_pixels_to_tile_units),u_extrude_scale:new l.aL(y,s.u_extrude_scale),u_overscale_factor:new l.aH(y,s.u_overscale_factor)}),collisionCircle:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_inv_matrix:new l.aI(y,s.u_inv_matrix),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_viewport_size:new l.aL(y,s.u_viewport_size)}),debug:(y,s)=>({u_color:new l.aM(y,s.u_color),u_matrix:new l.aI(y,s.u_matrix),u_overlay:new l.aG(y,s.u_overlay),u_overlay_scale:new l.aH(y,s.u_overlay_scale)}),clippingMask:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix)}),heatmap:(y,s)=>({u_extrude_scale:new l.aH(y,s.u_extrude_scale),u_intensity:new l.aH(y,s.u_intensity),u_matrix:new l.aI(y,s.u_matrix)}),heatmapTexture:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_world:new l.aL(y,s.u_world),u_image:new l.aG(y,s.u_image),u_color_ramp:new l.aG(y,s.u_color_ramp),u_opacity:new l.aH(y,s.u_opacity)}),hillshade:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_latrange:new l.aL(y,s.u_latrange),u_light:new l.aL(y,s.u_light),u_shadow:new l.aM(y,s.u_shadow),u_highlight:new l.aM(y,s.u_highlight),u_accent:new l.aM(y,s.u_accent)}),hillshadePrepare:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_image:new l.aG(y,s.u_image),u_dimension:new l.aL(y,s.u_dimension),u_zoom:new l.aH(y,s.u_zoom),u_unpack:new l.aJ(y,s.u_unpack)}),line:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels)}),lineGradient:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_image:new l.aG(y,s.u_image),u_image_height:new l.aH(y,s.u_image_height)}),linePattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texsize:new l.aL(y,s.u_texsize),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_image:new l.aG(y,s.u_image),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_scale:new l.aK(y,s.u_scale),u_fade:new l.aH(y,s.u_fade)}),lineSDF:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ratio:new l.aH(y,s.u_ratio),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_units_to_pixels:new l.aL(y,s.u_units_to_pixels),u_patternscale_a:new l.aL(y,s.u_patternscale_a),u_patternscale_b:new l.aL(y,s.u_patternscale_b),u_sdfgamma:new l.aH(y,s.u_sdfgamma),u_image:new l.aG(y,s.u_image),u_tex_y_a:new l.aH(y,s.u_tex_y_a),u_tex_y_b:new l.aH(y,s.u_tex_y_b),u_mix:new l.aH(y,s.u_mix)}),raster:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_tl_parent:new l.aL(y,s.u_tl_parent),u_scale_parent:new l.aH(y,s.u_scale_parent),u_buffer_scale:new l.aH(y,s.u_buffer_scale),u_fade_t:new l.aH(y,s.u_fade_t),u_opacity:new l.aH(y,s.u_opacity),u_image0:new l.aG(y,s.u_image0),u_image1:new l.aG(y,s.u_image1),u_brightness_low:new l.aH(y,s.u_brightness_low),u_brightness_high:new l.aH(y,s.u_brightness_high),u_saturation_factor:new l.aH(y,s.u_saturation_factor),u_contrast_factor:new l.aH(y,s.u_contrast_factor),u_spin_weights:new l.aK(y,s.u_spin_weights)}),symbolIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture)}),symbolSDF:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texture:new l.aG(y,s.u_texture),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),symbolTextAndIcon:(y,s)=>({u_is_size_zoom_constant:new l.aG(y,s.u_is_size_zoom_constant),u_is_size_feature_constant:new l.aG(y,s.u_is_size_feature_constant),u_size_t:new l.aH(y,s.u_size_t),u_size:new l.aH(y,s.u_size),u_camera_to_center_distance:new l.aH(y,s.u_camera_to_center_distance),u_pitch:new l.aH(y,s.u_pitch),u_rotate_symbol:new l.aG(y,s.u_rotate_symbol),u_aspect_ratio:new l.aH(y,s.u_aspect_ratio),u_fade_change:new l.aH(y,s.u_fade_change),u_matrix:new l.aI(y,s.u_matrix),u_label_plane_matrix:new l.aI(y,s.u_label_plane_matrix),u_coord_matrix:new l.aI(y,s.u_coord_matrix),u_is_text:new l.aG(y,s.u_is_text),u_pitch_with_map:new l.aG(y,s.u_pitch_with_map),u_texsize:new l.aL(y,s.u_texsize),u_texsize_icon:new l.aL(y,s.u_texsize_icon),u_texture:new l.aG(y,s.u_texture),u_texture_icon:new l.aG(y,s.u_texture_icon),u_gamma_scale:new l.aH(y,s.u_gamma_scale),u_device_pixel_ratio:new l.aH(y,s.u_device_pixel_ratio),u_is_halo:new l.aG(y,s.u_is_halo)}),background:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_color:new l.aM(y,s.u_color)}),backgroundPattern:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_opacity:new l.aH(y,s.u_opacity),u_image:new l.aG(y,s.u_image),u_pattern_tl_a:new l.aL(y,s.u_pattern_tl_a),u_pattern_br_a:new l.aL(y,s.u_pattern_br_a),u_pattern_tl_b:new l.aL(y,s.u_pattern_tl_b),u_pattern_br_b:new l.aL(y,s.u_pattern_br_b),u_texsize:new l.aL(y,s.u_texsize),u_mix:new l.aH(y,s.u_mix),u_pattern_size_a:new l.aL(y,s.u_pattern_size_a),u_pattern_size_b:new l.aL(y,s.u_pattern_size_b),u_scale_a:new l.aH(y,s.u_scale_a),u_scale_b:new l.aH(y,s.u_scale_b),u_pixel_coord_upper:new l.aL(y,s.u_pixel_coord_upper),u_pixel_coord_lower:new l.aL(y,s.u_pixel_coord_lower),u_tile_units_to_pixels:new l.aH(y,s.u_tile_units_to_pixels)}),terrain:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainDepth:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_ele_delta:new l.aH(y,s.u_ele_delta)}),terrainCoords:(y,s)=>({u_matrix:new l.aI(y,s.u_matrix),u_texture:new l.aG(y,s.u_texture),u_terrain_coords_id:new l.aH(y,s.u_terrain_coords_id),u_ele_delta:new l.aH(y,s.u_ele_delta)})};class ny{constructor(s,f,m){this.context=s;const g=s.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),s.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(s){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,s.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Pl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class fh{constructor(s,f,m,g){this.length=f.length,this.attributes=m,this.itemSize=f.bytesPerElement,this.dynamicDraw=g,this.context=s;const v=s.gl;this.buffer=v.createBuffer(),s.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(s){if(s.length!==this.length)throw new Error(`Length of new data is ${s.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,s.arrayBuffer)}enableAttributes(s,f){for(let m=0;m0){const ut=l.F(),pt=Xe;l.aP(ut,qe.placementInvProjMatrix,y.transform.glCoordMatrix),l.aP(ut,ut,qe.placementViewportMatrix),z.push({circleArray:$e,circleOffset:Z,transform:pt,invTransform:ut,coord:Pe}),F+=$e.length/4,Z=F}tt&&R.draw(L,M.LINES,In.disabled,sr.disabled,y.colorModeForRenderPass(),er.disabled,fm(Xe,y.transform,Ue),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Pe),f.id,tt.layoutVertexBuffer,tt.indexBuffer,tt.segments,null,y.transform.zoom,null,null,tt.collisionVertexBuffer)}if(!C||!z.length)return;const ue=y.useProgram("collisionCircle"),le=new l.aQ;le.resize(4*F),le._trim();let fe=0;for(const pe of z)for(let Pe=0;Pe=0&&(le[ne.associatedIconIndex]={shiftedAnchor:sn,angle:dt})}else Ke(ne.numGlyphs,Z)}if(R){ue.clear();const fe=y.icon.placedSymbolArray;for(let ne=0;ney.style.map.terrain.getElevation(tt,rs,oi):null,xr=f.layout.get("text-rotation-alignment")==="map";W(ut,tt.posMatrix,y,g,Fo,Ws,ne,R,xr,ii)}const el=y.translatePosMatrix(tt.posMatrix,$e,v,C),Hs=we||g&&qe||wc?_p:Fo,ri=y.translatePosMatrix(Ws,$e,v,C,!0),br=dt&&f.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let pr;pr=dt?ut.iconsInText?lc(Ut.kind,Ht,Be,ne,y,el,Hs,ri,pn,li):ac(Ut.kind,Ht,Be,ne,y,el,Hs,ri,g,pn,!0):sc(Ut.kind,Ht,Be,ne,y,el,Hs,ri,g,pn);const ns={program:Cn,buffers:pt,uniformValues:pr,atlasTexture:Lr,atlasTextureIcon:vr,atlasInterpolation:Wn,atlasInterpolationIcon:zo,isSDF:dt,hasHalo:br};if(pe&&ut.canOverlap){Pe=!0;const ii=pt.segments.get();for(const xr of ii)Xe.push({segments:new l.$([xr]),sortKey:xr.sortKey,state:ns,terrainData:hn})}else Xe.push({segments:pt.segments,sortKey:0,state:ns,terrainData:hn})}Pe&&Xe.sort((tt,$e)=>tt.sortKey-$e.sortKey);for(const tt of Xe){const $e=tt.state;if(Z.activeTexture.set(ue.TEXTURE0),$e.atlasTexture.bind($e.atlasInterpolation,ue.CLAMP_TO_EDGE),$e.atlasTextureIcon&&(Z.activeTexture.set(ue.TEXTURE1),$e.atlasTextureIcon&&$e.atlasTextureIcon.bind($e.atlasInterpolationIcon,ue.CLAMP_TO_EDGE)),$e.isSDF){const ut=$e.uniformValues;$e.hasHalo&&(ut.u_is_halo=1,Cm($e.buffers,tt.segments,f,y,$e.program,Ue,z,F,ut,tt.terrainData)),ut.u_is_halo=0}Cm($e.buffers,tt.segments,f,y,$e.program,Ue,z,F,$e.uniformValues,tt.terrainData)}}function Cm(y,s,f,m,g,v,C,L,M,R){const z=m.context;g.draw(z,z.gl.TRIANGLES,v,C,L,er.disabled,M,R,f.id,y.layoutVertexBuffer,y.indexBuffer,s,f.paint,m.transform.zoom,y.programConfigurations.get(f.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Sh(y,s,f,m,g){if(!f||!m||!m.imageAtlas)return;const v=m.imageAtlas.patternPositions;let C=v[f.to.toString()],L=v[f.from.toString()];if(!C&&L&&(C=L),!L&&C&&(L=C),!C||!L){const M=g.getPaintProperty(s);C=v[M],L=v[M]}C&&L&&y.setConstantPatternPositions(C,L)}function Tm(y,s,f,m,g,v,C){const L=y.context.gl,M="fill-pattern",R=f.paint.get(M),z=R&&R.constantOr(1),F=f.getCrossfadeParameters();let Z,ue,le,fe,ne;C?(ue=z&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Z=L.LINES):(ue=z?"fillPattern":"fill",Z=L.TRIANGLES);const we=R.constantOr(null);for(const Be of m){const pe=s.getTile(Be);if(z&&!pe.patternsLoaded())continue;const Pe=pe.getBucket(f);if(!Pe)continue;const Ue=Pe.programConfigurations.get(f.id),qe=y.useProgram(ue,Ue),Xe=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Be);z&&(y.context.activeTexture.set(L.TEXTURE0),pe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Ue.updatePaintBuffers(F)),Sh(Ue,M,we,pe,f);const tt=Xe?Be:null,$e=y.translatePosMatrix(tt?tt.posMatrix:Be.posMatrix,pe,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(C){fe=Pe.indexBuffer2,ne=Pe.segments2;const ut=[L.drawingBufferWidth,L.drawingBufferHeight];le=ue==="fillOutlinePattern"&&z?hm($e,y,F,pe,ut):Q_($e,ut)}else fe=Pe.indexBuffer,ne=Pe.segments,le=z?ah($e,y,F,pe):cm($e);qe.draw(y.context,Z,g,y.stencilModeForClipping(Be),v,er.disabled,le,Xe,f.id,Pe.layoutVertexBuffer,fe,ne,f.paint,y.transform.zoom,Ue)}}function Eh(y,s,f,m,g,v,C){const L=y.context,M=L.gl,R="fill-extrusion-pattern",z=f.paint.get(R),F=z.constantOr(1),Z=f.getCrossfadeParameters(),ue=f.paint.get("fill-extrusion-opacity"),le=z.constantOr(null);for(const fe of m){const ne=s.getTile(fe),we=ne.getBucket(f);if(!we)continue;const Be=y.style.map.terrain&&y.style.map.terrain.getTerrainData(fe),pe=we.programConfigurations.get(f.id),Pe=y.useProgram(F?"fillExtrusionPattern":"fillExtrusion",pe);F&&(y.context.activeTexture.set(M.TEXTURE0),ne.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),pe.updatePaintBuffers(Z)),Sh(pe,R,le,ne,f);const Ue=y.translatePosMatrix(fe.posMatrix,ne,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),qe=f.paint.get("fill-extrusion-vertical-gradient"),Xe=F?J_(Ue,y,qe,ue,fe,Z,ne):rc(Ue,y,qe,ue);Pe.draw(L,L.gl.TRIANGLES,g,v,C,er.backCCW,Xe,Be,f.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,f.paint,y.transform.zoom,pe,y.style.map.terrain&&we.centroidVertexBuffer)}}function Ih(y,s,f,m,g,v,C){const L=y.context,M=L.gl,R=f.fbo;if(!R)return;const z=y.useProgram("hillshade"),F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(s);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,R.colorAttachment.get()),z.draw(L,M.TRIANGLES,g,v,C,er.disabled,((Z,ue,le,fe)=>{const ne=le.paint.get("hillshade-shadow-color"),we=le.paint.get("hillshade-highlight-color"),Be=le.paint.get("hillshade-accent-color");let pe=le.paint.get("hillshade-illumination-direction")*(Math.PI/180);le.paint.get("hillshade-illumination-anchor")==="viewport"&&(pe-=Z.transform.angle);const Pe=!Z.options.moving;return{u_matrix:fe?fe.posMatrix:Z.transform.calculatePosMatrix(ue.tileID.toUnwrapped(),Pe),u_image:0,u_latrange:mm(0,ue.tileID),u_light:[le.paint.get("hillshade-exaggeration"),pe],u_shadow:ne,u_highlight:we,u_accent:Be}})(y,f,m,F?s:null),F,m.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function yp(y,s,f,m,g,v){const C=y.context,L=C.gl,M=s.dem;if(M&&M.data){const R=M.dim,z=M.stride,F=M.getPixels();if(C.activeTexture.set(L.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||y.getTileTexture(z),s.demTexture){const ue=s.demTexture;ue.update(F,{premultiply:!1}),ue.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else s.demTexture=new Y(C,F,L.RGBA,{premultiply:!1}),s.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);C.activeTexture.set(L.TEXTURE0);let Z=s.fbo;if(!Z){const ue=new Y(C,{width:R,height:R,data:null},L.RGBA);ue.bind(L.LINEAR,L.CLAMP_TO_EDGE),Z=s.fbo=C.createFramebuffer(R,R,!0,!1),Z.colorAttachment.set(ue.texture)}C.bindFramebuffer.set(Z.framebuffer),C.viewport.set([0,0,R,R]),y.useProgram("hillshadePrepare").draw(C,L.TRIANGLES,m,g,v,er.disabled,((ue,le)=>{const fe=le.stride,ne=l.F();return l.aN(ne,0,l.W,-l.W,0,0,1),l.H(ne,ne,[0,-l.W,0]),{u_matrix:ne,u_image:1,u_dimension:[fe,fe],u_zoom:ue.overscaledZ,u_unpack:le.getUnpackVector()}})(s.tileID,M),null,f.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),s.needsHillshadePrepare=!1}}function Lm(y,s,f,m,g,v){const C=m.paint.get("raster-fade-duration");if(!v&&C>0){const L=I.now(),M=(L-y.timeAdded)/C,R=s?(L-s.timeAdded)/C:-1,z=f.getSource(),F=g.coveringZoomLevel({tileSize:z.tileSize,roundZoom:z.roundZoom}),Z=!s||Math.abs(s.tileID.overscaledZ-F)>Math.abs(y.tileID.overscaledZ-F),ue=Z&&y.refreshedUponExpiration?1:l.ac(Z?M:1-R,0,1);return y.refreshedUponExpiration&&M>=1&&(y.refreshedUponExpiration=!1),s?{opacity:1,mix:1-ue}:{opacity:ue,mix:0}}return{opacity:1,mix:0}}const Pm=new l.aO(1,0,0,1),Ch=new l.aO(0,1,0,1),vp=new l.aO(0,0,1,1),hy=new l.aO(1,0,1,1),Mm=new l.aO(0,1,1,1);function Cr(y,s,f,m){ro(y,0,s+f/2,y.transform.width,f,m)}function Ya(y,s,f,m){ro(y,s-f/2,0,f,y.transform.height,m)}function ro(y,s,f,m,g,v){const C=y.context,L=C.gl;L.enable(L.SCISSOR_TEST),L.scissor(s*y.pixelRatio,f*y.pixelRatio,m*y.pixelRatio,g*y.pixelRatio),C.clear({color:v}),L.disable(L.SCISSOR_TEST)}function bp(y,s,f){const m=y.context,g=m.gl,v=f.posMatrix,C=y.useProgram("debug"),L=In.disabled,M=sr.disabled,R=y.colorModeForRenderPass(),z="$debug",F=y.style.map.terrain&&y.style.map.terrain.getTerrainData(f);m.activeTexture.set(g.TEXTURE0);const Z=s.getTileByID(f.key).latestRawTileData,ue=Math.floor((Z&&Z.byteLength||0)/1024),le=s.getTile(f).tileSize,fe=512/Math.min(le,512)*(f.overscaledZ/y.transform.zoom)*.5;let ne=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(ne+=` => ${f.overscaledZ}`),function(we,Be){we.initDebugOverlayCanvas();const pe=we.debugOverlayCanvas,Pe=we.context.gl,Ue=we.debugOverlayCanvas.getContext("2d");Ue.clearRect(0,0,pe.width,pe.height),Ue.shadowColor="white",Ue.shadowBlur=2,Ue.lineWidth=1.5,Ue.strokeStyle="white",Ue.textBaseline="top",Ue.font="bold 36px Open Sans, sans-serif",Ue.fillText(Be,5,5),Ue.strokeText(Be,5,5),we.debugOverlayTexture.update(pe),we.debugOverlayTexture.bind(Pe.LINEAR,Pe.CLAMP_TO_EDGE)}(y,`${ne} ${ue}kB`),C.draw(m,g.TRIANGLES,L,M,Ur.alphaBlended,er.disabled,pm(v,l.aO.transparent,fe),null,z,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),C.draw(m,g.LINE_STRIP,L,M,R,er.disabled,pm(v,l.aO.red),F,z,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Th(y,s,f){const m=y.context,g=m.gl,v=y.colorModeForRenderPass(),C=new In(g.LEQUAL,In.ReadWrite,y.depthRangeFor3D),L=y.useProgram("terrain"),M=s.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,y.width,y.height]);for(const R of f){const z=y.renderToTexture.getTexture(R),F=s.getTerrainData(R.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,z.texture);const Z={u_matrix:y.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_texture:0,u_ele_delta:s.getMeshFrameDelta(y.transform.zoom)};L.draw(m,g.TRIANGLES,C,sr.disabled,v,er.backCCW,Z,F,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}class Am{constructor(s,f){this.context=new cy(s),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ei.maxUnderzooming+ei.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Za}resize(s,f,m){if(this.width=Math.floor(s*m),this.height=Math.floor(f*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const s=this.context,f=new l.aV;f.emplaceBack(0,0),f.emplaceBack(l.W,0),f.emplaceBack(0,l.W),f.emplaceBack(l.W,l.W),this.tileExtentBuffer=s.createVertexBuffer(f,ih.members),this.tileExtentSegments=l.$.simpleSegment(0,0,4,2);const m=new l.aV;m.emplaceBack(0,0),m.emplaceBack(l.W,0),m.emplaceBack(0,l.W),m.emplaceBack(l.W,l.W),this.debugBuffer=s.createVertexBuffer(m,ih.members),this.debugSegments=l.$.simpleSegment(0,0,4,5);const g=new l.Z;g.emplaceBack(0,0,0,0),g.emplaceBack(l.W,0,l.W,0),g.emplaceBack(0,l.W,0,l.W),g.emplaceBack(l.W,l.W,l.W,l.W),this.rasterBoundsBuffer=s.createVertexBuffer(g,fn.members),this.rasterBoundsSegments=l.$.simpleSegment(0,0,4,2);const v=new l.aV;v.emplaceBack(0,0),v.emplaceBack(1,0),v.emplaceBack(0,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,ih.members),this.viewportSegments=l.$.simpleSegment(0,0,4,2);const C=new l.aW;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=s.createIndexBuffer(C);const L=new l.aX;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(L);const M=this.context.gl;this.stencilClearMode=new sr({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){const s=this.context,f=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=l.F();l.aN(m,0,this.width,this.height,0,0,1),l.J(m,m,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(s,f.TRIANGLES,In.disabled,this.stencilClearMode,Ur.disabled,er.disabled,lh(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(s,f){if(this.currentStencilSource===s.source||!s.isTileClipped()||!f||!f.length)return;this.currentStencilSource=s.source;const m=this.context,g=m.gl;this.nextStencilID+f.length>256&&this.clearStencil(),m.setColorMode(Ur.disabled),m.setDepthMode(In.disabled);const v=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of f){const L=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);v.draw(m,g.TRIANGLES,In.disabled,new sr({func:g.ALWAYS,mask:0},L,255,g.KEEP,g.KEEP,g.REPLACE),Ur.disabled,er.disabled,lh(C.posMatrix),M,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,f=this.context.gl;return new sr({func:f.NOTEQUAL,mask:255},s,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(s){const f=this.context.gl;return new sr({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(s){const f=this.context.gl,m=s.sort((C,L)=>L.overscaledZ-C.overscaledZ),g=m[m.length-1].overscaledZ,v=m[0].overscaledZ-g+1;if(v>1){this.currentStencilSource=void 0,this.nextStencilID+v>256&&this.clearStencil();const C={};for(let L=0;L=0;this.currentLayer--){const M=this.style._layers[m[this.currentLayer]],R=g[M.source],z=v[M.source];this._renderTileClippingMasks(M,z),this.renderLayer(this,R,M,z)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerne.source&&!ne.isHidden(z)?[R.sourceCaches[ne.source]]:[]),ue=Z.filter(ne=>ne.getSource().type==="vector"),le=Z.filter(ne=>ne.getSource().type!=="vector"),fe=ne=>{(!F||F.getSource().maxzoomfe(ne)),F||le.forEach(ne=>fe(ne)),F}(this.style,this.transform.zoom);M&&function(R,z,F){for(let Z=0;Z0),g&&(l.a_(f,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.sourceCache.getRenderableTiles(),ue=v.useProgram("terrainDepth");L.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1});for(const le of Z){const fe=C.getTerrainData(le.tileID),ne={u_matrix:v.transform.calculatePosMatrix(le.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};ue.draw(L,M.TRIANGLES,z,sr.disabled,R,er.backCCW,ne,fe,"terrain",F.vertexBuffer,F.indexBuffer,F.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain),function(v,C){const L=v.context,M=L.gl,R=Ur.unblended,z=new In(M.LEQUAL,In.ReadWrite,[0,1]),F=C.getTerrainMesh(),Z=C.getCoordsTexture(),ue=C.sourceCache.getRenderableTiles(),le=v.useProgram("terrainCoords");L.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,v.width/devicePixelRatio,v.height/devicePixelRatio]),L.clear({color:l.aO.transparent,depth:1}),C.coordsIndex=[];for(const fe of ue){const ne=C.getTerrainData(fe.tileID);L.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,Z.texture);const we={u_matrix:v.transform.calculatePosMatrix(fe.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(v.transform.zoom)};le.draw(L,M.TRIANGLES,z,sr.disabled,R,er.backCCW,we,ne,"terrain",F.vertexBuffer,F.indexBuffer,F.segments),C.coordsIndex.push(fe.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,v.width,v.height])}(this,this.style.map.terrain))}renderLayer(s,f,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(v,C,L,M,R){if(v.renderPass!=="translucent")return;const z=sr.disabled,F=v.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Z,ue,le,fe,ne,we,Be){const pe=ue.transform,Pe=ne==="map",Ue=we==="map";for(const qe of Z){const Xe=fe.getTile(qe),tt=Xe.getBucket(le);if(!tt||!tt.text||!tt.text.segments.get().length)continue;const $e=l.ag(tt.textSizeData,pe.zoom),ut=Qt(Xe,1,ue.transform.zoom),pt=tn(qe.posMatrix,Ue,Pe,ue.transform,ut),sn=le.layout.get("icon-text-fit")!=="none"&&tt.hasIconData();if($e){const dt=Math.pow(2,pe.zoom-Xe.tileID.overscaledZ);bh(tt,Pe,Ue,Be,pe,pt,qe.posMatrix,dt,$e,sn,ue.style.map.terrain?(Ut,an)=>ue.style.map.terrain.getElevation(qe,Ut,an):null)}}}(M,v,L,C,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),R),L.paint.get("icon-opacity").constantOr(1)!==0&&wh(v,C,L,M,!1,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),L.layout.get("icon-rotation-alignment"),L.layout.get("icon-pitch-alignment"),L.layout.get("icon-keep-upright"),z,F),L.paint.get("text-opacity").constantOr(1)!==0&&wh(v,C,L,M,!0,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.layout.get("text-keep-upright"),z,F),C.map.showCollisionBoxes&&(vh(v,C,L,M,L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),!0),vh(v,C,L,M,L.paint.get("icon-translate"),L.paint.get("icon-translate-anchor"),!1))})(s,f,m,g,this.style.placement.variableOffsets);break;case"circle":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("circle-opacity"),z=L.paint.get("circle-stroke-width"),F=L.paint.get("circle-stroke-opacity"),Z=!L.layout.get("circle-sort-key").isConstant();if(R.constantOr(1)===0&&(z.constantOr(1)===0||F.constantOr(1)===0))return;const ue=v.context,le=ue.gl,fe=v.depthModeForSublayer(0,In.ReadOnly),ne=sr.disabled,we=v.colorModeForRenderPass(),Be=[];for(let pe=0;pepe.sortKey-Pe.sortKey);for(const pe of Be){const{programConfiguration:Pe,program:Ue,layoutVertexBuffer:qe,indexBuffer:Xe,uniformValues:tt,terrainData:$e}=pe.state;Ue.draw(ue,le.TRIANGLES,fe,ne,we,er.disabled,tt,$e,L.id,qe,Xe,pe.segments,L.paint,v.transform.zoom,Pe)}})(s,f,m,g);break;case"heatmap":(function(v,C,L,M){if(L.paint.get("heatmap-opacity")!==0)if(v.renderPass==="offscreen"){const R=v.context,z=R.gl,F=sr.disabled,Z=new Ur([z.ONE,z.ONE],l.aO.transparent,[!0,!0,!0,!0]);(function(ue,le,fe){const ne=ue.gl;ue.activeTexture.set(ne.TEXTURE1),ue.viewport.set([0,0,le.width/4,le.height/4]);let we=fe.heatmapFbo;if(we)ne.bindTexture(ne.TEXTURE_2D,we.colorAttachment.get()),ue.bindFramebuffer.set(we.framebuffer);else{const Be=ne.createTexture();ne.bindTexture(ne.TEXTURE_2D,Be),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_WRAP_S,ne.CLAMP_TO_EDGE),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_WRAP_T,ne.CLAMP_TO_EDGE),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_MIN_FILTER,ne.LINEAR),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_MAG_FILTER,ne.LINEAR),we=fe.heatmapFbo=ue.createFramebuffer(le.width/4,le.height/4,!1,!1),function(pe,Pe,Ue,qe){var Xe,tt;const $e=pe.gl,ut=(Xe=pe.HALF_FLOAT)!==null&&Xe!==void 0?Xe:$e.UNSIGNED_BYTE,pt=(tt=pe.RGBA16F)!==null&&tt!==void 0?tt:$e.RGBA;$e.texImage2D($e.TEXTURE_2D,0,pt,Pe.width/4,Pe.height/4,0,$e.RGBA,ut,null),qe.colorAttachment.set(Ue)}(ue,le,Be,we)}})(R,v,L),R.clear({color:l.aO.transparent});for(let ue=0;ue{const pe=l.F();l.aN(pe,0,fe.width,fe.height,0,0,1);const Pe=fe.context.gl;return{u_matrix:pe,u_world:[Pe.drawingBufferWidth,Pe.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ne.paint.get("heatmap-opacity")}})(R,z),null,z.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,z.paint,R.transform.zoom)}(v,L))})(s,f,m,g);break;case"line":(function(v,C,L,M){if(v.renderPass!=="translucent")return;const R=L.paint.get("line-opacity"),z=L.paint.get("line-width");if(R.constantOr(1)===0||z.constantOr(1)===0)return;const F=v.depthModeForSublayer(0,In.ReadOnly),Z=v.colorModeForRenderPass(),ue=L.paint.get("line-dasharray"),le=L.paint.get("line-pattern"),fe=le.constantOr(1),ne=L.paint.get("line-gradient"),we=L.getCrossfadeParameters(),Be=fe?"linePattern":ue?"lineSDF":ne?"lineGradient":"line",pe=v.context,Pe=pe.gl;let Ue=!0;for(const qe of M){const Xe=C.getTile(qe);if(fe&&!Xe.patternsLoaded())continue;const tt=Xe.getBucket(L);if(!tt)continue;const $e=tt.programConfigurations.get(L.id),ut=v.context.program.get(),pt=v.useProgram(Be,$e),sn=Ue||pt.program!==ut,dt=v.style.map.terrain&&v.style.map.terrain.getTerrainData(qe),Ut=le.constantOr(null);if(Ut&&Xe.imageAtlas){const Ht=Xe.imageAtlas,hn=Ht.patternPositions[Ut.to.toString()],pn=Ht.patternPositions[Ut.from.toString()];hn&&pn&&$e.setConstantPatternPositions(hn,pn)}const an=dt?qe:null,Cn=fe?Ll(v,Xe,L,we,an):ue?ch(v,Xe,L,ue,we,an):ne?gm(v,Xe,L,tt.lineClipsArray.length,an):uh(v,Xe,L,an);if(fe)pe.activeTexture.set(Pe.TEXTURE0),Xe.imageAtlasTexture.bind(Pe.LINEAR,Pe.CLAMP_TO_EDGE),$e.updatePaintBuffers(we);else if(ue&&(sn||v.lineAtlas.dirty))pe.activeTexture.set(Pe.TEXTURE0),v.lineAtlas.bind(pe);else if(ne){const Ht=tt.gradients[L.id];let hn=Ht.texture;if(L.gradientVersion!==Ht.version){let pn=256;if(L.stepInterpolant){const Lr=C.getSource().maxzoom,Wn=qe.canonical.z===Lr?Math.ceil(1<0?f.pop():null}isPatternMissing(s){if(!s)return!1;if(!s.from||!s.to)return!0;const f=this.imageManager.getPattern(s.from.toString()),m=this.imageManager.getPattern(s.to.toString());return!f||!m}useProgram(s,f){this.cache=this.cache||{};const m=s+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new Xa(this.context,nc[s],f,_m[s],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Y(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:s,drawingBufferHeight:f}=this.context.gl;return this.width!==s||this.height!==f}}class Ka{constructor(s,f){this.points=s,this.planes=f}static fromInvProjectionMatrix(s,f,m){const g=Math.pow(2,m),v=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(L=>{const M=1/(L=l.af([],L,s))[3]/f*g;return l.a$(L,L,[M,M,1/L[3],M])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const M=function(Z,ue){var le=ue[0],fe=ue[1],ne=ue[2],we=le*le+fe*fe+ne*ne;return we>0&&(we=1/Math.sqrt(we)),Z[0]=ue[0]*we,Z[1]=ue[1]*we,Z[2]=ue[2]*we,Z}([],function(Z,ue,le){var fe=ue[0],ne=ue[1],we=ue[2],Be=le[0],pe=le[1],Pe=le[2];return Z[0]=ne*Pe-we*pe,Z[1]=we*Be-fe*Pe,Z[2]=fe*pe-ne*Be,Z}([],te([],v[L[0]],v[L[1]]),te([],v[L[2]],v[L[1]]))),R=-((z=M)[0]*(F=v[L[1]])[0]+z[1]*F[1]+z[2]*F[2]);var z,F;return M.concat(R)});return new Ka(v,C)}}class Ja{constructor(s,f){this.min=s,this.max=f,this.center=function(m,g,v){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,v){return m[0]=g[0]+v[0],m[1]=g[1]+v[1],m[2]=g[2]+v[2],m}([],this.min,this.max))}quadrant(s){const f=[s%2==0,s<2],m=me(this.min),g=me(this.max);for(let v=0;v=0&&C++;if(C===0)return 0;C!==f.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let v=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let L=0;Lthis.max[g]-this.min[g])return 0}return 1}}class mu{constructor(s=0,f=0,m=0,g=0){if(isNaN(s)||s<0||isNaN(f)||f<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=f,this.left=m,this.right=g}interpolate(s,f,m){return f.top!=null&&s.top!=null&&(this.top=l.z.number(s.top,f.top,m)),f.bottom!=null&&s.bottom!=null&&(this.bottom=l.z.number(s.bottom,f.bottom,m)),f.left!=null&&s.left!=null&&(this.left=l.z.number(s.left,f.left,m)),f.right!=null&&s.right!=null&&(this.right=l.z.number(s.right,f.right,m)),this}getCenter(s,f){const m=l.ac((this.left+s-this.right)/2,0,s),g=l.ac((this.top+f-this.bottom)/2,0,f);return new l.P(m,g)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new mu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const xp=85.051129;class Lh{constructor(s,f,m,g,v){this.tileSize=512,this._renderWorldCopies=v===void 0||!!v,this._minZoom=s||0,this._maxZoom=f||22,this._minPitch=m??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.M(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new mu,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){const s=new Lh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return s.apply(this),s}apply(s){this.tileSize=s.tileSize,this.latRange=s.latRange,this.width=s.width,this.height=s.height,this._center=s._center,this._elevation=s._elevation,this.minElevationForCurrentTile=s.minElevationForCurrentTile,this.zoom=s.zoom,this.angle=s.angle,this._fov=s._fov,this._pitch=s._pitch,this._unmodified=s._unmodified,this._edgeInsets=s._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(s){const f=-l.b1(s,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=function(){var m=new l.A(4);return l.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,v){var C=g[0],L=g[1],M=g[2],R=g[3],z=Math.sin(v),F=Math.cos(v);m[0]=C*F+M*z,m[1]=L*F+R*z,m[2]=C*-z+M*F,m[3]=L*-z+R*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const f=l.ac(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=s/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(s){const f=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(s){s.lat===this._center.lat&&s.lng===this._center.lng||(this._unmodified=!1,this._center=s,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(s){s!==this._elevation&&(this._elevation=s,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(s){this._edgeInsets.equals(s)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,s,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(s){return this._edgeInsets.equals(s)}interpolatePadding(s,f,m){this._unmodified=!1,this._edgeInsets.interpolate(s,f,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(s){const f=(s.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/s.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(s){const f=[new l.b2(0,s)];if(this._renderWorldCopies){const m=this.pointCoordinate(new l.P(0,0)),g=this.pointCoordinate(new l.P(this.width,0)),v=this.pointCoordinate(new l.P(this.width,this.height)),C=this.pointCoordinate(new l.P(0,this.height)),L=Math.floor(Math.min(m.x,g.x,v.x,C.x)),M=Math.floor(Math.max(m.x,g.x,v.x,C.x)),R=1;for(let z=L-R;z<=M+R;z++)z!==0&&f.push(new l.b2(z,s))}return f}coveringTiles(s){var f,m;let g=this.coveringZoomLevel(s);const v=g;if(s.minzoom!==void 0&&gs.maxzoom&&(g=s.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),L=l.Y.fromLngLat(this.center),M=Math.pow(2,g),R=[M*C.x,M*C.y,0],z=[M*L.x,M*L.y,0],F=Ka.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let Z=s.minzoom||0;!s.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Z=g);const ue=s.terrain?2/Math.min(this.tileSize,s.tileSize)*this.tileSize:3,le=pe=>({aabb:new Ja([pe*M,0,0],[(pe+1)*M,M,0]),zoom:0,x:0,y:0,wrap:pe,fullyVisible:!1}),fe=[],ne=[],we=g,Be=s.reparseOverscaled?v:g;if(this._renderWorldCopies)for(let pe=1;pe<=3;pe++)fe.push(le(-pe)),fe.push(le(pe));for(fe.push(le(0));fe.length>0;){const pe=fe.pop(),Pe=pe.x,Ue=pe.y;let qe=pe.fullyVisible;if(!qe){const pt=pe.aabb.intersects(F);if(pt===0)continue;qe=pt===2}const Xe=s.terrain?R:z,tt=pe.aabb.distanceX(Xe),$e=pe.aabb.distanceY(Xe),ut=Math.max(Math.abs(tt),Math.abs($e));if(pe.zoom===we||ut>ue+(1<=Z){const pt=we-pe.zoom,sn=R[0]-.5-(Pe<>1),Ut=pe.zoom+1;let an=pe.aabb.quadrant(pt);if(s.terrain){const Cn=new l.Q(Ut,pe.wrap,Ut,sn,dt),Ht=s.terrain.getMinMaxElevation(Cn),hn=(f=Ht.minElevation)!==null&&f!==void 0?f:this.elevation,pn=(m=Ht.maxElevation)!==null&&m!==void 0?m:this.elevation;an=new Ja([an.min[0],an.min[1],hn],[an.max[0],an.max[1],pn])}fe.push({aabb:an,zoom:Ut,x:sn,y:dt,wrap:pe.wrap,fullyVisible:qe})}}return ne.sort((pe,Pe)=>pe.distanceSq-Pe.distanceSq).map(pe=>pe.tileID)}resize(s,f){this.width=s,this.height=f,this.pixelsToGLUnits=[2/s,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const f=l.ac(s.lat,-85.051129,xp);return new l.P(l.N(s.lng)*this.worldSize,l.O(f)*this.worldSize)}unproject(s){return new l.Y(s.x/this.worldSize,s.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(s){const f=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,s),v=s.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-v))return;const C=m+f-v,L=Math.cos(this._pitch)*this.cameraToCenterDistance/C/l.b3(1,g.lat),M=this.scaleZoom(L/this.tileSize);this._elevation=v,this._center=g,this.zoom=M}setLocationAtPoint(s,f){const m=this.pointCoordinate(f),g=this.pointCoordinate(this.centerPoint),v=this.locationCoordinate(s),C=new l.Y(v.x-(m.x-g.x),v.y-(m.y-g.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(s,f){return f?this.coordinatePoint(this.locationCoordinate(s),f.getElevationForLngLatZoom(s,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(s))}pointLocation(s,f){return this.coordinateLocation(this.pointCoordinate(s,f))}locationCoordinate(s){return l.Y.fromLngLat(s)}coordinateLocation(s){return s&&s.toLngLat()}pointCoordinate(s,f){if(f){const Z=f.pointCoordinate(s);if(Z!=null)return Z}const m=[s.x,s.y,0,1],g=[s.x,s.y,1,1];l.af(m,m,this.pixelMatrixInverse),l.af(g,g,this.pixelMatrixInverse);const v=m[3],C=g[3],L=m[1]/v,M=g[1]/C,R=m[2]/v,z=g[2]/C,F=R===z?0:(0-R)/(z-R);return new l.Y(l.z.number(m[0]/v,g[0]/C,F)/this.worldSize,l.z.number(L,M,F)/this.worldSize)}coordinatePoint(s,f=0,m=this.pixelMatrix){const g=[s.x*this.worldSize,s.y*this.worldSize,f,1];return l.af(g,g,m),new l.P(g[0]/g[3],g[1]/g[3])}getBounds(){const s=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new l.P(0,s))).extend(this.pointLocation(new l.P(this.width,s))).extend(this.pointLocation(new l.P(this.width,this.height))).extend(this.pointLocation(new l.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ce([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(s){s?(this.lngRange=[s.getWest(),s.getEast()],this.latRange=[s.getSouth(),s.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,xp])}calculatePosMatrix(s,f=!1){const m=s.key,g=f?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const v=s.canonical,C=this.worldSize/this.zoomScale(v.z),L=v.x+Math.pow(2,v.z)*s.wrap,M=l.an(new Float64Array(16));return l.H(M,M,[L*C,v.y*C,0]),l.J(M,M,[C/l.W,C/l.W,1]),l.K(M,f?this.alignedProjMatrix:this.projMatrix,M),g[m]=new Float32Array(M),g[m]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(s,f){f=l.ac(+f,this.minZoom,this.maxZoom);const m={center:new l.M(s.lng,s.lat),zoom:f};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const pe=179.9999999999;g=[-pe,pe]}const v=this.tileSize*this.zoomScale(m.zoom);let C=0,L=v,M=0,R=v,z=0,F=0;const{x:Z,y:ue}=this.size;if(this.latRange){const pe=this.latRange;C=l.O(pe[1])*v,L=l.O(pe[0])*v,L-CL&&(we=L-pe)}if(g){const pe=(M+R)/2;let Pe=le;this._renderWorldCopies&&(Pe=l.b1(le,pe-v/2,pe+v/2));const Ue=Z/2;Pe-UeR&&(ne=R-Ue)}if(ne!==void 0||we!==void 0){const pe=new l.P(ne??le,we??fe);m.center=this.unproject.call({worldSize:v},pe).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const s=this._unmodified,{center:f,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=m,this._unmodified=s,this._constraining=!1}_calcMatrices(){if(!this.height)return;const s=this.centerOffset,f=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.b3(1,this.center.lat)*this.worldSize;let g=l.an(new Float64Array(16));l.J(g,g,[this.width/2,-this.height/2,1]),l.H(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=l.an(new Float64Array(16)),l.J(g,g,[1,-1,1]),l.H(g,g,[-1,-1,0]),l.J(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const v=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),L=v-C*this._pixelPerMeter/Math.cos(this._pitch),M=C<0?L:v,R=Math.PI/2+this._pitch,z=this._fov*(.5+s.y/this.height),F=Math.sin(z)*M/Math.sin(l.ac(Math.PI-R-z,.01,Math.PI-.01)),Z=this.getHorizon(),ue=2*Math.atan(Z/this.cameraToCenterDistance)*(.5+s.y/(2*Z)),le=Math.sin(ue)*M/Math.sin(l.ac(Math.PI-R-ue,.01,Math.PI-.01)),fe=Math.min(F,le),ne=1.01*(Math.cos(Math.PI/2-this._pitch)*fe+M),we=this.height/50;g=new Float64Array(16),l.b4(g,this._fov,this.width/this.height,we,ne),g[8]=2*-s.x/this.width,g[9]=2*s.y/this.height,l.J(g,g,[1,-1,1]),l.H(g,g,[0,0,-this.cameraToCenterDistance]),l.b5(g,g,this._pitch),l.ad(g,g,this.angle),l.H(g,g,[-f,-m,0]),this.mercatorMatrix=l.J([],g,[this.worldSize,this.worldSize,this.worldSize]),l.J(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.K(new Float64Array(16),this.labelPlaneMatrix,g),l.H(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=l.ar([],g),this.pixelMatrix3D=l.K(new Float64Array(16),this.labelPlaneMatrix,g);const Be=this.width%2/2,pe=this.height%2/2,Pe=Math.cos(this.angle),Ue=Math.sin(this.angle),qe=f-Math.round(f)+Pe*Be+Ue*pe,Xe=m-Math.round(m)+Pe*pe+Ue*Be,tt=new Float64Array(g);if(l.H(tt,tt,[qe>.5?qe-1:qe,Xe>.5?Xe-1:Xe,0]),this.alignedProjMatrix=tt,g=l.ar(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const s=this.pointCoordinate(new l.P(0,0)),f=[s.x*this.worldSize,s.y*this.worldSize,0,1];return l.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.P(0,s))}getCameraQueryGeometry(s){const f=this.getCameraPoint();if(s.length===1)return[s[0],f];{let m=f.x,g=f.y,v=f.x,C=f.y;for(const L of s)m=Math.min(m,L.x),g=Math.min(g,L.y),v=Math.max(v,L.x),C=Math.max(C,L.y);return[new l.P(m,g),new l.P(v,g),new l.P(v,C),new l.P(m,C),new l.P(m,g)]}}lngLatToCameraDepth(s,f){const m=this.locationCoordinate(s),g=[m.x*this.worldSize,m.y*this.worldSize,f,1];return l.af(g,g,this.projMatrix),g[2]/g[3]}}function wp(y,s){let f,m=!1,g=null,v=null;const C=()=>{g=null,m&&(y.apply(v,f),g=setTimeout(C,s),m=!1)};return(...L)=>(m=!0,v=this,f=L,g||C(),g)}class Sp{constructor(s){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let m;return f.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:m,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,f)}catch{}},this._updateHash=wp(this._updateHashUnthrottled,300),this._hashName=s&&encodeURIComponent(s)}addTo(s){return this._map=s,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(s){const f=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),v=Math.pow(10,g),C=Math.round(f.lng*v)/v,L=Math.round(f.lat*v)/v,M=this._map.getBearing(),R=this._map.getPitch();let z="";if(z+=s?`/${C}/${L}/${m}`:`${m}/${L}/${C}`,(M||R)&&(z+="/"+Math.round(10*M)/10),R&&(z+=`/${Math.round(R)}`),this._hashName){const F=this._hashName;let Z=!1;const ue=window.location.hash.slice(1).split("&").map(le=>{const fe=le.split("=")[0];return fe===F?(Z=!0,`${fe}=${z}`):le}).filter(le=>le);return Z||ue.push(`${F}=${z}`),`#${ue.join("&")}`}return`#${z}`}}const cc={linearity:.3,easing:l.b6(0,0,.3,1)},kl=l.e({deceleration:2500,maxSpeed:1400},cc),km=l.e({deceleration:20,maxSpeed:1400},cc),Dm=l.e({deceleration:1e3,maxSpeed:360},cc),Rm=l.e({deceleration:1e3,maxSpeed:90},cc);class Nm{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:I.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,f=I.now();for(;s.length>0&&f-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new l.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:v}of this._inertiaBuffer)f.zoom+=v.zoomDelta||0,f.bearing+=v.bearingDelta||0,f.pitch+=v.pitchDelta||0,v.panDelta&&f.pan._add(v.panDelta),v.around&&(f.around=v.around),v.pinchAround&&(f.pinchAround=v.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(f.pan.mag()){const v=fc(f.pan.mag(),m,l.e({},kl,s||{}));g.offset=f.pan.mult(v.amount/f.pan.mag()),g.center=this._map.transform.center,hc(g,v)}if(f.zoom){const v=fc(f.zoom,m,km);g.zoom=this._map.transform.zoom+v.amount,hc(g,v)}if(f.bearing){const v=fc(f.bearing,m,Dm);g.bearing=this._map.transform.bearing+l.ac(v.amount,-179,179),hc(g,v)}if(f.pitch){const v=fc(f.pitch,m,Rm);g.pitch=this._map.transform.pitch+v.amount,hc(g,v)}if(g.zoom||g.bearing){const v=f.pinchAround===void 0?f.around:f.pinchAround;g.around=v?this._map.unproject(v):this._map.getCenter()}return this.clear(),l.e(g,{noMoveStart:!0})}}function hc(y,s){(!y.duration||y.durationf.unproject(M)),L=v.reduce((M,R,z,F)=>M.add(R.div(F.length)),new l.P(0,0));super(s,{points:v,point:L,lngLats:C,lngLat:f.unproject(L),originalEvent:m}),this._defaultPrevented=!1}}class Ep extends l.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,f,m){super(s,{originalEvent:m}),this._defaultPrevented=!1}}class ys{constructor(s,f){this._map=s,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(s){return this._firePreventable(new Ep(s.type,this._map,s))}mousedown(s,f){return this._mousedownPos=f,this._firePreventable(new yo(s.type,this._map,s))}mouseup(s){this._map.fire(new yo(s.type,this._map,s))}click(s,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new yo(s.type,this._map,s))}dblclick(s){return this._firePreventable(new yo(s.type,this._map,s))}mouseover(s){this._map.fire(new yo(s.type,this._map,s))}mouseout(s){this._map.fire(new yo(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Gs(s.type,this._map,s))}touchmove(s){this._map.fire(new Gs(s.type,this._map,s))}touchend(s){this._map.fire(new Gs(s.type,this._map,s))}touchcancel(s){this._map.fire(new Gs(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class js{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(s){this._map.fire(new yo(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new yo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._ignoreContextMenu||this._map.fire(new yo(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gu{constructor(s){this._map=s}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(s){return this.transform.pointLocation(l.P.convert(s),this._map.terrain)}}class vs{constructor(s,f){this._map=s,this._tr=new gu(s),this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,f){this.isEnabled()&&s.shiftKey&&s.button===0&&(T.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(s,f){if(!this._active)return;const m=f;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)v.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",s)}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(s,f){return this._map.fire(new l.k(s,{originalEvent:f}))}}function Dl(y,s){if(y.length!==s.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${s.length}`);const f={};for(let m=0;mthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=s.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const v=new l.P(0,0);for(const C of g)v._add(C);return v.div(g.length)}(f),this.touches=Dl(m,f)))}touchmove(s,f,m){if(this.aborted||!this.centroid)return;const g=Dl(m,f);for(const v in this.touches){const C=g[v];(!C||C.dist(this.touches[v])>30)&&(this.aborted=!0)}}touchend(s,f,m){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Ip{constructor(s){this.singleTap=new fy(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(s,f,m){this.singleTap.touchstart(s,f,m)}touchmove(s,f,m){this.singleTap.touchmove(s,f,m)}touchend(s,f,m){const g=this.singleTap.touchend(s,f,m);if(g){const v=s.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(g)<30;if(v&&C||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class py{constructor(s){this._tr=new gu(s),this._zoomIn=new Ip({numTouches:1,numTaps:2}),this._zoomOut=new Ip({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,f,m){this._zoomIn.touchstart(s,f,m),this._zoomOut.touchstart(s,f,m)}touchmove(s,f,m){this._zoomIn.touchmove(s,f,m),this._zoomOut.touchmove(s,f,m)}touchend(s,f,m){const g=this._zoomIn.touchend(s,f,m),v=this._zoomOut.touchend(s,f,m),C=this._tr;return g?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(g)},{originalEvent:s})}):v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(v)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _u{constructor(s){this._enabled=!!s.enable,this._moveStateManager=s.moveStateManager,this._clickTolerance=s.clickTolerance||1,this._moveFunction=s.move,this._activateOnStart=!!s.activateOnStart,s.assignEvents(this),this.reset()}reset(s){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(s)}_move(...s){const f=this._moveFunction(...s);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(s,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(s)&&(this._moveStateManager.startMove(s),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(s,f){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(s.preventDefault(),!this._moveStateManager.isValidMoveEvent(s))return void this.reset(s);const g=f.length?f[0]:f;return!this._moved&&g.dist(m){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(s){s.preventDefault()}},yu=({enable:y,clickTolerance:s,bearingDegreesPerPixelMoved:f=.8})=>{const m=new qs({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new _u({clickTolerance:s,move:(g,v)=>({bearingDelta:(v.x-g.x)*f}),moveStateManager:m,enable:y,assignEvents:Ph})},vu=({enable:y,clickTolerance:s,pitchDegreesPerPixelMoved:f=-.5})=>{const m=new qs({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new _u({clickTolerance:s,move:(g,v)=>({pitchDelta:(v.y-g.y)*f}),moveStateManager:m,enable:y,assignEvents:Ph})};class Om{constructor(s,f){this._clickTolerance=s.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(s,f,m){return this._calculateTransform(s,f,m)}touchmove(s,f,m){if(this._active&&!(m.length0&&(this._active=!0);const g=Dl(m,f),v=new l.P(0,0),C=new l.P(0,0);let L=0;for(const R in g){const z=g[R],F=this._touches[R];F&&(v._add(z),C._add(z.sub(F)),L++,g[R]=z)}if(this._touches=g,LMath.abs(y.x)}class Bm extends bt{constructor(s){super(),this._currentTouchCount=0,this._map=s}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(s,f,m){super.touchstart(s,f,m),this._currentTouchCount=m.length}_start(s){this._lastPoints=s,Ah(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,f,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=s[0].sub(this._lastPoints[0]),v=s[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,v,m.timeStamp),this._valid?(this._lastPoints=s,this._active=!0,{pitchDelta:(g.y+v.y)/2*-.5}):void 0}gestureBeginsVertically(s,f,m){if(this._valid!==void 0)return this._valid;const g=s.mag()>=2,v=f.mag()>=2;if(!g&&!v)return;if(!g||!v)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const C=s.y>0==f.y>0;return Ah(s)&&Ah(f)&&C}}const dy={panStep:100,bearingStep:15,pitchStep:10};class Qa{constructor(s){this._tr=new gu(s);const f=dy;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let f=0,m=0,g=0,v=0,C=0;switch(s.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:s.shiftKey?m=-1:(s.preventDefault(),v=-1);break;case 39:s.shiftKey?m=1:(s.preventDefault(),v=1);break;case 38:s.shiftKey?g=1:(s.preventDefault(),C=-1);break;case 40:s.shiftKey?g=-1:(s.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:L=>{const M=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:fr,zoom:f?Math.round(M.zoom)+f*(s.shiftKey?2:1):M.zoom,bearing:M.bearing+m*this._bearingStep,pitch:M.pitch+g*this._pitchStep,offset:[-v*this._panStep,-C*this._panStep],center:M.center},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function fr(y){return y*(2-y)}const dc=4.000244140625;class kh{constructor(s,f){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=s,this._tr=new gu(s),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(s){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!s[this._map.cooperativeGestures._bypassKey])return;let f=s.deltaMode===WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const m=I.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,f!==0&&f%dc==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(g*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),s.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=s,this._delta-=f,this._active||this._start(s)),s.preventDefault()}_start(s){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const f=T.mousePos(this._map.getCanvas(),s),m=this._tr;this._around=f.y>m.transform.height/2-m.transform.getHorizon()?l.M.convert(this._aroundCenter?m.center:m.unproject(f)):l.M.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._tr.transform;if(this._delta!==0){const L=this._type==="wheel"&&Math.abs(this._delta)>dc?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&M!==0&&(M=1/M);const R=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):s.scale;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(R*M))),this._type==="wheel"&&(this._startZoom=s.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:s.zoom,m=this._startZoom,g=this._easing;let v,C=!1;if(this._type==="wheel"&&m&&g){const L=Math.min((I.now()-this._lastWheelEventTime)/200,1),M=g(L);v=l.z.number(m,f,M),L<1?this._frameId||(this._frameId=!0):C=!0}else v=f,C=!0;return this._active=!0,C&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!C,zoomDelta:v-s.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let f=l.b7;if(this._prevEase){const m=this._prevEase,g=(I.now()-m.start)/m.duration,v=m.easing(g+.01)-m.easing(g),C=.27/Math.sqrt(v*v+1e-4)*.01,L=Math.sqrt(.0729-C*C);f=l.b6(C,L,.25,1)}return this._prevEase={start:I.now(),duration:s,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Tp{constructor(s,f){this._clickZoom=s,this._tapZoom=f}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Vm{constructor(s){this._tr=new gu(s),this.reset()}reset(){this._active=!1}dblclick(s,f){return s.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(s.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Um{constructor(){this._tap=new Ip({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(s,f,m){if(!this._swipePoint)if(this._tapTime){const g=f[0],v=s.timeStamp-this._tapTime<500,C=this._tapPoint.dist(g)<30;v&&C?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(s,f,m)}touchmove(s,f,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=f[0],v=g.y-this._swipePoint.y;return this._swipePoint=g,s.preventDefault(),this._active=!0,{zoomDelta:v/128}}}else this._tap.touchmove(s,f,m)}touchend(s,f,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(s,f,m);g&&(this._tapTime=s.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gm{constructor(s,f,m){this._el=s,this._mousePan=f,this._touchPan=m}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class bs{constructor(s,f,m){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=f,this._mousePitch=m}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class mc{constructor(s,f,m,g){this._el=s,this._touchZoom=f,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Dt{constructor(s,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=s,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const s=this._map.getCanvasContainer();s.classList.add("maplibregl-cooperative-gestures"),this._container=T.create("div","maplibregl-cooperative-gesture-screen",s);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=f,this._container.appendChild(g);const v=document.createElement("div");v.className="maplibregl-mobile-message",v.textContent=m,this._container.appendChild(v),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(T.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(s){this._onCooperativeGesture(s.touches.length===1)}wheel(s){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!s[this._bypassKey])}_onCooperativeGesture(s){this._enabled&&s&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Vt=y=>y.zoom||y.drag||y.pitch||y.rotate;class Dh extends l.k{}function gc(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Lp{constructor(s,f){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,v)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=g.type==="renderFrame"?void 0:g,L={needsRenderFrame:!1},M={},R={},z=g.touches,F=z?this._getMapTouches(z):void 0,Z=F?T.touchPos(this._map.getCanvas(),F):T.mousePos(this._map.getCanvas(),g);for(const{handlerName:fe,handler:ne,allowed:we}of this._handlers){if(!ne.isEnabled())continue;let Be;this._blockedByActive(R,we,fe)?ne.reset():ne[v||g.type]&&(Be=ne[v||g.type](g,Z,F),this.mergeHandlerResult(L,M,Be,fe,C),Be&&Be.needsRenderFrame&&this._triggerRenderFrame()),(Be||ne.isActive())&&(R[fe]=ne)}const ue={};for(const fe in this._previousActiveHandlers)R[fe]||(ue[fe]=C);this._previousActiveHandlers=R,(Object.keys(ue).length||gc(L))&&(this._changes.push([L,M,ue]),this._triggerRenderFrame()),(Object.keys(R).length||gc(L))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:le}=L;le&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],le(this._map))},this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Nm(s),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,v,C]of this._listeners)T.addEventListener(g,v,g===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[s,f,m]of this._listeners)T.removeEventListener(s,f,s===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(s){const f=this._map,m=f.getCanvasContainer();this._add("mapEvent",new ys(f,s));const g=f.boxZoom=new vs(f,s);this._add("boxZoom",g),s.interactive&&s.boxZoom&&g.enable();const v=f.cooperativeGestures=new Dt(f,s.cooperativeGestures);this._add("cooperativeGestures",v),s.cooperativeGestures&&v.enable();const C=new py(f),L=new Vm(f);f.doubleClickZoom=new Tp(L,C),this._add("tapZoom",C),this._add("clickZoom",L),s.interactive&&s.doubleClickZoom&&f.doubleClickZoom.enable();const M=new Um;this._add("tapDragZoom",M);const R=f.touchPitch=new Bm(f);this._add("touchPitch",R),s.interactive&&s.touchPitch&&f.touchPitch.enable(s.touchPitch);const z=yu(s),F=vu(s);f.dragRotate=new bs(s,z,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",F,["mouseRotate"]),s.interactive&&s.dragRotate&&f.dragRotate.enable();const Z=(({enable:Be,clickTolerance:pe})=>{const Pe=new qs({checkCorrectEvent:Ue=>T.mouseButton(Ue)===0&&!Ue.ctrlKey});return new _u({clickTolerance:pe,move:(Ue,qe)=>({around:qe,panDelta:qe.sub(Ue)}),activateOnStart:!0,moveStateManager:Pe,enable:Be,assignEvents:Ph})})(s),ue=new Om(s,f);f.dragPan=new Gm(m,Z,ue),this._add("mousePan",Z),this._add("touchPan",ue,["touchZoom","touchRotate"]),s.interactive&&s.dragPan&&f.dragPan.enable(s.dragPan);const le=new Cp,fe=new Fm;f.touchZoomRotate=new mc(m,fe,le,M),this._add("touchRotate",le,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]),s.interactive&&s.touchZoomRotate&&f.touchZoomRotate.enable(s.touchZoomRotate);const ne=f.scrollZoom=new kh(f,()=>this._triggerRenderFrame());this._add("scrollZoom",ne,["mousePan"]),s.interactive&&s.scrollZoom&&f.scrollZoom.enable(s.scrollZoom);const we=f.keyboard=new Qa(f);this._add("keyboard",we),s.interactive&&s.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new js(f))}_add(s,f,m){this._handlers.push({handlerName:s,handler:f,allowed:m}),this._handlersById[s]=f}stop(s){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vt(this._eventsInProgress)||this.isZooming()}_blockedByActive(s,f,m){for(const g in s)if(g!==m&&(!f||f.indexOf(g)<0))return!0;return!1}_getMapTouches(s){const f=[];for(const m of s)this._el.contains(m.target)&&f.push(m);return f}mergeHandlerResult(s,f,m,g,v){if(!m)return;l.e(s,m);const C={handlerName:g,originalEvent:m.originalEvent||v};m.zoomDelta!==void 0&&(f.zoom=C),m.panDelta!==void 0&&(f.drag=C),m.pitchDelta!==void 0&&(f.pitch=C),m.bearingDelta!==void 0&&(f.rotate=C)}_applyChanges(){const s={},f={},m={};for(const[g,v,C]of this._changes)g.panDelta&&(s.panDelta=(s.panDelta||new l.P(0,0))._add(g.panDelta)),g.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(s.around=g.around),g.pinchAround!==void 0&&(s.pinchAround=g.pinchAround),g.noInertia&&(s.noInertia=g.noInertia),l.e(f,v),l.e(m,C);this._updateMapTransform(s,f,m),this._changes=[]}_updateMapTransform(s,f,m){const g=this._map,v=g._getTransformForUpdate(),C=g.terrain;if(!(gc(s)||C&&this._terrainMovement))return this._fireEvents(f,m,!0);let{panDelta:L,zoomDelta:M,bearingDelta:R,pitchDelta:z,around:F,pinchAround:Z}=s;Z!==void 0&&(F=Z),g._stop(!0),F=F||g.transform.centerPoint;const ue=v.pointLocation(L?F.sub(L):F);R&&(v.bearing+=R),z&&(v.pitch+=z),M&&(v.zoom+=M),C?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?v.center=v.pointLocation(v.centerPoint.sub(L)):v.setLocationAtPoint(ue,F):(this._terrainMovement=!0,this._map._elevationFreeze=!0,v.setLocationAtPoint(ue,F),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,v.recalculateZoom(g.terrain)})):v.setLocationAtPoint(ue,F),g._applyUpdatedTransform(v),this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(f,m,!0)}_fireEvents(s,f,m){const g=Vt(this._eventsInProgress),v=Vt(s),C={};for(const z in s){const{originalEvent:F}=s[z];this._eventsInProgress[z]||(C[`${z}start`]=F),this._eventsInProgress[z]=s[z]}!g&&v&&this._fireEvent("movestart",v.originalEvent);for(const z in C)this._fireEvent(z,C[z]);v&&this._fireEvent("move",v.originalEvent);for(const z in s){const{originalEvent:F}=s[z];this._fireEvent(z,F)}const L={};let M;for(const z in this._eventsInProgress){const{handlerName:F,originalEvent:Z}=this._eventsInProgress[z];this._handlersById[F].isActive()||(delete this._eventsInProgress[z],M=f[F]||Z,L[`${z}end`]=M)}for(const z in L)this._fireEvent(z,L[z]);const R=Vt(this._eventsInProgress);if(m&&(g||v)&&!R){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=Z=>Z!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Dh("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class vo extends l.E{constructor(s,f){super(),this._renderFrameCallback=()=>{const m=Math.min((I.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=f.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new l.M(this.transform.center.lng,this.transform.center.lat)}setCenter(s,f){return this.jumpTo({center:s},f)}panBy(s,f,m){return s=l.P.convert(s).mult(-1),this.panTo(this.transform.center,l.e({offset:s},f),m)}panTo(s,f,m){return this.easeTo(l.e({center:s},f),m)}getZoom(){return this.transform.zoom}setZoom(s,f){return this.jumpTo({zoom:s},f),this}zoomTo(s,f,m){return this.easeTo(l.e({zoom:s},f),m)}zoomIn(s,f){return this.zoomTo(this.getZoom()+1,s,f),this}zoomOut(s,f){return this.zoomTo(this.getZoom()-1,s,f),this}getBearing(){return this.transform.bearing}setBearing(s,f){return this.jumpTo({bearing:s},f),this}getPadding(){return this.transform.padding}setPadding(s,f){return this.jumpTo({padding:s},f),this}rotateTo(s,f,m){return this.easeTo(l.e({bearing:s},f),m)}resetNorth(s,f){return this.rotateTo(0,l.e({duration:1e3},s),f),this}resetNorthPitch(s,f){return this.easeTo(l.e({bearing:0,pitch:0,duration:1e3},s),f),this}snapToNorth(s,f){return Math.abs(this.getBearing()){if(this._zooming&&(g.zoom=l.z.number(v,ne,Xe)),this._rotating&&(g.bearing=l.z.number(C,R,Xe)),this._pitching&&(g.pitch=l.z.number(L,z,Xe)),this._padding&&(g.interpolatePadding(M,F,Xe),ue=g.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Xe),Pe)g.setLocationAtPoint(Pe,Ue);else{const tt=g.zoomScale(g.zoom-v),$e=ne>v?Math.min(2,pe):Math.max(.5,pe),ut=Math.pow($e,1-Xe),pt=g.unproject(we.add(Be.mult(Xe*ut)).mult(tt));g.setLocationAtPoint(g.renderWorldCopies?pt.wrap():pt,ue)}this._applyUpdatedTransform(g),this._fireMoveEvents(f)},Xe=>{this.terrain&&this._finalizeElevation(),this._afterEase(f,Xe)},s),this}_prepareEase(s,f,m={}){this._moving=!0,f||m.moving||this.fire(new l.k("movestart",s)),this._zooming&&!m.zooming&&this.fire(new l.k("zoomstart",s)),this._rotating&&!m.rotating&&this.fire(new l.k("rotatestart",s)),this._pitching&&!m.pitching&&this.fire(new l.k("pitchstart",s))}_prepareElevation(s){this._elevationCenter=s,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(s,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(s){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(s<1&&f!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=s*(m-(f-(m*s+this._elevationStart))/(1-s)),this._elevationTarget=f}this.transform.elevation=l.z.number(this._elevationStart,this._elevationTarget,s)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(s){if(!this.transformCameraUpdate)return;const f=s.clone(),{center:m,zoom:g,pitch:v,bearing:C,elevation:L}=this.transformCameraUpdate(f);m&&(f.center=m),g!==void 0&&(f.zoom=g),v!==void 0&&(f.pitch=v),C!==void 0&&(f.bearing=C),L!==void 0&&(f.elevation=L),this.transform.apply(f)}_fireMoveEvents(s){this.fire(new l.k("move",s)),this._zooming&&this.fire(new l.k("zoom",s)),this._rotating&&this.fire(new l.k("rotate",s)),this._pitching&&this.fire(new l.k("pitch",s))}_afterEase(s,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const m=this._zooming,g=this._rotating,v=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new l.k("zoomend",s)),g&&this.fire(new l.k("rotateend",s)),v&&this.fire(new l.k("pitchend",s)),this.fire(new l.k("moveend",s))}flyTo(s,f){var m;if(!s.essential&&I.prefersReducedMotion){const Cn=l.L(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Cn,f)}this.stop(),s=l.e({offset:[0,0],speed:1.2,curve:1.42,easing:l.b7},s);const g=this._getTransformForUpdate(),v=this.getZoom(),C=this.getBearing(),L=this.getPitch(),M=this.getPadding(),R="bearing"in s?this._normalizeBearing(s.bearing,C):C,z="pitch"in s?+s.pitch:L,F="padding"in s?s.padding:g.padding,Z=l.P.convert(s.offset);let ue=g.centerPoint.add(Z);const le=g.pointLocation(ue),{center:fe,zoom:ne}=g.getConstrained(l.M.convert(s.center||le),(m=s.zoom)!==null&&m!==void 0?m:v);this._normalizeCenter(fe);const we=g.zoomScale(ne-v),Be=g.project(le),pe=g.project(fe).sub(Be);let Pe=s.curve;const Ue=Math.max(g.width,g.height),qe=Ue/we,Xe=pe.mag();if("minZoom"in s){const Cn=l.ac(Math.min(s.minZoom,v,ne),g.minZoom,g.maxZoom),Ht=Ue/g.zoomScale(Cn-v);Pe=Math.sqrt(Ht/Xe*2)}const tt=Pe*Pe;function $e(Cn){const Ht=(qe*qe-Ue*Ue+(Cn?-1:1)*tt*tt*Xe*Xe)/(2*(Cn?qe:Ue)*tt*Xe);return Math.log(Math.sqrt(Ht*Ht+1)-Ht)}function ut(Cn){return(Math.exp(Cn)-Math.exp(-Cn))/2}function pt(Cn){return(Math.exp(Cn)+Math.exp(-Cn))/2}const sn=$e(!1);let dt=function(Cn){return pt(sn)/pt(sn+Pe*Cn)},Ut=function(Cn){return Ue*((pt(sn)*(ut(Ht=sn+Pe*Cn)/pt(Ht))-ut(sn))/tt)/Xe;var Ht},an=($e(!0)-sn)/Pe;if(Math.abs(Xe)<1e-6||!isFinite(an)){if(Math.abs(Ue-qe)<1e-6)return this.easeTo(s,f);const Cn=qes.maxDuration&&(s.duration=0),this._zooming=!0,this._rotating=C!==R,this._pitching=z!==L,this._padding=!g.isPaddingEqual(F),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(fe),this._ease(Cn=>{const Ht=Cn*an,hn=1/dt(Ht);g.zoom=Cn===1?ne:v+g.scaleZoom(hn),this._rotating&&(g.bearing=l.z.number(C,R,Cn)),this._pitching&&(g.pitch=l.z.number(L,z,Cn)),this._padding&&(g.interpolatePadding(M,F,Cn),ue=g.centerPoint.add(Z)),this.terrain&&!s.freezeElevation&&this._updateElevation(Cn);const pn=Cn===1?fe:g.unproject(Be.add(pe.mult(Ut(Ht))).mult(hn));g.setLocationAtPoint(g.renderWorldCopies?pn.wrap():pn,ue),this._applyUpdatedTransform(g),this._fireMoveEvents(f)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(f)},s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const m=this._onEaseEnd;delete this._onEaseEnd,m.call(this,f)}if(!s){const m=this.handlers;m&&m.stop(!1)}return this}_ease(s,f,m){m.animate===!1||m.duration===0?(s(1),f()):(this._easeStart=I.now(),this._easeOptions=m,this._onEaseFrame=s,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(s,f){s=l.b1(s,-180,180);const m=Math.abs(s-f);return Math.abs(s-360-f)180?-360:m<-180?360:0}queryTerrainElevation(s){return this.terrain?this.terrain.getElevationForLngLatZoom(l.M.convert(s),this.transform.tileZoom)-this.transform.elevation:null}}const Pp={compact:!0,customAttribution:'MapLibre'};class xs{constructor(s=Pp){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=s}getDefaultPosition(){return"bottom-right"}onAdd(s){return this._map=s,this._compact=this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(s,f){const m=this._map._getUIString(`AttributionControl.${f}`);s.title=m,s.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let s=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=s.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&s.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const f=this._map.style.sourceCaches;for(const g in f){const v=f[g];if(v.used||v.usedForTerrain){const C=v.getSource();C.attribution&&s.indexOf(C.attribution)<0&&s.push(C.attribution)}}s=s.filter(g=>String(g).trim()),s.sort((g,v)=>g.length-v.length),s=s.filter((g,v)=>{for(let C=v+1;C=0)return!1;return!0});const m=s.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,s.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class jm{constructor(s={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const m=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=s}getDefaultPosition(){return"bottom-left"}onAdd(s){this._map=s,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const f=T.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class _c{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const f=++this._id;return this._queue.push({callback:s,id:f,cancelled:!1}),f}remove(s){const f=this._currentlyRunning,m=f?this._queue.concat(f):this._queue;for(const g of m)if(g.id===s)return void(g.cancelled=!0)}run(s=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const m of f)if(!m.cancelled&&(m.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Tr=l.X([{name:"a_pos3d",type:"Int16",components:3}]);class Gr extends l.E{constructor(s){super(),this.sourceCache=s,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,s.usedForTerrain=!0,s.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(s,f){this.sourceCache.update(s,f),this._renderableTilesKeys=[];const m={};for(const g of s.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),l.aN(g.posMatrix,0,l.W,0,l.W,0,1),this._tiles[g.key]=new Qo(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(s){for(const f in this._tiles){const m=this._tiles[f];(!s||m.tileID.equals(s)||m.tileID.isChildOf(s)||s.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(s=>this.getTileByID(s))}getTileByID(s){return this._tiles[s]}getTerrainCoords(s){const f={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16),l.aN(v.posMatrix,0,l.W,0,l.W,0,1),f[m]=v}else if(g.canonical.isChildOf(s.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=g.canonical.z-s.canonical.z,L=g.canonical.x-(g.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,R,0,R,0,1),l.H(v.posMatrix,v.posMatrix,[-L*R,-M*R,0]),f[m]=v}else if(s.canonical.isChildOf(g.canonical)){const v=s.clone();v.posMatrix=new Float64Array(16);const C=s.canonical.z-g.canonical.z,L=s.canonical.x-(s.canonical.x>>C<>C<>C;l.aN(v.posMatrix,0,l.W,0,l.W,0,1),l.H(v.posMatrix,v.posMatrix,[L*R,M*R,0]),l.J(v.posMatrix,v.posMatrix,[1/2**C,1/2**C,0]),f[m]=v}}return f}getSourceTile(s,f){const m=this.sourceCache._source;let g=s.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g=m.minzoom&&(!v||!v.dem);)v=this.sourceCache.getTileByID(s.scaledTo(g--).key);return v}tilesAfterTime(s=Date.now()){return Object.values(this._tiles).filter(f=>f.timeAdded>=s)}}class qm{constructor(s,f,m){this.painter=s,this.sourceCache=new Gr(f),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(s,f,m,g=l.W){var v;if(!(f>=0&&f=0&&ms.canonical.z&&(s.canonical.z>=g?v=s.canonical.z-g:l.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=s.canonical.x-(s.canonical.x>>v<>v<>8<<4|v>>8,f[C+3]=0;const m=new l.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),g=new Y(s,m,s.gl.RGBA,{premultiply:!1});return g.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(s){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),m=this.painter.context,g=m.gl,v=Math.round(s.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(s.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(v,L-C-1,1,1,g.RGBA,g.UNSIGNED_BYTE,f),m.bindFramebuffer.set(null);const M=f[0]+(f[2]>>4<<8),R=f[1]+((15&f[2])<<8),z=this.coordsIndex[255-f[3]],F=z&&this.sourceCache.getTileByID(z);if(!F)return null;const Z=this._coordsTextureSize,ue=(1<s.id!==f),this._recentlyUsed.push(s.id)}stampObject(s){s.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const s=this._createObject(this._objects.length);return this._objects.push(s),s}freeObject(s){s.inUse=!1}freeAllObjects(){for(const s of this._objects)this.freeObject(s)}isFull(){return!(this._objects.length!s.inUse)===!1}}const xa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Mp{constructor(s,f){this.painter=s,this.terrain=f,this.pool=new yc(s.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(s){return this.pool.getObjectForId(s.rtt[this._stacks.length-1].id).texture}prepareForRender(s,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=s._order.filter(m=>!s._layers[m].isHidden(f)),this._coordsDescendingInv={};for(const m in s.sourceCaches){this._coordsDescendingInv[m]={};const g=s.sourceCaches[m].getVisibleCoordinates();for(const v of g){const C=this.terrain.sourceCache.getTerrainCoords(v);for(const L in C)this._coordsDescendingInv[m][L]||(this._coordsDescendingInv[m][L]=[]),this._coordsDescendingInv[m][L].push(C[L])}}this._coordsDescendingInvStr={};for(const m of s._order){const g=s._layers[m],v=g.source;if(xa[g.type]&&!this._coordsDescendingInvStr[v]){this._coordsDescendingInvStr[v]={};for(const C in this._coordsDescendingInv[v])this._coordsDescendingInvStr[v][C]=this._coordsDescendingInv[v][C].map(L=>L.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const v=this._coordsDescendingInvStr[g][m.tileID.key];v&&v!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(s){if(s.isHidden(this.painter.transform.zoom))return!1;const f=s.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===s.id;if(xa[f]&&(this._prevType&&xa[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(s.id),!g))return!0;if(xa[this._prevType]||xa[f]&&g){this._prevType=f;const v=this._stacks.length-1,C=this._stacks[v]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(Th(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[v]){const R=this.pool.getObjectForId(L.rtt[v].id);if(R.stamp===L.rtt[v].stamp){this.pool.useObject(R);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),L.rtt[v]={id:M.id,stamp:M.stamp},m.context.bindFramebuffer.set(M.fbo.framebuffer),m.context.clear({color:l.aO.transparent,stencil:0}),m.currentStencilSource=void 0;for(let R=0;R{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Dp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Rp{constructor(s,f,m=!1){this.mousedown=C=>{this.startMouse(l.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),T.mousePos(this.element,C)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,T.mousePos(this.element,C))},this.mouseup=C=>{this.mouseRotate.dragEnd(C),this.mousePitch&&this.mousePitch.dragEnd(C),this.offTemp()},this.touchstart=C=>{C.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=T.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=T.touchPos(this.element,C.targetTouches)[0],this.moveTouch(C,this._lastPos))},this.touchend=C=>{C.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=s.dragRotate._mouseRotate.getClickTolerance(),v=s.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=yu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:L,bearingDegreesPerPixelMoved:M=.8})=>{const R=new Et;return new _u({clickTolerance:L,move:(z,F)=>({bearingDelta:(F.x-z.x)*M}),moveStateManager:R,enable:C,assignEvents:Rh})})({clickTolerance:g,enable:!0}),this.map=s,m&&(this.mousePitch=vu({clickTolerance:v,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:L,pitchDegreesPerPixelMoved:M=-.5})=>{const R=new Et;return new _u({clickTolerance:L,move:(z,F)=>({pitchDelta:(F.y-z.y)*M}),moveStateManager:R,enable:C,assignEvents:Rh})})({clickTolerance:v,enable:!0})),T.addEventListener(f,"mousedown",this.mousedown),T.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(f,"touchcancel",this.reset)}startMouse(s,f){this.mouseRotate.dragStart(s,f),this.mousePitch&&this.mousePitch.dragStart(s,f),T.disableDrag()}startTouch(s,f){this.touchRotate.dragStart(s,f),this.touchPitch&&this.touchPitch.dragStart(s,f),T.disableDrag()}moveMouse(s,f){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(s,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:v}=this.mousePitch.dragMove(s,f)||{};v&&m.setPitch(m.getPitch()+v)}}moveTouch(s,f){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(s,f)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:v}=this.touchPitch.dragMove(s,f)||{};v&&m.setPitch(m.getPitch()+v)}}off(){const s=this.element;T.removeEventListener(s,"mousedown",this.mousedown),T.removeEventListener(s,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(s,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let wa;function Nh(y,s,f){const m=new l.M(y.lng,y.lat);if(y=new l.M(y.lng,y.lat),s){const g=new l.M(y.lng-360,y.lat),v=new l.M(y.lng+360,y.lat),C=f.locationPoint(y).distSqr(s);f.locationPoint(g).distSqr(s)180;){const g=f.locationPoint(y);if(g.x>=0&&g.y>=0&&g.x<=f.width&&g.y<=f.height)break;y.lng>f.center.lng?y.lng-=360:y.lng+=360}return y.lng!==m.lng&&f.locationPoint(y).y>f.height/2-f.getHorizon()?y:m}const bc={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 Oh(y,s,f){const m=y.classList;for(const g in bc)m.remove(`maplibregl-${f}-anchor-${g}`);m.add(`maplibregl-${f}-anchor-${s}`)}class xc extends l.E{constructor(s){if(super(),this._onKeyPress=f=>{const m=f.code,g=f.charCode||f.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=f=>{const m=f.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=f=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Nh(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let v="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?v=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(v=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),f&&f.type!=="moveend"||(this._pos=this._pos.round()),T.setTransform(this._element,`${bc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${v}`),I.frameAsync(new AbortController).then(()=>{this._updateOpacity(f&&f.type==="moveend")}).catch(()=>{})},this._onMove=f=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=f.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.k("dragstart"))),this.fire(new l.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment!=="auto"?s.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(s==null?void 0:s.opacity,s==null?void 0:s.opacityWhenCovered),s&&s.element)this._element=s.element,this._offset=l.P.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div"),this._element.setAttribute("aria-label","Map marker");const f=T.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${m}px`),f.setAttributeNS(null,"width",`${g}px`),f.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const v=T.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");const C=T.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");const M=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const we of M){const Be=T.createNS("http://www.w3.org/2000/svg","ellipse");Be.setAttributeNS(null,"opacity","0.04"),Be.setAttributeNS(null,"cx","10.5"),Be.setAttributeNS(null,"cy","5.80029008"),Be.setAttributeNS(null,"rx",we.rx),Be.setAttributeNS(null,"ry",we.ry),L.appendChild(Be)}const R=T.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill",this._color);const z=T.createNS("http://www.w3.org/2000/svg","path");z.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),R.appendChild(z);const F=T.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const Z=T.createNS("http://www.w3.org/2000/svg","path");Z.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),F.appendChild(Z);const ue=T.createNS("http://www.w3.org/2000/svg","g");ue.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ue.setAttributeNS(null,"fill","#FFFFFF");const le=T.createNS("http://www.w3.org/2000/svg","g");le.setAttributeNS(null,"transform","translate(8.0, 8.0)");const fe=T.createNS("http://www.w3.org/2000/svg","circle");fe.setAttributeNS(null,"fill","#000000"),fe.setAttributeNS(null,"opacity","0.25"),fe.setAttributeNS(null,"cx","5.5"),fe.setAttributeNS(null,"cy","5.5"),fe.setAttributeNS(null,"r","5.4999962");const ne=T.createNS("http://www.w3.org/2000/svg","circle");ne.setAttributeNS(null,"fill","#FFFFFF"),ne.setAttributeNS(null,"cx","5.5"),ne.setAttributeNS(null,"cy","5.5"),ne.setAttributeNS(null,"r","5.4999962"),le.appendChild(fe),le.appendChild(ne),C.appendChild(L),C.appendChild(R),C.appendChild(F),C.appendChild(ue),C.appendChild(le),f.appendChild(C),f.setAttributeNS(null,"height",m*this._scale+"px"),f.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(f),this._offset=l.P.convert(s&&s.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()}),Oh(this._element,this._anchor,"marker"),s&&s.className)for(const f of s.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(s){return this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._update),s.on("moveend",this._update),s.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.M.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const g=Math.abs(13.5)/Math.SQRT2;s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const s=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:s?(s.isOpen()?s.remove():(s.setLngLat(this._lngLat),s.addTo(this._map)),this):this}_updateOpacity(s=!1){var f,m;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(s)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const g=this._map,v=g.terrain.depthAtPoint(this._pos),C=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,C)-v<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/g.transform._pixelPerMeter,M=Math.sin(g.getPitch()*Math.PI/180)*L,R=g.terrain.depthAtPoint(new l.P(this._pos.x,this._pos.y-this._offset.y)),z=g.transform.lngLatToCameraDepth(this._lngLat,C+M)-R>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(s){return this._offset=l.P.convert(s),this._update(),this}addClassName(s){this._element.classList.add(s)}removeClassName(s){this._element.classList.remove(s)}toggleClassName(s){return this._element.classList.toggle(s)}setDraggable(s){return this._draggable=!!s,this._map&&(s?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(s){return this._rotation=s||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(s){return this._rotationAlignment=s||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(s){return this._pitchAlignment=s&&s!=="auto"?s:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(s,f){return s===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),s!==void 0&&(this._opacity=s),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const zh={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let xu=0,Rl=!1;const Fh={maxWidth:100,unit:"metric"};function Bh(y,s,f){const m=f&&f.maxWidth||100,g=y._container.clientHeight/2,v=y.unproject([0,g]),C=y.unproject([m,g]),L=v.distanceTo(C);if(f&&f.unit==="imperial"){const M=3.2808*L;M>5280?Nl(s,m,M/5280,y._getUIString("ScaleControl.Miles")):Nl(s,m,M,y._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Nl(s,m,L/1852,y._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Nl(s,m,L/1e3,y._getUIString("ScaleControl.Kilometers")):Nl(s,m,L,y._getUIString("ScaleControl.Meters"))}function Nl(y,s,f,m){const g=function(v){const C=Math.pow(10,`${Math.floor(v)}`.length-1);let L=v/C;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(M){const R=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*R)/R}(L),C*L}(f);y.style.width=s*(g/f)+"px",y.innerHTML=`${g} ${m}`}const Np={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Op=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Vh(y){if(y){if(typeof y=="number"){const s=Math.round(Math.abs(y)/Math.SQRT2);return{center:new l.P(0,0),top:new l.P(0,y),"top-left":new l.P(s,s),"top-right":new l.P(-s,s),bottom:new l.P(0,-y),"bottom-left":new l.P(s,-s),"bottom-right":new l.P(-s,-s),left:new l.P(y,0),right:new l.P(-y,0)}}if(y instanceof l.P||Array.isArray(y)){const s=l.P.convert(y);return{center:s,top:s,"top-left":s,"top-right":s,bottom:s,"bottom-left":s,"bottom-right":s,left:s,right:s}}return{center:l.P.convert(y.center||[0,0]),top:l.P.convert(y.top||[0,0]),"top-left":l.P.convert(y["top-left"]||[0,0]),"top-right":l.P.convert(y["top-right"]||[0,0]),bottom:l.P.convert(y.bottom||[0,0]),"bottom-left":l.P.convert(y["bottom-left"]||[0,0]),"bottom-right":l.P.convert(y["bottom-right"]||[0,0]),left:l.P.convert(y.left||[0,0]),right:l.P.convert(y.right||[0,0])}}return Vh(new l.P(0,0))}const Wm=d;c.AJAXError=l.be,c.Evented=l.E,c.LngLat=l.M,c.MercatorCoordinate=l.Y,c.Point=l.P,c.addProtocol=l.bf,c.config=l.a,c.removeProtocol=l.bg,c.AttributionControl=xs,c.BoxZoomHandler=vs,c.CanvasSource=gs,c.CooperativeGesturesHandler=Dt,c.DoubleClickZoomHandler=Tp,c.DragPanHandler=Gm,c.DragRotateHandler=bs,c.EdgeInsets=mu,c.FullscreenControl=class extends l.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var s;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((s=f==null?void 0:f.shadowRoot)===null||s===void 0)&&s.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:l.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new l.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new l.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},c.GeoJSONSource=Dr,c.GeolocateControl=class extends l.E{constructor(y){super(),this._onSuccess=s=>{if(this._map){if(this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new l.k("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=s,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(s),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new l.k("geolocate",s)),this._finish()}},this._updateCamera=s=>{const f=new l.M(s.coords.longitude,s.coords.latitude),m=s.coords.accuracy,g=this._map.getBearing(),v=l.e({bearing:g},this.options.fitBoundsOptions),C=Ce.fromLngLat(f,m);this._map.fitBounds(C,v,{geolocateSource:!0})},this._updateMarker=s=>{if(s){const f=new l.M(s.coords.longitude,s.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=s=>{if(this._map){if(this.options.trackUserLocation)if(s.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(s.code===3&&Rl)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new l.k("error",s)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=s=>{if(this._map){if(this._container.addEventListener("contextmenu",f=>f.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1){l.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xc({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new l.k("trackuserlocationend")))})}},this.options=l.e({},zh,y)}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(){return l._(this,arguments,void 0,function*(s=!1){if(wa!==void 0&&!s)return wa;if(window.navigator.permissions===void 0)return wa=!!window.navigator.geolocation,wa;try{wa=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{wa=!!window.navigator.geolocation}return wa})}().then(s=>this._setupUI(s)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xu=0,Rl=!1}_isOutOfMapMaxBounds(y){const s=this._map.getMaxBounds(),f=y.coords;return s&&(f.longitudes.getEast()||f.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const y=this._map.getBounds(),s=y.getSouthEast(),f=y.getNorthEast(),m=s.distanceTo(f),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return l.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xu--,Rl=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new l.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xu++,xu>1?(y={maximumAge:6e5,timeout:0},Rl=!0):(y=this.options.positionOptions,Rl=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},c.Hash=Sp,c.ImageSource=tr,c.KeyboardHandler=Qa,c.LngLatBounds=Ce,c.LogoControl=jm,c.Map=class extends vo{constructor(y){if(l.bc.mark(l.bd.create),(y=l.e({},vc,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Lh(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._contextLost=s=>{s.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new l.k("webglcontextlost",{originalEvent:s}))},this._contextRestored=s=>{this._setupPainter(),this.resize(),this._update(),this.fire(new l.k("webglcontextrestored",{originalEvent:s}))},this._onMapScroll=s=>{if(s.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new _c,this._controls=[],this._mapId=l.a3(),this._locale=l.e({},Ap,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=j.addThrottleControl(()=>this.isMoving()),this._requestManager=new J(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let s=!1;const f=wp(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{s?f(m):s=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Lp(this,y),this._hash=y.hash&&new Sp(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,l.e({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new xs(typeof y.attributionControl=="boolean"?void 0:y.attributionControl)),y.maplibreLogo&&this.addControl(new jm,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new l.k(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new l.k(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new l.k("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(y,s){if(s===void 0&&(s=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new l.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=y.onAdd(this);this._controls.push(y);const m=this._controlPositions[s];return s.indexOf("bottom")!==-1?m.insertBefore(f,m.firstChild):m.appendChild(f),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new l.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(y);return s>-1&&this._controls.splice(s,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,s,f,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,s,f,m)}resize(y){var s;const f=this._containerDimensions(),m=f[0],g=f[1],v=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,v),this.painter.resize(m,g,v),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const M=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,M),this.painter.resize(m,g,M)}this.transform.resize(m,g),(s=this._requestedCameraState)===null||s===void 0||s.resize(m,g);const C=!this._moving;return C&&(this.stop(),this.fire(new l.k("movestart",y)).fire(new l.k("move",y))),this.fire(new l.k("resize",y)),C&&this.fire(new l.k("moveend",y)),this}_getClampedPixelRatio(y,s){const{0:f,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),v=y*g,C=s*g;return Math.min(v>f?f/v:1,C>m?m/C:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(Ce.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}project(y){return this.transform.locationPoint(l.M.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(l.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,s,f){if(y==="mouseenter"||y==="mouseover"){let m=!1;return{layer:s,listener:f,delegates:{mousemove:v=>{const C=this.getLayer(s)?this.queryRenderedFeatures(v.point,{layers:[s]}):[];C.length?m||(m=!0,f.call(this,new yo(y,this,v.originalEvent,{features:C}))):m=!1},mouseout:()=>{m=!1}}}}if(y==="mouseleave"||y==="mouseout"){let m=!1;return{layer:s,listener:f,delegates:{mousemove:C=>{(this.getLayer(s)?this.queryRenderedFeatures(C.point,{layers:[s]}):[]).length?m=!0:m&&(m=!1,f.call(this,new yo(y,this,C.originalEvent)))},mouseout:C=>{m&&(m=!1,f.call(this,new yo(y,this,C.originalEvent)))}}}}{const m=g=>{const v=this.getLayer(s)?this.queryRenderedFeatures(g.point,{layers:[s]}):[];v.length&&(g.features=v,f.call(this,g),delete g.features)};return{layer:s,listener:f,delegates:{[y]:m}}}}on(y,s,f){if(f===void 0)return super.on(y,s);const m=this._createDelegatedListener(y,s,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(y,s,f){if(f===void 0)return super.once(y,s);const m=this._createDelegatedListener(y,s,f);for(const g in m.delegates)this.once(g,m.delegates[g]);return this}off(y,s,f){return f===void 0?super.off(y,s):(this._delegatedListeners&&this._delegatedListeners[y]&&(m=>{const g=this._delegatedListeners[y];for(let v=0;vthis._updateStyle(y,s));const f=this.style&&s.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new No(this,s||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,s,f):this.style.loadJSON(y,s,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new No(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,s){if(typeof y=="string"){const f=this._requestManager.transformRequest(y,"Style");l.h(f,new AbortController).then(m=>{this._updateDiff(m.data,s)}).catch(m=>{m&&this.fire(new l.j(m))})}else typeof y=="object"&&this._updateDiff(y,s)}_updateDiff(y,s){try{this.style.setState(y,s)&&this._update(!0)}catch(f){l.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(y,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.w("There is no style added to the map.")}addSource(y,s){return this._lazyInitEmptyStyle(),this.style.addSource(y,s),this._update(!0)}isSourceLoaded(y){const s=this.style&&this.style.sourceCaches[y];if(s!==void 0)return s.loaded();this.fire(new l.j(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const s=this.style.sourceCaches[y.source];if(!s)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&s.reload();for(const f in this.style._layers){const m=this.style._layers[f];m.type==="hillshade"&&m.source===y.source&&l.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new qm(this.painter,s,y),this.painter.renderToTexture=new Mp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==y.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new l.k("terrain",{terrain:y})),this}getTerrain(){var y,s;return(s=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&s!==void 0?s:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const s in y){const f=y[s]._tiles;for(const m in f){const g=f[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,s,f={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:v,stretchY:C,content:L}=f;if(this._lazyInitEmptyStyle(),!(s instanceof HTMLImageElement||l.b(s))){if(s.width===void 0||s.height===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:R,data:z}=s,F=s;return this.style.addImage(y,{data:new l.R({width:M,height:R},new Uint8Array(z)),pixelRatio:m,stretchX:v,stretchY:C,content:L,sdf:g,version:0,userImage:F}),F.onAdd&&F.onAdd(this,y),this}}{const{width:M,height:R,data:z}=I.getImageData(s);this.style.addImage(y,{data:new l.R({width:M,height:R},z),pixelRatio:m,stretchX:v,stretchY:C,content:L,sdf:g,version:0})}}updateImage(y,s){const f=this.style.getImage(y);if(!f)return this.fire(new l.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const m=s instanceof HTMLImageElement||l.b(s)?I.getImageData(s):s,{width:g,height:v,data:C}=m;if(g===void 0||v===void 0)return this.fire(new l.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(g!==f.data.width||v!==f.data.height)return this.fire(new l.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(s instanceof HTMLImageElement||l.b(s));return f.data.replace(C,L),this.style.updateImage(y,f),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new l.j(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return j.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,s){return this._lazyInitEmptyStyle(),this.style.addLayer(y,s),this._update(!0)}moveLayer(y,s){return this.style.moveLayer(y,s),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,s,f){return this.style.setLayerZoomRange(y,s,f),this._update(!0)}setFilter(y,s,f={}){return this.style.setFilter(y,s,f),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,s,f,m={}){return this.style.setPaintProperty(y,s,f,m),this._update(!0)}getPaintProperty(y,s){return this.style.getPaintProperty(y,s)}setLayoutProperty(y,s,f,m={}){return this.style.setLayoutProperty(y,s,f,m),this._update(!0)}getLayoutProperty(y,s){return this.style.getLayoutProperty(y,s)}setGlyphs(y,s={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,s),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,s,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,s,f,m=>{m||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,s={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,s,f=>{f||this._update(!0)}),this}setLight(y,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,s),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,s){return this.style.setFeatureState(y,s),this._update()}removeFeatureState(y,s){return this.style.removeFeatureState(y,s),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,s=0;return this._container&&(y=this._container.clientWidth||400,s=this._container.clientHeight||300),[y,s]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const s=this._canvasContainer=T.create("div","maplibregl-canvas-container",y);this._interactive&&s.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const f=this._containerDimensions(),m=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],m);const g=this._controlContainer=T.create("div","maplibregl-control-container",y),v=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{v[C]=T.create("div",`maplibregl-ctrl-${C} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,s,f){this._canvas.width=Math.floor(f*y),this._canvas.height=Math.floor(f*s),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${s}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let s=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{s={requestedAttributes:y},m&&(s.statusMessage=m.statusMessage,s.type=m.type)},{once:!0});const f=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!f){const m="Failed to initialize WebGL";throw s?(s.message=m,new Error(JSON.stringify(s))):new Error(m)}this.painter=new Am(f,this.transform),k.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const s=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,v=I.now();this.style.zoomHistory.update(g,v);const C=new l.a8(g,{now:v,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=C.crossFadingFactor();L===1&&L===this._crossFadingFactor||(f=!0,this._crossFadingFactor=L),this.style.update(C)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new l.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.bc.mark(l.bd.load),this.fire(new l.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,l.bc.mark(l.bd.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),j.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),l.bc.clearMetrics(),this._removed=!0,this.fire(new l.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,I.frameAsync(this._frameRequest).then(y=>{l.bc.frame(y),this._frameRequest=null,this._render(y)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return kp}getCameraTargetElevation(){return this.transform.elevation}},c.MapMouseEvent=yo,c.MapTouchEvent=Gs,c.MapWheelEvent=Ep,c.Marker=xc,c.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const s=this._map.getZoom(),f=s===this._map.getMaxZoom(),m=s===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=s},this._setButtonTitle=(s,f)=>{const m=this._map._getUIString(`NavigationControl.${f}`);s.title=m,s.setAttribute("aria-label",m)},this.options=l.e({},Dp,y),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",s=>this._map.zoomIn({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",s=>this._map.zoomOut({},{originalEvent:s})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",s=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:s}):this._map.resetNorth({},{originalEvent:s})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Rp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,s){const f=T.create("button",y,this._container);return f.type="button",f.addEventListener("click",s),f}},c.Popup=class extends l.E{constructor(y){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new l.k("close"))),this),this._onMouseUp=s=>{this._update(s.point)},this._onMouseMove=s=>{this._update(s.point)},this._onDrag=s=>{this._update(s.point)},this._update=s=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const L of this.options.className.split(" "))this._container.classList.add(L);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Nh(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!s)return;const m=this._flatPos=this._pos=this._trackPointer&&s?s:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&s?s:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const v=Vh(this.options.offset);if(!g){const L=this._container.offsetWidth,M=this._container.offsetHeight;let R;R=m.y+v.bottom.ythis._map.transform.height-M?["bottom"]:[],m.xthis._map.transform.width-L/2&&R.push("right"),g=R.length===0?"bottom":R.join("-")}let C=m.add(v[g]);this.options.subpixelPositioning||(C=C.round()),T.setTransform(this._container,`${bc[g]} translate(${C.x}px,${C.y}px)`),Oh(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=l.e(Object.create(Np),y)}addTo(y){return this._map&&this.remove(),this._map=y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new l.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=l.M.convert(y),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const s=document.createDocumentFragment(),f=document.createElement("body");let m;for(f.innerHTML=y;m=f.firstChild,m;)s.appendChild(m);return this.setDOMContent(s)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Op);y&&y.focus()}},c.RasterDEMTileSource=en,c.RasterTileSource=ze,c.ScaleControl=class{constructor(y){this._onMove=()=>{Bh(this._map,this._container,this.options)},this.setUnit=s=>{this.options.unit=s,Bh(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Fh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},c.ScrollZoomHandler=kh,c.Style=No,c.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},c.TwoFingersTouchPitchHandler=Bm,c.TwoFingersTouchRotateHandler=Cp,c.TwoFingersTouchZoomHandler=Fm,c.TwoFingersTouchZoomRotateHandler=mc,c.VectorTileSource=xn,c.VideoSource=Do,c.addSourceType=(y,s)=>l._(void 0,void 0,void 0,function*(){if(Ha(y))throw new Error(`A source type called "${y}" already exists.`);((f,m)=>{Bs[f]=m})(y,s)}),c.clearPrewarmedResources=function(){const y=bn;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(kt),bn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},c.getMaxParallelImageRequests=function(){return l.a.MAX_PARALLEL_IMAGE_REQUESTS},c.getRTLTextPluginStatus=function(){return at().getRTLTextPluginStatus()},c.getVersion=function(){return Wm},c.getWorkerCount=function(){return un.workerCount},c.getWorkerUrl=function(){return l.a.WORKER_URL},c.importScriptInWorkers=function(y){return $r().broadcast("IS",y)},c.prewarm=function(){Bn().acquire(kt)},c.setMaxParallelImageRequests=function(y){l.a.MAX_PARALLEL_IMAGE_REQUESTS=y},c.setRTLTextPlugin=function(y,s){return at().setRTLTextPlugin(y,s)},c.setWorkerCount=function(y){un.workerCount=y},c.setWorkerUrl=function(y){l.a.WORKER_URL=y}});var a=n;return a})})(zI);var _D=zI.exports;const Ts=Dv(_D);var yD=Object.defineProperty,vD=(t,e,n)=>e in t?yD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zw=(t,e,n)=>(vD(t,typeof e!="symbol"?e+"":e,n),n);function Ad(){}function BI(t){return t()}function Xw(){return Object.create(null)}function A_(t){t.forEach(BI)}function VI(t){return typeof t=="function"}function bD(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function xD(t){return Object.keys(t).length===0}function wD(t,e){t.appendChild(e)}function SD(t,e,n){t.insertBefore(e,n||null)}function UI(t){t.parentNode&&t.parentNode.removeChild(t)}function Yw(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Lu(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function ED(t){return Array.from(t.childNodes)}function vg(t,e,n){t.classList.toggle(e,!!n)}let t1;function Id(t){t1=t}const cf=[],Kw=[];let _f=[];const Jw=[],ID=Promise.resolve();let ov=!1;function CD(){ov||(ov=!0,ID.then(GI))}function sv(t){_f.push(t)}const I0=new Set;let rf=0;function GI(){if(rf!==0)return;const t=t1;do{try{for(;rft.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),_f=e}const PD=new Set;function MD(t,e){t&&t.i&&(PD.delete(t),t.i(e))}function AD(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),sv(()=>{const a=t.$$.on_mount.map(BI).filter(VI);t.$$.on_destroy?t.$$.on_destroy.push(...a):A_(a),t.$$.on_mount=[]}),i.forEach(sv)}function kD(t,e){const n=t.$$;n.fragment!==null&&(LD(n.after_update),A_(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function DD(t,e){t.$$.dirty[0]===-1&&(cf.push(t),CD(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const D=k.length?k[0]:T;return w.ctx&&i(w.ctx[I],w.ctx[I]=D)&&(!w.skip_bound&&w.bound[I]&&w.bound[I](D),S&&DD(t,I)),T}):[],w.update(),S=!0,A_(w.before_update),w.fragment=r?r(w.ctx):!1,e.target){if(e.hydrate){const I=ED(e.target);w.fragment&&w.fragment.l(I),I.forEach(UI)}else w.fragment&&w.fragment.c();e.intro&&MD(t.$$.fragment),AD(t,e.target,e.anchor),GI()}Id(d)}class ND{constructor(){Zw(this,"$$"),Zw(this,"$$set")}$destroy(){kD(this,1),this.$destroy=Ad}$on(e,n){if(!VI(n))return Ad;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!xD(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const OD="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(OD);function zD(t){let e,n,r;return{c(){e=Yw("svg"),n=Yw("path"),Lu(n,"stroke-width","4"),Lu(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"),Lu(n,"class","svelte-gzo3ar"),Lu(e,"width",r=t[0]==="list"?20:void 0),Lu(e,"viewBox","0 0 70 85"),Lu(e,"fill","none"),Lu(e,"class","svelte-gzo3ar"),vg(e,"in-map",t[0]!=="list"),vg(e,"list-icon",t[0]==="list")},m(i,a){SD(i,e,a),wD(e,n)},p(i,[a]){a&1&&r!==(r=i[0]==="list"?20:void 0)&&Lu(e,"width",r),a&1&&vg(e,"in-map",i[0]!=="list"),a&1&&vg(e,"list-icon",i[0]==="list")},i:Ad,o:Ad,d(i){i&&UI(e)}}}function FD(t,e,n){let{displayIn:r}=e;return t.$$set=i=>{"displayIn"in i&&n(0,r=i.displayIn)},[r]}class BD extends ND{constructor(e){super(),RD(this,e,FD,zD,bD,{displayIn:0})}}const VD=[{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"}],UD={decimalLatitude:40.123,decimalLongitude:-74.123},GD=[{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}],jD=[{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 qD(){const t=[];return VD.forEach(e=>{e.decimalLatitude?t.push(e):t.push({...e,...UD})}),[...t,...GD,...jD]}const WD=qD();WD.map(t=>t.verbatimCoordinates);/** - * splaytree v3.1.2 - * Fast Splay tree for Node and browser - * - * @author Alexander Milevski - * @license MIT - * @preserve - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */function HD(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(w){return function(S){return d([w,S])}}function d(w){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=w[0]&2?i.return:w[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,w[1])).done)return a;switch(i=0,a&&(w=[w[0]&2,a.value]),w[0]){case 0:case 1:a=w;break;case 4:return n.label++,{value:w[1],done:!1};case 5:n.label++,i=w[1],w=[0];continue;case 7:w=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(w[0]===6||w[0]===2)){n=0;continue}if(w[0]===3&&(!a||w[1]>a[0]&&w[1]e?1:t0){if(e.right===null)break;if(n(t,e.right.key)>0){var l=e.right;if(e.right=l.left,l.left=e,e=l,e.right===null)break}i.right=e,i=e,e=e.right}else break}return i.right=e.left,a.left=e.right,e.left=r.right,e.right=r.left,e}function C0(t,e,n,r){var i=new zu(t,e);if(n===null)return i.left=i.right=null,i;n=ku(t,n,r);var a=r(t,n.key);return a<0?(i.left=n.left,i.right=n,n.left=null):a>=0&&(i.right=n.right,i.left=n,n.right=null),i}function Qw(t,e,n){var r=null,i=null;if(e){e=ku(t,e,n);var a=n(e.key,t);a===0?(r=e.left,i=e.right):a<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function XD(t,e,n){return e===null?t:(t===null||(e=ku(t.key,e,n),e.left=t),e)}function av(t,e,n,r,i){if(t){r(""+e+(n?"└── ":"├── ")+i(t)+` -`);var a=e+(n?" ":"│ ");t.left&&av(t.left,a,!1,r,i),t.right&&av(t.right,a,!0,r,i)}}var n1=function(){function t(e){e===void 0&&(e=ZD),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=C0(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new zu(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,a=ku(e,this._root,i),c=i(e,a.key);return c===0?this._root=a:(c<0?(r.left=a.left,r.right=a,a.left=null):c>0&&(r.right=a.right,r.left=a,a.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;if(n===null)return null;n=ku(e,n,r);var a=r(e,n.key);return a===0?(n.left===null?i=n.right:(i=ku(e,n.left,r),i.right=n.right),this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=ku(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=ku(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],a=!1;!a;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):a=!0;return this},t.prototype.range=function(e,n,r,i){for(var a=[],c=this._comparator,l=this._root,d;a.length!==0||l;)if(l)a.push(l),l=l.left;else{if(l=a.pop(),d=c(l.key,n),d>0)break;if(c(l.key,e)>=0&&r.call(i,l))return this;l=l.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,a=[];!r;)if(n)a.push(n),n=n.left;else if(a.length>0){if(n=a.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var a=i(e.key,n.key);if(a===0)break;a<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return KD(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,a=this._comparator;if(r&&cv(e,n,0,i-1,a),this._root===null)this._root=lv(e,n,0,i),this._size=i;else{var c=JD(this.toList(),YD(e,n),a);i=this._size+i,this._root=uv({head:c},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return av(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,a=Qw(e,this._root,i),c=a.left,l=a.right;i(e,n)<0?l=C0(n,r,l,i):c=C0(n,r,c,i),this._root=XD(c,l,i)},t.prototype.split=function(e){return Qw(e,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var e,n,r;return HD(this,function(i){switch(i.label){case 0:e=this._root,n=[],r=!1,i.label=1;case 1:return r?[3,6]:e===null?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return n.length===0?[3,4]:(e=n.pop(),[4,e]);case 3:return i.sent(),e=e.right,[3,5];case 4:r=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},t}();function lv(t,e,n,r){var i=r-n;if(i>0){var a=n+Math.floor(i/2),c=t[a],l=e[a],d=new zu(c,l);return d.left=lv(t,e,n,a),d.right=lv(t,e,a+1,r),d}return null}function YD(t,e){for(var n=new zu(null,null),r=n,i=0;i0?(e=a=a.next=n.pop(),e=e.right):r=!0;return a.next=null,i.next}function uv(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),a=uv(t,e,i),c=t.head;return c.left=a,t.head=t.head.next,c.right=uv(t,i+1,n),c}return null}function JD(t,e,n){for(var r=new zu(null,null),i=r,a=t,c=e;a!==null&&c!==null;)n(a.key,c.key)<0?(i.next=a,a=a.next):(i.next=c,c=c.next),i=i.next;return a!==null?i.next=a:c!==null&&(i.next=c),r.next}function cv(t,e,n,r,i){if(!(n>=r)){for(var a=t[n+r>>1],c=n-1,l=r+1;;){do c++;while(i(t[c],a)<0);do l--;while(i(t[l],a)>0);if(c>=l)break;var d=t[c];t[c]=t[l],t[l]=d,d=e[c],e[c]=e[l],e[l]=d}cv(t,e,n,l,i),cv(t,e,l+1,r,i)}}function _a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $w(t,e){for(var n=0;nn.x?1:e.yn.y?1:0}}]);function t(e,n){_a(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ho(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r=0&&I>=0?wT?-1:0:d<0&&I<0?wT?1:0:Id?1:0}}}]),t}(),rR=0,c_=function(){Ho(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,a=e.rightSE.point.x,c=n.rightSE.point.x;if(cl&&d>w)return-1;var I=e.comparePoint(n.leftSE.point);if(I<0)return 1;if(I>0)return-1;var T=n.comparePoint(e.rightSE.point);return T!==0?T:-1}if(r>i){if(ld&&l>S)return 1;var k=n.comparePoint(e.leftSE.point);if(k!==0)return k;var D=e.comparePoint(n.rightSE.point);return D<0?1:D>0?-1:1}if(ld)return 1;if(ac){var q=e.comparePoint(n.rightSE.point);if(q<0)return 1;if(q>0)return-1}if(a!==c){var ee=w-l,B=a-r,j=S-d,J=c-i;if(ee>B&&jJ)return-1}return a>c?1:aS?1:e.idn.id?1:0}}]);function t(e,n,r,i){_a(this,t),this.id=++rR,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return Ho(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:en?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x0&&l.swapEvents(),ll.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n0){var a=n;n=r,r=a}if(n.prev===r){var c=n;n=r,r=c}for(var l=0,d=r.rings.length;l0)i=n,a=e,c=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var d=new ll(i,!0),w=new ll(a,!1);return new t(d,w,[r],[c])}}]),t}(),i2=function(){function t(e,n,r){if(_a(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=kd.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var a=i,c=1,l=e.length;cthis.bbox.ur.x&&(this.bbox.ur.x=d.x),d.y>this.bbox.ur.y&&(this.bbox.ur.y=d.y),a=d)}(i.x!==a.x||i.y!==a.y)&&this.segments.push(c_.fromRing(a,i,this))}return Ho(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.interiorRings.push(a)}this.multiPoly=n}return Ho(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=a.bbox.ur.x),a.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=a.bbox.ur.y),this.polys.push(a)}this.isSubject=n}return Ho(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n0&&(e=i)}for(var a=e.segment.prevInResult(),c=a?a.prevInResult():null;;){if(!a)return null;if(!c)return a.ringOut;if(c.ringOut!==a.ringOut)return c.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=c.prevInResult(),c=a?a.prevInResult():null}}}]),t}(),s2=function(){function t(e){_a(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ho(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:c_.compare;_a(this,t),this.queue=e,this.tree=new n1(n),this.segments=[]}return Ho(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var a=i,c=i,l=void 0,d=void 0;l===void 0;)a=this.tree.prev(a),a===null?l=null:a.key.consumedBy===void 0&&(l=a.key);for(;d===void 0;)c=this.tree.next(c),c===null?d=null:c.key.consumedBy===void 0&&(d=c.key);if(e.isLeft){var w=null;if(l){var S=l.getIntersection(n);if(S!==null&&(n.isAnEndpoint(S)||(w=S),!l.isAnEndpoint(S)))for(var I=this._splitSafely(l,S),T=0,k=I.length;T0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=l)}else{if(l&&d){var te=l.getIntersection(d);if(te!==null){if(!l.isAnEndpoint(te))for(var $=this._splitSafely(l,te),Ae=0,Y=$.length;Aea2)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 aR(D),ae=D.size,me=D.pop();me;){var de=me.key;if(D.size===ae){var te=de.segment;throw new Error("Unable to pop() ".concat(de.isLeft?"left":"right"," SweepEvent ")+"[".concat(de.point.x,", ").concat(de.point.y,"] from segment #").concat(te.id," ")+"[".concat(te.leftSE.point.x,", ").concat(te.leftSE.point.y,"] -> ")+"[".concat(te.rightSE.point.x,", ").concat(te.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(D.size>a2)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(J.segments.length>lR)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var $=J.process(de),Ae=0,Y=$.length;Ae1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rn[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]e.x?1:this.ye.y?1:0};Ne.prototype.clone=function(){};Ne.prototype.copy=function(){return new Ne(this)};Ne.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};Ne.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)};Ne.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)};Ne.prototype.hashCode=function(){var t=17;return t=37*t+Ne.hashCode(this.x),t=37*t+Ne.hashCode(this.y),t};Ne.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};Ne.prototype.interfaces_=function(){return[ds,D_,ms]};Ne.prototype.getClass=function(){return Ne};Ne.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=$t.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}};Kc.DimensionalComparator.get=function(){return Xl};Kc.serialVersionUID.get=function(){return 6683108902428367e3};Kc.NULL_ORDINATE.get=function(){return $t.NaN};Kc.X.get=function(){return 0};Kc.Y.get=function(){return 1};Kc.Z.get=function(){return 2};Object.defineProperties(Ne,Kc);var Xl=function(t){if(this._dimensionsToTest=2,arguments.length!==0&&arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new lr("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};Xl.prototype.compare=function(t,e){var n=t,r=e,i=Xl.compare(n.x,r.x);if(i!==0)return i;var a=Xl.compare(n.y,r.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var c=Xl.compare(n.z,r.z);return c};Xl.prototype.interfaces_=function(){return[Ef]};Xl.prototype.getClass=function(){return Xl};Xl.compare=function(t,e){return te?1:$t.isNaN(t)?$t.isNaN(e)?0:-1:$t.isNaN(e)?1:0};var If=function(){};If.prototype.create=function(){};If.prototype.interfaces_=function(){return[]};If.prototype.getClass=function(){return If};var Fe=function(){},$d={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Fe.prototype.interfaces_=function(){return[]};Fe.prototype.getClass=function(){return Fe};Fe.toLocationSymbol=function(t){switch(t){case Fe.EXTERIOR:return"e";case Fe.BOUNDARY:return"b";case Fe.INTERIOR:return"i";case Fe.NONE:return"-"}throw new lr("Unknown location value: "+t)};$d.INTERIOR.get=function(){return 0};$d.BOUNDARY.get=function(){return 1};$d.EXTERIOR.get=function(){return 2};$d.NONE.get=function(){return-1};Object.defineProperties(Fe,$d);var Wt=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Zo=function(){},JI={LOG_10:{configurable:!0}};Zo.prototype.interfaces_=function(){return[]};Zo.prototype.getClass=function(){return Zo};Zo.log10=function(t){var e=Math.log(t);return $t.isInfinite(e)||$t.isNaN(e)?e:e/Zo.LOG_10};Zo.min=function(t,e,n,r){var i=t;return en?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],a=arguments[2];return ra?a:r}};Zo.wrap=function(t,e){return t<0?e- -t%e:t%e};Zo.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3],d=i;return a>d&&(d=a),c>d&&(d=c),l>d&&(d=l),d}};Zo.average=function(t,e){return(t+e)/2};JI.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Zo,JI);var ya=function(t){this.str=t};ya.prototype.append=function(t){this.str+=t};ya.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)};ya.prototype.toString=function(t){return this.str};var oa=function(t){this.value=t};oa.prototype.intValue=function(){return this.value};oa.prototype.compareTo=function(t){return this.valuet?1:0};oa.isNaN=function(t){return Number.isNaN(t)};var Dd=function(){};Dd.isWhitespace=function(t){return t<=32&&t>=0||t===127};Dd.toUpperCase=function(t){return t.toUpperCase()};var We=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.init(i,a)}},zs={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}};We.prototype.le=function(t){return(this._hi9?(S=!0,I="9"):I="0"+w,c.append(I),n=n.subtract(We.valueOf(w)).multiply(We.TEN),S&&n.selfAdd(We.TEN);var T=!0,k=We.magnitude(n._hi);if(k<0&&Math.abs(k)>=l-d&&(T=!1),!T)break}return e[0]=r,c.toString()};We.prototype.sqr=function(){return this.multiply(this)};We.prototype.doubleValue=function(){return this._hi+this._lo};We.prototype.subtract=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}};We.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};We.prototype.isZero=function(){return this._hi===0&&this._lo===0};We.prototype.selfSubtract=function(){if(arguments[0]instanceof We){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)}};We.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};We.prototype.min=function(t){return this.le(t)?this:t};We.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof We){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,l=null,d=null,w=null,S=null,I=null;return d=this._hi/n,w=We.SPLIT*d,i=w-d,I=We.SPLIT*n,i=w-i,a=d-i,c=I-n,S=d*n,c=I-c,l=n-c,I=i*c-S+i*l+a*c+a*l,w=(this._hi-S-I+this._lo-d*r)/n,I=d+w,this._hi=I,this._lo=d-I+w,this}};We.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};We.prototype.divide=function(){if(arguments[0]instanceof We){var t=arguments[0],e=null,n=null,r=null,i=null,a=null,c=null,l=null,d=null;a=this._hi/t._hi,c=We.SPLIT*a,e=c-a,d=We.SPLIT*t._hi,e=c-e,n=a-e,r=d-t._hi,l=a*t._hi,r=d-r,i=t._hi-r,d=e*r-l+e*i+n*r+n*i,c=(this._hi-l-d+this._lo-a*t._lo)/t._hi,d=a+c;var w=d,S=a-d+c;return new We(w,S)}else if(typeof arguments[0]=="number"){var I=arguments[0];return $t.isNaN(I)?We.createNaN():We.copy(this).selfDivide(I,0)}};We.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};We.prototype.pow=function(t){if(t===0)return We.valueOf(1);var e=new We(this),n=We.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2===1&&n.selfMultiply(e),r/=2,r>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n};We.prototype.ceil=function(){if(this.isNaN())return We.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new We(t,e)};We.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0};We.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};We.prototype.setValue=function(){if(arguments[0]instanceof We){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}};We.prototype.max=function(t){return this.ge(t)?this:t};We.prototype.sqrt=function(){if(this.isZero())return We.valueOf(0);if(this.isNegative())return We.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=We.valueOf(e),r=this.subtract(n.sqr()),i=r._hi*(t*.5);return n.add(i)};We.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof We){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,a=null,c=null,l=null;return i=this._hi+e,c=i-this._hi,a=i-c,a=e-c+(this._hi-a),l=a+this._lo,n=i+l,r=l+(i-n),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],w=arguments[1],S=null,I=null,T=null,k=null,D=null,U=null,q=null,ee=null;D=this._hi+d,T=this._lo+w,q=D-this._hi,ee=T-this._lo,U=D-q,k=T-ee,U=d-q+(this._hi-U),k=w-ee+(this._lo-k),q=U+T,S=D+q,I=q+(D-S),q=k+I;var B=S+q,j=q+(S-B);return this._hi=B,this._lo=j,this}};We.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof We){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,a=null,c=null,l=null,d=null,w=null;d=We.SPLIT*this._hi,i=d-this._hi,w=We.SPLIT*n,i=d-i,a=this._hi-i,c=w-n,d=this._hi*n,c=w-c,l=n-c,w=i*c-d+i*l+a*c+a*l+(this._hi*r+this._lo*n);var S=d+w;i=d-S;var I=w+i;return this._hi=S,this._lo=I,this}};We.prototype.selfSqr=function(){return this.selfMultiply(this)};We.prototype.floor=function(){if(this.isNaN())return We.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new We(t,e)};We.prototype.negate=function(){return this.isNaN()?this:new We(-this._hi,-this._lo)};We.prototype.clone=function(){};We.prototype.multiply=function(){if(arguments[0]instanceof We){var t=arguments[0];return t.isNaN()?We.createNaN():We.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return $t.isNaN(e)?We.createNaN():We.copy(this).selfMultiply(e,0)}};We.prototype.isNaN=function(){return $t.isNaN(this._hi)};We.prototype.intValue=function(){return Math.trunc(this._hi)};We.prototype.toString=function(){var t=We.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};We.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+We.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length,c=We.stringOfChar("0",a);i=n+c+".0"}return this.isNegative()?"-"+i:i};We.prototype.reciprocal=function(){var t=null,e=null,n=null,r=null,i=null,a=null,c=null,l=null;i=1/this._hi,a=We.SPLIT*i,t=a-i,l=We.SPLIT*this._hi,t=a-t,e=i-t,n=l-this._hi,c=i*this._hi,n=l-n,r=this._hi-n,l=t*n-c+t*r+e*n+e*r,a=(1-c-l-i*this._lo)/this._hi;var d=i+a,w=i-d+a;return new We(d,w)};We.prototype.toSciNotation=function(){if(this.isZero())return We.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=We.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var a=n.charAt(0)+"."+i;return this.isNegative()?"-"+a+r:a+r};We.prototype.abs=function(){return this.isNaN()?We.NaN:this.isNegative()?this.negate():new We(this)};We.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};We.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};We.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};We.prototype.trunc=function(){return this.isNaN()?We.NaN:this.isPositive()?this.floor():this.ceil()};We.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};We.prototype.interfaces_=function(){return[ms,ds,D_]};We.prototype.getClass=function(){return We};We.sqr=function(t){return We.valueOf(t).selfMultiply(t)};We.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return We.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new We(e)}};We.sqrt=function(t){return We.valueOf(t).sqrt()};We.parse=function(t){for(var e=0,n=t.length;Dd.isWhitespace(t.charAt(e));)e++;var r=!1;if(e=n);){var w=t.charAt(e);if(e++,Dd.isDigit(w)){var S=w-"0";a.selfMultiply(We.TEN),a.selfAdd(S),c++;continue}if(w==="."){l=c;continue}if(w==="e"||w==="E"){var I=t.substring(e);try{d=oa.parseInt(I)}catch(q){throw q instanceof Error?new Error("Invalid exponent "+I+" in string "+t):q}finally{}break}throw new Error("Unexpected character '"+w+"' at position "+e+" in string "+t)}var T=a,k=c-l-d;if(k===0)T=a;else if(k>0){var D=We.TEN.pow(k);T=a.divide(D)}else if(k<0){var U=We.TEN.pow(-k);T=a.multiply(U)}return r?T.negate():T};We.createNaN=function(){return new We($t.NaN,$t.NaN)};We.copy=function(t){return new We(t)};We.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n)),i=Math.pow(10,r);return i*10<=e&&(r+=1),r};We.stringOfChar=function(t,e){for(var n=new ya,r=0;r0){if(a<=0)return co.signum(c);r=i+a}else if(i<0){if(a>=0)return co.signum(c);r=-i-a}else return co.signum(c);var l=co.DP_SAFE_EPSILON*r;return c>=l||-c>=l?co.signum(c):2};co.signum=function(t){return t>0?1:t<0?-1:0};QI.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(co,QI);var Tn=function(){},em={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};em.X.get=function(){return 0};em.Y.get=function(){return 1};em.Z.get=function(){return 2};em.M.get=function(){return 3};Tn.prototype.setOrdinate=function(t,e,n){};Tn.prototype.size=function(){};Tn.prototype.getOrdinate=function(t,e){};Tn.prototype.getCoordinate=function(){};Tn.prototype.getCoordinateCopy=function(t){};Tn.prototype.getDimension=function(){};Tn.prototype.getX=function(t){};Tn.prototype.clone=function(){};Tn.prototype.expandEnvelope=function(t){};Tn.prototype.copy=function(){};Tn.prototype.getY=function(t){};Tn.prototype.toCoordinateArray=function(){};Tn.prototype.interfaces_=function(){return[D_]};Tn.prototype.getClass=function(){return Tn};Object.defineProperties(Tn,em);var $I=function(){},Kf=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}($I),Ci=function(){};Ci.arraycopy=function(t,e,n,r,i){for(var a=0,c=e;ct._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}};Ot.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ot){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||rthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(nthis._maxx&&(this._maxx=n),rthis._maxy&&(this._maxy=r))}};Ot.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};Ot.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)};Ot.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Ot.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Ot.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Ot.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e};Ot.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()}};Ot.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ot){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof Ne){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}};Ot.prototype.centre=function(){return this.isNull()?null:new Ne((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Ot.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Ne){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Ot){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3];it._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)};Ot.prototype.hashCode=function(){var t=17;return t=37*t+Ne.hashCode(this._minx),t=37*t+Ne.hashCode(this._maxx),t=37*t+Ne.hashCode(this._miny),t=37*t+Ne.hashCode(this._maxy),t};Ot.prototype.interfaces_=function(){return[ds,ms]};Ot.prototype.getClass=function(){return Ot};Ot.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3],l=Math.min(a.x,c.x),d=Math.max(a.x,c.x),w=Math.min(r.x,i.x),S=Math.max(r.x,i.x);return!(w>d||Sd)||Sn?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};mr.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};mr.prototype.setPrecisionModel=function(t){this._precisionModel=t};mr.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;ni?a=r:a=i;else{var c=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y);r>i?a=c:a=l,a===0&&!t.equals(e)&&(a=Math.max(c,l))}return ln.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a};mr.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i);return ln.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a};Jc.DONT_INTERSECT.get=function(){return 0};Jc.DO_INTERSECT.get=function(){return 1};Jc.COLLINEAR.get=function(){return 2};Jc.NO_INTERSECTION.get=function(){return 0};Jc.POINT_INTERSECTION.get=function(){return 1};Jc.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(mr,Jc);var Qu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new Ot(this._inputLines[0][0],this._inputLines[0][1]),i=new Ot(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,Ot.intersects(r,i,n)&&St.orientationIndex(r,i,n)===0&&St.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION}else return t.prototype.computeIntersection.apply(this,arguments)},e.prototype.normalizeToMinimum=function(n,r,i,a,c){c.x=this.smallestInAbsValue(n.x,r.x,i.x,a.x),c.y=this.smallestInAbsValue(n.y,r.y,i.y,a.y),n.x-=c.x,n.y-=c.y,r.x-=c.x,r.y-=c.y,i.x-=c.x,i.y-=c.y,a.x-=c.x,a.y-=c.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,a){var c=null;try{c=Ls.intersection(n,r,i,a)}catch(l){if(l instanceof Kf)c=e.nearestEndpoint(n,r,i,a);else throw l}finally{}return c},e.prototype.intersection=function(n,r,i,a){var c=this.intersectionWithNormalization(n,r,i,a);return this.isInSegmentEnvelopes(c)||(c=new Ne(e.nearestEndpoint(n,r,i,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c},e.prototype.smallestInAbsValue=function(n,r,i,a){var c=n,l=Math.abs(c);return Math.abs(r)1e-4&&Ci.out.println("Distance = "+c.distance(l))},e.prototype.intersectionWithNormalization=function(n,r,i,a){var c=new Ne(n),l=new Ne(r),d=new Ne(i),w=new Ne(a),S=new Ne;this.normalizeToEnvCentre(c,l,d,w,S);var I=this.safeHCoordinateIntersection(c,l,d,w);return I.x+=S.x,I.y+=S.y,I},e.prototype.computeCollinearIntersection=function(n,r,i,a){var c=Ot.intersects(n,r,i),l=Ot.intersects(n,r,a),d=Ot.intersects(i,a,n),w=Ot.intersects(i,a,r);return c&&l?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):d&&w?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):c&&d?(this._intPt[0]=i,this._intPt[1]=n,i.equals(n)&&!l&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):c&&w?(this._intPt[0]=i,this._intPt[1]=r,i.equals(r)&&!l&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&d?(this._intPt[0]=a,this._intPt[1]=n,a.equals(n)&&!c&&!w?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):l&&w?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!c&&!d?t.POINT_INTERSECTION:t.COLLINEAR_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,a,c){var l=n.xr.x?n.x:r.x,S=n.y>r.y?n.y:r.y,I=i.xa.x?i.x:a.x,D=i.y>a.y?i.y:a.y,U=l>I?l:I,q=wT?d:T,B=S0&&l>0||c<0&&l<0)return t.NO_INTERSECTION;var d=St.orientationIndex(i,a,n),w=St.orientationIndex(i,a,r);if(d>0&&w>0||d<0&&w<0)return t.NO_INTERSECTION;var S=c===0&&l===0&&d===0&&w===0;return S?this.computeCollinearIntersection(n,r,i,a):(c===0||l===0||d===0||w===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(a)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(a)?this._intPt[0]=r:c===0?this._intPt[0]=new Ne(i):l===0?this._intPt[0]=new Ne(a):d===0?this._intPt[0]=new Ne(n):w===0&&(this._intPt[0]=new Ne(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,a)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,a){var c=n,l=St.distancePointLine(n,i,a),d=St.distancePointLine(r,i,a);return d0?n>0?-i:i:n>0?i:-i;if(e===0||n===0)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,a=t,t=n,n=a,a=e,e=r,r=a):e<=-r?(i=-i,n=-n,r=-r):(a=t,t=-n,n=a,a=e,e=-r,r=a):r>0?-e<=r?(i=-i,t=-t,e=-e):(a=-t,t=n,n=a,a=-e,e=r,r=a):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,a=-t,t=-n,n=a,a=-e,e=-r,r=a),t>0)if(n>0){if(!(t<=n))return i}else return i;else{if(n>0)return-i;if(t>=n)i=-i,t=-t,n=-n;else return-i}for(;;){if(c=Math.floor(n/t),n=n-c*t,r=r-c*e,r<0)return-i;if(r>e)return i;if(t>n+n){if(er+r)return-i;n=t-n,r=e-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(c=Math.floor(t/n),t=t-c*n,e=e-c*r,e<0))return i;if(e>r)return-i;if(n>t+t){if(re+e)return i;t=n-t,e=r-e,i=-i}if(e===0)return t===0?0:i;if(t===0)return-i}};var ra=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ra.prototype.countSegment=function(t,e){if(t.xr&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,a=t.y-this._p.y,c=e.x-this._p.x,l=e.y-this._p.y,d=kc.signOfDet2x2(i,a,c,l);if(d===0)return this._isPointOnSegment=!0,null;l0&&this._crossingCount++}};ra.prototype.isPointInPolygon=function(){return this.getLocation()!==Fe.EXTERIOR};ra.prototype.getLocation=function(){return this._isPointOnSegment?Fe.BOUNDARY:this._crossingCount%2===1?Fe.INTERIOR:Fe.EXTERIOR};ra.prototype.isOnSegment=function(){return this._isPointOnSegment};ra.prototype.interfaces_=function(){return[]};ra.prototype.getClass=function(){return ra};ra.locatePointInRing=function(){if(arguments[0]instanceof Ne&&Wt(arguments[1],Tn)){for(var t=arguments[0],e=arguments[1],n=new ra(t),r=new Ne,i=new Ne,a=1;a1||d<0||d>1)&&(i=!0)}}return i?Zo.min(St.distancePointLine(t,n,r),St.distancePointLine(e,n,r),St.distancePointLine(n,t,e),St.distancePointLine(r,t,e)):0};St.isPointInRing=function(t,e){return St.locatePointInRing(t,e)!==Fe.EXTERIOR};St.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Ne;t.getCoordinate(0,r);for(var i=r.x,a=r.y,c=1;cn.y&&(n=a,r=i)}var c=r;do c=c-1,c<0&&(c=e);while(t[c].equals2D(n)&&c!==r);var l=r;do l=(l+1)%e;while(t[l].equals2D(n)&&l!==r);var d=t[c],w=t[l];if(d.equals2D(n)||w.equals2D(n)||d.equals2D(w))return!1;var S=St.computeOrientation(d,n,w),I=!1;return S===0?I=d.x>w.x:I=S>0,I};St.locatePointInRing=function(t,e){return ra.locatePointInRing(t,e)};St.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)};St.computeOrientation=function(t,e,n){return St.orientationIndex(t,e,n)};St.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new lr("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=1)return a.distance(l);var S=((c.y-a.y)*(l.x-c.x)-(c.x-a.x)*(l.y-c.y))/d;return Math.abs(S)*Math.sqrt(d)}};St.isOnLine=function(t,e){for(var n=new Qu,r=1;r0};Tf.prototype.interfaces_=function(){return[hs]};Tf.prototype.getClass=function(){return Tf};var Lf=function(){};Lf.prototype.isInBoundary=function(t){return t>1};Lf.prototype.interfaces_=function(){return[hs]};Lf.prototype.getClass=function(){return Lf};var Pf=function(){};Pf.prototype.isInBoundary=function(t){return t===1};Pf.prototype.interfaces_=function(){return[hs]};Pf.prototype.getClass=function(){return Pf};var qr=function(){};qr.prototype.add=function(){};qr.prototype.addAll=function(){};qr.prototype.isEmpty=function(){};qr.prototype.iterator=function(){};qr.prototype.size=function(){};qr.prototype.toArray=function(){};qr.prototype.remove=function(){};function i1(t){this.message=t||""}i1.prototype=new Error;i1.prototype.name="IndexOutOfBoundsException";var Jf=function(){};Jf.prototype.hasNext=function(){};Jf.prototype.next=function(){};Jf.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}(qr);function Qf(t){this.message=t||""}Qf.prototype=new Error;Qf.prototype.name="NoSuchElementException";var gt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof qr&&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,qr]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=this,i=n.iterator();i.hasNext();)r.add(i.next());return!0},e.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},e.prototype.iterator=function(){return new vR(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new i1;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=this,r=[],i=0,a=this.array_.length;i=1){var w=this.get(this.size()-1);if(w.equals2D(l))return null}t.prototype.add.call(this,l)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],I=arguments[1];return this.add(S,I),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var T=arguments[0],k=arguments[1],D=arguments[2];if(D)for(var U=0;U=0;q--)r.add(T[q],k);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Ne){var ee=arguments[0],B=arguments[1],j=arguments[2];if(!j){var J=this.size();if(J>0){if(ee>0){var ae=this.get(ee-1);if(ae.equals2D(B))return null}if(eeAe&&(Y=-1);for(var oe=$;oe!==Ae;oe+=Y)r.add(de[oe],te);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Ne(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(gt),vn=function(){},N_={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};N_.ForwardComparator.get=function(){return Rd};N_.BidirectionalComparator.get=function(){return Mf};N_.coordArrayType.get=function(){return new Array(0).fill(null)};vn.prototype.interfaces_=function(){return[]};vn.prototype.getClass=function(){return vn};vn.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};vn.ptNotInList=function(t,e){for(var n=0;n=t?e:[]};vn.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e};vn.extract=function(t,e,n){e=Zo.clamp(e,0,t.length),n=Zo.clamp(n,-1,t.length);var r=n-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(n.length===0)return 0;var i=vn.compare(n,r),a=vn.isEqualReversed(n,r);return a?0:i};Mf.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(n.length===0)return 0;for(var i=vn.increasingDirection(n),a=vn.increasingDirection(r),c=i>0?0:n.length-1,l=a>0?0:n.length-1,d=0;d0)e=e.right;else return e.value}return null};Ni.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=t.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var a=n.value;return n.value=e,a}while(n!==null);var c={key:t,left:null,right:null,value:e,parent:r,color:ul,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=c:r.right=c,this.fixAfterInsertion(c),this.size_++,null};Ni.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=Pu;t!=null&&t!==this.root_&&t.parent.color===Pu;)if(Kn(t)===T0(Kn(Kn(t)))){var n=h2(Kn(Kn(t)));c2(n)===Pu?(il(Kn(t),ul),il(n,ul),il(Kn(Kn(t)),Pu),t=Kn(Kn(t))):(t===h2(Kn(t))&&(t=Kn(t),e.rotateLeft(t)),il(Kn(t),ul),il(Kn(Kn(t)),Pu),e.rotateRight(Kn(Kn(t))))}else{var r=T0(Kn(Kn(t)));c2(r)===Pu?(il(Kn(t),ul),il(r,ul),il(Kn(Kn(t)),Pu),t=Kn(Kn(t))):(t===T0(Kn(t))&&(t=Kn(t),e.rotateRight(t)),il(Kn(t),ul),il(Kn(Kn(t)),Pu),e.rotateLeft(Kn(Kn(t))))}this.root_.color=ul};Ni.prototype.values=function(){var t=new gt,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=Ni.successor(e))!==null;)t.add(e.value);return t};Ni.prototype.entrySet=function(){var t=new o1,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=Ni.successor(e))!==null;)t.add(e);return t};Ni.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}};Ni.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}};Ni.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t};Ni.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}else{for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Ni.prototype.size=function(){return this.size_};var Nd=function(){};Nd.prototype.interfaces_=function(){return[]};Nd.prototype.getClass=function(){return Nd};function tC(){}tC.prototype=new O_;function sa(){this.array_=[],arguments[0]instanceof qr&&this.addAll(arguments[0])}sa.prototype=new tC;sa.prototype.contains=function(t){for(var e=this,n=0,r=this.array_.length;n=0;){var c=i.substring(0,a);r.add(c),i=i.substring(a+n),a=i.indexOf(e)}i.length>0&&r.add(i);for(var l=new Array(r.size()).fill(null),d=0;d0)for(var a=i;a0&&r.append(" ");for(var a=0;a0&&r.append(","),r.append(as.toString(t.getOrdinate(i,a)))}return r.append(")"),r.toString()}};Ar.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return Ar.createClosedRing(t,e,4);var r=e.getOrdinate(0,Tn.X)===e.getOrdinate(n-1,Tn.X)&&e.getOrdinate(0,Tn.Y)===e.getOrdinate(n-1,Tn.Y);return r?e:Ar.createClosedRing(t,e,n+1)};Ar.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Ar.copy(e,0,r,0,i);for(var a=i;a0&&Ar.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?kn.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 St.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();Ar.reverse(r);var i=this.getFactory().createLineString(r);return i},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],a=i,c=0,l=0;c= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=this,a=0;a=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}(Sr),ka=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 jt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isEquivalentClass(r)?t.prototype.equalsExact.call(this,r,i):!1}else return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this,i=this._geometries.length,a=new Array(i).fill(null),c=0;c0?e.createPoint(n[0]):e.createPoint():t};Fd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Fd.prototype.getClass=function(){return Fd};var Bd=function(){};Bd.prototype.edit=function(t,e){return t instanceof Oa?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Sr?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Po?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t};Bd.prototype.interfaces_=function(){return[fs.GeometryEditorOperation]};Bd.prototype.getClass=function(){return Bd};var Pr=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 ya(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n3&&(r=3),r<2?new Pr(n):new Pr(n,r)}};za.prototype.interfaces_=function(){return[If,ms]};za.prototype.getClass=function(){return za};za.instance=function(){return za.instanceObject};a1.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};a1.instanceObject.get=function(){return new za};Object.defineProperties(za,a1);var rC=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new gt,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new o1;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}($c),Rn=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 la){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},l1={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Rn.prototype.equals=function(t){if(!(t instanceof Rn))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale};Rn.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new oa(n).compareTo(new oa(r))};Rn.prototype.getScale=function(){return this._scale};Rn.prototype.isFloating=function(){return this._modelType===Rn.FLOATING||this._modelType===Rn.FLOATING_SINGLE};Rn.prototype.getType=function(){return this._modelType};Rn.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Rn.FLOATING?t="Floating":this._modelType===Rn.FLOATING_SINGLE?t="Floating-Single":this._modelType===Rn.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};Rn.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if($t.isNaN(t))return t;if(this._modelType===Rn.FLOATING_SINGLE){var e=t;return e}return this._modelType===Rn.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof Ne){var n=arguments[0];if(this._modelType===Rn.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}};Rn.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Rn.FLOATING?t=16:this._modelType===Rn.FLOATING_SINGLE?t=6:this._modelType===Rn.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};Rn.prototype.setScale=function(t){this._scale=Math.abs(t)};Rn.prototype.interfaces_=function(){return[ms,ds]};Rn.prototype.getClass=function(){return Rn};Rn.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e};l1.serialVersionUID.get=function(){return 7777263578777804e3};l1.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties(Rn,l1);var la=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},u1={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};la.prototype.readResolve=function(){return la.nameToTypeMap.get(this._name)};la.prototype.toString=function(){return this._name};la.prototype.interfaces_=function(){return[ms]};la.prototype.getClass=function(){return la};u1.serialVersionUID.get=function(){return-552860263173159e4};u1.nameToTypeMap.get=function(){return new rC};Object.defineProperties(la,u1);Rn.Type=la;Rn.FIXED=new la("FIXED");Rn.FLOATING=new la("FLOATING");Rn.FLOATING_SINGLE=new la("FLOATING SINGLE");var yn=function t(){this._precisionModel=new Rn,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Wt(arguments[0],If)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Rn&&(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]))},iC={serialVersionUID:{configurable:!0}};yn.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Ne(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Ne(t.getMinX(),t.getMinY()),new Ne(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Ne(t.getMinX(),t.getMinY()),new Ne(t.getMinX(),t.getMaxY()),new Ne(t.getMaxX(),t.getMaxY()),new Ne(t.getMaxX(),t.getMinY()),new Ne(t.getMinX(),t.getMinY())]),null)};yn.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Sr(this.getCoordinateSequenceFactory().create(t),this);if(Wt(t,Tn))return new Sr(t,this)}else return new Sr(this.getCoordinateSequenceFactory().create([]),this)};yn.prototype.createMultiLineString=function(){if(arguments.length===0)return new Fu(null,this);if(arguments.length===1){var t=arguments[0];return new Fu(t,this)}};yn.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var a=i.next(),c=a.getClass();e===null&&(e=c),c!==e&&(n=!0),a.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(yn.toGeometryArray(t));var l=t.iterator().next(),d=t.size()>1;if(d){if(l instanceof Qr)return this.createMultiPolygon(yn.toPolygonArray(t));if(l instanceof Sr)return this.createMultiLineString(yn.toLineStringArray(t));if(l instanceof Po)return this.createMultiPoint(yn.toPointArray(t));ln.shouldNeverReachHere("Unhandled class: "+l.getClass().getName())}return l};yn.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};yn.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Ne){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Wt(arguments[0],Tn)){var e=arguments[0];return new Po(e,this)}}};yn.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};yn.prototype.createPolygon=function(){if(arguments.length===0)return new Qr(null,null,this);if(arguments.length===1){if(Wt(arguments[0],Tn)){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 Oa){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Qr(r,i,this)}};yn.prototype.getSRID=function(){return this._SRID};yn.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Ki(null,this);if(arguments.length===1){var t=arguments[0];return new Ki(t,this)}};yn.prototype.createGeometry=function(t){var e=new fs(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})};yn.prototype.getPrecisionModel=function(){return this._precisionModel};yn.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(Wt(arguments[0],Tn)){var e=arguments[0];return new Oa(e,this)}}};yn.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ka(null,this);if(arguments.length===1){var t=arguments[0];return new ka(t,this)}};yn.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Af(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Af(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(Wt(arguments[0],Tn)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[t]};va.prototype.push=function(t){return this.array_.push(t),t};va.prototype.pop=function(t){if(this.array_.length===0)throw new U_;return this.array_.pop()};va.prototype.peek=function(){if(this.array_.length===0)throw new U_;return this.array_[this.array_.length-1]};va.prototype.empty=function(){return this.array_.length===0};va.prototype.isEmpty=function(){return this.empty()};va.prototype.search=function(t){return this.array_.indexOf(t)};va.prototype.size=function(){return this.array_.length};va.prototype.toArray=function(){for(var t=this,e=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===St.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)};ua.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),r=n.getCoordinates();if(e<0||e+1>=r.length||r[e].y===r[e+1].y)return-1;var i=lt.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])};ua.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)};ua.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();r.isForward()&&e.checkForRightmostCoordinate(r)}ln.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var i=this.getRightmostSide(this._minDe,this._minIndex);i===lt.LEFT&&(this._orientedDe=this._minDe.getSym())};ua.prototype.interfaces_=function(){return[]};ua.prototype.getClass=function(){return ua};var yl=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new Ne(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(gl),G_=function(){this.array_=[]};G_.prototype.addLast=function(t){this.array_.push(t)};G_.prototype.removeFirst=function(){return this.array_.shift()};G_.prototype.isEmpty=function(){return this.array_.length===0};var Ji=function(){this._finder=null,this._dirEdgeList=new gt,this._nodes=new gt,this._rightMostCoord=null,this._env=null,this._finder=new ua};Ji.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}};Ji.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Ji.prototype.computeNodeDepth=function(t){for(var e=this,n=null,r=t.getEdges().iterator();r.hasNext();){var i=r.next();if(i.isVisited()||i.getSym().isVisited()){n=i;break}}if(n===null)throw new yl("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var a=t.getEdges().iterator();a.hasNext();){var c=a.next();c.setVisited(!0),e.copySymDepths(c)}};Ji.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(lt.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)};Ji.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Ji.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(lt.RIGHT)>=1&&e.getDepth(lt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}};Ji.prototype.computeDepths=function(t){var e=this,n=new o1,r=new G_,i=t.getNode();for(r.addLast(i),n.add(i),t.setVisited(!0);!r.isEmpty();){var a=r.removeFirst();n.add(a),e.computeNodeDepth(a);for(var c=a.getEdges().iterator();c.hasNext();){var l=c.next(),d=l.getSym();if(!d.isVisited()){var w=d.getNode();n.contains(w)||(r.addLast(w),n.add(w))}}}};Ji.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0};Ji.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Ot,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),r=n.getEdge().getCoordinates(),i=0;ithis.location.length){var n=new Array(3).fill(null);n[lt.ON]=this.location[lt.ON],n[lt.LEFT]=Fe.NONE,n[lt.RIGHT]=Fe.NONE,this.location=n}for(var r=0;r1&&t.append(Fe.toLocationSymbol(this.location[lt.LEFT])),t.append(Fe.toLocationSymbol(this.location[lt.ON])),this.location.length>1&&t.append(Fe.toLocationSymbol(this.location[lt.RIGHT])),t.toString()};Jn.prototype.setLocations=function(t,e,n){this.location[lt.ON]=t,this.location[lt.LEFT]=e,this.location[lt.RIGHT]=n};Jn.prototype.get=function(t){return t1};Jn.prototype.isAnyNull=function(){for(var t=this,e=0;et._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2};Br.prototype.addPoints=function(t,e,n){var r=this,i=t.getCoordinates();if(e){var a=1;n&&(a=0);for(var c=a;c=0;d--)r._pts.add(i[d])}};Br.prototype.isHole=function(){return this._isHole};Br.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};Br.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!St.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();){var i=r.next();if(i.containsPoint(t))return!1}return!0};Br.prototype.addHole=function(t){this._holes.add(t)};Br.prototype.isShell=function(){return this._shell===null};Br.prototype.getLabel=function(){return this._label};Br.prototype.getEdges=function(){return this._edges};Br.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};Br.prototype.getShell=function(){return this._shell};Br.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,lt.RIGHT);if(r===Fe.NONE)return null;if(this._label.getLocation(n)===Fe.NONE)return this._label.setLocation(n,r),null}};Br.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};Br.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)};Xo.prototype.isInResult=function(){return this._isInResult};Xo.prototype.isVisited=function(){return this._isVisited};Xo.prototype.interfaces_=function(){return[]};Xo.prototype.getClass=function(){return Xo};var j_=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Vn(0,Fe.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var r=n.next();if(r.getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var i=Fe.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var a=n.getLocation(r);i!==Fe.BOUNDARY&&(i=a)}return i},e.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this._label===null?this._label=new Vn(n,r):this._label.setLocation(n,r)}else return t.prototype.setLabel.apply(this,arguments)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Vn)for(var i=arguments[0],a=0;a<2;a++){var c=n.computeMergedLocation(i,a),l=n._label.getLocation(a);l===Fe.NONE&&n._label.setLocation(a,c)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=Fe.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case Fe.BOUNDARY:i=Fe.INTERIOR;break;case Fe.INTERIOR:i=Fe.BOUNDARY;break;default:i=Fe.BOUNDARY;break}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Xo),ca=function(){this.nodeMap=new Ni,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};ca.prototype.find=function(t){return this.nodeMap.get(t)};ca.prototype.addNode=function(){if(arguments[0]instanceof Ne){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 j_){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}};ca.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};ca.prototype.iterator=function(){return this.nodeMap.values().iterator()};ca.prototype.values=function(){return this.nodeMap.values()};ca.prototype.getBoundaryNodes=function(t){for(var e=new gt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Fe.BOUNDARY&&e.add(r)}return e};ca.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};var Un=function(){},rm={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Un.prototype.interfaces_=function(){return[]};Un.prototype.getClass=function(){return Un};Un.isNorthern=function(t){return t===Un.NE||t===Un.NW};Un.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2};Un.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var r=te?t:e;return r===0&&i===3?3:r};Un.isInHalfPlane=function(t,e){return e===Un.SE?t===Un.SE||t===Un.SW:t===e||t===e+1};Un.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 lr("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Un.NE:Un.SE:e>=0?Un.NW:Un.SW}else if(arguments[0]instanceof Ne&&arguments[1]instanceof Ne){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new lr("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Un.NE:Un.SE:r.y>=n.y?Un.NW:Un.SW}};rm.NE.get=function(){return 0};rm.NW.get=function(){return 1};rm.SW.get=function(){return 2};rm.SE.get=function(){return 3};Object.defineProperties(Un,rm);var Oi=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var a=arguments[0],c=arguments[1],l=arguments[2],d=arguments[3];this._edge=a,this.init(c,l),this._label=d}};Oi.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){c.linkDirectedEdgesForMinimalEdgeRings();var l=c.buildMinimalRings(),d=r.findShell(l);d!==null?(r.placePolygonHoles(d,l),e.add(d)):n.addAll(l)}else i.add(c)}return i};Mo.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1};Mo.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new gt,r=t.iterator();r.hasNext();){var i=r.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var a=new MR(i,e._geometryFactory);n.add(a),a.setInResult()}}return n};Mo.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}};Mo.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};Mo.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),a=null,c=null,l=e.iterator();l.hasNext();){var d=l.next(),w=d.getLinearRing(),S=w.getEnvelopeInternal();a!==null&&(c=a.getLinearRing().getEnvelopeInternal());var I=!1;S.contains(r)&&St.isPointInRing(i,w.getCoordinates())&&(I=!0),I&&(a===null||c.contains(S))&&(a=d)}return a};Mo.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return ln.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n};Mo.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];gr.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new gt,a=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(a,this._shellList,i),this.placeFreeHoles(this._shellList,i)}};Mo.prototype.interfaces_=function(){return[]};Mo.prototype.getClass=function(){return Mo};var Df=function(){};Df.prototype.getBounds=function(){};Df.prototype.interfaces_=function(){return[]};Df.prototype.getClass=function(){return Df};var ks=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};ks.prototype.getItem=function(){return this._item};ks.prototype.getBounds=function(){return this._bounds};ks.prototype.interfaces_=function(){return[Df,ms]};ks.prototype.getClass=function(){return ks};var vl=function(){this._size=null,this._items=null,this._size=0,this._items=new gt,this._items.add(null)};vl.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};vl.prototype.size=function(){return this._size};vl.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)};vl.prototype.clear=function(){this._size=0,this._items.clear()};vl.prototype.isEmpty=function(){return this._size===0};vl.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)};vl.prototype.interfaces_=function(){return[]};vl.prototype.getClass=function(){return vl};var eu=function(){};eu.prototype.visitItem=function(t){};eu.prototype.interfaces_=function(){return[]};eu.prototype.getClass=function(){return eu};var Dc=function(){};Dc.prototype.insert=function(t,e){};Dc.prototype.remove=function(t,e){};Dc.prototype.query=function(){};Dc.prototype.interfaces_=function(){return[]};Dc.prototype.getClass=function(){return Dc};var Zr=function(){if(this._childBoundables=new gt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var t=arguments[0];this._level=t}},sC={serialVersionUID:{configurable:!0}};Zr.prototype.getLevel=function(){return this._level};Zr.prototype.size=function(){return this._childBoundables.size()};Zr.prototype.getChildBoundables=function(){return this._childBoundables};Zr.prototype.addChildBoundable=function(t){ln.isTrue(this._bounds===null),this._childBoundables.add(t)};Zr.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Zr.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Zr.prototype.interfaces_=function(){return[Df,ms]};Zr.prototype.getClass=function(){return Zr};sC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Zr,sC);var Ds=function(){};Ds.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}};Ds.min=function(t){return Ds.sort(t),t.get(0)};Ds.sort=function(t,e){var n=t.toArray();e?Nu.sort(n,e):Nu.sort(n);for(var r=t.iterator(),i=0,a=n.length;iOr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new lr("neither boundable is composite")};Or.prototype.isLeaves=function(){return!(Or.isComposite(this._boundable1)||Or.isComposite(this._boundable2))};Or.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0};Or.prototype.expand=function(t,e,n,r){for(var i=this,a=t.getChildBoundables(),c=a.iterator();c.hasNext();){var l=c.next(),d=new Or(l,e,i._itemDistance);d.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},q_={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};yi.prototype.getNodeCapacity=function(){return this._nodeCapacity};yi.prototype.lastNode=function(t){return t.get(t.size()-1)};yi.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Zr?n+=t.size(i):i instanceof ks&&(n+=1)}return n}};yi.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof ks&&i.getItem()===e&&(n=i)}return n!==null?(t.getChildBoundables().remove(n),!0):!1};yi.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new gt:e}else if(arguments.length===1){for(var n=arguments[0],r=new gt,i=n.getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Zr){var c=t.itemsTree(a);c!==null&&r.add(c)}else a instanceof ks?r.add(a.getItem()):ln.shouldNeverReachHere()}return r.size()<=0?null:r}};yi.prototype.insert=function(t,e){ln.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ks(t,e))};yi.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new gt;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];if(ln.isTrue(r>-2),i.getLevel()===r)return a.add(i),null;for(var c=i.getChildBoundables().iterator();c.hasNext();){var l=c.next();l instanceof Zr?t.boundablesAtLevel(r,l,a):(ln.isTrue(l instanceof ks),r===-1&&a.add(l))}return null}};yi.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new gt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(Wt(arguments[2],eu)&&arguments[0]instanceof Object&&arguments[1]instanceof Zr)for(var a=arguments[0],c=arguments[1],l=arguments[2],d=c.getChildBoundables(),w=0;wn&&(n=a)}}return n+1}};yi.prototype.createParentBoundables=function(t,e){var n=this;ln.isTrue(!t.isEmpty());var r=new gt;r.add(this.createNode(e));var i=new gt(t);Ds.sort(i,this.getComparator());for(var a=i.iterator();a.hasNext();){var c=a.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(c)}return r};yi.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};yi.prototype.interfaces_=function(){return[ms]};yi.prototype.getClass=function(){return yi};yi.compareDoubles=function(t,e){return t>e?1:t0);for(var c=new gt,l=0;l0;){var D=k.poll(),U=D.getDistance();if(U>=I)break;D.isLeaves()?(I=U,T=D):D.expandToQueue(k,I)}return[T.getBoundable(0).getItem(),T.getBoundable(1).getItem()]}}else if(arguments.length===3){var q=arguments[0],ee=arguments[1],B=arguments[2],j=new ks(q,ee),J=new Or(this.getRoot(),j,B);return this.nearestNeighbour(J)[0]}},e.prototype.interfaces_=function(){return[Dc,ms]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return f2},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[Ef]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[Ef]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(yi),f2=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new Ot(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zr),lo=function(){};lo.prototype.interfaces_=function(){return[]};lo.prototype.getClass=function(){return lo};lo.relativeSign=function(t,e){return te?1:0};lo.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=lo.relativeSign(e.x,n.x),i=lo.relativeSign(e.y,n.y);switch(t){case 0:return lo.compareValue(r,i);case 1:return lo.compareValue(i,r);case 2:return lo.compareValue(i,-r);case 3:return lo.compareValue(-r,i);case 4:return lo.compareValue(-r,-i);case 5:return lo.compareValue(-i,-r);case 6:return lo.compareValue(-i,r);case 7:return lo.compareValue(r,-i)}return ln.shouldNeverReachHere("invalid octant value"),0};lo.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var tu=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new Ne(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};tu.prototype.getCoordinate=function(){return this.coord};tu.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};tu.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:lo.compare(this._segmentOctant,this.coord,e.coord)};tu.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};tu.prototype.isInterior=function(){return this._isInterior};tu.prototype.interfaces_=function(){return[ds]};tu.prototype.getClass=function(){return tu};var Qi=function(){this._nodeMap=new Ni,this._edge=null;var t=arguments[0];this._edge=t};Qi.prototype.getSplitCoordinates=function(){var t=this,e=new tm;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();t.addEdgeCoordinates(r,i,e),r=i}return e.toCoordinateArray()};Qi.prototype.addCollapsedNodes=function(){var t=this,e=new gt;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var r=n.next().intValue();t.add(t._edge.getCoordinate(r),r)}};Qi.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}};Qi.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}else if(arguments[0]instanceof Ne&&arguments[1]instanceof Ne){var i=arguments[0],a=arguments[1],c=a.x-i.x,l=a.y-i.y;if(c===0&&l===0)throw new lr("Cannot compute the octant for two identical points "+i);return Rc.octant(c,l)}};var Fa=function(){};Fa.prototype.getCoordinates=function(){};Fa.prototype.size=function(){};Fa.prototype.getCoordinate=function(t){};Fa.prototype.isClosed=function(){};Fa.prototype.setData=function(t){};Fa.prototype.getData=function(){};Fa.prototype.interfaces_=function(){return[]};Fa.prototype.getClass=function(){return Fa};var Vd=function(){};Vd.prototype.addIntersection=function(t,e){};Vd.prototype.interfaces_=function(){return[Fa]};Vd.prototype.getClass=function(){return Vd};var kr=function(){this._nodeList=new Qi(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};kr.prototype.getCoordinates=function(){return this._pts};kr.prototype.size=function(){return this._pts.length};kr.prototype.getCoordinate=function(t){return this._pts[t]};kr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};kr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};kr.prototype.setData=function(t){this._data=t};kr.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Rc.octant(t,e)};kr.prototype.getData=function(){return this._data};kr.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],a=new Ne(n.getIntersection(i));this.addIntersection(a,r)}};kr.prototype.toString=function(){return Ms.toLineString(new Pr(this._pts))};kr.prototype.getNodeList=function(){return this._nodeList};kr.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof Ne){var r=arguments[0];return St.orientationIndex(this.p0,this.p1,r)}};zt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};zt.prototype.isVertical=function(){return this.p0.x===this.p1.x};zt.prototype.equals=function(t){if(!(t instanceof zt))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)};zt.prototype.intersection=function(t){var e=new Qu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null};zt.prototype.project=function(){if(arguments[0]instanceof Ne){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Ne(t);var e=this.projectionFactor(t),n=new Ne;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 zt){var r=arguments[0],i=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(i>=1&&a>=1||i<=0&&a<=0)return null;var c=this.project(r.p0);i<0&&(c=this.p0),i>1&&(c=this.p1);var l=this.project(r.p1);return a<0&&(l=this.p0),a>1&&(l=this.p1),new zt(c,l)}};zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};zt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};zt.prototype.distancePerpendicular=function(t){return St.distancePointLinePerpendicular(t,this.p0,this.p1)};zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};zt.prototype.midPoint=function(){return zt.midPoint(this.p0,this.p1)};zt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;if(r<=0)return $t.NaN;var i=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r;return i};zt.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=$t.MAX_VALUE,i=null,a=this.closestPoint(t.p0);r=a.distance(t.p0),n[0]=a,n[1]=t.p0;var c=this.closestPoint(t.p1);i=c.distance(t.p1),i0&&e<1)return this.project(t);var n=this.p0.distance(t),r=this.p1.distance(t);return n1||$t.isNaN(e))&&(e=1),e};zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};zt.prototype.distance=function(){if(arguments[0]instanceof zt){var t=arguments[0];return St.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof Ne){var e=arguments[0];return St.distancePointLine(e,this.p0,this.p1)}};zt.prototype.pointAlong=function(t){var e=new Ne;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};zt.prototype.hashCode=function(){var t=$t.doubleToLongBits(this.p0.x);t^=$t.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=$t.doubleToLongBits(this.p1.x);n^=$t.doubleToLongBits(this.p1.y)*31;var r=Math.trunc(n)^Math.trunc(n>>32);return e^r};zt.prototype.interfaces_=function(){return[ds,ms]};zt.prototype.getClass=function(){return zt};zt.midPoint=function(t,e){return new Ne((t.x+e.x)/2,(t.y+e.y)/2)};lC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(zt,lC);var Ud=function(){this.tempEnv1=new Ot,this.tempEnv2=new Ot,this._overlapSeg1=new zt,this._overlapSeg2=new zt};Ud.prototype.overlap=function(){if(arguments.length!==2&&arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}};Ud.prototype.interfaces_=function(){return[]};Ud.prototype.getClass=function(){return Ud};var Ao=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};Ao.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]};Ao.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],a=this._pts[n];if(r.tempEnv1.init(i,a),n-e===1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var c=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=Un.quadrant(t[n],t[n+1]),i=e+1;ic.getId()&&(c.computeOverlaps(w,i),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return p2},Object.defineProperties(e,n),e}(Gd),p2=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3],c=n.getContext(),l=i.getContext();this._si.processIntersections(c,r,l,a)}else return t.prototype.overlap.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ud),Dn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(a),this.setJoinStyle(c),this.setMitreLimit(l)}}},Il={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}};Dn.prototype.getEndCapStyle=function(){return this._endCapStyle};Dn.prototype.isSingleSided=function(){return this._isSingleSided};Dn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Dn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Dn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Dn.JOIN_ROUND&&(this._quadrantSegments=Dn.DEFAULT_QUADRANT_SEGMENTS)};Dn.prototype.getJoinStyle=function(){return this._joinStyle};Dn.prototype.setJoinStyle=function(t){this._joinStyle=t};Dn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Dn.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Dn.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Dn.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Dn.prototype.getMitreLimit=function(){return this._mitreLimit};Dn.prototype.setMitreLimit=function(t){this._mitreLimit=t};Dn.prototype.setSingleSided=function(t){this._isSingleSided=t};Dn.prototype.interfaces_=function(){return[]};Dn.prototype.getClass=function(){return Dn};Dn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)};Il.CAP_ROUND.get=function(){return 1};Il.CAP_FLAT.get=function(){return 2};Il.CAP_SQUARE.get=function(){return 3};Il.JOIN_ROUND.get=function(){return 1};Il.JOIN_MITRE.get=function(){return 2};Il.JOIN_BEVEL.get=function(){return 3};Il.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};Il.DEFAULT_MITRE_LIMIT.get=function(){return 5};Il.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Dn,Il);var Er=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=St.COUNTERCLOCKWISE,this._inputLine=t||null},im={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Er.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],a=this._inputLine[e],c=this._inputLine[n];return!this.isConcave(i,a,c)||!this.isShallow(i,a,c,r)?!1:this.isShallowSampled(i,a,t,n,r)};Er.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r=0;i--)n.addPt(t[i])};Yo.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-=Sn.PI_TIMES_2;for(;t<=-Math.PI;)t+=Sn.PI_TIMES_2;return t};Sn.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}};Sn.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,l=r*a+i*c;return l>0};Sn.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,a=n.x-e.x,c=n.y-e.y,l=r*a+i*c;return l<0};Sn.interiorAngle=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Math.abs(i-r)};Sn.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Sn.PI_TIMES_2;t>=Sn.PI_TIMES_2&&(t=0)}else{for(;t>=Sn.PI_TIMES_2;)t-=Sn.PI_TIMES_2;t<0&&(t=0)}return t};Sn.angleBetween=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n);return Sn.diff(r,i)};Sn.diff=function(t,e){var n=null;return tMath.PI&&(n=2*Math.PI-n),n};Sn.toRadians=function(t){return t*Math.PI/180};Sn.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Sn.COUNTERCLOCKWISE:n<0?Sn.CLOCKWISE:Sn.NONE};Sn.angleBetweenOriented=function(t,e,n){var r=Sn.angle(e,t),i=Sn.angle(e,n),a=i-r;return a<=-Math.PI?a+Sn.PI_TIMES_2:a>Math.PI?a-Sn.PI_TIMES_2:a};eh.PI_TIMES_2.get=function(){return 2*Math.PI};eh.PI_OVER_2.get=function(){return Math.PI/2};eh.PI_OVER_4.get=function(){return Math.PI/4};eh.COUNTERCLOCKWISE.get=function(){return St.COUNTERCLOCKWISE};eh.CLOCKWISE.get=function(){return St.CLOCKWISE};eh.NONE.get=function(){return St.COLLINEAR};Object.defineProperties(Sn,eh);var nr=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 zt,this._seg1=new zt,this._offset0=new zt,this._offset1=new zt,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new Qu,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Dn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},om={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}};nr.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=St.computeOrientation(this._s0,this._s1,this._s2),r=n===St.CLOCKWISE&&this._side===lt.LEFT||n===St.COUNTERCLOCKWISE&&this._side===lt.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)};nr.prototype.addLineEndCap=function(t,e){var n=new zt(t,e),r=new zt;this.computeOffsetSegment(n,lt.LEFT,this._distance,r);var i=new zt;this.computeOffsetSegment(n,lt.RIGHT,this._distance,i);var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a);switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,l+Math.PI/2,l-Math.PI/2,St.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Dn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Dn.CAP_SQUARE:var d=new Ne;d.x=Math.abs(this._distance)*Math.cos(l),d.y=Math.abs(this._distance)*Math.sin(l);var w=new Ne(r.p1.x+d.x,r.p1.y+d.y),S=new Ne(i.p1.x+d.x,i.p1.y+d.y);this._segList.addPt(w),this._segList.addPt(S);break}};nr.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};nr.prototype.addMitreJoin=function(t,e,n,r){var i=!0,a=null;try{a=Ls.intersection(e.p0,e.p1,n.p0,n.p1);var c=r<=0?1:a.distance(t)/Math.abs(r);c>this._bufParams.getMitreLimit()&&(i=!1)}catch(l){if(l instanceof Kf)a=new Ne(0,0),i=!1;else throw l}finally{}i?this._segList.addPt(a):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())};nr.prototype.addFilletCorner=function(t,e,n,r,i){var a=e.x-t.x,c=e.y-t.y,l=Math.atan2(c,a),d=n.x-t.x,w=n.y-t.y,S=Math.atan2(w,d);r===St.CLOCKWISE?l<=S&&(l+=2*Math.PI):l>=S&&(l-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,l,S,r,i),this._segList.addPt(n)};nr.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new Ne((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new Ne((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};nr.prototype.createCircle=function(t){var e=new Ne(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};nr.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)};nr.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Yo,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*nr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};nr.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()===Dn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Dn.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,St.CLOCKWISE,this._distance))};nr.prototype.closeRing=function(){this._segList.closeRing()};nr.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};nr.prototype.interfaces_=function(){return[]};nr.prototype.getClass=function(){return nr};om.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};om.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};om.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};om.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(nr,om);var ho=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};ho.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var a=i.getCoordinates();return n&&vn.reverse(a),a};ho.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Er.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],lt.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{n.addSegments(t,!1);var l=Er.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],lt.LEFT),n.addFirstSegment();for(var w=2;w<=d;w++)n.addNextSegment(l[w],!0)}n.addLastSegment(),n.closeRing()};ho.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===lt.RIGHT&&(r=-r);var i=Er.simplify(t,r),a=i.length-1;n.initSideSegments(i[a-1],i[0],e);for(var c=1;c<=a;c++){var l=c!==1;n.addNextSegment(i[c],l)}n.closeRing()};ho.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Er.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],lt.LEFT);for(var a=2;a<=i;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var c=Er.simplify(t,-n),l=c.length-1;e.initSideSegments(c[l],c[l-1],lt.LEFT);for(var d=l-2;d>=0;d--)e.addNextSegment(c[d],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()};ho.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Dn.CAP_ROUND:e.createCircle(t);break;case Dn.CAP_SQUARE:e.createSquare(t);break}};ho.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);var a=r.getCoordinates();return a};ho.prototype.getBufferParameters=function(){return this._bufParams};ho.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};ho.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return ho.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()};ho.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Er.simplify(t,-r),a=i.length-1;n.initSideSegments(i[a],i[a-1],lt.LEFT),n.addFirstSegment();for(var c=a-2;c>=0;c--)n.addNextSegment(i[c],!0)}else{var l=Er.simplify(t,r),d=l.length-1;n.initSideSegments(l[0],l[1],lt.LEFT),n.addFirstSegment();for(var w=2;w<=d;w++)n.addNextSegment(l[w],!0)}n.addLastSegment()};ho.prototype.getSegGen=function(t){return new nr(this._precisionModel,this._bufParams,t)};ho.prototype.interfaces_=function(){return[]};ho.prototype.getClass=function(){return ho};ho.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;na.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(Wt(arguments[2],Ps)&&arguments[0]instanceof Ne&&arguments[1]instanceof mv)for(var c=arguments[0],l=arguments[1],d=arguments[2],w=l.getEdge().getCoordinates(),S=0;St._seg.p1.y&&t._seg.reverse();var I=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(It._seg.p1.y)&&St.computeOrientation(t._seg.p0,t._seg.p1,c)!==St.RIGHT){var T=l.getDepth(lt.LEFT);t._seg.p0.equals(w[S])||(T=l.getDepth(lt.RIGHT));var k=new Vu(t._seg,T);d.add(k)}}else if(Wt(arguments[2],Ps)&&arguments[0]instanceof Ne&&Wt(arguments[1],Ps))for(var D=arguments[0],U=arguments[1],q=arguments[2],ee=U.iterator();ee.hasNext();){var B=ee.next();B.isForward()&&t.findStabbedSegments(D,B,q)}}};Nc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ds.min(e);return n._leftDepth};Nc.prototype.interfaces_=function(){return[]};Nc.prototype.getClass=function(){return Nc};cC.DepthSegment.get=function(){return Vu};Object.defineProperties(Nc,cC);var Vu=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new zt(t),this._leftDepth=e};Vu.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)};Vu.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)};Vu.prototype.toString=function(){return this._upwardSeg.toString()};Vu.prototype.interfaces_=function(){return[ds]};Vu.prototype.getClass=function(){return Vu};var Nn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Nn.prototype.area=function(){return Nn.area(this.p0,this.p1,this.p2)};Nn.prototype.signedArea=function(){return Nn.signedArea(this.p0,this.p1,this.p2)};Nn.prototype.interpolateZ=function(t){if(t===null)throw new lr("Supplied point is null.");return Nn.interpolateZ(t,this.p0,this.p1,this.p2)};Nn.prototype.longestSideLength=function(){return Nn.longestSideLength(this.p0,this.p1,this.p2)};Nn.prototype.isAcute=function(){return Nn.isAcute(this.p0,this.p1,this.p2)};Nn.prototype.circumcentre=function(){return Nn.circumcentre(this.p0,this.p1,this.p2)};Nn.prototype.area3D=function(){return Nn.area3D(this.p0,this.p1,this.p2)};Nn.prototype.centroid=function(){return Nn.centroid(this.p0,this.p1,this.p2)};Nn.prototype.inCentre=function(){return Nn.inCentre(this.p0,this.p1,this.p2)};Nn.prototype.interfaces_=function(){return[]};Nn.prototype.getClass=function(){return Nn};Nn.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)};Nn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2};Nn.det=function(t,e,n,r){return t*r-e*n};Nn.interpolateZ=function(t,e,n,r){var i=e.x,a=e.y,c=n.x-i,l=r.x-i,d=n.y-a,w=r.y-a,S=c*w-l*d,I=t.x-i,T=t.y-a,k=(w*I-l*T)/S,D=(-d*I+c*T)/S,U=e.z+k*(n.z-e.z)+D*(r.z-e.z);return U};Nn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),a=n.distance(t),c=r;return i>c&&(c=i),a>c&&(c=a),c};Nn.isAcute=function(t,e,n){return!(!Sn.isAcute(t,e,n)||!Sn.isAcute(e,n,t)||!Sn.isAcute(n,t,e))};Nn.circumcentre=function(t,e,n){var r=n.x,i=n.y,a=t.x-r,c=t.y-i,l=e.x-r,d=e.y-i,w=2*Nn.det(a,c,l,d),S=Nn.det(c,a*a+c*c,d,l*l+d*d),I=Nn.det(a,a*a+c*c,l,l*l+d*d),T=r-S/w,k=i+I/w;return new Ne(T,k)};Nn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Ls(t.x+n/2,t.y+r/2,1),a=new Ls(t.x-r+n/2,t.y+n+r/2,1);return new Ls(i,a)};Nn.angleBisector=function(t,e,n){var r=e.distance(t),i=e.distance(n),a=r/(r+i),c=n.x-t.x,l=n.y-t.y,d=new Ne(t.x+a*c,t.y+a*l);return d};Nn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,a=e.z-t.z,c=n.x-t.x,l=n.y-t.y,d=n.z-t.z,w=i*d-a*l,S=a*c-r*d,I=r*l-i*c,T=w*w+S*S+I*I,k=Math.sqrt(T)/2;return k};Nn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Ne(r,i)};Nn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),a=t.distance(e),c=r+i+a,l=(r*t.x+i*e.x+a*n.x)/c,d=(r*t.y+i*e.y+a*n.y)/c;return new Ne(l,d)};var ps=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new gt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};ps.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Fe.EXTERIOR,Fe.INTERIOR)};ps.prototype.addPolygon=function(t){var e=this,n=this._distance,r=lt.LEFT;this._distance<0&&(n=-this._distance,r=lt.RIGHT);var i=t.getExteriorRing(),a=vn.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,n,r,Fe.EXTERIOR,Fe.INTERIOR);for(var c=0;c0&&e.isErodedCompletely(l,-e._distance)||e.addPolygonRing(d,n,lt.opposite(r),Fe.INTERIOR,Fe.EXTERIOR)}};ps.prototype.isTriangleErodedCompletely=function(t,e){var n=new Nn(t[0],t[1],t[2]),r=n.inCentre(),i=St.distancePointLine(r,n.p0,n.p1);return i=Oa.MINIMUM_VALID_SIZE&&St.isCCW(t)&&(a=i,c=r,n=lt.opposite(n));var l=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(l,a,c)};ps.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Qr?this.addPolygon(t):t instanceof Sr?this.addLineString(t):t instanceof Po?this.addPoint(t):t instanceof Af?this.addCollection(t):t instanceof Fu?this.addCollection(t):t instanceof ka?this.addCollection(t):t instanceof Ki&&this.addCollection(t)};ps.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i};ps.prototype.addCollection=function(t){for(var e=this,n=0;n=this._max)throw new Qf;var t=this._parent.getGeometryN(this._index++);return t instanceof Ki?(this._subcollectionIterator=new Da(t),this._subcollectionIterator.next()):t};Da.prototype.remove=function(){throw new Error(this.getClass().getName())};Da.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)};Da.prototype.interfaces_=function(){return[Jf]};Da.prototype.getClass=function(){return Da};Da.isAtomic=function(t){return!(t instanceof Ki)};var Wo=function(){this._geom=null;var t=arguments[0];this._geom=t};Wo.prototype.locate=function(t){return Wo.locate(t,this._geom)};Wo.prototype.interfaces_=function(){return[Nf]};Wo.prototype.getClass=function(){return Wo};Wo.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?St.isPointInRing(t,e.getCoordinates()):!1};Wo.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Wo.isPointInRing(t,n))return!1;for(var r=0;r=0;a--){var c=n._edgeList.get(a),l=c.getSym();i===null&&(i=l),r!==null&&l.setNext(r),r=c}i.setNext(r)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),a=r.getDepth(lt.LEFT),c=r.getDepth(lt.RIGHT),l=this.computeDepths(i+1,this._edgeList.size(),a),d=this.computeDepths(0,i,l);if(d!==c)throw new yl("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var w=arguments[0],S=arguments[1],I=arguments[2],T=I,k=w;k=0;l--){var d=r._resultAreaEdgeList.get(l),w=d.getSym();switch(i===null&&d.getEdgeRing()===n&&(i=d),c){case r._SCANNING_FOR_INCOMING:if(w.getEdgeRing()!==n)continue;a=w,c=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(d.getEdgeRing()!==n)continue;a.setNextMin(d),c=r._SCANNING_FOR_INCOMING;break}}c===this._LINKING_TO_OUTGOING&&(ln.isTrue(i!==null,"found null for first outgoing dirEdge"),ln.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),a.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}else if(arguments.length===1){for(var a=arguments[0],c=0,l=this.iterator();l.hasNext();){var d=l.next();d.getEdgeRing()===a&&c++}return c}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=Fe.NONE,r=this.iterator();r.hasNext();){var i=r.next(),a=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=Fe.INTERIOR;break}if(a.isInResult()){n=Fe.EXTERIOR;break}}}if(n===Fe.NONE)return null;for(var c=n,l=this.iterator();l.hasNext();){var d=l.next(),w=d.getSym();d.isLineEdge()?d.getEdge().setCovered(c===Fe.INTERIOR):(d.isInResult()&&(c=Fe.EXTERIOR),w.isInResult()&&(c=Fe.INTERIOR))}},e.prototype.computeLabelling=function(n){var r=this;t.prototype.computeLabelling.call(this,n),this._label=new Vn(Fe.NONE);for(var i=this.iterator();i.hasNext();)for(var a=i.next(),c=a.getEdge(),l=c.getLabel(),d=0;d<2;d++){var w=l.getLocation(d);(w===Fe.INTERIOR||w===Fe.BOUNDARY)&&r._label.setLocation(d,Fe.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zi),hC=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 j_(n,new kR)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(kf),nu=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};nu.prototype.compareTo=function(t){var e=t,n=nu.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n};nu.prototype.interfaces_=function(){return[ds]};nu.prototype.getClass=function(){return nu};nu.orientation=function(t){return vn.increasingDirection(t)===1};nu.compareOriented=function(t,e,n,r){for(var i=e?1:-1,a=r?1:-1,c=e?t.length:-1,l=r?n.length:-1,d=e?0:t.length-1,w=r?0:n.length-1;;){var S=t[d].compareTo(n[w]);if(S!==0)return S;d+=i,w+=a;var I=d===c,T=w===l;if(I&&!T)return-1;if(!I&&T)return 1;if(I&&T)return 0}};var Rs=function(){this._edges=new gt,this._ocaMap=new Ni};Rs.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n0&&t.print(","),t.print("(");for(var i=r.getCoordinates(),a=0;a0&&t.print(","),t.print(i[a].x+" "+i[a].y);t.println(")")}t.print(") ")};Rs.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())};Rs.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n0||!e.coord.equals2D(i);a||r--;var c=new Array(r).fill(null),l=0;c[l++]=new Ne(t.coord);for(var d=t.segmentIndex+1;d<=e.segmentIndex;d++)c[l++]=n.edge.pts[d];return a&&(c[l]=e.coord),new d_(c,new Vn(this.edge._label))};Ba.prototype.add=function(t,e,n){var r=new ha(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)};Ba.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1};Ba.prototype.interfaces_=function(){return[]};Ba.prototype.getClass=function(){return Ba};var Gu=function(){};Gu.prototype.getChainStartIndices=function(t){var e=this,n=0,r=new gt;r.add(new oa(n));do{var i=e.findChainEnd(t,n);r.add(new oa(i)),n=i}while(nn?e:n};bl.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return en&&(i=1),t._depth[e][r]=i}}};Ii.prototype.getDelta=function(t){return this._depth[t][lt.RIGHT]-this._depth[t][lt.LEFT]};Ii.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Fe.EXTERIOR:Fe.INTERIOR};Ii.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};Ii.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);(i===Fe.EXTERIOR||i===Fe.INTERIOR)&&(t.isNull(n,r)?t._depth[n][r]=Ii.depthAtLocation(i):t._depth[n][r]+=Ii.depthAtLocation(i))}else if(arguments.length===3){var a=arguments[0],c=arguments[1],l=arguments[2];l===Fe.INTERIOR&&this._depth[a][c]++}};Ii.prototype.interfaces_=function(){return[]};Ii.prototype.getClass=function(){return Ii};Ii.depthAtLocation=function(t){return t===Fe.EXTERIOR?0:t===Fe.INTERIOR?1:Ii.NULL_VALUE};fC.NULL_VALUE.get=function(){return-1};Object.defineProperties(Ii,fC);var d_=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Ba(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ii,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var r=new e(n,Vn.toLineLabel(this._label));return r},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){var r=this;if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var a=!0,c=!0,l=this.pts.length,d=0;d0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},e.prototype.print=function(n){var r=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i0&&n.print(","),n.print(r.pts[i].x+" "+r.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){var r=this;n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(r.pts[i]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new bl(this)),this._mce},e.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new Ot;for(var r=0;r0&&r.append(","),r.append(n.pts[i].x+" "+n.pts[i].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()},e.prototype.isPointwiseEqual=function(n){var r=this;if(this.pts.length!==n.pts.length)return!1;for(var i=0;ir||this._maxya;if(c)return!1;var l=this.intersectsToleranceSquare(t,e);return ln.isTrue(!(c&&l),"Found bad envelope test"),l};fo.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 Ne(this._maxx,this._maxy),this._corner[1]=new Ne(this._minx,this._maxy),this._corner[2]=new Ne(this._minx,this._miny),this._corner[3]=new Ne(this._maxx,this._miny)};fo.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))};fo.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};fo.prototype.getCoordinate=function(){return this._originalPt};fo.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)};fo.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=fo.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ot(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};fo.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()))};fo.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&r||t.equals(this._pt)||e.equals(this._pt))};fo.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return this.intersects(n,r)?(t.addIntersection(this.getCoordinate(),e),!0):!1};fo.prototype.interfaces_=function(){return[]};fo.prototype.getClass=function(){return fo};dC.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(fo,dC);var jd=function(){this.tempEnv1=new Ot,this.selectedSegment=new zt};jd.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)}};jd.prototype.interfaces_=function(){return[]};jd.prototype.getClass=function(){return jd};var Of=function(){this._index=null;var t=arguments[0];this._index=t},mC={HotPixelSnapAction:{configurable:!0}};Of.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),a=new gC(e,n,r);return this._index.query(i,{interfaces_:function(){return[eu]},visitItem:function(c){var l=c;l.select(i,a)}}),a.isNodeAdded()}};Of.prototype.interfaces_=function(){return[]};Of.prototype.getClass=function(){return Of};mC.HotPixelSnapAction.get=function(){return gC};Object.defineProperties(Of,mC);var gC=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)}else return t.prototype.select.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jd),Oc=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new gt};Oc.prototype.processIntersections=function(t,e,n,r){var i=this;if(t===n&&e===r)return null;var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];if(this._li.computeIntersection(a,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var w=0;w=0;e--){try{t.bufferReducedPrecision(e)}catch(a){if(a instanceof yl)t._saveException=a;else throw a}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],r=Si.precisionScaleFactor(this._argGeom,this._distance,n),i=new Rn(r);this.bufferFixedPrecision(i)}};Si.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Rn.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};Si.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};Si.prototype.bufferOriginalPrecision=function(){try{var t=new Zi(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof gl)this._saveException=e;else throw e}finally{}};Si.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};Si.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};Si.prototype.interfaces_=function(){return[]};Si.prototype.getClass=function(){return Si};Si.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Si(t),r=n.getResultGeometry(e);return r}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof jt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],c=arguments[2],l=new Si(i);l.setQuadrantSegments(c);var d=l.getResultGeometry(a);return d}else if(arguments[2]instanceof Dn&&arguments[0]instanceof jt&&typeof arguments[1]=="number"){var w=arguments[0],S=arguments[1],I=arguments[2],T=new Si(w,I),k=T.getResultGeometry(S);return k}}else if(arguments.length===4){var D=arguments[0],U=arguments[1],q=arguments[2],ee=arguments[3],B=new Si(D);B.setQuadrantSegments(q),B.setEndCapStyle(ee);var j=B.getResultGeometry(U);return j}};Si.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Zo.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY())),a=e>0?e:0,c=i+2*a,l=Math.trunc(Math.log(c)/Math.log(10)+1),d=n-l,w=Math.pow(10,d);return w};$f.CAP_ROUND.get=function(){return Dn.CAP_ROUND};$f.CAP_BUTT.get=function(){return Dn.CAP_FLAT};$f.CAP_FLAT.get=function(){return Dn.CAP_FLAT};$f.CAP_SQUARE.get=function(){return Dn.CAP_SQUARE};$f.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(Si,$f);var qi=function(){this._pt=[new Ne,new Ne],this._distance=$t.NaN,this._isNull=!0};qi.prototype.getCoordinates=function(){return this._pt};qi.prototype.getCoordinate=function(t){return this._pt[t]};qi.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);rthis._distance&&this.initialize(e,n,r)}};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};var Pa=function(){};Pa.prototype.interfaces_=function(){return[]};Pa.prototype.getClass=function(){return Pa};Pa.computeDistance=function(){if(arguments[2]instanceof qi&&arguments[0]instanceof Sr&&arguments[1]instanceof Ne)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new zt,a=0;a0||this._isIn?Fe.INTERIOR:Fe.EXTERIOR)};Ns.prototype.interfaces_=function(){return[]};Ns.prototype.getClass=function(){return Ns};var Wi=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._component=r,this._segIndex=i,this._pt=a}},_C={INSIDE_AREA:{configurable:!0}};Wi.prototype.isInsideArea=function(){return this._segIndex===Wi.INSIDE_AREA};Wi.prototype.getCoordinate=function(){return this._pt};Wi.prototype.getGeometryComponent=function(){return this._component};Wi.prototype.getSegmentIndex=function(){return this._segIndex};Wi.prototype.interfaces_=function(){return[]};Wi.prototype.getClass=function(){return Wi};_C.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Wi,_C);var Kl=function(t){this._pts=t||null};Kl.prototype.filter=function(t){t instanceof Po&&this._pts.add(t)};Kl.prototype.interfaces_=function(){return[aa]};Kl.prototype.getClass=function(){return Kl};Kl.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Po?Ds.singletonList(t):Kl.getPoints(t,new gt)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Po?n.add(e):e instanceof Ki&&e.apply(new Kl(n)),n}};var Fc=function(){this._locations=null;var t=arguments[0];this._locations=t};Fc.prototype.filter=function(t){(t instanceof Po||t instanceof Sr||t instanceof Qr)&&this._locations.add(new Wi(t,0,t.getCoordinate()))};Fc.prototype.interfaces_=function(){return[aa]};Fc.prototype.getClass=function(){return Fc};Fc.getLocations=function(t){var e=new gt;return t.apply(new Fc(e)),e};var Ti=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ns,this._minDistanceLocation=null,this._minDistance=$t.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ti.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,a=dl.getPolygons(this._geom[n]);if(a.size()>0){var c=Fc.getLocations(this._geom[i]);if(this.computeContainmentDistance(c,a,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Wt(arguments[0],Ps)&&Wt(arguments[1],Ps)){for(var l=arguments[0],d=arguments[1],w=arguments[2],S=0;Sthis._minDistance)return null;for(var i=e.getCoordinates(),a=n.getCoordinate(),c=0;cthis._minDistance)return null;for(var k=S.getCoordinates(),D=I.getCoordinates(),U=0;Uthis._distance&&this.initialize(e,n,r)}};Ri.prototype.interfaces_=function(){return[]};Ri.prototype.getClass=function(){return Ri};var ea=function(){};ea.prototype.interfaces_=function(){return[]};ea.prototype.getClass=function(){return ea};ea.computeDistance=function(){if(arguments[2]instanceof Ri&&arguments[0]instanceof Sr&&arguments[1]instanceof Ne)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new zt,i=t.getCoordinates(),a=0;a1||t<=0)throw new lr("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};ls.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)};ls.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};ls.prototype.computeOrientedDistance=function(t,e,n){var r=new Bc(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new ou(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}};ls.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};ls.prototype.interfaces_=function(){return[]};ls.prototype.getClass=function(){return ls};ls.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ls(t,e);return n.distance()}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=new ls(r,i);return c.setDensifyFraction(a),c.distance()}};p1.MaxPointDistanceFilter.get=function(){return Bc};p1.MaxDensifiedByFractionDistanceFilter.get=function(){return ou};Object.defineProperties(ls,p1);var Bc=function(){this._maxPtDist=new Ri,this._minPtDist=new Ri,this._euclideanDist=new ea,this._geom=null;var t=arguments[0];this._geom=t};Bc.prototype.filter=function(t){this._minPtDist.initialize(),ea.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};Bc.prototype.getMaxPointDistance=function(){return this._maxPtDist};Bc.prototype.interfaces_=function(){return[Na]};Bc.prototype.getClass=function(){return Bc};var ou=function(){this._maxPtDist=new Ri,this._minPtDist=new Ri,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};ou.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),a=(i.x-r.x)/this._numSubSegs,c=(i.y-r.y)/this._numSubSegs,l=0;ln){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Ms.toLineString(i[0],i[1])+")"}};Co.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Co.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(),Co.VERBOSE&&Ci.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};Co.prototype.checkNegativeValid=function(){if(!(this._input instanceof Qr||this._input instanceof ka||this._input instanceof Ki))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)};Co.prototype.getErrorIndicator=function(){return this._errorIndicator};Co.prototype.checkMinimumDistance=function(t,e,n){var r=new Ti(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Li.prototype.report=function(t){if(!Li.VERBOSE)return null;Ci.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Li.prototype.getErrorMessage=function(){return this._errorMsg};Li.prototype.interfaces_=function(){return[]};Li.prototype.getClass=function(){return Li};Li.isValidMsg=function(t,e,n){var r=new Li(t,e,n);return r.isValid()?null:r.getErrorMessage()};Li.isValid=function(t,e,n){var r=new Li(t,e,n);return!!r.isValid()};m1.VERBOSE.get=function(){return!1};m1.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Li,m1);var pa=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};pa.prototype.getCoordinates=function(){return this._pts};pa.prototype.size=function(){return this._pts.length};pa.prototype.getCoordinate=function(t){return this._pts[t]};pa.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};pa.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Rc.octant(this.getCoordinate(t),this.getCoordinate(t+1))};pa.prototype.setData=function(t){this._data=t};pa.prototype.getData=function(){return this._data};pa.prototype.toString=function(){return Ms.toLineString(new Pr(this._pts))};pa.prototype.interfaces_=function(){return[Fa]};pa.prototype.getClass=function(){return pa};var vi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new gt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};vi.prototype.getInteriorIntersection=function(){return this._interiorIntersection};vi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};vi.prototype.getIntersectionSegments=function(){return this._intSegments};vi.prototype.count=function(){return this._intersectionCount};vi.prototype.getIntersections=function(){return this._intersections};vi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};vi.prototype.setKeepIntersections=function(t){this._keepIntersections=t};vi.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly){var i=this.isEndSegment(t,e)||this.isEndSegment(n,r);if(!i)return null}var a=t.getCoordinates()[e],c=t.getCoordinates()[e+1],l=n.getCoordinates()[r],d=n.getCoordinates()[r+1];this._li.computeIntersection(a,c,l,d),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=c,this._intSegments[2]=l,this._intSegments[3]=d,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};vi.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2};vi.prototype.hasIntersection=function(){return this._interiorIntersection!==null};vi.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};vi.prototype.interfaces_=function(){return[Uu]};vi.prototype.getClass=function(){return vi};vi.createAllIntersectionsFinder=function(t){var e=new vi(t);return e.setFindAllIntersections(!0),e};vi.createAnyIntersectionFinder=function(t){return new vi(t)};vi.createIntersectionCounter=function(t){var e=new vi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Os=function(){this._li=new Qu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Os.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};Os.prototype.getIntersections=function(){return this._segInt.getIntersections()};Os.prototype.isValid=function(){return this.execute(),this._isValid};Os.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};Os.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new h1;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};Os.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new yl(this.getErrorMessage(),this._segInt.getInteriorIntersection())};Os.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Ms.toLineString(t[0],t[1])+" and "+Ms.toLineString(t[2],t[3])};Os.prototype.interfaces_=function(){return[]};Os.prototype.getClass=function(){return Os};Os.computeIntersections=function(t){var e=new Os(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var qu=function t(){this._nv=null;var e=arguments[0];this._nv=new Os(t.toSegmentStrings(e))};qu.prototype.checkValid=function(){this._nv.checkValid()};qu.prototype.interfaces_=function(){return[]};qu.prototype.getClass=function(){return qu};qu.toSegmentStrings=function(t){for(var e=new gt,n=t.iterator();n.hasNext();){var r=n.next();e.add(new pa(r.getCoordinates(),r))}return e};qu.checkValid=function(t){var e=new qu(t);e.checkValid()};var Vc=function(t){this._mapOp=t};Vc.prototype.map=function(t){for(var e=this,n=new gt,r=0;r0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)};po.prototype.interfaces_=function(){return[]};po.prototype.getClass=function(){return po};var Ua=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new zt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Sr&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Ua.prototype.snapVertices=function(t,e){for(var n=this,r=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(c+1,new Ne(a),!1)}};Ua.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=$t.MAX_VALUE,i=-1,a=0;ae&&(e=r)}return e}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return Math.min(Mr.computeOverlaySnapTolerance(i),Mr.computeOverlaySnapTolerance(a))}};Mr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),r=n*Mr.SNAP_PRECISION_FACTOR;return r};Mr.snapToSelf=function(t,e,n){var r=new Mr(t);return r.snapToSelf(e,n)};yC.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Mr,yC);var vC=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var i=new Ua(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),a=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(po),ji=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};ji.prototype.getCommon=function(){return $t.longBitsToDouble(this._commonBits)};ji.prototype.add=function(t){var e=$t.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=ji.signExpBits(this._commonBits),this._isFirst=!1,null;var n=ji.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=ji.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=ji.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};ji.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=$t.longBitsToDouble(t),n=$t.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),a=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return a}};ji.prototype.interfaces_=function(){return[]};ji.prototype.getClass=function(){return ji};ji.getBit=function(t,e){var n=1<>52};ji.zeroLowerBits=function(t,e){var n=(1<=0;r--){if(ji.getBit(t,r)!==ji.getBit(e,r))return n;n++}return 52};var su=function(){this._commonCoord=null,this._ccFilter=new Gc},g1={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};su.prototype.addCommonBits=function(t){var e=new au(this._commonCoord);t.apply(e),t.geometryChanged()};su.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new Ne(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new au(e);return t.apply(n),t.geometryChanged(),t};su.prototype.getCommonCoordinate=function(){return this._commonCoord};su.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};su.prototype.interfaces_=function(){return[]};su.prototype.getClass=function(){return su};g1.CommonCoordinateFilter.get=function(){return Gc};g1.Translater.get=function(){return au};Object.defineProperties(su,g1);var Gc=function(){this._commonBitsX=new ji,this._commonBitsY=new ji};Gc.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};Gc.prototype.getCommonCoordinate=function(){return new Ne(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};Gc.prototype.interfaces_=function(){return[Na]};Gc.prototype.getClass=function(){return Gc};var au=function(){this.trans=null;var t=arguments[0];this.trans=t};au.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)};au.prototype.isDone=function(){return!1};au.prototype.isGeometryChanged=function(){return!0};au.prototype.interfaces_=function(){return[As]};au.prototype.getClass=function(){return au};var bi=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()};bi.prototype.selfSnap=function(t){var e=new Mr(t),n=e.snapTo(t,this._snapTolerance);return n};bi.prototype.removeCommonBits=function(t){this._cbr=new su,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};bi.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};bi.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=rn.overlayOp(e[0],e[1],t);return this.prepareResult(n)};bi.prototype.checkValid=function(t){t.isValid()||Ci.out.println("Snapped geometry is invalid")};bi.prototype.computeSnapTolerance=function(){this._snapTolerance=Mr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};bi.prototype.snap=function(t){var e=this.removeCommonBits(t),n=Mr.snap(e[0],e[1],this._snapTolerance);return n};bi.prototype.interfaces_=function(){return[]};bi.prototype.getClass=function(){return bi};bi.overlayOp=function(t,e,n){var r=new bi(t,e);return r.getResultGeometry(n)};bi.union=function(t,e){return bi.overlayOp(t,e,rn.UNION)};bi.intersection=function(t,e){return bi.overlayOp(t,e,rn.INTERSECTION)};bi.symDifference=function(t,e){return bi.overlayOp(t,e,rn.SYMDIFFERENCE)};bi.difference=function(t,e){return bi.overlayOp(t,e,rn.DIFFERENCE)};var $i=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};$i.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=rn.overlayOp(this._geom[0],this._geom[1],t);var i=!0;i&&(n=!0)}catch(a){if(a instanceof gl)r=a;else throw a}finally{}if(!n)try{e=bi.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof gl?r:a}finally{}return e};$i.prototype.interfaces_=function(){return[]};$i.prototype.getClass=function(){return $i};$i.overlayOp=function(t,e,n){var r=new $i(t,e);return r.getResultGeometry(n)};$i.union=function(t,e){return $i.overlayOp(t,e,rn.UNION)};$i.intersection=function(t,e){return $i.overlayOp(t,e,rn.INTERSECTION)};$i.symDifference=function(t,e){return $i.overlayOp(t,e,rn.SYMDIFFERENCE)};$i.difference=function(t,e){return $i.overlayOp(t,e,rn.DIFFERENCE)};var qd=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};qd.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)};qd.prototype.interfaces_=function(){return[]};qd.prototype.getClass=function(){return qd};var ko=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=a}},_1={INSERT:{configurable:!0},DELETE:{configurable:!0}};ko.prototype.isDelete=function(){return this._eventType===ko.DELETE};ko.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};ko.prototype.getObject=function(){return this._obj};ko.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0};ko.prototype.getInsertEvent=function(){return this._insertEvent};ko.prototype.isInsert=function(){return this._eventType===ko.INSERT};ko.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};ko.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};ko.prototype.interfaces_=function(){return[ds]};ko.prototype.getClass=function(){return ko};_1.INSERT.get=function(){return 1};_1.DELETE.get=function(){return 2};Object.defineProperties(ko,_1);var m_=function(){};m_.prototype.interfaces_=function(){return[]};m_.prototype.getClass=function(){return m_};var Pi=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};Pi.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Pi.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1};Pi.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Pi.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Pi.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Pi.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next(),i=r.getCoordinate();if(t.isIntersection(i))return!0}return!1};Pi.prototype.hasProperIntersection=function(){return this._hasProper};Pi.prototype.hasIntersection=function(){return this._hasIntersection};Pi.prototype.isDone=function(){return this._isDone};Pi.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))};Pi.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e};Pi.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],a=t.getCoordinates()[e+1],c=n.getCoordinates()[r],l=n.getCoordinates()[r+1];this._li.computeIntersection(i,a,c,l),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Pi.prototype.interfaces_=function(){return[]};Pi.prototype.getClass=function(){return Pi};Pi.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var DR=function(t){function e(){t.call(this),this.events=new gt,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;Ds.sort(this.events);for(var r=0;re||this._maxa?1:0};Wd.prototype.interfaces_=function(){return[Ef]};Wd.prototype.getClass=function(){return Wd};var RR=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ga),NR=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ga),ja=function(){this._leaves=new gt,this._root=null,this._level=0};ja.prototype.buildTree=function(){var t=this;Ds.sort(this._leaves,new Ga.NodeComparator);for(var e=this._leaves,n=null,r=new gt;;){if(t.buildLevel(e,r),r.size()===1)return r.get(0);n=e,e=r,r=n}};ja.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 RR(t,e,n))};ja.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)};ja.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};ja.prototype.printNode=function(t){Ci.out.println(Ms.toLineString(new Ne(t._min,this._level),new Ne(t._max,this._level)))};ja.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};ja.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,a=n.iterator();a.hasNext();){var c=a.next();r[i++]=c.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===Fe.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},e.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var a=vn.removeRepeatedPoints(n.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var c=r,l=i;St.isCCW(a)&&(c=i,l=r);var d=new d_(a,new Vn(this._argIndex,Fe.BOUNDARY,c,l));this._lineEdgeMap.put(n,d),this.insertEdge(d),this.insertPoint(this._argIndex,a[0],Fe.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var a=this._nodes.addNode(r),c=a.getLabel();c===null?a._label=new Vn(n,i):c.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new DR},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this,i=this._edges.iterator();i.hasNext();)for(var a=i.next(),c=a.getLabel().getLocation(n),l=a.eiList.iterator();l.hasNext();){var d=l.next();r.addSelfIntersectionNode(n,d.coord,c)}},e.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof ka&&(this._useBoundaryDeterminationRule=!1),n instanceof Qr)this.addPolygon(n);else if(n instanceof Sr)this.addLineString(n);else if(n instanceof Po)this.addPoint(n);else if(n instanceof Af)this.addCollection(n);else if(n instanceof Fu)this.addCollection(n);else if(n instanceof ka)this.addCollection(n);else if(n instanceof Ki)this.addCollection(n);else throw new Error(n.getClass().getName())}else return t.prototype.add.apply(this,arguments)},e.prototype.addCollection=function(n){for(var r=this,i=0;i50?(this._areaPtLocator===null&&(this._areaPtLocator=new Ff(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?Fe.BOUNDARY:Fe.INTERIOR},e}(gr),Vf=function(){if(this._li=new Qu,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 ud(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=hs.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 ud(0,e,r),this._arg[1]=new ud(1,n,r)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ud(0,i,c),this._arg[1]=new ud(1,a,c)}};Vf.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Vf.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Vf.prototype.interfaces_=function(){return[]};Vf.prototype.getClass=function(){return Vf};var Ou=function(){};Ou.prototype.interfaces_=function(){return[]};Ou.prototype.getClass=function(){return Ou};Ou.map=function(){if(arguments[0]instanceof jt&&Wt(arguments[1],Ou.MapOp)){for(var t=arguments[0],e=arguments[1],n=new gt,r=0;r=t.size()?null:t.get(e)};Fr.union=function(t){var e=new Fr(t);return e.union()};wC.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(Fr,wC);var g_=function(){};g_.prototype.interfaces_=function(){return[]};g_.prototype.getClass=function(){return g_};g_.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return rn.createEmptyResult(rn.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),$i.overlayOp(t,e,rn.UNION)};function $u(){return new __}function __(){this.reset()}__.prototype={constructor:__,reset:function(){this.s=this.t=0},add:function(t){d2(bg,t,this.t),d2(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new __;function d2(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var wr=1e-6,Hn=Math.PI,pl=Hn/2,m2=Hn/4,xl=Hn*2,Mu=180/Hn,Ks=Hn/180,Hi=Math.abs,OR=Math.atan,Gf=Math.atan2,Wr=Math.cos,Hr=Math.sin,ep=Math.sqrt;function SC(t){return t>1?0:t<-1?Hn:Math.acos(t)}function jc(t){return t>1?pl:t<-1?-pl:Math.asin(t)}function yd(){}function y_(t,e){t&&_2.hasOwnProperty(t.type)&&_2[t.type](t,e)}var g2={Feature:function(t,e){y_(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rHn?t-xl:t<-Hn?t+xl:t,e]}vv.invert=vv;function FR(t,e,n){return(t%=xl)?e||n?EC(b2(t),x2(e,n)):b2(t):e||n?x2(e,n):vv}function v2(t){return function(e,n){return e+=t,[e>Hn?e-xl:e<-Hn?e+xl:e,n]}}function b2(t){var e=v2(t);return e.invert=v2(-t),e}function x2(t,e){var n=Wr(t),r=Hr(t),i=Wr(e),a=Hr(e);function c(l,d){var w=Wr(d),S=Wr(l)*w,I=Hr(l)*w,T=Hr(d),k=T*n+S*r;return[Gf(I*i-k*a,S*n-T*r),jc(k*i+I*a)]}return c.invert=function(l,d){var w=Wr(d),S=Wr(l)*w,I=Hr(l)*w,T=Hr(d),k=T*i-I*a;return[Gf(I*i+T*a,S*n+k*r),jc(k*n-S*r)]},c}function BR(t,e,n,r,i,a){if(n){var c=Wr(e),l=Hr(e),d=r*n;i==null?(i=e+r*xl,a=e-d/2):(i=w2(c,i),a=w2(c,a),(r>0?ia)&&(i+=r*xl));for(var w,S=i;r>0?S>a:S1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function VR(t,e,n,r,i,a){var c=t[0],l=t[1],d=e[0],w=e[1],S=0,I=1,T=d-c,k=w-l,D;if(D=n-c,!(!T&&D>0)){if(D/=T,T<0){if(D0){if(D>I)return;D>S&&(S=D)}if(D=i-c,!(!T&&D<0)){if(D/=T,T<0){if(D>I)return;D>S&&(S=D)}else if(T>0){if(D0)){if(D/=k,k<0){if(D0){if(D>I)return;D>S&&(S=D)}if(D=a-l,!(!k&&D<0)){if(D/=k,k<0){if(D>I)return;D>S&&(S=D)}else if(k>0){if(D0&&(t[0]=c+S*T,t[1]=l+S*k),I<1&&(e[0]=c+I*T,e[1]=l+I*k),!0}}}}}function Fg(t,e){return Hi(t[0]-e[0])=0;--l)i.point((I=S[l])[0],I[1]);else r(T.x,T.p.x,-1,i);T=T.p}T=T.o,S=T.z,k=!k}while(!T.v);i.lineEnd()}}}function S2(t){if(e=t.length){for(var e,n=0,r=t[0],i;++ne?1:t>=e?0:NaN}function UR(t){return t.length===1&&(t=GR(t)),{left:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(r==null&&(r=0),i==null&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}function GR(t){return function(e,n){return TC(t(e),n)}}UR(TC);function LC(t){for(var e=t.length,n,r=-1,i=0,a,c;++r=0;)for(c=t[e],n=c.length;--n>=0;)a[--i]=c[n];return a}var vd=1e9,Eg=-vd;function jR(t,e,n,r){function i(w,S){return t<=w&&w<=n&&e<=S&&S<=r}function a(w,S,I,T){var k=0,D=0;if(w==null||(k=c(w,I))!==(D=c(S,I))||d(w,S)<0^I>0)do T.point(k===0||k===3?t:n,k>1?r:e);while((k=(k+I+4)%4)!==D);else T.point(S[0],S[1])}function c(w,S){return Hi(w[0]-t)0?0:3:Hi(w[0]-n)0?2:1:Hi(w[1]-e)0?1:0:S>0?3:2}function l(w,S){return d(w.x,S.x)}function d(w,S){var I=c(w,1),T=c(S,1);return I!==T?I-T:I===0?S[1]-w[1]:I===1?w[0]-S[0]:I===2?w[1]-S[1]:S[0]-w[0]}return function(w){var S=w,I=IC(),T,k,D,U,q,ee,B,j,J,ae,me,de={point:te,lineStart:oe,lineEnd:Ye,polygonStart:Ae,polygonEnd:Y};function te(Oe,He){i(Oe,He)&&S.point(Oe,He)}function $(){for(var Oe=0,He=0,Ge=k.length;Her&&(Fn-kt)*(r-un)>(bn-un)*(t-kt)&&++Oe:bn<=r&&(Fn-kt)*(r-un)<(bn-un)*(t-kt)&&--Oe;return Oe}function Ae(){S=I,T=[],k=[],me=!0}function Y(){var Oe=$(),He=me&&Oe,Ge=(T=LC(T)).length;(He||Ge)&&(w.polygonStart(),He&&(w.lineStart(),a(null,null,1,w),w.lineEnd()),Ge&&CC(T,l,Oe,a,w),w.polygonEnd()),S=w,T=k=D=null}function oe(){de.point=ve,k&&k.push(D=[]),ae=!0,J=!1,B=j=NaN}function Ye(){T&&(ve(U,q),ee&&J&&I.rejoin(),T.push(I.result())),de.point=te,J&&S.lineEnd()}function ve(Oe,He){var Ge=i(Oe,He);if(k&&D.push([Oe,He]),ae)U=Oe,q=He,ee=Ge,ae=!1,Ge&&(S.lineStart(),S.point(Oe,He));else if(Ge&&J)S.point(Oe,He);else{var Rt=[B=Math.max(Eg,Math.min(vd,B)),j=Math.max(Eg,Math.min(vd,j))],Pt=[Oe=Math.max(Eg,Math.min(vd,Oe)),He=Math.max(Eg,Math.min(vd,He))];VR(Rt,Pt,t,e,n,r)?(J||(S.lineStart(),S.point(Rt[0],Rt[1])),S.point(Pt[0],Pt[1]),Ge||S.lineEnd(),me=!1):Ge&&(S.lineStart(),S.point(Oe,He),me=!1)}B=Oe,j=He,J=Ge}return de}}var P0=$u();function qR(t,e){var n=e[0],r=e[1],i=[Hr(n),-Wr(n),0],a=0,c=0;P0.reset();for(var l=0,d=t.length;l=0?1:-1,te=de*me,$=te>Hn,Ae=D*J;if(P0.add(Gf(Ae*de*Hr(te),U*ae+Ae*Wr(te))),a+=$?me+de*xl:me,$^T>=n^B>=n){var Y=v_(jf(I),jf(ee));yv(Y);var oe=v_(i,Y);yv(oe);var Ye=($^me>=0?-1:1)*jc(oe[2]);(r>Ye||r===Ye&&(Y[0]||Y[1]))&&(c+=$^me>=0?1:-1)}}return(a<-wr||aHd&&(Hd=t),ex_&&(x_=e)}$u();function PC(t,e,n,r){return function(i,a){var c=e(a),l=i.invert(r[0],r[1]),d=IC(),w=e(d),S=!1,I,T,k,D={point:U,lineStart:ee,lineEnd:B,polygonStart:function(){D.point=j,D.lineStart=J,D.lineEnd=ae,T=[],I=[]},polygonEnd:function(){D.point=U,D.lineStart=ee,D.lineEnd=B,T=LC(T);var me=qR(I,l);T.length?(S||(a.polygonStart(),S=!0),CC(T,ZR,me,n,a)):me&&(S||(a.polygonStart(),S=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),S&&(a.polygonEnd(),S=!1),T=I=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function U(me,de){var te=i(me,de);t(me=te[0],de=te[1])&&a.point(me,de)}function q(me,de){var te=i(me,de);c.point(te[0],te[1])}function ee(){D.point=q,c.lineStart()}function B(){D.point=U,c.lineEnd()}function j(me,de){k.push([me,de]);var te=i(me,de);w.point(te[0],te[1])}function J(){w.lineStart(),k=[]}function ae(){j(k[0][0],k[0][1]),w.lineEnd();var me=w.clean(),de=d.result(),te,$=de.length,Ae,Y,oe;if(k.pop(),I.push(k),k=null,!!$){if(me&1){if(Y=de[0],(Ae=Y.length-1)>0){for(S||(a.polygonStart(),S=!0),a.lineStart(),te=0;te1&&me&2&&de.push(de.pop().concat(de.shift())),T.push(de.filter(HR))}}return D}}function HR(t){return t.length>1}function ZR(t,e){return((t=t.x)[0]<0?t[1]-pl-wr:pl-t[1])-((e=e.x)[0]<0?e[1]-pl-wr:pl-e[1])}const C2=PC(function(){return!0},XR,KR,[-Hn,-pl]);function XR(t){var e=NaN,n=NaN,r=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,c){var l=a>0?Hn:-Hn,d=Hi(a-e);Hi(d-Hn)0?pl:-pl),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(a,n),i=0):r!==l&&d>=Hn&&(Hi(e-r)wr?OR((Hr(e)*(a=Wr(r))*Hr(n)-Hr(r)*(i=Wr(e))*Hr(t))/(i*a*c)):(e+r)/2}function KR(t,e,n,r){var i;if(t==null)i=n*pl,r.point(-Hn,i),r.point(0,i),r.point(Hn,i),r.point(Hn,0),r.point(Hn,-i),r.point(0,-i),r.point(-Hn,-i),r.point(-Hn,0),r.point(-Hn,i);else if(Hi(t[0]-e[0])>wr){var a=t[0]0,i=Hi(n)>wr;function a(S,I,T,k){BR(k,t,e,T,S,I)}function c(S,I){return Wr(S)*Wr(I)>n}function l(S){var I,T,k,D,U;return{lineStart:function(){D=k=!1,U=1},point:function(q,ee){var B=[q,ee],j,J=c(q,ee),ae=r?J?0:w(q,ee):J?w(q+(q<0?Hn:-Hn),ee):0;if(!I&&(D=k=J)&&S.lineStart(),J!==k&&(j=d(I,B),(!j||Fg(I,j)||Fg(B,j))&&(B[0]+=wr,B[1]+=wr,J=c(B[0],B[1]))),J!==k)U=0,J?(S.lineStart(),j=d(B,I),S.point(j[0],j[1])):(j=d(I,B),S.point(j[0],j[1]),S.lineEnd()),I=j;else if(i&&I&&r^J){var me;!(ae&T)&&(me=d(B,I,!0))&&(U=0,r?(S.lineStart(),S.point(me[0][0],me[0][1]),S.point(me[1][0],me[1][1]),S.lineEnd()):(S.point(me[1][0],me[1][1]),S.lineEnd(),S.lineStart(),S.point(me[0][0],me[0][1])))}J&&(!I||!Fg(I,B))&&S.point(B[0],B[1]),I=B,k=J,T=ae},lineEnd:function(){k&&S.lineEnd(),I=null},clean:function(){return U|(D&&k)<<1}}}function d(S,I,T){var k=jf(S),D=jf(I),U=[1,0,0],q=v_(k,D),ee=xg(q,q),B=q[0],j=ee-B*B;if(!j)return!T&&S;var J=n*ee/j,ae=-n*B/j,me=v_(U,q),de=wg(U,J),te=wg(q,ae);L0(de,te);var $=me,Ae=xg(de,$),Y=xg($,$),oe=Ae*Ae-Y*(xg(de,de)-1);if(!(oe<0)){var Ye=ep(oe),ve=wg($,(-Ae-Ye)/Y);if(L0(ve,de),ve=_v(ve),!T)return ve;var Oe=S[0],He=I[0],Ge=S[1],Rt=I[1],Pt;He0^ve[1]<(Hi(ve[0]-Oe)Hn^(Oe<=ve[0]&&ve[0]<=He)){var un=wg($,(-Ae+Ye)/Y);return L0(un,de),[ve,_v(un)]}}}function w(S,I){var T=r?t:Hn-t,k=0;return S<-T?k|=1:S>T&&(k|=2),I<-T?k|=4:I>T&&(k|=8),k}return PC(c,l,a,r?[0,-t]:[-Hn,t-Hn])}function MC(t){return function(e){var n=new bv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function bv(){}bv.prototype={constructor:bv,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 AC(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),a!=null&&t.clipExtent(null),zR(n,t.stream(I2));var c=I2.result(),l=Math.min(r/(c[1][0]-c[0][0]),i/(c[1][1]-c[0][1])),d=+e[0][0]+(r-l*(c[1][0]+c[0][0]))/2,w=+e[0][1]+(i-l*(c[1][1]+c[0][1]))/2;return a!=null&&t.clipExtent(a),t.scale(l*150).translate([d,w])}function QR(t,e,n){return AC(t,[[0,0],e],n)}var T2=16,$R=Wr(30*Ks);function L2(t,e){return+e?tN(t,e):eN(t)}function eN(t){return MC({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function tN(t,e){function n(r,i,a,c,l,d,w,S,I,T,k,D,U,q){var ee=w-r,B=S-i,j=ee*ee+B*B;if(j>4*e&&U--){var J=c+T,ae=l+k,me=d+D,de=ep(J*J+ae*ae+me*me),te=jc(me/=de),$=Hi(Hi(me)-1)e||Hi((ee*Ye+B*ve)/j-.5)>.3||c*T+l*k+d*D<$R)&&(n(r,i,a,c,l,d,Y,oe,$,J/=de,ae/=de,me,U,q),q.point(Y,oe),n(Y,oe,$,J,ae,me,w,S,I,T,k,D,U,q))}}return function(r){var i,a,c,l,d,w,S,I,T,k,D,U,q={point:ee,lineStart:B,lineEnd:J,polygonStart:function(){r.polygonStart(),q.lineStart=ae},polygonEnd:function(){r.polygonEnd(),q.lineStart=B}};function ee(te,$){te=t(te,$),r.point(te[0],te[1])}function B(){I=NaN,q.point=j,r.lineStart()}function j(te,$){var Ae=jf([te,$]),Y=t(te,$);n(I,T,S,k,D,U,I=Y[0],T=Y[1],S=te,k=Ae[0],D=Ae[1],U=Ae[2],T2,r),r.point(I,T)}function J(){q.point=ee,r.lineEnd()}function ae(){B(),q.point=me,q.lineEnd=de}function me(te,$){j(i=te,$),a=I,c=T,l=k,d=D,w=U,q.point=j}function de(){n(I,T,S,k,D,U,a,c,i,l,d,w,T2,r),q.lineEnd=J,J()}return q}}var nN=MC({point:function(t,e){this.stream.point(t*Ks,e*Ks)}});function rN(t){return iN(function(){return t})()}function iN(t){var e,n=150,r=480,i=250,a,c,l=0,d=0,w=0,S=0,I=0,T,k,D=null,U=C2,q=null,ee,B,j,J=E2,ae=.5,me=L2(Y,ae),de,te;function $(ve){return ve=k(ve[0]*Ks,ve[1]*Ks),[ve[0]*n+a,c-ve[1]*n]}function Ae(ve){return ve=k.invert((ve[0]-a)/n,(c-ve[1])/n),ve&&[ve[0]*Mu,ve[1]*Mu]}function Y(ve,Oe){return ve=e(ve,Oe),[ve[0]*n+a,c-ve[1]*n]}$.stream=function(ve){return de&&te===ve?de:de=nN(U(T,me(J(te=ve))))},$.clipAngle=function(ve){return arguments.length?(U=+ve?JR(D=ve*Ks,6*Ks):(D=null,C2),Ye()):D*Mu},$.clipExtent=function(ve){return arguments.length?(J=ve==null?(q=ee=B=j=null,E2):jR(q=+ve[0][0],ee=+ve[0][1],B=+ve[1][0],j=+ve[1][1]),Ye()):q==null?null:[[q,ee],[B,j]]},$.scale=function(ve){return arguments.length?(n=+ve,oe()):n},$.translate=function(ve){return arguments.length?(r=+ve[0],i=+ve[1],oe()):[r,i]},$.center=function(ve){return arguments.length?(l=ve[0]%360*Ks,d=ve[1]%360*Ks,oe()):[l*Mu,d*Mu]},$.rotate=function(ve){return arguments.length?(w=ve[0]%360*Ks,S=ve[1]%360*Ks,I=ve.length>2?ve[2]%360*Ks:0,oe()):[w*Mu,S*Mu,I*Mu]},$.precision=function(ve){return arguments.length?(me=L2(Y,ae=ve*ve),Ye()):ep(ae)},$.fitExtent=function(ve,Oe){return AC($,ve,Oe)},$.fitSize=function(ve,Oe){return QR($,ve,Oe)};function oe(){k=EC(T=FR(w,S,I),e);var ve=e(l,d);return a=r-ve[0]*n,c=i+ve[1]*n,Ye()}function Ye(){return de=te=null,$}return function(){return e=t.apply(this,arguments),$.invert=e.invert&&Ae,oe()}}function kC(t){return function(e,n){var r=Wr(e),i=Wr(n),a=t(r*i);return[a*i*Hr(e),a*Hr(n)]}}function DC(t){return function(e,n){var r=ep(e*e+n*n),i=t(r),a=Hr(i),c=Wr(i);return[Gf(e*a,r*c),jc(r&&n*a/r)]}}var oN=kC(function(t){return ep(2/(1+t))});oN.invert=DC(function(t){return 2*jc(t/2)});var RC=kC(function(t){return(t=SC(t))&&t/Hr(t)});RC.invert=DC(function(t){return t});function sN(){return rN(RC).scale(79.4188).clipAngle(180-.001)}function P2(t,e){return[t,e]}P2.invert=P2;function aN(t,e,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var a=[];switch(t.type){case"GeometryCollection":return YI(t,function(c){var l=Bg(c,e,r,i);l&&a.push(l)}),pv(a);case"FeatureCollection":return u2(t,function(c){var l=Bg(c,e,r,i);l&&u2(l,function(d){d&&a.push(d)})}),pv(a)}return Bg(t,e,r,i)}function Bg(t,e,n,r){var i=t.properties||{},a=t.type==="Feature"?t.geometry:t;if(a.type==="GeometryCollection"){var c=[];return YI(t,function(U){var q=Bg(U,e,n,r);q&&c.push(q)}),pv(c)}var l=lN(a),d={type:a.type,coordinates:OC(a.coordinates,l)},w=new c1,S=w.read(d),I=mR(gR(e,n),"meters"),T=Si.bufferOp(S,I,r),k=new oC;if(T=k.write(T),!NC(T.coordinates)){var D={type:T.type,coordinates:zC(T.coordinates,l)};return k_(D,i)}}function NC(t){return Array.isArray(t[0])?NC(t[0]):isNaN(t[0])}function OC(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return OC(n,e)})}function zC(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return zC(n,e)})}function lN(t){var e=yR(t).geometry.coordinates,n=[-e[0],-e[1]];return sN().rotate(n).scale(jo)}function uN(t,e){var n=h_(t),r=h_(e),i=t.properties||{},a=qI.difference(n.coordinates,r.coordinates);return a.length===0?null:a.length===1?HI(a[0],i):ZI(a,i)}function M2(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 A2(t,e){const n=uN({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},t);if(!n)return;n.properties={isMask:"y"};const r=aN(t,0);if(r.geometry.type==="Polygon")for(const i of r.geometry.coordinates)M2(i);else for(const i of r.geometry.coordinates)for(const a of i)M2(a);e({type:"FeatureCollection",features:[r,n]})}let k2={type:"FeatureCollection",features:[]};function cN(t,e,n=!0,r=!0,i={},a={},c={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let l,d=[],w,S;function I(){(c!=null&&c.fill||c!=null&&c.line)&&t.addSource("full-geom",{type:"geojson",data:k2}),c!=null&&c.fill&&t.addLayer({...c==null?void 0:c.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),c!=null&&c.line&&t.addLayer({...c==null?void 0:c.line,id:"full-geom-line",type:"line",source:"full-geom"})}t.loaded()?I():t.once("load",()=>{I()});const T=D=>{l==null||l({type:"mapClick",coordinates:[D.lngLat.lng,D.lngLat.lat]})};function k(D=!1){if(!e)throw new Error;const U=document.createElement("div");return D&&U.classList.add("marker-interactive"),new BD({props:{displayIn:"maplibre"},target:U}),new e.Marker({element:U,offset:[1,-13]})}return{setEventHandler(D){D?(l=D,t.on("click",T)):(l=void 0,t.off("click",T))},flyTo(D,U){t.flyTo({center:D,zoom:U,...i})},fitBounds(D,U,q){t.fitBounds([[D[0],D[1]],[D[2],D[3]]],{padding:U,maxZoom:q,...a})},indicateReverse(D){t.getCanvasContainer().style.cursor=D?"crosshair":""},setReverseMarker(D){!e||!n||(S?D?S.setLngLat(D):(S.remove(),S=void 0):D&&(S=(typeof n=="object"?new e.Marker(n):k()).setLngLat(D).addTo(t),S.getElement().classList.add("marker-reverse")))},setMarkers(D,U){if(!n)return;function q(ee){var B;(B=t.getSource("full-geom"))==null||B.setData(ee)}for(const ee of d)ee.remove();if(d.length=0,q(k2),!!e){if(U){let ee=!1;if(U.geometry.type==="GeometryCollection"){const B=U.geometry.geometries.filter(j=>j.type==="Polygon"||j.type==="MultiPolygon");if(B.length>0){let j=B.pop();for(const J of B)j=_R(j,J);A2({...U,geometry:j},q),ee=!0}else{const j=U.geometry.geometries.filter(J=>J.type==="LineString"||J.type==="MultiLineString");j.length>0&&(q({...U,geometry:{type:"GeometryCollection",geometries:j}}),ee=!0)}}if(!ee){if(U.geometry.type==="Polygon"||U.geometry.type==="MultiPolygon")A2(U,q);else if(U.geometry.type==="LineString"||U.geometry.type==="MultiLineString"){q(U);return}}n&&d.push((typeof n=="object"?new e.Marker(n):k()).setLngLat(U.center).addTo(t))}if(r)for(const ee of D??[]){if(ee===U)continue;const B=(typeof r=="object"?new e.Marker(r):k(!0)).setLngLat(ee.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(ee.place_type[0]==="reverse"?ee.place_name:ee.place_name.replace(/,.*/,""))).addTo(t),j=B.getElement();j.addEventListener("click",J=>{J.stopPropagation(),l==null||l({type:"markerClick",id:ee.id})}),j.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:ee.id}),B.togglePopup()}),j.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:ee.id}),B.togglePopup()}),d.push(B)}}},setSelectedMarker(D){w&&w.getElement().classList.toggle("marker-selected",!1),w=D>-1?d[D]:void 0,w==null||w.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const D=t.getCenter();return[t.getZoom(),D.lng,D.lat]}}}function hN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("path"),Ve(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"),Ve(e,"viewBox","0 0 14 14"),Ve(e,"width","13"),Ve(e,"height","13"),Ve(e,"class","svelte-en2qvf")},m(r,i){Me(r,e,i),xe(e,n)},p:et,i:et,o:et,d(r){r&&Le(e)}}}class FC extends Jt{constructor(e){super(),Kt(this,e,null,hN,qt,{})}}function fN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("path"),Ve(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"),Ve(e,"viewBox","0 0 30 30"),Ve(e,"fill","none"),Ve(e,"xmlns","http://www.w3.org/2000/svg"),Ve(e,"class","svelte-d2loi5")},m(r,i){Me(r,e,i),xe(e,n)},p:et,i:et,o:et,d(r){r&&Le(e)}}}class BC extends Jt{constructor(e){super(),Kt(this,e,null,fN,qt,{})}}function pN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"area.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"area.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function dN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"reverse.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"reverse.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function mN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"poi.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"poi.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function gN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"postal_code.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"postal_code.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function _N(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"street.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"street.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function yN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"road.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"road.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function vN(t){let e,n;return{c(){e=ke("img"),To(e.src,n=t[3]+"housenumber.svg")||Ve(e,"src",n),Ve(e,"alt",t[6]),Ve(e,"class","svelte-ltkwvy")},m(r,i){Me(r,e,i)},p(r,i){i&8&&!To(e.src,n=r[3]+"housenumber.svg")&&Ve(e,"src",n),i&64&&Ve(e,"alt",r[6])},d(r){r&&Le(e)}}}function bN(t){let e,n,r,i;return{c(){e=ke("img"),To(e.src,n=t[5])||Ve(e,"src",n),Ve(e,"alt",t[4]),Ve(e,"class","svelte-ltkwvy")},m(a,c){Me(a,e,c),r||(i=Gt(e,"error",t[14]),r=!0)},p(a,c){c&32&&!To(e.src,n=a[5])&&Ve(e,"src",n),c&16&&Ve(e,"alt",a[4])},d(a){a&&Le(e),r=!1,i()}}}function D2(t){let e,n;return{c(){e=ke("span"),n=vt(t[6]),Ve(e,"class","secondary svelte-ltkwvy")},m(r,i){Me(r,e,i),xe(e,n)},p(r,i){i&64&&An(n,r[6])},d(r){r&&Le(e)}}}function xN(t){var de,te;let e,n,r,i,a,c,l,d,w=(t[7]?t[0].place_name:t[0].place_name.replace(/,.*/,""))+"",S,I,T=t[2]==="always"||t[2]&&!t[0].address&&((de=t[0].properties)==null?void 0:de.kind)!=="road"&&((te=t[0].properties)==null?void 0:te.kind)!=="road_relation"&&!t[0].id.startsWith("address.")&&!t[0].id.startsWith("postal_code.")&&(!t[0].id.startsWith("poi.")||!t[5])&&!t[7],k,D,U=(t[7]?"":t[0].place_name.replace(/[^,]*,?\s*/,""))+"",q,ee,B;function j($,Ae){var Y,oe;return Ae&1&&(n=null),Ae&1&&(r=null),Ae&1&&(i=null),$[5]?bN:$[0].address?vN:((Y=$[0].properties)==null?void 0:Y.kind)==="road"||((oe=$[0].properties)==null?void 0:oe.kind)==="road_relation"?yN:(n==null&&(n=!!$[0].id.startsWith("address.")),n?_N:(r==null&&(r=!!$[0].id.startsWith("postal_code.")),r?gN:(i==null&&(i=!!$[0].id.startsWith("poi.")),i?mN:$[7]?dN:pN)))}let J=j(t,-1),ae=J(t),me=T&&D2(t);return{c(){e=ke("li"),ae.c(),a=nt(),c=ke("span"),l=ke("span"),d=ke("span"),S=vt(w),I=nt(),me&&me.c(),k=nt(),D=ke("span"),q=vt(U),Ve(d,"class","primary svelte-ltkwvy"),Ve(l,"class","svelte-ltkwvy"),Ve(D,"class","line2 svelte-ltkwvy"),Ve(c,"class","texts svelte-ltkwvy"),Ve(e,"tabindex","0"),Ve(e,"data-selected",t[1]),Ve(e,"class","svelte-ltkwvy"),hl(e,"selected",t[1])},m($,Ae){Me($,e,Ae),ae.m(e,null),xe(e,a),xe(e,c),xe(c,l),xe(l,d),xe(d,S),xe(l,I),me&&me.m(l,null),xe(c,k),xe(c,D),xe(D,q),ee||(B=[Gt(e,"mouseenter",t[12]),Gt(e,"focus",t[13])],ee=!0)},p($,[Ae]){var Y,oe;J===(J=j($,Ae))&&ae?ae.p($,Ae):(ae.d(1),ae=J($),ae&&(ae.c(),ae.m(e,a))),Ae&1&&w!==(w=($[7]?$[0].place_name:$[0].place_name.replace(/,.*/,""))+"")&&An(S,w),Ae&37&&(T=$[2]==="always"||$[2]&&!$[0].address&&((Y=$[0].properties)==null?void 0:Y.kind)!=="road"&&((oe=$[0].properties)==null?void 0:oe.kind)!=="road_relation"&&!$[0].id.startsWith("address.")&&!$[0].id.startsWith("postal_code.")&&(!$[0].id.startsWith("poi.")||!$[5])&&!$[7]),T?me?me.p($,Ae):(me=D2($),me.c(),me.m(l,null)):me&&(me.d(1),me=null),Ae&1&&U!==(U=($[7]?"":$[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&An(q,U),Ae&2&&Ve(e,"data-selected",$[1]),Ae&2&&hl(e,"selected",$[1])},i:et,o:et,d($){$&&Le(e),ae.d(),me&&me.d(),ee=!1,Mi(B)}}}function wN(t,e,n){var j;let r,i,{feature:a}=e,{selected:c=!1}=e,{showPlaceType:l}=e,{missingIconsCache:d}=e,{iconsBaseUrl:w}=e;const S=(j=a.properties)==null?void 0:j.categories;let I,T,k=0,D=a.place_type[0]==="reverse";function U(J){T&&d.add(T),n(10,k++,k)}function q(J){dn.call(this,t,J)}function ee(J){dn.call(this,t,J)}const B=J=>U(J.currentTarget);return t.$$set=J=>{"feature"in J&&n(0,a=J.feature),"selected"in J&&n(1,c=J.selected),"showPlaceType"in J&&n(2,l=J.showPlaceType),"missingIconsCache"in J&&n(9,d=J.missingIconsCache),"iconsBaseUrl"in J&&n(3,w=J.iconsBaseUrl)},t.$$.update=()=>{var J,ae,me,de;if(t.$$.dirty&3640)do n(11,r--,r),n(4,I=S==null?void 0:S[r]),n(5,T=I?w+I.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!T||d.has(T)));t.$$.dirty&1&&n(6,i=a.id.startsWith("poi.")?(ae=(J=a.properties)==null?void 0:J.categories)==null?void 0:ae.join(", "):((de=(me=a.properties)==null?void 0:me.place_type_name)==null?void 0:de[0])??a.place_type[0])},n(11,r=(S==null?void 0:S.length)??0),[a,c,l,w,I,T,i,D,U,d,k,r,q,ee,B]}class SN extends Jt{constructor(e){super(),Kt(this,e,wN,xN,qt,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function EN(t){let e;return{c(){e=ke("div"),e.innerHTML='',Ve(e,"class","svelte-7cmwmc")},m(n,r){Me(n,e,r)},p:et,i:et,o:et,d(n){n&&Le(e)}}}class IN extends Jt{constructor(e){super(),Kt(this,e,null,EN,qt,{})}}function CN(t){let e,n;return{c(){e=Yl("svg"),n=Yl("path"),Ve(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"),Ve(e,"viewBox","0 0 60.006 21.412"),Ve(e,"width","14"),Ve(e,"height","20"),Ve(e,"class","svelte-en2qvf")},m(r,i){Me(r,e,i),xe(e,n)},p:et,i:et,o:et,d(r){r&&Le(e)}}}class TN extends Jt{constructor(e){super(),Kt(this,e,null,CN,qt,{})}}function LN(t){let e,n,r;return{c(){e=Yl("svg"),n=Yl("circle"),r=Yl("path"),Ve(n,"cx","4.789"),Ve(n,"cy","4.787"),Ve(n,"r","3.85"),Ei(n,"stroke-width","1.875"),Ei(n,"fill","none"),Ve(r,"d","M12.063 12.063 7.635 7.635"),Ei(r,"stroke-width","1.875"),Ei(r,"stroke-linecap","round"),Ve(e,"xmlns","http://www.w3.org/2000/svg"),Ve(e,"width","13"),Ve(e,"height","13"),Ve(e,"viewBox","0 0 13 13"),Ve(e,"class","svelte-1bpbt60")},m(i,a){Me(i,e,a),xe(e,n),xe(e,r)},p:et,i:et,o:et,d(i){i&&Le(e)}}}class PN extends Jt{constructor(e){super(),Kt(this,e,null,LN,qt,{})}}function MN(t,e,n){const r=e[1],i=e[0],a=r-i;return t===r&&n?t:((t-i)%a+a)%a+i}function R2(t){const e=[...t];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!cd.coords)break e;return cd.coords}let a;try{return a=await new Promise((c,l)=>{n.signal.addEventListener("abort",()=>{l(Error("aborted"))}),navigator.geolocation.getCurrentPosition(d=>{c([d.coords.longitude,d.coords.latitude].map(w=>w.toFixed(6)).join(","))},d=>{l(d)},i)}),a}catch{}finally{i.cachedLocationExpiry&&(cd={time:Date.now(),coords:a})}if(n.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}const N2=/(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,O2=/(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,z2=/(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,F2=/(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 kN(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){if(t=="DD")return this.decimalCoordinates;const e=this.decimalCoordinates.split(",").map(c=>Number(c.trim()));let n=B2(e[0],t),r=B2(e[1],t);n.endsWith('.0"')&&r.endsWith('.0"')&&(n=n.replace(/\.0"$/,'"'),r=r.replace(/\.0"$/,'"'));const i=e[0]>=0?" N":" S",a=e[1]>=0?" E":" W";return`${n+i}, ${r+a}`}else throw new Error("no decimal coordinates to convert")}function B2(t,e){const n=Math.abs(t),r=Math.floor(n),i=(n-r)*60;if(e=="DM"){let l=DN(i,3).toFixed(3).padStart(6,"0");return`${r}° ${l}'`}let a=Math.floor(i),c=((i-a)*60).toFixed(1).padStart(4,"0");return a=a.toString().padStart(2,"0"),`${r}° ${a}' ${c}"`}function DN(t,e){const n=Math.pow(10,e);return Math.round((t+Number.EPSILON)*n)/n}function v1(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let n=null,r=null,i="",a="",c=[],l=!1;if(N2.test(t))if(c=N2.exec(t),l=Ig(c),l){if(n=c[2],r=c[6],n.includes(",")&&(n=n.replace(",",".")),r.includes(",")&&(r=r.replace(",",".")),Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");if(Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");c[1]?(i=c[1],a=c[5]):c[4]&&(i=c[4],a=c[8])}else throw new Error("invalid decimal coordinate format");else if(O2.test(t))if(c=O2.exec(t),l=Ig(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6].replace(",",".")/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[9])),c[11]&&(r+=c[11]/60),c[13]&&(r+=c[13].replace(",",".")/3600),parseInt(c[9])<0&&(r=-1*r),c[1]?(i=c[1],a=c[8]):c[7]&&(i=c[7],a=c[14]);else throw new Error("invalid DMS coordinates format");else if(z2.test(t))if(c=z2.exec(t),l=Ig(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid DMS coordinates format");else if(F2.test(t))if(c=F2.exec(t),l=Ig(c),l)n=Math.abs(parseInt(c[2])),c[4]&&(n+=c[4]/60),c[6]&&(n+=c[6]/3600),parseInt(c[2])<0&&(n=-1*n),r=Math.abs(parseInt(c[10])),c[12]&&(r+=c[12]/60),c[14]&&(r+=c[14]/3600),parseInt(c[10])<0&&(r=-1*r),c[1]?(i=c[1],a=c[9]):c[8]&&(i=c[8],a=c[16]);else throw new Error("invalid coordinates format");if(l){if(Math.abs(r)>=180)throw new Error("invalid longitude value");if(Math.abs(n)>=90)throw new Error("invalid latitude value");if((i||a)&&(!i||!a))throw new Error("invalid coordinates format");if(i&&i==a)throw new Error("invalid coordinates format");let d=/S|SOUTH/i;d.test(i)&&n>0&&(n=-1*n),d=/W|WEST/i,d.test(a)&&r>0&&(r=-1*r);const w=c[0].trim();let S,I;const T=/[,/;\u0020]/g,k=w.match(T);if(k==null){const q=Math.floor(t.length/2);S=w.substring(0,q).trim(),I=w.substring(q).trim()}else{let q;k.length%2==1?q=Math.floor(k.length/2):q=k.length/2-1;let ee=0;if(q==0)ee=w.indexOf(k[0]),S=w.substring(0,ee).trim(),I=w.substring(ee+1).trim();else{let B=0,j=0;for(;B<=q;)ee=w.indexOf(k[B],j),j=ee+1,B++;S=w.substring(0,ee).trim(),I=w.substring(ee+1).trim()}}const D=S.split(".");if(D.length==2&&D[1]==0&&D[1].length!=2)throw new Error("invalid coordinates format");const U=I.split(".");if(U.length==2&&U[1]==0&&U[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(I))throw new Error("degree only coordinate/s provided");return isNaN(n)&&n.includes(",")&&(n=n.replace(",",".")),n=Number(Number(n).toFixed(e)),isNaN(r)&&r.includes(",")&&(r=r.replace(",",".")),r=Number(Number(r).toFixed(e)),Object.freeze({verbatimCoordinates:w,verbatimLatitude:S,verbatimLongitude:I,decimalLatitude:n,decimalLongitude:r,decimalCoordinates:`${n},${r}`,closeEnough:RN,toCoordinateFormat:kN})}else throw new Error("coordinates pattern match failed")}function Ig(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const n=/^[-+]?\d+([\.,]\d+)?$/,r=/[eastsouthnorthwest]+/i,i=e.length/2;for(let a=0;a{e.decimalLatitude?t.push(e):t.push({...e,...zN})}),[...t,...FN,...BN]}const UN=VN();v1.formats=UN.map(t=>t.verbatimCoordinates);const GN=v1;function U2(t,e,n){const r=t.slice();return r[81]=e[n],r[83]=n,r}function G2(t){let e,n;return e=new IN({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function j2(t){let e,n,r,i,a;return n=new TN({}),{c(){e=ke("button"),ot(n.$$.fragment),Ve(e,"type","button"),Ve(e,"title",t[9]),Ve(e,"class","svelte-zh3kmv"),hl(e,"active",t[0])},m(c,l){Me(c,e,l),rt(n,e,null),r=!0,i||(a=Gt(e,"click",t[67]),i=!0)},p(c,l){(!r||l[0]&512)&&Ve(e,"title",c[9]),(!r||l[0]&1)&&hl(e,"active",c[0])},i(c){r||(ye(n.$$.fragment,c),r=!0)},o(c){Se(n.$$.fragment,c),r=!1},d(c){c&&Le(e),it(n),i=!1,a()}}}function jN(t){let e,n=[],r=new Map,i,a,c,l=zr(t[14]);const d=w=>w[81].id+(w[81].address?","+w[81].address:"");for(let w=0;w{de=null}),Pn()),(!j||Oe[0]&2)&&hl(w,"displayable",ve[1]!==""),ve[5]===!0?te?(te.p(ve,Oe),Oe[0]&32&&ye(te,1)):(te=j2(ve),te.c(),ye(te,1),te.m(r,D)):te&&(Ln(),Se(te,1,1,()=>{te=null}),Pn()),Ae&&Ae.p&&(!j||Oe[1]&134217728)&&Kr(Ae,$,ve,ve[58],j?Yr($,ve[58],Oe,null):Jr(ve[58]),null);let He=q;q=Ye(ve),q===He?~q&&oe[q].p(ve,Oe):(ee&&(Ln(),Se(oe[He],1,1,()=>{oe[He]=null}),Pn()),~q?(ee=oe[q],ee?ee.p(ve,Oe):(ee=oe[q]=Y[q](ve),ee.c()),ye(ee,1),ee.m(n,null)):ee=null),(!j||Oe[0]&4&&B!==(B=Vg(ve[2])+" svelte-zh3kmv"))&&Ve(n,"class",B),(!j||Oe[0]&22)&&hl(n,"can-collapse",ve[4]&&ve[1]==="")},i(ve){j||(ye(me),ye(a.$$.fragment,ve),ye(I.$$.fragment,ve),ye(de),ye(te),ye(Ae,ve),ye(ee),j=!0)},o(ve){Se(me),Se(a.$$.fragment,ve),Se(I.$$.fragment,ve),Se(de),Se(te),Se(Ae,ve),Se(ee),j=!1},d(ve){ve&&(Le(e),Le(n)),it(a),t[61](null),it(I),de&&de.d(),te&&te.d(),Ae&&Ae.d(ve),~q&&oe[q].d(),J=!1,Mi(ae)}}}function XN(t,e,n){let r,{$$slots:i={},$$scope:a}=e,{class:c=void 0}=e,{apiKey:l}=e,{bbox:d=void 0}=e,{clearButtonTitle:w="clear"}=e,{clearOnBlur:S=!1}=e,{collapsed:I=!1}=e,{country:T=void 0}=e,{debounceSearch:k=200}=e,{enableReverse:D=!1}=e,{errorMessage:U="Something went wrong…"}=e,{filter:q=()=>!0}=e,{flyTo:ee=!0}=e,{fuzzyMatch:B=!0}=e,{language:j=void 0}=e,{limit:J=void 0}=e,{mapController:ae=void 0}=e,{minLength:me=2}=e,{noResultsMessage:de="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:te="Search"}=e,{proximity:$=[{type:"server-geolocation"}]}=e,{reverseActive:Ae=D==="always"}=e,{reverseButtonTitle:Y="toggle reverse geocoding"}=e,{searchValue:oe=""}=e,{showFullGeometry:Ye=!0}=e,{showPlaceType:ve="ifNeeded"}=e,{showResultsWhileTyping:Oe=!0}=e,{selectFirst:He=!0}=e,{flyToSelected:Ge=!1}=e,{markerOnSelected:Rt=!0}=e,{types:Pt=void 0}=e,{excludeTypes:Zt=!1}=e,{zoom:Xt=16}=e,{maxZoom:kt=18}=e,{apiUrl:un="https://api.maptiler.com/geocoding"}=e,{fetchParameters:Fn={}}=e,{iconsBaseUrl:bn="https://cdn.maptiler.com/maptiler-geocoding-control/v1.2.2/icons/"}=e,{adjustUrlQuery:mn=Q=>{}}=e;function Bn(){ze.focus()}function ir(){ze.blur()}function $r(Q,Ie=!0){n(1,oe=Q),Ie?(n(15,en=-1),Cl()):(ei(),setTimeout(()=>{ze.focus(),ze.select()}))}function _r(){n(14,ie=void 0),n(55,_t=void 0),n(15,en=-1)}function cr(){n(54,Ce=[]),n(55,_t=void 0)}let or=!1,ie,Ce,_t,xn="",ze,en=-1,Dr,fn=[],tr,Do,gs,Bs;const Ha=new Set,Ai=Yu();us(()=>{ae&&(ae.setEventHandler(void 0),ae.indicateReverse(!1),ae.setSelectedMarker(-1),ae.setMarkers(void 0,void 0))});function Cl(Q){if(Do&&(clearTimeout(Do),Do=void 0),en>-1&&ie)n(55,_t=ie[en]),n(1,oe=_t.place_type[0]==="reverse"?_t.place_name:_t.place_name.replace(/,.*/,"")),n(18,Dr=void 0),n(54,Ce=void 0),n(15,en=-1);else if(oe){const Ie=Q||!_s(oe);at(oe,{exact:!0}).then(()=>{n(54,Ce=ie),n(55,_t=void 0),Ie&&Qo()}).catch(_e=>n(18,Dr=_e))}}function _s(Q){try{return GN(Q,6)}catch{return!1}}async function at(Q,{byId:Ie=!1,exact:_e=!1}={}){n(18,Dr=void 0),tr==null||tr.abort();const De=new AbortController;n(19,tr=De);try{const je=_s(Q),Ze=new URLSearchParams;if(j!==void 0&&Ze.set("language",Array.isArray(j)?j.join(","):j??""),Pt&&Ze.set("types",Pt.join(",")),Zt&&Ze.set("excludeTypes",String(Zt)),d&&Ze.set("bbox",d.map(Yt=>Yt.toFixed(6)).join(",")),T&&Ze.set("country",Array.isArray(T)?T.join(","):T),!Ie&&!je){const Yt=await AN(ae,$,De);Yt&&Ze.set("proximity",Yt),(_e||!Oe)&&Ze.set("autocomplete","false"),Ze.set("fuzzyMatch",String(B))}J!==void 0&&(!je||(Pt==null?void 0:Pt.length)===1)&&Ze.set("limit",String(J)),Ze.set("key",l),mn(Ze);const Ke=un+"/"+encodeURIComponent(je?je.decimalLongitude+","+je.decimalLatitude:Q)+".json?"+Ze.toString();if(Ke===xn){Ie?(n(14,ie=void 0),n(55,_t=fn[0])):n(14,ie=fn);return}xn=Ke;const Mt=await fetch(Ke,{signal:De.signal,...Fn});if(!Mt.ok)throw new Error(await Mt.text());const Nt=await Mt.json();Ai("response",{url:Ke,featureCollection:Nt}),Ie?(n(14,ie=void 0),n(55,_t=Nt.features[0]),fn=[_t]):(n(14,ie=Nt.features.filter(q)),je&&ie.unshift({type:"Feature",properties:{},id:"reverse_"+je.decimalLongitude+"_"+je.decimalLatitude,text:je.decimalLatitude+", "+je.decimalLongitude,place_name:je.decimalLatitude+", "+je.decimalLongitude,place_type:["reverse"],center:[je.decimalLongitude,je.decimalLatitude],bbox:[je.decimalLongitude,je.decimalLatitude,je.decimalLongitude,je.decimalLatitude],geometry:{type:"Point",coordinates:[je.decimalLongitude,je.decimalLatitude]}}),fn=ie,je&&ze.focus())}catch(je){if(je&&typeof je=="object"&&"name"in je&&je.name==="AbortError")return;throw je}finally{De===tr&&n(19,tr=void 0)}}function Qo(){var _e;if(!(Ce!=null&&Ce.length)||!ee)return;const Q=[180,90,-180,-90],Ie=!Ce.some(De=>!De.matching_text);for(const De of Ce)if(Ie||!De.matching_text)for(const je of[0,1,2,3])Q[je]=Math[je<2?"min":"max"](Q[je],((_e=De.bbox)==null?void 0:_e[je])??De.center[je%2]);ae&&Ce.length>0&&(_t&&Q[0]===Q[2]&&Q[1]===Q[3]?ae.flyTo(_t.center,Xt):ae.fitBounds(R2(Q),50,kt))}function eo(Q){n(0,Ae=D==="always"),n(14,ie=void 0),n(55,_t=void 0),n(15,en=-1),$r(Q[1].toFixed(6)+", "+MN(Q[0],[-180,180],!0).toFixed(6),!1)}function Tl(Q){if(!ie)return;let Ie=Q.key==="ArrowDown"?1:Q.key==="ArrowUp"?-1:0;Ie&&(en===(He?0:-1)&&Ie===-1&&n(15,en=ie.length),n(15,en+=Ie),en>=ie.length&&n(15,en=-1),en<0&&He&&n(15,en=0),Q.preventDefault())}function ei(Q=!0){if(n(18,Dr=void 0),Oe){if(Do&&clearTimeout(Do),oe.length{at(Ie).catch(_e=>n(18,Dr=_e))},Q?k:0)}else n(14,ie=void 0),n(18,Dr=void 0)}function ft(Q){n(55,_t=Q),n(1,oe=Q.place_name),n(15,en=-1)}const on=()=>ze.focus();function nn(Q){Gn[Q?"unshift":"push"](()=>{ze=Q,n(17,ze)})}function Rr(){oe=this.value,n(1,oe),n(13,or),n(27,S)}const $o=()=>n(13,or=!0),tn=()=>n(13,or=!1),ba=()=>ei(),Vr=()=>{n(1,oe=""),ze.focus()},he=()=>n(0,Ae=!Ae),V=()=>n(18,Dr=void 0),W=Q=>n(15,en=Q),K=Q=>ft(Q),se=()=>{He||n(15,en=-1)},Ee=()=>{};return t.$$set=Q=>{"class"in Q&&n(2,c=Q.class),"apiKey"in Q&&n(25,l=Q.apiKey),"bbox"in Q&&n(26,d=Q.bbox),"clearButtonTitle"in Q&&n(3,w=Q.clearButtonTitle),"clearOnBlur"in Q&&n(27,S=Q.clearOnBlur),"collapsed"in Q&&n(4,I=Q.collapsed),"country"in Q&&n(28,T=Q.country),"debounceSearch"in Q&&n(29,k=Q.debounceSearch),"enableReverse"in Q&&n(5,D=Q.enableReverse),"errorMessage"in Q&&n(6,U=Q.errorMessage),"filter"in Q&&n(30,q=Q.filter),"flyTo"in Q&&n(31,ee=Q.flyTo),"fuzzyMatch"in Q&&n(32,B=Q.fuzzyMatch),"language"in Q&&n(33,j=Q.language),"limit"in Q&&n(34,J=Q.limit),"mapController"in Q&&n(35,ae=Q.mapController),"minLength"in Q&&n(36,me=Q.minLength),"noResultsMessage"in Q&&n(7,de=Q.noResultsMessage),"placeholder"in Q&&n(8,te=Q.placeholder),"proximity"in Q&&n(37,$=Q.proximity),"reverseActive"in Q&&n(0,Ae=Q.reverseActive),"reverseButtonTitle"in Q&&n(9,Y=Q.reverseButtonTitle),"searchValue"in Q&&n(1,oe=Q.searchValue),"showFullGeometry"in Q&&n(38,Ye=Q.showFullGeometry),"showPlaceType"in Q&&n(10,ve=Q.showPlaceType),"showResultsWhileTyping"in Q&&n(39,Oe=Q.showResultsWhileTyping),"selectFirst"in Q&&n(11,He=Q.selectFirst),"flyToSelected"in Q&&n(40,Ge=Q.flyToSelected),"markerOnSelected"in Q&&n(41,Rt=Q.markerOnSelected),"types"in Q&&n(42,Pt=Q.types),"excludeTypes"in Q&&n(43,Zt=Q.excludeTypes),"zoom"in Q&&n(44,Xt=Q.zoom),"maxZoom"in Q&&n(45,kt=Q.maxZoom),"apiUrl"in Q&&n(46,un=Q.apiUrl),"fetchParameters"in Q&&n(47,Fn=Q.fetchParameters),"iconsBaseUrl"in Q&&n(12,bn=Q.iconsBaseUrl),"adjustUrlQuery"in Q&&n(48,mn=Q.adjustUrlQuery),"$$scope"in Q&&n(58,a=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&134225920&&setTimeout(()=>{n(16,gs=or),S&&!or&&n(1,oe="")}),t.$$.dirty[0]&16386|t.$$.dirty[1]&32&&oe.lengthn(18,Dr=Q)),t.$$.dirty[1]&50356241&&(ae&&_t&&_t.id!==Bs&&ee&&(!_t.bbox||_t.bbox[0]===_t.bbox[2]&&_t.bbox[1]===_t.bbox[3]?ae.flyTo(_t.center,_t.id.startsWith("poi.")||_t.id.startsWith("address.")?kt:Xt):ae.fitBounds(R2(_t.bbox),50,kt),n(14,ie=void 0),n(54,Ce=void 0),n(15,en=-1)),n(56,Bs=_t==null?void 0:_t.id)),t.$$.dirty[0]&18432&&He&&ie!=null&&ie.length&&n(15,en=0),t.$$.dirty[0]&2050&&(He||n(15,en=-1)),t.$$.dirty[0]&16384|t.$$.dirty[1]&8388608&&Ce!==ie&&n(54,Ce=void 0),t.$$.dirty[0]&81921|t.$$.dirty[1]&8388624&&ae&&ae.setEventHandler(Q=>{switch(Q.type){case"mapClick":Ae&&eo(Q.coordinates);break;case"markerClick":{const Ie=ie==null?void 0:ie.find(_e=>_e.id===Q.id);Ie&&ft(Ie)}break;case"markerMouseEnter":Ce&&n(15,en=gs?(ie==null?void 0:ie.findIndex(Ie=>Ie.id===Q.id))??-1:-1);break;case"markerMouseLeave":Ce&&n(15,en=-1);break}}),t.$$.dirty[0]&49152&&n(57,r=ie==null?void 0:ie[en]),t.$$.dirty[1]&67133969&&ae&&r&&ee&&Ge&&ae.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?kt:Xt),t.$$.dirty[1]&1040&&(Rt||ae==null||ae.setMarkers(void 0,void 0)),t.$$.dirty[1]&75498512&&ae&&Rt&&!Ce&&(ae.setMarkers(r?[r]:void 0,void 0),ae.setSelectedMarker(r?0:-1)),t.$$.dirty[1]&25165840&&ae&&ae.setMarkers(Ce,_t),t.$$.dirty[0]&32768|t.$$.dirty[1]&8388624&&Ce&&ae&&ae.setSelectedMarker(en),t.$$.dirty[0]&2|t.$$.dirty[1]&16&&ae){const Q=_s(oe);ae.setReverseMarker(Q?[Q.decimalLongitude,Q.decimalLatitude]:void 0)}t.$$.dirty[1]&67108864&&Ai("select",r),t.$$.dirty[1]&16777216&&Ai("pick",_t),t.$$.dirty[0]&81920&&Ai("optionsVisibilityChange",gs&&!!ie),t.$$.dirty[0]&16384&&Ai("featuresListed",ie),t.$$.dirty[1]&8388608&&Ai("featuresMarked",Ce),t.$$.dirty[0]&1&&Ai("reverseToggle",Ae),t.$$.dirty[0]&2&&Ai("queryChange",oe),t.$$.dirty[0]&1|t.$$.dirty[1]&16&&ae&&ae.indicateReverse(Ae)},[Ae,oe,c,w,I,D,U,de,te,Y,ve,He,bn,or,ie,en,gs,ze,Dr,tr,Ha,Cl,Tl,ei,ft,l,d,S,T,k,q,ee,B,j,J,ae,me,$,Ye,Oe,Ge,Rt,Pt,Zt,Xt,kt,un,Fn,mn,Bn,ir,$r,_r,cr,Ce,_t,Bs,r,a,i,on,nn,Rr,$o,tn,ba,Vr,he,V,W,K,se,Ee]}class YN extends Jt{constructor(e){super(),Kt(this,e,XN,ZN,qt,{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 W2(t){let e,n,r;return n=new YN({props:{mapController:t[1],apiKey:t[0]}}),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"class","svelte-ixhnie")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p(i,a){const c={};a&2&&(c.mapController=i[1]),a&1&&(c.apiKey=i[0]),n.$set(c)},i(i){r||(ye(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function KN(t){let e,n,r=t[1]&&W2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[1]?r?(r.p(i,a),a&2&&ye(r,1)):(r=W2(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function JN(t,e,n){let r,{apiKey:i}=e,{map:a}=e;return t.$$set=c=>{"apiKey"in c&&n(0,i=c.apiKey),"map"in c&&n(2,a=c.map)},t.$$.update=()=>{t.$$.dirty&4&&n(1,r=a?cN(a,Ts):null)},[i,r,a]}class QN extends Jt{constructor(e){super(),Kt(this,e,JN,KN,qt,{apiKey:0,map:2})}}const $N=Symbol.for("svelte-maplibre");function eO(){return Cv($N)}function tO(t){return"layerType"in t&&t.layerType==="deckgl"}var qc=nO;function nO(t){var e,n,r;if(t){if(Array.isArray(t)){for(e=[],n=t.length,r=0;r({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),Z2=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function X2(t){let e,n,r=(t[4]||t[3]instanceof Ts.Marker)&&Y2(t);return{c(){e=ke("div"),r&&r.c()},m(i,a){Me(i,e,a),r&&r.m(e,null),t[32](e),n=!0},p(i,a){i[4]||i[3]instanceof Ts.Marker?r?(r.p(i,a),a[0]&24&&ye(r,1)):(r=Y2(i),r.c(),ye(r,1),r.m(e,null)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(),t[32](null)}}}function Y2(t){let e;const n=t[30].default,r=Xr(n,t,t[29],Z2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[0]&536870933)&&Kr(r,n,i,i[29],e?Yr(n,i[29],a,oO):Jr(i[29]),Z2)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function sO(t){let e,n,r=t[9].default&&X2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[9].default?r?(r.p(i,a),a[0]&512&&ye(r,1)):(r=X2(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function aO(t,e,n){let r,i,a,c,l,d,{$$slots:w={},$$scope:S}=e;const I=rP(w);let{closeButton:T=void 0}=e,{closeOnClickOutside:k=!0}=e,{closeOnClickInside:D=!1}=e,{closeOnMove:U=!1}=e,{openOn:q="click"}=e,{openIfTopMost:ee=!0}=e,{focusAfterOpen:B=!0}=e,{anchor:j=void 0}=e,{offset:J=void 0}=e,{popupClass:ae=void 0}=e,{maxWidth:me=void 0}=e,{lngLat:de=void 0}=e,{html:te=void 0}=e,{open:$=!1}=e;const Ae=Yu(),{map:Y,popupTarget:oe,layerEvent:Ye,layer:ve,eventTopMost:Oe}=eO();Ct(t,Y,Ce=>n(2,a=Ce)),Ct(t,oe,Ce=>n(3,l=Ce)),Ct(t,Ye,Ce=>n(28,c=Ce)),Ct(t,ve,Ce=>n(35,d=Ce));const He=["click","dblclick","contextmenu"];let Ge,Rt=!1,Pt;function Zt(){if(!Ge)return;let Ce=Ge.getElement();!Ce||Ce===Pt||(Pt=Ce,q==="hover"&&(Pt.style.pointerEvents="none"),Pt.addEventListener("mouseenter",()=>{n(24,Rt=!0)},{passive:!0}),Pt.addEventListener("mouseleave",()=>{n(24,Rt=!1)},{passive:!0}),Pt.addEventListener("click",()=>{D&&n(0,$=!1)},{passive:!0}))}Xu(()=>{if(a)return a.on("click",_r),a.on("contextmenu",_r),typeof l=="string"&&(a.on("click",l,Fn),a.on("dblclick",l,Fn),a.on("contextmenu",l,Fn),a.on("mousemove",l,$r),a.on("mouseleave",l,ir),a.on("touchstart",l,mn),a.on("touchend",l,Bn)),()=>{a!=null&&a.loaded()&&(Ge==null||Ge.remove(),a.off("click",_r),a.off("contextmenu",_r),l instanceof Ts.Marker?l.getPopup()===Ge&&l.setPopup(void 0):typeof l=="string"&&(a.off("click",l,Fn),a.off("dblclick",l,Fn),a.off("contextmenu",l,Fn),a.off("mousemove",l,$r),a.off("mouseleave",l,ir),a.off("touchstart",l,mn),a.off("touchend",l,Bn)))}});function Xt(Ce){return ee?!("marker"in Ce)&&!tO(Ce)&&Oe(Ce)!==d:!1}let kt=null,un="normal";function Fn(Ce){Ce.type===q&&(Xt(Ce)||("layerType"in Ce?Ce.layerType==="deckgl"?(n(10,de=Ce.coordinate),n(4,kt=Ce.object?[Ce.object]:null)):(n(10,de=Ce.lngLat),n(4,kt=Ce.features??[])):(n(10,de=Ce.lngLat),n(4,kt=Ce.features??[])),setTimeout(()=>n(0,$=!0))))}let bn=null;function mn(Ce){bn=Ce.point}function Bn(Ce){if(!bn||q!=="hover")return;let _t=bn.dist(Ce.point);bn=null,_t<3&&(n(10,de=Ce.lngLat),n(4,kt=Ce.features??[]),Ge.isOpen()?n(25,un="justOpened"):(n(25,un="opening"),n(0,$=!0)))}function ir(Ce){q!=="hover"||bn||un!=="normal"||(n(0,$=!1),n(4,kt=null))}function $r(Ce){if(!(q!=="hover"||bn||un!=="normal")){if(Xt(Ce)){n(0,$=!1),n(4,kt=null);return}n(0,$=!0),n(4,kt=Ce.features??[]),n(10,de=Ce.lngLat)}}function _r(Ce){if(un==="justOpened"){n(25,un="normal");return}if(!k)return;let _t=[Pt,l instanceof Ts.Marker?l==null?void 0:l.getElement():null];$&&Ge.isOpen()&&!_t.some(xn=>xn==null?void 0:xn.contains(Ce.originalEvent.target))&&(Ce.type==="contextmenu"&&q==="contextmenu"||Ce.type!=="contextmenu")&&n(0,$=!1)}us(()=>{a&&(Ge!=null&&Ge.isOpen())&&Ge.remove()});let cr;const or=()=>n(0,$=!1);function ie(Ce){Gn[Ce?"unshift":"push"](()=>{cr=Ce,n(1,cr)})}return t.$$set=Ce=>{"closeButton"in Ce&&n(11,T=Ce.closeButton),"closeOnClickOutside"in Ce&&n(12,k=Ce.closeOnClickOutside),"closeOnClickInside"in Ce&&n(13,D=Ce.closeOnClickInside),"closeOnMove"in Ce&&n(14,U=Ce.closeOnMove),"openOn"in Ce&&n(15,q=Ce.openOn),"openIfTopMost"in Ce&&n(16,ee=Ce.openIfTopMost),"focusAfterOpen"in Ce&&n(17,B=Ce.focusAfterOpen),"anchor"in Ce&&n(18,j=Ce.anchor),"offset"in Ce&&n(19,J=Ce.offset),"popupClass"in Ce&&n(20,ae=Ce.popupClass),"maxWidth"in Ce&&n(21,me=Ce.maxWidth),"lngLat"in Ce&&n(10,de=Ce.lngLat),"html"in Ce&&n(22,te=Ce.html),"open"in Ce&&n(0,$=Ce.open),"$$scope"in Ce&&n(29,S=Ce.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&n(27,r=T??(!k&&!D)),t.$$.dirty[0]&146685952&&(Ge||(n(23,Ge=new Ts.Popup({closeButton:r,closeOnClick:!1,closeOnMove:U,focusAfterOpen:B,maxWidth:me,className:ae,anchor:j,offset:J})),Pt=Ge.getElement(),Ge.on("open",()=>{n(0,$=!0),Zt(),Ae("open",Ge)}),Ge.on("close",()=>{n(0,$=!1),Ae("close",Ge)}),Ge.on("hover",()=>{Ae("hover",Ge)}))),t.$$.dirty[0]&8421384&&Ge&&l instanceof Ts.Marker&&(q==="click"?l.setPopup(Ge):l.getPopup()===Ge&&l.setPopup(void 0)),t.$$.dirty[0]&268468224&&He.includes(q)&&(c==null?void 0:c.type)===q&&(Fn(c),Zn(Ye,c=null,c)),t.$$.dirty[0]&268468224&&n(26,i=q==="hover"&&((c==null?void 0:c.type)==="mousemove"||(c==null?void 0:c.type)==="mouseenter")),t.$$.dirty[0]&352354304&&q==="hover"&&Ye&&(i&&c&&(c.layerType==="deckgl"?(n(10,de=c.coordinate),n(4,kt=c.object?[c.object]:null)):(n(10,de=c.lngLat),n(4,kt=c.features??[]))),n(0,$=(i||Rt)??!1)),t.$$.dirty[0]&12582914&&(cr?Ge.setDOMContent(cr):te&&Ge.setHTML(te)),t.$$.dirty[0]&8389632&&de&&Ge.setLngLat(de),t.$$.dirty[0]&41943045&&a){let Ce=Ge.isOpen();$&&!Ce?(Ge.addTo(a),un==="opening"&&n(25,un="justOpened")):!$&&Ce&&Ge.remove()}},[$,cr,a,l,kt,Y,oe,Ye,ve,I,de,T,k,D,U,q,ee,B,j,J,ae,me,te,Ge,Rt,un,i,r,c,S,w,or,ie]}class lO extends Jt{constructor(e){super(),Kt(this,e,aO,sO,qt,{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])}}var sm=Uint8Array,VC=Uint16Array,uO=Int32Array,cO=new sm([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]),hO=new sm([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]),UC=function(t,e){for(var n=new VC(31),r=0;r<31;++r)n[r]=e+=1<>1|($n&21845)<<1,jl=(jl&52428)>>2|(jl&13107)<<2,jl=(jl&61680)>>4|(jl&3855)<<4,dO[$n]=((jl&65280)>>8|(jl&255)<<8)>>1;var jl,$n,W_=new sm(288);for($n=0;$n<144;++$n)W_[$n]=8;var $n;for($n=144;$n<256;++$n)W_[$n]=9;var $n;for($n=256;$n<280;++$n)W_[$n]=7;var $n;for($n=280;$n<288;++$n)W_[$n]=8;var $n,mO=new sm(32);for($n=0;$n<32;++$n)mO[$n]=5;var $n,gO=new sm(0),_O=typeof TextDecoder<"u"&&new TextDecoder,yO=0;try{_O.decode(gO,{stream:!0}),yO=1}catch{}const vO=t=>({props:t&8}),K2=t=>({props:wO(t[3])});function bO(t){let e;const n=t[1].default,r=Xr(n,t,t[2],K2);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&12)&&Kr(r,n,i,i[2],e?Yr(n,i[2],a,vO):Jr(i[2]),K2)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function xO(t){let e,n;return e=new lO({props:{openOn:t[0],$$slots:{default:[bO,({features:r})=>({3:r}),({features:r})=>r?8:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.openOn=r[0]),i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function wO(t){return t?t[0].properties??{}:(console.log("A Popup with null features should be impossible"),{})}function SO(t,e,n){let{$$slots:r={},$$scope:i}=e,{openOn:a="hover"}=e;return t.$$set=c=>{"openOn"in c&&n(0,a=c.openOn),"$$scope"in c&&n(2,i=c.$$scope)},[a,r,i]}class th extends Jt{constructor(e){super(),Kt(this,e,SO,xO,qt,{openOn:0})}}const EO=["==",["geometry-type"],"Polygon"],IO=["==",["geometry-type"],"LineString"];function x1(t,e,n){let r=["match",t];for(let[i,a]of Object.entries(e))r.push(i),r.push(a);return r.push(n),r}function Wc(t,e,n){let r=["step",t];for(let i=1;i{var c;let r=e.get(n.originalEvent);if(r!==void 0)return r;let a=(c=n.target.queryRenderedFeatures(n.point).find(l=>{var d;return(d=t.get(l.layer.id))==null?void 0:d.interactive}))==null?void 0:c.layer.id;return e.set(n.originalEvent,a),a}}function LO(){let t=new Map;return Iv(w1,{map:Qn(null),source:r0(null),layer:r0(null),popupTarget:r0(null),cluster:Qn(),loadedImages:Qn(new Set),minzoom:Qn(0),maxzoom:Qn(24),layerEvent:Qn(null),layerInfo:t,eventTopMost:TO(t)})}function J2(t){return{subscribe:t.subscribe}}function S1({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=np(),a=Qn(null),c=J2(a),l={...i,[t]:J2(a)};if(e&&(l.popupTarget=c),r){let d=Qn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Qn()),Iv(w1,l),{...i,self:a}}function PO(){return S1({key:"source",setCluster:!0})}function MO(t=!0){return S1({key:"layer",setPopupTarget:t,setMouseEvent:t})}function AO(){return S1({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function Q2(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],a=n[r];i!==a&&t(r,a,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function kO(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function DO(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function Hc(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function $2(t){let e=t[0],n,r,i=eS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c[0]&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=eS(a),i.c(),ye(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ye(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function eS(t){let e;const n=t[36].default,r=Xr(n,t,t[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[1]&16)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function RO(t){let e,n,r=t[0]&&$2(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&ye(r,1)):(r=$2(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function NO(t,e,n){let r,i,a,c,l,d,w,S,I,T,k,D,{$$slots:U={},$$scope:q}=e,{id:ee=tp("layer")}=e,{source:B=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:J=void 0}=e,{beforeLayerType:ae=void 0}=e,{type:me}=e,{paint:de=void 0}=e,{layout:te=void 0}=e,{filter:$=void 0}=e,{applyToClusters:Ae=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:Ye=!1}=e,{hovered:ve=null}=e,{interactive:Oe=!0}=e,{hoverCursor:He=void 0}=e,{eventsIfTopMost:Ge=!1}=e;const Rt=Yu(),{map:Pt,source:Zt,self:Xt,minzoom:kt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=MO();Ct(t,Pt,ie=>n(31,I=ie)),Ct(t,Zt,ie=>n(32,T=ie)),Ct(t,Xt,ie=>n(0,S=ie)),Ct(t,kt,ie=>n(34,D=ie)),Ct(t,un,ie=>n(33,k=ie)),us(()=>{S&&I&&(bn.delete(S),I==null||I.removeLayer(S))});let mn;function Bn(ie){var ze,en;if(!Oe||!S||!I||Ge&&Fn(ie)!==S)return;let Ce=ie.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn={event:ie,map:I,clusterId:_t,layer:S,source:l,features:Ce};Rt(ie.type,xn)}function ir(ie){var ze,en;if(!Oe||!S||!I||Ge&&Fn(ie)!==S)return;He&&(I.getCanvas().style.cursor=He);let Ce=ie.features??[];n(6,ve=Ce[0]??null);let _t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id;Rt("mouseenter",{event:ie,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function $r(ie){var ze,en,Dr;if(!Oe||!I)return;if(Ge&&Fn(ie)!==S){n(6,ve=null),Ye&&mn!==void 0&&(I==null||I.setFeatureState({source:l,sourceLayer:j,id:mn},{hover:!1}),mn=void 0);return}I.getCanvas().style.cursor=He;let Ce=ie.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn=(Dr=Ce[0])==null?void 0:Dr.id;xn!==mn&&(Ye&&(mn!==void 0&&(I==null||I.setFeatureState({source:l,id:mn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:l,id:xn,sourceLayer:j},{hover:!0})),mn=xn,n(6,ve=Ce[0]??null)),Rt("mousemove",{event:ie,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function _r(ie){if(!(!Oe||!S||!I)){if(He&&(I.getCanvas().style.cursor=""),n(6,ve=null),Ye&&mn!==void 0){const Ce={source:l,id:mn,sourceLayer:j};I==null||I.setFeatureState(Ce,{hover:!1}),mn=void 0}Rt("mouseleave",{map:I,layer:S,source:l})}}let cr=!0;function or(ie){I&&(I.off("click",ie,Bn),I.off("dblclick",ie,Bn),I.off("contextmenu",ie,Bn),I.off("mouseenter",ie,ir),I.off("mousemove",ie,$r),I.off("mouseleave",ie,_r))}return us(()=>{I&&S&&or(S)}),t.$$set=ie=>{"id"in ie&&n(7,ee=ie.id),"source"in ie&&n(8,B=ie.source),"sourceLayer"in ie&&n(9,j=ie.sourceLayer),"beforeId"in ie&&n(10,J=ie.beforeId),"beforeLayerType"in ie&&n(11,ae=ie.beforeLayerType),"type"in ie&&n(12,me=ie.type),"paint"in ie&&n(13,de=ie.paint),"layout"in ie&&n(14,te=ie.layout),"filter"in ie&&n(15,$=ie.filter),"applyToClusters"in ie&&n(16,Ae=ie.applyToClusters),"minzoom"in ie&&n(17,Y=ie.minzoom),"maxzoom"in ie&&n(18,oe=ie.maxzoom),"manageHoverState"in ie&&n(19,Ye=ie.manageHoverState),"hovered"in ie&&n(6,ve=ie.hovered),"interactive"in ie&&n(20,Oe=ie.interactive),"hoverCursor"in ie&&n(21,He=ie.hoverCursor),"eventsIfTopMost"in ie&&n(22,Ge=ie.eventsIfTopMost),"$$scope"in ie&&n(35,q=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=DO(Ae)),t.$$.dirty[0]&1073774592&&n(24,i=kO("all",r,$)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Y??D),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??k),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==ee&&l){S&&(or(S),bn.delete(S));let ie=J;if(!J&&ae){let Ce=I.getStyle().layers,_t=typeof ae=="function"?ae:ze=>ze.type===ae,xn=Ce==null?void 0:Ce.find(_t);xn&&(ie=xn.id)}Zn(Xt,S=ee,S),I.addLayer(qc({id:S,type:me,source:l,"source-layer":j,filter:i,paint:de,layout:te,minzoom:a,maxzoom:c}),ie),n(23,cr=!0),I.on("click",S,Bn),I.on("dblclick",S,Bn),I.on("contextmenu",S,Bn),I.on("mouseenter",S,ir),I.on("mousemove",S,$r),I.on("mouseleave",S,_r)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Oe}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?Q2((ie,Ce)=>I==null?void 0:I.setPaintProperty(S,ie,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?Q2((ie,Ce)=>I==null?void 0:I.setLayoutProperty(S,ie,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(de)),t.$$.dirty[0]&134234112&&(w==null||w(te)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(cr?n(23,cr=!1):I==null||I.setFilter(S,i))},[S,Pt,Zt,Xt,kt,un,ve,ee,B,j,J,ae,me,de,te,$,Ae,Y,oe,Ye,Oe,He,Ge,cr,i,c,a,w,d,l,r,I,T,k,D,q,U]}let H_=class extends Jt{constructor(e){super(),Kt(this,e,NO,RO,qt,{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 OO(t){let e;const n=t[16].default,r=Xr(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function zO(t){let e,n,r;function i(c){t[17](c)}let a={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:[OO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function FO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:J=!0}=e;function ae(oe){B=oe,n(0,B)}function me(oe){dn.call(this,t,oe)}function de(oe){dn.call(this,t,oe)}function te(oe){dn.call(this,t,oe)}function $(oe){dn.call(this,t,oe)}function Ae(oe){dn.call(this,t,oe)}function Y(oe){dn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,a=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,w=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,I=oe.layout),"filter"in oe&&n(8,T=oe.filter),"applyToClusters"in oe&&n(9,k=oe.applyToClusters),"minzoom"in oe&&n(10,D=oe.minzoom),"maxzoom"in oe&&n(11,U=oe.maxzoom),"hoverCursor"in oe&&n(12,q=oe.hoverCursor),"manageHoverState"in oe&&n(13,ee=oe.manageHoverState),"hovered"in oe&&n(0,B=oe.hovered),"eventsIfTopMost"in oe&&n(14,j=oe.eventsIfTopMost),"interactive"in oe&&n(15,J=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,q,ee,j,J,r,ae,me,de,te,$,Ae,Y,i]}let Z_=class extends Jt{constructor(e){super(),Kt(this,e,FO,zO,qt,{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 BO(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function VO(t){let e,n,r;function i(c){t[16](c)}let a={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:[BO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function UO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function J(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function de(Y){dn.call(this,t,Y)}function te(Y){dn.call(this,t,Y)}function $(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,J,ae,me,de,te,$,Ae,i]}let E1=class extends Jt{constructor(e){super(),Kt(this,e,UO,VO,qt,{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 GO(t,e,n){let r;const{map:i}=np();Ct(t,i,d=>n(4,r=d));let{position:a="top-left"}=e,{container:c=void 0}=e,l=null;return us(()=>{r!=null&&r.loaded()&&l&&r.removeControl(l)}),t.$$set=d=>{"position"in d&&n(1,a=d.position),"container"in d&&n(2,c=d.container)},t.$$.update=()=>{if(t.$$.dirty&30&&r&&!l){let d;typeof c=="string"?d=document.querySelector(c)??void 0:d=c,n(3,l=new Ts.FullscreenControl({container:d})),r.addControl(l,a)}},[i,a,c,l,r]}class jO extends Jt{constructor(e){super(),Kt(this,e,GO,null,qt,{position:1,container:2})}}function qO(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function WO(t,e,n){gE().then(()=>{let r=hE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function tS(t){let e=t[0],n,r,i=nS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=nS(a),i.c(),ye(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ye(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function nS(t){let e;const n=t[19].default,r=Xr(n,t,t[18],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&262144)&&Kr(r,n,i,i[18],e?Yr(n,i[18],a,null):Jr(i[18]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function HO(t){let e,n,r=t[0]&&tS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ye(r,1)):(r=tS(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function ZO(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:d=tp("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:T=void 0}=e,{lineMetrics:k=void 0}=e,{cluster:D=void 0}=e,{maxzoom:U=void 0}=e,{attribution:q=void 0}=e,{buffer:ee=void 0}=e,{tolerance:B=void 0}=e;const{map:j,cluster:J,self:ae}=PO();Ct(t,j,te=>n(17,i=te)),Ct(t,J,te=>n(20,a=te)),Ct(t,ae,te=>n(0,r=te));let me,de=!0;return us(()=>{r&&me&&i&&(WO(j,r,me),Zn(ae,r=null,r),n(15,me=void 0))}),t.$$set=te=>{"id"in te&&n(4,d=te.id),"data"in te&&n(5,w=te.data),"generateId"in te&&n(6,S=te.generateId),"promoteId"in te&&n(7,I=te.promoteId),"filter"in te&&n(8,T=te.filter),"lineMetrics"in te&&n(9,k=te.lineMetrics),"cluster"in te&&n(10,D=te.cluster),"maxzoom"in te&&n(11,U=te.maxzoom),"attribution"in te&&n(12,q=te.attribution),"buffer"in te&&n(13,ee=te.buffer),"tolerance"in te&&n(14,B=te.tolerance),"$$scope"in te&&n(18,l=te.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Zn(J,a=D,a),t.$$.dirty&196593&&i&&r!==d&&(Zn(ae,r=d,r),qO(i,r,qc({type:"geojson",data:w,filter:T,lineMetrics:k,generateId:S,promoteId:I,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties,maxzoom:U,attribution:q,buffer:ee,tolerance:B}),te=>i&&te===r,()=>{r&&(n(15,me=i==null?void 0:i.getSource(r)),n(16,de=!0))})),t.$$.dirty&131088&&(i==null||i.on("style.load",()=>{n(15,me=i==null?void 0:i.getSource(d))})),t.$$.dirty&98336&&me&&(de?n(16,de=!1):me.setData(w)),t.$$.dirty&33792&&(me==null||me.setClusterOptions(qc({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[r,j,J,ae,d,w,S,I,T,k,D,U,q,ee,B,me,de,i,l,c]}let qa=class extends Jt{constructor(e){super(),Kt(this,e,ZO,HO,qt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}};function XO(t,e,n){let r;const{map:i}=np();Ct(t,i,T=>n(8,r=T));let{position:a="top-left"}=e,{positionOptions:c=void 0}=e,{fitBoundsOptions:l=void 0}=e,{trackUserLocation:d=!1}=e,{showAccuracyCircle:w=!0}=e,{showUserLocation:S=!0}=e,{control:I=null}=e;return us(()=>{r!=null&&r.loaded()&&I&&r.removeControl(I)}),t.$$set=T=>{"position"in T&&n(2,a=T.position),"positionOptions"in T&&n(3,c=T.positionOptions),"fitBoundsOptions"in T&&n(4,l=T.fitBoundsOptions),"trackUserLocation"in T&&n(5,d=T.trackUserLocation),"showAccuracyCircle"in T&&n(6,w=T.showAccuracyCircle),"showUserLocation"in T&&n(7,S=T.showUserLocation),"control"in T&&n(1,I=T.control)},t.$$.update=()=>{t.$$.dirty&510&&r&&!I&&(n(1,I=new Ts.GeolocateControl({positionOptions:c,fitBoundsOptions:l,trackUserLocation:d,showAccuracyCircle:w,showUserLocation:S})),r.addControl(I,a))},[i,I,a,c,l,d,w,S,r]}class YO extends Jt{constructor(e){super(),Kt(this,e,XO,null,qt,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function KO(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function JO(t){let e,n,r;function i(c){t[16](c)}let a={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:[KO]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function QO(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function J(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function de(Y){dn.call(this,t,Y)}function te(Y){dn.call(this,t,Y)}function $(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,J,ae,me,de,te,$,Ae,i]}let lu=class extends Jt{constructor(e){super(),Kt(this,e,QO,JO,qt,{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 $O(t,e,n){let r;const i=Yu();let{layer:a=void 0}=e;const{map:c}=np();Ct(t,c,S=>n(2,r=S));function l(S){i(S.type,{...S,map:c})}const d=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],w=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return us(()=>{if(r)if(a)for(const S of d)r.off(S,a,l);else for(const S of w)r.off(S,l)}),t.$$set=S=>{"layer"in S&&n(1,a=S.layer)},t.$$.update=()=>{if(t.$$.dirty&6&&r)if(a)for(const S of d)r.on(S,a,l);else for(const S of w)r.on(S,l)},[c,a,r]}class e5 extends Jt{constructor(e){super(),Kt(this,e,$O,null,qt,{layer:1})}}function t5(t){let e=t.getCenter(),n=Math.round(t.getZoom()*100)/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),a=Math.round(e.lat*i)/i,c=Math.round(e.lng*i)/i,l=`${n}/${a}/${c}`,d=t.getBearing(),w=t.getPitch();return(d||w)&&(l+=`/${Math.round(d*10)/10}`),w&&(l+=`/${Math.round(w)}`),`#${l}`}function n5(t){return t.replace("#","").split("/").map(parseFloat)}function r5(t,e,n){let r;const{map:i}=np();Ct(t,i,S=>n(6,r=S));let{position:a="top-left"}=e,{showCompass:c=!0}=e,{showZoom:l=!0}=e,{visualizePitch:d=!1}=e,w=null;return us(()=>{r!=null&&r.loaded()&&w&&r.removeControl(w)}),t.$$set=S=>{"position"in S&&n(1,a=S.position),"showCompass"in S&&n(2,c=S.showCompass),"showZoom"in S&&n(3,l=S.showZoom),"visualizePitch"in S&&n(4,d=S.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&r&&!w&&(n(5,w=new Ts.NavigationControl({showCompass:c,showZoom:l,visualizePitch:d})),r.addControl(w,a))},[i,a,c,l,d,w,r]}class i5 extends Jt{constructor(e){super(),Kt(this,e,r5,null,qt,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function o5(t,e,n){let r;const{map:i}=np();Ct(t,i,w=>n(5,r=w));let{position:a="bottom-left"}=e,{maxWidth:c=void 0}=e,{unit:l="metric"}=e,d=null;return us(()=>{r!=null&&r.loaded()&&d&&r.removeControl(d)}),t.$$set=w=>{"position"in w&&n(1,a=w.position),"maxWidth"in w&&n(2,c=w.maxWidth),"unit"in w&&n(3,l=w.unit)},t.$$.update=()=>{t.$$.dirty&62&&r&&!d&&(n(4,d=new Ts.ScaleControl({maxWidth:c,unit:l})),r.addControl(d,a))},[i,a,c,l,d,r]}class s5 extends Jt{constructor(e){super(),Kt(this,e,o5,null,qt,{position:1,maxWidth:2,unit:3})}}const{window:a5}=iP,l5=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),rS=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function iS(t){let e,n,r=t[3]&&oS(t);const i=t[40].default,a=Xr(i,t,t[39],rS);return{c(){r&&r.c(),e=nt(),a&&a.c()},m(c,l){r&&r.m(c,l),Me(c,e,l),a&&a.m(c,l),n=!0},p(c,l){c[3]?r?(r.p(c,l),l[0]&8&&ye(r,1)):(r=oS(c),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn()),a&&a.p&&(!n||l[0]&112|l[1]&256)&&Kr(a,i,c,c[39],n?Yr(i,c[39],l,l5):Jr(c[39]),rS)},i(c){n||(ye(r),ye(a,c),n=!0)},o(c){Se(r),Se(a,c),n=!1},d(c){c&&Le(e),r&&r.d(c),a&&a.d(c)}}}function oS(t){let e,n,r,i,a,c,l,d;return e=new i5({props:{position:t[7]}}),r=new YO({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),a=new jO({props:{position:t[7]}}),l=new s5({props:{position:t[7]}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment),c=nt(),ot(l.$$.fragment)},m(w,S){rt(e,w,S),Me(w,n,S),rt(r,w,S),Me(w,i,S),rt(a,w,S),Me(w,c,S),rt(l,w,S),d=!0},p(w,S){const I={};S[0]&128&&(I.position=w[7]),e.$set(I);const T={};S[0]&128&&(T.position=w[7]),r.$set(T);const k={};S[0]&128&&(k.position=w[7]),a.$set(k);const D={};S[0]&128&&(D.position=w[7]),l.$set(D)},i(w){d||(ye(e.$$.fragment,w),ye(r.$$.fragment,w),ye(a.$$.fragment,w),ye(l.$$.fragment,w),d=!0)},o(w){Se(e.$$.fragment,w),Se(r.$$.fragment,w),Se(a.$$.fragment,w),Se(l.$$.fragment,w),d=!1},d(w){w&&(Le(n),Le(i),Le(c)),it(e,w),it(r,w),it(a,w),it(l,w)}}}function u5(t){let e,n,r,i,a,c=t[4]&&t[0]&&iS(t);return{c(){e=ke("div"),c&&c.c(),Ve(e,"class",n=Vg(t[2])+" svelte-p00lfq"),Ve(e,"data-testid","map-container"),hl(e,"expand-map",!t[2])},m(l,d){Me(l,e,d),c&&c.m(e,null),t[41](e),r=!0,i||(a=[Gt(a5,"hashchange",t[11]),A0(t[10].call(null,e))],i=!0)},p(l,d){l[4]&&l[0]?c?(c.p(l,d),d[0]&17&&ye(c,1)):(c=iS(l),c.c(),ye(c,1),c.m(e,null)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),(!r||d[0]&4&&n!==(n=Vg(l[2])+" svelte-p00lfq"))&&Ve(e,"class",n),(!r||d[0]&4)&&hl(e,"expand-map",!l[2])},i(l){r||(ye(c),r=!0)},o(l){Se(c),r=!1},d(l){l&&Le(e),c&&c.d(),t[41](null),i=!1,Mi(a)}}}function c5(t,e,n){let r,i,a,c,{$$slots:l={},$$scope:d}=e,{map:w=null}=e,{mapContainer:S=void 0}=e,{class:I=void 0}=e,{style:T}=e,{diffStyleUpdates:k=!1}=e,{center:D=void 0}=e,{zoom:U=void 0}=e,{pitch:q=0}=e,{bearing:ee=0}=e,{bounds:B=void 0}=e,{hash:j=!1}=e,{updateHash:J=ie=>{window.history.replaceState(window.history.state,"",ie)}}=e,{loaded:ae=!1}=e,{minZoom:me=0}=e,{maxZoom:de=22}=e,{antialias:te=void 0}=e,{zoomOnDoubleClick:$=!0}=e,{locale:Ae=void 0}=e,{interactive:Y=!0}=e,{attributionControl:oe=!0}=e,{cooperativeGestures:Ye=!1}=e,{preserveDrawingBuffer:ve=!1}=e,{maxBounds:Oe=void 0}=e,{images:He=[]}=e,{standardControls:Ge=!1}=e,{filterLayers:Rt=void 0}=e,{transformRequest:Pt=void 0}=e;const Zt=Yu(),{map:Xt,loadedImages:kt}=LO();Ct(t,Xt,ie=>n(4,a=ie)),Ct(t,kt,ie=>n(5,c=ie));let un=new Set;async function Fn(ie,Ce=!1){if(a&&!(!a.loaded()&&!Ce))if("url"in ie){un.add(ie.id);try{let _t=await a.loadImage(ie.url);a==null||a.addImage(ie.id,_t.data,ie.options),c.add(ie.id),kt.set(c)}catch(_t){Zt("error",_t)}finally{un.delete(ie.id)}}else a.addImage(ie.id,ie.data,ie.options),c.add(ie.id),kt.set(c)}let bn,mn,Bn,ir;function $r(ie){return cr(),Zn(Xt,a=new Ts.Map(qc({container:ie,style:T,locale:Ae,center:D,zoom:U,pitch:q,bearing:ee,minZoom:me,maxZoom:de,antialias:te,interactive:Y,preserveDrawingBuffer:ve,maxBounds:Oe,bounds:B,attributionControl:oe,transformRequest:Pt,cooperativeGestures:Ye})),a),a.on("load",Ce=>{Ce.target.getContainer().setAttribute("data-testid","map"),Ce.target.getCanvas().setAttribute("data-testid","map-canvas"),n(0,ae=!0),Zt("load",a)}),a.on("error",Ce=>Zt("error",{...Ce,map:a})),a.on("movestart",Ce=>Zt("movestart",{...Ce,map:a})),a.on("moveend",Ce=>{if(n(12,D=Ce.target.getCenter()),n(13,U=Ce.target.getZoom()),n(14,q=Ce.target.getPitch()),n(15,ee=Ce.target.getBearing()),n(16,B=Ce.target.getBounds()),Zt("moveend",{...Ce,map:a}),j){let _t=new URL(window.location.href.replace(/(#.+)?$/,t5(a)));J(_t)}}),a.on("click",Ce=>Zt("click",{...Ce,map:a})),a.on("dblclick",Ce=>Zt("dblclick",{...Ce,map:a})),a.on("contextmenu",Ce=>Zt("contextmenu",{...Ce,map:a})),a.on("zoomstart",Ce=>Zt("zoomstart",{...Ce,map:a})),a.on("zoom",Ce=>{Zt("zoom",{...Ce,map:a})}),a.on("zoomend",Ce=>{Zt("zoomend",{...Ce,map:a})}),a.on("style.load",()=>{if(a){const Ce=a.getStyle();if(n(36,bn=Ce.layers.map(_t=>_t.id)),n(37,mn=Object.keys(Ce.sources)),ir)for(const[_t,xn]of Object.entries(ir))a.addSource(_t,xn);if(Bn)for(const _t of Bn)a.addLayer(_t);for(const _t of He)Fn(_t,!0)}}),a.on("styledata",Ce=>{if(a&&Rt){const _t=a.getStyle().layers;if(_t)for(let xn of _t)Rt(xn)||a.setLayoutProperty(xn.id,"visibility","none")}Zt("styledata",{...Ce,map:a})}),{destroy(){n(0,ae=!1),a==null||a.remove(),Zn(Xt,a=null,a)}}}let _r=T;function cr(){if(j){let ie=n5(window.location.hash);ie.length>=3&&(n(13,U=ie[0]),n(12,D=[ie[2],ie[1]])),ie.length==5&&(n(15,ee=ie[3]),n(14,q=ie[4]))}}function or(ie){Gn[ie?"unshift":"push"](()=>{S=ie,n(1,S)})}return t.$$set=ie=>{"map"in ie&&n(17,w=ie.map),"mapContainer"in ie&&n(1,S=ie.mapContainer),"class"in ie&&n(2,I=ie.class),"style"in ie&&n(18,T=ie.style),"diffStyleUpdates"in ie&&n(19,k=ie.diffStyleUpdates),"center"in ie&&n(12,D=ie.center),"zoom"in ie&&n(13,U=ie.zoom),"pitch"in ie&&n(14,q=ie.pitch),"bearing"in ie&&n(15,ee=ie.bearing),"bounds"in ie&&n(16,B=ie.bounds),"hash"in ie&&n(20,j=ie.hash),"updateHash"in ie&&n(21,J=ie.updateHash),"loaded"in ie&&n(0,ae=ie.loaded),"minZoom"in ie&&n(22,me=ie.minZoom),"maxZoom"in ie&&n(23,de=ie.maxZoom),"antialias"in ie&&n(24,te=ie.antialias),"zoomOnDoubleClick"in ie&&n(25,$=ie.zoomOnDoubleClick),"locale"in ie&&n(26,Ae=ie.locale),"interactive"in ie&&n(27,Y=ie.interactive),"attributionControl"in ie&&n(28,oe=ie.attributionControl),"cooperativeGestures"in ie&&n(29,Ye=ie.cooperativeGestures),"preserveDrawingBuffer"in ie&&n(30,ve=ie.preserveDrawingBuffer),"maxBounds"in ie&&n(31,Oe=ie.maxBounds),"images"in ie&&n(32,He=ie.images),"standardControls"in ie&&n(3,Ge=ie.standardControls),"filterLayers"in ie&&n(33,Rt=ie.filterLayers),"transformRequest"in ie&&n(34,Pt=ie.transformRequest),"$$scope"in ie&&n(39,d=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&n(7,r=typeof Ge=="boolean"?void 0:Ge),t.$$.dirty[0]&16&&n(17,w=a),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&a&&!of(T,_r)){const ie=a.getStyle();if(bn&&(Bn=ie.layers.filter(Ce=>!bn.includes(Ce.id))),mn){const Ce=Object.keys(ie.sources).filter(_t=>!mn.includes(_t));ir={};for(const _t of Ce)ir[_t]=ie.sources[_t]}n(38,_r=T),a.setStyle(T,{diff:k}),Zn(kt,c=new Set,c),n(35,un=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&ae&&a!=null&&a.loaded())for(let ie of He)!c.has(ie.id)&&!un.has(ie.id)&&!a.hasImage(ie.id)&&Fn(ie);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&n(6,i=He.every(ie=>c.has(ie.id))),t.$$.dirty[0]&61456&&a){let ie={};D!=null&&!of(D,a==null?void 0:a.getCenter())&&(ie.center=D),U!=null&&!of(U,a==null?void 0:a.getZoom())&&(ie.zoom=U),ee!=null&&!of(ee,a==null?void 0:a.getBearing())&&(ie.bearing=ee),q!=null&&!of(q,a==null?void 0:a.getPitch())&&(ie.pitch=q),Object.keys(ie).length&&a.easeTo(ie)}t.$$.dirty[0]&65552&&B&&!of(B,a==null?void 0:a.getBounds())&&(a==null||a.fitBounds(B)),t.$$.dirty[0]&33554448&&($?a==null||a.doubleClickZoom.enable():a==null||a.doubleClickZoom.disable())},[ae,S,I,Ge,a,c,i,r,Xt,kt,$r,cr,D,U,q,ee,B,w,T,k,j,J,me,de,te,$,Ae,Y,oe,Ye,ve,Oe,He,Rt,Pt,un,bn,mn,_r,d,l,or]}class h5 extends Jt{constructor(e){super(),Kt(this,e,c5,u5,qt,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const f5=t=>({marker:t&8}),sS=t=>({marker:t[3]});function p5(t){let e,n,r,i,a,c,l;const d=t[19].default,w=Xr(d,t,t[18],sS);return{c(){e=ke("div"),w&&w.c(),Ve(e,"tabindex",n=t[1]?0:void 0),Ve(e,"role",r=t[1]?"button":void 0),Ei(e,"z-index",t[2])},m(S,I){Me(S,e,I),w&&w.m(e,null),a=!0,c||(l=[A0(t[7].call(null,e)),A0(i=d5.call(null,e,t[0])),Gt(e,"click",t0(t[20])),Gt(e,"dblclick",t0(t[21])),Gt(e,"contextmenu",t0(t[22])),Gt(e,"mouseenter",t[23]),Gt(e,"mouseleave",t[24]),Gt(e,"mousemove",t[25]),Gt(e,"keydown",t[8])],c=!0)},p(S,[I]){w&&w.p&&(!a||I&262152)&&Kr(w,d,S,S[18],a?Yr(d,S[18],I,f5):Jr(S[18]),sS),(!a||I&2&&n!==(n=S[1]?0:void 0))&&Ve(e,"tabindex",n),(!a||I&2&&r!==(r=S[1]?"button":void 0))&&Ve(e,"role",r),i&&E_(i.update)&&I&1&&i.update.call(null,S[0]),I&4&&Ei(e,"z-index",S[2])},i(S){a||(ye(w,S),a=!0)},o(S){Se(w,S),a=!1},d(S){S&&Le(e),w&&w.d(S),c=!1,Mi(l)}}}function d5(t,e){const n=t.className;function r(i){i?t.className=`${n} ${i}`:t.className=n}return r(e),{update:r}}function m5(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{marker:d=void 0}=e,{lngLat:w}=e,{class:S=void 0}=e,{interactive:I=!0}=e,{asButton:T=!1}=e,{draggable:k=!1}=e,{feature:D=null}=e,{offset:U=void 0}=e,{zIndex:q=void 0}=e,{rotation:ee=0}=e,{opacity:B=1}=e;const j=Yu(),{map:J,layerEvent:ae,self:me}=AO();Ct(t,J,Ge=>n(27,a=Ge)),Ct(t,ae,Ge=>n(26,r=Ge)),Ct(t,me,Ge=>n(3,i=Ge));function de(Ge){Zn(me,i=new Ts.Marker({element:Ge,rotation:ee,draggable:k,offset:U,opacity:B.toString()}).setLngLat(w).addTo(a),i),n(11,d=i);const Rt=()=>Ae("dragstart"),Pt=()=>{te(),Ae("drag")},Zt=()=>{te(),Ae("dragend")};return k&&(i.on("dragstart",Rt),i.on("drag",Pt),i.on("dragend",Zt)),{destroy(){k&&(i==null||i.off("dragstart",Rt),i==null||i.off("drag",Pt),i==null||i.off("dragend",Zt)),n(11,d=void 0),i==null||i.remove()}}}function te(){let Ge=i==null?void 0:i.getLngLat();Ge&&(Array.isArray(w)?n(10,w=[Ge.lng,Ge.lat]):w&&"lon"in w?n(10,w={lon:Ge.lng,lat:Ge.lat}):n(10,w=Ge))}function $(Ge){Ge.key===" "&&(Ge.preventDefault(),Ge.stopPropagation(),Ae("click"))}function Ae(Ge){if(!I)return;let Rt=i==null?void 0:i.getLngLat();if(!Rt)return;const Pt=[Rt.lng,Rt.lat];let Zt={map:a,marker:i,lngLat:Pt,features:[{type:"Feature",properties:(D==null?void 0:D.properties)??{},geometry:{type:"Point",coordinates:Pt}}]};Zn(ae,r={...Zt,layerType:"marker",type:Ge},r),j(Ge,Zt)}const Y=()=>Ae("click"),oe=()=>Ae("dblclick"),Ye=()=>Ae("contextmenu"),ve=Ge=>{Ae("mouseenter")},Oe=()=>{Ae("mouseleave")},He=()=>Ae("mousemove");return t.$$set=Ge=>{"marker"in Ge&&n(11,d=Ge.marker),"lngLat"in Ge&&n(10,w=Ge.lngLat),"class"in Ge&&n(0,S=Ge.class),"interactive"in Ge&&n(12,I=Ge.interactive),"asButton"in Ge&&n(1,T=Ge.asButton),"draggable"in Ge&&n(13,k=Ge.draggable),"feature"in Ge&&n(14,D=Ge.feature),"offset"in Ge&&n(15,U=Ge.offset),"zIndex"in Ge&&n(2,q=Ge.zIndex),"rotation"in Ge&&n(16,ee=Ge.rotation),"opacity"in Ge&&n(17,B=Ge.opacity),"$$scope"in Ge&&n(18,l=Ge.$$scope)},t.$$.update=()=>{t.$$.dirty&1032&&(i==null||i.setLngLat(w)),t.$$.dirty&32776&&(i==null||i.setOffset(U??[0,0])),t.$$.dirty&65544&&(i==null||i.setRotation(ee)),t.$$.dirty&131080&&(i==null||i.setOpacity(B.toString()))},[S,T,q,i,J,ae,me,de,$,Ae,w,d,I,k,D,U,ee,B,l,c,Y,oe,Ye,ve,Oe,He]}class Zd extends Jt{constructor(e){super(),Kt(this,e,m5,p5,qt,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function g5(t){let e;const n=t[16].default,r=Xr(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function _5(t){let e,n,r;function i(c){t[17](c)}let a={id:t[1],type:"symbol",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],applyToClusters:t[9],minzoom:t[10],maxzoom:t[11],hoverCursor:t[12],manageHoverState:t[13],eventsIfTopMost:t[14],interactive:t[15],$$slots:{default:[g5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new H_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function y5(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=tp("symbol")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S=void 0}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:J=!0}=e;function ae(oe){B=oe,n(0,B)}function me(oe){dn.call(this,t,oe)}function de(oe){dn.call(this,t,oe)}function te(oe){dn.call(this,t,oe)}function $(oe){dn.call(this,t,oe)}function Ae(oe){dn.call(this,t,oe)}function Y(oe){dn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,a=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,w=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,I=oe.layout),"filter"in oe&&n(8,T=oe.filter),"applyToClusters"in oe&&n(9,k=oe.applyToClusters),"minzoom"in oe&&n(10,D=oe.minzoom),"maxzoom"in oe&&n(11,U=oe.maxzoom),"hoverCursor"in oe&&n(12,q=oe.hoverCursor),"manageHoverState"in oe&&n(13,ee=oe.manageHoverState),"hovered"in oe&&n(0,B=oe.hovered),"eventsIfTopMost"in oe&&n(14,j=oe.eventsIfTopMost),"interactive"in oe&&n(15,J=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,q,ee,j,J,r,ae,me,de,te,$,Ae,Y,i]}class v5 extends Jt{constructor(e){super(),Kt(this,e,y5,_5,qt,{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 b5=t=>({}),aS=t=>({}),x5=t=>({}),lS=t=>({}),w5=t=>({}),uS=t=>({});function S5(t){let e,n,r,i,a,c;const l=t[1].top,d=Xr(l,t,t[0],uS),w=t[1].left,S=Xr(w,t,t[0],lS),I=t[1].main,T=Xr(I,t,t[0],aS);return{c(){e=ke("div"),d&&d.c(),n=nt(),r=ke("div"),S&&S.c(),i=nt(),a=ke("div"),T&&T.c(),Ve(e,"class","top svelte-mpick2"),Ve(r,"class","left svelte-mpick2"),Ve(a,"class","main svelte-mpick2")},m(k,D){Me(k,e,D),d&&d.m(e,null),Me(k,n,D),Me(k,r,D),S&&S.m(r,null),Me(k,i,D),Me(k,a,D),T&&T.m(a,null),c=!0},p(k,[D]){d&&d.p&&(!c||D&1)&&Kr(d,l,k,k[0],c?Yr(l,k[0],D,w5):Jr(k[0]),uS),S&&S.p&&(!c||D&1)&&Kr(S,w,k,k[0],c?Yr(w,k[0],D,x5):Jr(k[0]),lS),T&&T.p&&(!c||D&1)&&Kr(T,I,k,k[0],c?Yr(I,k[0],D,b5):Jr(k[0]),aS)},i(k){c||(ye(d,k),ye(S,k),ye(T,k),c=!0)},o(k){Se(d,k),Se(S,k),Se(T,k),c=!1},d(k){k&&(Le(e),Le(n),Le(r),Le(i),Le(a)),d&&d.d(k),S&&S.d(k),T&&T.d(k)}}}function E5(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=a=>{"$$scope"in a&&n(0,i=a.$$scope)},[i,r]}class I5 extends Jt{constructor(e){super(),Kt(this,e,E5,S5,qt,{})}}const C5=t=>({}),cS=t=>({}),T5=t=>({}),hS=t=>({}),L5=t=>({}),fS=t=>({});function P5(t){let e,n,r,i,a,c;const l=t[4].top,d=Xr(l,t,t[3],fS),w=t[4].sidebar,S=Xr(w,t,t[3],hS),I=t[4].map,T=Xr(I,t,t[3],cS);return{c(){e=ke("div"),d&&d.c(),n=nt(),r=ke("div"),S&&S.c(),i=nt(),a=ke("div"),T&&T.c()},m(k,D){Me(k,e,D),d&&d.m(e,null),t[5](e),Me(k,n,D),Me(k,r,D),S&&S.m(r,null),t[6](r),Me(k,i,D),Me(k,a,D),T&&T.m(a,null),t[7](a),c=!0},p(k,[D]){d&&d.p&&(!c||D&8)&&Kr(d,l,k,k[3],c?Yr(l,k[3],D,L5):Jr(k[3]),fS),S&&S.p&&(!c||D&8)&&Kr(S,w,k,k[3],c?Yr(w,k[3],D,T5):Jr(k[3]),hS),T&&T.p&&(!c||D&8)&&Kr(T,I,k,k[3],c?Yr(I,k[3],D,C5):Jr(k[3]),cS)},i(k){c||(ye(d,k),ye(S,k),ye(T,k),c=!0)},o(k){Se(d,k),Se(S,k),Se(T,k),c=!1},d(k){k&&(Le(e),Le(n),Le(r),Le(i),Le(a)),d&&d.d(k),t[5](null),S&&S.d(k),t[6](null),T&&T.d(k),t[7](null)}}}function M5(t,e,n){let r,i,a;Ct(t,xv,I=>n(0,r=I)),Ct(t,wv,I=>n(1,i=I)),Ct(t,Sv,I=>n(2,a=I));let{$$slots:c={},$$scope:l}=e;function d(I){Gn[I?"unshift":"push"](()=>{r=I,xv.set(r)})}function w(I){Gn[I?"unshift":"push"](()=>{i=I,wv.set(i)})}function S(I){Gn[I?"unshift":"push"](()=>{a=I,Sv.set(a)})}return t.$$set=I=>{"$$scope"in I&&n(3,l=I.$$scope)},[r,i,a,l,c,d,w,S]}class rp extends Jt{constructor(e){super(),Kt(this,e,M5,P5,qt,{})}}let xv=Qn(null),wv=Qn(null),Sv=Qn(null);function pS(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[A5,({props:r})=>({4:r}),({props:r})=>r?16:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&48&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function A5(t){let e,n;return e=new Mv({props:{properties:t[4]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.properties=r[4]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function k5(t){let e,n,r=t[1]&&pS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[1]?r?(r.p(i,a),a&2&&ye(r,1)):(r=pS(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function D5(t){let e,n,r;function i(c){t[2](c)}let a={id:"amenities",paint:{"circle-radius":5,"circle-opacity":0,"circle-stroke-width":2,"circle-stroke-color":Hc("orange","red")},manageHoverState:!0,filter:["has","amenity_kind"],hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[k5]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new Z_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[3]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&34&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function R5(t,e,n){let{hovered:r=null}=e,{popups:i=!1}=e;function a(l){r=l,n(0,r)}const c=l=>window.open(cs(l.detail.features[0].properties).osm_id,"_blank");return t.$$set=l=>{"hovered"in l&&n(0,r=l.hovered),"popups"in l&&n(1,i=l.popups)},[r,i,a,c]}class jC extends Jt{constructor(e){super(),Kt(this,e,R5,D5,qt,{hovered:0,popups:1})}}function dS(t,e,n){const r=t.slice();return r[2]=e[n][0],r[3]=e[n][1],r}function mS(t,e,n){const r=t.slice();return r[6]=e[n],r}function gS(t){let e,n,r=Zg(t[6])+"",i,a,c;return{c(){e=ke("li"),n=ke("a"),i=vt(r),c=nt(),Ve(n,"href",a=t[6].properties.osm_id),Ve(n,"target","_blank")},m(l,d){Me(l,e,d),xe(e,n),xe(n,i),xe(e,c)},p(l,d){d&1&&r!==(r=Zg(l[6])+"")&&An(i,r),d&1&&a!==(a=l[6].properties.osm_id)&&Ve(n,"href",a)},d(l){l&&Le(e)}}}function _S(t){let e,n,r=t[2]+"",i,a,c=t[3].length+"",l,d,w,S,I,T=zr(t[3]),k=[];for(let D=0;Di[1].length-r[1].length),n}function O5(t,e,n){let r,{gj:i}=e;return t.$$set=a=>{"gj"in a&&n(1,i=a.gj)},t.$$.update=()=>{t.$$.dirty&2&&n(0,r=i.features.filter(a=>"amenity_kind"in a.properties))},[r,i]}class qC extends Jt{constructor(e){super(),Kt(this,e,O5,N5,qt,{gj:1})}}function vS(t,e,n){const r=t.slice();return r[3]=e[n],r}function bS(t){let e,n,r=zr(t[0]),i=[];for(let a=0;a0&&bS(t);return{c(){n&&n.c(),e=ur()},m(r,i){n&&n.m(r,i),Me(r,e,i)},p(r,[i]){r[0].length>0?n?n.p(r,i):(n=bS(r),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:et,o:et,d(r){r&&Le(e),n&&n.d(r)}}}function F5(t,e,n){let{loading:r}=e,i;function a(c){Gn[c?"unshift":"push"](()=>{i=c,n(1,i),n(0,r)})}return t.$$set=c=>{"loading"in c&&n(0,r=c.loading)},t.$$.update=()=>{t.$$.dirty&3&&r.length>0&&i&&n(1,i.scrollTop=i.scrollHeight,i)},[r,i,a]}class WC extends Jt{constructor(e){super(),Kt(this,e,F5,z5,qt,{loading:0})}}function B5(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,q,ee,B,j,J,ae,me,de,te,$,Ae,Y,oe,Ye,ve;return{c(){e=ke("nav"),n=ke("ul"),r=ke("li"),i=ke("button"),i.textContent="Change study area",a=nt(),c=ke("li"),l=ke("button"),d=vt("Isochrone"),S=nt(),I=ke("li"),T=ke("button"),k=vt("Route"),U=nt(),q=ke("li"),ee=ke("button"),B=vt("Score"),J=nt(),ae=ke("li"),me=ke("button"),de=vt("Debug network"),$=nt(),Ae=ke("label"),Y=ke("input"),oe=vt("Population"),l.disabled=w=t[0].kind=="isochrone",T.disabled=D=t[0].kind=="route",ee.disabled=j=t[0].kind=="score",me.disabled=te=t[0].kind=="debug",Ve(Y,"type","checkbox")},m(Oe,He){Me(Oe,e,He),xe(e,n),xe(n,r),xe(r,i),xe(n,a),xe(n,c),xe(c,l),xe(l,d),xe(n,S),xe(n,I),xe(I,T),xe(T,k),xe(n,U),xe(n,q),xe(q,ee),xe(ee,B),xe(n,J),xe(n,ae),xe(ae,me),xe(me,de),xe(e,$),xe(e,Ae),xe(Ae,Y),Y.checked=t[1],xe(Ae,oe),Ye||(ve=[Gt(i,"click",t[2]),Gt(l,"click",t[3]),Gt(T,"click",t[4]),Gt(ee,"click",t[5]),Gt(me,"click",t[6]),Gt(Y,"change",t[7])],Ye=!0)},p(Oe,[He]){He&1&&w!==(w=Oe[0].kind=="isochrone")&&(l.disabled=w),He&1&&D!==(D=Oe[0].kind=="route")&&(T.disabled=D),He&1&&j!==(j=Oe[0].kind=="score")&&(ee.disabled=j),He&1&&te!==(te=Oe[0].kind=="debug")&&(me.disabled=te),He&2&&(Y.checked=Oe[1])},i:et,o:et,d(Oe){Oe&&Le(e),Ye=!1,Mi(ve)}}}function V5(t,e,n){let r,i;Ct(t,$s,I=>n(0,r=I)),Ct(t,z0,I=>n(1,i=I));const a=()=>Zn($s,r={kind:"title"},r),c=()=>Zn($s,r={kind:"isochrone"},r),l=()=>Zn($s,r={kind:"route"},r),d=()=>Zn($s,r={kind:"score"},r),w=()=>Zn($s,r={kind:"debug"},r);function S(){i=this.checked,z0.set(i)}return[r,i,a,c,l,d,w,S]}class X_ extends Jt{constructor(e){super(),Kt(this,e,V5,B5,qt,{})}}function wS(t,e,n){const r=t.slice();return r[10]=e[n][0],r[11]=e[n][1],r[12]=e,r[13]=n,r}function U5(t){let e,n,r=t[0].join(", ")+"",i,a,c,l,d;return{c(){e=ke("p"),n=vt("Amenities: "),i=vt(r),a=nt(),c=ke("button"),c.textContent="Choose"},m(w,S){Me(w,e,S),xe(e,n),xe(e,i),Me(w,a,S),Me(w,c,S),l||(d=Gt(c,"click",t[6]),l=!0)},p(w,S){S&1&&r!==(r=w[0].join(", ")+"")&&An(i,r)},i:et,o:et,d(w){w&&(Le(e),Le(a),Le(c)),l=!1,d()}}}function G5(t){let e,n;return e=new Pv({props:{$$slots:{default:[j5,({dialog:r})=>({9:r}),({dialog:r})=>r?512:0]},$$scope:{ctx:t}}}),e.$on("close",t[5]),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&16898&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function SS(t){let e,n,r,i=t[10]+"",a,c,l=t[11].num+"",d,w,S,I;function T(){t[3].call(n,t[12],t[13])}return{c(){e=ke("label"),n=ke("input"),r=nt(),a=vt(i),c=vt(" ("),d=vt(l),w=vt(`) - `),Ve(n,"type","checkbox")},m(k,D){Me(k,e,D),xe(e,n),n.checked=t[11].enabled,xe(e,r),xe(e,a),xe(e,c),xe(e,d),xe(e,w),S||(I=Gt(n,"change",T),S=!0)},p(k,D){t=k,D&2&&(n.checked=t[11].enabled),D&2&&i!==(i=t[10]+"")&&An(a,i),D&2&&l!==(l=t[11].num+"")&&An(d,l)},d(k){k&&Le(e),S=!1,I()}}}function j5(t){let e,n,r,i,a,c,l,d,w,S,I=zr(t[1].entries()),T=[];for(let D=0;D{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),ye(n,1),n.m(r.parentNode,r))},i(d){i||(ye(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Le(r),c[e].d(d)}}}function W5(t,e){let n=[...t.entries()];n.sort((i,a)=>e(a[1])-e(i[1]));let r=new Map;for(let[i,a]of n)r.set(i,a);return r}function H5(t,e,n){let r;Ct(t,Ql,T=>n(7,r=T));let i=new Map,a=!1,{enabled:c}=e;Xu(async()=>{let T=await r.renderAmenities();for(let k of T.features){let D=k.properties.amenity_kind;i.has(D)?i.get(D).num+=1:i.set(D,{enabled:!1,num:1})}n(1,i=W5(i,k=>k.num))});function l(T){return[...i.entries()].filter(k=>k[1].enabled).map(k=>k[0])}function d(T,k){T[k][1].enabled=this.checked,n(1,i)}const w=T=>cs(T).close(),S=()=>n(2,a=!1),I=()=>n(2,a=!0);return t.$$set=T=>{"enabled"in T&&n(0,c=T.enabled)},t.$$.update=()=>{t.$$.dirty&2&&n(0,c=l())},[c,i,a,d,w,S,I]}class Z5 extends Jt{constructor(e){super(),Kt(this,e,H5,q5,qt,{enabled:0})}}function X5(t){let e,n,r,i,a,c,l,d,w;return{c(){e=ke("label"),n=vt(`Mode: - `),r=ke("select"),i=ke("option"),i.textContent="Car",a=ke("option"),a.textContent="Bicycle",c=ke("option"),c.textContent="Foot",l=ke("option"),l.textContent="Public transit",i.__value="car",Di(i,i.__value),a.__value="bicycle",Di(a,a.__value),c.__value="foot",Di(c,c.__value),l.__value="transit",Di(l,l.__value),t[0]===void 0&&Ld(()=>t[1].call(r))},m(S,I){Me(S,e,I),xe(e,n),xe(e,r),xe(r,i),xe(r,a),xe(r,c),xe(r,l),Ug(r,t[0],!0),d||(w=Gt(r,"change",t[1]),d=!0)},p(S,[I]){I&1&&Ug(r,S[0])},i:et,o:et,d(S){S&&Le(e),d=!1,w()}}}function Y5(t,e,n){let{travelMode:r}=e;function i(){r=pE(this),n(0,r)}return t.$$set=a=>{"travelMode"in a&&n(0,r=a.travelMode)},[r,i]}class I1 extends Jt{constructor(e){super(),Kt(this,e,Y5,X5,qt,{travelMode:0})}}const Zu=["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],K5=["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"];function J5(t){let e=t[2].population.toLocaleString()+"",n,r,i=Math.round(t[2].density).toLocaleString()+"",a,c;return{c(){n=vt(e),r=vt(" people live here ("),a=vt(i),c=vt(" people / square kilometer)")},m(l,d){Me(l,n,d),Me(l,r,d),Me(l,a,d),Me(l,c,d)},p(l,d){d&4&&e!==(e=l[2].population.toLocaleString()+"")&&An(n,e),d&4&&i!==(i=Math.round(l[2].density).toLocaleString()+"")&&An(a,i)},d(l){l&&(Le(n),Le(r),Le(a),Le(c))}}}function Q5(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[J5,({props:r})=>({2:r}),({props:r})=>r?4:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&12&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function $5(t){let e,n,r,i;return e=new E1({props:{manageHoverState:!0,paint:{"fill-color":Wc(["get","density"],t[1],K5),"fill-opacity":Hc(.2,.8)},$$slots:{default:[Q5]},$$scope:{ctx:t}}}),r=new lu({props:{paint:{"line-color":"black","line-width":1}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment)},m(a,c){rt(e,a,c),Me(a,n,c),rt(r,a,c),i=!0},p(a,c){const l={};c&8&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){i||(ye(e.$$.fragment,a),ye(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Le(n),it(e,a),it(r,a)}}}function ez(t){let e,n;return e=new qa({props:{data:t[0],generateId:!0,$$slots:{default:[$5]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&8&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function tz(t,e,n){let{gj:r}=e,i=Array.from(Array(6).keys()).map(a=>r.max_density/(6-1)*a);return t.$$set=a=>{"gj"in a&&n(0,r=a.gj)},[r,i]}class nz extends Jt{constructor(e){super(),Kt(this,e,tz,ez,qt,{gj:0})}}function ES(t,e,n){const r=t.slice();return r[3]=e[n],r}function rz(t){let e=t[6].name+"",n,r,i=JSON.parse(t[6].next_steps).length+"",a,c;return{c(){n=vt(e),r=vt(" has "),a=vt(i),c=vt(" next steps (arrivals)")},m(l,d){Me(l,n,d),Me(l,r,d),Me(l,a,d),Me(l,c,d)},p(l,d){d&64&&e!==(e=l[6].name+"")&&An(n,e),d&64&&i!==(i=JSON.parse(l[6].next_steps).length+"")&&An(a,i)},d(l){l&&(Le(n),Le(r),Le(a),Le(c))}}}function iz(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[rz,({props:r})=>({6:r}),({props:r})=>r?64:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&192&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function IS(t){let e,n;return e=new Pv({props:{$$slots:{default:[oz]},$$scope:{ctx:t}}}),e.$on("close",t[2]),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&129&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function CS(t){let e,n=JSON.stringify(t[3])+"",r;return{c(){e=ke("p"),r=vt(n)},m(i,a){Me(i,e,a),xe(e,r)},p(i,a){a&1&&n!==(n=JSON.stringify(i[3])+"")&&An(r,n)},d(i){i&&Le(e)}}}function oz(t){let e,n=zr(t[0]),r=[];for(let i=0;i{a=null}),Pn())},i(c){i||(ye(e.$$.fragment,c),ye(a),i=!0)},o(c){Se(e.$$.fragment,c),Se(a),i=!1},d(c){c&&(Le(n),Le(r)),it(e,c),a&&a.d(c)}}}function az(t,e,n){let r=null;return[r,c=>n(0,r=JSON.parse(cs(c.detail.features[0].properties).next_steps)),()=>n(0,r=null)]}class lz extends Jt{constructor(e){super(),Kt(this,e,az,sz,qt,{})}}function uz(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ye(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function TS(t){let e,n;return e=new qC({props:{gj:t[0]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.gj=r[0]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function cz(t){let e,n,r,i,a,c,l,d,w;function S(k){t[3](k)}let I={};t[1]!==void 0&&(I.travelMode=t[1]),c=new I1({props:I}),Gn.push(()=>Yi(c,"travelMode",S));let T=t[0]&&TS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debug mode",r=nt(),i=ke("p"),i.textContent="Hover to see a segment's properties, and click to open OSM",a=nt(),ot(c.$$.fragment),d=nt(),T&&T.c(),Ve(e,"slot","sidebar")},m(k,D){Me(k,e,D),xe(e,n),xe(e,r),xe(e,i),xe(e,a),rt(c,e,null),xe(e,d),T&&T.m(e,null),w=!0},p(k,D){const U={};!l&&D&2&&(l=!0,U.travelMode=k[1],Xi(()=>l=!1)),c.$set(U),k[0]?T?(T.p(k,D),D&1&&ye(T,1)):(T=TS(k),T.c(),ye(T,1),T.m(e,null)):T&&(Ln(),Se(T,1,1,()=>{T=null}),Pn())},i(k){w||(ye(c.$$.fragment,k),ye(T),w=!0)},o(k){Se(c.$$.fragment,k),Se(T),w=!1},d(k){k&&Le(e),it(c),T&&T.d()}}}function LS(t){let e,n;return e=new qa({props:{data:t[0],generateId:!0,$$slots:{default:[pz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.data=r[0]),i&66&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function hz(t){let e,n;return e=new Mv({props:{properties:t[5]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.properties=r[5]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function fz(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[hz,({props:r})=>({5:r}),({props:r})=>r?32:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&96&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function pz(t){let e,n,r,i,a,c;return e=new lu({props:{id:"network",paint:{"line-width":Hc(5,7),"line-color":"black"},filter:bx(t[1]),manageHoverState:!0,hoverCursor:"pointer",eventsIfTopMost:!0,$$slots:{default:[fz]},$$scope:{ctx:t}}}),e.$on("click",t[2]),r=new jC({props:{popups:!0}}),a=new lz({}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment)},m(l,d){rt(e,l,d),Me(l,n,d),rt(r,l,d),Me(l,i,d),rt(a,l,d),c=!0},p(l,d){const w={};d&2&&(w.filter=bx(l[1])),d&64&&(w.$$scope={dirty:d,ctx:l}),e.$set(w)},i(l){c||(ye(e.$$.fragment,l),ye(r.$$.fragment,l),ye(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Le(n),Le(i)),it(e,l),it(r,l),it(a,l)}}}function dz(t){let e,n,r=t[0]&&LS(t);return{c(){e=ke("div"),r&&r.c(),Ve(e,"slot","map")},m(i,a){Me(i,e,a),r&&r.m(e,null),n=!0},p(i,a){i[0]?r?(r.p(i,a),a&1&&ye(r,1)):(r=LS(i),r.c(),ye(r,1),r.m(e,null)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d()}}}function mz(t){let e,n;return e=new rp({props:{$$slots:{map:[dz],sidebar:[cz],top:[uz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&67&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function gz(t,e,n){let r,i;Ct(t,Ql,d=>n(4,r=d)),Ct(t,vf,d=>n(1,i=d));let a=null;Xu(async()=>{n(0,a=await r.renderDebug())});const c=d=>window.open(cs(d.detail.features[0].properties).way,"_blank");function l(d){i=d,vf.set(i)}return[a,i,c,l]}class _z extends Jt{constructor(e){super(),Kt(this,e,gz,mz,qt,{})}}function yz(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ye(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function PS(t){let e,n=Zg(t[2])+"",r,i,a=t[2].properties.amenity_kind+"",c,l;return{c(){e=ke("span"),r=vt(n),i=vt(" ("),c=vt(a),l=vt(")")},m(d,w){Me(d,e,w),xe(e,r),xe(e,i),xe(e,c),xe(e,l)},p(d,w){w&4&&n!==(n=Zg(d[2])+"")&&An(r,n),w&4&&a!==(a=d[2].properties.amenity_kind+"")&&An(c,a)},d(d){d&&Le(e)}}}function MS(t){let e,n;return{c(){e=ke("p"),n=vt(t[7])},m(r,i){Me(r,e,i),xe(e,n)},p(r,i){i&128&&An(n,r[7])},d(r){r&&Le(e)}}}function AS(t){let e,n;return e=new qC({props:{gj:t[5]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.gj=r[5]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function vz(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,q,ee,B,j,J,ae,me,de,te,$=t[2]&&PS(t);function Ae(ve){t[12](ve)}let Y={};t[4]!==void 0&&(Y.travelMode=t[4]),l=new I1({props:Y}),Gn.push(()=>Yi(l,"travelMode",Ae)),j=new _E({props:{colorScale:Zu,limits:t[8]}});let oe=t[7]&&MS(t),Ye=t[5]&&AS(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Isochrone mode",r=nt(),i=ke("p"),i.textContent=`Move the pin to calculate an isochrone from that start. The cost is time - in seconds.`,a=nt(),$&&$.c(),c=nt(),ot(l.$$.fragment),w=nt(),S=ke("label"),I=vt(`Start time (PT only) - `),T=ke("input"),D=nt(),U=ke("label"),q=ke("input"),ee=vt("Contours"),B=nt(),ot(j.$$.fragment),J=nt(),oe&&oe.c(),ae=nt(),Ye&&Ye.c(),Ve(T,"type","time"),T.disabled=k=t[4]!="transit",Ve(q,"type","checkbox"),Ve(e,"slot","sidebar")},m(ve,Oe){Me(ve,e,Oe),xe(e,n),xe(e,r),xe(e,i),xe(e,a),$&&$.m(e,null),xe(e,c),rt(l,e,null),xe(e,w),xe(e,S),xe(S,I),xe(S,T),Di(T,t[3]),xe(e,D),xe(e,U),xe(U,q),q.checked=t[1],xe(U,ee),xe(e,B),rt(j,e,null),xe(e,J),oe&&oe.m(e,null),xe(e,ae),Ye&&Ye.m(e,null),me=!0,de||(te=[Gt(T,"input",t[13]),Gt(q,"change",t[14])],de=!0)},p(ve,Oe){ve[2]?$?$.p(ve,Oe):($=PS(ve),$.c(),$.m(e,c)):$&&($.d(1),$=null);const He={};!d&&Oe&16&&(d=!0,He.travelMode=ve[4],Xi(()=>d=!1)),l.$set(He),(!me||Oe&16&&k!==(k=ve[4]!="transit"))&&(T.disabled=k),Oe&8&&Di(T,ve[3]),Oe&2&&(q.checked=ve[1]),ve[7]?oe?oe.p(ve,Oe):(oe=MS(ve),oe.c(),oe.m(e,ae)):oe&&(oe.d(1),oe=null),ve[5]?Ye?(Ye.p(ve,Oe),Oe&32&&ye(Ye,1)):(Ye=AS(ve),Ye.c(),ye(Ye,1),Ye.m(e,null)):Ye&&(Ln(),Se(Ye,1,1,()=>{Ye=null}),Pn())},i(ve){me||(ye(l.$$.fragment,ve),ye(j.$$.fragment,ve),ye(Ye),me=!0)},o(ve){Se(l.$$.fragment,ve),Se(j.$$.fragment,ve),Se(Ye),me=!1},d(ve){ve&&Le(e),$&&$.d(),it(l),it(j),oe&&oe.d(),Ye&&Ye.d(),de=!1,Mi(te)}}}function kS(t){let e,n,r;function i(c){t[10](c)}let a={draggable:!0,$$slots:{default:[bz]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.lngLat=t[0]),e=new Zd({props:a}),Gn.push(()=>Yi(e,"lngLat",i)),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,l){const d={};l&524288&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.lngLat=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function bz(t){let e;return{c(){e=ke("span"),e.textContent="X",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function DS(t){let e,n;return e=new qa({props:{data:t[5],generateId:!0,$$slots:{default:[Sz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&524292&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function xz(t){let e=(t[18].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=vt(e),r=vt(" minutes away")},m(i,a){Me(i,n,a),Me(i,r,a)},p(i,a){a&262144&&e!==(e=(i[18].cost_seconds/60).toFixed(1)+"")&&An(n,e)},d(i){i&&(Le(n),Le(r))}}}function wz(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[xz,({props:r})=>({18:r}),({props:r})=>r?262144:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&786432&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Sz(t){let e,n,r,i,a,c,l;e=new lu({props:{id:"isochrone",filter:IO,paint:{"line-width":2,"line-color":Wc(["get","cost_seconds"],t[9],Zu),"line-opacity":.5},eventsIfTopMost:!0,$$slots:{default:[wz]},$$scope:{ctx:t}}}),r=new E1({props:{id:"isochrone-contours",filter:EO,paint:{"fill-color":Wc(["get","min_seconds"],t[9],Zu),"fill-opacity":.5}}});function d(S){t[11](S)}let w={};return t[2]!==void 0&&(w.hovered=t[2]),a=new jC({props:w}),Gn.push(()=>Yi(a,"hovered",d)),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment)},m(S,I){rt(e,S,I),Me(S,n,I),rt(r,S,I),Me(S,i,I),rt(a,S,I),l=!0},p(S,I){const T={};I&524288&&(T.$$scope={dirty:I,ctx:S}),e.$set(T);const k={};!c&&I&4&&(c=!0,k.hovered=S[2],Xi(()=>c=!1)),a.$set(k)},i(S){l||(ye(e.$$.fragment,S),ye(r.$$.fragment,S),ye(a.$$.fragment,S),l=!0)},o(S){Se(e.$$.fragment,S),Se(r.$$.fragment,S),Se(a.$$.fragment,S),l=!1},d(S){S&&(Le(n),Le(i)),it(e,S),it(r,S),it(a,S)}}}function RS(t){let e,n;return e=new qa({props:{data:t[6],$$slots:{default:[Ez]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&524288&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Ez(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Iz(t){let e,n,r,i,a=t[0]&&kS(t),c=t[5]&&DS(t),l=t[6]&&RS(t);return{c(){e=ke("div"),a&&a.c(),n=nt(),c&&c.c(),r=nt(),l&&l.c(),Ve(e,"slot","map")},m(d,w){Me(d,e,w),a&&a.m(e,null),xe(e,n),c&&c.m(e,null),xe(e,r),l&&l.m(e,null),i=!0},p(d,w){d[0]?a?(a.p(d,w),w&1&&ye(a,1)):(a=kS(d),a.c(),ye(a,1),a.m(e,n)):a&&(Ln(),Se(a,1,1,()=>{a=null}),Pn()),d[5]?c?(c.p(d,w),w&32&&ye(c,1)):(c=DS(d),c.c(),ye(c,1),c.m(e,r)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),d[6]?l?(l.p(d,w),w&64&&ye(l,1)):(l=RS(d),l.c(),ye(l,1),l.m(e,null)):l&&(Ln(),Se(l,1,1,()=>{l=null}),Pn())},i(d){i||(ye(a),ye(c),ye(l),i=!0)},o(d){Se(a),Se(c),Se(l),i=!1},d(d){d&&Le(e),a&&a.d(),c&&c.d(),l&&l.d()}}}function Cz(t){let e,n;return e=new rp({props:{$$slots:{map:[Iz],sidebar:[vz],top:[yz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&524543&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function NS(t,e,n){return e+t*(n-e)}function Tz(t,e,n){let r,i,a;Ct(t,Hg,ae=>n(3,r=ae)),Ct(t,vf,ae=>n(4,i=ae)),Ct(t,Ql,ae=>n(15,a=ae));let c=null;Xu(async()=>{let ae=await a.getBounds();n(0,c={lng:NS(.5,ae[0],ae[2]),lat:NS(.5,ae[1],ae[3])})});let l=!1,d=null,w=null,S="",I;async function T(ae,me,de,te){if(c)try{n(5,d=await a.isochrone({start:c,mode:i,contours:l,startTime:r})),n(7,S="")}catch($){n(5,d=null),$=$.toString()}}async function k(ae,me,de){if(c&&I)try{n(6,w=await a.route({start:c,end:I.geometry.coordinates,mode:i,debugSearch:!1,useHeuristic:!1,startTime:r})),n(7,S="")}catch(te){n(6,w=null),te=te.toString()}else n(6,w=null)}let D=[0,3,6,9,12,15],U=D.map(ae=>ae*60);function q(ae){c=ae,n(0,c)}function ee(ae){I=ae,n(2,I)}function B(ae){i=ae,vf.set(i)}function j(){r=this.value,Hg.set(r)}function J(){l=this.checked,n(1,l)}return t.$$.update=()=>{t.$$.dirty&27&&T(),t.$$.dirty&13&&k()},[c,l,I,r,i,d,w,S,D,U,q,ee,B,j,J]}class Lz extends Jt{constructor(e){super(),Kt(this,e,Tz,Cz,qt,{})}}function OS(t,e,n){const r=t.slice();r[23]=e[n];const i=cs(r[23].properties);return r[22]=i,r}function Pz(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ye(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function Mz(t){let e,n,r,i,a,c,l,d=!t[6]&&zS(t);return{c(){e=ke("button"),n=vt("Watch how this route was found (PT only)"),i=nt(),d&&d.c(),a=ur(),e.disabled=r=t[5]!="transit"},m(w,S){Me(w,e,S),xe(e,n),Me(w,i,S),d&&d.m(w,S),Me(w,a,S),c||(l=Gt(e,"click",t[11]),c=!0)},p(w,S){S&32&&r!==(r=w[5]!="transit")&&(e.disabled=r),w[6]?d&&(d.d(1),d=null):d?d.p(w,S):(d=zS(w),d.c(),d.m(a.parentNode,a))},d(w){w&&(Le(e),Le(i),Le(a)),d&&d.d(w),c=!1,l()}}}function Az(t){let e,n;return{c(){e=ke("p"),n=vt(t[8])},m(r,i){Me(r,e,i),xe(e,n)},p(r,i){i&256&&An(n,r[8])},d(r){r&&Le(e)}}}function zS(t){let e,n=zr(t[7].features),r=[];for(let i=0;iYi(i,"travelMode",Y));function Ye(He,Ge){if(He[8])return Az;if(He[7])return Mz}let ve=Ye(t),Oe=ve&&ve(t);return{c(){e=ke("div"),n=ke("h2"),n.textContent="Route mode",r=nt(),ot(i.$$.fragment),c=nt(),l=ke("label"),d=ke("input"),S=vt(` - Use heuristic (PT only)`),I=nt(),T=ke("label"),k=vt(`Start time (PT only) - `),D=ke("input"),q=nt(),ee=ke("label"),B=ke("input"),j=vt(` - Buffer around route - `),J=ke("input"),ae=nt(),me=ke("p"),me.innerHTML=`Move the A and B pins to find a route. (Hint: right-click to - set the first pin somewhere.)`,de=nt(),Oe&&Oe.c(),Ve(d,"type","checkbox"),d.disabled=w=t[5]!="transit",Ve(D,"type","time"),D.disabled=U=t[5]!="transit",Ve(B,"type","checkbox"),Ve(J,"type","number"),Ve(J,"min","1"),Ve(J,"max","30"),Ve(e,"slot","sidebar")},m(He,Ge){Me(He,e,Ge),xe(e,n),xe(e,r),rt(i,e,null),xe(e,c),xe(e,l),xe(l,d),d.checked=t[4],xe(l,S),xe(e,I),xe(e,T),xe(T,k),xe(T,D),Di(D,t[3]),xe(e,q),xe(e,ee),xe(ee,B),B.checked=t[6],xe(ee,j),xe(ee,J),Di(J,t[0]),xe(e,ae),xe(e,me),xe(e,de),Oe&&Oe.m(e,null),te=!0,$||(Ae=[Gt(d,"change",t[15]),Gt(D,"input",t[16]),Gt(B,"change",t[17]),Gt(J,"input",t[18])],$=!0)},p(He,Ge){const Rt={};!a&&Ge&32&&(a=!0,Rt.travelMode=He[5],Xi(()=>a=!1)),i.$set(Rt),(!te||Ge&32&&w!==(w=He[5]!="transit"))&&(d.disabled=w),Ge&16&&(d.checked=He[4]),(!te||Ge&32&&U!==(U=He[5]!="transit"))&&(D.disabled=U),Ge&8&&Di(D,He[3]),Ge&64&&(B.checked=He[6]),Ge&1&&Kd(J.value)!==He[0]&&Di(J,He[0]),ve===(ve=Ye(He))&&Oe?Oe.p(He,Ge):(Oe&&Oe.d(1),Oe=ve&&ve(He),Oe&&(Oe.c(),Oe.m(e,null)))},i(He){te||(ye(i.$$.fragment,He),te=!0)},o(He){Se(i.$$.fragment,He),te=!1},d(He){He&&Le(e),it(i),Oe&&Oe.d(),$=!1,Mi(Ae)}}}function zz(t){let e;return{c(){e=ke("span"),e.textContent="A",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function Fz(t){let e;return{c(){e=ke("span"),e.textContent="B",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function BS(t){let e,n;return e=new qa({props:{data:t[7],generateId:!0,$$slots:{default:[Zz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&128&&(a.data=r[7]),i&67109440&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Bz(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":20,"line-color":x1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":Hc(.5,1)},manageHoverState:!0,$$slots:{default:[Gz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&67108864&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Vz(t){let e,n;return e=new lu({props:{paint:{"line-width":["case",["==",["get","kind"],"route"],20,3],"line-color":["case",["==",["get","kind"],"route"],"red",Wc(["get","cost_seconds"],t[9],Zu)],"line-opacity":.5},$$slots:{default:[Hz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&512&&(a.paint={"line-width":["case",["==",["get","kind"],"route"],20,3],"line-color":["case",["==",["get","kind"],"route"],"red",Wc(["get","cost_seconds"],r[9],Zu)],"line-opacity":.5}),i&67108864&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Uz(t){let e,n;return e=new Mv({props:{properties:t[22]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&4194304&&(a.properties=r[22]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Gz(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[Uz,({props:r})=>({22:r}),({props:r})=>r?4194304:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&71303168&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function jz(t){let e;return{c(){e=vt("part of the route")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function qz(t){let e=(t[22].cost_seconds/60).toFixed(1)+"",n,r;return{c(){n=vt(e),r=vt(" minutes away")},m(i,a){Me(i,n,a),Me(i,r,a)},p(i,a){a&4194304&&e!==(e=(i[22].cost_seconds/60).toFixed(1)+"")&&An(n,e)},d(i){i&&(Le(n),Le(r))}}}function Wz(t){let e;function n(a,c){return a[22].kind=="buffer"?qz:jz}let r=n(t),i=r(t);return{c(){i.c(),e=ur()},m(a,c){i.m(a,c),Me(a,e,c)},p(a,c){r===(r=n(a))&&i?i.p(a,c):(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){a&&Le(e),i.d(a)}}}function Hz(t){let e,n;return e=new th({props:{openOn:"hover",$$slots:{default:[Wz,({props:r})=>({22:r}),({props:r})=>r?4194304:0]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&71303168&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Zz(t){let e,n,r,i;const a=[Vz,Bz],c=[];function l(d,w){return d[6]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=ur()},m(d,w){c[e].m(d,w),Me(d,r,w),i=!0},p(d,w){let S=e;e=l(d),e===S?c[e].p(d,w):(Ln(),Se(c[S],1,1,()=>{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),ye(n,1),n.m(r.parentNode,r))},i(d){i||(ye(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Le(r),c[e].d(d)}}}function Xz(t){let e,n,r,i,a,c,l,d,w,S;n=new e5({}),n.$on("contextmenu",t[10]);function I(q){t[12](q)}let T={draggable:!0,$$slots:{default:[zz]},$$scope:{ctx:t}};t[2]!==void 0&&(T.lngLat=t[2]),i=new Zd({props:T}),Gn.push(()=>Yi(i,"lngLat",I));function k(q){t[13](q)}let D={draggable:!0,$$slots:{default:[Fz]},$$scope:{ctx:t}};t[1]!==void 0&&(D.lngLat=t[1]),l=new Zd({props:D}),Gn.push(()=>Yi(l,"lngLat",k));let U=t[7]&&BS(t);return{c(){e=ke("div"),ot(n.$$.fragment),r=nt(),ot(i.$$.fragment),c=nt(),ot(l.$$.fragment),w=nt(),U&&U.c(),Ve(e,"slot","map")},m(q,ee){Me(q,e,ee),rt(n,e,null),xe(e,r),rt(i,e,null),xe(e,c),rt(l,e,null),xe(e,w),U&&U.m(e,null),S=!0},p(q,ee){const B={};ee&67108864&&(B.$$scope={dirty:ee,ctx:q}),!a&&ee&4&&(a=!0,B.lngLat=q[2],Xi(()=>a=!1)),i.$set(B);const j={};ee&67108864&&(j.$$scope={dirty:ee,ctx:q}),!d&&ee&2&&(d=!0,j.lngLat=q[1],Xi(()=>d=!1)),l.$set(j),q[7]?U?(U.p(q,ee),ee&128&&ye(U,1)):(U=BS(q),U.c(),ye(U,1),U.m(e,null)):U&&(Ln(),Se(U,1,1,()=>{U=null}),Pn())},i(q){S||(ye(n.$$.fragment,q),ye(i.$$.fragment,q),ye(l.$$.fragment,q),ye(U),S=!0)},o(q){Se(n.$$.fragment,q),Se(i.$$.fragment,q),Se(l.$$.fragment,q),Se(U),S=!1},d(q){q&&Le(e),it(n),it(i),it(l),U&&U.d()}}}function Yz(t){let e,n;return e=new rp({props:{$$slots:{map:[Xz],sidebar:[Oz],top:[Pz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&67109887&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function Kz(t,e,n){let r,i,a,c,l,d,w,S,I,T;Ct(t,Sx,$=>n(0,i=$)),Ct(t,bf,$=>n(1,a=$)),Ct(t,Lc,$=>n(2,c=$)),Ct(t,$s,$=>n(19,l=$)),Ct(t,Hg,$=>n(3,d=$)),Ct(t,xx,$=>n(4,w=$)),Ct(t,vf,$=>n(5,S=$)),Ct(t,Ql,$=>n(20,I=$)),Ct(t,wx,$=>n(6,T=$));let k=null,D="";async function U($,Ae,Y,oe,Ye,ve,Oe){try{T?n(7,k=await I.bufferRoute({start:c,end:[a.lng,a.lat],mode:S,useHeuristic:w,startTime:d,maxSeconds:i*60})):n(7,k=await I.route({start:$,end:[Ae.lng,Ae.lat],mode:Y,debugSearch:!1,useHeuristic:w,startTime:d})),n(8,D="")}catch(He){n(7,k=null),n(8,D=He.toString())}}function q($){Zn(Lc,c=$.detail.lngLat,c)}async function ee(){try{let $=await I.route({start:c,end:[a.lng,a.lat],mode:S,debugSearch:!0,useHeuristic:w,startTime:d});Zn($s,l={kind:"debug-route",debugGj:$,start:c,end:a,routeGj:k},l)}catch($){n(8,D=$.toString())}}function B($){c=$,Lc.set(c)}function j($){a=$,bf.set(a)}function J($){S=$,vf.set(S)}function ae(){w=this.checked,xx.set(w)}function me(){d=this.value,Hg.set(d)}function de(){T=this.checked,wx.set(T)}function te(){i=Kd(this.value),Sx.set(i)}return t.$$.update=()=>{t.$$.dirty&127&&U(c,a,S),t.$$.dirty&1&&n(9,r=Array.from(Array(6).keys()).map($=>i*60/(6-1)*$))},[i,a,c,d,w,S,T,k,D,r,q,ee,B,j,J,ae,me,de,te]}class Jz extends Jt{constructor(e){super(),Kt(this,e,Kz,Yz,qt,{})}}function Qz(t){let e,n,r,i;return{c(){e=ke("div"),n=ke("button"),n.textContent="Back",Ve(e,"slot","top")},m(a,c){Me(a,e,c),xe(e,n),r||(i=Gt(n,"click",t[10]),r=!0)},p:et,d(a){a&&Le(e),r=!1,i()}}}function $z(t){let e,n,r,i,a,c,l,d,w,S=cs(t[4].features[t[4].features.length-1].properties).time+"",I,T,k;return{c(){e=ke("div"),n=ke("h2"),n.textContent="Debugging a route",r=nt(),i=ke("p"),i.textContent=`${t[6]} total nodes searched`,a=nt(),c=ke("input"),l=nt(),d=ke("p"),w=vt("Search is currently at "),I=vt(S),Ve(c,"type","range"),Ve(c,"min","1"),Ve(c,"max",t[6]),Ve(e,"slot","sidebar")},m(D,U){Me(D,e,U),xe(e,n),xe(e,r),xe(e,i),xe(e,a),xe(e,c),Di(c,t[3]),xe(e,l),xe(e,d),xe(d,w),xe(d,I),T||(k=[Gt(c,"change",t[9]),Gt(c,"input",t[9])],T=!0)},p(D,U){U&8&&Di(c,D[3]),U&16&&S!==(S=cs(D[4].features[D[4].features.length-1].properties).time+"")&&An(I,S)},d(D){D&&Le(e),T=!1,Mi(k)}}}function e6(t){let e;return{c(){e=ke("span"),e.textContent="A",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function t6(t){let e;return{c(){e=ke("span"),e.textContent="B",Ve(e,"class","dot svelte-1ej0v4r")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function n6(t){let e,n;return e=new lu({props:{paint:{"line-width":20,"line-color":x1(["get","kind"],{road:"cyan",transit:"purple"},"red"),"line-opacity":.5}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function r6(t){let e,n,r,i;return e=new Z_({props:{paint:{"circle-radius":5,"circle-color":"black"}}}),r=new lu({props:{paint:{"line-width":5,"line-color":x1(["get","kind"],{road:"black",transit:"orange"},"red")}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment)},m(a,c){rt(e,a,c),Me(a,n,c),rt(r,a,c),i=!0},p:et,i(a){i||(ye(e.$$.fragment,a),ye(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Le(n),it(e,a),it(r,a)}}}function i6(t){let e,n,r,i,a,c,l,d,w;return n=new Zd({props:{lngLat:t[0],$$slots:{default:[e6]},$$scope:{ctx:t}}}),i=new Zd({props:{lngLat:t[1],$$slots:{default:[t6]},$$scope:{ctx:t}}}),c=new qa({props:{data:t[2],$$slots:{default:[n6]},$$scope:{ctx:t}}}),d=new qa({props:{data:t[4],generateId:!0,$$slots:{default:[r6]},$$scope:{ctx:t}}}),{c(){e=ke("div"),ot(n.$$.fragment),r=nt(),ot(i.$$.fragment),a=nt(),ot(c.$$.fragment),l=nt(),ot(d.$$.fragment),Ve(e,"slot","map")},m(S,I){Me(S,e,I),rt(n,e,null),xe(e,r),rt(i,e,null),xe(e,a),rt(c,e,null),xe(e,l),rt(d,e,null),w=!0},p(S,I){const T={};I&1&&(T.lngLat=S[0]),I&4096&&(T.$$scope={dirty:I,ctx:S}),n.$set(T);const k={};I&2&&(k.lngLat=S[1]),I&4096&&(k.$$scope={dirty:I,ctx:S}),i.$set(k);const D={};I&4&&(D.data=S[2]),I&4096&&(D.$$scope={dirty:I,ctx:S}),c.$set(D);const U={};I&16&&(U.data=S[4]),I&4096&&(U.$$scope={dirty:I,ctx:S}),d.$set(U)},i(S){w||(ye(n.$$.fragment,S),ye(i.$$.fragment,S),ye(c.$$.fragment,S),ye(d.$$.fragment,S),w=!0)},o(S){Se(n.$$.fragment,S),Se(i.$$.fragment,S),Se(c.$$.fragment,S),Se(d.$$.fragment,S),w=!1},d(S){S&&Le(e),it(n),it(i),it(c),it(d)}}}function o6(t){let e,n,r,i;return e=new rp({props:{$$slots:{map:[i6],sidebar:[$z],top:[Qz]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(a,c){rt(e,a,c),n=!0,r||(i=Gt(window,"keydown",t[7]),r=!0)},p(a,[c]){const l={};c&4159&&(l.$$scope={dirty:c,ctx:a}),e.$set(l)},i(a){n||(ye(e.$$.fragment,a),n=!0)},o(a){Se(e.$$.fragment,a),n=!1},d(a){it(e,a),r=!1,i()}}}function s6(t,e,n){let r,i,a;Ct(t,I_,U=>n(11,i=U)),Ct(t,$s,U=>n(5,a=U));let{debugGj:c}=e,{start:l}=e,{end:d}=e,{routeGj:w}=e,S=c.features.length/2,I=1;function T(U){U.key=="ArrowLeft"&&I>1&&(U.stopPropagation(),n(3,I--,I)),U.key=="ArrowRight"&&I{i==null||i.keyboard.disable()}),us(()=>{i==null||i.keyboard.enable()});function k(){I=Kd(this.value),n(3,I)}const D=()=>Zn($s,a={kind:"route"},a);return t.$$set=U=>{"debugGj"in U&&n(8,c=U.debugGj),"start"in U&&n(0,l=U.start),"end"in U&&n(1,d=U.end),"routeGj"in U&&n(2,w=U.routeGj)},t.$$.update=()=>{t.$$.dirty&264&&n(4,r={type:"FeatureCollection",features:c.features.slice(0,2*I)})},[l,d,w,I,r,a,S,T,c,k,D]}class a6 extends Jt{constructor(e){super(),Kt(this,e,s6,o6,qt,{debugGj:8,start:0,end:1,routeGj:2})}}function VS(t){let e,n;return e=new WC({props:{loading:t[3]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&8&&(a.loading=r[3]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function l6(t){let e,n,r;return n=new X_({}),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"slot","top")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ye(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function US(t){let e,n,r=t[2].properties.poi+"",i,a,c=t[2].properties.cost+"",l,d;return{c(){e=ke("span"),n=vt("From "),i=vt(r),a=vt(", it's "),l=vt(c),d=vt(" seconds to the nearest parking")},m(w,S){Me(w,e,S),xe(e,n),xe(e,i),xe(e,a),xe(e,l),xe(e,d)},p(w,S){S&4&&r!==(r=w[2].properties.poi+"")&&An(i,r),S&4&&c!==(c=w[2].properties.cost+"")&&An(l,c)},d(w){w&&Le(e)}}}function u6(t){let e,n,r,i,a,c,l,d,w,S,I,T,k,D,U,q,ee,B,j,J,ae,me,de,te=t[2]&&US(t);function $(Y){t[10](Y)}let Ae={};return t[1]!==void 0&&(Ae.enabled=t[1]),a=new Z5({props:Ae}),Gn.push(()=>Yi(a,"enabled",$)),d=new _E({props:{colorScale:Zu,limits:t[7]}}),{c(){e=ke("div"),n=ke("h2"),n.textContent="Score mode",r=nt(),te&&te.c(),i=nt(),ot(a.$$.fragment),l=nt(),ot(d.$$.fragment),w=nt(),S=ke("label"),I=ke("input"),T=vt(` - Max time (seconds)`),k=nt(),D=ke("label"),U=ke("input"),q=vt(` - Show parking`),ee=nt(),B=ke("p"),B.textContent=`This is an early experiment of a mode to show an "access score". Right - now, it's starting from every POI chosen and walking up to some time to - the nearest bicycle parking. This is a simple way of showing POIs without - any nearby parking. Note the granularity of results is poor; the search - begins and ends at the nearest intersection, and the time to walk doesn't - take into account the side of the road or walking partly down some road.`,j=nt(),J=ke("p"),J.innerHTML='Parking icon from OpenStreetMap Carto',Ve(I,"type","number"),Ve(U,"type","checkbox"),Ve(e,"slot","sidebar")},m(Y,oe){Me(Y,e,oe),xe(e,n),xe(e,r),te&&te.m(e,null),xe(e,i),rt(a,e,null),xe(e,l),rt(d,e,null),xe(e,w),xe(e,S),xe(S,I),Di(I,t[0]),xe(S,T),xe(e,k),xe(e,D),xe(D,U),U.checked=t[4],xe(D,q),xe(e,ee),xe(e,B),xe(e,j),xe(e,J),ae=!0,me||(de=[Gt(I,"input",t[11]),Gt(U,"change",t[12])],me=!0)},p(Y,oe){Y[2]?te?te.p(Y,oe):(te=US(Y),te.c(),te.m(e,i)):te&&(te.d(1),te=null);const Ye={};!c&&oe&2&&(c=!0,Ye.enabled=Y[1],Xi(()=>c=!1)),a.$set(Ye);const ve={};oe&128&&(ve.limits=Y[7]),d.$set(ve),oe&1&&Kd(I.value)!==Y[0]&&Di(I,Y[0]),oe&16&&(U.checked=Y[4])},i(Y){ae||(ye(a.$$.fragment,Y),ye(d.$$.fragment,Y),ae=!0)},o(Y){Se(a.$$.fragment,Y),Se(d.$$.fragment,Y),ae=!1},d(Y){Y&&Le(e),te&&te.d(),it(a),it(d),me=!1,Mi(de)}}}function GS(t){let e,n;return e=new qa({props:{data:t[5],generateId:!0,$$slots:{default:[c6]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.data=r[5]),i&131204&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function c6(t){let e,n,r;function i(c){t[9](c)}let a={paint:{"circle-radius":15,"circle-color":Wc(["get","cost"],t[7],Zu),"circle-stroke-width":Hc(1,3),"circle-stroke-color":"black"},manageHoverState:!0};return t[2]!==void 0&&(a.hovered=t[2]),e=new Z_({props:a}),Gn.push(()=>Yi(e,"hovered",i)),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,l){const d={};l&128&&(d.paint={"circle-radius":15,"circle-color":Wc(["get","cost"],c[7],Zu),"circle-stroke-width":Hc(1,3),"circle-stroke-color":"black"}),!n&&l&4&&(n=!0,d.hovered=c[2],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function jS(t){let e,n;return e=new qa({props:{data:t[6],$$slots:{default:[h6]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[6]),i&131072&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function h6(t){let e,n;return e=new lu({props:{id:"route",paint:{"line-width":10,"line-color":"red"}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function f6(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function p6(t){let e,n;return e=new qa({props:{data:t[16],$$slots:{default:[d6]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&256&&(a.data=r[16]),i&131088&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function d6(t){let e,n;return e=new v5({props:{filter:["==",["get","amenity_kind"],"bicycle_parking"],layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:t[4]?"visible":"none"}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&16&&(a.layout={"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[4]?"visible":"none"}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function m6(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function g6(t){let e,n,r,i,a,c=t[5]&&GS(t),l=t[6]&&jS(t),d={ctx:t,current:null,token:null,hasCatch:!1,pending:m6,then:p6,catch:f6,value:16,blocks:[,,,]};return yf(i=cs(t[8]).renderAmenities(),d),{c(){e=ke("div"),c&&c.c(),n=nt(),l&&l.c(),r=nt(),d.block.c(),Ve(e,"slot","map")},m(w,S){Me(w,e,S),c&&c.m(e,null),xe(e,n),l&&l.m(e,null),xe(e,r),d.block.m(e,d.anchor=null),d.mount=()=>e,d.anchor=null,a=!0},p(w,S){t=w,t[5]?c?(c.p(t,S),S&32&&ye(c,1)):(c=GS(t),c.c(),ye(c,1),c.m(e,n)):c&&(Ln(),Se(c,1,1,()=>{c=null}),Pn()),t[6]?l?(l.p(t,S),S&64&&ye(l,1)):(l=jS(t),l.c(),ye(l,1),l.m(e,r)):l&&(Ln(),Se(l,1,1,()=>{l=null}),Pn()),d.ctx=t,S&256&&i!==(i=cs(t[8]).renderAmenities())&&yf(i,d)||Lv(d,t,S)},i(w){a||(ye(c),ye(l),ye(d.block),a=!0)},o(w){Se(c),Se(l);for(let S=0;S<3;S+=1){const I=d.blocks[S];Se(I)}a=!1},d(w){w&&Le(e),c&&c.d(),l&&l.d(),d.block.d(),d.token=null,d=null}}}function _6(t){let e,n,r,i=t[5]==null&&VS(t);return n=new rp({props:{$$slots:{map:[g6],sidebar:[u6],top:[l6]},$$scope:{ctx:t}}}),{c(){i&&i.c(),e=nt(),ot(n.$$.fragment)},m(a,c){i&&i.m(a,c),Me(a,e,c),rt(n,a,c),r=!0},p(a,[c]){a[5]==null?i?(i.p(a,c),c&32&&ye(i,1)):(i=VS(a),i.c(),ye(i,1),i.m(e.parentNode,e)):i&&(Ln(),Se(i,1,1,()=>{i=null}),Pn());const l={};c&131575&&(l.$$scope={dirty:c,ctx:a}),n.$set(l)},i(a){r||(ye(i),ye(n.$$.fragment,a),r=!0)},o(a){Se(i),Se(n.$$.fragment,a),r=!1},d(a){a&&Le(e),i&&i.d(a),it(n,a)}}}function y6(t,e,n){let r,i;Ct(t,Ql,j=>n(8,i=j));let a=[],c=600,l=[],d=!0,w=null;async function S(j,J){n(3,a=[...a,"Calculating scores"]),n(5,w=await i.score({poiKinds:l,maxSeconds:c},kv(I))),n(3,a=[])}function I(j){n(3,a=[...a,j])}let T=null,k;async function D(j){if(k)try{n(6,T=await i.route({start:{lng:k.geometry.coordinates[0],lat:k.geometry.coordinates[1]},end:[k.properties.closest_lon,k.properties.closest_lat],mode:"foot",debugSearch:!1,useHeuristic:!1,startTime:"07:00"}))}catch(J){console.log(`No route: ${J}`),n(6,T=null)}else n(6,T=null)}function U(j){k=j,n(2,k)}function q(j){l=j,n(1,l)}function ee(){c=Kd(this.value),n(0,c)}function B(){d=this.checked,n(4,d)}return t.$$.update=()=>{t.$$.dirty&3&&S(),t.$$.dirty&1&&n(7,r=Array.from(Array(6).keys()).map(j=>c/(6-1)*j)),t.$$.dirty&4&&D()},[c,l,k,a,d,w,T,r,i,U,q,ee,B]}class v6 extends Jt{constructor(e){super(),Kt(this,e,y6,_6,qt,{})}}var Io=63710088e-1,C1={centimeters:Io*100,centimetres:Io*100,degrees:Io/111325,feet:Io*3.28084,inches:Io*39.37,kilometers:Io/1e3,kilometres:Io/1e3,meters:Io,metres:Io,miles:Io/1609.344,millimeters:Io*1e3,millimetres:Io*1e3,nauticalmiles:Io/1852,radians:1,yards:Io*1.0936},b6={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/Io,yards:1.0936133},Ev={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 ma(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function x6(t,e,n){switch(t){case"Point":return os(e).geometry;case"LineString":return ta(e).geometry;case"Polygon":return T1(e).geometry;case"MultiPoint":return ZC(e).geometry;case"MultiLineString":return HC(e).geometry;case"MultiPolygon":return XC(e).geometry;default:throw new Error(t+" is invalid")}}function os(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(!w_(t[0])||!w_(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return ma(r,e,n)}function w6(t,e,n){return n===void 0&&(n={}),Zc(t.map(function(r){return os(r,e)}),n)}function T1(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function L1(t,e){e===void 0&&(e="kilometers");var n=C1[e];if(!n)throw new Error(e+" units is invalid");return t*n}function Y_(t,e){e===void 0&&(e="kilometers");var n=C1[e];if(!n)throw new Error(e+" units is invalid");return t/n}function T6(t,e){return Xd(Y_(t,e))}function L6(t){var e=t%360;return e<0&&(e+=360),e}function Xd(t){var e=t%(2*Math.PI);return e*180/Math.PI}function na(t){var e=t%360;return e*Math.PI/180}function P6(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 L1(Y_(t,e),n)}function M6(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=Ev[e];if(!r)throw new Error("invalid original units");var i=Ev[n];if(!i)throw new Error("invalid final units");return t/r*i}function w_(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function P1(t){return!!t&&t.constructor===Object}function A6(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(!w_(e))throw new Error("bbox must only contain numbers")})}function k6(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 D6=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Ev,bearingToAzimuth:L6,convertArea:M6,convertLength:P6,degreesToRadians:na,earthRadius:Io,factors:C1,feature:ma,featureCollection:Zc,geometry:x6,geometryCollection:I6,isNumber:w_,isObject:P1,lengthToDegrees:T6,lengthToRadians:Y_,lineString:ta,lineStrings:E6,multiLineString:HC,multiPoint:ZC,multiPolygon:XC,point:os,points:w6,polygon:T1,polygons:S6,radiansToDegrees:Xd,radiansToLength:L1,round:C6,unitsFactors:b6,validateBBox:A6,validateId:k6},Symbol.toStringTag,{value:"Module"}));function Yd(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Wf(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 YC(t,e,n){if(n===void 0&&(n={}),n.final===!0)return R6(t,e);var r=Yd(t),i=Yd(e),a=na(r[0]),c=na(i[0]),l=na(r[1]),d=na(i[1]),w=Math.sin(c-a)*Math.cos(d),S=Math.cos(l)*Math.sin(d)-Math.sin(l)*Math.cos(d)*Math.cos(c-a);return Xd(Math.atan2(w,S))}function R6(t,e){var n=YC(e,t);return n=(n+180)%360,n}function hd(t,e,n){n===void 0&&(n={});var r=Yd(t),i=Yd(e),a=na(i[1]-r[1]),c=na(i[0]-r[0]),l=na(r[1]),d=na(i[1]),w=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(l)*Math.cos(d);return L1(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)),n.units)}function qS(t,e,n,r){r===void 0&&(r={});var i=Yd(t),a=na(i[0]),c=na(i[1]),l=na(n),d=Y_(e,r.units),w=Math.asin(Math.sin(c)*Math.cos(d)+Math.cos(c)*Math.sin(d)*Math.cos(l)),S=a+Math.atan2(Math.sin(l)*Math.sin(d)*Math.cos(c),Math.cos(d)-Math.sin(c)*Math.sin(w)),I=Xd(S),T=Xd(w);return os([I,T],r.properties)}function am(t,e,n){if(t!==null)for(var r,i,a,c,l,d,w,S=0,I=0,T,k=t.type,D=k==="FeatureCollection",U=k==="Feature",q=D?t.features.length:1,ee=0;eed||D>w||U>S){l=I,d=r,w=D,S=U,a=0;return}var q=ta([l,I],n.properties);if(e(q,r,i,U,a)===!1)return!1;a++,l=I})===!1)return!1}}})}function U6(t,e,n){var r=n,i=!1;return JC(t,function(a,c,l,d,w){i===!1&&n===void 0?r=a:r=e(r,a,c,l,d,w),i=!0}),r}function QC(t,e){if(!t)throw new Error("geojson is required");ip(t,function(n,r,i){if(n.geometry!==null){var a=n.geometry.type,c=n.geometry.coordinates;switch(a){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var l=0;li?n:i,w=r>a?r:a;return[c,l,d,w]}var A1={exports:{}},$C={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(Jd,function(){function n(B,j,J,ae,me){(function de(te,$,Ae,Y,oe){for(;Y>Ae;){if(Y-Ae>600){var Ye=Y-Ae+1,ve=$-Ae+1,Oe=Math.log(Ye),He=.5*Math.exp(2*Oe/3),Ge=.5*Math.sqrt(Oe*He*(Ye-He)/Ye)*(ve-Ye/2<0?-1:1),Rt=Math.max(Ae,Math.floor($-ve*He/Ye+Ge)),Pt=Math.min(Y,Math.floor($+(Ye-ve)*He/Ye+Ge));de(te,$,Rt,Pt,oe)}var Zt=te[$],Xt=Ae,kt=Y;for(r(te,Ae,$),oe(te[Y],Zt)>0&&r(te,Ae,Y);Xt0;)kt--}oe(te[Ae],Zt)===0?r(te,Ae,kt):r(te,++kt,Y),kt<=$&&(Ae=kt+1),$<=kt&&(Y=kt-1)}})(B,j,J||0,ae||B.length-1,me||i)}function r(B,j,J){var ae=B[j];B[j]=B[J],B[J]=ae}function i(B,j){return Bj?1:0}var a=function(B){B===void 0&&(B=9),this._maxEntries=Math.max(4,B),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function c(B,j,J){if(!J)return j.indexOf(B);for(var ae=0;ae=B.minX&&j.maxY>=B.minY}function q(B){return{children:B,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ee(B,j,J,ae,me){for(var de=[j,J];de.length;)if(!((J=de.pop())-(j=de.pop())<=ae)){var te=j+Math.ceil((J-j)/ae/2)*ae;n(B,te,j,J,me),de.push(j,te,te,J)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(B){var j=this.data,J=[];if(!U(B,j))return J;for(var ae=this.toBBox,me=[];j;){for(var de=0;de=0&&me[j].children.length>this._maxEntries;)this._split(me,j),j--;this._adjustParentBBoxes(ae,me,j)},a.prototype._split=function(B,j){var J=B[j],ae=J.children.length,me=this._minEntries;this._chooseSplitAxis(J,me,ae);var de=this._chooseSplitIndex(J,me,ae),te=q(J.children.splice(de,J.children.length-de));te.height=J.height,te.leaf=J.leaf,l(J,this.toBBox),l(te,this.toBBox),j?B[j-1].children.push(te):this._splitRoot(J,te)},a.prototype._splitRoot=function(B,j){this.data=q([B,j]),this.data.height=B.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(B,j,J){for(var ae,me,de,te,$,Ae,Y,oe=1/0,Ye=1/0,ve=j;ve<=J-j;ve++){var Oe=d(B,0,ve,this.toBBox),He=d(B,ve,J,this.toBBox),Ge=(me=Oe,de=He,te=void 0,$=void 0,Ae=void 0,Y=void 0,te=Math.max(me.minX,de.minX),$=Math.max(me.minY,de.minY),Ae=Math.min(me.maxX,de.maxX),Y=Math.min(me.maxY,de.maxY),Math.max(0,Ae-te)*Math.max(0,Y-$)),Rt=T(Oe)+T(He);Ge=j;oe--){var Ye=B.children[oe];w(te,B.leaf?me(Ye):Ye),$+=k(te)}return $},a.prototype._adjustParentBBoxes=function(B,j,J){for(var ae=J;ae>=0;ae--)w(j[ae],B)},a.prototype._condense=function(B){for(var j=B.length-1,J=void 0;j>=0;j--)B[j].children.length===0?j>0?(J=B[j-1].children).splice(J.indexOf(B[j]),1):this.clear():l(B[j],this.toBBox)},a})})($C);var Y6=$C.exports;const K6=C_(D6),J6=C_(W6),Q6=C_(gD);var ol=Y6,eT=K6,tT=J6,sf=Q6.default,$6=tT.featureEach;tT.coordEach;eT.polygon;var HS=eT.featureCollection;function nT(t){var e=new ol(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:sf(n),ol.prototype.insert.call(this,n)},e.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:sf(i),r.push(i)}):$6(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:sf(i),r.push(i)}),ol.prototype.load.call(this,r)},e.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:sf(n),ol.prototype.remove.call(this,n,r)},e.clear=function(){return ol.prototype.clear.call(this)},e.search=function(n){var r=ol.prototype.search.call(this,this.toBBox(n));return HS(r)},e.collides=function(n){return ol.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=ol.prototype.all.call(this);return HS(n)},e.toJSON=function(){return ol.prototype.toJSON.call(this)},e.fromJSON=function(n){return ol.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=sf(n);else if(n.type==="FeatureCollection")r=sf(n);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}A1.exports=nT;A1.exports.default=nT;var eF=A1.exports;const tF=Dv(eF);function nF(t,e){var n={},r=[];if(t.type==="LineString"&&(t=ma(t)),e.type==="LineString"&&(e=ma(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 i=ZS(t,e);return i&&r.push(i),Zc(r)}var a=tF();return a.load(WS(e)),S_(WS(t),function(c){S_(a.search(c),function(l){var d=ZS(c,l);if(d){var w=Wf(d).join(",");n[w]||(n[w]=!0,r.push(d))}})}),Zc(r)}function ZS(t,e){var n=Wf(t),r=Wf(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(r.length!==2)throw new Error(" line2 must only contain 2 coordinates");var i=n[0][0],a=n[0][1],c=n[1][0],l=n[1][1],d=r[0][0],w=r[0][1],S=r[1][0],I=r[1][1],T=(I-w)*(c-i)-(S-d)*(l-a),k=(S-d)*(a-w)-(I-w)*(i-d),D=(c-i)*(a-w)-(l-a)*(i-d);if(T===0)return null;var U=k/T,q=D/T;if(U>=0&&U<=1&&q>=0&&q<=1){var ee=i+U*(c-i),B=a+U*(l-a);return os([ee,B])}return null}function rF(t,e,n){n===void 0&&(n={});var r=os([1/0,1/0],{dist:1/0}),i=0;return ip(t,function(a){for(var c=Wf(a),l=0;l0&&(q=U.features[0],q.properties.dist=hd(e,q,n),q.properties.location=i+hd(d,q,n)),d.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,r=this.dragFrom[1]-e.lngLat.lat;for(let i of this.points)i[0]-=n,i[1]-=r}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});gi(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(XS(this.points).forEach((r,i)=>{n.push([i+1,rF(r,this.cursor).properties.dist])}),n.sort((r,i)=>r[1]-i[1]),n.length>0){let r=n[0][0];this.points.splice(r,0,this.cursor.geometry.coordinates),this.hover=r}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});gi(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=M0(e.lngLat.toArray()),this.onClick(e),this.finish())});gi(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});gi(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});gi(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});gi(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((i,a)=>{let c=M0(i);c.properties.hover=this.hover==a,c.properties.idx=a,e.features.push(c)}),e.features=e.features.concat(XS(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),iT.set(e);let r="crosshair";this.hover!=null&&(r=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=r,oT.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=M0(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(rT),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>aF&&this.previousStates.shift()}}function XS(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 uF(t){let e,n,r;return{c(){e=vt("Undo ("),n=vt(t[1]),r=vt(")")},m(i,a){Me(i,e,a),Me(i,n,a),Me(i,r,a)},p(i,a){a&2&&An(n,i[1])},d(i){i&&(Le(e),Le(n),Le(r))}}}function cF(t){let e;return{c(){e=vt("Undo")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function hF(t){let e,n,r,i,a,c,l,d,w,S,I;function T(U,q){return U[1]==0?cF:uF}let k=T(t),D=k(t);return{c(){e=ke("div"),n=ke("button"),n.textContent="Finish",r=nt(),i=ke("button"),i.textContent="Cancel",a=nt(),c=ke("button"),D.c(),d=nt(),w=ke("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 - to undo your last change
  • Press Enter - or - double click - to finish
  • Press Escape - to cancel
  • `,c.disabled=l=t[1]==0,Ei(e,"display","flex"),Ei(e,"justify-content","space-between")},m(U,q){Me(U,e,q),xe(e,n),xe(e,r),xe(e,i),xe(e,a),xe(e,c),D.m(c,null),Me(U,d,q),Me(U,w,q),S||(I=[Gt(n,"click",t[2]),Gt(i,"click",t[3]),Gt(c,"click",t[4])],S=!0)},p(U,[q]){k===(k=T(U))&&D?D.p(U,q):(D.d(1),D=k(U),D&&(D.c(),D.m(c,null))),q&2&&l!==(l=U[1]==0)&&(c.disabled=l)},i:et,o:et,d(U){U&&(Le(e),Le(d),Le(w)),D.d(),S=!1,Mi(I)}}}function fF(t,e,n){let r;Ct(t,oT,d=>n(1,r=d));let{polygonTool:i}=e;const a=()=>i.finish(),c=()=>i.cancel(),l=()=>i.undo();return t.$$set=d=>{"polygonTool"in d&&n(0,i=d.polygonTool)},[i,r,a,c,l]}class pF extends Jt{constructor(e){super(),Kt(this,e,fF,hF,qt,{polygonTool:0})}}let dF=Date.now();function lm(t){return`${t}-${dF++}`}const sT=Symbol.for("svelte-maplibre");function mF(){return Cv(sT)}function YS(t){return{subscribe:t.subscribe}}function aT({key:t,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:r=!1}){let i=mF(),a=Qn(null),c=YS(a),l={...i,[t]:YS(a)};if(e&&(l.popupTarget=c),r){let d=Qn(null);l.layerEvent=d,i.layerEvent=d}return n&&(l.cluster=Qn()),Iv(sT,l),{...i,self:a}}function gF(){return aT({key:"source",setCluster:!0})}function _F(t=!0){return aT({key:"layer",setPopupTarget:t,setMouseEvent:t})}function KS(t){let e;return n=>{if(n)for(let r in n){let i=e==null?void 0:e[r],a=n[r];i!==a&&t(r,a,i)}else if(e)for(let r in e)t(r,void 0,e[r]);e=n}}function yF(t,...e){let n=[t];for(let r of e)if(r)Array.isArray(r)&&r[0]===t?n.push(...r.slice(1)):n.push(r);else continue;if(n.length!==1)return n.length===2?n[1]:n}function vF(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function JS(t){let e=t[0],n,r,i=QS(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c[0]&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=QS(a),i.c(),ye(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ye(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function QS(t){let e;const n=t[36].default,r=Xr(n,t,t[35],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a[1]&16)&&Kr(r,n,i,i[35],e?Yr(n,i[35],a,null):Jr(i[35]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function bF(t){let e,n,r=t[0]&&JS(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,a){i[0]?r?(r.p(i,a),a[0]&1&&ye(r,1)):(r=JS(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function xF(t,e,n){let r,i,a,c,l,d,w,S,I,T,k,D,{$$slots:U={},$$scope:q}=e,{id:ee=lm("layer")}=e,{source:B=void 0}=e,{sourceLayer:j=void 0}=e,{beforeId:J=void 0}=e,{beforeLayerType:ae=void 0}=e,{type:me}=e,{paint:de=void 0}=e,{layout:te=void 0}=e,{filter:$=void 0}=e,{applyToClusters:Ae=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:oe=void 0}=e,{manageHoverState:Ye=!1}=e,{hovered:ve=null}=e,{interactive:Oe=!0}=e,{hoverCursor:He=void 0}=e,{eventsIfTopMost:Ge=!1}=e;const Rt=Yu(),{map:Pt,source:Zt,self:Xt,minzoom:kt,maxzoom:un,eventTopMost:Fn,layerInfo:bn}=_F();Ct(t,Pt,ie=>n(31,I=ie)),Ct(t,Zt,ie=>n(32,T=ie)),Ct(t,Xt,ie=>n(0,S=ie)),Ct(t,kt,ie=>n(34,D=ie)),Ct(t,un,ie=>n(33,k=ie)),us(()=>{S&&I&&(bn.delete(S),I==null||I.removeLayer(S))});let mn;function Bn(ie){var ze,en;if(!Oe||!S||!I||Ge&&Fn(ie)!==S)return;let Ce=ie.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn={event:ie,map:I,clusterId:_t,layer:S,source:l,features:Ce};Rt(ie.type,xn)}function ir(ie){var ze,en;if(!Oe||!S||!I||Ge&&Fn(ie)!==S)return;He&&(I.getCanvas().style.cursor=He);let Ce=ie.features??[];n(6,ve=Ce[0]??null);let _t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id;Rt("mouseenter",{event:ie,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function $r(ie){var ze,en,Dr;if(!Oe||!I)return;if(Ge&&Fn(ie)!==S){n(6,ve=null),Ye&&mn!==void 0&&(I==null||I.setFeatureState({source:l,sourceLayer:j,id:mn},{hover:!1}),mn=void 0);return}I.getCanvas().style.cursor=He;let Ce=ie.features??[],_t=(en=(ze=Ce[0])==null?void 0:ze.properties)==null?void 0:en.cluster_id,xn=(Dr=Ce[0])==null?void 0:Dr.id;xn!==mn&&(Ye&&(mn!==void 0&&(I==null||I.setFeatureState({source:l,id:mn,sourceLayer:j},{hover:!1})),I==null||I.setFeatureState({source:l,id:xn,sourceLayer:j},{hover:!0})),mn=xn,n(6,ve=Ce[0]??null)),Rt("mousemove",{event:ie,map:I,clusterId:_t,layer:S,source:l,features:Ce})}function _r(ie){if(!(!Oe||!S||!I)){if(He&&(I.getCanvas().style.cursor=""),n(6,ve=null),Ye&&mn!==void 0){const Ce={source:l,id:mn,sourceLayer:j};I==null||I.setFeatureState(Ce,{hover:!1}),mn=void 0}Rt("mouseleave",{map:I,layer:S,source:l})}}let cr=!0;function or(ie){I&&(I.off("click",ie,Bn),I.off("dblclick",ie,Bn),I.off("contextmenu",ie,Bn),I.off("mouseenter",ie,ir),I.off("mousemove",ie,$r),I.off("mouseleave",ie,_r))}return us(()=>{I&&S&&or(S)}),t.$$set=ie=>{"id"in ie&&n(7,ee=ie.id),"source"in ie&&n(8,B=ie.source),"sourceLayer"in ie&&n(9,j=ie.sourceLayer),"beforeId"in ie&&n(10,J=ie.beforeId),"beforeLayerType"in ie&&n(11,ae=ie.beforeLayerType),"type"in ie&&n(12,me=ie.type),"paint"in ie&&n(13,de=ie.paint),"layout"in ie&&n(14,te=ie.layout),"filter"in ie&&n(15,$=ie.filter),"applyToClusters"in ie&&n(16,Ae=ie.applyToClusters),"minzoom"in ie&&n(17,Y=ie.minzoom),"maxzoom"in ie&&n(18,oe=ie.maxzoom),"manageHoverState"in ie&&n(19,Ye=ie.manageHoverState),"hovered"in ie&&n(6,ve=ie.hovered),"interactive"in ie&&n(20,Oe=ie.interactive),"hoverCursor"in ie&&n(21,He=ie.hoverCursor),"eventsIfTopMost"in ie&&n(22,Ge=ie.eventsIfTopMost),"$$scope"in ie&&n(35,q=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&n(30,r=vF(Ae)),t.$$.dirty[0]&1073774592&&n(24,i=yF("all",r,$)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&n(26,a=Y??D),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&n(25,c=oe??k),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&n(29,l=B||T),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&I&&S!==ee&&l){S&&(or(S),bn.delete(S));let ie=J;if(!J&&ae){let Ce=I.getStyle().layers,_t=typeof ae=="function"?ae:ze=>ze.type===ae,xn=Ce==null?void 0:Ce.find(_t);xn&&(ie=xn.id)}Zn(Xt,S=ee,S),I.addLayer(qc({id:S,type:me,source:l,"source-layer":j,filter:i,paint:de,layout:te,minzoom:a,maxzoom:c}),ie),n(23,cr=!0),I.on("click",S,Bn),I.on("dblclick",S,Bn),I.on("contextmenu",S,Bn),I.on("mouseenter",S,ir),I.on("mousemove",S,$r),I.on("mouseleave",S,_r)}t.$$.dirty[0]&1048577&&S&&bn.set(S,{interactive:Oe}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(28,d=S?KS((ie,Ce)=>I==null?void 0:I.setPaintProperty(S,ie,Ce)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&n(27,w=S?KS((ie,Ce)=>I==null?void 0:I.setLayoutProperty(S,ie,Ce)):void 0),t.$$.dirty[0]&268443648&&(d==null||d(de)),t.$$.dirty[0]&134234112&&(w==null||w(te)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&S&&(I==null||I.setLayerZoomRange(S,a,c)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&S&&(cr?n(23,cr=!1):I==null||I.setFilter(S,i))},[S,Pt,Zt,Xt,kt,un,ve,ee,B,j,J,ae,me,de,te,$,Ae,Y,oe,Ye,Oe,He,Ge,cr,i,c,a,w,d,l,r,I,T,k,D,q,U]}class k1 extends Jt{constructor(e){super(),Kt(this,e,xF,bF,qt,{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 wF(t){let e;const n=t[16].default,r=Xr(n,t,t[24],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16777216)&&Kr(r,n,i,i[24],e?Yr(n,i[24],a,null):Jr(i[24]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function SF(t){let e,n,r;function i(c){t[17](c)}let a={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:[wF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new k1({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[18]),e.$on("dblclick",t[19]),e.$on("contextmenu",t[20]),e.$on("mouseenter",t[21]),e.$on("mousemove",t[22]),e.$on("mouseleave",t[23]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.applyToClusters=c[9]),l&1024&&(d.minzoom=c[10]),l&2048&&(d.maxzoom=c[11]),l&4096&&(d.hoverCursor=c[12]),l&8192&&(d.manageHoverState=c[13]),l&16384&&(d.eventsIfTopMost=c[14]),l&32768&&(d.interactive=c[15]),l&16777216&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function EF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("circle")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{applyToClusters:k=void 0}=e,{minzoom:D=void 0}=e,{maxzoom:U=void 0}=e,{hoverCursor:q=void 0}=e,{manageHoverState:ee=!1}=e,{hovered:B=null}=e,{eventsIfTopMost:j=!1}=e,{interactive:J=!0}=e;function ae(oe){B=oe,n(0,B)}function me(oe){dn.call(this,t,oe)}function de(oe){dn.call(this,t,oe)}function te(oe){dn.call(this,t,oe)}function $(oe){dn.call(this,t,oe)}function Ae(oe){dn.call(this,t,oe)}function Y(oe){dn.call(this,t,oe)}return t.$$set=oe=>{"id"in oe&&n(1,a=oe.id),"source"in oe&&n(2,c=oe.source),"sourceLayer"in oe&&n(3,l=oe.sourceLayer),"beforeId"in oe&&n(4,d=oe.beforeId),"beforeLayerType"in oe&&n(5,w=oe.beforeLayerType),"paint"in oe&&n(6,S=oe.paint),"layout"in oe&&n(7,I=oe.layout),"filter"in oe&&n(8,T=oe.filter),"applyToClusters"in oe&&n(9,k=oe.applyToClusters),"minzoom"in oe&&n(10,D=oe.minzoom),"maxzoom"in oe&&n(11,U=oe.maxzoom),"hoverCursor"in oe&&n(12,q=oe.hoverCursor),"manageHoverState"in oe&&n(13,ee=oe.manageHoverState),"hovered"in oe&&n(0,B=oe.hovered),"eventsIfTopMost"in oe&&n(14,j=oe.eventsIfTopMost),"interactive"in oe&&n(15,J=oe.interactive),"$$scope"in oe&&n(24,i=oe.$$scope)},[B,a,c,l,d,w,S,I,T,k,D,U,q,ee,j,J,r,ae,me,de,te,$,Ae,Y,i]}class IF extends Jt{constructor(e){super(),Kt(this,e,EF,SF,qt,{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 CF(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function TF(t){let e,n,r;function i(c){t[16](c)}let a={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:[CF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new k1({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function LF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("fill")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function J(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function de(Y){dn.call(this,t,Y)}function te(Y){dn.call(this,t,Y)}function $(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,J,ae,me,de,te,$,Ae,i]}class PF extends Jt{constructor(e){super(),Kt(this,e,LF,TF,qt,{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 MF(t,e,n,r,i){let a=!1;t.getSource(e)&&(a=!0,t.removeSource(e));const c=()=>{r(e)&&(t.addSource(e,n),i())};if(a){const l=()=>{e&&(t.getSource(e)?setTimeout(l,1):c())};l()}else c()}function AF(t,e,n){gE().then(()=>{let r=hE(t);if(!r)return;r.getSource(e)===n&&r.removeSource(e)})}function $S(t){let e=t[0],n,r,i=eE(t);return{c(){i.c(),n=ur()},m(a,c){i.m(a,c),Me(a,n,c),r=!0},p(a,c){c&1&&qt(e,e=a[0])?(Ln(),Se(i,1,1,et),Pn(),i=eE(a),i.c(),ye(i,1),i.m(n.parentNode,n)):i.p(a,c)},i(a){r||(ye(i),r=!0)},o(a){Se(i),r=!1},d(a){a&&Le(n),i.d(a)}}}function eE(t){let e;const n=t[15].default,r=Xr(n,t,t[14],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&16384)&&Kr(r,n,i,i[14],e?Yr(n,i[14],a,null):Jr(i[14]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function kF(t){let e,n,r=t[0]&&$S(t);return{c(){r&&r.c(),e=ur()},m(i,a){r&&r.m(i,a),Me(i,e,a),n=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&ye(r,1)):(r=$S(i),r.c(),ye(r,1),r.m(e.parentNode,e)):r&&(Ln(),Se(r,1,1,()=>{r=null}),Pn())},i(i){n||(ye(r),n=!0)},o(i){Se(r),n=!1},d(i){i&&Le(e),r&&r.d(i)}}}function DF(t,e,n){let r,i,a,{$$slots:c={},$$scope:l}=e,{id:d=lm("geojson")}=e,{data:w}=e,{generateId:S=!1}=e,{promoteId:I=void 0}=e,{filter:T=void 0}=e,{lineMetrics:k=void 0}=e,{cluster:D=void 0}=e;const{map:U,cluster:q,self:ee}=gF();Ct(t,U,J=>n(13,i=J)),Ct(t,q,J=>n(16,a=J)),Ct(t,ee,J=>n(0,r=J));let B,j=!0;return us(()=>{r&&B&&i&&(AF(U,r,B),Zn(ee,r=null,r),n(11,B=void 0))}),t.$$set=J=>{"id"in J&&n(4,d=J.id),"data"in J&&n(5,w=J.data),"generateId"in J&&n(6,S=J.generateId),"promoteId"in J&&n(7,I=J.promoteId),"filter"in J&&n(8,T=J.filter),"lineMetrics"in J&&n(9,k=J.lineMetrics),"cluster"in J&&n(10,D=J.cluster),"$$scope"in J&&n(14,l=J.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&Zn(q,a=D,a),t.$$.dirty&12273&&i&&r!==d&&(Zn(ee,r=d,r),MF(i,r,qc({type:"geojson",data:w,filter:T,lineMetrics:k,generateId:S,promoteId:I,cluster:!!D,clusterMinPoints:D==null?void 0:D.minPoints,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius,clusterProperties:D==null?void 0:D.properties}),J=>i&&J===r,()=>{r&&(n(11,B=i==null?void 0:i.getSource(r)),n(12,j=!0))})),t.$$.dirty&8208&&(i==null||i.on("style.load",()=>{n(11,B=i==null?void 0:i.getSource(d))})),t.$$.dirty&6176&&B&&(j?n(12,j=!1):B.setData(w)),t.$$.dirty&3072&&(B==null||B.setClusterOptions(qc({cluster:!!D,clusterMaxZoom:D==null?void 0:D.maxZoom,clusterRadius:D==null?void 0:D.radius})))},[r,U,q,ee,d,w,S,I,T,k,D,B,j,i,l,c]}class RF extends Jt{constructor(e){super(),Kt(this,e,DF,kF,qt,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10})}}function NF(t){let e;const n=t[15].default,r=Xr(n,t,t[23],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&8388608)&&Kr(r,n,i,i[23],e?Yr(n,i[23],a,null):Jr(i[23]),null)},i(i){e||(ye(r,i),e=!0)},o(i){Se(r,i),e=!1},d(i){r&&r.d(i)}}}function OF(t){let e,n,r;function i(c){t[16](c)}let a={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:[NF]},$$scope:{ctx:t}};return t[0]!==void 0&&(a.hovered=t[0]),e=new k1({props:a}),Gn.push(()=>Yi(e,"hovered",i)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){ot(e.$$.fragment)},m(c,l){rt(e,c,l),r=!0},p(c,[l]){const d={};l&2&&(d.id=c[1]),l&4&&(d.source=c[2]),l&8&&(d.sourceLayer=c[3]),l&16&&(d.beforeId=c[4]),l&32&&(d.beforeLayerType=c[5]),l&64&&(d.paint=c[6]),l&128&&(d.layout=c[7]),l&256&&(d.filter=c[8]),l&512&&(d.minzoom=c[9]),l&1024&&(d.maxzoom=c[10]),l&2048&&(d.hoverCursor=c[11]),l&4096&&(d.manageHoverState=c[12]),l&8192&&(d.eventsIfTopMost=c[13]),l&16384&&(d.interactive=c[14]),l&8388608&&(d.$$scope={dirty:l,ctx:c}),!n&&l&1&&(n=!0,d.hovered=c[0],Xi(()=>n=!1)),e.$set(d)},i(c){r||(ye(e.$$.fragment,c),r=!0)},o(c){Se(e.$$.fragment,c),r=!1},d(c){it(e,c)}}}function zF(t,e,n){let{$$slots:r={},$$scope:i}=e,{id:a=lm("line")}=e,{source:c=void 0}=e,{sourceLayer:l=void 0}=e,{beforeId:d=void 0}=e,{beforeLayerType:w=void 0}=e,{paint:S}=e,{layout:I=void 0}=e,{filter:T=void 0}=e,{minzoom:k=void 0}=e,{maxzoom:D=void 0}=e,{hoverCursor:U=void 0}=e,{manageHoverState:q=!1}=e,{hovered:ee=null}=e,{eventsIfTopMost:B=!1}=e,{interactive:j=!0}=e;function J(Y){ee=Y,n(0,ee)}function ae(Y){dn.call(this,t,Y)}function me(Y){dn.call(this,t,Y)}function de(Y){dn.call(this,t,Y)}function te(Y){dn.call(this,t,Y)}function $(Y){dn.call(this,t,Y)}function Ae(Y){dn.call(this,t,Y)}return t.$$set=Y=>{"id"in Y&&n(1,a=Y.id),"source"in Y&&n(2,c=Y.source),"sourceLayer"in Y&&n(3,l=Y.sourceLayer),"beforeId"in Y&&n(4,d=Y.beforeId),"beforeLayerType"in Y&&n(5,w=Y.beforeLayerType),"paint"in Y&&n(6,S=Y.paint),"layout"in Y&&n(7,I=Y.layout),"filter"in Y&&n(8,T=Y.filter),"minzoom"in Y&&n(9,k=Y.minzoom),"maxzoom"in Y&&n(10,D=Y.maxzoom),"hoverCursor"in Y&&n(11,U=Y.hoverCursor),"manageHoverState"in Y&&n(12,q=Y.manageHoverState),"hovered"in Y&&n(0,ee=Y.hovered),"eventsIfTopMost"in Y&&n(13,B=Y.eventsIfTopMost),"interactive"in Y&&n(14,j=Y.interactive),"$$scope"in Y&&n(23,i=Y.$$scope)},[ee,a,c,l,d,w,S,I,T,k,D,U,q,B,j,r,J,ae,me,de,te,$,Ae,i]}class FF extends Jt{constructor(e){super(),Kt(this,e,zF,OF,qt,{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 BF(t){let e,n,r,i,a,c;return e=new PF({props:{id:"edit-polygon-fill",filter:iF,paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}}),r=new FF({props:{id:"edit-polygon-lines",filter:oF,paint:{"line-color":"black","line-width":8,"line-opacity":.5}}}),a=new IF({props:{id:"edit-polygon-vertices",filter:sF,paint:{"circle-color":"black","circle-opacity":["case",["has","hovered"],1,.5],"circle-radius":10}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment),i=nt(),ot(a.$$.fragment)},m(l,d){rt(e,l,d),Me(l,n,d),rt(r,l,d),Me(l,i,d),rt(a,l,d),c=!0},p:et,i(l){c||(ye(e.$$.fragment,l),ye(r.$$.fragment,l),ye(a.$$.fragment,l),c=!0)},o(l){Se(e.$$.fragment,l),Se(r.$$.fragment,l),Se(a.$$.fragment,l),c=!1},d(l){l&&(Le(n),Le(i)),it(e,l),it(r,l),it(a,l)}}}function VF(t){let e,n;return e=new RF({props:{data:t[0],$$slots:{default:[BF]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&1&&(a.data=r[0]),i&2&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function UF(t,e,n){let r;return Ct(t,iT,i=>n(0,r=i)),[r]}class GF extends Jt{constructor(e){super(),Kt(this,e,UF,VF,qt,{})}}function jF(t){let e,n,r,i,a,c,l;return{c(){e=ke("button"),e.textContent="Import current view",n=nt(),r=ke("i"),r.textContent="or...",i=nt(),a=ke("button"),a.textContent="Draw an area to import on the map",Ve(e,"type","button"),Ve(a,"type","button")},m(d,w){Me(d,e,w),Me(d,n,w),Me(d,r,w),Me(d,i,w),Me(d,a,w),c||(l=[Gt(e,"click",t[1]),Gt(a,"click",t[2])],c=!0)},p:et,i:et,o:et,d(d){d&&(Le(e),Le(n),Le(r),Le(i),Le(a)),c=!1,Mi(l)}}}function qF(t){let e,n;return e=new pF({props:{polygonTool:t[0]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&1&&(a.polygonTool=r[0]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function WF(t){let e,n,r,i;const a=[qF,jF],c=[];function l(d,w){return d[0]?0:1}return e=l(t),n=c[e]=a[e](t),{c(){n.c(),r=ur()},m(d,w){c[e].m(d,w),Me(d,r,w),i=!0},p(d,[w]){let S=e;e=l(d),e===S?c[e].p(d,w):(Ln(),Se(c[S],1,1,()=>{c[S]=null}),Pn(),n=c[e],n?n.p(d,w):(n=c[e]=a[e](d),n.c()),ye(n,1),n.m(r.parentNode,r))},i(d){i||(ye(n),i=!0)},o(d){Se(n),i=!1},d(d){d&&Le(r),c[e].d(d)}}}function fd(t){return[t.lng,t.lat]}function HF(t,e,n){let{map:r}=e;const i=Yu();let a=null;async function c(S){try{i("loading","Loading from Overpass");let T=await(await fetch(XF(S))).text();i("gotXml",T)}catch(I){i("error",I.toString())}}function l(){let S=r.getBounds();return{type:"Feature",properties:{},geometry:{coordinates:[[fd(S.getSouthWest()),fd(S.getNorthWest()),fd(S.getNorthEast()),fd(S.getSouthEast()),fd(S.getSouthWest())]],type:"Polygon"}}}async function d(){if(r){if(r.getZoom()<13){i("error","Zoom in more to import");return}await c(l())}}function w(){r&&(n(0,a=new lF(r)),a.startNew(),a.addEventListenerSuccess(async S=>{n(0,a=null),await c(S)}),a.addEventListenerFailure(()=>{n(0,a=null)}))}return t.$$set=S=>{"map"in S&&n(3,r=S.map)},[a,d,w,r]}class ZF extends Jt{constructor(e){super(),Kt(this,e,HF,WF,qt,{map:3})}}function XF(t){let e='poly:"';for(let[r,i]of t.geometry.coordinates[0])e+=`${i} ${r} `;return e=e.slice(0,-1)+'"',`https://overpass-api.de/api/interpreter?data=${`(nwr(${e}); node(w)->.x; <;); out meta;`}`}function tE(t,e,n){const r=t.slice();return r[21]=e[n][0],r[22]=e[n][1],r}function nE(t,e,n){const r=t.slice();return r[25]=e[n][0],r[26]=e[n][1],r}function rE(t){let e,n=t[26]+"",r,i;return{c(){e=ke("option"),r=vt(n),e.__value=i=t[25],Di(e,e.__value)},m(a,c){Me(a,e,c),xe(e,r)},p(a,c){c&4&&n!==(n=a[26]+"")&&An(r,n),c&4&&i!==(i=a[25])&&(e.__value=i,Di(e,e.__value))},d(a){a&&Le(e)}}}function iE(t){let e,n,r=zr(t[22]),i=[];for(let a=0;at[9].call(c)),Ve(D,"type","file"),Ve($,"type","file")},m(Oe,He){rt(e,Oe,He),Me(Oe,n,He),Me(Oe,r,He),xe(r,i),xe(i,a),xe(i,c),xe(c,l);for(let Ge=0;Gen(15,r=te)),Ct(t,Ql,te=>n(16,i=te)),Ct(t,I_,te=>n(5,a=te));let c="",l=[],d=!1,w=[];Xu(async()=>{try{let te=await fetch("/osm/areas.json");if(te.ok)d=!0,console.log("Using local cache, not od2net.org"),n(2,w=await te.json());else{let $=await fetch("https://assets.od2net.org/severance_pbfs/areas.json");n(2,w=await $.json())}}catch{}});let S;async function I(te){try{await D(await S.files[0].arrayBuffer()),n(0,c="")}catch($){window.alert(`Couldn't open this file: ${$}`)}n(1,l=[])}let T;async function k(te){try{n(1,l=["Loading pre-built file"]);let $=await T.files[0].arrayBuffer();console.time("load"),await i.loadGraphFile(new Uint8Array($)),console.timeEnd("load"),Zn(mf,r=!0,r),n(0,c="")}catch($){window.alert(`Couldn't open this file: ${$}`)}n(1,l=[])}async function D(te){let $=d?`http://${window.location.host}/15m/gtfs.gmd`:"https://assets.od2net.org/gtfs.gmd",Ae=d?`http://${window.location.host}/15m/population.fgb`:"https://assets.od2net.org/population.fgb";n(1,l=["Building map model from OSM input"]),console.time("load"),await i.loadOsmFile(new Uint8Array(te),$,Ae,kv(U)),console.timeEnd("load"),Zn(mf,r=!0,r)}function U(te){n(1,l=[...l,te])}async function q(te){try{await D(new TextEncoder().encode(te.detail)),n(0,c="")}catch($){window.alert(`Couldn't import from Overpass: ${$}`)}n(1,l=[])}async function ee(te){te!=""&&(d?await B(`/osm/${te}.pbf`):await B(`https://assets.od2net.org/severance_pbfs/${te}.pbf`))}async function B(te){try{n(1,l=[`Downloading ${te}`]);let $=await fetch(te);await D(await $.arrayBuffer())}catch($){window.alert(`Couldn't open from URL ${te}: ${$}`)}n(1,l=[])}function j(){c=pE(this),n(0,c),n(2,w)}function J(te){Gn[te?"unshift":"push"](()=>{S=te,n(3,S)})}const ae=te=>n(1,l=[...l,te.detail]),me=te=>window.alert(te.detail);function de(te){Gn[te?"unshift":"push"](()=>{T=te,n(4,T)})}return t.$$.update=()=>{t.$$.dirty&1&&ee(c)},[c,l,w,S,T,a,I,k,q,j,J,ae,me,de]}class JF extends Jt{constructor(e){super(),Kt(this,e,KF,YF,qt,{})}}function QF(t){let e;return{c(){e=ke("div"),Ve(e,"slot","top")},m(n,r){Me(n,e,r)},p:et,d(n){n&&Le(e)}}}function $F(t){let e;return{c(){e=ke("p"),e.textContent="Waiting for MapLibre and WASM to load..."},m(n,r){Me(n,e,r)},i:et,o:et,d(n){n&&Le(e)}}}function eB(t){let e,n;return e=new JF({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function tB(t){let e,n,r,i,a,c;const l=[eB,$F],d=[];function w(S,I){return S[0]?0:1}return i=w(t),a=d[i]=l[i](t),{c(){e=ke("div"),n=ke("h2"),n.textContent="Choose your study area",r=nt(),a.c(),Ve(e,"slot","sidebar")},m(S,I){Me(S,e,I),xe(e,n),xe(e,r),d[i].m(e,null),c=!0},p(S,I){let T=i;i=w(S),i!==T&&(Ln(),Se(d[T],1,1,()=>{d[T]=null}),Pn(),a=d[i],a||(a=d[i]=l[i](S),a.c()),ye(a,1),a.m(e,null))},i(S){c||(ye(a),c=!0)},o(S){Se(a),c=!1},d(S){S&&Le(e),d[i].d()}}}function nB(t){let e,n,r;return n=new GF({}),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"slot","map")},m(i,a){Me(i,e,a),rt(n,e,null),r=!0},p:et,i(i){r||(ye(n.$$.fragment,i),r=!0)},o(i){Se(n.$$.fragment,i),r=!1},d(i){i&&Le(e),it(n)}}}function rB(t){let e,n;return e=new rp({props:{$$slots:{map:[nB],sidebar:[tB],top:[QF]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,[i]){const a={};i&33&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function iB(t,e,n){let r,i,a,c,l;return Ct(t,bf,d=>n(1,r=d)),Ct(t,Lc,d=>n(2,i=d)),Ct(t,Ql,d=>n(3,a=d)),Ct(t,mf,d=>n(4,c=d)),Ct(t,I_,d=>n(0,l=d)),Xu(async()=>{Zn(mf,c=!1,c),await a.unset(),Zn(Lc,i=null,i),Zn(bf,r=null,r)}),[l]}class oB extends Jt{constructor(e){super(),Kt(this,e,iB,rB,qt,{})}}function sB(){return new Worker("/15m/assets/worker-28b5e3cc.js")}function aB(t){let e,n,r,i,a,c;return{c(){e=ke("div"),n=ke("button"),n.innerHTML=`A/B Street logo`,r=nt(),i=ke("span"),Ve(n,"class","outline"),Ei(i,"width","100%"),Ve(e,"slot","top"),Ei(e,"display","flex")},m(l,d){Me(l,e,d),xe(e,n),xe(e,r),xe(e,i),t[18](i),a||(c=Gt(n,"click",t[17]),a=!0)},p:et,d(l){l&&Le(e),t[18](null),a=!1,c()}}}function oE(t){let e,n,r,i,a,c;return{c(){e=ke("hr"),n=nt(),r=ke("div"),i=ke("button"),i.textContent="Zoom to fit"},m(l,d){Me(l,e,d),Me(l,n,d),Me(l,r,d),xe(r,i),a||(c=Gt(i,"click",t[9]),a=!0)},p:et,d(l){l&&(Le(e),Le(n),Le(r)),a=!1,c()}}}function lB(t){let e,n,r,i,a,c=t[5].kind!="title"&&oE(t);return{c(){e=ke("div"),n=ke("h1"),n.textContent="15-minute neighbourhood tool",r=nt(),i=ke("div"),a=nt(),c&&c.c(),Ve(e,"slot","left")},m(l,d){Me(l,e,d),xe(e,n),xe(e,r),xe(e,i),t[16](i),xe(e,a),c&&c.m(e,null)},p(l,d){l[5].kind!="title"?c?c.p(l,d):(c=oE(l),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},d(l){l&&Le(e),t[16](null),c&&c.d()}}}function sE(t){let e,n;return e=new oB({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function aE(t){let e,n,r,i,a,c,l,d={ctx:t,current:null,token:null,hasCatch:!1,pending:fB,then:cB,catch:uB,value:23,blocks:[,,,]};yf(e=cs(t[6]).getInvertedBoundary(),d);const w=[_B,gB,mB,dB,pB],S=[];function I(k,D){return k[5].kind=="debug"?0:k[5].kind=="isochrone"?1:k[5].kind=="route"?2:k[5].kind=="score"?3:k[5].kind=="debug-route"?4:-1}~(r=I(t))&&(i=S[r]=w[r](t));let T=t[7]&&lE(t);return{c(){d.block.c(),n=nt(),i&&i.c(),a=nt(),T&&T.c(),c=ur()},m(k,D){d.block.m(k,d.anchor=D),d.mount=()=>n.parentNode,d.anchor=n,Me(k,n,D),~r&&S[r].m(k,D),Me(k,a,D),T&&T.m(k,D),Me(k,c,D),l=!0},p(k,D){t=k,d.ctx=t,D&64&&e!==(e=cs(t[6]).getInvertedBoundary())&&yf(e,d)||Lv(d,t,D);let U=r;r=I(t),r===U?~r&&S[r].p(t,D):(i&&(Ln(),Se(S[U],1,1,()=>{S[U]=null}),Pn()),~r?(i=S[r],i?i.p(t,D):(i=S[r]=w[r](t),i.c()),ye(i,1),i.m(a.parentNode,a)):i=null),t[7]?T?(T.p(t,D),D&128&&ye(T,1)):(T=lE(t),T.c(),ye(T,1),T.m(c.parentNode,c)):T&&(Ln(),Se(T,1,1,()=>{T=null}),Pn())},i(k){l||(ye(d.block),ye(i),ye(T),l=!0)},o(k){for(let D=0;D<3;D+=1){const U=d.blocks[D];Se(U)}Se(i),Se(T),l=!1},d(k){k&&(Le(n),Le(a),Le(c)),d.block.d(k),d.token=null,d=null,~r&&S[r].d(k),T&&T.d(k)}}}function uB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function cB(t){let e,n;return e=new qa({props:{data:t[23],$$slots:{default:[hB]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.data=r[23]),i&16777216&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function hB(t){let e,n;return e=new E1({props:{paint:{"fill-color":"black","fill-opacity":.3}}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function fB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function pB(t){let e,n;return e=new a6({props:{debugGj:t[5].debugGj,start:t[5].start,end:t[5].end,routeGj:t[5].routeGj}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&32&&(a.debugGj=r[5].debugGj),i&32&&(a.start=r[5].start),i&32&&(a.end=r[5].end),i&32&&(a.routeGj=r[5].routeGj),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function dB(t){let e,n;return e=new v6({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function mB(t){let e,n;return e=new Jz({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function gB(t){let e,n;return e=new Lz({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function _B(t){let e,n;return e=new _z({}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p:et,i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function lE(t){let e,n,r,i={ctx:t,current:null,token:null,hasCatch:!1,pending:bB,then:vB,catch:yB,value:22,blocks:[,,,]};return yf(n=cs(t[6]).renderZones(),i),{c(){e=ur(),i.block.c()},m(a,c){Me(a,e,c),i.block.m(a,i.anchor=c),i.mount=()=>e.parentNode,i.anchor=e,r=!0},p(a,c){t=a,i.ctx=t,c&64&&n!==(n=cs(t[6]).renderZones())&&yf(n,i)||Lv(i,t,c)},i(a){r||(ye(i.block),r=!0)},o(a){for(let c=0;c<3;c+=1){const l=i.blocks[c];Se(l)}r=!1},d(a){a&&Le(e),i.block.d(a),i.token=null,i=null}}}function yB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function vB(t){let e,n;return e=new nz({props:{gj:t[22]}}),{c(){ot(e.$$.fragment)},m(r,i){rt(e,r,i),n=!0},p(r,i){const a={};i&64&&(a.gj=r[22]),e.$set(a)},i(r){n||(ye(e.$$.fragment,r),n=!0)},o(r){Se(e.$$.fragment,r),n=!1},d(r){it(e,r)}}}function bB(t){return{c:et,m:et,p:et,i:et,o:et,d:et}}function xB(t){let e,n,r,i,a,c,l;e=new QN({props:{map:t[0],apiKey:TE}});let d=t[5].kind=="title"&&sE(),w=t[4]&&aE(t);return{c(){ot(e.$$.fragment),n=nt(),r=ke("div"),i=nt(),d&&d.c(),a=nt(),w&&w.c(),c=ur()},m(S,I){rt(e,S,I),Me(S,n,I),Me(S,r,I),t[13](r),Me(S,i,I),d&&d.m(S,I),Me(S,a,I),w&&w.m(S,I),Me(S,c,I),l=!0},p(S,I){const T={};I&1&&(T.map=S[0]),e.$set(T),S[5].kind=="title"?d?I&32&&ye(d,1):(d=sE(),d.c(),ye(d,1),d.m(a.parentNode,a)):d&&(Ln(),Se(d,1,1,()=>{d=null}),Pn()),S[4]?w?(w.p(S,I),I&16&&ye(w,1)):(w=aE(S),w.c(),ye(w,1),w.m(c.parentNode,c)):w&&(Ln(),Se(w,1,1,()=>{w=null}),Pn())},i(S){l||(ye(e.$$.fragment,S),ye(d),ye(w),l=!0)},o(S){Se(e.$$.fragment,S),Se(d),Se(w),l=!1},d(S){S&&(Le(n),Le(r),Le(i),Le(a),Le(c)),it(e,S),t[13](null),d&&d.d(S),w&&w.d(S)}}}function wB(t){let e,n,r,i;function a(l){t[14](l)}let c={style:`https://api.maptiler.com/maps/dataviz/style.json?key=${TE}`,standardControls:!0,hash:!0,images:[{id:"cycle_parking",url:dP}],$$slots:{default:[xB]},$$scope:{ctx:t}};return t[0]!==void 0&&(c.map=t[0]),n=new h5({props:c}),Gn.push(()=>Yi(n,"map",a)),n.$on("error",t[15]),{c(){e=ke("div"),ot(n.$$.fragment),Ve(e,"slot","main"),Ei(e,"position","relative"),Ei(e,"width","100%"),Ei(e,"height","100vh")},m(l,d){Me(l,e,d),rt(n,e,null),i=!0},p(l,d){const w={};d&16777465&&(w.$$scope={dirty:d,ctx:l}),!r&&d&1&&(r=!0,w.map=l[0],Xi(()=>r=!1)),n.$set(w)},i(l){i||(ye(n.$$.fragment,l),i=!0)},o(l){Se(n.$$.fragment,l),i=!1},d(l){l&&Le(e),it(n)}}}function SB(t){let e,n,r,i;return e=new JP({}),r=new I5({props:{$$slots:{main:[wB],left:[lB],top:[aB]},$$scope:{ctx:t}}}),{c(){ot(e.$$.fragment),n=nt(),ot(r.$$.fragment)},m(a,c){rt(e,a,c),Me(a,n,c),rt(r,a,c),i=!0},p(a,[c]){const l={};c&16777727&&(l.$$scope={dirty:c,ctx:a}),r.$set(l)},i(a){i||(ye(e.$$.fragment,a),ye(r.$$.fragment,a),i=!0)},o(a){Se(e.$$.fragment,a),Se(r.$$.fragment,a),i=!1},d(a){a&&Le(n),it(e,a),it(r,a)}}}function Cg(t,e,n){return e+t*(n-e)}function EB(t,e,n){let r,i,a,c,l,d,w,S,I,T;Ct(t,Sv,$=>n(10,r=$)),Ct(t,wv,$=>n(11,i=$)),Ct(t,xv,$=>n(12,a=$)),Ct(t,mf,$=>n(4,c=$)),Ct(t,$s,$=>n(5,l=$)),Ct(t,bf,$=>n(19,d=$)),Ct(t,Lc,$=>n(20,w=$)),Ct(t,Ql,$=>n(6,S=$)),Ct(t,z0,$=>n(7,I=$)),Ct(t,Wg,$=>n(8,T=$)),Xu(async()=>{const $=wE(new sB);let Ae=await new $;Ql.set(Ae)});let k;async function D(){k&&c&&k.fitBounds(await S.getBounds(),{animate:!1})}async function U($){if($){console.log("New map model loaded");let Ae=await S.getBounds();Zn(Lc,w={lng:Cg(.4,Ae[0],Ae[2]),lat:Cg(.4,Ae[1],Ae[3])},w),Zn(bf,d={lng:Cg(.6,Ae[0],Ae[2]),lat:Cg(.6,Ae[1],Ae[3])},d),await D(),Zn($s,l={kind:"isochrone"},l)}}let q,ee,B;function j($){Gn[$?"unshift":"push"](()=>{B=$,n(3,B),n(10,r)})}function J($){k=$,n(0,k)}const ae=$=>{console.log($.detail.error)};function me($){Gn[$?"unshift":"push"](()=>{ee=$,n(2,ee),n(11,i)})}const de=()=>Zn(Wg,T=!0,T);function te($){Gn[$?"unshift":"push"](()=>{q=$,n(1,q),n(12,a)})}return t.$$.update=()=>{t.$$.dirty&1&&k&&I_.set(k),t.$$.dirty&16&&U(c),t.$$.dirty&4098&&q&&a&&(n(1,q.innerHTML="",q),q.appendChild(a)),t.$$.dirty&2052&&ee&&i&&(n(2,ee.innerHTML="",ee),ee.appendChild(i)),t.$$.dirty&1032&&B&&r&&(n(3,B.innerHTML="",B),B.appendChild(r))},[k,q,ee,B,c,l,S,I,T,D,r,i,a,j,J,ae,me,de,te]}class IB extends Jt{constructor(e){super(),Kt(this,e,EB,SB,qt,{})}}new IB({target:document.getElementById("app")}); diff --git a/assets/worker-28b5e3cc.js b/assets/worker-7536a087.js similarity index 94% rename from assets/worker-28b5e3cc.js rename to assets/worker-7536a087.js index c553b78..f64c857 100644 --- a/assets/worker-28b5e3cc.js +++ b/assets/worker-7536a087.js @@ -3,4 +3,4 @@ var Me=Object.defineProperty;var Te=(A,k,R)=>k in A?Me(A,k,{enumerable:!0,config * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */const A=Symbol("Comlink.proxy"),k=Symbol("Comlink.endpoint"),R=Symbol("Comlink.releaseProxy"),H=Symbol("Comlink.finalizer"),z=Symbol("Comlink.thrown"),Z=n=>typeof n=="object"&&n!==null||typeof n=="function",ie={canHandle:n=>Z(n)&&n[A],serialize(n){const{port1:e,port2:t}=new MessageChannel;return J(n,e),[t,[t]]},deserialize(n){return n.start(),ue(n)}},ae={canHandle:n=>Z(n)&&z in n,serialize({value:n}){let e;return n instanceof Error?e={isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:e={isError:!1,value:n},[e,[]]},deserialize(n){throw n.isError?Object.assign(new Error(n.value.message),n.value):n.value}},Y=new Map([["proxy",ie],["throw",ae]]);function se(n,e){for(const t of n)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function J(n,e=globalThis,t=["*"]){e.addEventListener("message",function r(o){if(!o||!o.data)return;if(!se(t,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:b,type:s,path:u}=Object.assign({path:[]},o.data),f=(o.data.argumentList||[]).map(S);let c;try{const d=u.slice(0,-1).reduce((m,N)=>m[N],n),y=u.reduce((m,N)=>m[N],n);switch(s){case"GET":c=y;break;case"SET":d[u.slice(-1)[0]]=S(o.data.value),c=!0;break;case"APPLY":c=y.apply(d,f);break;case"CONSTRUCT":{const m=new y(...f);c=we(m)}break;case"ENDPOINT":{const{port1:m,port2:N}=new MessageChannel;J(n,N),c=de(m,[m])}break;case"RELEASE":c=void 0;break;default:return}}catch(d){c={value:d,[z]:0}}Promise.resolve(c).catch(d=>({value:d,[z]:0})).then(d=>{const[y,m]=U(d);e.postMessage(Object.assign(Object.assign({},y),{id:b}),m),s==="RELEASE"&&(e.removeEventListener("message",r),K(e),H in n&&typeof n[H]=="function"&&n[H]())}).catch(d=>{const[y,m]=U({value:new TypeError("Unserializable return value"),[z]:0});e.postMessage(Object.assign(Object.assign({},y),{id:b}),m)})}),e.start&&e.start()}function ce(n){return n.constructor.name==="MessagePort"}function K(n){ce(n)&&n.close()}function ue(n,e){return V(n,[],e)}function C(n){if(n)throw new Error("Proxy has been released and is not useable")}function X(n){return x(n,{type:"RELEASE"}).then(()=>{K(n)})}const P=new WeakMap,W="FinalizationRegistry"in globalThis&&new FinalizationRegistry(n=>{const e=(P.get(n)||0)-1;P.set(n,e),e===0&&X(n)});function fe(n,e){const t=(P.get(e)||0)+1;P.set(e,t),W&&W.register(n,e,n)}function be(n){W&&W.unregister(n)}function V(n,e=[],t=function(){}){let r=!1;const o=new Proxy(t,{get(b,s){if(C(r),s===R)return()=>{be(o),X(n),r=!0};if(s==="then"){if(e.length===0)return{then:()=>o};const u=x(n,{type:"GET",path:e.map(f=>f.toString())}).then(S);return u.then.bind(u)}return V(n,[...e,s])},set(b,s,u){C(r);const[f,c]=U(u);return x(n,{type:"SET",path:[...e,s].map(d=>d.toString()),value:f},c).then(S)},apply(b,s,u){C(r);const f=e[e.length-1];if(f===k)return x(n,{type:"ENDPOINT"}).then(S);if(f==="bind")return V(n,e.slice(0,-1));const[c,d]=Q(u);return x(n,{type:"APPLY",path:e.map(y=>y.toString()),argumentList:c},d).then(S)},construct(b,s){C(r);const[u,f]=Q(s);return x(n,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:u},f).then(S)}});return fe(o,n),o}function ge(n){return Array.prototype.concat.apply([],n)}function Q(n){const e=n.map(U);return[e.map(t=>t[0]),ge(e.map(t=>t[1]))]}const q=new WeakMap;function de(n,e){return q.set(n,e),n}function we(n){return Object.assign(n,{[A]:!0})}function U(n){for(const[e,t]of Y)if(t.canHandle(n)){const[r,o]=t.serialize(n);return[{type:"HANDLER",name:e,value:r},o]}return[{type:"RAW",value:n},q.get(n)||[]]}function S(n){switch(n.type){case"HANDLER":return Y.get(n.name).deserialize(n.value);case"RAW":return n.value}}function x(n,e,t){return new Promise(r=>{const o=le();n.addEventListener("message",function b(s){!s.data||!s.data.id||s.data.id!==o||(n.removeEventListener("message",b),r(s.data))}),n.start&&n.start(),n.postMessage(Object.assign({id:o},e),t)})}function le(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let i;const E=new Array(128).fill(void 0);E.push(void 0,null,!0,!1);function _(n){return E[n]}let M=E.length;function ye(n){n<132||(E[n]=M,M=n)}function p(n){const e=_(n);return ye(n),e}let v=0,T=null;function F(){return(T===null||T.byteLength===0)&&(T=new Uint8Array(i.memory.buffer)),T}const D=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},me=typeof D.encodeInto=="function"?function(n,e){return D.encodeInto(n,e)}:function(n,e){const t=D.encode(n);return e.set(t),{read:n.length,written:t.length}};function O(n,e,t){if(t===void 0){const u=D.encode(n),f=e(u.length,1)>>>0;return F().subarray(f,f+u.length).set(u),v=u.length,f}let r=n.length,o=e(r,1)>>>0;const b=F();let s=0;for(;s127)break;b[o+s]=u}if(s!==r){s!==0&&(n=n.slice(s)),o=t(o,r,r=s+n.length*3,1)>>>0;const u=F().subarray(o+s,o+r),f=me(n,u);s+=f.written,o=t(o,r,s,1)>>>0}return v=s,o}function h(n){return n==null}let B=null;function g(){return(B===null||B.byteLength===0)&&(B=new Int32Array(i.memory.buffer)),B}function a(n){M===E.length&&E.push(E.length+1);const e=M;return M=E[e],E[e]=n,e}const ee=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ee.decode();function l(n,e){return n=n>>>0,ee.decode(F().subarray(n,n+e))}let L=null;function ne(){return(L===null||L.byteLength===0)&&(L=new Float64Array(i.memory.buffer)),L}let j=null;function he(){return(j===null||j.byteLength===0)&&(j=new BigInt64Array(i.memory.buffer)),j}function $(n){const e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){const o=n.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){const o=n.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(n)){const o=n.length;let b="[";o>0&&(b+=$(n[0]));for(let s=1;s1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message} -${n.stack}`:r}const te=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>{i.__wbindgen_export_2.get(n.dtor)(n.a,n.b)});function re(n,e,t,r){const o={a:n,b:e,cnt:1,dtor:t},b=(...s)=>{o.cnt++;const u=o.a;o.a=0;try{return r(u,o.b,...s)}finally{--o.cnt===0?(i.__wbindgen_export_2.get(o.dtor)(u,o.b),te.unregister(o)):o.a=u}};return b.original=o,te.register(b,o,o),b}function pe(n,e,t){i._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha0b106c86a4071f7(n,e,a(t))}function ve(n,e,t){i._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a3a4bb5c4c0b039(n,e,a(t))}function ke(n,e){const t=e(n.length*1,1)>>>0;return F().set(n,t/1),v=n.length,t}function Ee(n,e){return n=n>>>0,ne().subarray(n/8,n/8+e)}function w(n,e){try{return n.apply(this,e)}catch(t){i.__wbindgen_exn_store(a(t))}}function Ae(n,e,t,r){i.wasm_bindgen__convert__closures__invoke2_mut__h5b77cba7b0f68717(n,e,a(t),a(r))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>i.__wbg_intounderlyingbytesource_free(n>>>0)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>i.__wbg_intounderlyingsink_free(n>>>0)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>i.__wbg_intounderlyingsource_free(n>>>0));const oe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>i.__wbg_mapmodel_free(n>>>0));class I{static __wrap(e){e=e>>>0;const t=Object.create(I.prototype);return t.__wbg_ptr=e,oe.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,oe.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_mapmodel_free(e)}constructor(e,t,r,o,b){const s=ke(e,i.__wbindgen_malloc),u=v;var f=h(r)?0:O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),c=v,d=h(o)?0:O(o,i.__wbindgen_malloc,i.__wbindgen_realloc),y=v;const m=i.mapmodel_new(s,u,t,f,c,d,y,h(b)?0:a(b));return p(m)}renderDebug(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_renderDebug(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}renderAmenities(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_renderAmenities(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}getInvertedBoundary(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_getInvertedBoundary(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}getBounds(){try{const o=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_getBounds(o,this.__wbg_ptr);var e=g()[o/4+0],t=g()[o/4+1],r=Ee(e,t).slice();return i.__wbindgen_free(e,t*8,8),r}finally{i.__wbindgen_add_to_stack_pointer(16)}}renderZones(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_renderZones(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}isochrone(e){let t,r;try{const d=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_isochrone(d,this.__wbg_ptr,a(e));var o=g()[d/4+0],b=g()[d/4+1],s=g()[d/4+2],u=g()[d/4+3],f=o,c=b;if(u)throw f=0,c=0,p(s);return t=f,r=c,l(f,c)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(t,r,1)}}route(e){let t,r;try{const d=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_route(d,this.__wbg_ptr,a(e));var o=g()[d/4+0],b=g()[d/4+1],s=g()[d/4+2],u=g()[d/4+3],f=o,c=b;if(u)throw f=0,c=0,p(s);return t=f,r=c,l(f,c)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(t,r,1)}}bufferRoute(e){let t,r;try{const d=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_bufferRoute(d,this.__wbg_ptr,a(e));var o=g()[d/4+0],b=g()[d/4+1],s=g()[d/4+2],u=g()[d/4+3],f=o,c=b;if(u)throw f=0,c=0,p(s);return t=f,r=c,l(f,c)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(t,r,1)}}score(e,t){let r,o;try{const y=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_score(y,this.__wbg_ptr,a(e),h(t)?0:a(t));var b=g()[y/4+0],s=g()[y/4+1],u=g()[y/4+2],f=g()[y/4+3],c=b,d=s;if(f)throw c=0,d=0,p(u);return r=c,o=d,l(c,d)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(r,o,1)}}}async function Re(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function Se(){const n={};return n.wbg={},n.wbg.__wbindgen_object_drop_ref=function(e){p(e)},n.wbg.__wbg_mapmodel_new=function(e){const t=I.__wrap(e);return a(t)},n.wbg.__wbindgen_string_get=function(e,t){const r=_(t),o=typeof r=="string"?r:void 0;var b=h(o)?0:O(o,i.__wbindgen_malloc,i.__wbindgen_realloc),s=v;g()[e/4+1]=s,g()[e/4+0]=b},n.wbg.__wbindgen_boolean_get=function(e){const t=_(e);return typeof t=="boolean"?t?1:0:2},n.wbg.__wbindgen_is_bigint=function(e){return typeof _(e)=="bigint"},n.wbg.__wbindgen_bigint_from_u64=function(e){const t=BigInt.asUintN(64,e);return a(t)},n.wbg.__wbindgen_jsval_eq=function(e,t){return _(e)===_(t)},n.wbg.__wbindgen_error_new=function(e,t){const r=new Error(l(e,t));return a(r)},n.wbg.__wbindgen_string_new=function(e,t){const r=l(e,t);return a(r)},n.wbg.__wbindgen_is_object=function(e){const t=_(e);return typeof t=="object"&&t!==null},n.wbg.__wbindgen_is_undefined=function(e){return _(e)===void 0},n.wbg.__wbindgen_in=function(e,t){return _(e)in _(t)},n.wbg.__wbindgen_number_get=function(e,t){const r=_(t),o=typeof r=="number"?r:void 0;ne()[e/8+1]=h(o)?0:o,g()[e/4+0]=!h(o)},n.wbg.__wbindgen_jsval_loose_eq=function(e,t){return _(e)==_(t)},n.wbg.__wbindgen_object_clone_ref=function(e){const t=_(e);return a(t)},n.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,t){const r=_(e)[_(t)];return a(r)},n.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return a(e)},n.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const r=_(t).stack,o=O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),b=v;g()[e/4+1]=b,g()[e/4+0]=o},n.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let r,o;try{r=e,o=t,console.error(l(e,t))}finally{i.__wbindgen_free(r,o,1)}},n.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const t=_(e).performance;return a(t)},n.wbg.__wbg_now_abd80e969af37148=function(e){return _(e).now()},n.wbg.__wbindgen_cb_drop=function(e){const t=p(e).original;return t.cnt--==1?(t.a=0,!0):!1},n.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){const t=fetch(_(e));return a(t)},n.wbg.__wbg_done_2ffa852272310e47=function(e){return _(e).done},n.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return w(function(e){const t=_(e).getReader();return a(t)},arguments)},n.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){const t=_(e).value;return a(t)},n.wbg.__wbg_fetch_1e4e8ed1f64c7e28=function(e){const t=fetch(_(e));return a(t)},n.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){const t=_(e).queueMicrotask;return a(t)},n.wbg.__wbindgen_is_function=function(e){return typeof _(e)=="function"},n.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(_(e))},n.wbg.__wbg_fetch_693453ca3f88c055=function(e,t){const r=_(e).fetch(_(t));return a(r)},n.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(_(e))},n.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(_(e))},n.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(_(e))},n.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(_(e))},n.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(_(e))},n.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03=function(){return w(function(e,t,r){const o=new Request(l(e,t),_(r));return a(o)},arguments)},n.wbg.__wbg_instanceof_Response_4c3b1446206114d1=function(e){let t;try{t=_(e)instanceof Response}catch{t=!1}return t},n.wbg.__wbg_url_83a6a4f65f7a2b38=function(e,t){const r=_(t).url,o=O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),b=v;g()[e/4+1]=b,g()[e/4+0]=o},n.wbg.__wbg_status_d6d47ad2837621eb=function(e){return _(e).status},n.wbg.__wbg_headers_24def508a7518df9=function(e){const t=_(e).headers;return a(t)},n.wbg.__wbg_body_69be35dff3d68d53=function(e){const t=_(e).body;return h(t)?0:a(t)},n.wbg.__wbg_arrayBuffer_5b2688e3dd873fed=function(){return w(function(e){const t=_(e).arrayBuffer();return a(t)},arguments)},n.wbg.__wbg_signal_3c701f5f40a5f08d=function(e){const t=_(e).signal;return a(t)},n.wbg.__wbg_new_0ae46f44b7485bb2=function(){return w(function(){const e=new AbortController;return a(e)},arguments)},n.wbg.__wbg_abort_2c4fb490d878d2b2=function(e){_(e).abort()},n.wbg.__wbg_byobRequest_05466bb0cacd89fa=function(e){const t=_(e).byobRequest;return h(t)?0:a(t)},n.wbg.__wbg_close_d29a75e8efc5fa94=function(){return w(function(e){_(e).close()},arguments)},n.wbg.__wbg_view_1fe68975176283b3=function(e){const t=_(e).view;return h(t)?0:a(t)},n.wbg.__wbg_respond_6272b341f88864a2=function(){return w(function(e,t){_(e).respond(t>>>0)},arguments)},n.wbg.__wbg_read_79c1f6a58844174c=function(e){const t=_(e).read();return a(t)},n.wbg.__wbg_releaseLock_6eb6fa75435874b8=function(e){_(e).releaseLock()},n.wbg.__wbg_cancel_ef8b2c6f99da9cde=function(e){const t=_(e).cancel();return a(t)},n.wbg.__wbg_new_7a20246daa6eec7e=function(){return w(function(){const e=new Headers;return a(e)},arguments)},n.wbg.__wbg_append_aa3f462f9e2b5ff2=function(){return w(function(e,t,r,o,b){_(e).append(l(t,r),l(o,b))},arguments)},n.wbg.__wbg_close_79df9bcee94a607c=function(){return w(function(e){_(e).close()},arguments)},n.wbg.__wbg_enqueue_e8019641f9877e27=function(){return w(function(e,t){_(e).enqueue(_(t))},arguments)},n.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,t){const r=_(e)[t>>>0];return a(r)},n.wbg.__wbg_length_cd7af8117672b8b8=function(e){return _(e).length},n.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,t){const r=new Function(l(e,t));return a(r)},n.wbg.__wbg_next_40fc327bfc8770e6=function(e){const t=_(e).next;return a(t)},n.wbg.__wbg_next_196c84450b364254=function(){return w(function(e){const t=_(e).next();return a(t)},arguments)},n.wbg.__wbg_done_298b57d23c0fc80c=function(e){return _(e).done},n.wbg.__wbg_value_d93c65011f51a456=function(e){const t=_(e).value;return a(t)},n.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return a(Symbol.iterator)},n.wbg.__wbg_get_e3c254076557e348=function(){return w(function(e,t){const r=Reflect.get(_(e),_(t));return a(r)},arguments)},n.wbg.__wbg_call_27c0f87801dedf93=function(){return w(function(e,t){const r=_(e).call(_(t));return a(r)},arguments)},n.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return a(e)},n.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return w(function(){const e=self.self;return a(e)},arguments)},n.wbg.__wbg_window_c6fb939a7f436783=function(){return w(function(){const e=window.window;return a(e)},arguments)},n.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return w(function(){const e=globalThis.globalThis;return a(e)},arguments)},n.wbg.__wbg_global_207b558942527489=function(){return w(function(){const e=global.global;return a(e)},arguments)},n.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(_(e))},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let t;try{t=_(e)instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbg_new_28c511d9baebfa89=function(e,t){const r=new Error(l(e,t));return a(r)},n.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return w(function(e,t,r){const o=_(e).call(_(t),_(r));return a(o)},arguments)},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(_(e))},n.wbg.__wbg_new_81740750da40724f=function(e,t){try{var r={a:e,b:t},o=(s,u)=>{const f=r.a;r.a=0;try{return Ae(f,r.b,s,u)}finally{r.a=f}};const b=new Promise(o);return a(b)}finally{r.a=r.b=0}},n.wbg.__wbg_resolve_b0083a7967828ec8=function(e){const t=Promise.resolve(_(e));return a(t)},n.wbg.__wbg_catch_0260e338d10f79ae=function(e,t){const r=_(e).catch(_(t));return a(r)},n.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,t){const r=_(e).then(_(t));return a(r)},n.wbg.__wbg_then_a73caa9a87991566=function(e,t,r){const o=_(e).then(_(t),_(r));return a(o)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const t=_(e).buffer;return a(t)},n.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,t,r){const o=new Uint8Array(_(e),t>>>0,r>>>0);return a(o)},n.wbg.__wbg_new_63b92bc8671ed464=function(e){const t=new Uint8Array(_(e));return a(t)},n.wbg.__wbg_set_a47bac70306a19a7=function(e,t,r){_(e).set(_(t),r>>>0)},n.wbg.__wbg_length_c20a40f15020d68a=function(e){return _(e).length},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let t;try{t=_(e)instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){const t=_(e).buffer;return a(t)},n.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return _(e).byteLength},n.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return _(e).byteOffset},n.wbg.__wbg_has_0af94d20077affa2=function(){return w(function(e,t){return Reflect.has(_(e),_(t))},arguments)},n.wbg.__wbg_set_1f9b04f170055d33=function(){return w(function(e,t,r){return Reflect.set(_(e),_(t),_(r))},arguments)},n.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return w(function(e){const t=JSON.stringify(_(e));return a(t)},arguments)},n.wbg.__wbindgen_bigint_get_as_i64=function(e,t){const r=_(t),o=typeof r=="bigint"?r:void 0;he()[e/8+1]=h(o)?BigInt(0):o,g()[e/4+0]=!h(o)},n.wbg.__wbindgen_debug_string=function(e,t){const r=$(_(t)),o=O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),b=v;g()[e/4+1]=b,g()[e/4+0]=o},n.wbg.__wbindgen_throw=function(e,t){throw new Error(l(e,t))},n.wbg.__wbindgen_memory=function(){const e=i.memory;return a(e)},n.wbg.__wbindgen_closure_wrapper1726=function(e,t,r){const o=re(e,t,623,pe);return a(o)},n.wbg.__wbindgen_closure_wrapper2715=function(e,t,r){const o=re(e,t,762,ve);return a(o)},n}function xe(n,e){return i=n.exports,G.__wbindgen_wasm_module=e,j=null,L=null,B=null,T=null,i}async function G(n){if(i!==void 0)return i;typeof n>"u"&&(n="/15m/assets/backend_bg.wasm");const e=Se();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:t,module:r}=await Re(await n,e);return xe(t,r)}class Oe{constructor(){_e(this,"inner");this.inner=null}async loadOsmFile(e,t,r,o){await G(),this.inner=await new I(e,!0,t,r,o)}async loadGraphFile(e){await G(),this.inner=await new I(e,!1,void 0,void 0,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}renderAmenities(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderAmenities())}renderZones(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderZones())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}bufferRoute(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.bufferRoute({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,use_heuristic:e.useHeuristic,start_time:e.startTime,max_seconds:e.maxSeconds}))}score(e,t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds,max_seconds:e.maxSeconds},t))}}J(Oe)})(); +${n.stack}`:r}const te=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>{i.__wbindgen_export_2.get(n.dtor)(n.a,n.b)});function re(n,e,t,r){const o={a:n,b:e,cnt:1,dtor:t},b=(...s)=>{o.cnt++;const u=o.a;o.a=0;try{return r(u,o.b,...s)}finally{--o.cnt===0?(i.__wbindgen_export_2.get(o.dtor)(u,o.b),te.unregister(o)):o.a=u}};return b.original=o,te.register(b,o,o),b}function pe(n,e,t){i._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha0b106c86a4071f7(n,e,a(t))}function ve(n,e,t){i._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4a3a4bb5c4c0b039(n,e,a(t))}function ke(n,e){const t=e(n.length*1,1)>>>0;return F().set(n,t/1),v=n.length,t}function Ee(n,e){return n=n>>>0,ne().subarray(n/8,n/8+e)}function w(n,e){try{return n.apply(this,e)}catch(t){i.__wbindgen_exn_store(a(t))}}function Ae(n,e,t,r){i.wasm_bindgen__convert__closures__invoke2_mut__h5b77cba7b0f68717(n,e,a(t),a(r))}typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>i.__wbg_intounderlyingbytesource_free(n>>>0)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>i.__wbg_intounderlyingsink_free(n>>>0)),typeof FinalizationRegistry>"u"||new FinalizationRegistry(n=>i.__wbg_intounderlyingsource_free(n>>>0));const oe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>i.__wbg_mapmodel_free(n>>>0));class I{static __wrap(e){e=e>>>0;const t=Object.create(I.prototype);return t.__wbg_ptr=e,oe.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,oe.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_mapmodel_free(e)}constructor(e,t,r,o,b){const s=ke(e,i.__wbindgen_malloc),u=v;var f=h(r)?0:O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),c=v,d=h(o)?0:O(o,i.__wbindgen_malloc,i.__wbindgen_realloc),y=v;const m=i.mapmodel_new(s,u,t,f,c,d,y,h(b)?0:a(b));return p(m)}renderDebug(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_renderDebug(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}renderAmenities(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_renderAmenities(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}getInvertedBoundary(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_getInvertedBoundary(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}getBounds(){try{const o=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_getBounds(o,this.__wbg_ptr);var e=g()[o/4+0],t=g()[o/4+1],r=Ee(e,t).slice();return i.__wbindgen_free(e,t*8,8),r}finally{i.__wbindgen_add_to_stack_pointer(16)}}renderZones(){let e,t;try{const c=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_renderZones(c,this.__wbg_ptr);var r=g()[c/4+0],o=g()[c/4+1],b=g()[c/4+2],s=g()[c/4+3],u=r,f=o;if(s)throw u=0,f=0,p(b);return e=u,t=f,l(u,f)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(e,t,1)}}isochrone(e){let t,r;try{const d=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_isochrone(d,this.__wbg_ptr,a(e));var o=g()[d/4+0],b=g()[d/4+1],s=g()[d/4+2],u=g()[d/4+3],f=o,c=b;if(u)throw f=0,c=0,p(s);return t=f,r=c,l(f,c)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(t,r,1)}}route(e){let t,r;try{const d=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_route(d,this.__wbg_ptr,a(e));var o=g()[d/4+0],b=g()[d/4+1],s=g()[d/4+2],u=g()[d/4+3],f=o,c=b;if(u)throw f=0,c=0,p(s);return t=f,r=c,l(f,c)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(t,r,1)}}bufferRoute(e){let t,r;try{const d=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_bufferRoute(d,this.__wbg_ptr,a(e));var o=g()[d/4+0],b=g()[d/4+1],s=g()[d/4+2],u=g()[d/4+3],f=o,c=b;if(u)throw f=0,c=0,p(s);return t=f,r=c,l(f,c)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(t,r,1)}}score(e,t){let r,o;try{const y=i.__wbindgen_add_to_stack_pointer(-16);i.mapmodel_score(y,this.__wbg_ptr,a(e),h(t)?0:a(t));var b=g()[y/4+0],s=g()[y/4+1],u=g()[y/4+2],f=g()[y/4+3],c=b,d=s;if(f)throw c=0,d=0,p(u);return r=c,o=d,l(c,d)}finally{i.__wbindgen_add_to_stack_pointer(16),i.__wbindgen_free(r,o,1)}}}async function Re(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{const t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function Se(){const n={};return n.wbg={},n.wbg.__wbindgen_object_drop_ref=function(e){p(e)},n.wbg.__wbg_mapmodel_new=function(e){const t=I.__wrap(e);return a(t)},n.wbg.__wbindgen_string_get=function(e,t){const r=_(t),o=typeof r=="string"?r:void 0;var b=h(o)?0:O(o,i.__wbindgen_malloc,i.__wbindgen_realloc),s=v;g()[e/4+1]=s,g()[e/4+0]=b},n.wbg.__wbindgen_is_bigint=function(e){return typeof _(e)=="bigint"},n.wbg.__wbindgen_bigint_from_u64=function(e){const t=BigInt.asUintN(64,e);return a(t)},n.wbg.__wbindgen_jsval_eq=function(e,t){return _(e)===_(t)},n.wbg.__wbindgen_error_new=function(e,t){const r=new Error(l(e,t));return a(r)},n.wbg.__wbindgen_boolean_get=function(e){const t=_(e);return typeof t=="boolean"?t?1:0:2},n.wbg.__wbindgen_string_new=function(e,t){const r=l(e,t);return a(r)},n.wbg.__wbindgen_is_object=function(e){const t=_(e);return typeof t=="object"&&t!==null},n.wbg.__wbindgen_is_undefined=function(e){return _(e)===void 0},n.wbg.__wbindgen_in=function(e,t){return _(e)in _(t)},n.wbg.__wbindgen_number_get=function(e,t){const r=_(t),o=typeof r=="number"?r:void 0;ne()[e/8+1]=h(o)?0:o,g()[e/4+0]=!h(o)},n.wbg.__wbindgen_jsval_loose_eq=function(e,t){return _(e)==_(t)},n.wbg.__wbindgen_object_clone_ref=function(e){const t=_(e);return a(t)},n.wbg.__wbg_getwithrefkey_3b3c46ba20582127=function(e,t){const r=_(e)[_(t)];return a(r)},n.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return a(e)},n.wbg.__wbg_stack_658279fe44541cf6=function(e,t){const r=_(t).stack,o=O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),b=v;g()[e/4+1]=b,g()[e/4+0]=o},n.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let r,o;try{r=e,o=t,console.error(l(e,t))}finally{i.__wbindgen_free(r,o,1)}},n.wbg.__wbg_performance_a1b8bde2ee512264=function(e){const t=_(e).performance;return a(t)},n.wbg.__wbg_now_abd80e969af37148=function(e){return _(e).now()},n.wbg.__wbindgen_cb_drop=function(e){const t=p(e).original;return t.cnt--==1?(t.a=0,!0):!1},n.wbg.__wbg_fetch_bc7c8e27076a5c84=function(e){const t=fetch(_(e));return a(t)},n.wbg.__wbg_done_2ffa852272310e47=function(e){return _(e).done},n.wbg.__wbg_getReader_ab94afcb5cb7689a=function(){return w(function(e){const t=_(e).getReader();return a(t)},arguments)},n.wbg.__wbg_value_9f6eeb1e2aab8d96=function(e){const t=_(e).value;return a(t)},n.wbg.__wbg_fetch_1e4e8ed1f64c7e28=function(e){const t=fetch(_(e));return a(t)},n.wbg.__wbg_queueMicrotask_3cbae2ec6b6cd3d6=function(e){const t=_(e).queueMicrotask;return a(t)},n.wbg.__wbindgen_is_function=function(e){return typeof _(e)=="function"},n.wbg.__wbg_queueMicrotask_481971b0d87f3dd4=function(e){queueMicrotask(_(e))},n.wbg.__wbg_fetch_693453ca3f88c055=function(e,t){const r=_(e).fetch(_(t));return a(r)},n.wbg.__wbg_debug_34c9290896ec9856=function(e){console.debug(_(e))},n.wbg.__wbg_error_e60eff06f24ab7a4=function(e){console.error(_(e))},n.wbg.__wbg_info_d7d58472d0bab115=function(e){console.info(_(e))},n.wbg.__wbg_log_a4530b4fe289336f=function(e){console.log(_(e))},n.wbg.__wbg_warn_f260f49434e45e62=function(e){console.warn(_(e))},n.wbg.__wbg_newwithstrandinit_f581dff0d19a8b03=function(){return w(function(e,t,r){const o=new Request(l(e,t),_(r));return a(o)},arguments)},n.wbg.__wbg_instanceof_Response_4c3b1446206114d1=function(e){let t;try{t=_(e)instanceof Response}catch{t=!1}return t},n.wbg.__wbg_url_83a6a4f65f7a2b38=function(e,t){const r=_(t).url,o=O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),b=v;g()[e/4+1]=b,g()[e/4+0]=o},n.wbg.__wbg_status_d6d47ad2837621eb=function(e){return _(e).status},n.wbg.__wbg_headers_24def508a7518df9=function(e){const t=_(e).headers;return a(t)},n.wbg.__wbg_body_69be35dff3d68d53=function(e){const t=_(e).body;return h(t)?0:a(t)},n.wbg.__wbg_arrayBuffer_5b2688e3dd873fed=function(){return w(function(e){const t=_(e).arrayBuffer();return a(t)},arguments)},n.wbg.__wbg_signal_3c701f5f40a5f08d=function(e){const t=_(e).signal;return a(t)},n.wbg.__wbg_new_0ae46f44b7485bb2=function(){return w(function(){const e=new AbortController;return a(e)},arguments)},n.wbg.__wbg_abort_2c4fb490d878d2b2=function(e){_(e).abort()},n.wbg.__wbg_byobRequest_05466bb0cacd89fa=function(e){const t=_(e).byobRequest;return h(t)?0:a(t)},n.wbg.__wbg_close_d29a75e8efc5fa94=function(){return w(function(e){_(e).close()},arguments)},n.wbg.__wbg_view_1fe68975176283b3=function(e){const t=_(e).view;return h(t)?0:a(t)},n.wbg.__wbg_respond_6272b341f88864a2=function(){return w(function(e,t){_(e).respond(t>>>0)},arguments)},n.wbg.__wbg_read_79c1f6a58844174c=function(e){const t=_(e).read();return a(t)},n.wbg.__wbg_releaseLock_6eb6fa75435874b8=function(e){_(e).releaseLock()},n.wbg.__wbg_cancel_ef8b2c6f99da9cde=function(e){const t=_(e).cancel();return a(t)},n.wbg.__wbg_new_7a20246daa6eec7e=function(){return w(function(){const e=new Headers;return a(e)},arguments)},n.wbg.__wbg_append_aa3f462f9e2b5ff2=function(){return w(function(e,t,r,o,b){_(e).append(l(t,r),l(o,b))},arguments)},n.wbg.__wbg_close_79df9bcee94a607c=function(){return w(function(e){_(e).close()},arguments)},n.wbg.__wbg_enqueue_e8019641f9877e27=function(){return w(function(e,t){_(e).enqueue(_(t))},arguments)},n.wbg.__wbg_get_bd8e338fbd5f5cc8=function(e,t){const r=_(e)[t>>>0];return a(r)},n.wbg.__wbg_length_cd7af8117672b8b8=function(e){return _(e).length},n.wbg.__wbg_newnoargs_e258087cd0daa0ea=function(e,t){const r=new Function(l(e,t));return a(r)},n.wbg.__wbg_next_40fc327bfc8770e6=function(e){const t=_(e).next;return a(t)},n.wbg.__wbg_next_196c84450b364254=function(){return w(function(e){const t=_(e).next();return a(t)},arguments)},n.wbg.__wbg_done_298b57d23c0fc80c=function(e){return _(e).done},n.wbg.__wbg_value_d93c65011f51a456=function(e){const t=_(e).value;return a(t)},n.wbg.__wbg_iterator_2cee6dadfd956dfa=function(){return a(Symbol.iterator)},n.wbg.__wbg_get_e3c254076557e348=function(){return w(function(e,t){const r=Reflect.get(_(e),_(t));return a(r)},arguments)},n.wbg.__wbg_call_27c0f87801dedf93=function(){return w(function(e,t){const r=_(e).call(_(t));return a(r)},arguments)},n.wbg.__wbg_new_72fb9a18b5ae2624=function(){const e=new Object;return a(e)},n.wbg.__wbg_self_ce0dbfc45cf2f5be=function(){return w(function(){const e=self.self;return a(e)},arguments)},n.wbg.__wbg_window_c6fb939a7f436783=function(){return w(function(){const e=window.window;return a(e)},arguments)},n.wbg.__wbg_globalThis_d1e6af4856ba331b=function(){return w(function(){const e=globalThis.globalThis;return a(e)},arguments)},n.wbg.__wbg_global_207b558942527489=function(){return w(function(){const e=global.global;return a(e)},arguments)},n.wbg.__wbg_isArray_2ab64d95e09ea0ae=function(e){return Array.isArray(_(e))},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let t;try{t=_(e)instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbg_new_28c511d9baebfa89=function(e,t){const r=new Error(l(e,t));return a(r)},n.wbg.__wbg_call_b3ca7c6051f9bec1=function(){return w(function(e,t,r){const o=_(e).call(_(t),_(r));return a(o)},arguments)},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(_(e))},n.wbg.__wbg_new_81740750da40724f=function(e,t){try{var r={a:e,b:t},o=(s,u)=>{const f=r.a;r.a=0;try{return Ae(f,r.b,s,u)}finally{r.a=f}};const b=new Promise(o);return a(b)}finally{r.a=r.b=0}},n.wbg.__wbg_resolve_b0083a7967828ec8=function(e){const t=Promise.resolve(_(e));return a(t)},n.wbg.__wbg_catch_0260e338d10f79ae=function(e,t){const r=_(e).catch(_(t));return a(r)},n.wbg.__wbg_then_0c86a60e8fcfe9f6=function(e,t){const r=_(e).then(_(t));return a(r)},n.wbg.__wbg_then_a73caa9a87991566=function(e,t,r){const o=_(e).then(_(t),_(r));return a(o)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){const t=_(e).buffer;return a(t)},n.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb=function(e,t,r){const o=new Uint8Array(_(e),t>>>0,r>>>0);return a(o)},n.wbg.__wbg_new_63b92bc8671ed464=function(e){const t=new Uint8Array(_(e));return a(t)},n.wbg.__wbg_set_a47bac70306a19a7=function(e,t,r){_(e).set(_(t),r>>>0)},n.wbg.__wbg_length_c20a40f15020d68a=function(e){return _(e).length},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let t;try{t=_(e)instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_buffer_dd7f74bc60f1faab=function(e){const t=_(e).buffer;return a(t)},n.wbg.__wbg_byteLength_58f7b4fab1919d44=function(e){return _(e).byteLength},n.wbg.__wbg_byteOffset_81d60f7392524f62=function(e){return _(e).byteOffset},n.wbg.__wbg_has_0af94d20077affa2=function(){return w(function(e,t){return Reflect.has(_(e),_(t))},arguments)},n.wbg.__wbg_set_1f9b04f170055d33=function(){return w(function(e,t,r){return Reflect.set(_(e),_(t),_(r))},arguments)},n.wbg.__wbg_stringify_8887fe74e1c50d81=function(){return w(function(e){const t=JSON.stringify(_(e));return a(t)},arguments)},n.wbg.__wbindgen_bigint_get_as_i64=function(e,t){const r=_(t),o=typeof r=="bigint"?r:void 0;he()[e/8+1]=h(o)?BigInt(0):o,g()[e/4+0]=!h(o)},n.wbg.__wbindgen_debug_string=function(e,t){const r=$(_(t)),o=O(r,i.__wbindgen_malloc,i.__wbindgen_realloc),b=v;g()[e/4+1]=b,g()[e/4+0]=o},n.wbg.__wbindgen_throw=function(e,t){throw new Error(l(e,t))},n.wbg.__wbindgen_memory=function(){const e=i.memory;return a(e)},n.wbg.__wbindgen_closure_wrapper1726=function(e,t,r){const o=re(e,t,623,pe);return a(o)},n.wbg.__wbindgen_closure_wrapper2715=function(e,t,r){const o=re(e,t,762,ve);return a(o)},n}function xe(n,e){return i=n.exports,G.__wbindgen_wasm_module=e,j=null,L=null,B=null,T=null,i}async function G(n){if(i!==void 0)return i;typeof n>"u"&&(n="/15m/assets/backend_bg.wasm");const e=Se();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:t,module:r}=await Re(await n,e);return xe(t,r)}class Oe{constructor(){_e(this,"inner");this.inner=null}async loadOsmFile(e,t,r,o){await G(),this.inner=await new I(e,!0,t,r,o)}async loadGraphFile(e){await G(),this.inner=await new I(e,!1,void 0,void 0,void 0)}isLoaded(){return this.inner!=null}unset(){this.inner=null}getBounds(){if(!this.inner)throw new Error("Backend used without a file loaded");return Array.from(this.inner.getBounds())}getInvertedBoundary(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.getInvertedBoundary())}renderDebug(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderDebug())}renderAmenities(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderAmenities())}renderZones(){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.renderZones())}isochrone(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.isochrone({x:e.start.lng,y:e.start.lat,mode:e.mode,contours:e.contours,start_time:e.startTime,max_seconds:e.maxSeconds}))}route(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.route({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,debug_search:e.debugSearch,use_heuristic:e.useHeuristic,start_time:e.startTime}))}bufferRoute(e){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.bufferRoute({x1:e.start.lng,y1:e.start.lat,x2:e.end[0],y2:e.end[1],mode:e.mode,use_heuristic:e.useHeuristic,start_time:e.startTime,max_seconds:e.maxSeconds}))}score(e,t){if(!this.inner)throw new Error("Backend used without a file loaded");return JSON.parse(this.inner.score({poi_kinds:e.poiKinds,max_seconds:e.maxSeconds},t))}}J(Oe)})(); diff --git a/index.html b/index.html index bc02b55..1720c49 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ 15-minute neighborhood tool - +