From 26e17062a9ef410ab83b2ce5e46c47bbc2e8bb5d Mon Sep 17 00:00:00 2001 From: dabreegster Date: Sat, 24 Aug 2024 16:42:27 +0000 Subject: [PATCH] deploy: 2d411403c67656503762d008638aa12ee9fd559c --- assets/main-52a4e42c.js | 624 ---------------------------------------- assets/main-f18bdacd.js | 624 ++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- 3 files changed, 625 insertions(+), 625 deletions(-) delete mode 100644 assets/main-52a4e42c.js create mode 100644 assets/main-f18bdacd.js diff --git a/assets/main-52a4e42c.js b/assets/main-52a4e42c.js deleted file mode 100644 index b4524ba..0000000 --- a/assets/main-52a4e42c.js +++ /dev/null @@ -1,624 +0,0 @@ -var Mb=Object.defineProperty;var Rb=(s,o,c)=>o in s?Mb(s,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[o]=c;var Md=(s,o,c)=>(Rb(s,typeof o!="symbol"?o+"":o,c),c);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const _ of document.querySelectorAll('link[rel="modulepreload"]'))d(_);new MutationObserver(_=>{for(const k of _)if(k.type==="childList")for(const I of k.addedNodes)I.tagName==="LINK"&&I.rel==="modulepreload"&&d(I)}).observe(document,{childList:!0,subtree:!0});function c(_){const k={};return _.integrity&&(k.integrity=_.integrity),_.referrerPolicy&&(k.referrerPolicy=_.referrerPolicy),_.crossOrigin==="use-credentials"?k.credentials="include":_.crossOrigin==="anonymous"?k.credentials="omit":k.credentials="same-origin",k}function d(_){if(_.ep)return;_.ep=!0;const k=c(_);fetch(_.href,k)}})();function Un(){}function Db(s,o){for(const c in o)s[c]=o[c];return s}function Bv(s){return s()}function ty(){return Object.create(null)}function ma(s){s.forEach(Bv)}function Vp(s){return typeof s=="function"}function gn(s,o){return s!=s?o==o:s!==o||s&&typeof s=="object"||typeof s=="function"}function zb(s){return Object.keys(s).length===0}function jv(s,...o){if(s==null){for(const d of o)d(void 0);return Un}const c=s.subscribe(...o);return c.unsubscribe?()=>c.unsubscribe():c}function Nb(s){let o;return jv(s,c=>o=c)(),o}function Pn(s,o,c){s.$$.on_destroy.push(jv(o,c))}function Po(s,o,c,d){if(s){const _=Uv(s,o,c,d);return s[0](_)}}function Uv(s,o,c,d){return s[1]&&d?Db(c.ctx.slice(),s[1](d(o))):c.ctx}function Lo(s,o,c,d){if(s[2]&&d){const _=s[2](d(c));if(o.dirty===void 0)return _;if(typeof _=="object"){const k=[],I=Math.max(o.dirty.length,_.length);for(let f=0;f32){const o=[],c=s.ctx.length/32;for(let d=0;ds.removeEventListener(o,c,d)}function Ln(s,o,c){c==null?s.removeAttribute(o):s.getAttribute(o)!==c&&s.setAttribute(o,c)}function Vv(s){let o;return{p(...c){o=c,o.forEach(d=>s.push(d))},r(){o.forEach(c=>s.splice(s.indexOf(c),1))}}}function jb(s){return Array.from(s.childNodes)}function Ur(s,o){o=""+o,s.data!==o&&(s.data=o)}function Nc(s,o){s.value=o??""}function Rs(s,o,c,d){c==null?s.style.removeProperty(o):s.style.setProperty(o,c,d?"important":"")}function ny(s,o,c){s.classList.toggle(o,!!c)}function Ub(s,o,{bubbles:c=!1,cancelable:d=!1}={}){return new CustomEvent(s,{detail:o,bubbles:c,cancelable:d})}let Xc;function jc(s){Xc=s}function $c(){if(!Xc)throw new Error("Function called outside component initialization");return Xc}function Vb(s){$c().$$.on_mount.push(s)}function Ro(s){$c().$$.on_destroy.push(s)}function Mf(){const s=$c();return(o,c,{cancelable:d=!1}={})=>{const _=s.$$.callbacks[o];if(_){const k=Ub(o,c,{cancelable:d});return _.slice().forEach(I=>{I.call(s,k)}),!k.defaultPrevented}return!0}}function qv(s,o){return $c().$$.context.set(s,o),o}function qb(s){return $c().$$.context.get(s)}function cs(s,o){const c=s.$$.callbacks[o.type];c&&c.slice().forEach(d=>d.call(this,o))}const xu=[],pa=[];let Su=[];const sp=[],Gv=Promise.resolve();let op=!1;function Zv(){op||(op=!0,Gv.then(Wv))}function Gb(){return Zv(),Gv}function ap(s){Su.push(s)}function Rf(s){sp.push(s)}const Rd=new Set;let du=0;function Wv(){if(du!==0)return;const s=Xc;do{try{for(;dus.indexOf(d)===-1?o.push(d):c.push(d)),c.forEach(d=>d()),Su=o}const Xh=new Set;let Rl;function ds(){Rl={r:0,c:[],p:Rl}}function ps(){Rl.r||ma(Rl.c),Rl=Rl.p}function Dt(s,o){s&&s.i&&(Xh.delete(s),s.i(o))}function Xt(s,o,c,d){if(s&&s.o){if(Xh.has(s))return;Xh.add(s),Rl.c.push(()=>{Xh.delete(s),d&&(c&&s.d(1),d())}),s.o(o)}else d&&d()}function Eo(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function Df(s,o,c){const d=s.$$.props[o];d!==void 0&&(s.$$.bound[d]=c,c(s.$$.ctx[d]))}function rn(s){s&&s.c()}function Wi(s,o,c){const{fragment:d,after_update:_}=s.$$;d&&d.m(o,c),ap(()=>{const k=s.$$.on_mount.map(Bv).filter(Vp);s.$$.on_destroy?s.$$.on_destroy.push(...k):ma(k),s.$$.on_mount=[]}),_.forEach(ap)}function Xi(s,o){const c=s.$$;c.fragment!==null&&(Wb(c.after_update),ma(c.on_destroy),c.fragment&&c.fragment.d(o),c.on_destroy=c.fragment=null,c.ctx=[])}function Xb(s,o){s.$$.dirty[0]===-1&&(xu.push(s),Zv(),s.$$.dirty.fill(0)),s.$$.dirty[o/31|0]|=1<{const re=Q.length?Q[0]:V;return F.ctx&&_(F.ctx[N],F.ctx[N]=re)&&(!F.skip_bound&&F.bound[N]&&F.bound[N](re),j&&Xb(s,N)),V}):[],F.update(),j=!0,ma(F.before_update),F.fragment=d?d(F.ctx):!1,o.target){if(o.hydrate){const N=jb(o.target);F.fragment&&F.fragment.l(N),N.forEach(St)}else F.fragment&&F.fragment.c();o.intro&&Dt(s.$$.fragment),Wi(s,o.target,o.anchor),Wv()}jc(D)}class qn{constructor(){Md(this,"$$");Md(this,"$$set")}$destroy(){Xi(this,1),this.$destroy=Un}$on(o,c){if(!Vp(c))return Un;const d=this.$$.callbacks[o]||(this.$$.callbacks[o]=[]);return d.push(c),()=>{const _=d.indexOf(c);_!==-1&&d.splice(_,1)}}$set(o){this.$$set&&!zb(o)&&(this.$$.skip_bound=!0,this.$$set(o),this.$$.skip_bound=!1)}}const Hb="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Hb);const pu=[];function Dd(s,o){return{subscribe:ko(s,o).subscribe}}function ko(s,o=Un){let c;const d=new Set;function _(f){if(gn(s,f)&&(s=f,c)){const D=!pu.length;for(const F of d)F[1](),pu.push(F,s);if(D){for(let F=0;F{d.delete(F),d.size===0&&c&&(c(),c=null)}}return{set:_,update:k,subscribe:I}}const Yb=s=>({}),ry=s=>({}),Kb=s=>({}),sy=s=>({});function Jb(s){let o,c,d,_;const k=s[1].left,I=Po(k,s,s[0],sy),f=s[1].main,D=Po(f,s,s[0],ry);return{c(){o=gt("div"),I&&I.c(),c=Vt(),d=gt("div"),D&&D.c(),Ln(o,"class","left svelte-k43lgc"),Ln(d,"class","main svelte-k43lgc")},m(F,j){Tt(F,o,j),I&&I.m(o,null),Tt(F,c,j),Tt(F,d,j),D&&D.m(d,null),_=!0},p(F,[j]){I&&I.p&&(!_||j&1)&&Ao(I,k,F,F[0],_?Lo(k,F[0],j,Kb):Mo(F[0]),sy),D&&D.p&&(!_||j&1)&&Ao(D,f,F,F[0],_?Lo(f,F[0],j,Yb):Mo(F[0]),ry)},i(F){_||(Dt(I,F),Dt(D,F),_=!0)},o(F){Xt(I,F),Xt(D,F),_=!1},d(F){F&&(St(o),St(c),St(d)),I&&I.d(F),D&&D.d(F)}}}function Qb(s,o,c){let{$$slots:d={},$$scope:_}=o;return s.$$set=k=>{"$$scope"in k&&c(0,_=k.$$scope)},[_,d]}class $b extends qn{constructor(o){super(),Vn(this,o,Qb,Jb,gn,{})}}let ew=Date.now();function eh(s){return`${s}-${ew++}`}const qp=Symbol.for("svelte-maplibre");function Ol(){return qb(qp)}function tw(s){let o=new WeakMap;return c=>{var I;let d=o.get(c.originalEvent);if(d!==void 0)return d;let k=(I=c.target.queryRenderedFeatures(c.point).find(f=>{var D;return(D=s.get(f.layer.id))==null?void 0:D.interactive}))==null?void 0:I.layer.id;return o.set(c.originalEvent,k),k}}function iw(){let s=new Map;return qv(qp,{map:ko(null),source:Dd(null),layer:Dd(null),popupTarget:Dd(null),cluster:ko(),loadedImages:ko(new Set),minzoom:ko(0),maxzoom:ko(24),layerEvent:ko(null),layerInfo:s,eventTopMost:tw(s)})}function oy(s){return{subscribe:s.subscribe}}function Xv({key:s,setPopupTarget:o=!1,setCluster:c=!1,setMouseEvent:d=!1}){let _=Ol(),k=ko(null),I=oy(k),f={..._,[s]:oy(k)};if(o&&(f.popupTarget=I),d){let D=ko(null);f.layerEvent=D,_.layerEvent=D}return c&&(f.cluster=ko()),qv(qp,f),{..._,self:k}}function Hv(){return Xv({key:"source",setCluster:!0})}function nw(s=!0){return Xv({key:"layer",setPopupTarget:s,setMouseEvent:s})}function rw(s){return"layerType"in s&&s.layerType==="deckgl"}var sw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ow(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Yv={exports:{}};/** - * MapLibre GL JS - * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.5.1/LICENSE.txt - */(function(s,o){(function(c,d){s.exports=d()})(sw,function(){var c={},d={};function _(I,f,D){if(d[I]=D,I==="index"){var F="var sharedModule = {}; ("+d.shared+")(sharedModule); ("+d.worker+")(sharedModule);",j={};return d.shared(j),d.index(c,j),typeof window<"u"&&c.setWorkerUrl(window.URL.createObjectURL(new Blob([F],{type:"text/javascript"}))),c}}_("shared",["exports"],function(I){function f(i,e,n,h){return new(n||(n=Promise))(function(g,w){function S(A){try{P(h.next(A))}catch(O){w(O)}}function T(A){try{P(h.throw(A))}catch(O){w(O)}}function P(A){var O;A.done?g(A.value):(O=A.value,O instanceof n?O:new n(function(U){U(O)})).then(S,T)}P((h=h.apply(i,e||[])).next())})}function D(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var F=j;function j(i,e){this.x=i,this.y=e}j.prototype={clone:function(){return new j(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,n=i.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),n=Math.sin(i),h=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=h,this},_rotateAround:function(i,e){var n=Math.cos(i),h=Math.sin(i),g=e.y+h*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-h*(this.y-e.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},j.convert=function(i){return i instanceof j?i:Array.isArray(i)?new j(i[0],i[1]):i};var N=D(F),V=Q;function Q(i,e,n,h){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=n,this.p2y=h}Q.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var n=i,h=0;h<8;h++){var g=this.sampleCurveX(n)-i;if(Math.abs(g)g?S=n:T=n,n=.5*(T-S)+S;return n},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var re=D(V);let Ae,xe;function Te(){return Ae==null&&(Ae=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ae}function Ce(){if(xe==null&&(xe=!1,Te())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let h=0;h<5*5;h++){const g=4*h;e.fillStyle=`rgb(${g},${g+1},${g+2})`,e.fillRect(h%5,Math.floor(h/5),1,1)}const n=e.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&n[h]!==h){xe=!0;break}}}return xe||!1}function ke(i,e,n,h){const g=new re(i,e,n,h);return w=>g.solve(w)}const Re=ke(.25,.1,.25,1);function ze(i,e,n){return Math.min(n,Math.max(e,i))}function Oe(i,e,n){const h=n-e,g=((i-e)%h+h)%h+e;return g===e?n:g}function Ze(i,...e){for(const n of e)for(const h in n)i[h]=n[h];return i}let je=1;function He(i,e,n){const h={};for(const g in i)h[g]=e.call(this,i[g],g,i);return h}function pt(i,e,n){const h={};for(const g in i)e.call(this,i[g],g,i)&&(h[g]=i[g]);return h}function Ie(i){return Array.isArray(i)?i.map(Ie):typeof i=="object"&&i?He(i,Ie):i}const Pt={};function st(i){Pt[i]||(typeof console<"u"&&console.warn(i),Pt[i]=!0)}function Ue(i,e,n){return(n.y-i.y)*(e.x-i.x)>(e.y-i.y)*(n.x-i.x)}function lt(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Lt=null;function ct(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Qt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ii(i,e,n,h,g){return f(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const w=new VideoFrame(i,{timestamp:0});try{const S=w==null?void 0:w.format;if(!S||!S.startsWith("BGR")&&!S.startsWith("RGB"))throw new Error(`Unrecognized format ${S}`);const T=S.startsWith("BGR"),P=new Uint8ClampedArray(h*g*4);if(yield w.copyTo(P,function(A,O,U,Z,Y){const J=4*Math.max(-O,0),ie=(Math.max(0,U)-U)*Z*4+J,le=4*Z,de=Math.max(0,O),De=Math.max(0,U);return{rect:{x:de,y:De,width:Math.min(A.width,O+Z)-de,height:Math.min(A.height,U+Y)-De},layout:[{offset:ie,stride:le}]}}(i,e,n,h,g)),T)for(let A=0;Alt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,vi=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const h=Ot(i.url);if(h)return h(i,e);if(lt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:mt},e)}if(!(/^file:/.test(n=i.url)||/^file:/.test(_e())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(h,g){return f(this,void 0,void 0,function*(){const w=new Request(h.url,{method:h.method||"GET",body:h.body,credentials:h.credentials,headers:h.headers,cache:h.cache,referrer:_e(),signal:g.signal});h.type!=="json"||w.headers.has("Accept")||w.headers.set("Accept","application/json");const S=yield fetch(w);if(!S.ok){const A=yield S.blob();throw new vt(S.status,S.statusText,h.url,A)}let T;T=h.type==="arrayBuffer"||h.type==="image"?S.arrayBuffer():h.type==="json"?S.json():S.text();const P=yield T;if(g.signal.aborted)throw qt();return{data:P,cacheControl:S.headers.get("Cache-Control"),expires:S.headers.get("Expires")}})}(i,e);if(lt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:mt},e)}var n;return function(h,g){return new Promise((w,S)=>{var T;const P=new XMLHttpRequest;P.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(P.responseType="arraybuffer");for(const A in h.headers)P.setRequestHeader(A,h.headers[A]);h.type==="json"&&(P.responseType="text",!((T=h.headers)===null||T===void 0)&&T.Accept||P.setRequestHeader("Accept","application/json")),P.withCredentials=h.credentials==="include",P.onerror=()=>{S(new Error(P.statusText))},P.onload=()=>{if(!g.signal.aborted)if((P.status>=200&&P.status<300||P.status===0)&&P.response!==null){let A=P.response;if(h.type==="json")try{A=JSON.parse(P.response)}catch(O){return void S(O)}w({data:A,cacheControl:P.getResponseHeader("Cache-Control"),expires:P.getResponseHeader("Expires")})}else{const A=new Blob([P.response],{type:P.getResponseHeader("Content-Type")});S(new vt(P.status,P.statusText,h.url,A))}},g.signal.addEventListener("abort",()=>{P.abort(),S(qt())}),P.send(h.body)})}(i,e)};function Kt(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),n=window.location;return e.protocol===n.protocol&&e.host===n.host}function _t(i,e,n){n[i]&&n[i].indexOf(e)!==-1||(n[i]=n[i]||[],n[i].push(e))}function he(i,e,n){if(n&&n[i]){const h=n[i].indexOf(e);h!==-1&&n[i].splice(h,1)}}class be{constructor(e,n={}){Ze(this,n),this.type=e}}class Rt extends be{constructor(e,n={}){super("error",Ze({error:e},n))}}class Ke{on(e,n){return this._listeners=this._listeners||{},_t(e,n,this._listeners),this}off(e,n){return he(e,n,this._listeners),he(e,n,this._oneTimeListeners),this}once(e,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},_t(e,n,this._oneTimeListeners),this):new Promise(h=>this.once(e,h))}fire(e,n){typeof e=="string"&&(e=new be(e,n||{}));const h=e.type;if(this.listens(h)){e.target=this;const g=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const T of g)T.call(this,e);const w=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const T of w)he(h,T,this._oneTimeListeners),T.call(this,e);const S=this._eventedParent;S&&(Ze(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),S.fire(e))}else e instanceof Rt&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,n){return this._eventedParent=e,this._eventedParentData=n,this}}var Ne={$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"},projection:{type:"projection"},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":{}}},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},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",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-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-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}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},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 Yi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Hn(i,e){const n={};for(const h in i)h!=="ref"&&(n[h]=i[h]);return Yi.forEach(h=>{h in e&&(n[h]=e[h])}),n}function Je(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let n=0;n`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const ee=[gs,ut,mi,rt,Kn,ur,Rr,H(si),Sn,Dr,ce];function $(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!$(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const n of ee)if(!$(n,e))return null}}return`Expected ${X(i)} but found ${X(e)} instead.`}function ge(i,e){return e.some(n=>n.kind===i.kind)}function we(i,e){return e.some(n=>n==="null"?i===null:n==="array"?Array.isArray(i):n==="object"?i&&!Array.isArray(i)&&typeof i=="object":n===typeof i)}function Le(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const pe=.96422,Ve=.82521,$e=4/29,Fe=6/29,dt=3*Fe*Fe,Bt=Fe*Fe*Fe,Jt=Math.PI/180,ui=180/Math.PI;function bi(i){return(i%=360)<0&&(i+=360),i}function Ht([i,e,n,h]){let g,w;const S=zi((.2225045*(i=Ai(i))+.7168786*(e=Ai(e))+.0606169*(n=Ai(n)))/1);i===e&&e===n?g=w=S:(g=zi((.4360747*i+.3850649*e+.1430804*n)/pe),w=zi((.0139322*i+.0971045*e+.7141733*n)/Ve));const T=116*S-16;return[T<0?0:T,500*(g-S),200*(S-w),h]}function Ai(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function zi(i){return i>Bt?Math.pow(i,1/3):i/dt+$e}function ji([i,e,n,h]){let g=(i+16)/116,w=isNaN(e)?g:g+e/500,S=isNaN(n)?g:g-n/200;return g=1*Ii(g),w=pe*Ii(w),S=Ve*Ii(S),[fi(3.1338561*w-1.6168667*g-.4906146*S),fi(-.9787684*w+1.9161415*g+.033454*S),fi(.0719453*w-.2289914*g+1.4052427*S),h]}function fi(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Ii(i){return i>Fe?i*i*i:dt*(i-$e)}function Mi(i){return parseInt(i.padEnd(2,i),16)/255}function sn(i,e){return wi(e?i/100:i,0,1)}function wi(i,e,n){return Math.min(Math.max(e,i),n)}function Mn(i){return!i.some(Number.isNaN)}const Oo={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 ki{constructor(e,n,h,g=1,w=!0){this.r=e,this.g=n,this.b=h,this.a=g,w||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[e,n,h,g]))}static parse(e){if(e instanceof ki)return e;if(typeof e!="string")return;const n=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=Oo[h];if(g){const[S,T,P]=g;return[S/255,T/255,P/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const S=h.length<6?1:2;let T=1;return[Mi(h.slice(T,T+=S)),Mi(h.slice(T,T+=S)),Mi(h.slice(T,T+=S)),Mi(h.slice(T,T+S)||"ff")]}if(h.startsWith("rgb")){const S=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(S){const[T,P,A,O,U,Z,Y,J,ie,le,de,De]=S,ve=[O||" ",Y||" ",le].join("");if(ve===" "||ve===" /"||ve===",,"||ve===",,,"){const Pe=[A,Z,ie].join(""),qe=Pe==="%%%"?100:Pe===""?255:0;if(qe){const it=[wi(+P/qe,0,1),wi(+U/qe,0,1),wi(+J/qe,0,1),de?sn(+de,De):1];if(Mn(it))return it}}return}}const w=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[S,T,P,A,O,U,Z,Y,J]=w,ie=[P||" ",O||" ",Z].join("");if(ie===" "||ie===" /"||ie===",,"||ie===",,,"){const le=[+T,wi(+A,0,100),wi(+U,0,100),Y?sn(+Y,J):1];if(Mn(le))return function([de,De,ve,Pe]){function qe(it){const Et=(it+de/30)%12,$t=De*Math.min(ve,1-ve);return ve-$t*Math.max(-1,Math.min(Et-3,9-Et,1))}return de=bi(de),De/=100,ve/=100,[qe(0),qe(8),qe(4),Pe]}(le)}}}(e);return n?new ki(...n,!1):void 0}get rgb(){const{r:e,g:n,b:h,a:g}=this,w=g||1/0;return this.overwriteGetter("rgb",[e/w,n/w,h/w,g])}get hcl(){return this.overwriteGetter("hcl",function(e){const[n,h,g,w]=Ht(e),S=Math.sqrt(h*h+g*g);return[Math.round(1e4*S)?bi(Math.atan2(g,h)*ui):NaN,S,n,w]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ht(this.rgb))}overwriteGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}toString(){const[e,n,h,g]=this.rgb;return`rgba(${[e,n,h].map(w=>Math.round(255*w)).join(",")},${g})`}}ki.black=new ki(0,0,0,1),ki.white=new ki(1,1,1,1),ki.transparent=new ki(0,0,0,0),ki.red=new ki(1,0,0,1);class Ns{constructor(e,n,h){this.sensitivity=e?n?"variant":"case":n?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,n){return this.collator.compare(e,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Fo{constructor(e,n,h,g,w){this.text=e,this.image=n,this.scale=h,this.fontStack=g,this.textColor=w}}class Gn{constructor(e){this.sections=e}static fromString(e){return new Gn([new Fo(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Gn?e:Gn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Jn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Jn)return e;if(typeof e=="number")return new Jn([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const n of e)if(typeof n!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Jn(e)}}toString(){return JSON.stringify(this.values)}}const Fu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class on{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof on)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let n=0;n=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof n=="number"&&n>=0&&n<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[i,e,n,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[i,e,n,h]:[i,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Vr(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ki||i instanceof Ns||i instanceof Gn||i instanceof Jn||i instanceof on||i instanceof hn)return!0;if(Array.isArray(i)){for(const e of i)if(!Vr(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Vr(i[e]))return!1;return!0}return!1}function an(i){if(i===null)return gs;if(typeof i=="string")return mi;if(typeof i=="boolean")return rt;if(typeof i=="number")return ut;if(i instanceof ki)return Kn;if(i instanceof Ns)return cn;if(i instanceof Gn)return ur;if(i instanceof Jn)return Sn;if(i instanceof on)return ce;if(i instanceof hn)return Dr;if(Array.isArray(i)){const e=i.length;let n;for(const h of i){const g=an(h);if(n){if(n===g)continue;n=si;break}n=g}return H(n||si,e)}return Rr}function Jr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ki||i instanceof Gn||i instanceof Jn||i instanceof on||i instanceof hn?i.toString():JSON.stringify(i)}class Os{constructor(e,n){this.type=e,this.value=n}static parse(e,n){if(e.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Vr(e[1]))return n.error("invalid value");const h=e[1];let g=an(h);const w=n.expectedType;return g.kind!=="array"||g.N!==0||!w||w.kind!=="array"||typeof w.N=="number"&&w.N!==0||(g=w),new Os(g,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class fn{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Bo={string:mi,number:ut,boolean:rt,object:Rr};class cr{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let h,g=1;const w=e[0];if(w==="array"){let T,P;if(e.length>2){const A=e[1];if(typeof A!="string"||!(A in Bo)||A==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);T=Bo[A],g++}else T=si;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return n.error('The length argument to "array" must be a positive integer literal',2);P=e[2],g++}h=H(T,P)}else{if(!Bo[w])throw new Error(`Types doesn't contain name = ${w}`);h=Bo[w]}const S=[];for(;ge.outputDefined())}}const ys={"to-boolean":rt,"to-color":Kn,"to-number":ut,"to-string":mi};class Rn{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");const h=e[0];if(!ys[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&e.length!==2)return n.error("Expected one argument.");const g=ys[h],w=[];for(let S=1;S4?`Invalid rbga value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:io(n[0],n[1],n[2],n[3]),!h))return new ki(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new fn(h||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const h of this.args){n=h.evaluate(e);const g=Jn.parse(n);if(g)return g}throw new fn(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const h of this.args){n=h.evaluate(e);const g=on.parse(n);if(g)return g}throw new fn(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const h of this.args){if(n=h.evaluate(e),n===null)return 0;const g=Number(n);if(!isNaN(g))return g}throw new fn(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return Gn.fromString(Jr(this.args[0].evaluate(e)));case"resolvedImage":return hn.fromString(Jr(this.args[0].evaluate(e)));default:return Jr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const qr=["Unknown","Point","LineString","Polygon"];class no{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"?qr[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(e){let n=this._parseColorCache[e];return n||(n=this._parseColorCache[e]=ki.parse(e)),n}}class hr{constructor(e,n,h=[],g,w=new ei,S=[]){this.registry=e,this.path=h,this.key=h.map(T=>`[${T}]`).join(""),this.scope=w,this.errors=S,this.expectedType=g,this._isConstant=n}parse(e,n,h,g,w={}){return n?this.concat(n,h,g)._parse(e,w):this._parse(e,w)}_parse(e,n){function h(g,w,S){return S==="assert"?new cr(w,[g]):S==="coerce"?new Rn(w,[g]):g}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=e[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const w=this.registry[g];if(w){let S=w.parse(e,this);if(!S)return null;if(this.expectedType){const T=this.expectedType,P=S.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||P.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(T.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(T.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(T,P))return null}else S=h(S,T,n.typeAnnotation||"coerce");else S=h(S,T,n.typeAnnotation||"coerce");else S=h(S,T,n.typeAnnotation||"coerce");else S=h(S,T,n.typeAnnotation||"assert")}if(!(S instanceof Os)&&S.type.kind!=="resolvedImage"&&this._isConstant(S)){const T=new no;try{S=new Os(S.type,S.evaluate(T))}catch(P){return this.error(P.message),null}}return S}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,n,h){const g=typeof e=="number"?this.path.concat(e):this.path,w=h?this.scope.concat(h):this.scope;return new hr(this.registry,this._isConstant,g,n||null,w,this.errors)}error(e,...n){const h=`${this.key}${n.map(g=>`[${g}]`).join("")}`;this.errors.push(new li(h,e))}checkSubtype(e,n){const h=$(e,n);return h&&this.error(h),h}}class Si{constructor(e,n){this.type=n.type,this.bindings=[].concat(e),this.result=n}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const n of this.bindings)e(n[1]);e(this.result)}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const h=[];for(let w=1;w=h.length)throw new fn(`Array index out of bounds: ${n} > ${h.length-1}.`);if(n!==Math.floor(n))throw new fn(`Array index must be an integer, but found ${n} instead.`);return h[n]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class jo{constructor(e,n){this.type=rt,this.needle=e,this.haystack=n}static parse(e,n){if(e.length!==3)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const h=n.parse(e[1],1,si),g=n.parse(e[2],2,si);return h&&g?ge(h.type,[rt,mi,ut,gs,si])?new jo(h,g):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${X(h.type)} instead`):null}evaluate(e){const n=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!h)return!1;if(!we(n,["boolean","string","number","null"]))throw new fn(`Expected first argument to be of type boolean, string, number or null, but found ${X(an(n))} instead.`);if(!we(h,["string","array"]))throw new fn(`Expected second argument to be of type array or string, but found ${X(an(h))} instead.`);return h.indexOf(n)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Uo{constructor(e,n,h){this.type=ut,this.needle=e,this.haystack=n,this.fromIndex=h}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=n.parse(e[1],1,si),g=n.parse(e[2],2,si);if(!h||!g)return null;if(!ge(h.type,[rt,mi,ut,gs,si]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${X(h.type)} instead`);if(e.length===4){const w=n.parse(e[3],3,ut);return w?new Uo(h,g,w):null}return new Uo(h,g)}evaluate(e){const n=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!we(n,["boolean","string","number","null"]))throw new fn(`Expected first argument to be of type boolean, string, number or null, but found ${X(an(n))} instead.`);if(!we(h,["string","array"]))throw new fn(`Expected second argument to be of type array or string, but found ${X(an(h))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(e);return h.indexOf(n,g)}return h.indexOf(n)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class _s{constructor(e,n,h,g,w,S){this.inputType=e,this.type=n,this.input=h,this.cases=g,this.outputs=w,this.otherwise=S}static parse(e,n){if(e.length<5)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return n.error("Expected an even number of arguments.");let h,g;n.expectedType&&n.expectedType.kind!=="value"&&(g=n.expectedType);const w={},S=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return Z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof J=="number"&&Math.floor(J)!==J)return Z.error("Numeric branch labels must be integer values.");if(h){if(Z.checkSubtype(h,an(J)))return null}else h=an(J);if(w[String(J)]!==void 0)return Z.error("Branch labels must be unique.");w[String(J)]=S.length}const Y=n.parse(U,A,g);if(!Y)return null;g=g||Y.type,S.push(Y)}const T=n.parse(e[1],1,si);if(!T)return null;const P=n.parse(e[e.length-1],e.length-1,g);return P?T.type.kind!=="value"&&n.concat(1).checkSubtype(h,T.type)?null:new _s(h,g,T,w,S,P):null}evaluate(e){const n=this.input.evaluate(e);return(an(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Vo{constructor(e,n,h){this.type=e,this.branches=n,this.otherwise=h}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return n.error("Expected an odd number of arguments.");let h;n.expectedType&&n.expectedType.kind!=="value"&&(h=n.expectedType);const g=[];for(let S=1;Sn.outputDefined())&&this.otherwise.outputDefined()}}class ya{constructor(e,n,h,g){this.type=e,this.input=n,this.beginIndex=h,this.endIndex=g}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=n.parse(e[1],1,si),g=n.parse(e[2],2,ut);if(!h||!g)return null;if(!ge(h.type,[H(si),mi,si]))return n.error(`Expected first argument to be of type array or string, but found ${X(h.type)} instead`);if(e.length===4){const w=n.parse(e[3],3,ut);return w?new ya(h.type,h,g,w):null}return new ya(h.type,h,g)}evaluate(e){const n=this.input.evaluate(e),h=this.beginIndex.evaluate(e);if(!we(n,["string","array"]))throw new fn(`Expected first argument to be of type array or string, but found ${X(an(n))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(e);return n.slice(h,g)}return n.slice(h)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ro(i,e){const n=i.length-1;let h,g,w=0,S=n,T=0;for(;w<=S;)if(T=Math.floor((w+S)/2),h=i[T],g=i[T+1],h<=e){if(T===n||ee))throw new fn("Input is not a number.");S=T-1}return 0}class so{constructor(e,n,h){this.type=e,this.input=n,this.labels=[],this.outputs=[];for(const[g,w]of h)this.labels.push(g),this.outputs.push(w)}static parse(e,n){if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");const h=n.parse(e[1],1,ut);if(!h)return null;const g=[];let w=null;n.expectedType&&n.expectedType.kind!=="value"&&(w=n.expectedType);for(let S=1;S=T)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const U=n.parse(P,O,w);if(!U)return null;w=w||U.type,g.push([T,U])}return new so(w,h,g)}evaluate(e){const n=this.labels,h=this.outputs;if(n.length===1)return h[0].evaluate(e);const g=this.input.evaluate(e);if(g<=n[0])return h[0].evaluate(e);const w=n.length;return g>=n[w-1]?h[w-1].evaluate(e):h[ro(n,g)].evaluate(e)}eachChild(e){e(this.input);for(const n of this.outputs)e(n)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function il(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ji=vs;function vs(i,e,n,h){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=n,this.p2y=h}vs.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var n=i,h=0;h<8;h++){var g=this.sampleCurveX(n)-i;if(Math.abs(g)g?S=n:T=n,n=.5*(T-S)+S;return n},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Bu=il(Ji);function Gr(i,e,n){return i+n*(e-i)}function Dn(i,e,n){return i.map((h,g)=>Gr(h,e[g],n))}const Qi={number:Gr,color:function(i,e,n,h="rgb"){switch(h){case"rgb":{const[g,w,S,T]=Dn(i.rgb,e.rgb,n);return new ki(g,w,S,T,!1)}case"hcl":{const[g,w,S,T]=i.hcl,[P,A,O,U]=e.hcl;let Z,Y;if(isNaN(g)||isNaN(P))isNaN(g)?isNaN(P)?Z=NaN:(Z=P,S!==1&&S!==0||(Y=A)):(Z=g,O!==1&&O!==0||(Y=w));else{let De=P-g;P>g&&De>180?De-=360:P180&&(De+=360),Z=g+n*De}const[J,ie,le,de]=function([De,ve,Pe,qe]){return De=isNaN(De)?0:De*Jt,ji([Pe,Math.cos(De)*ve,Math.sin(De)*ve,qe])}([Z,Y??Gr(w,A,n),Gr(S,O,n),Gr(T,U,n)]);return new ki(J,ie,le,de,!1)}case"lab":{const[g,w,S,T]=ji(Dn(i.lab,e.lab,n));return new ki(g,w,S,T,!1)}}},array:Dn,padding:function(i,e,n){return new Jn(Dn(i.values,e.values,n))},variableAnchorOffsetCollection:function(i,e,n){const h=i.values,g=e.values;if(h.length!==g.length)throw new fn(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const w=[];for(let S=0;Stypeof O!="number"||O<0||O>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:A}}}if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(w=n.parse(w,2,ut),!w)return null;const T=[];let P=null;h==="interpolate-hcl"||h==="interpolate-lab"?P=Kn:n.expectedType&&n.expectedType.kind!=="value"&&(P=n.expectedType);for(let A=0;A=O)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Z);const J=n.parse(U,Y,P);if(!J)return null;P=P||J.type,T.push([O,J])}return Le(P,ut)||Le(P,Kn)||Le(P,Sn)||Le(P,ce)||Le(P,H(ut))?new zn(P,h,g,w,T):n.error(`Type ${X(P)} is not interpolatable.`)}evaluate(e){const n=this.labels,h=this.outputs;if(n.length===1)return h[0].evaluate(e);const g=this.input.evaluate(e);if(g<=n[0])return h[0].evaluate(e);const w=n.length;if(g>=n[w-1])return h[w-1].evaluate(e);const S=ro(n,g),T=zn.interpolationFactor(this.interpolation,g,n[S],n[S+1]),P=h[S].evaluate(e),A=h[S+1].evaluate(e);switch(this.operator){case"interpolate":return Qi[this.type.kind](P,A,T);case"interpolate-hcl":return Qi.color(P,A,T,"hcl");case"interpolate-lab":return Qi.color(P,A,T,"lab")}}eachChild(e){e(this.input);for(const n of this.outputs)e(n)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function qo(i,e,n,h){const g=h-n,w=i-n;return g===0?0:e===1?w/g:(Math.pow(e,w)-1)/(Math.pow(e,g)-1)}class _a{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expectected at least one argument.");let h=null;const g=n.expectedType;g&&g.kind!=="value"&&(h=g);const w=[];for(const T of e.slice(1)){const P=n.parse(T,1+w.length,h,void 0,{typeAnnotation:"omit"});if(!P)return null;h=h||P.type,w.push(P)}if(!h)throw new Error("No output type");const S=g&&w.some(T=>$(g,T.type));return new _a(S?si:h,w)}evaluate(e){let n,h=null,g=0;for(const w of this.args)if(g++,h=w.evaluate(e),h&&h instanceof hn&&!h.available&&(n||(n=h.name),h=null,g===this.args.length&&(h=n)),h!==null)break;return h}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function nl(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Go(i,e,n,h){return h.compare(e,n)===0}function Fs(i,e,n){const h=i!=="=="&&i!=="!=";return class Kv{constructor(w,S,T){this.type=rt,this.lhs=w,this.rhs=S,this.collator=T,this.hasUntypedArgument=w.type.kind==="value"||S.type.kind==="value"}static parse(w,S){if(w.length!==3&&w.length!==4)return S.error("Expected two or three arguments.");const T=w[0];let P=S.parse(w[1],1,si);if(!P)return null;if(!nl(T,P.type))return S.concat(1).error(`"${T}" comparisons are not supported for type '${X(P.type)}'.`);let A=S.parse(w[2],2,si);if(!A)return null;if(!nl(T,A.type))return S.concat(2).error(`"${T}" comparisons are not supported for type '${X(A.type)}'.`);if(P.type.kind!==A.type.kind&&P.type.kind!=="value"&&A.type.kind!=="value")return S.error(`Cannot compare types '${X(P.type)}' and '${X(A.type)}'.`);h&&(P.type.kind==="value"&&A.type.kind!=="value"?P=new cr(A.type,[P]):P.type.kind!=="value"&&A.type.kind==="value"&&(A=new cr(P.type,[A])));let O=null;if(w.length===4){if(P.type.kind!=="string"&&A.type.kind!=="string"&&P.type.kind!=="value"&&A.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(O=S.parse(w[3],3,cn),!O)return null}return new Kv(P,A,O)}evaluate(w){const S=this.lhs.evaluate(w),T=this.rhs.evaluate(w);if(h&&this.hasUntypedArgument){const P=an(S),A=an(T);if(P.kind!==A.kind||P.kind!=="string"&&P.kind!=="number")throw new fn(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${P.kind}, ${A.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const P=an(S),A=an(T);if(P.kind!=="string"||A.kind!=="string")return e(w,S,T)}return this.collator?n(w,S,T,this.collator.evaluate(w)):e(w,S,T)}eachChild(w){w(this.lhs),w(this.rhs),this.collator&&w(this.collator)}outputDefined(){return!0}}}const rl=Fs("==",function(i,e,n){return e===n},Go),Ti=Fs("!=",function(i,e,n){return e!==n},function(i,e,n,h){return!Go(0,e,n,h)}),Zr=Fs("<",function(i,e,n){return e",function(i,e,n){return e>n},function(i,e,n,h){return h.compare(e,n)>0}),sl=Fs("<=",function(i,e,n){return e<=n},function(i,e,n,h){return h.compare(e,n)<=0}),Zo=Fs(">=",function(i,e,n){return e>=n},function(i,e,n,h){return h.compare(e,n)>=0});class Wo{constructor(e,n,h){this.type=cn,this.locale=h,this.caseSensitive=e,this.diacriticSensitive=n}static parse(e,n){if(e.length!==2)return n.error("Expected one argument.");const h=e[1];if(typeof h!="object"||Array.isArray(h))return n.error("Collator options argument must be an object.");const g=n.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,rt);if(!g)return null;const w=n.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,rt);if(!w)return null;let S=null;return h.locale&&(S=n.parse(h.locale,1,mi),!S)?null:new Wo(g,w,S)}evaluate(e){return new Ns(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class In{constructor(e,n,h,g,w){this.type=mi,this.number=e,this.locale=n,this.currency=h,this.minFractionDigits=g,this.maxFractionDigits=w}static parse(e,n){if(e.length!==3)return n.error("Expected two arguments.");const h=n.parse(e[1],1,ut);if(!h)return null;const g=e[2];if(typeof g!="object"||Array.isArray(g))return n.error("NumberFormat options argument must be an object.");let w=null;if(g.locale&&(w=n.parse(g.locale,1,mi),!w))return null;let S=null;if(g.currency&&(S=n.parse(g.currency,1,mi),!S))return null;let T=null;if(g["min-fraction-digits"]&&(T=n.parse(g["min-fraction-digits"],1,ut),!T))return null;let P=null;return g["max-fraction-digits"]&&(P=n.parse(g["max-fraction-digits"],1,ut),!P)?null:new In(h,w,S,T,P)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Xo{constructor(e){this.type=ur,this.sections=e}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");const h=e[1];if(!Array.isArray(h)&&typeof h=="object")return n.error("First argument must be an image or text section.");const g=[];let w=!1;for(let S=1;S<=e.length-1;++S){const T=e[S];if(w&&typeof T=="object"&&!Array.isArray(T)){w=!1;let P=null;if(T["font-scale"]&&(P=n.parse(T["font-scale"],1,ut),!P))return null;let A=null;if(T["text-font"]&&(A=n.parse(T["text-font"],1,H(mi)),!A))return null;let O=null;if(T["text-color"]&&(O=n.parse(T["text-color"],1,Kn),!O))return null;const U=g[g.length-1];U.scale=P,U.font=A,U.textColor=O}else{const P=n.parse(e[S],1,si);if(!P)return null;const A=P.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");w=!0,g.push({content:P,scale:null,font:null,textColor:null})}}return new Xo(g)}evaluate(e){return new Gn(this.sections.map(n=>{const h=n.content.evaluate(e);return an(h)===Dr?new Fo("",h,null,null,null):new Fo(Jr(h),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)}))}eachChild(e){for(const n of this.sections)e(n.content),n.scale&&e(n.scale),n.font&&e(n.font),n.textColor&&e(n.textColor)}outputDefined(){return!1}}class Ho{constructor(e){this.type=Dr,this.input=e}static parse(e,n){if(e.length!==2)return n.error("Expected two arguments.");const h=n.parse(e[1],1,mi);return h?new Ho(h):n.error("No image name provided.")}evaluate(e){const n=this.input.evaluate(e),h=hn.fromString(n);return h&&e.availableImages&&(h.available=e.availableImages.indexOf(n)>-1),h}eachChild(e){e(this.input)}outputDefined(){return!1}}class xa{constructor(e){this.type=ut,this.input=e}static parse(e,n){if(e.length!==2)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);const h=n.parse(e[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${X(h.type)} instead.`):new xa(h):null}evaluate(e){const n=this.input.evaluate(e);if(typeof n=="string"||Array.isArray(n))return n.length;throw new fn(`Expected value to be of type string or array, but found ${X(an(n))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const zr=8192;function ol(i,e){const n=(180+i[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,g=Math.pow(2,e.z);return[Math.round(n*g*zr),Math.round(h*g*zr)]}function Bs(i,e){const n=Math.pow(2,e.z);return[(g=(i[0]/zr+e.x)/n,360*g-180),(h=(i[1]/zr+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*h)*Math.PI/180))-90)];var h,g}function pi(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function xs(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function ju(i,e,n){const h=i[0]-e[0],g=i[1]-e[1],w=i[0]-n[0],S=i[1]-n[1];return h*S-w*g==0&&h*w<=0&&g*S<=0}function Zn(i,e,n,h){return(g=[h[0]-n[0],h[1]-n[1]])[0]*(w=[e[0]-i[0],e[1]-i[1]])[1]-g[1]*w[0]!=0&&!(!Ul(i,e,n,h)||!Ul(n,h,i,e));var g,w}function oo(i,e,n){for(const h of n)for(let g=0;g(g=i)[1]!=(S=T[P+1])[1]>g[1]&&g[0]<(S[0]-w[0])*(g[1]-w[1])/(S[1]-w[1])+w[0]&&(h=!h)}var g,w,S;return h}function lo(i,e){for(const n of e)if(ao(i,n))return!0;return!1}function al(i,e){for(const n of i)if(!ao(n,e))return!1;for(let n=0;n0&&T<0||S<0&&T>0}function kr(i,e,n){const h=[];for(let g=0;gn[2]){const g=.5*h;let w=i[0]-n[0]>g?-h:n[0]-i[0]>g?h:0;w===0&&(w=i[0]-n[2]>g?-h:n[2]-i[0]>g?h:0),i[0]+=w}pi(e,i)}function ql(i,e,n,h){const g=Math.pow(2,h.z)*zr,w=[h.x*zr,h.y*zr],S=[];for(const T of i)for(const P of T){const A=[P.x+w[0],P.y+w[1]];Vl(A,e,n,g),S.push(A)}return S}function Gl(i,e,n,h){const g=Math.pow(2,h.z)*zr,w=[h.x*zr,h.y*zr],S=[];for(const P of i){const A=[];for(const O of P){const U=[O.x+w[0],O.y+w[1]];pi(e,U),A.push(U)}S.push(A)}if(e[2]-e[0]<=g/2){(T=e)[0]=T[1]=1/0,T[2]=T[3]=-1/0;for(const P of S)for(const A of P)Vl(A,e,n,g)}var T;return S}class js{constructor(e,n){this.type=rt,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Vr(e[1])){const h=e[1];if(h.type==="FeatureCollection"){const g=[];for(const w of h.features){const{type:S,coordinates:T}=w.geometry;S==="Polygon"&&g.push(T),S==="MultiPolygon"&&g.push(...T)}if(g.length)return new js(h,{type:"MultiPolygon",coordinates:g})}else if(h.type==="Feature"){const g=h.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new js(h,h.geometry)}else if(h.type==="Polygon"||h.type==="MultiPolygon")return new js(h,h)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(n,h){const g=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],S=n.canonicalID();if(h.type==="Polygon"){const T=kr(h.coordinates,w,S),P=ql(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!ao(A,T))return!1}if(h.type==="MultiPolygon"){const T=ll(h.coordinates,w,S),P=ql(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!lo(A,T))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(n,h){const g=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],S=n.canonicalID();if(h.type==="Polygon"){const T=kr(h.coordinates,w,S),P=Gl(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!al(A,T))return!1}if(h.type==="MultiPolygon"){const T=ll(h.coordinates,w,S),P=Gl(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!uo(A,T))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Zl=class{constructor(i=[],e=Uu){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:n}=this,h=e[i];for(;i>0;){const g=i-1>>1,w=e[g];if(n(h,w)>=0)break;e[i]=w,i=g}e[i]=h}_down(i){const{data:e,compare:n}=this,h=this.length>>1,g=e[i];for(;i=0)break;e[i]=S,i=w}e[i]=g}};function Uu(i,e){return ie?1:0}function Vu(i,e,n,h,g){bs(i,e,n,h||i.length-1,g||qu)}function bs(i,e,n,h,g){for(;h>n;){if(h-n>600){var w=h-n+1,S=e-n+1,T=Math.log(w),P=.5*Math.exp(2*T/3),A=.5*Math.sqrt(T*P*(w-P)/w)*(S-w/2<0?-1:1);bs(i,e,Math.max(n,Math.floor(e-S*P/w+A)),Math.min(h,Math.floor(e+(w-S)*P/w+A)),g)}var O=i[e],U=n,Z=h;for(En(i,n,e),g(i[h],O)>0&&En(i,n,h);U0;)Z--}g(i[n],O)===0?En(i,n,Z):En(i,++Z,h),Z<=e&&(n=Z+1),e<=Z&&(h=Z-1)}}function En(i,e,n){var h=i[e];i[e]=i[n],i[n]=h}function qu(i,e){return ie?1:0}function Yo(i,e){if(i.length<=1)return[i];const n=[];let h,g;for(const w of i){const S=ul(w);S!==0&&(w.area=Math.abs(S),g===void 0&&(g=S<0),g===S<0?(h&&n.push(h),h=[w]):h.push(w))}if(h&&n.push(h),e>1)for(let w=0;w1?(A=e[P+1][0],O=e[P+1][1]):Y>0&&(A+=U/this.kx*Y,O+=Z/this.ky*Y)),U=this.wrap(n[0]-A)*this.kx,Z=(n[1]-O)*this.ky;const J=U*U+Z*Z;J180;)e-=360;return e}}function fl(i,e){return e[0]-i[0]}function Nn(i){return i[1]-i[0]+1}function dr(i,e){return i[1]>=i[0]&&i[1]i[1])return[null,null];const n=Nn(i);if(e){if(n===2)return[i,null];const g=Math.floor(n/2);return[[i[0],i[0]+g],[i[0]+g,i[1]]]}if(n===1)return[i,null];const h=Math.floor(n/2)-1;return[[i[0],i[0]+h],[i[0]+h+1,i[1]]]}function wa(i,e){if(!dr(e,i.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let h=e[0];h<=e[1];++h)pi(n,i[h]);return n}function ka(i){const e=[1/0,1/0,-1/0,-1/0];for(const n of i)for(const h of n)pi(e,h);return e}function dl(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Jo(i,e,n){if(!dl(i)||!dl(e))return NaN;let h=0,g=0;return i[2]e[2]&&(h=i[0]-e[2]),i[1]>e[3]&&(g=i[1]-e[3]),i[3]=h)return h;if(xs(g,w)){if(Qo(i,e))return 0}else if(Qo(e,i))return 0;let S=1/0;for(const T of i)for(let P=0,A=T.length,O=A-1;P0;){const P=S.pop();if(P[0]>=w)continue;const A=P[1],O=e?50:100;if(Nn(A)<=O){if(!dr(A,i.length))return NaN;if(e){const U=Ui(i,A,n,h);if(isNaN(U)||U===0)return U;w=Math.min(w,U)}else for(let U=A[0];U<=A[1];++U){const Z=qi(i[U],n,h);if(w=Math.min(w,Z),w===0)return 0}}else{const U=Ko(A,e);Sa(S,w,h,i,T,U[0]),Sa(S,w,h,i,T,U[1])}}return w}function Ea(i,e,n,h,g,w=1/0){let S=Math.min(w,g.distance(i[0],n[0]));if(S===0)return S;const T=new Zl([[0,[0,i.length-1],[0,n.length-1]]],fl);for(;T.length>0;){const P=T.pop();if(P[0]>=S)continue;const A=P[1],O=P[2],U=e?50:100,Z=h?50:100;if(Nn(A)<=U&&Nn(O)<=Z){if(!dr(A,i.length)&&dr(O,n.length))return NaN;let Y;if(e&&h)Y=yi(i,A,n,O,g),S=Math.min(S,Y);else if(e&&!h){const J=i.slice(A[0],A[1]+1);for(let ie=O[0];ie<=O[1];++ie)if(Y=Ni(n[ie],J,g),S=Math.min(S,Y),S===0)return S}else if(!e&&h){const J=n.slice(O[0],O[1]+1);for(let ie=A[0];ie<=A[1];++ie)if(Y=Ni(i[ie],J,g),S=Math.min(S,Y),S===0)return S}else Y=ml(i,A,n,O,g),S=Math.min(S,Y)}else{const Y=Ko(A,e),J=Ko(O,h);Ia(T,S,g,i,n,Y[0],J[0]),Ia(T,S,g,i,n,Y[0],J[1]),Ia(T,S,g,i,n,Y[1],J[0]),Ia(T,S,g,i,n,Y[1],J[1])}}return S}function gl(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class ws{constructor(e,n){this.type=ut,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Vr(e[1])){const h=e[1];if(h.type==="FeatureCollection")return new ws(h,h.features.map(g=>gl(g.geometry)).flat());if(h.type==="Feature")return new ws(h,gl(h.geometry));if("type"in h&&"coordinates"in h)return new ws(h,gl(h))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(n,h){const g=n.geometry(),w=g.flat().map(P=>Bs([P.x,P.y],n.canonical));if(g.length===0)return NaN;const S=new fr(w[0][1]);let T=1/0;for(const P of h){switch(P.type){case"Point":T=Math.min(T,Ea(w,!1,[P.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Ea(w,!1,P.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,$o(w,!1,P.coordinates,S,T))}if(T===0)return T}return T}(e,this.geometries);if(e.geometryType()==="LineString")return function(n,h){const g=n.geometry(),w=g.flat().map(P=>Bs([P.x,P.y],n.canonical));if(g.length===0)return NaN;const S=new fr(w[0][1]);let T=1/0;for(const P of h){switch(P.type){case"Point":T=Math.min(T,Ea(w,!0,[P.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Ea(w,!0,P.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,$o(w,!0,P.coordinates,S,T))}if(T===0)return T}return T}(e,this.geometries);if(e.geometryType()==="Polygon")return function(n,h){const g=n.geometry();if(g.length===0||g[0].length===0)return NaN;const w=Yo(g,0).map(P=>P.map(A=>A.map(O=>Bs([O.x,O.y],n.canonical)))),S=new fr(w[0][0][0][1]);let T=1/0;for(const P of h)for(const A of w){switch(P.type){case"Point":T=Math.min(T,$o([P.coordinates],!1,A,S,T));break;case"LineString":T=Math.min(T,$o(P.coordinates,!0,A,S,T));break;case"Polygon":T=Math.min(T,Wl(A,P.coordinates,S,T))}if(T===0)return T}return T}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Us={"==":rl,"!=":Ti,">":va,"<":Zr,">=":Zo,"<=":sl,array:cr,at:tl,boolean:cr,case:Vo,coalesce:_a,collator:Wo,format:Xo,image:Ho,in:jo,"index-of":Uo,interpolate:zn,"interpolate-hcl":zn,"interpolate-lab":zn,length:xa,let:Si,literal:Os,match:_s,number:cr,"number-format":In,object:cr,slice:ya,step:so,string:cr,"to-boolean":Rn,"to-color":Rn,"to-number":Rn,"to-string":Rn,var:ga,within:js,distance:ws};class pr{constructor(e,n,h,g){this.name=e,this.type=n,this._evaluate=h,this.args=g}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,n){const h=e[0],g=pr.definitions[h];if(!g)return n.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const w=Array.isArray(g)?g[0]:g.type,S=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,T=S.filter(([A])=>!Array.isArray(A)||A.length===e.length-1);let P=null;for(const[A,O]of T){P=new hr(n.registry,ea,n.path,null,n.scope);const U=[];let Z=!1;for(let Y=1;Y{return Z=U,Array.isArray(Z)?`(${Z.map(X).join(", ")})`:`(${X(Z.type)}...)`;var Z}).join(" | "),O=[];for(let U=1;U{n=e?n&&ea(h):n&&h instanceof Os}),!!n&&Pa(i)&&ho(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Pa(i){if(i instanceof pr&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof js||i instanceof ws)return!1;let e=!0;return i.eachChild(n=>{e&&!Pa(n)&&(e=!1)}),e}function co(i){if(i instanceof pr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(n=>{e&&!co(n)&&(e=!1)}),e}function ho(i,e){if(i instanceof pr&&e.indexOf(i.name)>=0)return!1;let n=!0;return i.eachChild(h=>{n&&!ho(h,e)&&(n=!1)}),n}function Xl(i){return{result:"success",value:i}}function Vs(i){return{result:"error",value:i}}function Ss(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function _l(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function fo(i){return!!i.expression&&i.expression.interpolated}function _i(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ta(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function vl(i){return i}function mr(i,e){const n=e.type==="color",h=i.stops&&typeof i.stops[0][0]=="object",g=h||!(h||i.property!==void 0),w=i.type||(fo(e)?"exponential":"interval");if(n||e.type==="padding"){const O=n?ki.parse:Jn.parse;(i=wr({},i)).stops&&(i.stops=i.stops.map(U=>[U[0],O(U[1])])),i.default=O(i.default?i.default:e.default)}if(i.colorSpace&&(S=i.colorSpace)!=="rgb"&&S!=="hcl"&&S!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var S;let T,P,A;if(w==="exponential")T=a;else if(w==="interval")T=r;else if(w==="categorical"){T=v,P=Object.create(null);for(const O of i.stops)P[O[0]]=O[1];A=typeof i.stops[0][0]}else{if(w!=="identity")throw new Error(`Unknown function type "${w}"`);T=u}if(h){const O={},U=[];for(let J=0;JJ[0]),evaluate:({zoom:J},ie)=>a({stops:Z,base:i.base},e,J).evaluate(J,ie)}}if(g){const O=w==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:O,interpolationFactor:zn.interpolationFactor.bind(void 0,O),zoomStops:i.stops.map(U=>U[0]),evaluate:({zoom:U})=>T(i,e,U,P,A)}}return{kind:"source",evaluate(O,U){const Z=U&&U.properties?U.properties[i.property]:void 0;return Z===void 0?On(i.default,e.default):T(i,e,Z,P,A)}}}function On(i,e,n){return i!==void 0?i:e!==void 0?e:n!==void 0?n:void 0}function v(i,e,n,h,g){return On(typeof n===g?h[n]:void 0,i.default,e.default)}function r(i,e,n){if(_i(n)!=="number")return On(i.default,e.default);const h=i.stops.length;if(h===1||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[h-1][0])return i.stops[h-1][1];const g=ro(i.stops.map(w=>w[0]),n);return i.stops[g][1]}function a(i,e,n){const h=i.base!==void 0?i.base:1;if(_i(n)!=="number")return On(i.default,e.default);const g=i.stops.length;if(g===1||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[g-1][0])return i.stops[g-1][1];const w=ro(i.stops.map(O=>O[0]),n),S=function(O,U,Z,Y){const J=Y-Z,ie=O-Z;return J===0?0:U===1?ie/J:(Math.pow(U,ie)-1)/(Math.pow(U,J)-1)}(n,h,i.stops[w][0],i.stops[w+1][0]),T=i.stops[w][1],P=i.stops[w+1][1],A=Qi[e.type]||vl;return typeof T.evaluate=="function"?{evaluate(...O){const U=T.evaluate.apply(void 0,O),Z=P.evaluate.apply(void 0,O);if(U!==void 0&&Z!==void 0)return A(U,Z,S,i.colorSpace)}}:A(T,P,S,i.colorSpace)}function u(i,e,n){switch(e.type){case"color":n=ki.parse(n);break;case"formatted":n=Gn.fromString(n.toString());break;case"resolvedImage":n=hn.fromString(n.toString());break;case"padding":n=Jn.parse(n);break;default:_i(n)===e.type||e.type==="enum"&&e.values[n]||(n=void 0)}return On(n,i.default,e.default)}pr.register(Us,{error:[{kind:"error"},[mi],(i,[e])=>{throw new fn(e.evaluate(i))}],typeof:[mi,[si],(i,[e])=>X(an(e.evaluate(i)))],"to-rgba":[H(ut,4),[Kn],(i,[e])=>{const[n,h,g,w]=e.evaluate(i).rgb;return[255*n,255*h,255*g,w]}],rgb:[Kn,[ut,ut,ut],yl],rgba:[Kn,[ut,ut,ut,ut],yl],has:{type:rt,overloads:[[[mi],(i,[e])=>Ta(e.evaluate(i),i.properties())],[[mi,Rr],(i,[e,n])=>Ta(e.evaluate(i),n.evaluate(i))]]},get:{type:si,overloads:[[[mi],(i,[e])=>Ca(e.evaluate(i),i.properties())],[[mi,Rr],(i,[e,n])=>Ca(e.evaluate(i),n.evaluate(i))]]},"feature-state":[si,[mi],(i,[e])=>Ca(e.evaluate(i),i.featureState||{})],properties:[Rr,[],i=>i.properties()],"geometry-type":[mi,[],i=>i.geometryType()],id:[si,[],i=>i.id()],zoom:[ut,[],i=>i.globals.zoom],"heatmap-density":[ut,[],i=>i.globals.heatmapDensity||0],"line-progress":[ut,[],i=>i.globals.lineProgress||0],accumulated:[si,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ut,ks(ut),(i,e)=>{let n=0;for(const h of e)n+=h.evaluate(i);return n}],"*":[ut,ks(ut),(i,e)=>{let n=1;for(const h of e)n*=h.evaluate(i);return n}],"-":{type:ut,overloads:[[[ut,ut],(i,[e,n])=>e.evaluate(i)-n.evaluate(i)],[[ut],(i,[e])=>-e.evaluate(i)]]},"/":[ut,[ut,ut],(i,[e,n])=>e.evaluate(i)/n.evaluate(i)],"%":[ut,[ut,ut],(i,[e,n])=>e.evaluate(i)%n.evaluate(i)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(i,[e,n])=>Math.pow(e.evaluate(i),n.evaluate(i))],sqrt:[ut,[ut],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ut,[ut],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ut,[ut],(i,[e])=>Math.log(e.evaluate(i))],log2:[ut,[ut],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ut,[ut],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ut,[ut],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ut,[ut],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ut,[ut],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ut,[ut],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ut,[ut],(i,[e])=>Math.atan(e.evaluate(i))],min:[ut,ks(ut),(i,e)=>Math.min(...e.map(n=>n.evaluate(i)))],max:[ut,ks(ut),(i,e)=>Math.max(...e.map(n=>n.evaluate(i)))],abs:[ut,[ut],(i,[e])=>Math.abs(e.evaluate(i))],round:[ut,[ut],(i,[e])=>{const n=e.evaluate(i);return n<0?-Math.round(-n):Math.round(n)}],floor:[ut,[ut],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ut,[ut],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[rt,[mi,si],(i,[e,n])=>i.properties()[e.value]===n.value],"filter-id-==":[rt,[si],(i,[e])=>i.id()===e.value],"filter-type-==":[rt,[mi],(i,[e])=>i.geometryType()===e.value],"filter-<":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h{const n=i.id(),h=e.value;return typeof n==typeof h&&n":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h>g}],"filter-id->":[rt,[si],(i,[e])=>{const n=i.id(),h=e.value;return typeof n==typeof h&&n>h}],"filter-<=":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h<=g}],"filter-id-<=":[rt,[si],(i,[e])=>{const n=i.id(),h=e.value;return typeof n==typeof h&&n<=h}],"filter->=":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h>=g}],"filter-id->=":[rt,[si],(i,[e])=>{const n=i.id(),h=e.value;return typeof n==typeof h&&n>=h}],"filter-has":[rt,[si],(i,[e])=>e.value in i.properties()],"filter-has-id":[rt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[rt,[H(mi)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[rt,[H(si)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[rt,[mi,H(si)],(i,[e,n])=>n.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[rt,[mi,H(si)],(i,[e,n])=>function(h,g,w,S){for(;w<=S;){const T=w+S>>1;if(g[T]===h)return!0;g[T]>h?S=T-1:w=T+1}return!1}(i.properties()[e.value],n.value,0,n.value.length-1)],all:{type:rt,overloads:[[[rt,rt],(i,[e,n])=>e.evaluate(i)&&n.evaluate(i)],[ks(rt),(i,e)=>{for(const n of e)if(!n.evaluate(i))return!1;return!0}]]},any:{type:rt,overloads:[[[rt,rt],(i,[e,n])=>e.evaluate(i)||n.evaluate(i)],[ks(rt),(i,e)=>{for(const n of e)if(n.evaluate(i))return!0;return!1}]]},"!":[rt,[rt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[rt,[mi],(i,[e])=>{const n=i.globals&&i.globals.isSupportedScript;return!n||n(e.evaluate(i))}],upcase:[mi,[mi],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[mi,[mi],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[mi,ks(si),(i,e)=>e.map(n=>Jr(n.evaluate(i))).join("")],"resolved-locale":[mi,[cn],(i,[e])=>e.evaluate(i).resolvedLocale()]});class y{constructor(e,n){var h;this.expression=e,this._warningHistory={},this._evaluator=new no,this._defaultValue=n?(h=n).type==="color"&&ta(h.default)?new ki(0,0,0,0):h.type==="color"?ki.parse(h.default)||null:h.type==="padding"?Jn.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?on.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(e,n,h,g,w,S){return this._evaluator.globals=e,this._evaluator.feature=n,this._evaluator.featureState=h,this._evaluator.canonical=g,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=S,this.expression.evaluate(this._evaluator)}evaluate(e,n,h,g,w,S){this._evaluator.globals=e,this._evaluator.feature=n||null,this._evaluator.featureState=h||null,this._evaluator.canonical=g,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=S||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new fn(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){return this._warningHistory[T.message]||(this._warningHistory[T.message]=!0,typeof console<"u"&&console.warn(T.message)),this._defaultValue}}}function E(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Us}function M(i,e){const n=new hr(Us,ea,[],e?function(g){const w={color:Kn,string:mi,number:ut,enum:mi,boolean:rt,formatted:ur,padding:Sn,resolvedImage:Dr,variableAnchorOffsetCollection:ce};return g.type==="array"?H(w[g.value]||si,g.length):w[g.type]}(e):void 0),h=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Xl(new y(h,e)):Vs(n.errors)}class B{constructor(e,n){this.kind=e,this._styleExpression=n,this.isStateDependent=e!=="constant"&&!co(n.expression)}evaluateWithoutErrorHandling(e,n,h,g,w,S){return this._styleExpression.evaluateWithoutErrorHandling(e,n,h,g,w,S)}evaluate(e,n,h,g,w,S){return this._styleExpression.evaluate(e,n,h,g,w,S)}}class W{constructor(e,n,h,g){this.kind=e,this.zoomStops=h,this._styleExpression=n,this.isStateDependent=e!=="camera"&&!co(n.expression),this.interpolationType=g}evaluateWithoutErrorHandling(e,n,h,g,w,S){return this._styleExpression.evaluateWithoutErrorHandling(e,n,h,g,w,S)}evaluate(e,n,h,g,w,S){return this._styleExpression.evaluate(e,n,h,g,w,S)}interpolationFactor(e,n,h){return this.interpolationType?zn.interpolationFactor(this.interpolationType,e,n,h):0}}function ne(i,e){const n=M(i,e);if(n.result==="error")return n;const h=n.value.expression,g=Pa(h);if(!g&&!Ss(e))return Vs([new li("","data expressions not supported")]);const w=ho(h,["zoom"]);if(!w&&!_l(e))return Vs([new li("","zoom expressions not supported")]);const S=Ee(h);return S||w?S instanceof li?Vs([S]):S instanceof zn&&!fo(e)?Vs([new li("",'"interpolate" expressions cannot be used with this property')]):Xl(S?new W(g?"camera":"composite",n.value,S.labels,S instanceof zn?S.interpolation:void 0):new B(g?"constant":"source",n.value)):Vs([new li("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class me{constructor(e,n){this._parameters=e,this._specification=n,wr(this,mr(this._parameters,this._specification))}static deserialize(e){return new me(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ee(i){let e=null;if(i instanceof Si)e=Ee(i.result);else if(i instanceof _a){for(const n of i.args)if(e=Ee(n),e)break}else(i instanceof so||i instanceof zn)&&i.input instanceof pr&&i.input.name==="zoom"&&(e=i);return e instanceof li||i.eachChild(n=>{const h=Ee(n);h instanceof li?e=h:!e&&h?e=new li("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&h&&e!==h&&(e=new li("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Xe(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Xe(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ht={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tt(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Xe(i)||(i=ci(i));const e=M(i,ht);if(e.result==="error")throw new Error(e.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,h,g)=>e.value.evaluate(n,h,{},g),needGeometry:ni(i)}}function Yt(i,e){return ie?1:0}function ni(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Ci(i[1],i[2],e):e==="any"?(n=i.slice(1),["any"].concat(n.map(ci))):e==="all"?["all"].concat(i.slice(1).map(ci)):e==="none"?["all"].concat(i.slice(1).map(ci).map(wn)):e==="in"?Ri(i[1],i.slice(2)):e==="!in"?wn(Ri(i[1],i.slice(2))):e==="has"?bn(i[1]):e!=="!has"||wn(bn(i[1]));var n}function Ci(i,e,n){switch(i){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,i,e]}}function Ri(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(n=>typeof n!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Yt)]]:["filter-in-small",i,["literal",e]]}}function bn(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function wn(i){return["!",i]}function gr(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let g="[";for(const w of i)g+=`${gr(w)},`;return`${g}]`}const n=Object.keys(i).sort();let h="{";for(let g=0;gh.maximum?[new Ge(e,n,`${n} is greater than the maximum value ${h.maximum}`)]:[]}function na(i){const e=i.valueSpec,n=Li(i.value.type);let h,g,w,S={};const T=n!=="categorical"&&i.value.property===void 0,P=!T,A=_i(i.value.stops)==="array"&&_i(i.value.stops[0])==="array"&&_i(i.value.stops[0][0])==="object",O=yn({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(Y){if(n==="identity")return[new Ge(Y.key,Y.value,'identity function may not have a "stops" property')];let J=[];const ie=Y.value;return J=J.concat(ia({key:Y.key,value:ie,valueSpec:Y.valueSpec,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec,arrayElementValidator:U})),_i(ie)==="array"&&ie.length===0&&J.push(new Ge(Y.key,ie,"array must have at least one stop")),J},default:function(Y){return Y.validateSpec({key:Y.key,value:Y.value,valueSpec:e,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec})}}});return n==="identity"&&T&&O.push(new Ge(i.key,i.value,'missing required property "property"')),n==="identity"||i.value.stops||O.push(new Ge(i.key,i.value,'missing required property "stops"')),n==="exponential"&&i.valueSpec.expression&&!fo(i.valueSpec)&&O.push(new Ge(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(P&&!Ss(i.valueSpec)?O.push(new Ge(i.key,i.value,"property functions not supported")):T&&!_l(i.valueSpec)&&O.push(new Ge(i.key,i.value,"zoom functions not supported"))),n!=="categorical"&&!A||i.value.property!==void 0||O.push(new Ge(i.key,i.value,'"property" property is required')),O;function U(Y){let J=[];const ie=Y.value,le=Y.key;if(_i(ie)!=="array")return[new Ge(le,ie,`array expected, ${_i(ie)} found`)];if(ie.length!==2)return[new Ge(le,ie,`array length 2 expected, length ${ie.length} found`)];if(A){if(_i(ie[0])!=="object")return[new Ge(le,ie,`object expected, ${_i(ie[0])} found`)];if(ie[0].zoom===void 0)return[new Ge(le,ie,"object stop key must have zoom")];if(ie[0].value===void 0)return[new Ge(le,ie,"object stop key must have value")];if(w&&w>Li(ie[0].zoom))return[new Ge(le,ie[0].zoom,"stop zoom values must appear in ascending order")];Li(ie[0].zoom)!==w&&(w=Li(ie[0].zoom),g=void 0,S={}),J=J.concat(yn({key:`${le}[0]`,value:ie[0],valueSpec:{zoom:{}},validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec,objectElementValidators:{zoom:po,value:Z}}))}else J=J.concat(Z({key:`${le}[0]`,value:ie[0],valueSpec:{},validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec},ie));return E(Or(ie[1]))?J.concat([new Ge(`${le}[1]`,ie[1],"expressions are not allowed in function stops.")]):J.concat(Y.validateSpec({key:`${le}[1]`,value:ie[1],valueSpec:e,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec}))}function Z(Y,J){const ie=_i(Y.value),le=Li(Y.value),de=Y.value!==null?Y.value:J;if(h){if(ie!==h)return[new Ge(Y.key,de,`${ie} stop domain type must match previous stop domain type ${h}`)]}else h=ie;if(ie!=="number"&&ie!=="string"&&ie!=="boolean")return[new Ge(Y.key,de,"stop domain value must be a number, string, or boolean")];if(ie!=="number"&&n!=="categorical"){let De=`number expected, ${ie} found`;return Ss(e)&&n===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ge(Y.key,de,De)]}return n!=="categorical"||ie!=="number"||isFinite(le)&&Math.floor(le)===le?n!=="categorical"&&ie==="number"&&g!==void 0&&lenew Ge(`${i.key}${h.key}`,i.value,h.message));const n=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!n.outputDefined())return[new Ge(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!co(n))return[new Ge(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!co(n))return[new Ge(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ho(n,["zoom","feature-state"]))return[new Ge(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Pa(n))return[new Ge(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function xl(i){const e=i.key,n=i.value,h=i.valueSpec,g=[];return Array.isArray(h.values)?h.values.indexOf(Li(n))===-1&&g.push(new Ge(e,n,`expected one of [${h.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(h.values).indexOf(Li(n))===-1&&g.push(new Ge(e,n,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(n)} found`)),g}function bl(i){return Xe(Or(i.value))?Qr(wr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):wl(i)}function wl(i){const e=i.value,n=i.key;if(_i(e)!=="array")return[new Ge(n,e,`array expected, ${_i(e)} found`)];const h=i.styleSpec;let g,w=[];if(e.length<1)return[new Ge(n,e,"filter array must have at least 1 element")];switch(w=w.concat(xl({key:`${n}[0]`,value:e[0],valueSpec:h.filter_operator,style:i.style,styleSpec:i.styleSpec})),Li(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Li(e[1])==="$type"&&w.push(new Ge(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&w.push(new Ge(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(g=_i(e[1]),g!=="string"&&w.push(new Ge(`${n}[1]`,e[1],`string expected, ${g} found`)));for(let S=2;S{A in n&&e.push(new Ge(h,n[A],`"${A}" is prohibited for ref layers`))}),g.layers.forEach(A=>{Li(A.id)===T&&(P=A)}),P?P.ref?e.push(new Ge(h,n.ref,"ref cannot reference another ref layer")):S=Li(P.type):e.push(new Ge(h,n.ref,`ref layer "${T}" not found`))}else if(S!=="background")if(n.source){const P=g.sources&&g.sources[n.source],A=P&&Li(P.type);P?A==="vector"&&S==="raster"?e.push(new Ge(h,n.source,`layer "${n.id}" requires a raster source`)):A!=="raster-dem"&&S==="hillshade"?e.push(new Ge(h,n.source,`layer "${n.id}" requires a raster-dem source`)):A==="raster"&&S!=="raster"?e.push(new Ge(h,n.source,`layer "${n.id}" requires a vector source`)):A!=="vector"||n["source-layer"]?A==="raster-dem"&&S!=="hillshade"?e.push(new Ge(h,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!n.paint||!n.paint["line-gradient"]||A==="geojson"&&P.lineMetrics||e.push(new Ge(h,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ge(h,n,`layer "${n.id}" must specify a "source-layer"`)):e.push(new Ge(h,n.source,`source "${n.source}" not found`))}else e.push(new Ge(h,n,'missing required property "source"'));return e=e.concat(yn({key:h,value:n,valueSpec:w.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${h}.type`,value:n.type,valueSpec:w.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:n,objectKey:"type"}),filter:bl,layout:P=>yn({layer:n,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Xu(wr({layerType:S},A))}}),paint:P=>yn({layer:n,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Wu(wr({layerType:S},A))}})}})),e}function qs(i){const e=i.value,n=i.key,h=_i(e);return h!=="string"?[new Ge(n,e,`string expected, ${h} found`)]:[]}const Yu={promoteId:function({key:i,value:e}){if(_i(e)==="string")return qs({key:i,value:e});{const n=[];for(const h in e)n.push(...qs({key:`${i}.${h}`,value:e[h]}));return n}}};function sh(i){const e=i.value,n=i.key,h=i.styleSpec,g=i.style,w=i.validateSpec;if(!e.type)return[new Ge(n,e,'"type" is required')];const S=Li(e.type);let T;switch(S){case"vector":case"raster":return T=yn({key:n,value:e,valueSpec:h[`source_${S.replace("-","_")}`],style:i.style,styleSpec:h,objectElementValidators:Yu,validateSpec:w}),T;case"raster-dem":return T=function(P){var A;const O=(A=P.sourceName)!==null&&A!==void 0?A:"",U=P.value,Z=P.styleSpec,Y=Z.source_raster_dem,J=P.style;let ie=[];const le=_i(U);if(U===void 0)return ie;if(le!=="object")return ie.push(new Ge("source_raster_dem",U,`object expected, ${le} found`)),ie;const de=Li(U.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],ve=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Pe in U)!de&&De.includes(Pe)?ie.push(new Ge(Pe,U[Pe],`In "${O}": "${Pe}" is only valid when "encoding" is set to "custom". ${ve} encoding found`)):Y[Pe]?ie=ie.concat(P.validateSpec({key:Pe,value:U[Pe],valueSpec:Y[Pe],validateSpec:P.validateSpec,style:J,styleSpec:Z})):ie.push(new Ge(Pe,U[Pe],`unknown property "${Pe}"`));return ie}({sourceName:n,value:e,style:i.style,styleSpec:h,validateSpec:w}),T;case"geojson":if(T=yn({key:n,value:e,valueSpec:h.source_geojson,style:g,styleSpec:h,validateSpec:w,objectElementValidators:Yu}),e.cluster)for(const P in e.clusterProperties){const[A,O]=e.clusterProperties[P],U=typeof A=="string"?[A,["accumulated"],["get",P]]:A;T.push(...Qr({key:`${n}.${P}.map`,value:O,validateSpec:w,expressionContext:"cluster-map"})),T.push(...Qr({key:`${n}.${P}.reduce`,value:U,validateSpec:w,expressionContext:"cluster-reduce"}))}return T;case"video":return yn({key:n,value:e,valueSpec:h.source_video,style:g,validateSpec:w,styleSpec:h});case"image":return yn({key:n,value:e,valueSpec:h.source_image,style:g,validateSpec:w,styleSpec:h});case"canvas":return[new Ge(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xl({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:w,styleSpec:h})}}function Ku(i){const e=i.value,n=i.styleSpec,h=n.light,g=i.style;let w=[];const S=_i(e);if(e===void 0)return w;if(S!=="object")return w=w.concat([new Ge("light",e,`object expected, ${S} found`)]),w;for(const T in e){const P=T.match(/^(.*)-transition$/);w=w.concat(P&&h[P[1]]&&h[P[1]].transition?i.validateSpec({key:T,value:e[T],valueSpec:n.transition,validateSpec:i.validateSpec,style:g,styleSpec:n}):h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],validateSpec:i.validateSpec,style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)])}return w}function oh(i){const e=i.value,n=i.styleSpec,h=n.sky,g=i.style,w=_i(e);if(e===void 0)return[];if(w!=="object")return[new Ge("sky",e,`object expected, ${w} found`)];let S=[];for(const T in e)S=S.concat(h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)]);return S}function Ju(i){const e=i.value,n=i.styleSpec,h=n.terrain,g=i.style;let w=[];const S=_i(e);if(e===void 0)return w;if(S!=="object")return w=w.concat([new Ge("terrain",e,`object expected, ${S} found`)]),w;for(const T in e)w=w.concat(h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],validateSpec:i.validateSpec,style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)]);return w}function Qu(i){let e=[];const n=i.value,h=i.key;if(Array.isArray(n)){const g=[],w=[];for(const S in n)n[S].id&&g.includes(n[S].id)&&e.push(new Ge(h,n,`all the sprites' ids must be unique, but ${n[S].id} is duplicated`)),g.push(n[S].id),n[S].url&&w.includes(n[S].url)&&e.push(new Ge(h,n,`all the sprites' URLs must be unique, but ${n[S].url} is duplicated`)),w.push(n[S].url),e=e.concat(yn({key:`${h}[${S}]`,value:n[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return qs({key:h,value:n})}const $u={"*":()=>[],array:ia,boolean:function(i){const e=i.value,n=i.key,h=_i(e);return h!=="boolean"?[new Ge(n,e,`boolean expected, ${h} found`)]:[]},number:po,color:function(i){const e=i.key,n=i.value,h=_i(n);return h!=="string"?[new Ge(e,n,`color expected, ${h} found`)]:ki.parse(String(n))?[]:[new Ge(e,n,`color expected, "${n}" found`)]},constants:Is,enum:xl,filter:bl,function:na,layer:Hu,object:yn,source:sh,light:Ku,sky:oh,terrain:Ju,projection:function(i){const e=i.value,n=i.styleSpec,h=n.projection,g=i.style,w=_i(e);if(e===void 0)return[];if(w!=="object")return[new Ge("projection",e,`object expected, ${w} found`)];let S=[];for(const T in e)S=S.concat(h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)]);return S},string:qs,formatted:function(i){return qs(i).length===0?[]:Qr(i)},resolvedImage:function(i){return qs(i).length===0?[]:Qr(i)},padding:function(i){const e=i.key,n=i.value;if(_i(n)==="array"){if(n.length<1||n.length>4)return[new Ge(e,n,`padding requires 1 to 4 values; ${n.length} values found`)];const h={type:"number"};let g=[];for(let w=0;w[]}})),i.constants&&(n=n.concat(Is({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:kl}))),ec(n)}function $r(i){return function(e){return i({...e,validateSpec:kl})}}function ec(i){return[].concat(i).sort((e,n)=>e.line-n.line)}function es(i){return function(...e){return ec(i.apply(this,e))}}Wr.source=es($r(sh)),Wr.sprite=es($r(Qu)),Wr.glyphs=es($r(ah)),Wr.light=es($r(Ku)),Wr.sky=es($r(oh)),Wr.terrain=es($r(Ju)),Wr.layer=es($r(Hu)),Wr.filter=es($r(bl)),Wr.paintProperty=es($r(Wu)),Wr.layoutProperty=es($r(Xu));const Gs=Wr,jf=Gs.light,tc=Gs.sky,Uf=Gs.paintProperty,Vf=Gs.layoutProperty;function ic(i,e){let n=!1;if(e&&e.length)for(const h of e)i.fire(new Rt(new Error(h.message))),n=!0;return n}class La{constructor(e,n,h){const g=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const S=new Int32Array(this.arrayBuffer);e=S[0],this.d=(n=S[1])+2*(h=S[2]);for(let P=0;P=U[J+0]&&g>=U[J+1])?(T[Y]=!0,S.push(O[Y])):T[Y]=!1}}}}_forEachCell(e,n,h,g,w,S,T,P){const A=this._convertToCellCoord(e),O=this._convertToCellCoord(n),U=this._convertToCellCoord(h),Z=this._convertToCellCoord(g);for(let Y=A;Y<=U;Y++)for(let J=O;J<=Z;J++){const ie=this.d*J+Y;if((!P||P(this._convertFromCellCoord(Y),this._convertFromCellCoord(J),this._convertFromCellCoord(Y+1),this._convertFromCellCoord(J+1)))&&w.call(this,e,n,h,g,ie,S,T,P))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,n=3+this.cells.length+1+1;let h=0;for(let S=0;S=0)continue;const S=i[w];g[w]=Es[n].shallow.indexOf(w)>=0?S:Sl(S,e)}i instanceof Error&&(g.message=i.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(g.$name=n),g}function Ts(i){if(uh(i))return i;if(Array.isArray(i))return i.map(Ts);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=nc(i)||"Object";if(!Es[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:n}=Es[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(i);const h=Object.create(n.prototype);for(const g of Object.keys(i)){if(g==="$name")continue;const w=i[g];h[g]=Es[e].shallow.indexOf(g)>=0?w:Ts(w)}return h}class ch{constructor(){this.first=!0}update(e,n){const h=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=n):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function rc(i){for(const e of i)if(sc(e.charCodeAt(0)))return!0;return!1}function qf(i){for(const e of i)if(!hh(e.charCodeAt(0)))return!1;return!0}function hh(i){return!(kt.Arabic(i)||kt["Arabic Supplement"](i)||kt["Arabic Extended-A"](i)||kt["Arabic Presentation Forms-A"](i)||kt["Arabic Presentation Forms-B"](i))}function sc(i){return!(i!==746&&i!==747&&(i<4352||!(kt["Bopomofo Extended"](i)||kt.Bopomofo(i)||kt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||kt["CJK Compatibility Ideographs"](i)||kt["CJK Compatibility"](i)||kt["CJK Radicals Supplement"](i)||kt["CJK Strokes"](i)||!(!kt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||kt["CJK Unified Ideographs Extension A"](i)||kt["CJK Unified Ideographs"](i)||kt["Enclosed CJK Letters and Months"](i)||kt["Hangul Compatibility Jamo"](i)||kt["Hangul Jamo Extended-A"](i)||kt["Hangul Jamo Extended-B"](i)||kt["Hangul Jamo"](i)||kt["Hangul Syllables"](i)||kt.Hiragana(i)||kt["Ideographic Description Characters"](i)||kt.Kanbun(i)||kt["Kangxi Radicals"](i)||kt["Katakana Phonetic Extensions"](i)||kt.Katakana(i)&&i!==12540||!(!kt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!kt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||kt["Unified Canadian Aboriginal Syllabics"](i)||kt["Unified Canadian Aboriginal Syllabics Extended"](i)||kt["Vertical Forms"](i)||kt["Yijing Hexagram Symbols"](i)||kt["Yi Syllables"](i)||kt["Yi Radicals"](i))))}function fh(i){return!(sc(i)||function(e){return!!(kt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||kt["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||kt["Letterlike Symbols"](e)||kt["Number Forms"](e)||kt["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||kt["Control Pictures"](e)&&e!==9251||kt["Optical Character Recognition"](e)||kt["Enclosed Alphanumerics"](e)||kt["Geometric Shapes"](e)||kt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||kt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||kt["CJK Symbols and Punctuation"](e)||kt.Katakana(e)||kt["Private Use Area"](e)||kt["CJK Compatibility Forms"](e)||kt["Small Form Variants"](e)||kt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function mo(i){return i>=1424&&i<=2303||kt["Arabic Presentation Forms-A"](i)||kt["Arabic Presentation Forms-B"](i)}function dh(i,e){return!(!e&&mo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||kt.Khmer(i))}function oc(i){for(const e of i)if(mo(e.charCodeAt(0)))return!0;return!1}const go=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Gi{constructor(e,n){this.zoom=e,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.zoomHistory=n.zoomHistory,this.transition=n.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ch,this.transition={})}isSupportedScript(e){return function(n,h){for(const g of n)if(!dh(g.charCodeAt(0),h))return!1;return!0}(e,go.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,n=e-Math.floor(e),h=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*n}}}class Hl{constructor(e,n){this.property=e,this.value=n,this.expression=function(h,g){if(ta(h))return new me(h,g);if(E(h)){const w=ne(h,g);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));return w.value}{let w=h;return g.type==="color"&&typeof h=="string"?w=ki.parse(h):g.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(w=on.parse(h)):w=Jn.parse(h),{kind:"constant",evaluate:()=>w}}}(n===void 0?e.specification.default:n,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,n,h){return this.property.possiblyEvaluate(this,e,n,h)}}class Aa{constructor(e){this.property=e,this.value=new Hl(e,void 0)}transitioned(e,n){return new ph(this.property,this.value,n,Ze({},e.transition,this.transition),e.now)}untransitioned(){return new ph(this.property,this.value,null,{},0)}}class Ma{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ie(this._values[e].value.value)}setValue(e,n){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Aa(this._values[e].property)),this._values[e].value=new Hl(this._values[e].property,n===null?void 0:Ie(n))}getTransition(e){return Ie(this._values[e].transition)}setTransition(e,n){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Aa(this._values[e].property)),this._values[e].transition=Ie(n)||void 0}serialize(){const e={};for(const n of Object.keys(this._values)){const h=this.getValue(n);h!==void 0&&(e[n]=h);const g=this.getTransition(n);g!==void 0&&(e[`${n}-transition`]=g)}return e}transitioned(e,n){const h=new ac(this._properties);for(const g of Object.keys(this._values))h._values[g]=this._values[g].transitioned(e,n._values[g]);return h}untransitioned(){const e=new ac(this._properties);for(const n of Object.keys(this._values))e._values[n]=this._values[n].untransitioned();return e}}class ph{constructor(e,n,h,g,w){this.property=e,this.value=n,this.begin=w+g.delay||0,this.end=this.begin+g.duration||0,e.specification.transition&&(g.delay||g.duration)&&(this.prior=h)}possiblyEvaluate(e,n,h){const g=e.now||0,w=this.value.possiblyEvaluate(e,n,h),S=this.prior;if(S){if(g>this.end)return this.prior=null,w;if(this.value.isDataDriven())return this.prior=null,w;if(g=1)return 1;const A=P*P,O=A*P;return 4*(P<.5?O:3*(P-A)+O-.75)}(T))}}return w}}class ac{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,n,h){const g=new Yl(this._properties);for(const w of Object.keys(this._values))g._values[w]=this._values[w].possiblyEvaluate(e,n,h);return g}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Il{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Ie(this._values[e].value)}setValue(e,n){this._values[e]=new Hl(this._values[e].property,n===null?void 0:Ie(n))}serialize(){const e={};for(const n of Object.keys(this._values)){const h=this.getValue(n);h!==void 0&&(e[n]=h)}return e}possiblyEvaluate(e,n,h){const g=new Yl(this._properties);for(const w of Object.keys(this._values))g._values[w]=this._values[w].possiblyEvaluate(e,n,h);return g}}class Cs{constructor(e,n,h){this.property=e,this.value=n,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,n,h,g){return this.property.evaluate(this.value,this.parameters,e,n,h,g)}}class Yl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Zt{constructor(e){this.specification=e}possiblyEvaluate(e,n){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(n)}interpolate(e,n,h){const g=Qi[this.specification.type];return g?g(e,n,h):e}}class ti{constructor(e,n){this.specification=e,this.overrides=n}possiblyEvaluate(e,n,h,g){return new Cs(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(n,null,{},h,g)}:e.expression,n)}interpolate(e,n,h){if(e.value.kind!=="constant"||n.value.kind!=="constant")return e;if(e.value.value===void 0||n.value.value===void 0)return new Cs(this,{kind:"constant",value:void 0},e.parameters);const g=Qi[this.specification.type];if(g){const w=g(e.value.value,n.value.value,h);return new Cs(this,{kind:"constant",value:w},e.parameters)}return e}evaluate(e,n,h,g,w,S){return e.kind==="constant"?e.value:e.evaluate(n,h,g,w,S)}}class x extends ti{possiblyEvaluate(e,n,h,g){if(e.value===void 0)return new Cs(this,{kind:"constant",value:void 0},n);if(e.expression.kind==="constant"){const w=e.expression.evaluate(n,null,{},h,g),S=e.property.specification.type==="resolvedImage"&&typeof w!="string"?w.name:w,T=this._calculate(S,S,S,n);return new Cs(this,{kind:"constant",value:T},n)}if(e.expression.kind==="camera"){const w=this._calculate(e.expression.evaluate({zoom:n.zoom-1}),e.expression.evaluate({zoom:n.zoom}),e.expression.evaluate({zoom:n.zoom+1}),n);return new Cs(this,{kind:"constant",value:w},n)}return new Cs(this,e.expression,n)}evaluate(e,n,h,g,w,S){if(e.kind==="source"){const T=e.evaluate(n,h,g,w,S);return this._calculate(T,T,T,n)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(n.zoom)-1},h,g),e.evaluate({zoom:Math.floor(n.zoom)},h,g),e.evaluate({zoom:Math.floor(n.zoom)+1},h,g),n):e.value}_calculate(e,n,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:h,to:n}}interpolate(e){return e}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,n,h,g){if(e.value!==void 0){if(e.expression.kind==="constant"){const w=e.expression.evaluate(n,null,{},h,g);return this._calculate(w,w,w,n)}return this._calculate(e.expression.evaluate(new Gi(Math.floor(n.zoom-1),n)),e.expression.evaluate(new Gi(Math.floor(n.zoom),n)),e.expression.evaluate(new Gi(Math.floor(n.zoom+1),n)),n)}}_calculate(e,n,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:h,to:n}}interpolate(e){return e}}class l{constructor(e){this.specification=e}possiblyEvaluate(e,n,h,g){return!!e.expression.evaluate(n,null,{},h,g)}interpolate(){return!1}}class p{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in e){const h=e[n];h.specification.overridable&&this.overridableProperties.push(n);const g=this.defaultPropertyValues[n]=new Hl(h,void 0),w=this.defaultTransitionablePropertyValues[n]=new Aa(h);this.defaultTransitioningPropertyValues[n]=w.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=g.possiblyEvaluate({})}}}Mt("DataDrivenProperty",ti),Mt("DataConstantProperty",Zt),Mt("CrossFadedDataDrivenProperty",x),Mt("CrossFadedProperty",t),Mt("ColorRampProperty",l);const m="-transition";class b extends Ke{constructor(e,n){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),n.layout&&(this._unevaluatedLayout=new Il(n.layout)),n.paint)){this._transitionablePaint=new Ma(n.paint);for(const h in e.paint)this.setPaintProperty(h,e.paint[h],{validate:!1});for(const h in e.layout)this.setLayoutProperty(h,e.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Yl(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,n,h={}){n!=null&&this._validate(Vf,`layers.${this.id}.layout.${e}`,e,n,h)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,n):this.visibility=n)}getPaintProperty(e){return e.endsWith(m)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,n,h={}){if(n!=null&&this._validate(Uf,`layers.${this.id}.paint.${e}`,e,n,h))return!1;if(e.endsWith(m))return this._transitionablePaint.setTransition(e.slice(0,-11),n||void 0),!1;{const g=this._transitionablePaint._values[e],w=g.property.specification["property-type"]==="cross-faded-data-driven",S=g.value.isDataDriven(),T=g.value;this._transitionablePaint.setValue(e,n),this._handleSpecialPaintPropertyUpdate(e);const P=this._transitionablePaint._values[e].value;return P.isDataDriven()||S||w||this._handleOverridablePaintPropertyUpdate(e,T,P)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,n,h){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,n){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,n)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),pt(e,(n,h)=>!(n===void 0||h==="layout"&&!Object.keys(n).length||h==="paint"&&!Object.keys(n).length))}_validate(e,n,h,g,w={}){return(!w||w.validate!==!1)&&ic(this,e.call(Gs,{key:n,layerType:this.type,objectKey:h,value:g,styleSpec:Ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const n=this.paint.get(e);if(n instanceof Cs&&Ss(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const C={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class L{constructor(e,n){this._structArray=e,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class R{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,n){return e._trim(),n&&(e.isTransferred=!0,n.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const n=Object.create(this.prototype);return n.arrayBuffer=e.arrayBuffer,n.length=e.length,n.capacity=e.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function z(i,e=1){let n=0,h=0;return{members:i.map(g=>{const w=C[g.type].BYTES_PER_ELEMENT,S=n=G(n,Math.max(e,w)),T=g.components||1;return h=Math.max(h,w),n+=w*T,{name:g.name,type:g.type,components:T,offset:S}}),size:G(n,Math.max(h,e)),alignment:e}}function G(i,e){return Math.ceil(i/e)*e}class q extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n){const h=this.length;return this.resize(h+1),this.emplace(h,e,n)}emplace(e,n,h){const g=2*e;return this.int16[g+0]=n,this.int16[g+1]=h,e}}q.prototype.bytesPerElement=4,Mt("StructArrayLayout2i4",q);class K extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.int16[w+0]=n,this.int16[w+1]=h,this.int16[w+2]=g,e}}K.prototype.bytesPerElement=6,Mt("StructArrayLayout3i6",K);class te extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g){const w=this.length;return this.resize(w+1),this.emplace(w,e,n,h,g)}emplace(e,n,h,g,w){const S=4*e;return this.int16[S+0]=n,this.int16[S+1]=h,this.int16[S+2]=g,this.int16[S+3]=w,e}}te.prototype.bytesPerElement=8,Mt("StructArrayLayout4i8",te);class se extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=6*e;return this.int16[P+0]=n,this.int16[P+1]=h,this.int16[P+2]=g,this.int16[P+3]=w,this.int16[P+4]=S,this.int16[P+5]=T,e}}se.prototype.bytesPerElement=12,Mt("StructArrayLayout2i4i12",se);class ue extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=4*e,A=8*e;return this.int16[P+0]=n,this.int16[P+1]=h,this.uint8[A+4]=g,this.uint8[A+5]=w,this.uint8[A+6]=S,this.uint8[A+7]=T,e}}ue.prototype.bytesPerElement=8,Mt("StructArrayLayout2i4ub8",ue);class ae extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n){const h=this.length;return this.resize(h+1),this.emplace(h,e,n)}emplace(e,n,h){const g=2*e;return this.float32[g+0]=n,this.float32[g+1]=h,e}}ae.prototype.bytesPerElement=8,Mt("StructArrayLayout2f8",ae);class fe extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S,T,P,A,O){const U=this.length;return this.resize(U+1),this.emplace(U,e,n,h,g,w,S,T,P,A,O)}emplace(e,n,h,g,w,S,T,P,A,O,U){const Z=10*e;return this.uint16[Z+0]=n,this.uint16[Z+1]=h,this.uint16[Z+2]=g,this.uint16[Z+3]=w,this.uint16[Z+4]=S,this.uint16[Z+5]=T,this.uint16[Z+6]=P,this.uint16[Z+7]=A,this.uint16[Z+8]=O,this.uint16[Z+9]=U,e}}fe.prototype.bytesPerElement=20,Mt("StructArrayLayout10ui20",fe);class ye extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S,T,P,A,O,U,Z){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,n,h,g,w,S,T,P,A,O,U,Z)}emplace(e,n,h,g,w,S,T,P,A,O,U,Z,Y){const J=12*e;return this.int16[J+0]=n,this.int16[J+1]=h,this.int16[J+2]=g,this.int16[J+3]=w,this.uint16[J+4]=S,this.uint16[J+5]=T,this.uint16[J+6]=P,this.uint16[J+7]=A,this.int16[J+8]=O,this.int16[J+9]=U,this.int16[J+10]=Z,this.int16[J+11]=Y,e}}ye.prototype.bytesPerElement=24,Mt("StructArrayLayout4i4ui4i24",ye);class oe extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.float32[w+0]=n,this.float32[w+1]=h,this.float32[w+2]=g,e}}oe.prototype.bytesPerElement=12,Mt("StructArrayLayout3f12",oe);class Se extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint32[1*e+0]=n,e}}Se.prototype.bytesPerElement=4,Mt("StructArrayLayout1ul4",Se);class Me extends R{_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(e,n,h,g,w,S,T,P,A){const O=this.length;return this.resize(O+1),this.emplace(O,e,n,h,g,w,S,T,P,A)}emplace(e,n,h,g,w,S,T,P,A,O){const U=10*e,Z=5*e;return this.int16[U+0]=n,this.int16[U+1]=h,this.int16[U+2]=g,this.int16[U+3]=w,this.int16[U+4]=S,this.int16[U+5]=T,this.uint32[Z+3]=P,this.uint16[U+8]=A,this.uint16[U+9]=O,e}}Me.prototype.bytesPerElement=20,Mt("StructArrayLayout6i1ul2ui20",Me);class Be extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=6*e;return this.int16[P+0]=n,this.int16[P+1]=h,this.int16[P+2]=g,this.int16[P+3]=w,this.int16[P+4]=S,this.int16[P+5]=T,e}}Be.prototype.bytesPerElement=12,Mt("StructArrayLayout2i2i2i12",Be);class Qe extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w){const S=this.length;return this.resize(S+1),this.emplace(S,e,n,h,g,w)}emplace(e,n,h,g,w,S){const T=4*e,P=8*e;return this.float32[T+0]=n,this.float32[T+1]=h,this.float32[T+2]=g,this.int16[P+6]=w,this.int16[P+7]=S,e}}Qe.prototype.bytesPerElement=16,Mt("StructArrayLayout2f1f2i16",Qe);class ot extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=16*e,A=4*e,O=8*e;return this.uint8[P+0]=n,this.uint8[P+1]=h,this.float32[A+1]=g,this.float32[A+2]=w,this.int16[O+6]=S,this.int16[O+7]=T,e}}ot.prototype.bytesPerElement=16,Mt("StructArrayLayout2ub2f2i16",ot);class It extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.uint16[w+0]=n,this.uint16[w+1]=h,this.uint16[w+2]=g,e}}It.prototype.bytesPerElement=6,Mt("StructArrayLayout3ui6",It);class Ct extends R{_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(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,ie,le,de){const De=this.length;return this.resize(De+1),this.emplace(De,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,ie,le,de)}emplace(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,ie,le,de,De){const ve=24*e,Pe=12*e,qe=48*e;return this.int16[ve+0]=n,this.int16[ve+1]=h,this.uint16[ve+2]=g,this.uint16[ve+3]=w,this.uint32[Pe+2]=S,this.uint32[Pe+3]=T,this.uint32[Pe+4]=P,this.uint16[ve+10]=A,this.uint16[ve+11]=O,this.uint16[ve+12]=U,this.float32[Pe+7]=Z,this.float32[Pe+8]=Y,this.uint8[qe+36]=J,this.uint8[qe+37]=ie,this.uint8[qe+38]=le,this.uint32[Pe+10]=de,this.int16[ve+22]=De,e}}Ct.prototype.bytesPerElement=48,Mt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ct);class at extends R{_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(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,ie,le,de,De,ve,Pe,qe,it,Et,$t,wt,xt,Gt,zt){const At=this.length;return this.resize(At+1),this.emplace(At,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,ie,le,de,De,ve,Pe,qe,it,Et,$t,wt,xt,Gt,zt)}emplace(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,ie,le,de,De,ve,Pe,qe,it,Et,$t,wt,xt,Gt,zt,At){const Ye=32*e,Wt=16*e;return this.int16[Ye+0]=n,this.int16[Ye+1]=h,this.int16[Ye+2]=g,this.int16[Ye+3]=w,this.int16[Ye+4]=S,this.int16[Ye+5]=T,this.int16[Ye+6]=P,this.int16[Ye+7]=A,this.uint16[Ye+8]=O,this.uint16[Ye+9]=U,this.uint16[Ye+10]=Z,this.uint16[Ye+11]=Y,this.uint16[Ye+12]=J,this.uint16[Ye+13]=ie,this.uint16[Ye+14]=le,this.uint16[Ye+15]=de,this.uint16[Ye+16]=De,this.uint16[Ye+17]=ve,this.uint16[Ye+18]=Pe,this.uint16[Ye+19]=qe,this.uint16[Ye+20]=it,this.uint16[Ye+21]=Et,this.uint16[Ye+22]=$t,this.uint32[Wt+12]=wt,this.float32[Wt+13]=xt,this.float32[Wt+14]=Gt,this.uint16[Ye+30]=zt,this.uint16[Ye+31]=At,e}}at.prototype.bytesPerElement=64,Mt("StructArrayLayout8i15ui1ul2f2ui64",at);class ft extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.float32[1*e+0]=n,e}}ft.prototype.bytesPerElement=4,Mt("StructArrayLayout1f4",ft);class Nt extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.uint16[6*e+0]=n,this.float32[w+1]=h,this.float32[w+2]=g,e}}Nt.prototype.bytesPerElement=12,Mt("StructArrayLayout1ui2f12",Nt);class ai extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=4*e;return this.uint32[2*e+0]=n,this.uint16[w+2]=h,this.uint16[w+3]=g,e}}ai.prototype.bytesPerElement=8,Mt("StructArrayLayout1ul2ui8",ai);class yt extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n){const h=this.length;return this.resize(h+1),this.emplace(h,e,n)}emplace(e,n,h){const g=2*e;return this.uint16[g+0]=n,this.uint16[g+1]=h,e}}yt.prototype.bytesPerElement=4,Mt("StructArrayLayout2ui4",yt);class bt extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint16[1*e+0]=n,e}}bt.prototype.bytesPerElement=2,Mt("StructArrayLayout1ui2",bt);class ri extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,h,g){const w=this.length;return this.resize(w+1),this.emplace(w,e,n,h,g)}emplace(e,n,h,g,w){const S=4*e;return this.float32[S+0]=n,this.float32[S+1]=h,this.float32[S+2]=g,this.float32[S+3]=w,e}}ri.prototype.bytesPerElement=16,Mt("StructArrayLayout4f16",ri);class $i extends L{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 N(this.anchorPointX,this.anchorPointY)}}$i.prototype.size=20;class gi extends Me{get(e){return new $i(this,e)}}Mt("CollisionBoxArray",gi);class xi extends L{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}xi.prototype.size=48;class en extends Ct{get(e){return new xi(this,e)}}Mt("PlacedSymbolArray",en);class Qn extends L{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}Qn.prototype.size=64;class ts extends at{get(e){return new Qn(this,e)}}Mt("SymbolInstanceArray",ts);class tn extends ft{getoffsetX(e){return this.float32[1*e+0]}}Mt("GlyphOffsetArray",tn);class Sr extends K{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Mt("SymbolLineVertexArray",Sr);class yr extends L{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]}}yr.prototype.size=12;class $n extends Nt{get(e){return new yr(this,e)}}Mt("TextAnchorOffsetArray",$n);class er extends L{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]}}er.prototype.size=8;class is extends ai{get(e){return new er(this,e)}}Mt("FeatureIndexArray",is);class ra extends q{}class Kl extends q{}class Ra extends q{}class sa extends se{}class Jl extends ue{}class lc extends ae{}class Wn extends fe{}class ns extends ye{}class yo extends oe{}class Da extends Se{}class tr extends Be{}class ir extends ot{}class Fn extends It{}class ln extends yt{}const za=z([{name:"a_pos",components:2,type:"Int16"}],4),{members:uc}=za;class Tn{constructor(e=[]){this.segments=e}prepareSegment(e,n,h,g){let w=this.segments[this.segments.length-1];return e>Tn.MAX_VERTEX_ARRAY_LENGTH&&st(`Max vertices per segment is ${Tn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!w||w.vertexLength+e>Tn.MAX_VERTEX_ARRAY_LENGTH||w.sortKey!==g)&&(w={vertexOffset:n.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},g!==void 0&&(w.sortKey=g),this.segments.push(w)),w}get(){return this.segments}destroy(){for(const e of this.segments)for(const n in e.vaos)e.vaos[n].destroy()}static simpleSegment(e,n,h,g){return new Tn([{vertexOffset:e,primitiveOffset:n,vertexLength:h,primitiveLength:g,vaos:{},sortKey:0}])}}function mh(i,e){return 256*(i=ze(Math.floor(i),0,255))+ze(Math.floor(e),0,255)}Tn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Mt("SegmentVector",Tn);const Ql=z([{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 $l={exports:{}},_o={exports:{}};_o.exports=function(i,e){var n,h,g,w,S,T,P,A;for(h=i.length-(n=3&i.length),g=e,S=3432918353,T=461845907,A=0;A>>16)*S&65535)<<16)&4294967295)<<15|P>>>17))*T+(((P>>>16)*T&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(w>>>16)&65535)<<16);switch(P=0,n){case 3:P^=(255&i.charCodeAt(A+2))<<16;case 2:P^=(255&i.charCodeAt(A+1))<<8;case 1:g^=P=(65535&(P=(P=(65535&(P^=255&i.charCodeAt(A)))*S+(((P>>>16)*S&65535)<<16)&4294967295)<<15|P>>>17))*T+(((P>>>16)*T&65535)<<16)&4294967295}return g^=i.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var gh=_o.exports,cc={exports:{}};cc.exports=function(i,e){for(var n,h=i.length,g=e^h,w=0;h>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(w)|(255&i.charCodeAt(++w))<<8|(255&i.charCodeAt(++w))<<16|(255&i.charCodeAt(++w))<<24))+((1540483477*(n>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),h-=4,++w;switch(h){case 3:g^=(255&i.charCodeAt(w+2))<<16;case 2:g^=(255&i.charCodeAt(w+1))<<8;case 1:g=1540483477*(65535&(g^=255&i.charCodeAt(w)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var hc=gh,fc=cc.exports;$l.exports=hc,$l.exports.murmur3=hc,$l.exports.murmur2=fc;var eu=D($l.exports);class Na{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,n,h,g){this.ids.push(ym(e)),this.positions.push(n,h,g)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=ym(e);let h=0,g=this.ids.length-1;for(;h>1;this.ids[S]>=n?g=S:h=S+1}const w=[];for(;this.ids[h]===n;)w.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return w}static serialize(e,n){const h=new Float64Array(e.ids),g=new Uint32Array(e.positions);return Gf(h,g,0,h.length-1),n&&n.push(h.buffer,g.buffer),{ids:h,positions:g}}static deserialize(e){const n=new Na;return n.ids=e.ids,n.positions=e.positions,n.indexed=!0,n}}function ym(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:eu(String(i))}function Gf(i,e,n,h){for(;n>1];let w=n-1,S=h+1;for(;;){do w++;while(i[w]g);if(w>=S)break;yh(i,w,S),yh(e,3*w,3*S),yh(e,3*w+1,3*S+1),yh(e,3*w+2,3*S+2)}S-n`u_${g}`),this.type=h}setUniform(e,n,h){e.set(h.constantOr(this.value))}getBinding(e,n,h){return this.type==="color"?new vm(e,n):new _h(e,n)}}class tu{constructor(e,n){this.uniformNames=n.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=e.tlbr}setUniform(e,n,h,g){const w=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;w&&e.set(w)}getBinding(e,n,h){return h.substr(0,9)==="u_pattern"?new _m(e,n):new _h(e,n)}}class oa{constructor(e,n,h,g){this.expression=e,this.type=h,this.maxValue=0,this.paintVertexAttributes=n.map(w=>({name:`a_${w}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(e,n,h,g,w){const S=this.paintVertexArray.length,T=this.expression.evaluate(new Gi(0),n,{},g,[],w);this.paintVertexArray.resize(e),this._setPaintValue(S,e,T)}updatePaintArray(e,n,h,g){const w=this.expression.evaluate({zoom:0},h,g);this._setPaintValue(e,n,w)}_setPaintValue(e,n,h){if(this.type==="color"){const g=Zf(h);for(let w=e;w`u_${T}_t`),this.type=h,this.useIntegerZoom=g,this.zoom=w,this.maxValue=0,this.paintVertexAttributes=n.map(T=>({name:`a_${T}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(e,n,h,g,w){const S=this.expression.evaluate(new Gi(this.zoom),n,{},g,[],w),T=this.expression.evaluate(new Gi(this.zoom+1),n,{},g,[],w),P=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(P,e,S,T)}updatePaintArray(e,n,h,g){const w=this.expression.evaluate({zoom:this.zoom},h,g),S=this.expression.evaluate({zoom:this.zoom+1},h,g);this._setPaintValue(e,n,w,S)}_setPaintValue(e,n,h,g){if(this.type==="color"){const w=Zf(h),S=Zf(g);for(let T=e;T`#define HAS_UNIFORM_${g}`))}return e}getBinderAttributes(){const e=[];for(const n in this.binders){const h=this.binders[n];if(h instanceof oa||h instanceof Zs)for(let g=0;g!0){this.programConfigurations={};for(const g of e)this.programConfigurations[g.id]=new xm(g,n,h);this.needsUpload=!1,this._featureMap=new Na,this._bufferOffset=0}populatePaintArrays(e,n,h,g,w,S){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(e,n,g,w,S);n.id!==void 0&&this._featureMap.add(n.id,h,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,n,h,g){for(const w of h)this.needsUpload=this.programConfigurations[w.id].updatePaintArrays(e,this._featureMap,n,w,g)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function U1(i,e){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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function bm(i,e,n){const h={color:{source:ae,composite:ri},number:{source:ft,composite:ae}},g=function(w){return{"line-pattern":{source:Wn,composite:Wn},"fill-pattern":{source:Wn,composite:Wn},"fill-extrusion-pattern":{source:Wn,composite:Wn}}[w]}(i);return g&&g[n]||h[e][n]}Mt("ConstantBinder",dc),Mt("CrossFadedConstantBinder",tu),Mt("SourceExpressionBinder",oa),Mt("CrossFadedCompositeBinder",Oa),Mt("CompositeExpressionBinder",Zs),Mt("ProgramConfiguration",xm,{omit:["_buffers"]}),Mt("ProgramConfigurationSet",Tl);const kn=8192,Wf=Math.pow(2,14)-1,wm=-Wf-1;function Cl(i){const e=kn/i.extent,n=i.loadGeometry();for(let h=0;hS.x+1||PS.y+1)&&st("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Pl(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Cl(i):[]}}function vh(i,e,n,h,g){i.emplaceBack(2*e+(h+1)/2,2*n+(g+1)/2)}class Xf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Kl,this.indexArray=new Fn,this.segments=new Tn,this.programConfigurations=new Tl(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){const g=this.layers[0],w=[];let S=null,T=!1;g.type==="circle"&&(S=g.layout.get("circle-sort-key"),T=!S.isConstant());for(const{feature:P,id:A,index:O,sourceLayerIndex:U}of e){const Z=this.layers[0]._featureFilter.needGeometry,Y=Pl(P,Z);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),Y,h))continue;const J=T?S.evaluate(Y,{},h):void 0,ie={id:A,properties:P.properties,type:P.type,sourceLayerIndex:U,index:O,geometry:Z?Y.geometry:Cl(P),patterns:{},sortKey:J};w.push(ie)}T&&w.sort((P,A)=>P.sortKey-A.sortKey);for(const P of w){const{geometry:A,index:O,sourceLayerIndex:U}=P,Z=e[O].feature;this.addFeature(P,A,O,h),n.featureIndex.insert(Z,A,O,U,this.index)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,n,h,g){for(const w of n)for(const S of w){const T=S.x,P=S.y;if(T<0||T>=kn||P<0||P>=kn)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),O=A.vertexLength;vh(this.layoutVertexArray,T,P,-1,-1),vh(this.layoutVertexArray,T,P,1,-1),vh(this.layoutVertexArray,T,P,1,1),vh(this.layoutVertexArray,T,P,-1,1),this.indexArray.emplaceBack(O,O+1,O+2),this.indexArray.emplaceBack(O,O+3,O+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},g)}}function km(i,e){for(let n=0;n1){if(Hf(i,e))return!0;for(let h=0;h1?n:n.sub(e)._mult(g)._add(e))}function Em(i,e){let n,h,g,w=!1;for(let S=0;Se.y!=g.y>e.y&&e.x<(g.x-h.x)*(e.y-h.y)/(g.y-h.y)+h.x&&(w=!w)}return w}function iu(i,e){let n=!1;for(let h=0,g=i.length-1;he.y!=S.y>e.y&&e.x<(S.x-w.x)*(e.y-w.y)/(S.y-w.y)+w.x&&(n=!n)}return n}function Z1(i,e,n){const h=n[0],g=n[2];if(i.xg.x&&e.x>g.x||i.yg.y&&e.y>g.y)return!1;const w=Ue(i,e,n[0]);return w!==Ue(i,e,n[1])||w!==Ue(i,e,n[2])||w!==Ue(i,e,n[3])}function pc(i,e,n){const h=e.paint.get(i).value;return h.kind==="constant"?h.value:n.programConfigurations.get(e.id).getMaxValue(i)}function xh(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function bh(i,e,n,h,g){if(!e[0]&&!e[1])return i;const w=N.convert(e)._mult(g);n==="viewport"&&w._rotate(-h);const S=[];for(let T=0;TLm(le,ie))}(A,P),Y=U?O*T:O;for(const J of g)for(const ie of J){const le=U?ie:Lm(ie,P);let de=Y;const De=wh([],[ie.x,ie.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?de*=De[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(de*=S.cameraToCenterDistance/De[3]),V1(Z,le,de))return!0}return!1}}function Lm(i,e){const n=wh([],[i.x,i.y,0,1],e);return new N(n[0]/n[3],n[1]/n[3])}class Am extends Xf{}let Mm;Mt("HeatmapBucket",Am,{omit:["layers"]});var Y1={get paint(){return Mm=Mm||new p({"heatmap-radius":new ti(Ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ti(Ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Zt(Ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new l(Ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Zt(Ne.paint_heatmap["heatmap-opacity"])})}};function Jf(i,{width:e,height:n},h,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==e*n*h)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${e*n*h}`)}else g=new Uint8Array(e*n*h);return i.width=e,i.height=n,i.data=g,i}function Rm(i,{width:e,height:n},h){if(e===i.width&&n===i.height)return;const g=Jf({},{width:e,height:n},h);Qf(i,g,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,n)},h),i.width=e,i.height=n,i.data=g.data}function Qf(i,e,n,h,g,w){if(g.width===0||g.height===0)return e;if(g.width>i.width||g.height>i.height||n.x>i.width-g.width||n.y>i.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>e.width||g.height>e.height||h.x>e.width-g.width||h.y>e.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const S=i.data,T=e.data;if(S===T)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P{e[i.evaluationKey]=P;const A=i.expression.evaluate(e);g.data[S+T+0]=Math.floor(255*A.r/A.a),g.data[S+T+1]=Math.floor(255*A.g/A.a),g.data[S+T+2]=Math.floor(255*A.b/A.a),g.data[S+T+3]=Math.floor(255*A.a)};if(i.clips)for(let S=0,T=0;S80*n){T=1/0,P=1/0;let O=-1/0,U=-1/0;for(let Z=n;ZO&&(O=Y),J>U&&(U=J)}A=Math.max(O-T,U-P),A=A!==0?32767/A:0}return yc(w,S,n,T,P,A,0),S}function Om(i,e,n,h,g){let w;if(g===function(S,T,P,A){let O=0;for(let U=T,Z=P-A;U0)for(let S=e;S=e;S-=h)w=jm(S/h|0,i[S],i[S+1],w);return w&&kh(w,w.next)&&(vc(w),w=w.next),w}function Ll(i,e){if(!i)return i;e||(e=i);let n,h=i;do if(n=!1,h.steiner||!kh(h,h.next)&&_n(h.prev,h,h.next)!==0)h=h.next;else{if(vc(h),h=e=h.prev,h===h.next)break;n=!0}while(n||h!==e);return e}function yc(i,e,n,h,g,w,S){if(!i)return;!S&&w&&function(P,A,O,U){let Z=P;do Z.z===0&&(Z.z=$f(Z.x,Z.y,A,O,U)),Z.prevZ=Z.prev,Z.nextZ=Z.next,Z=Z.next;while(Z!==P);Z.prevZ.nextZ=null,Z.prevZ=null,function(Y){let J,ie=1;do{let le,de=Y;Y=null;let De=null;for(J=0;de;){J++;let ve=de,Pe=0;for(let it=0;it0||qe>0&&ve;)Pe!==0&&(qe===0||!ve||de.z<=ve.z)?(le=de,de=de.nextZ,Pe--):(le=ve,ve=ve.nextZ,qe--),De?De.nextZ=le:Y=le,le.prevZ=De,De=le;de=ve}De.nextZ=null,ie*=2}while(J>1)}(Z)}(i,h,g,w);let T=i;for(;i.prev!==i.next;){const P=i.prev,A=i.next;if(w?ix(i,h,g,w):tx(i))e.push(P.i,i.i,A.i),vc(i),i=A.next,T=A.next;else if((i=A)===T){S?S===1?yc(i=nx(Ll(i),e),e,n,h,g,w,2):S===2&&rx(i,e,n,h,g,w):yc(Ll(i),e,n,h,g,w,1);break}}}function tx(i){const e=i.prev,n=i,h=i.next;if(_n(e,n,h)>=0)return!1;const g=e.x,w=n.x,S=h.x,T=e.y,P=n.y,A=h.y,O=gw?g>S?g:S:w>S?w:S,Y=T>P?T>A?T:A:P>A?P:A;let J=h.next;for(;J!==e;){if(J.x>=O&&J.x<=Z&&J.y>=U&&J.y<=Y&&ru(g,T,w,P,S,A,J.x,J.y)&&_n(J.prev,J,J.next)>=0)return!1;J=J.next}return!0}function ix(i,e,n,h){const g=i.prev,w=i,S=i.next;if(_n(g,w,S)>=0)return!1;const T=g.x,P=w.x,A=S.x,O=g.y,U=w.y,Z=S.y,Y=TP?T>A?T:A:P>A?P:A,le=O>U?O>Z?O:Z:U>Z?U:Z,de=$f(Y,J,e,n,h),De=$f(ie,le,e,n,h);let ve=i.prevZ,Pe=i.nextZ;for(;ve&&ve.z>=de&&Pe&&Pe.z<=De;){if(ve.x>=Y&&ve.x<=ie&&ve.y>=J&&ve.y<=le&&ve!==g&&ve!==S&&ru(T,O,P,U,A,Z,ve.x,ve.y)&&_n(ve.prev,ve,ve.next)>=0||(ve=ve.prevZ,Pe.x>=Y&&Pe.x<=ie&&Pe.y>=J&&Pe.y<=le&&Pe!==g&&Pe!==S&&ru(T,O,P,U,A,Z,Pe.x,Pe.y)&&_n(Pe.prev,Pe,Pe.next)>=0))return!1;Pe=Pe.nextZ}for(;ve&&ve.z>=de;){if(ve.x>=Y&&ve.x<=ie&&ve.y>=J&&ve.y<=le&&ve!==g&&ve!==S&&ru(T,O,P,U,A,Z,ve.x,ve.y)&&_n(ve.prev,ve,ve.next)>=0)return!1;ve=ve.prevZ}for(;Pe&&Pe.z<=De;){if(Pe.x>=Y&&Pe.x<=ie&&Pe.y>=J&&Pe.y<=le&&Pe!==g&&Pe!==S&&ru(T,O,P,U,A,Z,Pe.x,Pe.y)&&_n(Pe.prev,Pe,Pe.next)>=0)return!1;Pe=Pe.nextZ}return!0}function nx(i,e){let n=i;do{const h=n.prev,g=n.next.next;!kh(h,g)&&Fm(h,n,n.next,g)&&_c(h,g)&&_c(g,h)&&(e.push(h.i,n.i,g.i),vc(n),vc(n.next),n=i=g),n=n.next}while(n!==i);return Ll(n)}function rx(i,e,n,h,g,w){let S=i;do{let T=S.next.next;for(;T!==S.prev;){if(S.i!==T.i&&ux(S,T)){let P=Bm(S,T);return S=Ll(S,S.next),P=Ll(P,P.next),yc(S,e,n,h,g,w,0),void yc(P,e,n,h,g,w,0)}T=T.next}S=S.next}while(S!==i)}function sx(i,e){return i.x-e.x}function ox(i,e){const n=function(g,w){let S=w;const T=g.x,P=g.y;let A,O=-1/0;do{if(P<=S.y&&P>=S.next.y&&S.next.y!==S.y){const ie=S.x+(P-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(ie<=T&&ie>O&&(O=ie,A=S.x=S.x&&S.x>=Z&&T!==S.x&&ru(PA.x||S.x===A.x&&ax(A,S)))&&(A=S,J=ie)}S=S.next}while(S!==U);return A}(i,e);if(!n)return e;const h=Bm(n,i);return Ll(h,h.next),Ll(n,n.next)}function ax(i,e){return _n(i.prev,i,e.prev)<0&&_n(e.next,i,i.next)<0}function $f(i,e,n,h,g){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-n)*g|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-h)*g|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function lx(i){let e=i,n=i;do(e.x=(i-S)*(w-T)&&(i-S)*(h-T)>=(n-S)*(e-T)&&(n-S)*(w-T)>=(g-S)*(h-T)}function ux(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(n,h){let g=n;do{if(g.i!==n.i&&g.next.i!==n.i&&g.i!==h.i&&g.next.i!==h.i&&Fm(g,g.next,n,h))return!0;g=g.next}while(g!==n);return!1}(i,e)&&(_c(i,e)&&_c(e,i)&&function(n,h){let g=n,w=!1;const S=(n.x+h.x)/2,T=(n.y+h.y)/2;do g.y>T!=g.next.y>T&&g.next.y!==g.y&&S<(g.next.x-g.x)*(T-g.y)/(g.next.y-g.y)+g.x&&(w=!w),g=g.next;while(g!==n);return w}(i,e)&&(_n(i.prev,i,e.prev)||_n(i,e.prev,e))||kh(i,e)&&_n(i.prev,i,i.next)>0&&_n(e.prev,e,e.next)>0)}function _n(i,e,n){return(e.y-i.y)*(n.x-e.x)-(e.x-i.x)*(n.y-e.y)}function kh(i,e){return i.x===e.x&&i.y===e.y}function Fm(i,e,n,h){const g=Ih(_n(i,e,n)),w=Ih(_n(i,e,h)),S=Ih(_n(n,h,i)),T=Ih(_n(n,h,e));return g!==w&&S!==T||!(g!==0||!Sh(i,n,e))||!(w!==0||!Sh(i,h,e))||!(S!==0||!Sh(n,i,h))||!(T!==0||!Sh(n,e,h))}function Sh(i,e,n){return e.x<=Math.max(i.x,n.x)&&e.x>=Math.min(i.x,n.x)&&e.y<=Math.max(i.y,n.y)&&e.y>=Math.min(i.y,n.y)}function Ih(i){return i>0?1:i<0?-1:0}function _c(i,e){return _n(i.prev,i,i.next)<0?_n(i,e,i.next)>=0&&_n(i,i.prev,e)>=0:_n(i,e,i.prev)<0||_n(i,i.next,e)<0}function Bm(i,e){const n=ed(i.i,i.x,i.y),h=ed(e.i,e.x,e.y),g=i.next,w=e.prev;return i.next=e,e.prev=i,n.next=g,g.prev=n,h.next=n,n.prev=h,w.next=h,h.prev=w,h}function jm(i,e,n,h){const g=ed(i,e,n);return h?(g.next=h.next,g.prev=h,h.next.prev=g,h.next=g):(g.prev=g,g.next=g),g}function vc(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ed(i,e,n){return{i,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function td(i,e,n){const h=n.patternDependencies;let g=!1;for(const w of e){const S=w.paint.get(`${i}-pattern`);S.isConstant()||(g=!0);const T=S.constantOr(null);T&&(g=!0,h[T.to]=!0,h[T.from]=!0)}return g}function id(i,e,n,h,g){const w=g.patternDependencies;for(const S of e){const T=S.paint.get(`${i}-pattern`).value;if(T.kind!=="constant"){let P=T.evaluate({zoom:h-1},n,{},g.availableImages),A=T.evaluate({zoom:h},n,{},g.availableImages),O=T.evaluate({zoom:h+1},n,{},g.availableImages);P=P&&P.name?P.name:P,A=A&&A.name?A.name:A,O=O&&O.name?O.name:O,w[P]=!0,w[A]=!0,w[O]=!0,n.patterns[S.id]={min:P,mid:A,max:O}}}return n}class nd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ra,this.indexArray=new Fn,this.indexArray2=new ln,this.programConfigurations=new Tl(e.layers,e.zoom),this.segments=new Tn,this.segments2=new Tn,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){this.hasPattern=td("fill",this.layers,n);const g=this.layers[0].layout.get("fill-sort-key"),w=!g.isConstant(),S=[];for(const{feature:T,id:P,index:A,sourceLayerIndex:O}of e){const U=this.layers[0]._featureFilter.needGeometry,Z=Pl(T,U);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),Z,h))continue;const Y=w?g.evaluate(Z,{},h,n.availableImages):void 0,J={id:P,properties:T.properties,type:T.type,sourceLayerIndex:O,index:A,geometry:U?Z.geometry:Cl(T),patterns:{},sortKey:Y};S.push(J)}w&&S.sort((T,P)=>T.sortKey-P.sortKey);for(const T of S){const{geometry:P,index:A,sourceLayerIndex:O}=T;if(this.hasPattern){const U=id("fill",this.layers,T,this.zoom,n);this.patternFeatures.push(U)}else this.addFeature(T,P,A,h,{});n.featureIndex.insert(e[A].feature,P,A,O,this.index)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}addFeatures(e,n,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,n,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ex),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,n,h,g,w){for(const S of Yo(n,500)){let T=0;for(const Y of S)T+=Y.length;const P=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),A=P.vertexLength,O=[],U=[];for(const Y of S){if(Y.length===0)continue;Y!==S[0]&&U.push(O.length/2);const J=this.segments2.prepareSegment(Y.length,this.layoutVertexArray,this.indexArray2),ie=J.vertexLength;this.layoutVertexArray.emplaceBack(Y[0].x,Y[0].y),this.indexArray2.emplaceBack(ie+Y.length-1,ie),O.push(Y[0].x),O.push(Y[0].y);for(let le=1;le>3}if(g--,h===1||h===2)w+=i.readSVarint(),S+=i.readSVarint(),h===1&&(e&&T.push(e),e=[]),e.push(new mx(w,S));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&T.push(e),T},su.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,n=1,h=0,g=0,w=0,S=1/0,T=-1/0,P=1/0,A=-1/0;i.pos>3}if(h--,n===1||n===2)(g+=i.readSVarint())T&&(T=g),(w+=i.readSVarint())A&&(A=w);else if(n!==7)throw new Error("unknown command "+n)}return[S,P,T,A]},su.prototype.toGeoJSON=function(i,e,n){var h,g,w=this.extent*Math.pow(2,n),S=this.extent*i,T=this.extent*e,P=this.loadGeometry(),A=su.types[this.type];function O(Y){for(var J=0;J>3;g=S===1?h.readString():S===2?h.readFloat():S===3?h.readDouble():S===4?h.readVarint64():S===5?h.readVarint():S===6?h.readSVarint():S===7?h.readBoolean():null}return g}(n))}Zm.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new _x(this._pbf,e,this.extent,this._keys,this._values)};var xx=Gm;function bx(i,e,n){if(i===3){var h=new xx(n,n.readVarint()+n.pos);h.length&&(e[h.name]=h)}}Fa.VectorTile=function(i,e){this.layers=i.readFields(bx,{},e)},Fa.VectorTileFeature=qm,Fa.VectorTileLayer=Gm;const wx=Fa.VectorTileFeature.types,rd=Math.pow(2,13);function xc(i,e,n,h,g,w,S,T){i.emplaceBack(e,n,2*Math.floor(h*rd)+S,g*rd*2,w*rd*2,Math.round(T))}class sd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new sa,this.centroidVertexArray=new ra,this.indexArray=new Fn,this.programConfigurations=new Tl(e.layers,e.zoom),this.segments=new Tn,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){this.features=[],this.hasPattern=td("fill-extrusion",this.layers,n);for(const{feature:g,id:w,index:S,sourceLayerIndex:T}of e){const P=this.layers[0]._featureFilter.needGeometry,A=Pl(g,P);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),A,h))continue;const O={id:w,sourceLayerIndex:T,index:S,geometry:P?A.geometry:Cl(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(id("fill-extrusion",this.layers,O,this.zoom,n)):this.addFeature(O,O.geometry,S,h,{}),n.featureIndex.insert(g,O.geometry,S,T,this.index,!0)}}addFeatures(e,n,h){for(const g of this.features){const{geometry:w}=g;this.addFeature(g,w,g.index,n,h)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,px),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,dx.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,n,h,g,w){for(const S of Yo(n,500)){const T={x:0,y:0,vertexCount:0};let P=0;for(const J of S)P+=J.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const J of S){if(J.length===0||Sx(J))continue;let ie=0;for(let le=0;le=1){const De=J[le-1];if(!kx(de,De)){A.vertexLength+4>Tn.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ve=de.sub(De)._perp()._unit(),Pe=De.dist(de);ie+Pe>32768&&(ie=0),xc(this.layoutVertexArray,de.x,de.y,ve.x,ve.y,0,0,ie),xc(this.layoutVertexArray,de.x,de.y,ve.x,ve.y,0,1,ie),T.x+=2*de.x,T.y+=2*de.y,T.vertexCount+=2,ie+=Pe,xc(this.layoutVertexArray,De.x,De.y,ve.x,ve.y,0,0,ie),xc(this.layoutVertexArray,De.x,De.y,ve.x,ve.y,0,1,ie),T.x+=2*De.x,T.y+=2*De.y,T.vertexCount+=2;const qe=A.vertexLength;this.indexArray.emplaceBack(qe,qe+2,qe+1),this.indexArray.emplaceBack(qe+1,qe+2,qe+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+P>Tn.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),wx[e.type]!=="Polygon")continue;const O=[],U=[],Z=A.vertexLength;for(const J of S)if(J.length!==0){J!==S[0]&&U.push(O.length/2);for(let ie=0;iekn)||i.y===e.y&&(i.y<0||i.y>kn)}function Sx(i){return i.every(e=>e.x<0)||i.every(e=>e.x>kn)||i.every(e=>e.y<0)||i.every(e=>e.y>kn)}let Wm;Mt("FillExtrusionBucket",sd,{omit:["layers","features"]});var Ix={get paint(){return Wm=Wm||new p({"fill-extrusion-opacity":new Zt(Ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ti(Ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Zt(Ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Zt(Ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new x(Ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ti(Ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ti(Ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Zt(Ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ex extends b{constructor(e){super(e,Ix)}createBucket(e){return new sd(e)}queryRadius(){return xh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,n,h,g,w,S,T,P){const A=bh(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,T),O=this.paint.get("fill-extrusion-height").evaluate(n,h),U=this.paint.get("fill-extrusion-base").evaluate(n,h),Z=function(J,ie,le,de){const De=[];for(const ve of J){const Pe=[ve.x,ve.y,0,1];wh(Pe,Pe,ie),De.push(new N(Pe[0]/Pe[3],Pe[1]/Pe[3]))}return De}(A,P),Y=function(J,ie,le,de){const De=[],ve=[],Pe=de[8]*ie,qe=de[9]*ie,it=de[10]*ie,Et=de[11]*ie,$t=de[8]*le,wt=de[9]*le,xt=de[10]*le,Gt=de[11]*le;for(const zt of J){const At=[],Ye=[];for(const Wt of zt){const Ut=Wt.x,oi=Wt.y,Vi=de[0]*Ut+de[4]*oi+de[12],Fi=de[1]*Ut+de[5]*oi+de[13],Bn=de[2]*Ut+de[6]*oi+de[14],Ps=de[3]*Ut+de[7]*oi+de[15],rr=Bn+it,pn=Ps+Et,Er=Vi+$t,Tr=Fi+wt,Cr=Bn+xt,mn=Ps+Gt,jn=new N((Vi+Pe)/pn,(Fi+qe)/pn);jn.z=rr/pn,At.push(jn);const _r=new N(Er/mn,Tr/mn);_r.z=Cr/mn,Ye.push(_r)}De.push(At),ve.push(Ye)}return[De,ve]}(g,U,O,P);return function(J,ie,le){let de=1/0;Sm(le,ie)&&(de=Xm(le,ie[0]));for(let De=0;Den.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new Jl,this.layoutVertexArray2=new lc,this.indexArray=new Fn,this.programConfigurations=new Tl(e.layers,e.zoom),this.segments=new Tn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){this.hasPattern=td("line",this.layers,n);const g=this.layers[0].layout.get("line-sort-key"),w=!g.isConstant(),S=[];for(const{feature:T,id:P,index:A,sourceLayerIndex:O}of e){const U=this.layers[0]._featureFilter.needGeometry,Z=Pl(T,U);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),Z,h))continue;const Y=w?g.evaluate(Z,{},h):void 0,J={id:P,properties:T.properties,type:T.type,sourceLayerIndex:O,index:A,geometry:U?Z.geometry:Cl(T),patterns:{},sortKey:Y};S.push(J)}w&&S.sort((T,P)=>T.sortKey-P.sortKey);for(const T of S){const{geometry:P,index:A,sourceLayerIndex:O}=T;if(this.hasPattern){const U=id("line",this.layers,T,this.zoom,n);this.patternFeatures.push(U)}else this.addFeature(T,P,A,h,{});n.featureIndex.insert(e[A].feature,P,A,O,this.index)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}addFeatures(e,n,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,n,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Lx)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Cx),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,n,h,g,w){const S=this.layers[0].layout,T=S.get("line-join").evaluate(e,{}),P=S.get("line-cap"),A=S.get("line-miter-limit"),O=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const U of n)this.addLine(U,e,T,P,A,O);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,w,g)}addLine(e,n,h,g,w,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let de=0;de=2&&e[P-1].equals(e[P-2]);)P--;let A=0;for(;A0;if(Et&&de>A){const Gt=Z.dist(Y);if(Gt>2*O){const zt=Z.sub(Z.sub(Y)._mult(O/Gt)._round());this.updateDistance(Y,zt),this.addCurrentVertex(zt,ie,0,0,U),Y=zt}}const wt=Y&&J;let xt=wt?h:T?"butt":g;if(wt&&xt==="round"&&(qew&&(xt="bevel"),xt==="bevel"&&(qe>2&&(xt="flipbevel"),qe100)De=le.mult(-1);else{const Gt=qe*ie.add(le).mag()/ie.sub(le).mag();De._perp()._mult(Gt*($t?-1:1))}this.addCurrentVertex(Z,De,0,0,U),this.addCurrentVertex(Z,De.mult(-1),0,0,U)}else if(xt==="bevel"||xt==="fakeround"){const Gt=-Math.sqrt(qe*qe-1),zt=$t?Gt:0,At=$t?0:Gt;if(Y&&this.addCurrentVertex(Z,ie,zt,At,U),xt==="fakeround"){const Ye=Math.round(180*it/Math.PI/20);for(let Wt=1;Wt2*O){const zt=Z.add(J.sub(Z)._mult(O/Gt)._round());this.updateDistance(Z,zt),this.addCurrentVertex(zt,le,0,0,U),Z=zt}}}}addCurrentVertex(e,n,h,g,w,S=!1){const T=n.y*g-n.x,P=-n.y-n.x*g;this.addHalfVertex(e,n.x+n.y*h,n.y-n.x*h,S,!1,h,w),this.addHalfVertex(e,T,P,S,!0,-g,w),this.distance>Hm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,n,h,g,w,S))}addHalfVertex({x:e,y:n},h,g,w,S,T,P){const A=.5*(this.lineClips?this.scaledDistance*(Hm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(w?1:0),(n<<1)+(S?1:0),Math.round(63*h)+128,Math.round(63*g)+128,1+(T===0?0:T<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 O=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,O),P.primitiveLength++),S?this.e2=O:this.e1=O}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,n){this.distance+=e.dist(n),this.updateScaledDistance()}}let Ym,Km;Mt("LineBucket",od,{omit:["layers","patternFeatures"]});var Jm={get paint(){return Km=Km||new p({"line-opacity":new ti(Ne.paint_line["line-opacity"]),"line-color":new ti(Ne.paint_line["line-color"]),"line-translate":new Zt(Ne.paint_line["line-translate"]),"line-translate-anchor":new Zt(Ne.paint_line["line-translate-anchor"]),"line-width":new ti(Ne.paint_line["line-width"]),"line-gap-width":new ti(Ne.paint_line["line-gap-width"]),"line-offset":new ti(Ne.paint_line["line-offset"]),"line-blur":new ti(Ne.paint_line["line-blur"]),"line-dasharray":new t(Ne.paint_line["line-dasharray"]),"line-pattern":new x(Ne.paint_line["line-pattern"]),"line-gradient":new l(Ne.paint_line["line-gradient"])})},get layout(){return Ym=Ym||new p({"line-cap":new Zt(Ne.layout_line["line-cap"]),"line-join":new ti(Ne.layout_line["line-join"]),"line-miter-limit":new Zt(Ne.layout_line["line-miter-limit"]),"line-round-limit":new Zt(Ne.layout_line["line-round-limit"]),"line-sort-key":new ti(Ne.layout_line["line-sort-key"])})}};class Rx extends ti{possiblyEvaluate(e,n){return n=new Gi(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(e,n)}evaluate(e,n,h,g){return n=Ze({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(e,n,h,g)}}let Eh;class Dx extends b{constructor(e){super(e,Jm),this.gradientVersion=0,Eh||(Eh=new Rx(Jm.paint.properties["line-width"].specification),Eh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const n=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(n)&&n._styleExpression.expression instanceof so,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,n){super.recalculate(e,n),this.paint._values["line-floorwidth"]=Eh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new od(e)}queryRadius(e){const n=e,h=Qm(pc("line-width",this,n),pc("line-gap-width",this,n)),g=pc("line-offset",this,n);return h/2+Math.abs(g)+xh(this.paint.get("line-translate"))}queryIntersectsFeature(e,n,h,g,w,S,T){const P=bh(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,T),A=T/2*Qm(this.paint.get("line-width").evaluate(n,h),this.paint.get("line-gap-width").evaluate(n,h)),O=this.paint.get("line-offset").evaluate(n,h);return O&&(g=function(U,Z){const Y=[];for(let J=0;J=3){for(let le=0;le0?e+2*i:i}const zx=z([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Nx=z([{name:"a_projected_pos",components:3,type:"Float32"}],4);z([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ox=z([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);z([{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 $m=z([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Fx=z([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Bx(i,e,n){return i.sections.forEach(h=>{h.text=function(g,w,S){const T=w.layout.get("text-transform").evaluate(S,{});return T==="uppercase"?g=g.toLocaleUpperCase():T==="lowercase"&&(g=g.toLocaleLowerCase()),go.applyArabicShaping&&(g=go.applyArabicShaping(g)),g}(h.text,e,n)}),i}z([{name:"triangle",components:3,type:"Uint16"}]),z([{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"}]),z([{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"}]),z([{type:"Float32",name:"offsetX"}]),z([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),z([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const wc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Cn=24,eg=Oi,tg=function(i,e,n,h,g){var w,S,T=8*g-h-1,P=(1<>1,O=-7,U=n?g-1:0,Z=n?-1:1,Y=i[e+U];for(U+=Z,w=Y&(1<<-O)-1,Y>>=-O,O+=T;O>0;w=256*w+i[e+U],U+=Z,O-=8);for(S=w&(1<<-O)-1,w>>=-O,O+=h;O>0;S=256*S+i[e+U],U+=Z,O-=8);if(w===0)w=1-A;else{if(w===P)return S?NaN:1/0*(Y?-1:1);S+=Math.pow(2,h),w-=A}return(Y?-1:1)*S*Math.pow(2,w-h)},ig=function(i,e,n,h,g,w){var S,T,P,A=8*w-g-1,O=(1<>1,Z=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,Y=h?0:w-1,J=h?1:-1,ie=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(T=isNaN(e)?1:0,S=O):(S=Math.floor(Math.log(e)/Math.LN2),e*(P=Math.pow(2,-S))<1&&(S--,P*=2),(e+=S+U>=1?Z/P:Z*Math.pow(2,1-U))*P>=2&&(S++,P/=2),S+U>=O?(T=0,S=O):S+U>=1?(T=(e*P-1)*Math.pow(2,g),S+=U):(T=e*Math.pow(2,U-1)*Math.pow(2,g),S=0));g>=8;i[n+Y]=255&T,Y+=J,T/=256,g-=8);for(S=S<0;i[n+Y]=255&S,Y+=J,S/=256,A-=8);i[n+Y-J]|=128*ie};function Oi(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Oi.Varint=0,Oi.Fixed64=1,Oi.Bytes=2,Oi.Fixed32=5;var ad=4294967296,ng=1/ad,rg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function aa(i){return i.type===Oi.Bytes?i.readVarint()+i.pos:i.pos+1}function ou(i,e,n){return n?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function sg(i,e,n){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(h);for(var g=n.pos-1;g>=i;g--)n.buf[g+h]=n.buf[g]}function jx(i,e){for(var n=0;n>>8,i[n+2]=e>>>16,i[n+3]=e>>>24}function og(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Oi.prototype={destroy:function(){this.buf=null},readFields:function(i,e,n){for(n=n||this.length;this.pos>3,w=this.pos;this.type=7&h,i(g,e,this),this.pos===w&&this.skip(h)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Th(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=og(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Th(this.buf,this.pos)+Th(this.buf,this.pos+4)*ad;return this.pos+=8,i},readSFixed64:function(){var i=Th(this.buf,this.pos)+og(this.buf,this.pos+4)*ad;return this.pos+=8,i},readFloat:function(){var i=tg(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=tg(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,n,h=this.buf;return e=127&(n=h[this.pos++]),n<128?e:(e|=(127&(n=h[this.pos++]))<<7,n<128?e:(e|=(127&(n=h[this.pos++]))<<14,n<128?e:(e|=(127&(n=h[this.pos++]))<<21,n<128?e:function(g,w,S){var T,P,A=S.buf;if(T=(112&(P=A[S.pos++]))>>4,P<128||(T|=(127&(P=A[S.pos++]))<<3,P<128)||(T|=(127&(P=A[S.pos++]))<<10,P<128)||(T|=(127&(P=A[S.pos++]))<<17,P<128)||(T|=(127&(P=A[S.pos++]))<<24,P<128)||(T|=(1&(P=A[S.pos++]))<<31,P<128))return ou(g,T,w);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=h[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&rg?function(n,h,g){return rg.decode(n.subarray(h,g))}(this.buf,e,i):function(n,h,g){for(var w="",S=h;S239?4:O>223?3:O>191?2:1;if(S+Z>g)break;Z===1?O<128&&(U=O):Z===2?(192&(T=n[S+1]))==128&&(U=(31&O)<<6|63&T)<=127&&(U=null):Z===3?(P=n[S+2],(192&(T=n[S+1]))==128&&(192&P)==128&&((U=(15&O)<<12|(63&T)<<6|63&P)<=2047||U>=55296&&U<=57343)&&(U=null)):Z===4&&(P=n[S+2],A=n[S+3],(192&(T=n[S+1]))==128&&(192&P)==128&&(192&A)==128&&((U=(15&O)<<18|(63&T)<<12|(63&P)<<6|63&A)<=65535||U>=1114112)&&(U=null)),U===null?(U=65533,Z=1):U>65535&&(U-=65536,w+=String.fromCharCode(U>>>10&1023|55296),U=56320|1023&U),w+=String.fromCharCode(U),S+=Z}return w}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Oi.Bytes)return i.push(this.readVarint(e));var n=aa(this);for(i=i||[];this.pos127;);else if(e===Oi.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Oi.Fixed32)this.pos+=4;else{if(e!==Oi.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,n){var h,g;if(e>=0?(h=e%4294967296|0,g=e/4294967296|0):(g=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,g=g+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(w,S,T){T.buf[T.pos++]=127&w|128,w>>>=7,T.buf[T.pos++]=127&w|128,w>>>=7,T.buf[T.pos++]=127&w|128,w>>>=7,T.buf[T.pos++]=127&w|128,T.buf[T.pos]=127&(w>>>=7)}(h,0,n),function(w,S){var T=(7&w)<<4;S.buf[S.pos++]|=T|((w>>>=3)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w)))))}(g,n)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(h,g,w){for(var S,T,P=0;P55295&&S<57344){if(!T){S>56319||P+1===g.length?(h[w++]=239,h[w++]=191,h[w++]=189):T=S;continue}if(S<56320){h[w++]=239,h[w++]=191,h[w++]=189,T=S;continue}S=T-55296<<10|S-56320|65536,T=null}else T&&(h[w++]=239,h[w++]=191,h[w++]=189,T=null);S<128?h[w++]=S:(S<2048?h[w++]=S>>6|192:(S<65536?h[w++]=S>>12|224:(h[w++]=S>>18|240,h[w++]=S>>12&63|128),h[w++]=S>>6&63|128),h[w++]=63&S|128)}return w}(this.buf,i,this.pos);var n=this.pos-e;n>=128&&sg(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),ig(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),ig(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&sg(n,h,this),this.pos=n-1,this.writeVarint(h),this.pos+=h},writeMessage:function(i,e,n){this.writeTag(i,Oi.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,jx,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ux,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Gx,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Vx,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,qx,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Zx,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Wx,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Xx,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Hx,e)},writeBytesField:function(i,e){this.writeTag(i,Oi.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Oi.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Oi.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Oi.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Oi.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Oi.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Oi.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Oi.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Oi.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Oi.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var ld=D(eg);const ud=3;function Yx(i,e,n){i===1&&n.readMessage(Kx,e)}function Kx(i,e,n){if(i===3){const{id:h,bitmap:g,width:w,height:S,left:T,top:P,advance:A}=n.readMessage(Jx,{});e.push({id:h,bitmap:new gc({width:w+2*ud,height:S+2*ud},g),metrics:{width:w,height:S,left:T,top:P,advance:A}})}}function Jx(i,e,n){i===1?e.id=n.readVarint():i===2?e.bitmap=n.readBytes():i===3?e.width=n.readVarint():i===4?e.height=n.readVarint():i===5?e.left=n.readSVarint():i===6?e.top=n.readSVarint():i===7&&(e.advance=n.readVarint())}const ag=ud;function lg(i){let e=0,n=0;for(const S of i)e+=S.w*S.h,n=Math.max(n,S.w);i.sort((S,T)=>T.h-S.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let g=0,w=0;for(const S of i)for(let T=h.length-1;T>=0;T--){const P=h[T];if(!(S.w>P.w||S.h>P.h)){if(S.x=P.x,S.y=P.y,w=Math.max(w,S.y+S.h),g=Math.max(g,S.x+S.w),S.w===P.w&&S.h===P.h){const A=h.pop();T=0&&h>=e&&Ph[this.text.charCodeAt(h)];h--)n--;this.text=this.text.substring(e,n),this.sectionIndex=this.sectionIndex.slice(e,n)}substring(e,n){const h=new lu;return h.text=this.text.substring(e,n),h.sectionIndex=this.sectionIndex.slice(e,n),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,n)=>Math.max(e,this.sections[n].scale),0)}addTextSection(e,n){this.text+=e.text,this.sections.push(Sc.forText(e.scale,e.fontStack||n));const h=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ch(i,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J){const ie=lu.fromFeature(i,g);let le;U===I.ai.vertical&&ie.verticalizePunctuation();const{processBidirectionalText:de,processStyledBidirectionalText:De}=go;if(de&&ie.sections.length===1){le=[];const qe=de(ie.toString(),hd(ie,A,w,e,h,Y));for(const it of qe){const Et=new lu;Et.text=it,Et.sections=ie.sections;for(let $t=0;$t0&&la>or&&(or=la)}else{const as=Et[Ei.fontStack],Xn=as&&as[nn];if(Xn&&Xn.rect)fu=Xn.rect,dn=Xn.metrics;else{const la=it[Ei.fontStack],Pc=la&&la[nn];if(!Pc)continue;dn=Pc.metrics}Xr=(jn-Ei.scale)*Cn}Ls?(qe.verticalizable=!0,Pr.push({glyph:nn,imageName:xo,x:oi,y:Vi+Xr,vertical:Ls,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Zi,metrics:dn,rect:fu}),oi+=bo*Ei.scale+Ye):(Pr.push({glyph:nn,imageName:xo,x:oi,y:Vi+Xr,vertical:Ls,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Zi,metrics:dn,rect:fu}),oi+=dn.advance*Ei.scale+Ye)}Pr.length!==0&&(Fi=Math.max(oi-Ye,Fi),tb(Pr,0,Pr.length-1,Ps,or)),oi=0;const os=xt*jn+or;sr.lineOffset=Math.max(or,_r),Vi+=os,Bn=Math.max(os,Bn),++rr}var pn;const Er=Vi-kc,{horizontalAlign:Tr,verticalAlign:Cr}=fd(Gt);(function(mn,jn,_r,sr,Pr,or,os,Br,Ei){const Zi=(jn-_r)*Pr;let nn=0;nn=or!==os?-Br*sr-kc:(-sr*Ei+.5)*os;for(const Xr of mn)for(const dn of Xr.positionedGlyphs)dn.x+=Zi,dn.y+=nn})(qe.positionedLines,Ps,Tr,Cr,Fi,Bn,xt,Er,wt.length),qe.top+=-Cr*Er,qe.bottom=qe.top+Er,qe.left+=-Tr*Fi,qe.right=qe.left+Fi}(Pe,e,n,h,le,S,T,P,U,A,Z,J),!function(qe){for(const it of qe)if(it.positionedGlyphs.length!==0)return!1;return!0}(ve)&&Pe}const Ph={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Qx={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},$x={40:!0};function cg(i,e,n,h,g,w){if(e.imageName){const S=h[e.imageName];return S?S.displaySize[0]*e.scale*Cn/w+g:0}{const S=n[e.fontStack],T=S&&S[i];return T?T.metrics.advance*e.scale+g:0}}function hg(i,e,n,h){const g=Math.pow(i-e,2);return h?i=0;let A=0;for(let U=0;UA){const O=Math.ceil(w/A);g*=O/S,S=O}return{x1:h,y1:g,x2:h+w,y2:g+S}}function mg(i,e,n,h,g,w){const S=i.image;let T;if(S.content){const le=S.content,de=S.pixelRatio||1;T=[le[0]/de,le[1]/de,S.displaySize[0]-le[2]/de,S.displaySize[1]-le[3]/de]}const P=e.left*w,A=e.right*w;let O,U,Z,Y;n==="width"||n==="both"?(Y=g[0]+P-h[3],U=g[0]+A+h[1]):(Y=g[0]+(P+A-S.displaySize[0])/2,U=Y+S.displaySize[0]);const J=e.top*w,ie=e.bottom*w;return n==="height"||n==="both"?(O=g[1]+J-h[0],Z=g[1]+ie+h[2]):(O=g[1]+(J+ie-S.displaySize[1])/2,Z=O+S.displaySize[1]),{image:S,top:O,right:U,bottom:Z,left:Y,collisionPadding:T}}const Ic=255,vo=128,ja=Ic*vo;function gg(i,e){const{expression:n}=e;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Gi(i+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:h,interpolationType:g}=n;let w=0;for(;wS.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Kf([]),this.placementViewportMatrix=Kf([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=gg(this.zoom,n["text-size"]),this.iconSizeData=gg(this.zoom,n["icon-size"]);const h=this.layers[0].layout,g=h.get("symbol-sort-key"),w=h.get("symbol-z-order");this.canOverlap=dd(h,"text-overlap","text-allow-overlap")!=="never"||dd(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=w!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(w==="viewport-y"||w==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(S=>I.ai[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=e.sourceID}createArrays(){this.text=new md(new Tl(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new md(new Tl(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new tn,this.lineVertexArray=new Sr,this.symbolInstances=new ts,this.textAnchorOffsets=new $n}calculateGlyphDependencies(e,n,h,g,w){for(let S=0;S0)&&(S.value.kind!=="constant"||S.value.value.length>0),O=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,U=w.get("symbol-sort-key");if(this.features=[],!A&&!O)return;const Z=n.iconDependencies,Y=n.glyphDependencies,J=n.availableImages,ie=new Gi(this.zoom);for(const{feature:le,id:de,index:De,sourceLayerIndex:ve}of e){const Pe=g._featureFilter.needGeometry,qe=Pl(le,Pe);if(!g._featureFilter.filter(ie,qe,h))continue;let it,Et;if(Pe||(qe.geometry=Cl(le)),A){const wt=g.getValueAndResolveTokens("text-field",qe,h,J),xt=Gn.factory(wt),Gt=this.hasRTLText=this.hasRTLText||sb(xt);(!Gt||go.getRTLTextPluginStatus()==="unavailable"||Gt&&go.isParsed())&&(it=Bx(xt,g,qe))}if(O){const wt=g.getValueAndResolveTokens("icon-image",qe,h,J);Et=wt instanceof hn?wt:hn.fromString(wt)}if(!it&&!Et)continue;const $t=this.sortFeaturesByKey?U.evaluate(qe,{},h):void 0;if(this.features.push({id:de,text:it,icon:Et,index:De,sourceLayerIndex:ve,geometry:qe.geometry,properties:le.properties,type:nb[le.type],sortKey:$t}),Et&&(Z[Et.name]=!0),it){const wt=S.evaluate(qe,{},h).join(","),xt=w.get("text-rotation-alignment")!=="viewport"&&w.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(I.ai.vertical)>=0;for(const Gt of it.sections)if(Gt.image)Z[Gt.image.name]=!0;else{const zt=rc(it.toString()),At=Gt.fontStack||wt,Ye=Y[At]=Y[At]||{};this.calculateGlyphDependencies(Gt.text,Ye,xt,this.allowVerticalPlacement,zt)}}}w.get("symbol-placement")==="line"&&(this.features=function(le){const de={},De={},ve=[];let Pe=0;function qe(wt){ve.push(le[wt]),Pe++}function it(wt,xt,Gt){const zt=De[wt];return delete De[wt],De[xt]=zt,ve[zt].geometry[0].pop(),ve[zt].geometry[0]=ve[zt].geometry[0].concat(Gt[0]),zt}function Et(wt,xt,Gt){const zt=de[xt];return delete de[xt],de[wt]=zt,ve[zt].geometry[0].shift(),ve[zt].geometry[0]=Gt[0].concat(ve[zt].geometry[0]),zt}function $t(wt,xt,Gt){const zt=Gt?xt[0][xt[0].length-1]:xt[0][0];return`${wt}:${zt.x}:${zt.y}`}for(let wt=0;wtwt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,de)=>le.sortKey-de.sortKey)}update(e,n,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,n,this.layers,h),this.icon.programConfigurations.updatePaintArrays(e,n,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,n){const h=this.lineVertexArray.length;if(e.segment!==void 0){let g=e.dist(n[e.segment+1]),w=e.dist(n[e.segment]);const S={};for(let T=e.segment+1;T=0;T--)S[T]={x:n[T].x,y:n[T].y,tileUnitDistanceFromAnchor:w},T>0&&(w+=n[T-1].dist(n[T]));for(let T=0;T0}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(e,n){const h=e.placedSymbolArray.get(n),g=h.vertexStartIndex+4*h.numGlyphs;for(let w=h.vertexStartIndex;wg[T]-g[P]||w[P]-w[T]),S}addToSortKeyRanges(e,n){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===n?h.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const h=this.symbolInstances.get(n);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((g,w,S)=>{g>=0&&S.indexOf(g)===w&&this.addIndicesForPlacedSymbol(this.text,g)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let yg,_g;Mt("SymbolBucket",uu,{omit:["layers","collisionBoxArray","features","compareText"]}),uu.MAX_GLYPHS=65535,uu.addDynamicAttributes=pd;var yd={get paint(){return _g=_g||new p({"icon-opacity":new ti(Ne.paint_symbol["icon-opacity"]),"icon-color":new ti(Ne.paint_symbol["icon-color"]),"icon-halo-color":new ti(Ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new ti(Ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ti(Ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Zt(Ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Zt(Ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new ti(Ne.paint_symbol["text-opacity"]),"text-color":new ti(Ne.paint_symbol["text-color"],{runtimeType:Kn,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ti(Ne.paint_symbol["text-halo-color"]),"text-halo-width":new ti(Ne.paint_symbol["text-halo-width"]),"text-halo-blur":new ti(Ne.paint_symbol["text-halo-blur"]),"text-translate":new Zt(Ne.paint_symbol["text-translate"]),"text-translate-anchor":new Zt(Ne.paint_symbol["text-translate-anchor"])})},get layout(){return yg=yg||new p({"symbol-placement":new Zt(Ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Zt(Ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Zt(Ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ti(Ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Zt(Ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Zt(Ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Zt(Ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Zt(Ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Zt(Ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Zt(Ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new ti(Ne.layout_symbol["icon-size"]),"icon-text-fit":new Zt(Ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Zt(Ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new ti(Ne.layout_symbol["icon-image"]),"icon-rotate":new ti(Ne.layout_symbol["icon-rotate"]),"icon-padding":new ti(Ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Zt(Ne.layout_symbol["icon-keep-upright"]),"icon-offset":new ti(Ne.layout_symbol["icon-offset"]),"icon-anchor":new ti(Ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Zt(Ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Zt(Ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Zt(Ne.layout_symbol["text-rotation-alignment"]),"text-field":new ti(Ne.layout_symbol["text-field"]),"text-font":new ti(Ne.layout_symbol["text-font"]),"text-size":new ti(Ne.layout_symbol["text-size"]),"text-max-width":new ti(Ne.layout_symbol["text-max-width"]),"text-line-height":new Zt(Ne.layout_symbol["text-line-height"]),"text-letter-spacing":new ti(Ne.layout_symbol["text-letter-spacing"]),"text-justify":new ti(Ne.layout_symbol["text-justify"]),"text-radial-offset":new ti(Ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Zt(Ne.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ti(Ne.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ti(Ne.layout_symbol["text-anchor"]),"text-max-angle":new Zt(Ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Zt(Ne.layout_symbol["text-writing-mode"]),"text-rotate":new ti(Ne.layout_symbol["text-rotate"]),"text-padding":new Zt(Ne.layout_symbol["text-padding"]),"text-keep-upright":new Zt(Ne.layout_symbol["text-keep-upright"]),"text-transform":new ti(Ne.layout_symbol["text-transform"]),"text-offset":new ti(Ne.layout_symbol["text-offset"]),"text-allow-overlap":new Zt(Ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Zt(Ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Zt(Ne.layout_symbol["text-ignore-placement"]),"text-optional":new Zt(Ne.layout_symbol["text-optional"])})}};class vg{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:gs,this.defaultValue=e}evaluate(e){if(e.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(e.formattedSection))return n.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Mt("FormatSectionOverride",vg,{omit:["defaultValue"]});class Ah extends b{constructor(e){super(e,yd)}recalculate(e,n){if(super.recalculate(e,n),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 h=this.layout.get("text-writing-mode");if(h){const g=[];for(const w of h)g.indexOf(w)<0&&g.push(w);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,n,h,g){const w=this.layout.get(e).evaluate(n,{},h,g),S=this._unevaluatedLayout._values[e];return S.isDataDriven()||E(S.value)||!w?w:function(T,P){return P.replace(/{([^{}]+)}/g,(A,O)=>T&&O in T?String(T[O]):"")}(n.properties,w)}createBucket(e){return new uu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of yd.paint.overridableProperties){if(!Ah.hasPaintOverride(this.layout,e))continue;const n=this.paint.get(e),h=new vg(n),g=new y(h,n.property.specification);let w=null;w=n.value.kind==="constant"||n.value.kind==="source"?new B("source",g):new W("composite",g,n.value.zoomStops),this.paint._values[e]=new Cs(n.property,w,n.parameters)}}_handleOverridablePaintPropertyUpdate(e,n,h){return!(!this.layout||n.isDataDriven()||h.isDataDriven())&&Ah.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,n){const h=e.get("text-field"),g=yd.paint.properties[n];let w=!1;const S=T=>{for(const P of T)if(g.overrides&&g.overrides.hasOverride(P))return void(w=!0)};if(h.value.kind==="constant"&&h.value.value instanceof Gn)S(h.value.value.sections);else if(h.value.kind==="source"){const T=A=>{w||(A instanceof Os&&an(A.value)===ur?S(A.value.sections):A instanceof Xo?S(A.sections):A.eachChild(T))},P=h.value;P._styleExpression&&T(P._styleExpression.expression)}return w}}let xg;var ob={get paint(){return xg=xg||new p({"background-color":new Zt(Ne.paint_background["background-color"]),"background-pattern":new t(Ne.paint_background["background-pattern"]),"background-opacity":new Zt(Ne.paint_background["background-opacity"])})}};class ab extends b{constructor(e){super(e,ob)}}let bg;var lb={get paint(){return bg=bg||new p({"raster-opacity":new Zt(Ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Zt(Ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Zt(Ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Zt(Ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Zt(Ne.paint_raster["raster-saturation"]),"raster-contrast":new Zt(Ne.paint_raster["raster-contrast"]),"raster-resampling":new Zt(Ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Zt(Ne.paint_raster["raster-fade-duration"])})}};class ub extends b{constructor(e){super(e,lb)}}class cb extends b{constructor(e){super(e,{}),this.onAdd=n=>{this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)},this.onRemove=n=>{this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)},this.implementation=e}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 hb{constructor(e){this._methodToThrottle=e,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 _d=63710088e-1;class Ua{constructor(e,n){if(isNaN(e)||isNaN(n))throw new Error(`Invalid LngLat object: (${e}, ${n})`);if(this.lng=+e,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ua(Oe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const n=Math.PI/180,h=this.lat*n,g=e.lat*n,w=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g)*Math.cos((e.lng-this.lng)*n);return _d*Math.acos(Math.min(w,1))}static convert(e){if(e instanceof Ua)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ua(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ua(Number("lng"in e?e.lng:e.lon),Number(e.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 wg=2*Math.PI*_d;function kg(i){return wg*Math.cos(i*Math.PI/180)}function Sg(i){return(180+i)/360}function Ig(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Eg(i,e){return i/kg(e)}function vd(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Mh{constructor(e,n,h=0){this.x=+e,this.y=+n,this.z=+h}static fromLngLat(e,n=0){const h=Ua.convert(e);return new Mh(Sg(h.lng),Ig(h.lat),Eg(n,h.lat))}toLngLat(){return new Ua(360*this.x-180,vd(this.y))}toAltitude(){return this.z*kg(vd(this.y))}meterInMercatorCoordinateUnits(){return 1/wg*(e=vd(this.y),1/Math.cos(e*Math.PI/180));var e}}function Tg(i,e,n){var h=2*Math.PI*6378137/256/Math.pow(2,n);return[i*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}class xd{constructor(e,n,h){if(e<0||e>25||h<0||h>=Math.pow(2,e)||n<0||n>=Math.pow(2,e))throw new Error(`x=${n}, y=${h}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=n,this.y=h,this.key=Ec(0,e,e,n,h)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,n,h){const g=(S=this.y,T=this.z,P=Tg(256*(w=this.x),256*(S=Math.pow(2,T)-S-1),T),A=Tg(256*(w+1),256*(S+1),T),P[0]+","+P[1]+","+A[0]+","+A[1]);var w,S,T,P,A;const O=function(U,Z,Y){let J,ie="";for(let le=U;le>0;le--)J=1<1?"@2x":"").replace(/{quadkey}/g,O).replace(/{bbox-epsg-3857}/g,g)}isChildOf(e){const n=this.z-e.z;return n>0&&e.x===this.x>>n&&e.y===this.y>>n}getTilePoint(e){const n=Math.pow(2,this.z);return new N((e.x*n-this.x)*kn,(e.y*n-this.y)*kn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Cg{constructor(e,n){this.wrap=e,this.canonical=n,this.key=Ec(e,n.z,n.z,n.x,n.y)}}class ss{constructor(e,n,h,g,w){if(e= z; overscaledZ = ${e}; z = ${h}`);this.overscaledZ=e,this.wrap=n,this.canonical=new xd(h,+g,+w),this.key=Ec(n,e,h,g,w)}clone(){return new ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-e;return e>this.canonical.z?new ss(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ss(e,this.wrap,e,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(e,n){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-e;return e>this.canonical.z?Ec(this.wrap*+n,e,this.canonical.z,this.canonical.x,this.canonical.y):Ec(this.wrap*+n,e,e,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const n=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>n&&e.canonical.y===this.canonical.y>>n}children(e){if(this.overscaledZ>=e)return[new ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,h=2*this.canonical.x,g=2*this.canonical.y;return[new ss(n,this.wrap,n,h,g),new ss(n,this.wrap,n,h+1,g),new ss(n,this.wrap,n,h,g+1),new ss(n,this.wrap,n,h+1,g+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=U),U=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(e+1)}unpack(e,n,h){return e*this.redFactor+n*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,n,h){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let g=n*this.dim,w=n*this.dim+this.dim,S=h*this.dim,T=h*this.dim+this.dim;switch(n){case-1:g=w-1;break;case 1:w=g+1}switch(h){case-1:S=T-1;break;case 1:T=S+1}const P=-n*this.dim,A=-h*this.dim;for(let O=S;O=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Ag{constructor(e,n,h,g,w){this.type="Feature",this._vectorTileFeature=e,e._z=n,e._x=h,e._y=g,this.properties=e.properties,this.id=w}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(e[n]=this[n]);return e}}class Mg{constructor(e,n){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new La(kn,16,0),this.grid3D=new La(kn,16,0),this.featureIndexArray=new is,this.promoteId=n}insert(e,n,h,g,w,S){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,g,w);const P=S?this.grid3D:this.grid;for(let A=0;A=0&&U[3]>=0&&P.insert(T,U[0],U[1],U[2],U[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Fa.VectorTile(new ld(this.rawTileData)).layers,this.sourceLayerCoder=new Lg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,n,h,g){this.loadVTLayers();const w=e.params||{},S=kn/e.tileSize/e.scale,T=tt(w.filter),P=e.queryGeometry,A=e.queryPadding*S,O=Dg(P),U=this.grid.query(O.minX-A,O.minY-A,O.maxX+A,O.maxY+A),Z=Dg(e.cameraQueryGeometry),Y=this.grid3D.query(Z.minX-A,Z.minY-A,Z.maxX+A,Z.maxY+A,(le,de,De,ve)=>function(Pe,qe,it,Et,$t){for(const xt of Pe)if(qe<=xt.x&&it<=xt.y&&Et>=xt.x&&$t>=xt.y)return!0;const wt=[new N(qe,it),new N(qe,$t),new N(Et,$t),new N(Et,it)];if(Pe.length>2){for(const xt of wt)if(iu(Pe,xt))return!0}for(let xt=0;xt(ve||(ve=Cl(Pe)),qe.queryIntersectsFeature(P,Pe,it,ve,this.z,e.transform,S,e.pixelPosMatrix)))}return J}loadMatchingFeature(e,n,h,g,w,S,T,P,A,O,U){const Z=this.bucketLayerIDs[n];if(S&&!function(le,de){for(let De=0;De=0)return!0;return!1}(S,Z))return;const Y=this.sourceLayerCoder.decode(h),J=this.vtLayers[Y].feature(g);if(w.needGeometry){const le=Pl(J,!0);if(!w.filter(new Gi(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!w.filter(new Gi(this.tileID.overscaledZ),J))return;const ie=this.getId(J,Y);for(let le=0;le{const T=e instanceof Yl?e.get(S):null;return T&&T.evaluate?T.evaluate(n,h,g):T})}function Dg(i){let e=1/0,n=1/0,h=-1/0,g=-1/0;for(const w of i)e=Math.min(e,w.x),n=Math.min(n,w.y),h=Math.max(h,w.x),g=Math.max(g,w.y);return{minX:e,minY:n,maxX:h,maxY:g}}function fb(i,e){return e-i}function zg(i,e,n,h,g){const w=[];for(let S=0;S=h&&U.x>=h||(O.x>=h?O=new N(h,O.y+(h-O.x)/(U.x-O.x)*(U.y-O.y))._round():U.x>=h&&(U=new N(h,O.y+(h-O.x)/(U.x-O.x)*(U.y-O.y))._round()),O.y>=g&&U.y>=g||(O.y>=g?O=new N(O.x+(g-O.y)/(U.y-O.y)*(U.x-O.x),g)._round():U.y>=g&&(U=new N(O.x+(g-O.y)/(U.y-O.y)*(U.x-O.x),g)._round()),P&&O.equals(P[P.length-1])||(P=[O],w.push(P)),P.push(U)))))}}return w}Mt("FeatureIndex",Mg,{omit:["rawTileData","sourceLayerCoder"]});class Va extends N{constructor(e,n,h,g){super(e,n),this.angle=h,g!==void 0&&(this.segment=g)}clone(){return new Va(this.x,this.y,this.angle,this.segment)}}function Ng(i,e,n,h,g){if(e.segment===void 0||n===0)return!0;let w=e,S=e.segment+1,T=0;for(;T>-n/2;){if(S--,S<0)return!1;T-=i[S].dist(w),w=i[S]}T+=i[S].dist(i[S+1]),S++;const P=[];let A=0;for(;Th;)A-=P.shift().angleDelta;if(A>g)return!1;S++,T+=O.dist(U)}return!0}function Og(i){let e=0;for(let n=0;nA){const J=(A-P)/Y,ie=Qi.number(U.x,Z.x,J),le=Qi.number(U.y,Z.y,J),de=new Va(ie,le,Z.angleTo(U),O);return de._round(),!S||Ng(i,de,T,S,e)?de:void 0}P+=Y}}function pb(i,e,n,h,g,w,S,T,P){const A=Fg(h,w,S),O=Bg(h,g),U=O*S,Z=i[0].x===0||i[0].x===P||i[0].y===0||i[0].y===P;return e-U=0&&Pe=0&&qe=0&&Z+A<=O){const it=new Va(Pe,qe,De,J);it._round(),h&&!Ng(i,it,w,h,g)||Y.push(it)}}U+=de}return T||Y.length||S||(Y=jg(i,U/2,n,h,g,w,S,!0,P)),Y}Mt("Anchor",Va);const cu=Fr;function Ug(i,e,n,h){const g=[],w=i.image,S=w.pixelRatio,T=w.paddedRect.w-2*cu,P=w.paddedRect.h-2*cu;let A={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const O=w.stretchX||[[0,T]],U=w.stretchY||[[0,P]],Z=(Ye,Wt)=>Ye+Wt[1]-Wt[0],Y=O.reduce(Z,0),J=U.reduce(Z,0),ie=T-Y,le=P-J;let de=0,De=Y,ve=0,Pe=J,qe=0,it=ie,Et=0,$t=le;if(w.content&&h){const Ye=w.content,Wt=Ye[2]-Ye[0],Ut=Ye[3]-Ye[1];(w.textFitWidth||w.textFitHeight)&&(A=pg(i)),de=Rh(O,0,Ye[0]),ve=Rh(U,0,Ye[1]),De=Rh(O,Ye[0],Ye[2]),Pe=Rh(U,Ye[1],Ye[3]),qe=Ye[0]-de,Et=Ye[1]-ve,it=Wt-De,$t=Ut-Pe}const wt=A.x1,xt=A.y1,Gt=A.x2-wt,zt=A.y2-xt,At=(Ye,Wt,Ut,oi)=>{const Vi=Dh(Ye.stretch-de,De,Gt,wt),Fi=zh(Ye.fixed-qe,it,Ye.stretch,Y),Bn=Dh(Wt.stretch-ve,Pe,zt,xt),Ps=zh(Wt.fixed-Et,$t,Wt.stretch,J),rr=Dh(Ut.stretch-de,De,Gt,wt),pn=zh(Ut.fixed-qe,it,Ut.stretch,Y),Er=Dh(oi.stretch-ve,Pe,zt,xt),Tr=zh(oi.fixed-Et,$t,oi.stretch,J),Cr=new N(Vi,Bn),mn=new N(rr,Bn),jn=new N(rr,Er),_r=new N(Vi,Er),sr=new N(Fi/S,Ps/S),Pr=new N(pn/S,Tr/S),or=e*Math.PI/180;if(or){const Ei=Math.sin(or),Zi=Math.cos(or),nn=[Zi,-Ei,Ei,Zi];Cr._matMult(nn),mn._matMult(nn),_r._matMult(nn),jn._matMult(nn)}const os=Ye.stretch+Ye.fixed,Br=Wt.stretch+Wt.fixed;return{tl:Cr,tr:mn,bl:_r,br:jn,tex:{x:w.paddedRect.x+cu+os,y:w.paddedRect.y+cu+Br,w:Ut.stretch+Ut.fixed-os,h:oi.stretch+oi.fixed-Br},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:sr,pixelOffsetBR:Pr,minFontScaleX:it/S/Gt,minFontScaleY:$t/S/zt,isSDF:n}};if(h&&(w.stretchX||w.stretchY)){const Ye=Vg(O,ie,Y),Wt=Vg(U,le,J);for(let Ut=0;Ut0&&(ie=Math.max(10,ie),this.circleDiameter=ie)}else{const Z=!((U=S.image)===null||U===void 0)&&U.content&&(S.image.textFitWidth||S.image.textFitHeight)?pg(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};Z.y1=Z.y1*T-P[0],Z.y2=Z.y2*T+P[2],Z.x1=Z.x1*T-P[3],Z.x2=Z.x2*T+P[1];const Y=S.collisionPadding;if(Y&&(Z.x1-=Y[0]*T,Z.y1-=Y[1]*T,Z.x2+=Y[2]*T,Z.y2+=Y[3]*T),O){const J=new N(Z.x1,Z.y1),ie=new N(Z.x2,Z.y1),le=new N(Z.x1,Z.y2),de=new N(Z.x2,Z.y2),De=O*Math.PI/180;J._rotate(De),ie._rotate(De),le._rotate(De),de._rotate(De),Z.x1=Math.min(J.x,ie.x,le.x,de.x),Z.x2=Math.max(J.x,ie.x,le.x,de.x),Z.y1=Math.min(J.y,ie.y,le.y,de.y),Z.y2=Math.max(J.y,ie.y,le.y,de.y)}e.emplaceBack(n.x,n.y,Z.x1,Z.y1,Z.x2,Z.y2,h,g,w)}this.boxEndIndex=e.length}}class mb{constructor(e=[],n=(h,g)=>hg?1:0){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:h}=this,g=n[e];for(;e>0;){const w=e-1>>1,S=n[w];if(h(g,S)>=0)break;n[e]=S,e=w}n[e]=g}_down(e){const{data:n,compare:h}=this,g=this.length>>1,w=n[e];for(;e=0)break;n[e]=n[S],e=S}n[e]=w}}function gb(i,e=1,n=!1){let h=1/0,g=1/0,w=-1/0,S=-1/0;const T=i[0];for(let Y=0;Yw)&&(w=J.x),(!Y||J.y>S)&&(S=J.y)}const P=Math.min(w-h,S-g);let A=P/2;const O=new mb([],yb);if(P===0)return new N(h,g);for(let Y=h;YU.d||!U.d)&&(U=Y,n&&console.log("found best %d after %d probes",Math.round(1e4*Y.d)/1e4,Z)),Y.max-U.d<=e||(A=Y.h/2,O.push(new hu(Y.p.x-A,Y.p.y-A,A,i)),O.push(new hu(Y.p.x+A,Y.p.y-A,A,i)),O.push(new hu(Y.p.x-A,Y.p.y+A,A,i)),O.push(new hu(Y.p.x+A,Y.p.y+A,A,i)),Z+=4)}return n&&(console.log(`num probes: ${Z}`),console.log(`best distance: ${U.d}`)),U.p}function yb(i,e){return e.max-i.max}function hu(i,e,n,h){this.p=new N(i,e),this.h=n,this.d=function(g,w){let S=!1,T=1/0;for(let P=0;Pg.y!=J.y>g.y&&g.x<(J.x-Y.x)*(g.y-Y.y)/(J.y-Y.y)+Y.x&&(S=!S),T=Math.min(T,Im(g,Y,J))}}return(S?1:-1)*Math.sqrt(T)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var nr;I.ar=void 0,(nr=I.ar||(I.ar={}))[nr.center=1]="center",nr[nr.left=2]="left",nr[nr.right=3]="right",nr[nr.top=4]="top",nr[nr.bottom=5]="bottom",nr[nr["top-left"]=6]="top-left",nr[nr["top-right"]=7]="top-right",nr[nr["bottom-left"]=8]="bottom-left",nr[nr["bottom-right"]=9]="bottom-right";const qa=7,bd=Number.POSITIVE_INFINITY;function qg(i,e){return e[1]!==bd?function(n,h,g){let w=0,S=0;switch(h=Math.abs(h),g=Math.abs(g),n){case"top-right":case"top-left":case"top":S=g-qa;break;case"bottom-right":case"bottom-left":case"bottom":S=-g+qa}switch(n){case"top-right":case"bottom-right":case"right":w=-h;break;case"top-left":case"bottom-left":case"left":w=h}return[w,S]}(i,e[0],e[1]):function(n,h){let g=0,w=0;h<0&&(h=0);const S=h/Math.SQRT2;switch(n){case"top-right":case"top-left":w=S-qa;break;case"bottom-right":case"bottom-left":w=-S+qa;break;case"bottom":w=-h+qa;break;case"top":w=h-qa}switch(n){case"top-right":case"bottom-right":g=-S;break;case"top-left":case"bottom-left":g=S;break;case"left":g=h;break;case"right":g=-h}return[g,w]}(i,e[0])}function Gg(i,e,n){var h;const g=i.layout,w=(h=g.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(e,{},n);if(w){const T=w.values,P=[];for(let A=0;AZ*Cn);O.startsWith("top")?U[1]-=qa:O.startsWith("bottom")&&(U[1]+=qa),P[A+1]=U}return new on(P)}const S=g.get("text-variable-anchor");if(S){let T;T=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(e,{},n)*Cn,bd]:g.get("text-offset").evaluate(e,{},n).map(A=>A*Cn);const P=[];for(const A of S)P.push(A,qg(A,T));return new on(P)}return null}function wd(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function _b(i,e,n,h,g,w,S,T,P,A,O){let U=w.textMaxSize.evaluate(e,{});U===void 0&&(U=S);const Z=i.layers[0].layout,Y=Z.get("icon-offset").evaluate(e,{},O),J=Wg(n.horizontal),ie=S/24,le=i.tilePixelRatio*ie,de=i.tilePixelRatio*U/24,De=i.tilePixelRatio*T,ve=i.tilePixelRatio*Z.get("symbol-spacing"),Pe=Z.get("text-padding")*i.tilePixelRatio,qe=function(Ye,Wt,Ut,oi=1){const Vi=Ye.get("icon-padding").evaluate(Wt,{},Ut),Fi=Vi&&Vi.values;return[Fi[0]*oi,Fi[1]*oi,Fi[2]*oi,Fi[3]*oi]}(Z,e,O,i.tilePixelRatio),it=Z.get("text-max-angle")/180*Math.PI,Et=Z.get("text-rotation-alignment")!=="viewport"&&Z.get("symbol-placement")!=="point",$t=Z.get("icon-rotation-alignment")==="map"&&Z.get("symbol-placement")!=="point",wt=Z.get("symbol-placement"),xt=ve/2,Gt=Z.get("icon-text-fit");let zt;h&&Gt!=="none"&&(i.allowVerticalPlacement&&n.vertical&&(zt=mg(h,n.vertical,Gt,Z.get("icon-text-fit-padding"),Y,ie)),J&&(h=mg(h,J,Gt,Z.get("icon-text-fit-padding"),Y,ie)));const At=(Ye,Wt)=>{Wt.x<0||Wt.x>=kn||Wt.y<0||Wt.y>=kn||function(Ut,oi,Vi,Fi,Bn,Ps,rr,pn,Er,Tr,Cr,mn,jn,_r,sr,Pr,or,os,Br,Ei,Zi,nn,Xr,dn,fu){const xo=Ut.addToLineVertexArray(oi,Vi);let bo,Ls,as,Xn,la=0,Pc=0,Kg=0,Jg=0,Ld=-1,Ad=-1;const ua={};let Qg=eu("");if(Ut.allowVerticalPlacement&&Fi.vertical){const vr=pn.layout.get("text-rotate").evaluate(Zi,{},dn)+90;as=new Nh(Er,oi,Tr,Cr,mn,Fi.vertical,jn,_r,sr,vr),rr&&(Xn=new Nh(Er,oi,Tr,Cr,mn,rr,or,os,sr,vr))}if(Bn){const vr=pn.layout.get("icon-rotate").evaluate(Zi,{}),ls=pn.layout.get("icon-text-fit")!=="none",Al=Ug(Bn,vr,Xr,ls),Xs=rr?Ug(rr,vr,Xr,ls):void 0;Ls=new Nh(Er,oi,Tr,Cr,mn,Bn,or,os,!1,vr),la=4*Al.length;const Ml=Ut.iconSizeData;let wo=null;Ml.kind==="source"?(wo=[vo*pn.layout.get("icon-size").evaluate(Zi,{})],wo[0]>ja&&st(`${Ut.layerIds[0]}: Value for "icon-size" is >= ${Ic}. Reduce your "icon-size".`)):Ml.kind==="composite"&&(wo=[vo*nn.compositeIconSizes[0].evaluate(Zi,{},dn),vo*nn.compositeIconSizes[1].evaluate(Zi,{},dn)],(wo[0]>ja||wo[1]>ja)&&st(`${Ut.layerIds[0]}: Value for "icon-size" is >= ${Ic}. Reduce your "icon-size".`)),Ut.addSymbols(Ut.icon,Al,wo,Ei,Br,Zi,I.ai.none,oi,xo.lineStartIndex,xo.lineLength,-1,dn),Ld=Ut.icon.placedSymbolArray.length-1,Xs&&(Pc=4*Xs.length,Ut.addSymbols(Ut.icon,Xs,wo,Ei,Br,Zi,I.ai.vertical,oi,xo.lineStartIndex,xo.lineLength,-1,dn),Ad=Ut.icon.placedSymbolArray.length-1)}const $g=Object.keys(Fi.horizontal);for(const vr of $g){const ls=Fi.horizontal[vr];if(!bo){Qg=eu(ls.text);const Xs=pn.layout.get("text-rotate").evaluate(Zi,{},dn);bo=new Nh(Er,oi,Tr,Cr,mn,ls,jn,_r,sr,Xs)}const Al=ls.positionedLines.length===1;if(Kg+=Zg(Ut,oi,ls,Ps,pn,sr,Zi,Pr,xo,Fi.vertical?I.ai.horizontal:I.ai.horizontalOnly,Al?$g:[vr],ua,Ld,nn,dn),Al)break}Fi.vertical&&(Jg+=Zg(Ut,oi,Fi.vertical,Ps,pn,sr,Zi,Pr,xo,I.ai.vertical,["vertical"],ua,Ad,nn,dn));const bb=bo?bo.boxStartIndex:Ut.collisionBoxArray.length,wb=bo?bo.boxEndIndex:Ut.collisionBoxArray.length,kb=as?as.boxStartIndex:Ut.collisionBoxArray.length,Sb=as?as.boxEndIndex:Ut.collisionBoxArray.length,Ib=Ls?Ls.boxStartIndex:Ut.collisionBoxArray.length,Eb=Ls?Ls.boxEndIndex:Ut.collisionBoxArray.length,Tb=Xn?Xn.boxStartIndex:Ut.collisionBoxArray.length,Cb=Xn?Xn.boxEndIndex:Ut.collisionBoxArray.length;let Ws=-1;const Fh=(vr,ls)=>vr&&vr.circleDiameter?Math.max(vr.circleDiameter,ls):ls;Ws=Fh(bo,Ws),Ws=Fh(as,Ws),Ws=Fh(Ls,Ws),Ws=Fh(Xn,Ws);const ey=Ws>-1?1:0;ey&&(Ws*=fu/Cn),Ut.glyphOffsetArray.length>=uu.MAX_GLYPHS&&st("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Zi.sortKey!==void 0&&Ut.addToSortKeyRanges(Ut.symbolInstances.length,Zi.sortKey);const Pb=Gg(pn,Zi,dn),[Lb,Ab]=function(vr,ls){const Al=vr.length,Xs=ls==null?void 0:ls.values;if((Xs==null?void 0:Xs.length)>0)for(let Ml=0;Ml=0?ua.right:-1,ua.center>=0?ua.center:-1,ua.left>=0?ua.left:-1,ua.vertical||-1,Ld,Ad,Qg,bb,wb,kb,Sb,Ib,Eb,Tb,Cb,Tr,Kg,Jg,la,Pc,ey,0,jn,Ws,Lb,Ab)}(i,Wt,Ye,n,h,g,zt,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,le,[Pe,Pe,Pe,Pe],Et,P,De,qe,$t,Y,e,w,A,O,S)};if(wt==="line")for(const Ye of zg(e.geometry,0,0,kn,kn)){const Wt=pb(Ye,ve,it,n.vertical||J,h,24,de,i.overscaling,kn);for(const Ut of Wt)J&&vb(i,J.text,xt,Ut)||At(Ye,Ut)}else if(wt==="line-center"){for(const Ye of e.geometry)if(Ye.length>1){const Wt=db(Ye,it,n.vertical||J,h,24,de);Wt&&At(Ye,Wt)}}else if(e.type==="Polygon")for(const Ye of Yo(e.geometry,0)){const Wt=gb(Ye,16);At(Ye[0],new Va(Wt.x,Wt.y,0))}else if(e.type==="LineString")for(const Ye of e.geometry)At(Ye,new Va(Ye[0].x,Ye[0].y,0));else if(e.type==="Point")for(const Ye of e.geometry)for(const Wt of Ye)At([Wt],new Va(Wt.x,Wt.y,0))}function Zg(i,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J){const ie=function(De,ve,Pe,qe,it,Et,$t,wt){const xt=qe.layout.get("text-rotate").evaluate(Et,{})*Math.PI/180,Gt=[];for(const zt of ve.positionedLines)for(const At of zt.positionedGlyphs){if(!At.rect)continue;const Ye=At.rect||{};let Wt=ag+1,Ut=!0,oi=1,Vi=0;const Fi=(it||wt)&&At.vertical,Bn=At.metrics.advance*At.scale/2;if(wt&&ve.verticalizable&&(Vi=zt.lineOffset/2-(At.imageName?-(Cn-At.metrics.width*At.scale)/2:(At.scale-1)*Cn)),At.imageName){const Ei=$t[At.imageName];Ut=Ei.sdf,oi=Ei.pixelRatio,Wt=Fr/oi}const Ps=it?[At.x+Bn,At.y]:[0,0];let rr=it?[0,0]:[At.x+Bn+Pe[0],At.y+Pe[1]-Vi],pn=[0,0];Fi&&(pn=rr,rr=[0,0]);const Er=At.metrics.isDoubleResolution?2:1,Tr=(At.metrics.left-Wt)*At.scale-Bn+rr[0],Cr=(-At.metrics.top-Wt)*At.scale+rr[1],mn=Tr+Ye.w/Er*At.scale/oi,jn=Cr+Ye.h/Er*At.scale/oi,_r=new N(Tr,Cr),sr=new N(mn,Cr),Pr=new N(Tr,jn),or=new N(mn,jn);if(Fi){const Ei=new N(-Bn,Bn-kc),Zi=-Math.PI/2,nn=Cn/2-Bn,Xr=new N(5-kc-nn,-(At.imageName?nn:0)),dn=new N(...pn);_r._rotateAround(Zi,Ei)._add(Xr)._add(dn),sr._rotateAround(Zi,Ei)._add(Xr)._add(dn),Pr._rotateAround(Zi,Ei)._add(Xr)._add(dn),or._rotateAround(Zi,Ei)._add(Xr)._add(dn)}if(xt){const Ei=Math.sin(xt),Zi=Math.cos(xt),nn=[Zi,-Ei,Ei,Zi];_r._matMult(nn),sr._matMult(nn),Pr._matMult(nn),or._matMult(nn)}const os=new N(0,0),Br=new N(0,0);Gt.push({tl:_r,tr:sr,bl:Pr,br:or,tex:Ye,writingMode:ve.writingMode,glyphOffset:Ps,sectionIndex:At.sectionIndex,isSDF:Ut,pixelOffsetTL:os,pixelOffsetBR:Br,minFontScaleX:0,minFontScaleY:0})}return Gt}(0,n,T,g,w,S,h,i.allowVerticalPlacement),le=i.textSizeData;let de=null;le.kind==="source"?(de=[vo*g.layout.get("text-size").evaluate(S,{})],de[0]>ja&&st(`${i.layerIds[0]}: Value for "text-size" is >= ${Ic}. Reduce your "text-size".`)):le.kind==="composite"&&(de=[vo*Y.compositeTextSizes[0].evaluate(S,{},J),vo*Y.compositeTextSizes[1].evaluate(S,{},J)],(de[0]>ja||de[1]>ja)&&st(`${i.layerIds[0]}: Value for "text-size" is >= ${Ic}. Reduce your "text-size".`)),i.addSymbols(i.text,ie,de,T,w,S,A,e,P.lineStartIndex,P.lineLength,Z,J);for(const De of O)U[De]=i.text.placedSymbolArray.length-1;return 4*ie.length}function Wg(i){for(const e in i)return i[e];return null}function vb(i,e,n,h){const g=i.compareText;if(e in g){const w=g[e];for(let S=w.length-1;S>=0;S--)if(h.dist(w[S])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const w=Xg[15&h];if(!w)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(e,2,1),[T]=new Uint32Array(e,4,1);return new kd(T,S,w,e)}constructor(e,n=64,h=Float64Array,g){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=h,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const w=Xg.indexOf(this.ArrayType),S=2*e*this.ArrayType.BYTES_PER_ELEMENT,T=e*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-T%8)%8;if(w<0)throw new Error(`Unexpected typed array class: ${h}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+T+P,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+S+T+P),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+T+P,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+w]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=e,this.coords[this._pos++]=n,h}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Sd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:w,coords:S,nodeSize:T}=this,P=[0,w.length-1,0],A=[];for(;P.length;){const O=P.pop()||0,U=P.pop()||0,Z=P.pop()||0;if(U-Z<=T){for(let le=Z;le<=U;le++){const de=S[2*le],De=S[2*le+1];de>=e&&de<=h&&De>=n&&De<=g&&A.push(w[le])}continue}const Y=Z+U>>1,J=S[2*Y],ie=S[2*Y+1];J>=e&&J<=h&&ie>=n&&ie<=g&&A.push(w[Y]),(O===0?e<=J:n<=ie)&&(P.push(Z),P.push(Y-1),P.push(1-O)),(O===0?h>=J:g>=ie)&&(P.push(Y+1),P.push(U),P.push(1-O))}return A}within(e,n,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:w,nodeSize:S}=this,T=[0,g.length-1,0],P=[],A=h*h;for(;T.length;){const O=T.pop()||0,U=T.pop()||0,Z=T.pop()||0;if(U-Z<=S){for(let le=Z;le<=U;le++)Yg(w[2*le],w[2*le+1],e,n)<=A&&P.push(g[le]);continue}const Y=Z+U>>1,J=w[2*Y],ie=w[2*Y+1];Yg(J,ie,e,n)<=A&&P.push(g[Y]),(O===0?e-h<=J:n-h<=ie)&&(T.push(Z),T.push(Y-1),T.push(1-O)),(O===0?e+h>=J:n+h>=ie)&&(T.push(Y+1),T.push(U),T.push(1-O))}return P}}function Sd(i,e,n,h,g,w){if(g-h<=n)return;const S=h+g>>1;Hg(i,e,S,h,g,w),Sd(i,e,n,h,S-1,1-w),Sd(i,e,n,S+1,g,1-w)}function Hg(i,e,n,h,g,w){for(;g>h;){if(g-h>600){const A=g-h+1,O=n-h+1,U=Math.log(A),Z=.5*Math.exp(2*U/3),Y=.5*Math.sqrt(U*Z*(A-Z)/A)*(O-A/2<0?-1:1);Hg(i,e,n,Math.max(h,Math.floor(n-O*Z/A+Y)),Math.min(g,Math.floor(n+(A-O)*Z/A+Y)),w)}const S=e[2*n+w];let T=h,P=g;for(Tc(i,e,h,n),e[2*g+w]>S&&Tc(i,e,h,g);TS;)P--}e[2*h+w]===S?Tc(i,e,h,P):(P++,Tc(i,e,P,g)),P<=n&&(h=P+1),n<=P&&(g=P-1)}}function Tc(i,e,n,h){Id(i,n,h),Id(e,2*n,2*h),Id(e,2*n+1,2*h+1)}function Id(i,e,n){const h=i[e];i[e]=i[n],i[n]=h}function Yg(i,e,n,h){const g=i-n,w=e-h;return g*g+w*w}var Ed;I.bf=void 0,(Ed=I.bf||(I.bf={})).create="create",Ed.load="load",Ed.fullLoad="fullLoad";let Oh=null,Cc=[];const Td=1e3/60,Cd="loadTime",Pd="fullLoadTime",xb={mark(i){performance.mark(i)},frame(i){const e=i;Oh!=null&&Cc.push(e-Oh),Oh=e},clearMetrics(){Oh=null,Cc=[],performance.clearMeasures(Cd),performance.clearMeasures(Pd);for(const i in I.bf)performance.clearMarks(I.bf[i])},getPerformanceMetrics(){performance.measure(Cd,I.bf.create,I.bf.load),performance.measure(Pd,I.bf.create,I.bf.fullLoad);const i=performance.getEntriesByName(Cd)[0].duration,e=performance.getEntriesByName(Pd)[0].duration,n=Cc.length,h=1/(Cc.reduce((w,S)=>w+S,0)/n/1e3),g=Cc.filter(w=>w>Td).reduce((w,S)=>w+(S-Td)/Td,0);return{loadTime:i,fullLoadTime:e,fps:h,percentDroppedFrames:g/(n+g)*100,totalFrames:n}}};I.$=class extends te{},I.A=nu,I.B=tc,I.C=function(i){if(Lt==null){const e=i.navigator?i.navigator.userAgent:null;Lt=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Lt},I.D=Zt,I.E=Ke,I.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new hb(()=>this.process()),this.subscription=function(n,h,g,w){return n.addEventListener(h,g,!1),{unsubscribe:()=>{n.removeEventListener(h,g,!1)}}}(this.target,"message",n=>this.receive(n)),this.globalScope=lt(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((n,h)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:n,reject:h},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const T={id:g,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const w=[],S=Object.assign(Object.assign({},i),{id:g,sourceMapId:this.mapId,origin:location.origin,data:Sl(i.data,w)});this.target.postMessage(S,{transfer:w})})}receive(i){const e=i.data,n=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[n];const h=this.abortControllers[n];return delete this.abortControllers[n],void(h&&h.abort())}if(lt(self)||e.mustQueue)return this.tasks[n]=e,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return f(this,void 0,void 0,function*(){if(e.type===""){const g=this.resolveRejects[i];return delete this.resolveRejects[i],g?void(e.error?g.reject(Ts(e.error)):g.resolve(Ts(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const n=Ts(e.data),h=new AbortController;this.abortControllers[i]=h;try{const g=yield this.messageHandlers[e.type](e.sourceMapId,n,h);this.completeTask(i,null,g)}catch(g){this.completeTask(i,g)}})}completeTask(i,e,n){const h=[];delete this.abortControllers[i];const g={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Sl(e):null,data:Sl(n,h)};this.target.postMessage(g,{transfer:h})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},I.G=mt,I.H=function(){var i=new nu(16);return nu!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},I.I=cd,I.J=function(i,e,n){var h,g,w,S,T,P,A,O,U,Z,Y,J,ie=n[0],le=n[1],de=n[2];return e===i?(i[12]=e[0]*ie+e[4]*le+e[8]*de+e[12],i[13]=e[1]*ie+e[5]*le+e[9]*de+e[13],i[14]=e[2]*ie+e[6]*le+e[10]*de+e[14],i[15]=e[3]*ie+e[7]*le+e[11]*de+e[15]):(g=e[1],w=e[2],S=e[3],T=e[4],P=e[5],A=e[6],O=e[7],U=e[8],Z=e[9],Y=e[10],J=e[11],i[0]=h=e[0],i[1]=g,i[2]=w,i[3]=S,i[4]=T,i[5]=P,i[6]=A,i[7]=O,i[8]=U,i[9]=Z,i[10]=Y,i[11]=J,i[12]=h*ie+T*le+U*de+e[12],i[13]=g*ie+P*le+Z*de+e[13],i[14]=w*ie+A*le+Y*de+e[14],i[15]=S*ie+O*le+J*de+e[15]),i},I.K=function(i,e,n){var h=n[0],g=n[1],w=n[2];return i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i[3]=e[3]*h,i[4]=e[4]*g,i[5]=e[5]*g,i[6]=e[6]*g,i[7]=e[7]*g,i[8]=e[8]*w,i[9]=e[9]*w,i[10]=e[10]*w,i[11]=e[11]*w,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},I.L=Pm,I.M=function(i,e){const n={};for(let h=0;h{const e=window.document.createElement("video");return e.muted=!0,new Promise(n=>{e.onloadstart=()=>{n(e)};for(const h of i){const g=window.document.createElement("source");Kt(h)||(e.crossOrigin="Anonymous"),g.src=h,e.appendChild(g)}})},I.a4=function(){return je++},I.a5=gi,I.a6=uu,I.a7=tt,I.a8=Pl,I.a9=Gi,I.aA=function(i){i=i.slice();const e=Object.create(null);for(let n=0;n{"source"in S&&h[S.source]?n.push({command:"removeLayer",args:[S.id]}):w.push(S)}),n=n.concat(g),function(S,T,P){T=T||[];const A=(S=S||[]).map(ms),O=T.map(ms),U=S.reduce(zs,{}),Z=T.reduce(zs,{}),Y=A.slice(),J=Object.create(null);let ie,le,de,De,ve;for(let Pe=0,qe=0;Pe@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,h,g,w)=>{const S=g||w;return e[h]=!S||S.toLowerCase(),""}),e["max-age"]){const n=parseInt(e["max-age"],10);isNaN(n)?delete e["max-age"]:e["max-age"]=n}return e},I.ac=function(i,e){const n=[];for(const h in i)h in e||n.push(h);return n},I.ad=ze,I.ae=function(i,e,n){var h=Math.sin(n),g=Math.cos(n),w=e[0],S=e[1],T=e[2],P=e[3],A=e[4],O=e[5],U=e[6],Z=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=w*g+A*h,i[1]=S*g+O*h,i[2]=T*g+U*h,i[3]=P*g+Z*h,i[4]=A*g-w*h,i[5]=O*g-S*h,i[6]=U*g-T*h,i[7]=Z*g-P*h,i},I.af=function(i){var e=new nu(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},I.ag=wh,I.ah=function(i,e){let n=0,h=0;if(i.kind==="constant")h=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:g,minZoom:w,maxZoom:S}=i,T=g?ze(zn.interpolationFactor(g,e,w,S),0,1):0;i.kind==="camera"?h=Qi.number(i.minSize,i.maxSize,T):n=T}return{uSizeT:n,uSize:h}},I.aj=function(i,{uSize:e,uSizeT:n},{lowerSize:h,upperSize:g}){return i.kind==="source"?h/vo:i.kind==="composite"?Qi.number(h/vo,g/vo,n):e},I.ak=pd,I.al=function(i,e,n,h){const g=e.y-i.y,w=e.x-i.x,S=h.y-n.y,T=h.x-n.x,P=S*w-T*g;if(P===0)return null;const A=(T*(i.y-n.y)-S*(i.x-n.x))/P;return new N(i.x+A*w,i.y+A*g)},I.am=zg,I.an=km,I.ao=Kf,I.ap=function(i){let e=1/0,n=1/0,h=-1/0,g=-1/0;for(const w of i)e=Math.min(e,w.x),n=Math.min(n,w.y),h=Math.max(h,w.x),g=Math.max(g,w.y);return[e,n,h,g]},I.aq=Cn,I.as=dd,I.at=function(i,e){var n=e[0],h=e[1],g=e[2],w=e[3],S=e[4],T=e[5],P=e[6],A=e[7],O=e[8],U=e[9],Z=e[10],Y=e[11],J=e[12],ie=e[13],le=e[14],de=e[15],De=n*T-h*S,ve=n*P-g*S,Pe=n*A-w*S,qe=h*P-g*T,it=h*A-w*T,Et=g*A-w*P,$t=O*ie-U*J,wt=O*le-Z*J,xt=O*de-Y*J,Gt=U*le-Z*ie,zt=U*de-Y*ie,At=Z*de-Y*le,Ye=De*At-ve*zt+Pe*Gt+qe*xt-it*wt+Et*$t;return Ye?(i[0]=(T*At-P*zt+A*Gt)*(Ye=1/Ye),i[1]=(g*zt-h*At-w*Gt)*Ye,i[2]=(ie*Et-le*it+de*qe)*Ye,i[3]=(Z*it-U*Et-Y*qe)*Ye,i[4]=(P*xt-S*At-A*wt)*Ye,i[5]=(n*At-g*xt+w*wt)*Ye,i[6]=(le*Pe-J*Et-de*ve)*Ye,i[7]=(O*Et-Z*Pe+Y*ve)*Ye,i[8]=(S*zt-T*xt+A*$t)*Ye,i[9]=(h*xt-n*zt-w*$t)*Ye,i[10]=(J*it-ie*Pe+de*De)*Ye,i[11]=(U*Pe-O*it-Y*De)*Ye,i[12]=(T*wt-S*Gt-P*$t)*Ye,i[13]=(n*Gt-h*wt+g*$t)*Ye,i[14]=(ie*ve-J*qe-le*De)*Ye,i[15]=(O*qe-U*ve+Z*De)*Ye,i):null},I.au=wd,I.av=fd,I.aw=kd,I.ax=function(){const i={},e=Ne.$version;for(const n in Ne.$root){const h=Ne.$root[n];if(h.required){let g=null;g=n==="version"?e:h.type==="array"?[]:{},g!=null&&(i[n]=g)}}return i},I.ay=ch,I.az=_e,I.b=ct,I.b0=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},I.b1=function(i,e,n){return i[0]=e[0]*n[0],i[1]=e[1]*n[1],i[2]=e[2]*n[2],i[3]=e[3]*n[3],i},I.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},I.b3=Oe,I.b4=Cg,I.b5=Eg,I.b6=function(i,e,n,h,g){var w,S=1/Math.tan(e/2);return i[0]=S/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=S,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,g!=null&&g!==1/0?(i[10]=(g+h)*(w=1/(h-g)),i[14]=2*g*h*w):(i[10]=-1,i[14]=-2*h),i},I.b7=function(i,e,n){var h=Math.sin(n),g=Math.cos(n),w=e[4],S=e[5],T=e[6],P=e[7],A=e[8],O=e[9],U=e[10],Z=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=w*g+A*h,i[5]=S*g+O*h,i[6]=T*g+U*h,i[7]=P*g+Z*h,i[8]=A*g-w*h,i[9]=O*g-S*h,i[10]=U*g-T*h,i[11]=Z*g-P*h,i},I.b8=ke,I.b9=Re,I.bA=function(i){return i.message===jt},I.bB=M,I.bC=go,I.ba=function(i){return i*Math.PI/180},I.bb=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},I.bc=class extends K{},I.bd=_d,I.be=xb,I.bg=vt,I.bh=function(i,e){et.REGISTERED_PROTOCOLS[i]=e},I.bi=function(i){delete et.REGISTERED_PROTOCOLS[i]},I.bj=function(i,e){const n={};for(let g=0;gAt*Cn)}let wt=S?"center":n.get("text-justify").evaluate(A,{},i.canonical);const xt=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(A,{},i.canonical)*Cn:1/0,Gt=()=>{i.bucket.allowVerticalPlacement&&rc(Pe)&&(J.vertical=Ch(ie,i.glyphMap,i.glyphPositions,i.imagePositions,O,xt,w,Et,"left",it,de,I.ai.vertical,!0,Z,U))};if(!S&&$t){const zt=new Set;if(wt==="auto")for(let Ye=0;Ye<$t.values.length;Ye+=2)zt.add(wd($t.values[Ye]));else zt.add(wt);let At=!1;for(const Ye of zt)if(!J.horizontal[Ye])if(At)J.horizontal[Ye]=J.horizontal[0];else{const Wt=Ch(ie,i.glyphMap,i.glyphPositions,i.imagePositions,O,xt,w,"center",Ye,it,de,I.ai.horizontal,!1,Z,U);Wt&&(J.horizontal[Ye]=Wt,At=Wt.positionedLines.length===1)}Gt()}else{wt==="auto"&&(wt=wd(Et));const zt=Ch(ie,i.glyphMap,i.glyphPositions,i.imagePositions,O,xt,w,Et,wt,it,de,I.ai.horizontal,!1,Z,U);zt&&(J.horizontal[wt]=zt),Gt(),rc(Pe)&&S&&T&&(J.vertical=Ch(ie,i.glyphMap,i.glyphPositions,i.imagePositions,O,xt,w,Et,wt,it,de,I.ai.vertical,!1,Z,U))}}let De=!1;if(A.icon&&A.icon.name){const Pe=i.imageMap[A.icon.name];Pe&&(le=ib(i.imagePositions[A.icon.name],n.get("icon-offset").evaluate(A,{},i.canonical),n.get("icon-anchor").evaluate(A,{},i.canonical)),De=!!Pe.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=De:i.bucket.sdfIcons!==De&&st("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Pe.pixelRatio!==i.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ve=Wg(J.horizontal)||J.vertical;i.bucket.iconsInText=!!ve&&ve.iconsInText,(ve||le)&&_b(i.bucket,A,J,le,i.imageMap,g,Z,Y,de,De,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},I.bp=od,I.bq=nd,I.br=sd,I.bs=Fa,I.bt=ld,I.bu=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},I.bv=function(i,e,n,h,g){return f(this,void 0,void 0,function*(){if(Ce())try{return yield ii(i,e,n,h,g)}catch{}return function(w,S,T,P,A){const O=w.width,U=w.height;nt&&Ft||(nt=new OffscreenCanvas(O,U),Ft=nt.getContext("2d",{willReadFrequently:!0})),nt.width=O,nt.height=U,Ft.drawImage(w,0,0,O,U);const Z=Ft.getImageData(S,T,P,A);return Ft.clearRect(0,0,O,U),Z.data}(i,e,n,h,g)})},I.bw=Pg,I.bx=D,I.by=F,I.bz=eg,I.c=qt,I.d=i=>f(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),I.e=Ze,I.f=i=>new Promise((e,n)=>{const h=new Image;h.onload=()=>{e(h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=Qt})},h.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const g=new Blob([new Uint8Array(i)],{type:"image/png"});h.src=i.byteLength?URL.createObjectURL(g):Qt}),I.g=Ot,I.h=(i,e)=>vi(Ze(i,{type:"json"}),e),I.i=lt,I.j=Rt,I.k=be,I.l=(i,e)=>vi(Ze(i,{type:"arrayBuffer"}),e),I.m=vi,I.n=function(i){return new ld(i).readFields(Yx,[])},I.o=gc,I.p=lg,I.q=p,I.r=jf,I.s=Kt,I.t=ic,I.u=kt,I.v=Ne,I.w=st,I.x=Gs,I.y=function([i,e,n]){return e+=90,e*=Math.PI/180,n*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(n),y:i*Math.sin(e)*Math.sin(n),z:i*Math.cos(n)}},I.z=Qi}),_("worker",["./shared"],function(I){class f{constructor(H){this.keyCache={},H&&this.replace(H)}replace(H){this._layerConfigs={},this._layers={},this.update(H,[])}update(H,X){for(const $ of H){this._layerConfigs[$.id]=$;const ge=this._layers[$.id]=I.aB($);ge._featureFilter=I.a7(ge.filter),this.keyCache[$.id]&&delete this.keyCache[$.id]}for(const $ of X)delete this.keyCache[$],delete this._layerConfigs[$],delete this._layers[$];this.familiesBySource={};const ee=I.bj(Object.values(this._layerConfigs),this.keyCache);for(const $ of ee){const ge=$.map(Fe=>this._layers[Fe.id]),we=ge[0];if(we.visibility==="none")continue;const Le=we.source||"";let pe=this.familiesBySource[Le];pe||(pe=this.familiesBySource[Le]={});const Ve=we.sourceLayer||"_geojsonTileLayer";let $e=pe[Ve];$e||($e=pe[Ve]=[]),$e.push(ge)}}}class D{constructor(H){const X={},ee=[];for(const Le in H){const pe=H[Le],Ve=X[Le]={};for(const $e in pe){const Fe=pe[+$e];if(!Fe||Fe.bitmap.width===0||Fe.bitmap.height===0)continue;const dt={x:0,y:0,w:Fe.bitmap.width+2,h:Fe.bitmap.height+2};ee.push(dt),Ve[$e]={rect:dt,metrics:Fe.metrics}}}const{w:$,h:ge}=I.p(ee),we=new I.o({width:$||1,height:ge||1});for(const Le in H){const pe=H[Le];for(const Ve in pe){const $e=pe[+Ve];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const Fe=X[Le][Ve].rect;I.o.copy($e.bitmap,we,{x:0,y:0},{x:Fe.x+1,y:Fe.y+1},$e.bitmap)}}this.image=we,this.positions=X}}I.bk("GlyphAtlas",D);class F{constructor(H){this.tileID=new I.S(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,X,ee,$){return I._(this,void 0,void 0,function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new I.a5;const ge=new I.bl(Object.keys(H.layers).sort()),we=new I.bm(this.tileID,this.promoteId);we.bucketLayerIDs=[];const Le={},pe={featureIndex:we,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},Ve=X.familiesBySource[this.source];for(const fi in Ve){const Ii=H.layers[fi];if(!Ii)continue;Ii.version===1&&I.w(`Vector tile source "${this.source}" layer "${fi}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Mi=ge.encode(fi),sn=[];for(let wi=0;wi=Mn.maxzoom||Mn.visibility!=="none"&&(j(wi,this.zoom,ee),(Le[Mn.id]=Mn.createBucket({index:we.bucketLayerIDs.length,layers:wi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Mi,sourceID:this.source})).populate(sn,pe,this.tileID.canonical),we.bucketLayerIDs.push(wi.map(Oo=>Oo.id)))}}const $e=I.aG(pe.glyphDependencies,fi=>Object.keys(fi).map(Number));this.inFlightDependencies.forEach(fi=>fi==null?void 0:fi.abort()),this.inFlightDependencies=[];let Fe=Promise.resolve({});if(Object.keys($e).length){const fi=new AbortController;this.inFlightDependencies.push(fi),Fe=$.sendAsync({type:"GG",data:{stacks:$e,source:this.source,tileID:this.tileID,type:"glyphs"}},fi)}const dt=Object.keys(pe.iconDependencies);let Bt=Promise.resolve({});if(dt.length){const fi=new AbortController;this.inFlightDependencies.push(fi),Bt=$.sendAsync({type:"GI",data:{icons:dt,source:this.source,tileID:this.tileID,type:"icons"}},fi)}const Jt=Object.keys(pe.patternDependencies);let ui=Promise.resolve({});if(Jt.length){const fi=new AbortController;this.inFlightDependencies.push(fi),ui=$.sendAsync({type:"GI",data:{icons:Jt,source:this.source,tileID:this.tileID,type:"patterns"}},fi)}const[bi,Ht,Ai]=yield Promise.all([Fe,Bt,ui]),zi=new D(bi),ji=new I.bn(Ht,Ai);for(const fi in Le){const Ii=Le[fi];Ii instanceof I.a6?(j(Ii.layers,this.zoom,ee),I.bo({bucket:Ii,glyphMap:bi,glyphPositions:zi.positions,imageMap:Ht,imagePositions:ji.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ii.hasPattern&&(Ii instanceof I.bp||Ii instanceof I.bq||Ii instanceof I.br)&&(j(Ii.layers,this.zoom,ee),Ii.addFeatures(pe,this.tileID.canonical,ji.patternPositions))}return this.status="done",{buckets:Object.values(Le).filter(fi=>!fi.isEmpty()),featureIndex:we,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:zi.image,imageAtlas:ji,glyphMap:this.returnDependencies?bi:null,iconMap:this.returnDependencies?Ht:null,glyphPositions:this.returnDependencies?zi.positions:null}})}}function j(ce,H,X){const ee=new I.a9(H);for(const $ of ce)$.recalculate(ee,X)}class N{constructor(H,X,ee){this.actor=H,this.layerIndex=X,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(H,X){return I._(this,void 0,void 0,function*(){const ee=yield I.l(H.request,X);try{return{vectorTile:new I.bs.VectorTile(new I.bt(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch($){const ge=new Uint8Array(ee.data);let we=`Unable to parse the tile at ${H.request.url}, `;throw we+=ge[0]===31&&ge[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${$.message}`,new Error(we)}})}loadTile(H){return I._(this,void 0,void 0,function*(){const X=H.uid,ee=!!(H&&H.request&&H.request.collectResourceTiming)&&new I.bu(H.request),$=new F(H);this.loading[X]=$;const ge=new AbortController;$.abort=ge;try{const we=yield this.loadVectorTile(H,ge);if(delete this.loading[X],!we)return null;const Le=we.rawData,pe={};we.expires&&(pe.expires=we.expires),we.cacheControl&&(pe.cacheControl=we.cacheControl);const Ve={};if(ee){const Fe=ee.finish();Fe&&(Ve.resourceTiming=JSON.parse(JSON.stringify(Fe)))}$.vectorTile=we.vectorTile;const $e=$.parse(we.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[X]=$,this.fetching[X]={rawTileData:Le,cacheControl:pe,resourceTiming:Ve};try{const Fe=yield $e;return I.e({rawTileData:Le.slice(0)},Fe,pe,Ve)}finally{delete this.fetching[X]}}catch(we){throw delete this.loading[X],$.status="done",this.loaded[X]=$,we}})}reloadTile(H){return I._(this,void 0,void 0,function*(){const X=H.uid;if(!this.loaded||!this.loaded[X])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ee=this.loaded[X];if(ee.showCollisionBoxes=H.showCollisionBoxes,ee.status==="parsing"){const $=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);let ge;if(this.fetching[X]){const{rawTileData:we,cacheControl:Le,resourceTiming:pe}=this.fetching[X];delete this.fetching[X],ge=I.e({rawTileData:we.slice(0)},$,Le,pe)}else ge=$;return ge}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(H){return I._(this,void 0,void 0,function*(){const X=this.loading,ee=H.uid;X&&X[ee]&&X[ee].abort&&(X[ee].abort.abort(),delete X[ee])})}removeTile(H){return I._(this,void 0,void 0,function*(){this.loaded&&this.loaded[H.uid]&&delete this.loaded[H.uid]})}}class V{constructor(){this.loaded={}}loadTile(H){return I._(this,void 0,void 0,function*(){const{uid:X,encoding:ee,rawImageData:$,redFactor:ge,greenFactor:we,blueFactor:Le,baseShift:pe}=H,Ve=$.width+2,$e=$.height+2,Fe=I.b($)?new I.R({width:Ve,height:$e},yield I.bv($,-1,-1,Ve,$e)):$,dt=new I.bw(X,Fe,ee,ge,we,Le,pe);return this.loaded=this.loaded||{},this.loaded[X]=dt,dt})}removeTile(H){const X=this.loaded,ee=H.uid;X&&X[ee]&&delete X[ee]}}function Q(ce,H){if(ce.length!==0){re(ce[0],H);for(var X=1;X=Math.abs(Le)?X-pe+Le:Le-pe+X,X=pe}X+ee>=0!=!!H&&ce.reverse()}var Ae=I.bx(function ce(H,X){var ee,$=H&&H.type;if($==="FeatureCollection")for(ee=0;ee>31}function lt(ce,H){for(var X=ce.loadGeometry(),ee=ce.type,$=0,ge=0,we=X.length,Le=0;Lece},ii=Math.fround||(nt=new Float32Array(1),ce=>(nt[0]=+ce,nt[0]));var nt;const Ft=3,jt=5,qt=6;class et{constructor(H){this.options=Object.assign(Object.create(Qt),H),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(H){const{log:X,minZoom:ee,maxZoom:$}=this.options;X&&console.time("total time");const ge=`prepare ${H.length} points`;X&&console.time(ge),this.points=H;const we=[];for(let pe=0;pe=ee;pe--){const Ve=+Date.now();Le=this.trees[pe]=this._createTree(this._cluster(Le,pe)),X&&console.log("z%d: %d clusters in %dms",pe,Le.numItems,+Date.now()-Ve)}return X&&console.timeEnd("total time"),this}getClusters(H,X){let ee=((H[0]+180)%360+360)%360-180;const $=Math.max(-90,Math.min(90,H[1]));let ge=H[2]===180?180:((H[2]+180)%360+360)%360-180;const we=Math.max(-90,Math.min(90,H[3]));if(H[2]-H[0]>=360)ee=-180,ge=180;else if(ee>ge){const Fe=this.getClusters([ee,$,180,we],X),dt=this.getClusters([-180,$,ge,we],X);return Fe.concat(dt)}const Le=this.trees[this._limitZoom(X)],pe=Le.range(vt(ee),_e(we),vt(ge),_e($)),Ve=Le.data,$e=[];for(const Fe of pe){const dt=this.stride*Fe;$e.push(Ve[dt+jt]>1?Ot(Ve,dt,this.clusterProps):this.points[Ve[dt+Ft]])}return $e}getChildren(H){const X=this._getOriginId(H),ee=this._getOriginZoom(H),$="No cluster with the specified id.",ge=this.trees[ee];if(!ge)throw new Error($);const we=ge.data;if(X*this.stride>=we.length)throw new Error($);const Le=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),pe=ge.within(we[X*this.stride],we[X*this.stride+1],Le),Ve=[];for(const $e of pe){const Fe=$e*this.stride;we[Fe+4]===H&&Ve.push(we[Fe+jt]>1?Ot(we,Fe,this.clusterProps):this.points[we[Fe+Ft]])}if(Ve.length===0)throw new Error($);return Ve}getLeaves(H,X,ee){const $=[];return this._appendLeaves($,H,X=X||10,ee=ee||0,0),$}getTile(H,X,ee){const $=this.trees[this._limitZoom(H)],ge=Math.pow(2,H),{extent:we,radius:Le}=this.options,pe=Le/we,Ve=(ee-pe)/ge,$e=(ee+1+pe)/ge,Fe={features:[]};return this._addTileFeatures($.range((X-pe)/ge,Ve,(X+1+pe)/ge,$e),$.data,X,ee,ge,Fe),X===0&&this._addTileFeatures($.range(1-pe/ge,Ve,1,$e),$.data,ge,ee,ge,Fe),X===ge-1&&this._addTileFeatures($.range(0,Ve,pe/ge,$e),$.data,-1,ee,ge,Fe),Fe.features.length?Fe:null}getClusterExpansionZoom(H){let X=this._getOriginZoom(H)-1;for(;X<=this.options.maxZoom;){const ee=this.getChildren(H);if(X++,ee.length!==1)break;H=ee[0].properties.cluster_id}return X}_appendLeaves(H,X,ee,$,ge){const we=this.getChildren(X);for(const Le of we){const pe=Le.properties;if(pe&&pe.cluster?ge+pe.point_count<=$?ge+=pe.point_count:ge=this._appendLeaves(H,pe.cluster_id,ee,$,ge):ge<$?ge++:H.push(Le),H.length===ee)break}return ge}_createTree(H){const X=new I.aw(H.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ee=0;ee1;let $e,Fe,dt;if(Ve)$e=mt(X,pe,this.clusterProps),Fe=X[pe],dt=X[pe+1];else{const ui=this.points[X[pe+Ft]];$e=ui.properties;const[bi,Ht]=ui.geometry.coordinates;Fe=vt(bi),dt=_e(Ht)}const Bt={type:1,geometry:[[Math.round(this.options.extent*(Fe*ge-ee)),Math.round(this.options.extent*(dt*ge-$))]],tags:$e};let Jt;Jt=Ve||this.options.generateId?X[pe+Ft]:this.points[X[pe+Ft]].id,Jt!==void 0&&(Bt.id=Jt),we.features.push(Bt)}}_limitZoom(H){return Math.max(this.options.minZoom,Math.min(Math.floor(+H),this.options.maxZoom+1))}_cluster(H,X){const{radius:ee,extent:$,reduce:ge,minPoints:we}=this.options,Le=ee/($*Math.pow(2,X)),pe=H.data,Ve=[],$e=this.stride;for(let Fe=0;FeX&&(bi+=pe[Ai+jt])}if(bi>ui&&bi>=we){let Ht,Ai=dt*ui,zi=Bt*ui,ji=-1;const fi=((Fe/$e|0)<<5)+(X+1)+this.points.length;for(const Ii of Jt){const Mi=Ii*$e;if(pe[Mi+2]<=X)continue;pe[Mi+2]=X;const sn=pe[Mi+jt];Ai+=pe[Mi]*sn,zi+=pe[Mi+1]*sn,pe[Mi+4]=fi,ge&&(Ht||(Ht=this._map(pe,Fe,!0),ji=this.clusterProps.length,this.clusterProps.push(Ht)),ge(Ht,this._map(pe,Mi)))}pe[Fe+4]=fi,Ve.push(Ai/bi,zi/bi,1/0,fi,-1,bi),ge&&Ve.push(ji)}else{for(let Ht=0;Ht<$e;Ht++)Ve.push(pe[Fe+Ht]);if(bi>1)for(const Ht of Jt){const Ai=Ht*$e;if(!(pe[Ai+2]<=X)){pe[Ai+2]=X;for(let zi=0;zi<$e;zi++)Ve.push(pe[Ai+zi])}}}}return Ve}_getOriginId(H){return H-this.points.length>>5}_getOriginZoom(H){return(H-this.points.length)%32}_map(H,X,ee){if(H[X+jt]>1){const we=this.clusterProps[H[X+qt]];return ee?Object.assign({},we):we}const $=this.points[H[X+Ft]].properties,ge=this.options.map($);return ee&&ge===$?Object.assign({},ge):ge}}function Ot(ce,H,X){return{type:"Feature",id:ce[H+Ft],properties:mt(ce,H,X),geometry:{type:"Point",coordinates:[(ee=ce[H],360*(ee-.5)),vi(ce[H+1])]}};var ee}function mt(ce,H,X){const ee=ce[H+jt],$=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,ge=ce[H+qt],we=ge===-1?{}:Object.assign({},X[ge]);return Object.assign(we,{cluster:!0,cluster_id:ce[H+Ft],point_count:ee,point_count_abbreviated:$})}function vt(ce){return ce/360+.5}function _e(ce){const H=Math.sin(ce*Math.PI/180),X=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return X<0?0:X>1?1:X}function vi(ce){const H=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(H))/Math.PI-90}function Kt(ce,H,X,ee){let $=ee;const ge=H+(X-H>>1);let we,Le=X-H;const pe=ce[H],Ve=ce[H+1],$e=ce[X],Fe=ce[X+1];for(let dt=H+3;dt$)we=dt,$=Bt;else if(Bt===$){const Jt=Math.abs(dt-ge);Jtee&&(we-H>3&&Kt(ce,H,we,ee),ce[we+2]=$,X-we>3&&Kt(ce,we,X,ee))}function _t(ce,H,X,ee,$,ge){let we=$-X,Le=ge-ee;if(we!==0||Le!==0){const pe=((ce-X)*we+(H-ee)*Le)/(we*we+Le*Le);pe>1?(X=$,ee=ge):pe>0&&(X+=we*pe,ee+=Le*pe)}return we=ce-X,Le=H-ee,we*we+Le*Le}function he(ce,H,X,ee){const $={id:ce??null,type:H,geometry:X,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(H==="Point"||H==="MultiPoint"||H==="LineString")be($,X);else if(H==="Polygon")be($,X[0]);else if(H==="MultiLineString")for(const ge of X)be($,ge);else if(H==="MultiPolygon")for(const ge of X)be($,ge[0]);return $}function be(ce,H){for(let X=0;X0&&(we+=ee?($*$e-Ve*ge)/2:Math.sqrt(Math.pow(Ve-$,2)+Math.pow($e-ge,2))),$=Ve,ge=$e}const Le=H.length-3;H[2]=1,Kt(H,0,Le,X),H[Le+2]=1,H.size=Math.abs(we),H.start=0,H.end=H.size}function Yi(ce,H,X,ee){for(let $=0;$1?1:X}function Ki(ce,H,X,ee,$,ge,we,Le){if(ee/=H,ge>=(X/=H)&&we=ee)return null;const pe=[];for(const Ve of ce){const $e=Ve.geometry;let Fe=Ve.type;const dt=$===0?Ve.minX:Ve.minY,Bt=$===0?Ve.maxX:Ve.maxY;if(dt>=X&&Bt=ee)continue;let Jt=[];if(Fe==="Point"||Fe==="MultiPoint")to($e,Jt,X,ee,$);else if(Fe==="LineString")Yn($e,Jt,X,ee,$,!1,Le.lineMetrics);else if(Fe==="MultiLineString")hi($e,Jt,X,ee,$,!1);else if(Fe==="Polygon")hi($e,Jt,X,ee,$,!0);else if(Fe==="MultiPolygon")for(const ui of $e){const bi=[];hi(ui,bi,X,ee,$,!0),bi.length&&Jt.push(bi)}if(Jt.length){if(Le.lineMetrics&&Fe==="LineString"){for(const ui of Jt)pe.push(he(Ve.id,Fe,ui,Ve.tags));continue}Fe!=="LineString"&&Fe!=="MultiLineString"||(Jt.length===1?(Fe="LineString",Jt=Jt[0]):Fe="MultiLineString"),Fe!=="Point"&&Fe!=="MultiPoint"||(Fe=Jt.length===3?"Point":"MultiPoint"),pe.push(he(Ve.id,Fe,Jt,Ve.tags))}}return pe.length?pe:null}function to(ce,H,X,ee,$){for(let ge=0;ge=X&&we<=ee&&An(H,ce[ge],ce[ge+1],ce[ge+2])}}function Yn(ce,H,X,ee,$,ge,we){let Le=Kr(ce);const pe=$===0?ms:zs;let Ve,$e,Fe=ce.start;for(let bi=0;biX&&($e=pe(Le,Ht,Ai,ji,fi,X),we&&(Le.start=Fe+Ve*$e)):Ii>ee?Mi=X&&($e=pe(Le,Ht,Ai,ji,fi,X),sn=!0),Mi>ee&&Ii<=ee&&($e=pe(Le,Ht,Ai,ji,fi,ee),sn=!0),!ge&&sn&&(we&&(Le.end=Fe+Ve*$e),H.push(Le),Le=Kr(ce)),we&&(Fe+=Ve)}let dt=ce.length-3;const Bt=ce[dt],Jt=ce[dt+1],ui=$===0?Bt:Jt;ui>=X&&ui<=ee&&An(Le,Bt,Jt,ce[dt+2]),dt=Le.length-3,ge&&dt>=3&&(Le[dt]!==Le[0]||Le[dt+1]!==Le[1])&&An(Le,Le[0],Le[1],Le[2]),Le.length&&H.push(Le)}function Kr(ce){const H=[];return H.size=ce.size,H.start=ce.start,H.end=ce.end,H}function hi(ce,H,X,ee,$,ge){for(const we of ce)Yn(we,H,X,ee,$,ge,!1)}function An(ce,H,X,ee){ce.push(H,X,ee)}function ms(ce,H,X,ee,$,ge){const we=(ge-H)/(ee-H);return An(ce,ge,X+($-X)*we,1),we}function zs(ce,H,X,ee,$,ge){const we=(ge-X)/($-X);return An(ce,H+(ee-H)*we,ge,1),we}function Ge(ce,H){const X=[];for(let ee=0;ee0&&H.size<($?we:ee))return void(X.numPoints+=H.length/3);const Le=[];for(let pe=0;pewe)&&(X.numSimplified++,Le.push(H[pe],H[pe+1])),X.numPoints++;$&&function(pe,Ve){let $e=0;for(let Fe=0,dt=pe.length,Bt=dt-2;Fe0===Ve)for(let Fe=0,dt=pe.length;Fe
24)throw new Error("maxZoom should be in the 0-24 range");if(X.promoteId&&X.generateId)throw new Error("promoteId and generateId cannot be used together.");let $=function(ge,we){const Le=[];if(ge.type==="FeatureCollection")for(let pe=0;pe1&&console.time("creation"),Bt=this.tiles[dt]=gs(H,X,ee,$,Ve),this.tileCoords.push({z:X,x:ee,y:$}),$e)){$e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",X,ee,$,Bt.numFeatures,Bt.numPoints,Bt.numSimplified),console.timeEnd("creation"));const sn=`z${X}`;this.stats[sn]=(this.stats[sn]||0)+1,this.total++}if(Bt.source=H,ge==null){if(X===Ve.indexMaxZoom||Bt.numPoints<=Ve.indexMaxPoints)continue}else{if(X===Ve.maxZoom||X===ge)continue;if(ge!=null){const sn=ge-X;if(ee!==we>>sn||$!==Le>>sn)continue}}if(Bt.source=null,H.length===0)continue;$e>1&&console.time("clipping");const Jt=.5*Ve.buffer/Ve.extent,ui=.5-Jt,bi=.5+Jt,Ht=1+Jt;let Ai=null,zi=null,ji=null,fi=null,Ii=Ki(H,Fe,ee-Jt,ee+bi,0,Bt.minX,Bt.maxX,Ve),Mi=Ki(H,Fe,ee+ui,ee+Ht,0,Bt.minX,Bt.maxX,Ve);H=null,Ii&&(Ai=Ki(Ii,Fe,$-Jt,$+bi,1,Bt.minY,Bt.maxY,Ve),zi=Ki(Ii,Fe,$+ui,$+Ht,1,Bt.minY,Bt.maxY,Ve),Ii=null),Mi&&(ji=Ki(Mi,Fe,$-Jt,$+bi,1,Bt.minY,Bt.maxY,Ve),fi=Ki(Mi,Fe,$+ui,$+Ht,1,Bt.minY,Bt.maxY,Ve),Mi=null),$e>1&&console.timeEnd("clipping"),pe.push(Ai||[],X+1,2*ee,2*$),pe.push(zi||[],X+1,2*ee,2*$+1),pe.push(ji||[],X+1,2*ee+1,2*$),pe.push(fi||[],X+1,2*ee+1,2*$+1)}}getTile(H,X,ee){H=+H,X=+X,ee=+ee;const $=this.options,{extent:ge,debug:we}=$;if(H<0||H>24)return null;const Le=1<1&&console.log("drilling down to z%d-%d-%d",H,X,ee);let Ve,$e=H,Fe=X,dt=ee;for(;!Ve&&$e>0;)$e--,Fe>>=1,dt>>=1,Ve=this.tiles[Rr($e,Fe,dt)];return Ve&&Ve.source?(we>1&&(console.log("found parent tile z%d-%d-%d",$e,Fe,dt),console.time("drilling down")),this.splitTile(Ve.source,$e,Fe,dt,H,X,ee),we>1&&console.timeEnd("drilling down"),this.tiles[pe]?li(this.tiles[pe],ge):null):null}}function Rr(ce,H,X){return 32*((1<{Fe.properties=Bt;const Jt={};for(const ui of dt)Jt[ui]=pe[ui].evaluate($e,Fe);return Jt},we.reduce=(Bt,Jt)=>{Fe.properties=Jt;for(const ui of dt)$e.accumulated=Bt[ui],Bt[ui]=Ve[ui].evaluate($e,Fe)},we}(H)).load((yield this._pendingData).features):($=yield this._pendingData,new Kn($,H.geojsonVtOptions)),this.loaded={};const ge={};if(ee){const we=ee.finish();we&&(ge.resourceTiming={},ge.resourceTiming[H.source]=JSON.parse(JSON.stringify(we)))}return ge}catch(ge){if(delete this._pendingRequest,I.bA(ge))return{abandoned:!0};throw ge}var $})}getData(){return I._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(H){const X=this.loaded;return X&&X[H.uid]?super.reloadTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,X){return I._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(H,X);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(Ae(ee,!0),H.filter){const $=I.bB(H.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if($.result==="error")throw new Error($.value.map(we=>`${we.key}: ${we.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(we=>$.value.evaluate({zoom:0},we))}}return ee})}loadGeoJSON(H,X){return I._(this,void 0,void 0,function*(){const{promoteId:ee}=H;if(H.request){const $=yield I.h(H.request,X);return this._dataUpdateable=cn($.data,ee)?ur($.data,ee):void 0,$.data}if(typeof H.data=="string")try{const $=JSON.parse(H.data);return this._dataUpdateable=cn($,ee)?ur($,ee):void 0,$}catch{throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}if(!H.dataDiff)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${H.source}`);return function($,ge,we){var Le,pe,Ve,$e;if(ge.removeAll&&$.clear(),ge.remove)for(const Fe of ge.remove)$.delete(Fe);if(ge.add)for(const Fe of ge.add){const dt=si(Fe,we);dt!=null&&$.set(dt,Fe)}if(ge.update)for(const Fe of ge.update){let dt=$.get(Fe.id);if(dt==null)continue;const Bt=!Fe.removeAllProperties&&(((Le=Fe.removeProperties)===null||Le===void 0?void 0:Le.length)>0||((pe=Fe.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0);if((Fe.newGeometry||Fe.removeAllProperties||Bt)&&(dt=Object.assign({},dt),$.set(Fe.id,dt),Bt&&(dt.properties=Object.assign({},dt.properties))),Fe.newGeometry&&(dt.geometry=Fe.newGeometry),Fe.removeAllProperties)dt.properties={};else if(((Ve=Fe.removeProperties)===null||Ve===void 0?void 0:Ve.length)>0)for(const Jt of Fe.removeProperties)Object.prototype.hasOwnProperty.call(dt.properties,Jt)&&delete dt.properties[Jt];if((($e=Fe.addOrUpdateProperties)===null||$e===void 0?void 0:$e.length)>0)for(const{key:Jt,value:ui}of Fe.addOrUpdateProperties)dt.properties[Jt]=ui}}(this._dataUpdateable,H.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(H){return I._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getLeaves(H.clusterId,H.limit,H.offset)}}class Dr{constructor(H){this.self=H,this.actor=new I.F(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(X,ee)=>{if(this.externalWorkerSourceTypes[X])throw new Error(`Worker source with name "${X}" already registered.`);this.externalWorkerSourceTypes[X]=ee},this.self.addProtocol=I.bh,this.self.removeProtocol=I.bi,this.self.registerRTLTextPlugin=X=>{if(I.bC.isParsed())throw new Error("RTL text plugin already registered.");I.bC.setMethods(X)},this.actor.registerMessageHandler("LDT",(X,ee)=>this._getDEMWorkerSource(X,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(X,ee)=>I._(this,void 0,void 0,function*(){this._getDEMWorkerSource(X,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(X,ee)=>I._(this,void 0,void 0,function*(){return this._getWorkerSource(X,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(X,ee)=>I._(this,void 0,void 0,function*(){return this._getWorkerSource(X,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(X,ee)=>I._(this,void 0,void 0,function*(){return this._getWorkerSource(X,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(X,ee)=>this._getWorkerSource(X,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(X,ee)=>this._getWorkerSource(X,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(X,ee)=>this._getWorkerSource(X,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(X,ee)=>this._getWorkerSource(X,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(X,ee)=>this._getWorkerSource(X,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(X,ee)=>this._getWorkerSource(X,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(X,ee)=>I._(this,void 0,void 0,function*(){if(!this.workerSources[X]||!this.workerSources[X][ee.type]||!this.workerSources[X][ee.type][ee.source])return;const $=this.workerSources[X][ee.type][ee.source];delete this.workerSources[X][ee.type][ee.source],$.removeSource!==void 0&&$.removeSource(ee)})),this.actor.registerMessageHandler("RM",X=>I._(this,void 0,void 0,function*(){delete this.layerIndexes[X],delete this.availableImages[X],delete this.workerSources[X],delete this.demWorkerSources[X]})),this.actor.registerMessageHandler("SR",(X,ee)=>I._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(X,ee)=>this._syncRTLPluginState(X,ee)),this.actor.registerMessageHandler("IS",(X,ee)=>I._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(X,ee)=>this._setImages(X,ee)),this.actor.registerMessageHandler("UL",(X,ee)=>I._(this,void 0,void 0,function*(){this._getLayerIndex(X).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(X,ee)=>I._(this,void 0,void 0,function*(){this._getLayerIndex(X).replace(ee)}))}_setImages(H,X){return I._(this,void 0,void 0,function*(){this.availableImages[H]=X;for(const ee in this.workerSources[H]){const $=this.workerSources[H][ee];for(const ge in $)$[ge].availableImages=X}})}_syncRTLPluginState(H,X){return I._(this,void 0,void 0,function*(){if(I.bC.isParsed())return I.bC.getState();if(X.pluginStatus!=="loading")return I.bC.setState(X),X;const ee=X.pluginURL;if(this.self.importScripts(ee),I.bC.isParsed()){const $={pluginStatus:"loaded",pluginURL:ee};return I.bC.setState($),$}throw I.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(H){let X=this.availableImages[H];return X||(X=[]),X}_getLayerIndex(H){let X=this.layerIndexes[H];return X||(X=this.layerIndexes[H]=new f),X}_getWorkerSource(H,X,ee){if(this.workerSources[H]||(this.workerSources[H]={}),this.workerSources[H][X]||(this.workerSources[H][X]={}),!this.workerSources[H][X][ee]){const $={sendAsync:(ge,we)=>(ge.targetMapId=H,this.actor.sendAsync(ge,we))};switch(X){case"vector":this.workerSources[H][X][ee]=new N($,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][X][ee]=new Sn($,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][X][ee]=new this.externalWorkerSourceTypes[X]($,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][X][ee]}_getDEMWorkerSource(H,X){return this.demWorkerSources[H]||(this.demWorkerSources[H]={}),this.demWorkerSources[H][X]||(this.demWorkerSources[H][X]=new V),this.demWorkerSources[H][X]}}return I.i(self)&&(self.worker=new Dr(self)),Dr}),_("index",["exports","./shared"],function(I,f){var D="4.5.1";let F,j;const N={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:x=>new Promise((t,l)=>{const p=requestAnimationFrame(t);x.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),l(f.c())})}),getImageData(x,t=0){return this.getImageCanvasContext(x).getImageData(-t,-t,x.width+2*t,x.height+2*t)},getImageCanvasContext(x){const t=window.document.createElement("canvas"),l=t.getContext("2d",{willReadFrequently:!0});if(!l)throw new Error("failed to create canvas 2d context");return t.width=x.width,t.height=x.height,l.drawImage(x,0,0,x.width,x.height),l},resolveURL:x=>(F||(F=document.createElement("a")),F.href=x,F.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(j==null&&(j=matchMedia("(prefers-reduced-motion: reduce)")),j.matches)}};class V{static testProp(t){if(!V.docStyle)return t[0];for(let l=0;l{window.removeEventListener("click",V.suppressClickInternal,!0)},0)}static getScale(t){const l=t.getBoundingClientRect();return{x:l.width/t.offsetWidth||1,y:l.height/t.offsetHeight||1,boundingClientRect:l}}static getPoint(t,l,p){const m=l.boundingClientRect;return new f.P((p.clientX-m.left)/l.x-t.clientLeft,(p.clientY-m.top)/l.y-t.clientTop)}static mousePos(t,l){const p=V.getScale(t);return V.getPoint(t,p,l)}static touchPos(t,l){const p=[],m=V.getScale(t);for(let b=0;b{re&&Ce(re),re=null,Te=!0},Ae.onerror=()=>{xe=!0,re=null},Ae.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(x){let t,l,p,m;x.resetRequestQueue=()=>{t=[],l=0,p=0,m={}},x.addThrottleControl=R=>{const z=p++;return m[z]=R,z},x.removeThrottleControl=R=>{delete m[R],C()},x.getImage=(R,z,G=!0)=>new Promise((q,K)=>{Q.supported&&(R.headers||(R.headers={}),R.headers.accept="image/webp,*/*"),f.e(R,{type:"image"}),t.push({abortController:z,requestParameters:R,supportImageRefresh:G,state:"queued",onError:te=>{K(te)},onSuccess:te=>{q(te)}}),C()});const b=R=>f._(this,void 0,void 0,function*(){R.state="running";const{requestParameters:z,supportImageRefresh:G,onError:q,onSuccess:K,abortController:te}=R,se=G===!1&&!f.i(self)&&!f.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((fe,ye)=>fe&&ye==="accept",!0));l++;const ue=se?L(z,te):f.m(z,te);try{const fe=yield ue;delete R.abortController,R.state="completed",fe.data instanceof HTMLImageElement||f.b(fe.data)?K(fe):fe.data&&K({data:yield(ae=fe.data,typeof createImageBitmap=="function"?f.d(ae):f.f(ae)),cacheControl:fe.cacheControl,expires:fe.expires})}catch(fe){delete R.abortController,q(fe)}finally{l--,C()}var ae}),C=()=>{const R=(()=>{for(const z of Object.keys(m))if(m[z]())return!0;return!1})()?f.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:f.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=l;z0;z++){const G=t.shift();G.abortController.signal.aborted?z--:b(G)}},L=(R,z)=>new Promise((G,q)=>{const K=new Image,te=R.url,se=R.credentials;se&&se==="include"?K.crossOrigin="use-credentials":(se&&se==="same-origin"||!f.s(te))&&(K.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{K.src="",q(f.c())}),K.fetchPriority="high",K.onload=()=>{K.onerror=K.onload=null,G({data:K})},K.onerror=()=>{K.onerror=K.onload=null,z.signal.aborted||q(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."))},K.src=te})}(ke||(ke={})),ke.resetRequestQueue();class Re{constructor(t){this._transformRequestFn=t}transformRequest(t,l){return this._transformRequestFn&&this._transformRequestFn(t,l)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function ze(x){var t=new f.A(3);return t[0]=x[0],t[1]=x[1],t[2]=x[2],t}var Oe,Ze=function(x,t,l){return x[0]=t[0]-l[0],x[1]=t[1]-l[1],x[2]=t[2]-l[2],x};Oe=new f.A(3),f.A!=Float32Array&&(Oe[0]=0,Oe[1]=0,Oe[2]=0);var je=function(x){var t=x[0],l=x[1];return t*t+l*l};function He(x){const t=[];if(typeof x=="string")t.push({id:"default",url:x});else if(x&&x.length>0){const l=[];for(const{id:p,url:m}of x){const b=`${p}${m}`;l.indexOf(b)===-1&&(l.push(b),t.push({id:p,url:m}))}}return t}function pt(x,t,l){const p=x.split("?");return p[0]+=`${t}${l}`,p.join("?")}(function(){var x=new f.A(2);f.A!=Float32Array&&(x[0]=0,x[1]=0)})();class Ie{constructor(t,l,p,m){this.context=t,this.format=p,this.texture=t.gl.createTexture(),this.update(l,m)}update(t,l,p){const{width:m,height:b}=t,C=!(this.size&&this.size[0]===m&&this.size[1]===b||p),{context:L}=this,{gl:R}=L;if(this.useMipmap=!!(l&&l.useMipmap),R.bindTexture(R.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===R.RGBA&&(!l||l.premultiply!==!1)),C)this.size=[m,b],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||f.b(t)?R.texImage2D(R.TEXTURE_2D,0,this.format,this.format,R.UNSIGNED_BYTE,t):R.texImage2D(R.TEXTURE_2D,0,this.format,m,b,0,this.format,R.UNSIGNED_BYTE,t.data);else{const{x:z,y:G}=p||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||f.b(t)?R.texSubImage2D(R.TEXTURE_2D,0,z,G,R.RGBA,R.UNSIGNED_BYTE,t):R.texSubImage2D(R.TEXTURE_2D,0,z,G,m,b,R.RGBA,R.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&R.generateMipmap(R.TEXTURE_2D)}bind(t,l,p){const{context:m}=this,{gl:b}=m;b.bindTexture(b.TEXTURE_2D,this.texture),p!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=b.LINEAR),t!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,t),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,p||t),this.filter=t),l!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,l),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,l),this.wrap=l)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Pt(x){const{userImage:t}=x;return!!(t&&t.render&&t.render())&&(x.data.replace(new Uint8Array(t.data.buffer)),!0)}class st extends f.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new f.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:l,promiseResolve:p}of this.requestors)p(this._getImagesForIds(l));this.requestors=[]}}getImage(t){const l=this.images[t];if(l&&!l.data&&l.spriteData){const p=l.spriteData;l.data=new f.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),l.spriteData=null}return l}addImage(t,l){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,l)&&(this.images[t]=l)}_validate(t,l){let p=!0;const m=l.data||l.spriteData;return this._validateStretch(l.stretchX,m&&m.width)||(this.fire(new f.j(new Error(`Image "${t}" has invalid "stretchX" value`))),p=!1),this._validateStretch(l.stretchY,m&&m.height)||(this.fire(new f.j(new Error(`Image "${t}" has invalid "stretchY" value`))),p=!1),this._validateContent(l.content,l)||(this.fire(new f.j(new Error(`Image "${t}" has invalid "content" value`))),p=!1),p}_validateStretch(t,l){if(!t)return!0;let p=0;for(const m of t){if(m[0]{let m=!0;if(!this.isLoaded())for(const b of t)this.images[b]||(m=!1);this.isLoaded()||m?l(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:l})})}_getImagesForIds(t){const l={};for(const p of t){let m=this.getImage(p);m||(this.fire(new f.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?l[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:f.w(`Image "${p}" 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 l}getPixelSize(){const{width:t,height:l}=this.atlasImage;return{width:t,height:l}}getPattern(t){const l=this.patterns[t],p=this.getImage(t);if(!p)return null;if(l&&l.position.version===p.version)return l.position;if(l)l.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},b=new f.I(m,p);this.patterns[t]={bin:m,position:b}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const l=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ie(t,this.atlasImage,l.RGBA),this.atlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const b in this.patterns)t.push(this.patterns[b].bin);const{w:l,h:p}=f.p(t),m=this.atlasImage;m.resize({width:l||1,height:p||1});for(const b in this.patterns){const{bin:C}=this.patterns[b],L=C.x+1,R=C.y+1,z=this.getImage(b).data,G=z.width,q=z.height;f.R.copy(z,m,{x:0,y:0},{x:L,y:R},{width:G,height:q}),f.R.copy(z,m,{x:0,y:q-1},{x:L,y:R-1},{width:G,height:1}),f.R.copy(z,m,{x:0,y:0},{x:L,y:R+q},{width:G,height:1}),f.R.copy(z,m,{x:G-1,y:0},{x:L-1,y:R},{width:1,height:q}),f.R.copy(z,m,{x:0,y:0},{x:L+G,y:R},{width:1,height:q})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const l of t){if(this.callbackDispatchedThisFrame[l])continue;this.callbackDispatchedThisFrame[l]=!0;const p=this.getImage(l);p||f.w(`Image with ID: "${l}" was not found`),Pt(p)&&this.updateImage(l,p)}}}const Ue=1e20;function lt(x,t,l,p,m,b,C,L,R){for(let z=t;z-1);R++,b[R]=L,C[R]=z,C[R+1]=Ue}for(let L=0,R=0;L65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[b])return{stack:t,id:l,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[b]){const L=ct.loadGlyphRange(t,b,this.url,this.requestManager);p.requests[b]=L}const C=yield p.requests[b];for(const L in C)this._doesCharSupportLocalGlyph(+L)||(p.glyphs[+L]=C[+L]);return p.ranges[b]=!0,{stack:t,id:l,glyph:C[l]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(f.u["CJK Unified Ideographs"](t)||f.u["Hangul Syllables"](t)||f.u.Hiragana(t)||f.u.Katakana(t))}_tinySDF(t,l,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let b=t.tinySDF;if(!b){let L="400";/bold/i.test(l)?L="900":/medium/i.test(l)?L="500":/light/i.test(l)&&(L="200"),b=t.tinySDF=new ct.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:L})}const C=b.draw(String.fromCharCode(p));return{id:p,bitmap:new f.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}}}}ct.loadGlyphRange=function(x,t,l,p){return f._(this,void 0,void 0,function*(){const m=256*t,b=m+255,C=p.transformRequest(l.replace("{fontstack}",x).replace("{range}",`${m}-${b}`),"Glyphs"),L=yield f.l(C,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${t}, ${m}-${b}`);const R={};for(const z of f.n(L.data))R[z.id]=z;return R})},ct.TinySDF=class{constructor({fontSize:x=24,buffer:t=3,radius:l=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:b="normal",fontStyle:C="normal"}={}){this.buffer=t,this.cutoff=p,this.radius=l;const L=this.size=x+4*t,R=this._createCanvas(L),z=this.ctx=R.getContext("2d",{willReadFrequently:!0});z.font=`${C} ${b} ${x}px ${m}`,z.textBaseline="alphabetic",z.textAlign="left",z.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(x){const t=document.createElement("canvas");return t.width=t.height=x,t}draw(x){const{width:t,actualBoundingBoxAscent:l,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:b}=this.ctx.measureText(x),C=Math.ceil(l),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-m))),R=Math.min(this.size-this.buffer,C+Math.ceil(p)),z=L+2*this.buffer,G=R+2*this.buffer,q=Math.max(z*G,0),K=new Uint8ClampedArray(q),te={data:K,width:z,height:G,glyphWidth:L,glyphHeight:R,glyphTop:C,glyphLeft:0,glyphAdvance:t};if(L===0||R===0)return te;const{ctx:se,buffer:ue,gridInner:ae,gridOuter:fe}=this;se.clearRect(ue,ue,L,R),se.fillText(x,ue,ue+C);const ye=se.getImageData(ue,ue,L,R);fe.fill(Ue,0,q),ae.fill(0,0,q);for(let oe=0;oe0?Qe*Qe:0,ae[Be]=Qe<0?Qe*Qe:0}}lt(fe,0,0,z,G,z,this.f,this.v,this.z),lt(ae,ue,ue,L,R,z,this.f,this.v,this.z);for(let oe=0;oe1&&(R=t[++L]);const G=Math.abs(z-R.left),q=Math.abs(z-R.right),K=Math.min(G,q);let te;const se=b/p*(m+1);if(R.isDash){const ue=m-Math.abs(se);te=Math.sqrt(K*K+ue*ue)}else te=m-Math.sqrt(K*K+se*se);this.data[C+z]=Math.max(0,Math.min(255,te+128))}}}addRegularDash(t){for(let L=t.length-1;L>=0;--L){const R=t[L],z=t[L+1];R.zeroLength?t.splice(L,1):z&&z.isDash===R.isDash&&(z.left=R.left,t.splice(L,1))}const l=t[0],p=t[t.length-1];l.isDash===p.isDash&&(l.left=p.left-this.width,p.right=l.right+this.width);const m=this.width*this.nextRow;let b=0,C=t[b];for(let L=0;L1&&(C=t[++b]);const R=Math.abs(L-C.left),z=Math.abs(L-C.right),G=Math.min(R,z);this.data[m+L]=Math.max(0,Math.min(255,(C.isDash?G:-G)+128))}}addDash(t,l){const p=l?7:0,m=2*p+1;if(this.nextRow+m>this.height)return f.w("LineAtlas out of space"),null;let b=0;for(let L=0;L{l.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[et]}numActive(){return Object.keys(this.active).length}}const mt=Math.floor(N.hardwareConcurrency/2);let vt,_e;function vi(){return vt||(vt=new Ot),vt}Ot.workerCount=f.C(globalThis)?Math.max(Math.min(mt,3),1):1;class Kt{constructor(t,l){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=l;const p=this.workerPool.acquire(l);for(let m=0;m{l.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,l){for(const p of this.actors)p.registerMessageHandler(t,l)}}function _t(){return _e||(_e=new Kt(vi(),f.G),_e.registerMessageHandler("GR",(x,t,l)=>f.m(t,l))),_e}function he(x,t){const l=f.H();return f.J(l,l,[1,1,0]),f.K(l,l,[.5*x.width,.5*x.height,1]),f.L(l,l,x.calculatePosMatrix(t.toUnwrapped()))}function be(x,t,l,p,m,b){const C=function(q,K,te){if(q)for(const se of q){const ue=K[se];if(ue&&ue.source===te&&ue.type==="fill-extrusion")return!0}else for(const se in K){const ue=K[se];if(ue.source===te&&ue.type==="fill-extrusion")return!0}return!1}(m&&m.layers,t,x.id),L=b.maxPitchScaleFactor(),R=x.tilesIn(p,L,C);R.sort(Rt);const z=[];for(const q of R)z.push({wrappedTileID:q.tileID.wrapped().key,queryResults:q.tile.queryRenderedFeatures(t,l,x._state,q.queryGeometry,q.cameraQueryGeometry,q.scale,m,b,L,he(x.transform,q.tileID))});const G=function(q){const K={},te={};for(const se of q){const ue=se.queryResults,ae=se.wrappedTileID,fe=te[ae]=te[ae]||{};for(const ye in ue){const oe=ue[ye],Se=fe[ye]=fe[ye]||{},Me=K[ye]=K[ye]||[];for(const Be of oe)Se[Be.featureIndex]||(Se[Be.featureIndex]=!0,Me.push(Be))}}return K}(z);for(const q in G)G[q].forEach(K=>{const te=K.feature,se=x.getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=se});return G}function Rt(x,t){const l=x.tileID,p=t.tileID;return l.overscaledZ-p.overscaledZ||l.canonical.y-p.canonical.y||l.wrap-p.wrap||l.canonical.x-p.canonical.x}function Ke(x,t,l){return f._(this,void 0,void 0,function*(){let p=x;if(x.url?p=(yield f.h(t.transformRequest(x.url,"Source"),l)).data:yield N.frameAsync(l),!p)return null;const m=f.M(f.e(p,x),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(b=>b.id)),m})}class Ne{constructor(t,l){t&&(l?this.setSouthWest(t).setNorthEast(l):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof f.N?new f.N(t.lng,t.lat):f.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof f.N?new f.N(t.lng,t.lat):f.N.convert(t),this}extend(t){const l=this._sw,p=this._ne;let m,b;if(t instanceof f.N)m=t,b=t;else{if(!(t instanceof Ne))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Ne.convert(t)):this.extend(f.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(f.N.convert(t)):this;if(m=t._sw,b=t._ne,!m||!b)return this}return l||p?(l.lng=Math.min(m.lng,l.lng),l.lat=Math.min(m.lat,l.lat),p.lng=Math.max(b.lng,p.lng),p.lat=Math.max(b.lat,p.lat)):(this._sw=new f.N(m.lng,m.lat),this._ne=new f.N(b.lng,b.lat)),this}getCenter(){return new f.N((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 f.N(this.getWest(),this.getNorth())}getSouthEast(){return new f.N(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(t){const{lng:l,lat:p}=f.N.convert(t);let m=this._sw.lng<=l&&l<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=l&&l>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(t){return t instanceof Ne?t:t&&new Ne(t)}static fromLngLat(t,l=0){const p=360*l/40075017,m=p/Math.cos(Math.PI/180*t.lat);return new Ne(new f.N(t.lng-m,t.lat-p),new f.N(t.lng+m,t.lat+p))}}class Yi{constructor(t,l,p){this.bounds=Ne.convert(this.validateBounds(t)),this.minzoom=l||0,this.maxzoom=p||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const l=Math.pow(2,t.z),p=Math.floor(f.O(this.bounds.getWest())*l),m=Math.floor(f.Q(this.bounds.getNorth())*l),b=Math.ceil(f.O(this.bounds.getEast())*l),C=Math.ceil(f.Q(this.bounds.getSouth())*l);return t.x>=p&&t.x=m&&t.y{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return f.e({},this._options)}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(l,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((b,C)=>{t.reloadPromise={resolve:b,reject:C}})}else t.actor=this.dispatcher.getActor(),m="LT";t.abortController=new AbortController;try{const b=yield t.actor.sendAsync({type:m,data:p},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,b)}catch(b){if(delete t.abortController,t.aborted)return;if(b&&b.status!==404)throw b;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,l){if(l&&l.resourceTiming&&(t.resourceTiming=l.resourceTiming),l&&this.map._refreshExpiredTiles&&t.setExpiryData(l),t.loadVectorData(l,this.map.painter),t.reloadPromise){const p=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(p.resolve).catch(p.reject)}}abortTile(t){return f._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return f._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Je extends f.E{constructor(t,l,p,m){super(),this.id=t,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=f.e({type:"raster"},l),f.e(this,f.M(l,["url","scheme","tileSize"]))}load(){return f._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new f.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Ke(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(f.e(this,t),t.bounds&&(this.tileBounds=new Yi(t.bounds,this.minzoom,this.maxzoom)),this.fire(new f.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new f.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new f.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return f.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const p=yield ke.getImage(this.map._requestManager.transformRequest(l,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&t.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,b=m.gl,C=p.data;t.texture=this.map.painter.getTileTexture(C.width),t.texture?t.texture.update(C,{useMipmap:!0}):(t.texture=new Ie(m,C,b.RGBA,{useMipmap:!0}),t.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&b.texParameterf(b.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),t.state="loaded"}}catch(p){if(delete t.abortController,t.aborted)t.state="unloaded";else if(p)throw t.state="errored",p}})}abortTile(t){return f._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return f._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Ki extends Je{constructor(t,l,p,m){super(t,l,p,m),this.type="raster-dem",this.maxzoom=22,this._options=f.e({type:"raster-dem"},l),this.encoding=l.encoding||"mapbox",this.redFactor=l.redFactor,this.greenFactor=l.greenFactor,this.blueFactor=l.blueFactor,this.baseShift=l.baseShift}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(l,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const m=yield ke.getImage(p,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(m&&m.data){const b=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&t.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const C=f.b(b)&&f.U()?b:yield this.readImageNow(b),L={type:this.type,uid:t.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const R=yield t.actor.sendAsync({type:"LDT",data:L});t.dem=R,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(m){if(delete t.abortController,t.aborted)t.state="unloaded";else if(m)throw t.state="errored",m}})}readImageNow(t){return f._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&f.V()){const l=t.width+2,p=t.height+2;try{return new f.R({width:l,height:p},yield f.W(t,-1,-1,l,p))}catch{}}return N.getImageData(t,1)})}_getNeighboringTiles(t){const l=t.canonical,p=Math.pow(2,l.z),m=(l.x-1+p)%p,b=l.x===0?t.wrap-1:t.wrap,C=(l.x+1+p)%p,L=l.x+1===p?t.wrap+1:t.wrap,R={};return R[new f.S(t.overscaledZ,b,l.z,m,l.y).key]={backfilled:!1},R[new f.S(t.overscaledZ,L,l.z,C,l.y).key]={backfilled:!1},l.y>0&&(R[new f.S(t.overscaledZ,b,l.z,m,l.y-1).key]={backfilled:!1},R[new f.S(t.overscaledZ,t.wrap,l.z,l.x,l.y-1).key]={backfilled:!1},R[new f.S(t.overscaledZ,L,l.z,C,l.y-1).key]={backfilled:!1}),l.y+10&&f.e(b,{resourceTiming:m}),this.fire(new f.k("data",Object.assign(Object.assign({},b),{sourceDataType:"metadata"}))),this.fire(new f.k("data",Object.assign(Object.assign({},b),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new f.k("dataabort",{dataType:"source"}));this.fire(new f.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.actor?"RT":"LT";t.actor=this.actor;const p={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const m=yield this.actor.sendAsync({type:l,data:p},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(m,this.map.painter,l==="RT")})}abortTile(t){return f._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return f._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.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 f.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Yn=f.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Kr extends f.E{constructor(t,l,p,m){super(),this.id=t,this.dispatcher=p,this.coordinates=l.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=l}load(t){return f._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new f.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const l=yield ke.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,l&&l.data&&(this.image=l.data,t&&(this.coordinates=t),this._finishLoading())}catch(l){this._request=null,this._loaded=!0,this.fire(new f.j(l))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new f.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const l=t.map(f.Z.fromLngLat);this.tileID=function(m){let b=1/0,C=1/0,L=-1/0,R=-1/0;for(const K of m)b=Math.min(b,K.x),C=Math.min(C,K.y),L=Math.max(L,K.x),R=Math.max(R,K.y);const z=Math.max(L-b,R-C),G=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),q=Math.pow(2,G);return new f.a1(G,Math.floor((b+L)/2*q),Math.floor((C+R)/2*q))}(l),this.minzoom=this.maxzoom=this.tileID.z;const p=l.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new f.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,f.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,f.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,f.X,f.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new f.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,l=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Yn.members)),this.boundsSegments||(this.boundsSegments=f.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ie(t,this.image,l.RGBA),this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,p=!0)}p&&this.fire(new f.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return f._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class hi extends Kr{constructor(t,l,p,m){super(t,l,p,m),this.roundZoom=!0,this.type="video",this.options=l}load(){return f._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const l of t.urls)this.urls.push(this.map._requestManager.transformRequest(l,"Source").url);try{const l=yield f.a3(this.urls);if(this._loaded=!0,!l)return;this.video=l,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(l){this.fire(new f.j(l))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const l=this.video.seekable;tl.end(0)?this.fire(new f.j(new f.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${l.start(0)} and ${l.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,l=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Yn.members)),this.boundsSegments||(this.boundsSegments=f.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),l.texSubImage2D(l.TEXTURE_2D,0,0,0,l.RGBA,l.UNSIGNED_BYTE,this.video)):(this.texture=new Ie(t,this.video,l.RGBA),this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,p=!0)}p&&this.fire(new f.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 An extends Kr{constructor(t,l,p,m){super(t,l,p,m),l.coordinates?Array.isArray(l.coordinates)&&l.coordinates.length===4&&!l.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(C=>typeof C!="number"))||this.fire(new f.j(new f.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new f.j(new f.a2(`sources.${t}`,null,'missing required property "coordinates"'))),l.animate&&typeof l.animate!="boolean"&&this.fire(new f.j(new f.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),l.canvas?typeof l.canvas=="string"||l.canvas instanceof HTMLCanvasElement||this.fire(new f.j(new f.a2(`sources.${t}`,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 f.j(new f.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=l,this.animate=l.animate===void 0||l.animate}load(){return f._(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 f.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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const l=this.map.painter.context,p=l.gl;this.boundsBuffer||(this.boundsBuffer=l.createVertexBuffer(this._boundsArray,Yn.members)),this.boundsSegments||(this.boundsSegments=f.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ie(l,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const b in this.tiles){const C=this.tiles[b];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,m=!0)}m&&this.fire(new f.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ms={},zs=x=>{switch(x){case"geojson":return to;case"image":return Kr;case"raster":return Je;case"raster-dem":return Ki;case"vector":return Hn;case"video":return hi;case"canvas":return An}return ms[x]},Ge="RTLPluginLoaded";class wr extends f.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=_t()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(l=>{throw this.status="error",l})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return f._(this,arguments,void 0,function*(l,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=N.resolveURL(l),!this.url)throw new Error(`requested url ${l} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return f._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new f.k(Ge))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let li=null;function ei(){return li||(li=new wr),li}class gs{constructor(t,l){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=f.a4(),this.uses=0,this.tileSize=l,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(t){const l=t+this.timeAdded;lb.getLayer(z)).filter(Boolean);if(R.length!==0){L.layers=R,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(z=>R.filter(G=>G.id===z)[0]));for(const z of R)C[z.id]=L}}return C}(t.buckets,l.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const b=this.buckets[m];if(b instanceof f.a6){if(this.hasSymbolBuckets=!0,!p)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const b=this.buckets[m];if(b instanceof f.a6&&b.hasRTLText){this.hasRTLText=!0,ei().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const b=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,l.style.getLayer(m).queryRadius(b))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new f.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(t)}const l=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ie(t,this.imageAtlas.image,l.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ie(t,this.glyphAtlasImage,l.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,l,p,m,b,C,L,R,z,G){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:b,scale:C,tileSize:this.tileSize,pixelPosMatrix:G,transform:R,params:L,queryPadding:this.queryPadding*z},t,l,p):{}}querySourceFeatures(t,l){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),b=l&&l.sourceLayer?l.sourceLayer:"",C=m._geojsonTileLayer||m[b];if(!C)return;const L=f.a7(l&&l.filter),{z:R,x:z,y:G}=this.tileID.canonical,q={z:R,x:z,y:G};for(let K=0;Kp)m=!1;else if(l)if(this.expirationTime{this.remove(t,b)},p)),this.data[m].push(b),this.order.push(m),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const l=this.data[t].shift();return l.timeout&&clearTimeout(l.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),l.value}getByKey(t){const l=this.data[t];return l?l[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,l){if(!this.has(t))return this;const p=t.wrapped().key,m=l===void 0?0:this.data[p].indexOf(l),b=this.data[p][m];return this.data[p].splice(m,1),b.timeout&&clearTimeout(b.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(b.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}filter(t){const l=[];for(const p in this.data)for(const m of this.data[p])t(m.value)||l.push(m);for(const p of l)this.remove(p.value.tileID,p)}}class mi{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,l,p){const m=String(l);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][m]=this.stateChanges[t][m]||{},f.e(this.stateChanges[t][m],p),this.deletedStates[t]===null){this.deletedStates[t]={};for(const b in this.state[t])b!==m&&(this.deletedStates[t][b]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][m]===null){this.deletedStates[t][m]={};for(const b in this.state[t][m])p[b]||(this.deletedStates[t][m][b]=null)}else for(const b in p)this.deletedStates[t]&&this.deletedStates[t][m]&&this.deletedStates[t][m][b]===null&&delete this.deletedStates[t][m][b]}removeFeatureState(t,l,p){if(this.deletedStates[t]===null)return;const m=String(l);if(this.deletedStates[t]=this.deletedStates[t]||{},p&&l!==void 0)this.deletedStates[t][m]!==null&&(this.deletedStates[t][m]=this.deletedStates[t][m]||{},this.deletedStates[t][m][p]=null);else if(l!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][m])for(p in this.deletedStates[t][m]={},this.stateChanges[t][m])this.deletedStates[t][m][p]=null;else this.deletedStates[t][m]=null;else this.deletedStates[t]=null}getState(t,l){const p=String(l),m=f.e({},(this.state[t]||{})[p],(this.stateChanges[t]||{})[p]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const b=this.deletedStates[t][l];if(b===null)return{};for(const C in b)delete m[C]}return m}initializeTileState(t,l){t.setFeatureState(this.state,l)}coalesceChanges(t,l){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const b={};for(const C in this.stateChanges[m])this.state[m][C]||(this.state[m][C]={}),f.e(this.state[m][C],this.stateChanges[m][C]),b[C]=this.state[m][C];p[m]=b}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const b={};if(this.deletedStates[m]===null)for(const C in this.state[m])b[C]={},this.state[m][C]={};else for(const C in this.deletedStates[m]){if(this.deletedStates[m][C]===null)this.state[m][C]={};else for(const L of Object.keys(this.deletedStates[m][C]))delete this.state[m][C][L];b[C]=this.state[m][C]}p[m]=p[m]||{},f.e(p[m],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in t)t[m].setFeatureState(p,l)}}class rt extends f.E{constructor(t,l,p){super(),this.id=t,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,b,C,L)=>{const R=new(zs(b.type))(m,b,C,L);if(R.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${R.id}`);return R})(t,l,p,this),this._tiles={},this._cache=new ut(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new mi,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}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 t in this._tiles){const l=this._tiles[t];if(l.state!=="loaded"&&l.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,l,p){return f._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,l,p)}catch(m){t.state="errored",m.status!==404?this._source.fire(new f.j(m,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new f.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const l in this._tiles){const p=this._tiles[l];p.upload(t),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Kn).map(t=>t.key)}getRenderableIds(t){const l=[];for(const p in this._tiles)this._isIdRenderable(p,t)&&l.push(this._tiles[p]);return t?l.sort((p,m)=>{const b=p.tileID,C=m.tileID,L=new f.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),R=new f.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-C.overscaledZ||R.y-L.y||R.x-L.x}).map(p=>p.tileID.key):l.map(p=>p.tileID).sort(Kn).map(p=>p.key)}hasRenderableParent(t){const l=this.findLoadedParent(t,0);return!!l&&this._isIdRenderable(l.tileID.key)}_isIdRenderable(t,l){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(l||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,l){return f._(this,void 0,void 0,function*(){const p=this._tiles[t];p&&(p.state!=="loading"&&(p.state=l),yield this._loadTile(p,t,l))})}_tileLoaded(t,l,p){t.timeAdded=N.now(),p==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(l,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new f.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const l=this.getRenderableIds();for(let m=0;m1||(Math.abs(C)>1&&(Math.abs(C+R)===1?C+=R:Math.abs(C-R)===1&&(C-=R)),b.dem&&m.dem&&(m.dem.backfillBorder(b.dem,C,L),m.neighboringTiles&&m.neighboringTiles[z]&&(m.neighboringTiles[z].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,l,p,m){for(const b in this._tiles){let C=this._tiles[b];if(m[b]||!C.hasData()||C.tileID.overscaledZ<=l||C.tileID.overscaledZ>p)continue;let L=C.tileID;for(;C&&C.tileID.overscaledZ>l+1;){const z=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[z.key],C&&C.hasData()&&(L=z)}let R=L;for(;R.overscaledZ>l;)if(R=R.scaledTo(R.overscaledZ-1),t[R.key]){m[L.key]=L;break}}}findLoadedParent(t,l){if(t.key in this._loadedParentTiles){const p=this._loadedParentTiles[t.key];return p&&p.tileID.overscaledZ>=l?p:null}for(let p=t.overscaledZ-1;p>=l;p--){const m=t.scaledTo(p),b=this._getLoadedTile(m);if(b)return b}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const l=this._tiles[t.key];return l&&l.hasData()?l:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const l=Math.ceil(t.width/this._source.tileSize)+1,p=Math.ceil(t.height/this._source.tileSize)+1,m=Math.floor(l*p*(this._maxTileCacheZoomLevels===null?f.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(b)}handleWrapJump(t){const l=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,l){const p={};for(const m in this._tiles){const b=this._tiles[m];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+l),p[b.tileID.key]=b}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(t,l,p,m,b,C){const L={},R={},z=Object.keys(t),G=N.now();for(const q of z){const K=t[q],te=this._tiles[q];if(!te||te.fadeEndTime!==0&&te.fadeEndTime<=G)continue;const se=this.findLoadedParent(K,l),ue=this.findLoadedSibling(K),ae=se||ue||null;ae&&(this._addTile(ae.tileID),L[ae.tileID.key]=ae.tileID),R[q]=K}this._retainLoadedChildren(R,m,p,t);for(const q in L)t[q]||(this._coveredTiles[q]=!0,t[q]=L[q]);if(C){const q={},K={};for(const te of b)this._tiles[te.key].hasData()?q[te.key]=te:K[te.key]=te;for(const te in K){const se=K[te].children(this._source.maxzoom);this._tiles[se[0].key]&&this._tiles[se[1].key]&&this._tiles[se[2].key]&&this._tiles[se[3].key]&&(q[se[0].key]=t[se[0].key]=se[0],q[se[1].key]=t[se[1].key]=se[1],q[se[2].key]=t[se[2].key]=se[2],q[se[3].key]=t[se[3].key]=se[3],delete K[te])}for(const te in K){const se=K[te],ue=this.findLoadedParent(se,this._source.minzoom),ae=this.findLoadedSibling(se),fe=ue||ae||null;if(fe){q[fe.tileID.key]=t[fe.tileID.key]=fe.tileID;for(const ye in q)q[ye].isChildOf(fe.tileID)&&delete q[ye]}}for(const te in this._tiles)q[te]||(this._coveredTiles[te]=!0)}}update(t,l){if(!this._sourceLoaded||this._paused)return;let p;this.transform=t,this.terrain=l,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(G=>new f.S(G.canonical.z,G.wrap,G.canonical.z,G.canonical.x,G.canonical.y)):(p=t.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:l}),this._source.hasTile&&(p=p.filter(G=>this._source.hasTile(G)))):p=[];const m=t.coveringZoomLevel(this._source),b=Math.max(m-rt.maxOverzooming,this._source.minzoom),C=Math.max(m+rt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const G={};for(const q of p)if(q.canonical.z>this._source.minzoom){const K=q.scaledTo(q.canonical.z-1);G[K.key]=K;const te=q.scaledTo(Math.max(this._source.minzoom,Math.min(q.canonical.z,5)));G[te.key]=te}p=p.concat(Object.values(G))}const L=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new f.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const R=this._updateRetainedTiles(p,m);Rr(this._source.type)&&this._updateCoveredAndRetainedTiles(R,b,C,m,p,l);for(const G in R)this._tiles[G].clearFadeHold();const z=f.ac(this._tiles,R);for(const G of z){const q=this._tiles[G];q.hasSymbolBuckets&&!q.holdingForFade()?q.setHoldDuration(this.map._fadeDuration):q.hasSymbolBuckets&&!q.symbolFadeFinished()||this._removeTile(G)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,l){var p;const m={},b={},C=Math.max(l-rt.maxOverzooming,this._source.minzoom),L=Math.max(l+rt.maxUnderzooming,this._source.minzoom),R={};for(const z of t){const G=this._addTile(z);m[z.key]=z,G.hasData()||lthis._source.maxzoom){const K=z.children(this._source.maxzoom)[0],te=this.getTile(K);if(te&&te.hasData()){m[K.key]=K;continue}}else{const K=z.children(this._source.maxzoom);if(m[K[0].key]&&m[K[1].key]&&m[K[2].key]&&m[K[3].key])continue}let q=G.wasRequested();for(let K=z.overscaledZ-1;K>=C;--K){const te=z.scaledTo(K);if(b[te.key])break;if(b[te.key]=!0,G=this.getTile(te),!G&&q&&(G=this._addTile(te)),G){const se=G.hasData();if((se||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||q)&&(m[te.key]=te),q=G.wasRequested(),se)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const l=[];let p,m=this._tiles[t].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}l.push(m.key);const b=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(b),p)break;m=b}for(const b of l)this._loadedParentTiles[b]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const l=this._tiles[t].tileID,p=this._getLoadedTile(l);this._loadedSiblingTiles[l.key]=p}}_addTile(t){let l=this._tiles[t.key];if(l)return l;l=this._cache.getAndRemove(t),l&&(this._setTileReloadTimer(t.key,l),l.tileID=t,this._state.initializeTileState(l,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,l)));const p=l;return l||(l=new gs(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(l,t.key,l.state)),l.uses++,this._tiles[t.key]=l,p||this._source.fire(new f.k("dataloading",{tile:l,coord:l.tileID,dataType:"source"})),l}_setTileReloadTimer(t,l){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const p=l.getExpiryTimeout();p&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},p))}_removeTile(t){const l=this._tiles[t];l&&(l.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),l.uses>0||(l.hasData()&&l.state!=="reloading"?this._cache.add(l.tileID,l,l.getExpiryTimeout()):(l.aborted=!0,this._abortTile(l),this._unloadTile(l))))}_dataHandler(t){const l=t.sourceDataType;t.dataType==="source"&&l==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&l==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,l,p){const m=[],b=this.transform;if(!b)return m;const C=p?b.getCameraQueryGeometry(t):t,L=t.map(se=>b.pointCoordinate(se,this.terrain)),R=C.map(se=>b.pointCoordinate(se,this.terrain)),z=this.getIds();let G=1/0,q=1/0,K=-1/0,te=-1/0;for(const se of R)G=Math.min(G,se.x),q=Math.min(q,se.y),K=Math.max(K,se.x),te=Math.max(te,se.y);for(let se=0;se=0&&oe[1].y+ye>=0){const Se=L.map(Be=>ae.getTilePoint(Be)),Me=R.map(Be=>ae.getTilePoint(Be));m.push({tile:ue,tileID:ae,queryGeometry:Se,cameraQueryGeometry:Me,scale:fe})}}return m}getVisibleCoordinates(t){const l=this.getRenderableIds(t).map(p=>this._tiles[p].tileID);for(const p of l)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return l}hasTransition(){if(this._source.hasTransition())return!0;if(Rr(this._source.type)){const t=N.now();for(const l in this._tiles)if(this._tiles[l].fadeEndTime>=t)return!0}return!1}setFeatureState(t,l,p){this._state.updateState(t=t||"_geojsonTileLayer",l,p)}removeFeatureState(t,l,p){this._state.removeFeatureState(t=t||"_geojsonTileLayer",l,p)}getFeatureState(t,l){return this._state.getState(t=t||"_geojsonTileLayer",l)}setDependencies(t,l,p){const m=this._tiles[t];m&&m.setDependencies(l,p)}reloadTilesForDependencies(t,l){for(const p in this._tiles)this._tiles[p].hasDependency(t,l)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(t,l))}}function Kn(x,t){const l=Math.abs(2*x.wrap)-+(x.wrap<0),p=Math.abs(2*t.wrap)-+(t.wrap<0);return x.overscaledZ-t.overscaledZ||p-l||t.canonical.y-x.canonical.y||t.canonical.x-x.canonical.x}function Rr(x){return x==="raster"||x==="image"||x==="video"}rt.maxOverzooming=10,rt.maxUnderzooming=3;class si{constructor(t,l){this.reset(t,l)}reset(t,l){this.points=t||[],this._distances=[0];for(let p=1;p0?(m-C)/L:0;return this.points[b].mult(1-R).add(this.points[l].mult(R))}}function cn(x,t){let l=!0;return x==="always"||x!=="never"&&t!=="never"||(l=!1),l}class ur{constructor(t,l,p){const m=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(t/p),this.yCellCount=Math.ceil(l/p);for(let C=0;Cthis.width||m<0||l>this.height)return[];const R=[];if(t<=0&&l<=0&&this.width<=p&&this.height<=m){if(b)return[{key:null,x1:t,y1:l,x2:p,y2:m}];for(let z=0;z0}hitTestCircle(t,l,p,m,b){const C=t-p,L=t+p,R=l-p,z=l+p;if(L<0||C>this.width||z<0||R>this.height)return!1;const G=[];return this._forEachCell(C,R,L,z,this._queryCellCircle,G,{hitTest:!0,overlapMode:m,circle:{x:t,y:l,radius:p},seenUids:{box:{},circle:{}}},b),G.length>0}_queryCell(t,l,p,m,b,C,L,R){const{seenUids:z,hitTest:G,overlapMode:q}=L,K=this.boxCells[b];if(K!==null){const se=this.bboxes;for(const ue of K)if(!z.box[ue]){z.box[ue]=!0;const ae=4*ue,fe=this.boxKeys[ue];if(t<=se[ae+2]&&l<=se[ae+3]&&p>=se[ae+0]&&m>=se[ae+1]&&(!R||R(fe))&&(!G||!cn(q,fe.overlapMode))&&(C.push({key:fe,x1:se[ae],y1:se[ae+1],x2:se[ae+2],y2:se[ae+3]}),G))return!0}}const te=this.circleCells[b];if(te!==null){const se=this.circles;for(const ue of te)if(!z.circle[ue]){z.circle[ue]=!0;const ae=3*ue,fe=this.circleKeys[ue];if(this._circleAndRectCollide(se[ae],se[ae+1],se[ae+2],t,l,p,m)&&(!R||R(fe))&&(!G||!cn(q,fe.overlapMode))){const ye=se[ae],oe=se[ae+1],Se=se[ae+2];if(C.push({key:fe,x1:ye-Se,y1:oe-Se,x2:ye+Se,y2:oe+Se}),G)return!0}}}return!1}_queryCellCircle(t,l,p,m,b,C,L,R){const{circle:z,seenUids:G,overlapMode:q}=L,K=this.boxCells[b];if(K!==null){const se=this.bboxes;for(const ue of K)if(!G.box[ue]){G.box[ue]=!0;const ae=4*ue,fe=this.boxKeys[ue];if(this._circleAndRectCollide(z.x,z.y,z.radius,se[ae+0],se[ae+1],se[ae+2],se[ae+3])&&(!R||R(fe))&&!cn(q,fe.overlapMode))return C.push(!0),!0}}const te=this.circleCells[b];if(te!==null){const se=this.circles;for(const ue of te)if(!G.circle[ue]){G.circle[ue]=!0;const ae=3*ue,fe=this.circleKeys[ue];if(this._circlesCollide(se[ae],se[ae+1],se[ae+2],z.x,z.y,z.radius)&&(!R||R(fe))&&!cn(q,fe.overlapMode))return C.push(!0),!0}}}_forEachCell(t,l,p,m,b,C,L,R){const z=this._convertToXCellCoord(t),G=this._convertToYCellCoord(l),q=this._convertToXCellCoord(p),K=this._convertToYCellCoord(m);for(let te=z;te<=q;te++)for(let se=G;se<=K;se++)if(b.call(this,t,l,p,m,this.xCellCount*se+te,C,L,R))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,l,p,m,b,C){const L=m-t,R=b-l,z=p+C;return z*z>L*L+R*R}_circleAndRectCollide(t,l,p,m,b,C,L){const R=(C-m)/2,z=Math.abs(t-(m+R));if(z>R+p)return!1;const G=(L-b)/2,q=Math.abs(l-(b+G));if(q>G+p)return!1;if(z<=R||q<=G)return!0;const K=z-R,te=q-G;return K*K+te*te<=p*p}}function Sn(x,t,l,p,m){const b=f.H();return t?(f.K(b,b,[1/m,1/m,1]),l||f.ae(b,b,p.angle)):f.L(b,p.labelPlaneMatrix,x),b}function Dr(x,t,l,p,m){if(t){const b=f.af(x);return f.K(b,b,[m,m,1]),l||f.ae(b,b,-p.angle),b}return p.glCoordMatrix}function ce(x,t,l){let p;l?(p=[x.x,x.y,l(x.x,x.y),1],f.ag(p,p,t)):(p=[x.x,x.y,0,1],function(b,C,L){const R=C[0],z=C[1];b[0]=L[0]*R+L[4]*z+L[12],b[1]=L[1]*R+L[5]*z+L[13],b[3]=L[3]*R+L[7]*z+L[15]}(p,p,t));const m=p[3];return{point:new f.P(p[0]/m,p[1]/m),signedDistanceFromCamera:m,isOccluded:!1}}function H(x,t){return .5+x/t*.5}function X(x,t){return x.x>=-t[0]&&x.x<=t[0]&&x.y>=-t[1]&&x.y<=t[1]}function ee(x,t,l,p,m,b,C,L,R,z,G,q,K,te,se){const ue=p?x.textSizeData:x.iconSizeData,ae=f.ah(ue,l.transform.zoom),fe=[256/l.width*2+1,256/l.height*2+1],ye=p?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;ye.clear();const oe=x.lineVertexArray,Se=p?x.text.placedSymbolArray:x.icon.placedSymbolArray,Me=l.transform.width/l.transform.height;let Be=!1;for(let Qe=0;QeMath.abs(l.x-t.x)*p?{useVertical:!0}:(x===f.ai.vertical?t.yl.x)?{needsFlipping:!0}:null}function we(x,t,l,p,m,b,C,L,R,z,G){const q=l/24,K=t.lineOffsetX*q,te=t.lineOffsetY*q;let se;if(t.numGlyphs>1){const ue=t.glyphStartIndex+t.numGlyphs,ae=t.lineStartIndex,fe=t.lineStartIndex+t.lineLength,ye=$(q,L,K,te,p,t,G,x);if(!ye)return{notEnoughRoom:!0};const oe=ce(ye.first.point,C,x.getElevation).point,Se=ce(ye.last.point,C,x.getElevation).point;if(m&&!p){const Me=ge(t.writingMode,oe,Se,z);if(Me)return Me}se=[ye.first];for(let Me=t.glyphStartIndex+1;Me0?oe.point:function(Be,Qe,ot,It,Ct,at){return Le(Be,Qe,ot,1,Ct,at)}(x.tileAnchorPoint,ye,ae,0,b,x),Me=ge(t.writingMode,ae,Se,z);if(Me)return Me}const ue=dt(q*L.getoffsetX(t.glyphStartIndex),K,te,p,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,x,G);if(!ue||x.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};se=[ue]}for(const ue of se)f.ak(R,ue.point,ue.angle);return{}}function Le(x,t,l,p,m,b){const C=x.add(x.sub(t)._unit()),L=m!==void 0?ce(C,m,b.getElevation).point:Ve(C.x,C.y,b).point,R=l.sub(L);return l.add(R._mult(p/R.mag()))}function pe(x,t,l){const p=t.projectionCache;if(p.projections[x])return p.projections[x];const m=new f.P(t.lineVertexArray.getx(x),t.lineVertexArray.gety(x)),b=Ve(m.x,m.y,t);if(b.signedDistanceFromCamera>0)return p.projections[x]=b.point,p.anyProjectionOccluded=p.anyProjectionOccluded||b.isOccluded,b.point;const C=x-l.direction;return function(L,R,z,G,q){return Le(L,R,z,G,void 0,q)}(l.distanceFromAnchor===0?t.tileAnchorPoint:new f.P(t.lineVertexArray.getx(C),t.lineVertexArray.gety(C)),m,l.previousVertex,l.absOffsetX-l.distanceFromAnchor+1,t)}function Ve(x,t,l){const p=x+l.translation[0],m=t+l.translation[1];let b;return!l.pitchWithMap&&l.projection.useSpecialProjectionForSymbols?(b=l.projection.projectTileCoordinates(p,m,l.unwrappedTileID,l.getElevation),b.point.x=(.5*b.point.x+.5)*l.width,b.point.y=(.5*-b.point.y+.5)*l.height):(b=ce(new f.P(p,m),l.labelPlaneMatrix,l.getElevation),b.isOccluded=!1),b}function $e(x,t,l){return x._unit()._perp()._mult(t*l)}function Fe(x,t,l,p,m,b,C,L,R){if(L.projectionCache.offsets[x])return L.projectionCache.offsets[x];const z=l.add(t);if(x+R.direction=m)return L.projectionCache.offsets[x]=z,z;const G=pe(x+R.direction,L,R),q=$e(G.sub(l),C,R.direction),K=l.add(q),te=G.add(q);return L.projectionCache.offsets[x]=f.al(b,z,K,te)||z,L.projectionCache.offsets[x]}function dt(x,t,l,p,m,b,C,L,R){const z=p?x-t:x+t;let G=z>0?1:-1,q=0;p&&(G*=-1,q=Math.PI),G<0&&(q+=Math.PI);let K,te=G>0?b+m:b+m+1;L.projectionCache.cachedAnchorPoint?K=L.projectionCache.cachedAnchorPoint:(K=Ve(L.tileAnchorPoint.x,L.tileAnchorPoint.y,L).point,L.projectionCache.cachedAnchorPoint=K);let se,ue,ae=K,fe=K,ye=0,oe=0;const Se=Math.abs(z),Me=[];let Be;for(;ye+oe<=Se;){if(te+=G,te=C)return null;ye+=oe,fe=ae,ue=se;const It={absOffsetX:Se,direction:G,distanceFromAnchor:ye,previousVertex:fe};if(ae=pe(te,L,It),l===0)Me.push(fe),Be=ae.sub(fe);else{let Ct;const at=ae.sub(fe);Ct=at.mag()===0?$e(pe(te+G,L,It).sub(ae),l,G):$e(at,l,G),ue||(ue=fe.add(Ct)),se=Fe(te,Ct,ae,b,C,ue,l,L,It),Me.push(ue),Be=se.sub(ue)}oe=Be.mag()}const Qe=Be._mult((Se-ye)/oe)._add(ue||fe),ot=q+Math.atan2(ae.y-fe.y,ae.x-fe.x);return Me.push(Qe),{point:Qe,angle:R?ot:0,path:Me}}const Bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Jt(x,t){for(let l=0;l=1;gi--)bt.push(ai.path[gi]);for(let gi=1;gixi.signedDistanceFromCamera<=0)?[]:gi.map(xi=>xi.point)}let $i=[];if(bt.length>0){const gi=bt[0].clone(),xi=bt[0].clone();for(let en=1;en=at.x&&xi.x<=ft.x&&gi.y>=at.y&&xi.y<=ft.y?[bt]:xi.xft.x||xi.yft.y?[]:f.am([bt],at.x,at.y,ft.x,ft.y)}for(const gi of $i){Nt.reset(gi,.25*Ct);let xi=0;xi=Nt.length<=.5*Ct?1:Math.ceil(Nt.paddedLength/ri)+1;for(let en=0;ence(m,p,l.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const l=[];let p=1/0,m=1/0,b=-1/0,C=-1/0;for(const G of t){const q=new f.P(G.x+ui,G.y+ui);p=Math.min(p,q.x),m=Math.min(m,q.y),b=Math.max(b,q.x),C=Math.max(C,q.y),l.push(q)}const L=this.grid.query(p,m,b,C).concat(this.ignoredGrid.query(p,m,b,C)),R={},z={};for(const G of L){const q=G.key;if(R[q.bucketInstanceId]===void 0&&(R[q.bucketInstanceId]={}),R[q.bucketInstanceId][q.featureIndex])continue;const K=[new f.P(G.x1,G.y1),new f.P(G.x2,G.y1),new f.P(G.x2,G.y2),new f.P(G.x1,G.y2)];f.an(l,K)&&(R[q.bucketInstanceId][q.featureIndex]=!0,z[q.bucketInstanceId]===void 0&&(z[q.bucketInstanceId]=[]),z[q.bucketInstanceId].push(q.featureIndex))}return z}insertCollisionBox(t,l,p,m,b,C){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:b,collisionGroupID:C,overlapMode:l},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,l,p,m,b,C){const L=p?this.ignoredGrid:this.grid,R={bucketInstanceId:m,featureIndex:b,collisionGroupID:C,overlapMode:l};for(let z=0;z=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(t,l,p,m){return p>=0&&t=0&&lthis.projectAndGetPerspectiveRatio(p,at.x,at.y,m,z));It=Ct.some(at=>!at.isOccluded),ot=Ct.map(at=>at.point)}else It=!0;return{box:f.ap(ot),allPointsOccluded:!It}}}function Ht(x,t,l){return t*(f.X/(x.tileSize*Math.pow(2,l-x.tileID.overscaledZ)))}class Ai{constructor(t,l,p,m){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?l:-l))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class zi{constructor(t,l,p,m,b){this.text=new Ai(t?t.text:null,l,p,b),this.icon=new Ai(t?t.icon:null,l,m,b)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ji{constructor(t,l,p){this.text=t,this.icon=l,this.skipFade=p}}class fi{constructor(){this.invProjMatrix=f.H(),this.viewportMatrix=f.H(),this.circles=[]}}class Ii{constructor(t,l,p,m,b){this.bucketInstanceId=t,this.featureIndex=l,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=b}}class Mi{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const l=++this.maxGroupID;this.collisionGroups[t]={ID:l,predicate:p=>p.collisionGroupID===l}}return this.collisionGroups[t]}}function sn(x,t,l,p,m){const{horizontalAlign:b,verticalAlign:C}=f.av(x);return new f.P(-(b-.5)*t+p[0]*m,-(C-.5)*l+p[1]*m)}class wi{constructor(t,l,p,m,b,C){this.transform=t.clone(),this.terrain=p,this.collisionIndex=new bi(this.transform,l),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Mi(b),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=C,C&&(C.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const l=this.terrain;return l?(p,m)=>l.getElevation(t,p,m):null}getBucketParts(t,l,p,m){const b=p.getBucket(l),C=p.latestFeatureIndex;if(!b||!C||l.id!==b.layerIds[0])return;const L=p.collisionBoxArray,R=b.layers[0].layout,z=b.layers[0].paint,G=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),q=p.tileSize/f.X,K=p.tileID.toUnwrapped(),te=this.transform.calculatePosMatrix(K),se=R.get("text-pitch-alignment")==="map",ue=R.get("text-rotation-alignment")==="map",ae=Ht(p,1,this.transform.zoom),fe=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),ye=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),oe=Sn(te,se,ue,this.transform,ae);let Se=null;if(se){const Be=Dr(te,se,ue,this.transform,ae);Se=f.L([],this.transform.labelPlaneMatrix,Be)}this.retainedQueryData[b.bucketInstanceId]=new Ii(b.bucketInstanceId,C,b.sourceLayerIndex,b.index,p.tileID);const Me={bucket:b,layout:R,translationText:fe,translationIcon:ye,posMatrix:te,unwrappedTileID:K,textLabelPlaneMatrix:oe,labelToScreenMatrix:Se,scale:G,textPixelRatio:q,holdingForFade:p.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:f.ah(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(m)for(const Be of b.sortKeyRanges){const{sortKey:Qe,symbolInstanceStart:ot,symbolInstanceEnd:It}=Be;t.push({sortKey:Qe,symbolInstanceStart:ot,symbolInstanceEnd:It,parameters:Me})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Me})}attemptAnchorPlacement(t,l,p,m,b,C,L,R,z,G,q,K,te,se,ue,ae,fe,ye,oe){const Se=f.ar[t.textAnchor],Me=[t.textOffset0,t.textOffset1],Be=sn(Se,p,m,Me,b),Qe=this.collisionIndex.placeCollisionBox(l,K,R,z,G,L,C,ae,q.predicate,oe,Be);if((!ye||this.collisionIndex.placeCollisionBox(ye,K,R,z,G,L,C,fe,q.predicate,oe,Be).placeable)&&Qe.placeable){let ot;if(this.prevPlacement&&this.prevPlacement.variableOffsets[te.crossTileID]&&this.prevPlacement.placements[te.crossTileID]&&this.prevPlacement.placements[te.crossTileID].text&&(ot=this.prevPlacement.variableOffsets[te.crossTileID].anchor),te.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[te.crossTileID]={textOffset:Me,width:p,height:m,anchor:Se,textBoxScale:b,prevAnchor:ot},this.markUsedJustification(se,Se,te,ue),se.allowVerticalPlacement&&(this.markUsedOrientation(se,ue,te),this.placedOrientations[te.crossTileID]=ue),{shift:Be,placedGlyphBoxes:Qe}}}placeLayerBucketPart(t,l,p){const{bucket:m,layout:b,translationText:C,translationIcon:L,posMatrix:R,unwrappedTileID:z,textLabelPlaneMatrix:G,labelToScreenMatrix:q,textPixelRatio:K,holdingForFade:te,collisionBoxArray:se,partiallyEvaluatedTextSize:ue,collisionGroup:ae}=t.parameters,fe=b.get("text-optional"),ye=b.get("icon-optional"),oe=f.as(b,"text-overlap","text-allow-overlap"),Se=oe==="always",Me=f.as(b,"icon-overlap","icon-allow-overlap"),Be=Me==="always",Qe=b.get("text-rotation-alignment")==="map",ot=b.get("text-pitch-alignment")==="map",It=b.get("icon-text-fit")!=="none",Ct=b.get("symbol-z-order")==="viewport-y",at=Se&&(Be||!m.hasIconData()||ye),ft=Be&&(Se||!m.hasTextData()||fe);!m.collisionArrays&&se&&m.deserializeCollisionBoxes(se);const Nt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),ai=(yt,bt,ri)=>{var $i,gi;if(l[yt.crossTileID])return;if(te)return void(this.placements[yt.crossTileID]=new ji(!1,!1,!1));let xi=!1,en=!1,Qn=!0,ts=null,tn={box:null,placeable:!1,offscreen:null},Sr={box:null,placeable:!1,offscreen:null},yr=null,$n=null,er=null,is=0,ra=0,Kl=0;bt.textFeatureIndex?is=bt.textFeatureIndex:yt.useRuntimeCollisionCircles&&(is=yt.featureIndex),bt.verticalTextFeatureIndex&&(ra=bt.verticalTextFeatureIndex);const Ra=bt.textBox;if(Ra){const Wn=tr=>{let ir=f.ai.horizontal;if(m.allowVerticalPlacement&&!tr&&this.prevPlacement){const Fn=this.prevPlacement.placedOrientations[yt.crossTileID];Fn&&(this.placedOrientations[yt.crossTileID]=Fn,ir=Fn,this.markUsedOrientation(m,ir,yt))}return ir},ns=(tr,ir)=>{if(m.allowVerticalPlacement&&yt.numVerticalGlyphVertices>0&&bt.verticalTextBox){for(const Fn of m.writingModes)if(Fn===f.ai.vertical?(tn=ir(),Sr=tn):tn=tr(),tn&&tn.placeable)break}else tn=tr()},yo=yt.textAnchorOffsetStartIndex,Da=yt.textAnchorOffsetEndIndex;if(Da===yo){const tr=(ir,Fn)=>{const ln=this.collisionIndex.placeCollisionBox(ir,oe,K,R,z,ot,Qe,C,ae.predicate,Nt);return ln&&ln.placeable&&(this.markUsedOrientation(m,Fn,yt),this.placedOrientations[yt.crossTileID]=Fn),ln};ns(()=>tr(Ra,f.ai.horizontal),()=>{const ir=bt.verticalTextBox;return m.allowVerticalPlacement&&yt.numVerticalGlyphVertices>0&&ir?tr(ir,f.ai.vertical):{box:null,offscreen:null}}),Wn(tn&&tn.placeable)}else{let tr=f.ar[(gi=($i=this.prevPlacement)===null||$i===void 0?void 0:$i.variableOffsets[yt.crossTileID])===null||gi===void 0?void 0:gi.anchor];const ir=(ln,za,uc)=>{const Tn=ln.x2-ln.x1,mh=ln.y2-ln.y1,Ql=yt.textBoxScale,$l=It&&Me==="never"?za:null;let _o=null,gh=oe==="never"?1:2,cc="never";tr&&gh++;for(let hc=0;hcir(Ra,bt.iconBox,f.ai.horizontal),()=>{const ln=bt.verticalTextBox;return m.allowVerticalPlacement&&(!tn||!tn.placeable)&&yt.numVerticalGlyphVertices>0&&ln?ir(ln,bt.verticalIconBox,f.ai.vertical):{box:null,occluded:!0,offscreen:null}}),tn&&(xi=tn.placeable,Qn=tn.offscreen);const Fn=Wn(tn&&tn.placeable);if(!xi&&this.prevPlacement){const ln=this.prevPlacement.variableOffsets[yt.crossTileID];ln&&(this.variableOffsets[yt.crossTileID]=ln,this.markUsedJustification(m,ln.anchor,yt,Fn))}}}if(yr=tn,xi=yr&&yr.placeable,Qn=yr&&yr.offscreen,yt.useRuntimeCollisionCircles){const Wn=m.text.placedSymbolArray.get(yt.centerJustifiedTextSymbolIndex),ns=f.aj(m.textSizeData,ue,Wn),yo=b.get("text-padding");$n=this.collisionIndex.placeCollisionCircles(oe,Wn,m.lineVertexArray,m.glyphOffsetArray,ns,R,z,G,q,p,ot,ae.predicate,yt.collisionCircleDiameter,yo,C,Nt),$n.circles.length&&$n.collisionDetected&&!p&&f.w("Collisions detected, but collision boxes are not shown"),xi=Se||$n.circles.length>0&&!$n.collisionDetected,Qn=Qn&&$n.offscreen}if(bt.iconFeatureIndex&&(Kl=bt.iconFeatureIndex),bt.iconBox){const Wn=ns=>this.collisionIndex.placeCollisionBox(ns,Me,K,R,z,ot,Qe,L,ae.predicate,Nt,It&&ts?ts:void 0);Sr&&Sr.placeable&&bt.verticalIconBox?(er=Wn(bt.verticalIconBox),en=er.placeable):(er=Wn(bt.iconBox),en=er.placeable),Qn=Qn&&er.offscreen}const sa=fe||yt.numHorizontalGlyphVertices===0&&yt.numVerticalGlyphVertices===0,Jl=ye||yt.numIconVertices===0;sa||Jl?Jl?sa||(en=en&&xi):xi=en&&xi:en=xi=en&ξconst lc=en&&er.placeable;if(xi&&yr.placeable&&this.collisionIndex.insertCollisionBox(yr.box,oe,b.get("text-ignore-placement"),m.bucketInstanceId,Sr&&Sr.placeable&&ra?ra:is,ae.ID),lc&&this.collisionIndex.insertCollisionBox(er.box,Me,b.get("icon-ignore-placement"),m.bucketInstanceId,Kl,ae.ID),$n&&xi&&this.collisionIndex.insertCollisionCircles($n.circles,oe,b.get("text-ignore-placement"),m.bucketInstanceId,is,ae.ID),p&&this.storeCollisionData(m.bucketInstanceId,ri,bt,yr,er,$n),yt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[yt.crossTileID]=new ji(xi||at,en||ft,Qn||m.justReloaded),l[yt.crossTileID]=!0};if(Ct){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const yt=m.getSortedSymbolIndexes(this.transform.angle);for(let bt=yt.length-1;bt>=0;--bt){const ri=yt[bt];ai(m.symbolInstances.get(ri),m.collisionArrays[ri],ri)}}else for(let yt=t.symbolInstanceStart;yt=0&&(t.text.placedSymbolArray.get(L).crossTileID=b>=0&&L!==b?0:p.crossTileID)}markUsedOrientation(t,l,p){const m=l===f.ai.horizontal||l===f.ai.horizontalOnly?l:0,b=l===f.ai.vertical?l:0,C=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const L of C)t.text.placedSymbolArray.get(L).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const l=this.prevPlacement;let p=!1;this.prevZoomAdjustment=l?l.zoomAdjustment(this.transform.zoom):0;const m=l?l.symbolFadeChange(t):1,b=l?l.opacities:{},C=l?l.variableOffsets:{},L=l?l.placedOrientations:{};for(const R in this.placements){const z=this.placements[R],G=b[R];G?(this.opacities[R]=new zi(G,m,z.text,z.icon),p=p||z.text!==G.text.placed||z.icon!==G.icon.placed):(this.opacities[R]=new zi(null,m,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const R in b){const z=b[R];if(!this.opacities[R]){const G=new zi(z,m,!1,!1);G.isHidden()||(this.opacities[R]=G,p=p||z.text.placed||z.icon.placed)}}for(const R in C)this.variableOffsets[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.variableOffsets[R]=C[R]);for(const R in L)this.placedOrientations[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.placedOrientations[R]=L[R]);if(l&&l.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=l?l.lastPlacementChangeTime:t)}updateLayerOpacities(t,l){const p={};for(const m of l){const b=m.getBucket(t);b&&m.latestFeatureIndex&&t.id===b.layerIds[0]&&this.updateBucketOpacities(b,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(t,l,p,m){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const b=t.layers[0],C=b.layout,L=new zi(null,0,!1,!1,!0),R=C.get("text-allow-overlap"),z=C.get("icon-allow-overlap"),G=b._unevaluatedLayout.hasValue("text-variable-anchor")||b._unevaluatedLayout.hasValue("text-variable-anchor-offset"),q=C.get("text-rotation-alignment")==="map",K=C.get("text-pitch-alignment")==="map",te=C.get("icon-text-fit")!=="none",se=new zi(null,0,R&&(z||!t.hasIconData()||C.get("icon-optional")),z&&(R||!t.hasTextData()||C.get("text-optional")),!0);!t.collisionArrays&&m&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(m);const ue=(fe,ye,oe)=>{for(let Se=0;Se0,ot=this.placedOrientations[ye.crossTileID],It=ot===f.ai.vertical,Ct=ot===f.ai.horizontal||ot===f.ai.horizontalOnly;if(oe>0||Se>0){const ft=on(Be.text);ue(t.text,oe,It?hn:ft),ue(t.text,Se,Ct?hn:ft);const Nt=Be.text.isHidden();[ye.rightJustifiedTextSymbolIndex,ye.centerJustifiedTextSymbolIndex,ye.leftJustifiedTextSymbolIndex].forEach(bt=>{bt>=0&&(t.text.placedSymbolArray.get(bt).hidden=Nt||It?1:0)}),ye.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(ye.verticalPlacedTextSymbolIndex).hidden=Nt||Ct?1:0);const ai=this.variableOffsets[ye.crossTileID];ai&&this.markUsedJustification(t,ai.anchor,ye,ot);const yt=this.placedOrientations[ye.crossTileID];yt&&(this.markUsedJustification(t,"left",ye,yt),this.markUsedOrientation(t,yt,ye))}if(Qe){const ft=on(Be.icon),Nt=!(te&&ye.verticalPlacedIconSymbolIndex&&It);ye.placedIconSymbolIndex>=0&&(ue(t.icon,ye.numIconVertices,Nt?ft:hn),t.icon.placedSymbolArray.get(ye.placedIconSymbolIndex).hidden=Be.icon.isHidden()),ye.verticalPlacedIconSymbolIndex>=0&&(ue(t.icon,ye.numVerticalIconVertices,Nt?hn:ft),t.icon.placedSymbolArray.get(ye.verticalPlacedIconSymbolIndex).hidden=Be.icon.isHidden())}const at=ae&&ae.has(fe)?ae.get(fe):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ft=t.collisionArrays[fe];if(ft){let Nt=new f.P(0,0);if(ft.textBox||ft.verticalTextBox){let ai=!0;if(G){const yt=this.variableOffsets[Me];yt?(Nt=sn(yt.anchor,yt.width,yt.height,yt.textOffset,yt.textBoxScale),q&&Nt._rotate(K?this.transform.angle:-this.transform.angle)):ai=!1}if(ft.textBox||ft.verticalTextBox){let yt;ft.textBox&&(yt=It),ft.verticalTextBox&&(yt=Ct),Mn(t.textCollisionBox.collisionVertexArray,Be.text.placed,!ai||yt,at.text,Nt.x,Nt.y)}}if(ft.iconBox||ft.verticalIconBox){const ai=!!(!Ct&&ft.verticalIconBox);let yt;ft.iconBox&&(yt=ai),ft.verticalIconBox&&(yt=!ai),Mn(t.iconCollisionBox.collisionVertexArray,Be.icon.placed,yt,at.icon,te?Nt.x:0,te?Nt.y:0)}}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const fe=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=fe.invProjMatrix,t.placementViewportMatrix=fe.viewportMatrix,t.collisionCircleArray=fe.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function Mn(x,t,l,p,m,b){p&&p.length!==0||(p=[0,0,0,0]);const C=p[0]-ui,L=p[1]-ui,R=p[2]-ui,z=p[3]-ui;x.emplaceBack(t?1:0,l?1:0,m||0,b||0,C,L),x.emplaceBack(t?1:0,l?1:0,m||0,b||0,R,L),x.emplaceBack(t?1:0,l?1:0,m||0,b||0,R,z),x.emplaceBack(t?1:0,l?1:0,m||0,b||0,C,z)}const Oo=Math.pow(2,25),ki=Math.pow(2,24),Ns=Math.pow(2,17),Fo=Math.pow(2,16),Gn=Math.pow(2,9),Jn=Math.pow(2,8),Fu=Math.pow(2,1);function on(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;const t=x.placed?1:0,l=Math.floor(127*x.opacity);return l*Oo+t*ki+l*Ns+t*Fo+l*Gn+t*Jn+l*Fu+t}const hn=0;function io(){return{isOccluded:(x,t,l)=>!1,getPitchedTextCorrection:(x,t,l)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(x,t,l,p){throw new Error("Not implemented.")},translatePosition:(x,t,l,p)=>function(m,b,C,L,R=!1){if(!C[0]&&!C[1])return[0,0];const z=R?L==="map"?m.angle:0:L==="viewport"?-m.angle:0;if(z){const G=Math.sin(z),q=Math.cos(z);C=[C[0]*q-C[1]*G,C[0]*G+C[1]*q]}return[R?C[0]:Ht(b,C[0],m.zoom),R?C[1]:Ht(b,C[1],m.zoom)]}(x,t,l,p),getCircleRadiusCorrection:x=>1}}class Vr{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,l,p,m,b){const C=this._bucketParts;for(;this._currentTileIndexL.sortKey-R.sortKey));this._currentPartIndex!this._forceFullPlacement&&N.now()-m>2;for(;this._currentPlacementIndex>=0;){const C=l[t[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 Vr(C)),this._inProgressLayer.continuePlacement(p[C.source],this.placement,this._showCollisionBoxes,C,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Jr=512/f.X/2;class Os{constructor(t,l,p){this.tileID=t,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let b=0;b({x:Math.floor(R.anchorX*Jr),y:Math.floor(R.anchorY*Jr)})),crossTileIDs:C.map(R=>R.crossTileID)};if(L.positions.length>128){const R=new f.aw(L.positions.length,16,Uint16Array);for(const{x:z,y:G}of L.positions)R.add(z,G);R.finish(),delete L.positions,L.index=R}this._symbolsByKey[b]=L}}getScaledCoordinates(t,l){const{x:p,y:m,z:b}=this.tileID.canonical,{x:C,y:L,z:R}=l.canonical,z=Jr/Math.pow(2,R-b),G=(L*f.X+t.anchorY)*z,q=m*f.X*Jr;return{x:Math.floor((C*f.X+t.anchorX)*z-p*f.X*Jr),y:Math.floor(G-q)}}findMatches(t,l,p){const m=this.tileID.canonical.zt)}}class fn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Bo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const l=Math.round((t-this.lng)/360);if(l!==0)for(const p in this.indexes){const m=this.indexes[p],b={};for(const C in m){const L=m[C];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+l),b[L.tileID.key]=L}this.indexes[p]=b}this.lng=t}addBucket(t,l,p){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===l.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let b=0;bt.overscaledZ)for(const L in C){const R=C[L];R.tileID.isChildOf(t)&&R.findMatches(l.symbolInstances,t,m)}else{const L=C[t.scaledTo(Number(b)).key];L&&L.findMatches(l.symbolInstances,t,m)}}for(let b=0;b{l[p]=!0});for(const p in this.layerIndexes)l[p]||delete this.layerIndexes[p]}}const ys=(x,t)=>f.t(x,t&&t.filter(l=>l.identifier!=="source.canvas")),Rn=f.ax();class qr extends f.E{constructor(t,l={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=t,this.dispatcher=new Kt(vi(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new st,this.imageManager.setEventedParent(this),this.glyphManager=new ct(t._requestManager,l.localIdeographFontFamily),this.lineAtlas=new qt(256,512),this.crossTileSymbolIndex=new cr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new f.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",f.az()),ei().on(Ge,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const b=m.getSource();if(b&&b.vectorLayerIds)for(const C in this._layers){const L=this._layers[C];L.source===b.id&&this._validateLayer(L)}})}loadURL(t,l={},p){this.fire(new f.k("dataloading",{dataType:"style"})),l.validate=typeof l.validate!="boolean"||l.validate;const m=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const b=this._loadStyleRequest;f.h(m,this._loadStyleRequest).then(C=>{this._loadStyleRequest=null,this._load(C.data,l,p)}).catch(C=>{this._loadStyleRequest=null,C&&!b.signal.aborted&&this.fire(new f.j(C))})}loadJSON(t,l={},p){this.fire(new f.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,l.validate=l.validate!==!1,this._load(t,l,p)}).catch(()=>{})}loadEmpty(){this.fire(new f.k("dataloading",{dataType:"style"})),this._load(Rn,{validate:!1})}_load(t,l,p){var m;const b=l.transformStyle?l.transformStyle(p,t):t;if(!l.validate||!ys(this,f.x(b))){this._loaded=!0,this.stylesheet=b;for(const C in b.sources)this.addSource(C,b.sources[C],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new nt(this.stylesheet.light),this.sky=new jt(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new f.k("data",{dataType:"style"})),this.fire(new f.k("style.load"))}}_createLayers(){const t=f.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(l=>l.id),this._layers={},this._serializedLayers=null;for(const l of t){const p=f.aB(l);p.setEventedParent(this,{layer:{id:l.id}}),this._layers[l.id]=p}}_loadSprite(t,l=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(b,C,L,R){return f._(this,void 0,void 0,function*(){const z=He(b),G=L>1?"@2x":"",q={},K={};for(const{id:te,url:se}of z){const ue=C.transformRequest(pt(se,G,".json"),"SpriteJSON");q[te]=f.h(ue,R);const ae=C.transformRequest(pt(se,G,".png"),"SpriteImage");K[te]=ke.getImage(ae,R)}return yield Promise.all([...Object.values(q),...Object.values(K)]),function(te,se){return f._(this,void 0,void 0,function*(){const ue={};for(const ae in te){ue[ae]={};const fe=N.getImageCanvasContext((yield se[ae]).data),ye=(yield te[ae]).data;for(const oe in ye){const{width:Se,height:Me,x:Be,y:Qe,sdf:ot,pixelRatio:It,stretchX:Ct,stretchY:at,content:ft,textFitWidth:Nt,textFitHeight:ai}=ye[oe];ue[ae][oe]={data:null,pixelRatio:It,sdf:ot,stretchX:Ct,stretchY:at,content:ft,textFitWidth:Nt,textFitHeight:ai,spriteData:{width:Se,height:Me,x:Be,y:Qe,context:fe}}}}return ue})}(q,K)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(b=>{if(this._spriteRequest=null,b)for(const C in b){this._spritesImagesIds[C]=[];const L=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(R=>!(R in b)):[];for(const R of L)this.imageManager.removeImage(R),this._changedImages[R]=!0;for(const R in b[C]){const z=C==="default"?R:`${C}:${R}`;this._spritesImagesIds[C].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,b[C][R],!1):this.imageManager.addImage(z,b[C][R]),l&&(this._changedImages[z]=!0)}}}).catch(b=>{this._spriteRequest=null,m=b,this.fire(new f.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),l&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"}))}_validateLayer(t){const l=this.sourceCaches[t.source];if(!l)return;const p=t.sourceLayer;if(!p)return;const m=l.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new f.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const l=this._serializedAllLayers();if(!t||t.length===0)return Object.values(l);const p=[];for(const m of t)l[m]&&p.push(l[m]);return p}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const l=Object.keys(this._layers);for(const p of l){const m=this._layers[p];m.type!=="custom"&&(t[p]=m.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const l=this._changed;if(l){const m=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(m.length||b.length)&&this._updateWorkerLayers(m,b);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(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const b=this.sourceCaches[m];p[m]=b.used,b.used=!1}for(const m of this._order){const b=this._layers[m];b.recalculate(t,this._availableImages),!b.isHidden(t.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const m in p){const b=this.sourceCaches[m];!!p[m]!=!!b.used&&b.fire(new f.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,l&&this.fire(new f.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const l in this.sourceCaches)this.sourceCaches[l].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,l){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:l})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,l={}){var p;this._checkLoaded();const m=this.serialize();if(t=l.transformStyle?l.transformStyle(m,t):t,((p=l.validate)===null||p===void 0||p)&&ys(this,f.x(t)))return!1;(t=f.aC(t)).layers=f.aA(t.layers);const b=f.aD(m,t),C=this._getOperationsToPerform(b);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=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const l=[],p=[];for(const m of t)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":l.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":l.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":l.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":l.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":l.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":l.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":l.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":l.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":l.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":l.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":l.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":l.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":l.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":l.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":l.push(()=>{});break;default:p.push(m.command)}return{operations:l,unimplemented:p}}addImage(t,l){if(this.getImage(t))return this.fire(new f.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,l),this._afterImageUpdated(t)}updateImage(t,l){this.imageManager.updateImage(t,l)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new f.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,l,p={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!l.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(l).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(l.type)>=0&&this._validate(f.x.source,`sources.${t}`,l,null,p))return;this.map&&this.map._collectResourceTiming&&(l.collectResourceTiming=!0);const m=this.sourceCaches[t]=new rt(t,l,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:t})),m.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new f.j(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));const l=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],l.fire(new f.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),l.setEventedParent(null),l.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,l){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const p=this.sourceCaches[t].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(l),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,l,p={}){this._checkLoaded();const m=t.id;if(this.getLayer(m))return void this.fire(new f.j(new Error(`Layer "${m}" already exists on this map.`)));let b;if(t.type==="custom"){if(ys(this,f.aE(t)))return;b=f.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(m,t.source),t=f.aC(t),t=f.e(t,{source:m})),this._validate(f.x.layer,`layers.${m}`,t,{arrayIndex:-1},p))return;b=f.aB(t),this._validateLayer(b),b.setEventedParent(this,{layer:{id:m}})}const C=l?this._order.indexOf(l):this._order.length;if(l&&C===-1)this.fire(new f.j(new Error(`Cannot add layer "${m}" before non-existing layer "${l}".`)));else{if(this._order.splice(C,0,m),this._layerOrderChanged=!0,this._layers[m]=b,this._removedLayers[m]&&b.source&&b.type!=="custom"){const L=this._removedLayers[m];delete this._removedLayers[m],L.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(t,l){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new f.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===l)return;const p=this._order.indexOf(t);this._order.splice(p,1);const m=l?this._order.indexOf(l):this._order.length;l&&m===-1?this.fire(new f.j(new Error(`Cannot move layer "${t}" before non-existing layer "${l}".`))):(this._order.splice(m,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const l=this._layers[t];if(!l)return void this.fire(new f.j(new Error(`Cannot remove non-existing layer "${t}".`)));l.setEventedParent(null);const p=this._order.indexOf(t);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=l,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],l.onRemove&&l.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,l,p){this._checkLoaded();const m=this.getLayer(t);m?m.minzoom===l&&m.maxzoom===p||(l!=null&&(m.minzoom=l),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new f.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,l,p={}){this._checkLoaded();const m=this.getLayer(t);if(m){if(!f.aF(m.filter,l))return l==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(f.x.filter,`layers.${m.id}.filter`,l,null,p)||(m.filter=f.aC(l),this._updateLayer(m)))}else this.fire(new f.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return f.aC(this.getLayer(t).filter)}setLayoutProperty(t,l,p,m={}){this._checkLoaded();const b=this.getLayer(t);b?f.aF(b.getLayoutProperty(l),p)||(b.setLayoutProperty(l,p,m),this._updateLayer(b)):this.fire(new f.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,l){const p=this.getLayer(t);if(p)return p.getLayoutProperty(l);this.fire(new f.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,l,p,m={}){this._checkLoaded();const b=this.getLayer(t);b?f.aF(b.getPaintProperty(l),p)||(b.setPaintProperty(l,p,m)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new f.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,l){return this.getLayer(t).getPaintProperty(l)}setFeatureState(t,l){this._checkLoaded();const p=t.source,m=t.sourceLayer,b=this.sourceCaches[p];if(b===void 0)return void this.fire(new f.j(new Error(`The source '${p}' does not exist in the map's style.`)));const C=b.getSource().type;C==="geojson"&&m?this.fire(new f.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||m?(t.id===void 0&&this.fire(new f.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(m,t.id,l)):this.fire(new f.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,l){this._checkLoaded();const p=t.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new f.j(new Error(`The source '${p}' does not exist in the map's style.`)));const b=m.getSource().type,C=b==="vector"?t.sourceLayer:void 0;b!=="vector"||C?l&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new f.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(C,t.id,l):this.fire(new f.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const l=t.source,p=t.sourceLayer,m=this.sourceCaches[l];if(m!==void 0)return m.getSource().type!=="vector"||p?(t.id===void 0&&this.fire(new f.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,t.id)):void this.fire(new f.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new f.j(new Error(`The source '${l}' does not exist in the map's style.`)))}getTransition(){return f.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=f.aG(this.sourceCaches,b=>b.serialize()),l=this._serializeByIds(this._order),p=this.map.getTerrain()||void 0,m=this.stylesheet;return f.aH({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:t,layers:l,terrain:p},b=>b!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const l=C=>this._layers[C].type==="fill-extrusion",p={},m=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(l(L)){p[L]=C;for(const R of t){const z=R[L];if(z)for(const G of z)m.push(G)}}}m.sort((C,L)=>L.intersectionZ-C.intersectionZ);const b=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(l(L))for(let R=m.length-1;R>=0;R--){const z=m[R].feature;if(p[z.layer.id]{const ot=fe.featureSortOrder;if(ot){const It=ot.indexOf(Be.featureIndex);return ot.indexOf(Qe.featureIndex)-It}return Qe.featureIndex-Be.featureIndex});for(const Be of Me)Se.push(Be)}}for(const fe in se)se[fe].forEach(ye=>{const oe=ye.feature,Se=z[L[fe].source].getFeatureState(oe.layer["source-layer"],oe.id);oe.source=oe.layer.source,oe.layer["source-layer"]&&(oe.sourceLayer=oe.layer["source-layer"]),oe.state=Se});return se}(this._layers,C,this.sourceCaches,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(t,l){l&&l.filter&&this._validate(f.x.filter,"querySourceFeatures.filter",l.filter,null,l);const p=this.sourceCaches[t];return p?function(m,b){const C=m.getRenderableIds().map(z=>m.getTileByID(z)),L=[],R={};for(let z=0;zK.getTileByID(te)).sort((te,se)=>se.tileID.overscaledZ-te.tileID.overscaledZ||(te.tileID.isLessThan(se.tileID)?-1:1))}const q=this.crossTileSymbolIndex.addLayer(G,R[G.source],t.center.lng);C=C||q}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(N.now(),t.zoom))&&(this.pauseablePlacement=new an(t,this.map.terrain,this._order,b,l,p,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,R),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(N.now()),L=!0),C&&this.pauseablePlacement.placement.setStale()),L||C)for(const z of this._order){const G=this._layers[z];G.type==="symbol"&&this.placement.updateLayerOpacities(G,R[G.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(N.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,l){return f._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(l.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[l.source];return m&&m.setDependencies(l.tileID.key,l.type,l.icons),p})}getGlyphs(t,l){return f._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(l.stacks),m=this.sourceCaches[l.source];return m&&m.setDependencies(l.tileID.key,l.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,l={}){this._checkLoaded(),t&&this._validate(f.x.glyphs,"glyphs",t,null,l)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,l,p={},m){this._checkLoaded();const b=[{id:t,url:l}],C=[...He(this.stylesheet.sprite),...b];this._validate(f.x.sprite,"sprite",C,null,p)||(this.stylesheet.sprite=C,this._loadSprite(b,!0,m))}removeSprite(t){this._checkLoaded();const l=He(this.stylesheet.sprite);if(l.find(p=>p.id===t)){if(this._spritesImagesIds[t])for(const p of this._spritesImagesIds[t])this.imageManager.removeImage(p),this._changedImages[p]=!0;l.splice(l.findIndex(p=>p.id===t),1),this.stylesheet.sprite=l.length>0?l:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"}))}else this.fire(new f.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return He(this.stylesheet.sprite)}setSprite(t,l={},p){this._checkLoaded(),t&&this._validate(f.x.sprite,"sprite",t,null,l)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,p):(this._unloadSprite(),p&&p(null)))}}var no=f.Y([{name:"a_pos",type:"Int16",components:2}]);const hr={prelude:Si(`#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:Si(`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:Si(`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:Si(`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:Si("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:Si(`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:Si(`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:Si("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_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Si("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:Si("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:Si(`#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:Si(`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:Si(`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:Si(`#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:Si(`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:Si(`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:Si(`#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:Si(`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:Si(`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:Si(`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:Si(`#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:Si(`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:Si(`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:Si(`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 -}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} -#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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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:Si(`#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 -}`,`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 bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} -#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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Si(`#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 -}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} -#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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Si("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Si("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);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Si("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);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:Si("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Si(x,t){const l=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,p=t.match(/attribute ([\w]+) ([\w]+)/g),m=x.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=b?b.concat(m):m,L={};return{fragmentSource:x=x.replace(l,(R,z,G,q,K)=>(L[K]=!0,z==="define"?` -#ifndef HAS_UNIFORM_u_${K} -varying ${G} ${q} ${K}; -#else -uniform ${G} ${q} u_${K}; -#endif -`:` -#ifdef HAS_UNIFORM_u_${K} - ${G} ${q} ${K} = u_${K}; -#endif -`)),vertexSource:t=t.replace(l,(R,z,G,q,K)=>{const te=q==="float"?"vec2":"vec4",se=K.match(/color/)?"color":te;return L[K]?z==="define"?` -#ifndef HAS_UNIFORM_u_${K} -uniform lowp float u_${K}_t; -attribute ${G} ${te} a_${K}; -varying ${G} ${q} ${K}; -#else -uniform ${G} ${q} u_${K}; -#endif -`:se==="vec4"?` -#ifndef HAS_UNIFORM_u_${K} - ${K} = a_${K}; -#else - ${G} ${q} ${K} = u_${K}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${K} - ${K} = unpack_mix_${se}(a_${K}, u_${K}_t); -#else - ${G} ${q} ${K} = u_${K}; -#endif -`:z==="define"?` -#ifndef HAS_UNIFORM_u_${K} -uniform lowp float u_${K}_t; -attribute ${G} ${te} a_${K}; -#else -uniform ${G} ${q} u_${K}; -#endif -`:se==="vec4"?` -#ifndef HAS_UNIFORM_u_${K} - ${G} ${q} ${K} = a_${K}; -#else - ${G} ${q} ${K} = u_${K}; -#endif -`:` -#ifndef HAS_UNIFORM_u_${K} - ${G} ${q} ${K} = unpack_mix_${se}(a_${K}, u_${K}_t); -#else - ${G} ${q} ${K} = u_${K}; -#endif -`}),staticAttributes:p,staticUniforms:C}}class ga{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,l,p,m,b,C,L,R,z){this.context=t;let G=this.boundPaintVertexBuffers.length!==m.length;for(let q=0;!G&&q({u_matrix:x,u_texture:0,u_ele_delta:t,u_fog_matrix:l,u_fog_color:p?p.properties.get("fog-color"):f.aN.white,u_fog_ground_blend:p?p.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?p.calculateFogBlendOpacity(m):0,u_horizon_color:p?p.properties.get("horizon-color"):f.aN.white,u_horizon_fog_blend:p?p.properties.get("horizon-fog-blend"):1});function jo(x){const t=[];for(let l=0;l({u_depth:new f.aI(Be,Qe.u_depth),u_terrain:new f.aI(Be,Qe.u_terrain),u_terrain_dim:new f.aJ(Be,Qe.u_terrain_dim),u_terrain_matrix:new f.aK(Be,Qe.u_terrain_matrix),u_terrain_unpack:new f.aL(Be,Qe.u_terrain_unpack),u_terrain_exaggeration:new f.aJ(Be,Qe.u_terrain_exaggeration)}))(t,Me),this.binderUniforms=p?p.getUniforms(t,Me):[]}draw(t,l,p,m,b,C,L,R,z,G,q,K,te,se,ue,ae,fe,ye){const oe=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(p),t.setStencilMode(m),t.setColorMode(b),t.setCullFace(C),R){t.activeTexture.set(oe.TEXTURE2),oe.bindTexture(oe.TEXTURE_2D,R.depthTexture),t.activeTexture.set(oe.TEXTURE3),oe.bindTexture(oe.TEXTURE_2D,R.texture);for(const Me in this.terrainUniforms)this.terrainUniforms[Me].set(R[Me])}for(const Me in this.fixedUniforms)this.fixedUniforms[Me].set(L[Me]);ue&&ue.setUniforms(t,this.binderUniforms,te,{zoom:se});let Se=0;switch(l){case oe.LINES:Se=2;break;case oe.TRIANGLES:Se=3;break;case oe.LINE_STRIP:Se=1}for(const Me of K.get()){const Be=Me.vaos||(Me.vaos={});(Be[z]||(Be[z]=new ga)).bind(t,this,G,ue?ue.getPaintVertexBuffers():[],q,Me.vertexOffset,ae,fe,ye),oe.drawElements(l,Me.primitiveLength*Se,oe.UNSIGNED_SHORT,Me.primitiveOffset*Se*2)}}}function _s(x,t,l){const p=1/Ht(l,1,t.transform.tileZoom),m=Math.pow(2,l.tileID.overscaledZ),b=l.tileSize*Math.pow(2,t.transform.tileZoom)/m,C=b*(l.tileID.canonical.x+l.tileID.wrap*m),L=b*l.tileID.canonical.y;return{u_image:0,u_texsize:l.imageAtlasTexture.size,u_scale:[p,x.fromScale,x.toScale],u_fade:x.t,u_pixel_coord_upper:[C>>16,L>>16],u_pixel_coord_lower:[65535&C,65535&L]}}const Vo=(x,t,l,p)=>{const m=t.style.light,b=m.properties.get("position"),C=[b.x,b.y,b.z],L=function(){var z=new f.A(9);return f.A!=Float32Array&&(z[1]=0,z[2]=0,z[3]=0,z[5]=0,z[6]=0,z[7]=0),z[0]=1,z[4]=1,z[8]=1,z}();m.properties.get("anchor")==="viewport"&&function(z,G){var q=Math.sin(G),K=Math.cos(G);z[0]=K,z[1]=q,z[2]=0,z[3]=-q,z[4]=K,z[5]=0,z[6]=0,z[7]=0,z[8]=1}(L,-t.transform.angle),function(z,G,q){var K=G[0],te=G[1],se=G[2];z[0]=K*q[0]+te*q[3]+se*q[6],z[1]=K*q[1]+te*q[4]+se*q[7],z[2]=K*q[2]+te*q[5]+se*q[8]}(C,C,L);const R=m.properties.get("color");return{u_matrix:x,u_lightpos:C,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[R.r,R.g,R.b],u_vertical_gradient:+l,u_opacity:p}},ya=(x,t,l,p,m,b,C)=>f.e(Vo(x,t,l,p),_s(b,t,C),{u_height_factor:-Math.pow(2,m.overscaledZ)/C.tileSize/8}),ro=x=>({u_matrix:x}),so=(x,t,l,p)=>f.e(ro(x),_s(l,t,p)),il=(x,t)=>({u_matrix:x,u_world:t}),Ji=(x,t,l,p,m)=>f.e(so(x,t,l,p),{u_world:m}),vs=(x,t,l,p)=>{const m=x.transform;let b,C;if(p.paint.get("circle-pitch-alignment")==="map"){const L=Ht(l,1,m.zoom);b=!0,C=[L,L]}else b=!1,C=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:x.translatePosMatrix(t.posMatrix,l,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:x.pixelRatio,u_extrude_scale:C}},Bu=(x,t,l)=>({u_matrix:x,u_inv_matrix:t,u_camera_to_center_distance:l.cameraToCenterDistance,u_viewport_size:[l.width,l.height]}),Gr=(x,t,l=1)=>({u_matrix:x,u_color:t,u_overlay:0,u_overlay_scale:l}),Dn=x=>({u_matrix:x}),Qi=(x,t,l,p)=>({u_matrix:x,u_extrude_scale:Ht(t,1,l),u_intensity:p});function zn(x,t){const l=Math.pow(2,t.canonical.z),p=t.canonical.y;return[new f.Z(0,p/l).toLngLat().lat,new f.Z(0,(p+1)/l).toLngLat().lat]}const qo=(x,t,l,p)=>{const m=x.transform;return{u_matrix:rl(x,t,l,p),u_ratio:1/Ht(t,1,m.zoom),u_device_pixel_ratio:x.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},_a=(x,t,l,p,m)=>f.e(qo(x,t,l,m),{u_image:0,u_image_height:p}),nl=(x,t,l,p,m)=>{const b=x.transform,C=Fs(t,b);return{u_matrix:rl(x,t,l,m),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Ht(t,1,b.zoom),u_device_pixel_ratio:x.pixelRatio,u_image:0,u_scale:[C,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Go=(x,t,l,p,m,b)=>{const C=x.lineAtlas,L=Fs(t,x.transform),R=l.layout.get("line-cap")==="round",z=C.getDash(p.from,R),G=C.getDash(p.to,R),q=z.width*m.fromScale,K=G.width*m.toScale;return f.e(qo(x,t,l,b),{u_patternscale_a:[L/q,-z.height/2],u_patternscale_b:[L/K,-G.height/2],u_sdfgamma:C.width/(256*Math.min(q,K)*x.pixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:G.y,u_mix:m.t})};function Fs(x,t){return 1/Ht(x,1,t.tileZoom)}function rl(x,t,l,p){return x.translatePosMatrix(p?p.posMatrix:t.tileID.posMatrix,t,l.paint.get("line-translate"),l.paint.get("line-translate-anchor"))}const Ti=(x,t,l,p,m)=>{return{u_matrix:x,u_tl_parent:t,u_scale_parent:l,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(C=m.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(b=m.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:Zr(m.paint.get("raster-hue-rotate"))};var b,C};function Zr(x){x*=Math.PI/180;const t=Math.sin(x),l=Math.cos(x);return[(2*l+1)/3,(-Math.sqrt(3)*t-l+1)/3,(Math.sqrt(3)*t-l+1)/3]}const va=(x,t,l,p,m,b,C,L,R,z,G,q,K,te)=>{const se=C.transform;return{u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:se.cameraToCenterDistance,u_pitch:se.pitch/360*2*Math.PI,u_rotate_symbol:+l,u_aspect_ratio:se.width/se.height,u_fade_change:C.options.fadeDuration?C.symbolFadeChange:1,u_matrix:L,u_label_plane_matrix:R,u_coord_matrix:z,u_is_text:+q,u_pitch_with_map:+p,u_is_along_line:m,u_is_variable_anchor:b,u_texsize:K,u_texture:0,u_translation:G,u_pitched_scale:te}},sl=(x,t,l,p,m,b,C,L,R,z,G,q,K,te,se)=>{const ue=C.transform;return f.e(va(x,t,l,p,m,b,C,L,R,z,G,q,K,se),{u_gamma_scale:p?Math.cos(ue._pitch)*ue.cameraToCenterDistance:1,u_device_pixel_ratio:C.pixelRatio,u_is_halo:+te})},Zo=(x,t,l,p,m,b,C,L,R,z,G,q,K,te)=>f.e(sl(x,t,l,p,m,b,C,L,R,z,G,!0,q,!0,te),{u_texsize_icon:K,u_texture_icon:1}),Wo=(x,t,l)=>({u_matrix:x,u_opacity:t,u_color:l}),In=(x,t,l,p,m,b)=>f.e(function(C,L,R,z){const G=R.imageManager.getPattern(C.from.toString()),q=R.imageManager.getPattern(C.to.toString()),{width:K,height:te}=R.imageManager.getPixelSize(),se=Math.pow(2,z.tileID.overscaledZ),ue=z.tileSize*Math.pow(2,R.transform.tileZoom)/se,ae=ue*(z.tileID.canonical.x+z.tileID.wrap*se),fe=ue*z.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:G.tl,u_pattern_br_a:G.br,u_pattern_tl_b:q.tl,u_pattern_br_b:q.br,u_texsize:[K,te],u_mix:L.t,u_pattern_size_a:G.displaySize,u_pattern_size_b:q.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Ht(z,1,R.transform.tileZoom),u_pixel_coord_upper:[ae>>16,fe>>16],u_pixel_coord_lower:[65535&ae,65535&fe]}}(p,b,l,m),{u_matrix:x,u_opacity:t}),Xo={fillExtrusion:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_lightpos:new f.aO(x,t.u_lightpos),u_lightintensity:new f.aJ(x,t.u_lightintensity),u_lightcolor:new f.aO(x,t.u_lightcolor),u_vertical_gradient:new f.aJ(x,t.u_vertical_gradient),u_opacity:new f.aJ(x,t.u_opacity)}),fillExtrusionPattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_lightpos:new f.aO(x,t.u_lightpos),u_lightintensity:new f.aJ(x,t.u_lightintensity),u_lightcolor:new f.aO(x,t.u_lightcolor),u_vertical_gradient:new f.aJ(x,t.u_vertical_gradient),u_height_factor:new f.aJ(x,t.u_height_factor),u_image:new f.aI(x,t.u_image),u_texsize:new f.aP(x,t.u_texsize),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade),u_opacity:new f.aJ(x,t.u_opacity)}),fill:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix)}),fillPattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_image:new f.aI(x,t.u_image),u_texsize:new f.aP(x,t.u_texsize),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade)}),fillOutline:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_world:new f.aP(x,t.u_world)}),fillOutlinePattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_world:new f.aP(x,t.u_world),u_image:new f.aI(x,t.u_image),u_texsize:new f.aP(x,t.u_texsize),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade)}),circle:(x,t)=>({u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_scale_with_map:new f.aI(x,t.u_scale_with_map),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_extrude_scale:new f.aP(x,t.u_extrude_scale),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_matrix:new f.aK(x,t.u_matrix)}),collisionBox:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_pixel_extrude_scale:new f.aP(x,t.u_pixel_extrude_scale)}),collisionCircle:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_inv_matrix:new f.aK(x,t.u_inv_matrix),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_viewport_size:new f.aP(x,t.u_viewport_size)}),debug:(x,t)=>({u_color:new f.aM(x,t.u_color),u_matrix:new f.aK(x,t.u_matrix),u_overlay:new f.aI(x,t.u_overlay),u_overlay_scale:new f.aJ(x,t.u_overlay_scale)}),clippingMask:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix)}),heatmap:(x,t)=>({u_extrude_scale:new f.aJ(x,t.u_extrude_scale),u_intensity:new f.aJ(x,t.u_intensity),u_matrix:new f.aK(x,t.u_matrix)}),heatmapTexture:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_world:new f.aP(x,t.u_world),u_image:new f.aI(x,t.u_image),u_color_ramp:new f.aI(x,t.u_color_ramp),u_opacity:new f.aJ(x,t.u_opacity)}),hillshade:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_image:new f.aI(x,t.u_image),u_latrange:new f.aP(x,t.u_latrange),u_light:new f.aP(x,t.u_light),u_shadow:new f.aM(x,t.u_shadow),u_highlight:new f.aM(x,t.u_highlight),u_accent:new f.aM(x,t.u_accent)}),hillshadePrepare:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_image:new f.aI(x,t.u_image),u_dimension:new f.aP(x,t.u_dimension),u_zoom:new f.aJ(x,t.u_zoom),u_unpack:new f.aL(x,t.u_unpack)}),line:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels)}),lineGradient:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels),u_image:new f.aI(x,t.u_image),u_image_height:new f.aJ(x,t.u_image_height)}),linePattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_texsize:new f.aP(x,t.u_texsize),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_image:new f.aI(x,t.u_image),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade)}),lineSDF:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels),u_patternscale_a:new f.aP(x,t.u_patternscale_a),u_patternscale_b:new f.aP(x,t.u_patternscale_b),u_sdfgamma:new f.aJ(x,t.u_sdfgamma),u_image:new f.aI(x,t.u_image),u_tex_y_a:new f.aJ(x,t.u_tex_y_a),u_tex_y_b:new f.aJ(x,t.u_tex_y_b),u_mix:new f.aJ(x,t.u_mix)}),raster:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_tl_parent:new f.aP(x,t.u_tl_parent),u_scale_parent:new f.aJ(x,t.u_scale_parent),u_buffer_scale:new f.aJ(x,t.u_buffer_scale),u_fade_t:new f.aJ(x,t.u_fade_t),u_opacity:new f.aJ(x,t.u_opacity),u_image0:new f.aI(x,t.u_image0),u_image1:new f.aI(x,t.u_image1),u_brightness_low:new f.aJ(x,t.u_brightness_low),u_brightness_high:new f.aJ(x,t.u_brightness_high),u_saturation_factor:new f.aJ(x,t.u_saturation_factor),u_contrast_factor:new f.aJ(x,t.u_contrast_factor),u_spin_weights:new f.aO(x,t.u_spin_weights)}),symbolIcon:(x,t)=>({u_is_size_zoom_constant:new f.aI(x,t.u_is_size_zoom_constant),u_is_size_feature_constant:new f.aI(x,t.u_is_size_feature_constant),u_size_t:new f.aJ(x,t.u_size_t),u_size:new f.aJ(x,t.u_size),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_pitch:new f.aJ(x,t.u_pitch),u_rotate_symbol:new f.aI(x,t.u_rotate_symbol),u_aspect_ratio:new f.aJ(x,t.u_aspect_ratio),u_fade_change:new f.aJ(x,t.u_fade_change),u_matrix:new f.aK(x,t.u_matrix),u_label_plane_matrix:new f.aK(x,t.u_label_plane_matrix),u_coord_matrix:new f.aK(x,t.u_coord_matrix),u_is_text:new f.aI(x,t.u_is_text),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_is_along_line:new f.aI(x,t.u_is_along_line),u_is_variable_anchor:new f.aI(x,t.u_is_variable_anchor),u_texsize:new f.aP(x,t.u_texsize),u_texture:new f.aI(x,t.u_texture),u_translation:new f.aP(x,t.u_translation),u_pitched_scale:new f.aJ(x,t.u_pitched_scale)}),symbolSDF:(x,t)=>({u_is_size_zoom_constant:new f.aI(x,t.u_is_size_zoom_constant),u_is_size_feature_constant:new f.aI(x,t.u_is_size_feature_constant),u_size_t:new f.aJ(x,t.u_size_t),u_size:new f.aJ(x,t.u_size),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_pitch:new f.aJ(x,t.u_pitch),u_rotate_symbol:new f.aI(x,t.u_rotate_symbol),u_aspect_ratio:new f.aJ(x,t.u_aspect_ratio),u_fade_change:new f.aJ(x,t.u_fade_change),u_matrix:new f.aK(x,t.u_matrix),u_label_plane_matrix:new f.aK(x,t.u_label_plane_matrix),u_coord_matrix:new f.aK(x,t.u_coord_matrix),u_is_text:new f.aI(x,t.u_is_text),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_is_along_line:new f.aI(x,t.u_is_along_line),u_is_variable_anchor:new f.aI(x,t.u_is_variable_anchor),u_texsize:new f.aP(x,t.u_texsize),u_texture:new f.aI(x,t.u_texture),u_gamma_scale:new f.aJ(x,t.u_gamma_scale),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_is_halo:new f.aI(x,t.u_is_halo),u_translation:new f.aP(x,t.u_translation),u_pitched_scale:new f.aJ(x,t.u_pitched_scale)}),symbolTextAndIcon:(x,t)=>({u_is_size_zoom_constant:new f.aI(x,t.u_is_size_zoom_constant),u_is_size_feature_constant:new f.aI(x,t.u_is_size_feature_constant),u_size_t:new f.aJ(x,t.u_size_t),u_size:new f.aJ(x,t.u_size),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_pitch:new f.aJ(x,t.u_pitch),u_rotate_symbol:new f.aI(x,t.u_rotate_symbol),u_aspect_ratio:new f.aJ(x,t.u_aspect_ratio),u_fade_change:new f.aJ(x,t.u_fade_change),u_matrix:new f.aK(x,t.u_matrix),u_label_plane_matrix:new f.aK(x,t.u_label_plane_matrix),u_coord_matrix:new f.aK(x,t.u_coord_matrix),u_is_text:new f.aI(x,t.u_is_text),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_is_along_line:new f.aI(x,t.u_is_along_line),u_is_variable_anchor:new f.aI(x,t.u_is_variable_anchor),u_texsize:new f.aP(x,t.u_texsize),u_texsize_icon:new f.aP(x,t.u_texsize_icon),u_texture:new f.aI(x,t.u_texture),u_texture_icon:new f.aI(x,t.u_texture_icon),u_gamma_scale:new f.aJ(x,t.u_gamma_scale),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_is_halo:new f.aI(x,t.u_is_halo),u_translation:new f.aP(x,t.u_translation),u_pitched_scale:new f.aJ(x,t.u_pitched_scale)}),background:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_opacity:new f.aJ(x,t.u_opacity),u_color:new f.aM(x,t.u_color)}),backgroundPattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_opacity:new f.aJ(x,t.u_opacity),u_image:new f.aI(x,t.u_image),u_pattern_tl_a:new f.aP(x,t.u_pattern_tl_a),u_pattern_br_a:new f.aP(x,t.u_pattern_br_a),u_pattern_tl_b:new f.aP(x,t.u_pattern_tl_b),u_pattern_br_b:new f.aP(x,t.u_pattern_br_b),u_texsize:new f.aP(x,t.u_texsize),u_mix:new f.aJ(x,t.u_mix),u_pattern_size_a:new f.aP(x,t.u_pattern_size_a),u_pattern_size_b:new f.aP(x,t.u_pattern_size_b),u_scale_a:new f.aJ(x,t.u_scale_a),u_scale_b:new f.aJ(x,t.u_scale_b),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_tile_units_to_pixels:new f.aJ(x,t.u_tile_units_to_pixels)}),terrain:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_texture:new f.aI(x,t.u_texture),u_ele_delta:new f.aJ(x,t.u_ele_delta),u_fog_matrix:new f.aK(x,t.u_fog_matrix),u_fog_color:new f.aM(x,t.u_fog_color),u_fog_ground_blend:new f.aJ(x,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new f.aJ(x,t.u_fog_ground_blend_opacity),u_horizon_color:new f.aM(x,t.u_horizon_color),u_horizon_fog_blend:new f.aJ(x,t.u_horizon_fog_blend)}),terrainDepth:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ele_delta:new f.aJ(x,t.u_ele_delta)}),terrainCoords:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_texture:new f.aI(x,t.u_texture),u_terrain_coords_id:new f.aJ(x,t.u_terrain_coords_id),u_ele_delta:new f.aJ(x,t.u_ele_delta)}),sky:(x,t)=>({u_sky_color:new f.aM(x,t.u_sky_color),u_horizon_color:new f.aM(x,t.u_horizon_color),u_horizon:new f.aJ(x,t.u_horizon),u_sky_horizon_blend:new f.aJ(x,t.u_sky_horizon_blend)})};class Ho{constructor(t,l,p){this.context=t;const m=t.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete l.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const l=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),l.bufferSubData(l.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const xa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class zr{constructor(t,l,p,m){this.length=l.length,this.attributes=p,this.itemSize=l.bytesPerElement,this.dynamicDraw=m,this.context=t;const b=t.gl;this.buffer=b.createBuffer(),t.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete l.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const l=this.context.gl;this.bind(),l.bufferSubData(l.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,l){for(let p=0;p0){const Be=f.H();f.aR(Be,oe.placementInvProjMatrix,x.transform.glCoordMatrix),f.aR(Be,Be,oe.placementViewportMatrix),R.push({circleArray:Me,circleOffset:G,transform:ye.posMatrix,invTransform:Be,coord:ye}),z+=Me.length/4,G=z}Se&&L.draw(b,C.LINES,yi.disabled,qi.disabled,x.colorModeForRenderPass(),Ui.disabled,{u_matrix:ye.posMatrix,u_pixel_extrude_scale:[1/(q=x.transform).width,1/q.height]},x.style.map.terrain&&x.style.map.terrain.getTerrainData(ye),l.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,null,x.transform.zoom,null,null,Se.collisionVertexBuffer)}var q;if(!m||!R.length)return;const K=x.useProgram("collisionCircle"),te=new f.aS;te.resize(4*z),te._trim();let se=0;for(const fe of R)for(let ye=0;ye=0&&(fe[oe.associatedIconIndex]={shiftedAnchor:ri,angle:$i})}else Jt(oe.numGlyphs,ue)}if(z){ae.clear();const ye=x.icon.placedSymbolArray;for(let oe=0;oex.style.map.terrain.getElevation(at,uc,Tn):null,za=l.layout.get("text-rotation-alignment")==="map";ee(Nt,at.posMatrix,x,m,ra,Ra,fe,z,za,ue,at.toUnwrapped(),se.width,se.height,sa,ln)}const Wn=at.posMatrix,ns=m&&ot||lc,yo=ye||ns?Sa:ra,Da=Kl,tr=bt&&l.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ir;ir=bt?Nt.iconsInText?Zo(ri.kind,xi,oe,fe,ye,ns,x,Wn,yo,Da,sa,Qn,yr,Ct):sl(ri.kind,xi,oe,fe,ye,ns,x,Wn,yo,Da,sa,m,Qn,!0,Ct):va(ri.kind,xi,oe,fe,ye,ns,x,Wn,yo,Da,sa,m,Qn,Ct);const Fn={program:gi,buffers:ai,uniformValues:ir,atlasTexture:ts,atlasTextureIcon:$n,atlasInterpolation:tn,atlasInterpolationIcon:Sr,isSDF:bt,hasHalo:tr};if(Me&&Nt.canOverlap){Be=!0;const ln=ai.segments.get();for(const za of ln)It.push({segments:new f.a0([za]),sortKey:za.sortKey,state:Fn,terrainData:en})}else It.push({segments:ai.segments,sortKey:0,state:Fn,terrainData:en})}Be&&It.sort((at,ft)=>at.sortKey-ft.sortKey);for(const at of It){const ft=at.state;if(K.activeTexture.set(te.TEXTURE0),ft.atlasTexture.bind(ft.atlasInterpolation,te.CLAMP_TO_EDGE),ft.atlasTextureIcon&&(K.activeTexture.set(te.TEXTURE1),ft.atlasTextureIcon&&ft.atlasTextureIcon.bind(ft.atlasInterpolationIcon,te.CLAMP_TO_EDGE)),ft.isSDF){const Nt=ft.uniformValues;ft.hasHalo&&(Nt.u_is_halo=1,Us(ft.buffers,at.segments,l,x,ft.program,Qe,G,q,Nt,at.terrainData)),Nt.u_is_halo=0}Us(ft.buffers,at.segments,l,x,ft.program,Qe,G,q,ft.uniformValues,at.terrainData)}}function Us(x,t,l,p,m,b,C,L,R,z){const G=p.context;m.draw(G,G.gl.TRIANGLES,b,C,L,Ui.disabled,R,z,l.id,x.layoutVertexBuffer,x.indexBuffer,t,l.paint,p.transform.zoom,x.programConfigurations.get(l.id),x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer)}function pr(x,t,l,p,m){if(!l||!p||!p.imageAtlas)return;const b=p.imageAtlas.patternPositions;let C=b[l.to.toString()],L=b[l.from.toString()];if(!C&&L&&(C=L),!L&&C&&(L=C),!C||!L){const R=m.getPaintProperty(t);C=b[R],L=b[R]}C&&L&&x.setConstantPatternPositions(C,L)}function yl(x,t,l,p,m,b,C){const L=x.context.gl,R="fill-pattern",z=l.paint.get(R),G=z&&z.constantOr(1),q=l.getCrossfadeParameters();let K,te,se,ue,ae;C?(te=G&&!l.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",K=L.LINES):(te=G?"fillPattern":"fill",K=L.TRIANGLES);const fe=z.constantOr(null);for(const ye of p){const oe=t.getTile(ye);if(G&&!oe.patternsLoaded())continue;const Se=oe.getBucket(l);if(!Se)continue;const Me=Se.programConfigurations.get(l.id),Be=x.useProgram(te,Me),Qe=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ye);G&&(x.context.activeTexture.set(L.TEXTURE0),oe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Me.updatePaintBuffers(q)),pr(Me,R,fe,oe,l);const ot=Qe?ye:null,It=x.translatePosMatrix(ot?ot.posMatrix:ye.posMatrix,oe,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor"));if(C){ue=Se.indexBuffer2,ae=Se.segments2;const Ct=[L.drawingBufferWidth,L.drawingBufferHeight];se=te==="fillOutlinePattern"&&G?Ji(It,x,q,oe,Ct):il(It,Ct)}else ue=Se.indexBuffer,ae=Se.segments,se=G?so(It,x,q,oe):ro(It);Be.draw(x.context,K,m,x.stencilModeForClipping(ye),b,Ui.disabled,se,Qe,l.id,Se.layoutVertexBuffer,ue,ae,l.paint,x.transform.zoom,Me)}}function Ta(x,t,l,p,m,b,C){const L=x.context,R=L.gl,z="fill-extrusion-pattern",G=l.paint.get(z),q=G.constantOr(1),K=l.getCrossfadeParameters(),te=l.paint.get("fill-extrusion-opacity"),se=G.constantOr(null);for(const ue of p){const ae=t.getTile(ue),fe=ae.getBucket(l);if(!fe)continue;const ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ue),oe=fe.programConfigurations.get(l.id),Se=x.useProgram(q?"fillExtrusionPattern":"fillExtrusion",oe);q&&(x.context.activeTexture.set(R.TEXTURE0),ae.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),oe.updatePaintBuffers(K)),pr(oe,z,se,ae,l);const Me=x.translatePosMatrix(ue.posMatrix,ae,l.paint.get("fill-extrusion-translate"),l.paint.get("fill-extrusion-translate-anchor")),Be=l.paint.get("fill-extrusion-vertical-gradient"),Qe=q?ya(Me,x,Be,te,ue,K,ae):Vo(Me,x,Be,te);Se.draw(L,L.gl.TRIANGLES,m,b,C,Ui.backCCW,Qe,ye,l.id,fe.layoutVertexBuffer,fe.indexBuffer,fe.segments,l.paint,x.transform.zoom,oe,x.style.map.terrain&&fe.centroidVertexBuffer)}}function Ca(x,t,l,p,m,b,C){const L=x.context,R=L.gl,z=l.fbo;if(!z)return;const G=x.useProgram("hillshade"),q=x.style.map.terrain&&x.style.map.terrain.getTerrainData(t);L.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,z.colorAttachment.get()),G.draw(L,R.TRIANGLES,m,b,C,Ui.disabled,((K,te,se,ue)=>{const ae=se.paint.get("hillshade-shadow-color"),fe=se.paint.get("hillshade-highlight-color"),ye=se.paint.get("hillshade-accent-color");let oe=se.paint.get("hillshade-illumination-direction")*(Math.PI/180);se.paint.get("hillshade-illumination-anchor")==="viewport"&&(oe-=K.transform.angle);const Se=!K.options.moving;return{u_matrix:ue?ue.posMatrix:K.transform.calculatePosMatrix(te.tileID.toUnwrapped(),Se),u_image:0,u_latrange:zn(0,te.tileID),u_light:[se.paint.get("hillshade-exaggeration"),oe],u_shadow:ae,u_highlight:fe,u_accent:ye}})(x,l,p,q?t:null),q,p.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}function ks(x,t,l,p,m,b){const C=x.context,L=C.gl,R=t.dem;if(R&&R.data){const z=R.dim,G=R.stride,q=R.getPixels();if(C.activeTexture.set(L.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||x.getTileTexture(G),t.demTexture){const te=t.demTexture;te.update(q,{premultiply:!1}),te.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else t.demTexture=new Ie(C,q,L.RGBA,{premultiply:!1}),t.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);C.activeTexture.set(L.TEXTURE0);let K=t.fbo;if(!K){const te=new Ie(C,{width:z,height:z,data:null},L.RGBA);te.bind(L.LINEAR,L.CLAMP_TO_EDGE),K=t.fbo=C.createFramebuffer(z,z,!0,!1),K.colorAttachment.set(te.texture)}C.bindFramebuffer.set(K.framebuffer),C.viewport.set([0,0,z,z]),x.useProgram("hillshadePrepare").draw(C,L.TRIANGLES,p,m,b,Ui.disabled,((te,se)=>{const ue=se.stride,ae=f.H();return f.aQ(ae,0,f.X,-f.X,0,0,1),f.J(ae,ae,[0,-f.X,0]),{u_matrix:ae,u_image:1,u_dimension:[ue,ue],u_zoom:te.overscaledZ,u_unpack:se.getUnpackVector()}})(t.tileID,R),null,l.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ea(x,t,l,p,m,b){const C=p.paint.get("raster-fade-duration");if(!b&&C>0){const L=N.now(),R=(L-x.timeAdded)/C,z=t?(L-t.timeAdded)/C:-1,G=l.getSource(),q=m.coveringZoomLevel({tileSize:G.tileSize,roundZoom:G.roundZoom}),K=!t||Math.abs(t.tileID.overscaledZ-q)>Math.abs(x.tileID.overscaledZ-q),te=K&&x.refreshedUponExpiration?1:f.ad(K?R:1-z,0,1);return x.refreshedUponExpiration&&R>=1&&(x.refreshedUponExpiration=!1),t?{opacity:1,mix:1-te}:{opacity:te,mix:0}}return{opacity:1,mix:0}}const Pa=new f.aN(1,0,0,1),co=new f.aN(0,1,0,1),ho=new f.aN(0,0,1,1),Xl=new f.aN(1,0,1,1),Vs=new f.aN(0,1,1,1);function Ss(x,t,l,p){fo(x,0,t+l/2,x.transform.width,l,p)}function _l(x,t,l,p){fo(x,t-l/2,0,l,x.transform.height,p)}function fo(x,t,l,p,m,b){const C=x.context,L=C.gl;L.enable(L.SCISSOR_TEST),L.scissor(t*x.pixelRatio,l*x.pixelRatio,p*x.pixelRatio,m*x.pixelRatio),C.clear({color:b}),L.disable(L.SCISSOR_TEST)}function _i(x,t,l){const p=x.context,m=p.gl,b=l.posMatrix,C=x.useProgram("debug"),L=yi.disabled,R=qi.disabled,z=x.colorModeForRenderPass(),G="$debug",q=x.style.map.terrain&&x.style.map.terrain.getTerrainData(l);p.activeTexture.set(m.TEXTURE0);const K=t.getTileByID(l.key).latestRawTileData,te=Math.floor((K&&K.byteLength||0)/1024),se=t.getTile(l).tileSize,ue=512/Math.min(se,512)*(l.overscaledZ/x.transform.zoom)*.5;let ae=l.canonical.toString();l.overscaledZ!==l.canonical.z&&(ae+=` => ${l.overscaledZ}`),function(fe,ye){fe.initDebugOverlayCanvas();const oe=fe.debugOverlayCanvas,Se=fe.context.gl,Me=fe.debugOverlayCanvas.getContext("2d");Me.clearRect(0,0,oe.width,oe.height),Me.shadowColor="white",Me.shadowBlur=2,Me.lineWidth=1.5,Me.strokeStyle="white",Me.textBaseline="top",Me.font="bold 36px Open Sans, sans-serif",Me.fillText(ye,5,5),Me.strokeText(ye,5,5),fe.debugOverlayTexture.update(oe),fe.debugOverlayTexture.bind(Se.LINEAR,Se.CLAMP_TO_EDGE)}(x,`${ae} ${te}kB`),C.draw(p,m.TRIANGLES,L,R,Ni.alphaBlended,Ui.disabled,Gr(b,f.aN.transparent,ue),null,G,x.debugBuffer,x.quadTriangleIndexBuffer,x.debugSegments),C.draw(p,m.LINE_STRIP,L,R,z,Ui.disabled,Gr(b,f.aN.red),q,G,x.debugBuffer,x.tileBorderIndexBuffer,x.debugSegments)}function ta(x,t,l){const p=x.context,m=p.gl,b=x.colorModeForRenderPass(),C=new yi(m.LEQUAL,yi.ReadWrite,x.depthRangeFor3D),L=x.useProgram("terrain"),R=t.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,x.width,x.height]);for(const z of l){const G=x.renderToTexture.getTexture(z),q=t.getTerrainData(z.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,G.texture);const K=x.transform.calculatePosMatrix(z.tileID.toUnwrapped()),te=t.getMeshFrameDelta(x.transform.zoom),se=x.transform.calculateFogMatrix(z.tileID.toUnwrapped()),ue=tl(K,te,se,x.style.sky,x.transform.pitch);L.draw(p,m.TRIANGLES,C,qi.disabled,b,Ui.backCCW,ue,q,"terrain",R.vertexBuffer,R.indexBuffer,R.segments)}}class vl{constructor(t,l,p){this.vertexBuffer=t,this.indexBuffer=l,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class mr{constructor(t,l){this.context=new pl(t),this.transform=l,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:f.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=rt.maxUnderzooming+rt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new cr}resize(t,l,p){if(this.width=Math.floor(t*p),this.height=Math.floor(l*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const t=this.context,l=new f.aX;l.emplaceBack(0,0),l.emplaceBack(f.X,0),l.emplaceBack(0,f.X),l.emplaceBack(f.X,f.X),this.tileExtentBuffer=t.createVertexBuffer(l,no.members),this.tileExtentSegments=f.a0.simpleSegment(0,0,4,2);const p=new f.aX;p.emplaceBack(0,0),p.emplaceBack(f.X,0),p.emplaceBack(0,f.X),p.emplaceBack(f.X,f.X),this.debugBuffer=t.createVertexBuffer(p,no.members),this.debugSegments=f.a0.simpleSegment(0,0,4,5);const m=new f.$;m.emplaceBack(0,0,0,0),m.emplaceBack(f.X,0,f.X,0),m.emplaceBack(0,f.X,0,f.X),m.emplaceBack(f.X,f.X,f.X,f.X),this.rasterBoundsBuffer=t.createVertexBuffer(m,Yn.members),this.rasterBoundsSegments=f.a0.simpleSegment(0,0,4,2);const b=new f.aX;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(b,no.members),this.viewportSegments=f.a0.simpleSegment(0,0,4,2);const C=new f.aZ;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(C);const L=new f.aY;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(L);const R=this.context.gl;this.stencilClearMode=new qi({func:R.ALWAYS,mask:0},0,255,R.ZERO,R.ZERO,R.ZERO)}clearStencil(){const t=this.context,l=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=f.H();f.aQ(p,0,this.width,this.height,0,0,1),f.K(p,p,[l.drawingBufferWidth,l.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,l.TRIANGLES,yi.disabled,this.stencilClearMode,Ni.disabled,Ui.disabled,Dn(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,l){if(this.currentStencilSource===t.source||!t.isTileClipped()||!l||!l.length)return;this.currentStencilSource=t.source;const p=this.context,m=p.gl;this.nextStencilID+l.length>256&&this.clearStencil(),p.setColorMode(Ni.disabled),p.setDepthMode(yi.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of l){const L=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,R=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);b.draw(p,m.TRIANGLES,yi.disabled,new qi({func:m.ALWAYS,mask:0},L,255,m.KEEP,m.KEEP,m.REPLACE),Ni.disabled,Ui.disabled,Dn(C.posMatrix),R,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,l=this.context.gl;return new qi({func:l.NOTEQUAL,mask:255},t,255,l.KEEP,l.KEEP,l.REPLACE)}stencilModeForClipping(t){const l=this.context.gl;return new qi({func:l.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,l.KEEP,l.KEEP,l.REPLACE)}stencilConfigForOverlap(t){const l=this.context.gl,p=t.sort((C,L)=>L.overscaledZ-C.overscaledZ),m=p[p.length-1].overscaledZ,b=p[0].overscaledZ-m+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const C={};for(let L=0;L({u_sky_color:ye.properties.get("sky-color"),u_horizon_color:ye.properties.get("horizon-color"),u_horizon:(oe.height/2+oe.getHorizon())*Se,u_sky_horizon_blend:ye.properties.get("sky-horizon-blend")*oe.height/2*Se}))(G,z.style.map.transform,z.pixelRatio),se=new yi(K.LEQUAL,yi.ReadWrite,[0,1]),ue=qi.disabled,ae=z.colorModeForRenderPass(),fe=z.useProgram("sky");if(!G.mesh){const ye=new f.aX;ye.emplaceBack(-1,-1),ye.emplaceBack(1,-1),ye.emplaceBack(1,1),ye.emplaceBack(-1,1);const oe=new f.aY;oe.emplaceBack(0,1,2),oe.emplaceBack(0,2,3),G.mesh=new vl(q.createVertexBuffer(ye,no.members),q.createIndexBuffer(oe),f.a0.simpleSegment(0,0,ye.length,oe.length))}fe.draw(q,K.TRIANGLES,se,ue,ae,Ui.disabled,te,void 0,"sky",G.mesh.vertexBuffer,G.mesh.indexBuffer,G.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=l.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const z=this.style._layers[m[this.currentLayer]],G=b[z.source],q=C[z.source];this._renderTileClippingMasks(z,q),this.renderLayer(this,G,z,q)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerfe.source&&!fe.isHidden(q)?[G.sourceCaches[fe.source]]:[]),se=te.filter(fe=>fe.getSource().type==="vector"),ue=te.filter(fe=>fe.getSource().type!=="vector"),ae=fe=>{(!K||K.getSource().maxzoomae(fe)),K||ue.forEach(fe=>ae(fe)),K}(this.style,this.transform.zoom);z&&function(G,q,K){for(let te=0;te0),m&&(f.b0(l,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(b,C){const L=b.context,R=L.gl,z=Ni.unblended,G=new yi(R.LEQUAL,yi.ReadWrite,[0,1]),q=C.getTerrainMesh(),K=C.sourceCache.getRenderableTiles(),te=b.useProgram("terrainDepth");L.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:f.aN.transparent,depth:1});for(const se of K){const ue=C.getTerrainData(se.tileID),ae={u_matrix:b.transform.calculatePosMatrix(se.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(b.transform.zoom)};te.draw(L,R.TRIANGLES,G,qi.disabled,z,Ui.backCCW,ae,ue,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain),function(b,C){const L=b.context,R=L.gl,z=Ni.unblended,G=new yi(R.LEQUAL,yi.ReadWrite,[0,1]),q=C.getTerrainMesh(),K=C.getCoordsTexture(),te=C.sourceCache.getRenderableTiles(),se=b.useProgram("terrainCoords");L.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:f.aN.transparent,depth:1}),C.coordsIndex=[];for(const ue of te){const ae=C.getTerrainData(ue.tileID);L.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,K.texture);const fe={u_matrix:b.transform.calculatePosMatrix(ue.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(b.transform.zoom)};se.draw(L,R.TRIANGLES,G,qi.disabled,z,Ui.backCCW,fe,ae,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),C.coordsIndex.push(ue.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain))}renderLayer(t,l,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(b,C,L,R,z){if(b.renderPass!=="translucent")return;const G=qi.disabled,q=b.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(K,te,se,ue,ae,fe,ye,oe,Se){const Me=te.transform,Be=io(),Qe=ae==="map",ot=fe==="map";for(const It of K){const Ct=ue.getTile(It),at=Ct.getBucket(se);if(!at||!at.text||!at.text.segments.get().length)continue;const ft=f.ah(at.textSizeData,Me.zoom),Nt=Ht(Ct,1,te.transform.zoom),ai=Sn(It.posMatrix,ot,Qe,te.transform,Nt),yt=se.layout.get("icon-text-fit")!=="none"&&at.hasIconData();if(ft){const bt=Math.pow(2,Me.zoom-Ct.tileID.overscaledZ),ri=te.style.map.terrain?(gi,xi)=>te.style.map.terrain.getElevation(It,gi,xi):null,$i=Be.translatePosition(Me,Ct,ye,oe);Ea(at,Qe,ot,Se,Me,ai,It.posMatrix,bt,ft,yt,Be,$i,It.toUnwrapped(),ri)}}}(R,b,L,C,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),z),L.paint.get("icon-opacity").constantOr(1)!==0&&ws(b,C,L,R,!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"),G,q),L.paint.get("text-opacity").constantOr(1)!==0&&ws(b,C,L,R,!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"),G,q),C.map.showCollisionBoxes&&(Wl(b,C,L,R,!0),Wl(b,C,L,R,!1))})(t,l,p,m,this.style.placement.variableOffsets);break;case"circle":(function(b,C,L,R){if(b.renderPass!=="translucent")return;const z=L.paint.get("circle-opacity"),G=L.paint.get("circle-stroke-width"),q=L.paint.get("circle-stroke-opacity"),K=!L.layout.get("circle-sort-key").isConstant();if(z.constantOr(1)===0&&(G.constantOr(1)===0||q.constantOr(1)===0))return;const te=b.context,se=te.gl,ue=b.depthModeForSublayer(0,yi.ReadOnly),ae=qi.disabled,fe=b.colorModeForRenderPass(),ye=[];for(let oe=0;oeoe.sortKey-Se.sortKey);for(const oe of ye){const{programConfiguration:Se,program:Me,layoutVertexBuffer:Be,indexBuffer:Qe,uniformValues:ot,terrainData:It}=oe.state;Me.draw(te,se.TRIANGLES,ue,ae,fe,Ui.disabled,ot,It,L.id,Be,Qe,oe.segments,L.paint,b.transform.zoom,Se)}})(t,l,p,m);break;case"heatmap":(function(b,C,L,R){if(L.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const z=b.context,G=z.gl,q=qi.disabled,K=new Ni([G.ONE,G.ONE],f.aN.transparent,[!0,!0,!0,!0]);(function(te,se,ue){const ae=te.gl;te.activeTexture.set(ae.TEXTURE1),te.viewport.set([0,0,se.width/4,se.height/4]);let fe=ue.heatmapFbo;if(fe)ae.bindTexture(ae.TEXTURE_2D,fe.colorAttachment.get()),te.bindFramebuffer.set(fe.framebuffer);else{const ye=ae.createTexture();ae.bindTexture(ae.TEXTURE_2D,ye),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_WRAP_S,ae.CLAMP_TO_EDGE),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_WRAP_T,ae.CLAMP_TO_EDGE),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_MIN_FILTER,ae.LINEAR),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_MAG_FILTER,ae.LINEAR),fe=ue.heatmapFbo=te.createFramebuffer(se.width/4,se.height/4,!1,!1),function(oe,Se,Me,Be){var Qe,ot;const It=oe.gl,Ct=(Qe=oe.HALF_FLOAT)!==null&&Qe!==void 0?Qe:It.UNSIGNED_BYTE,at=(ot=oe.RGBA16F)!==null&&ot!==void 0?ot:It.RGBA;It.texImage2D(It.TEXTURE_2D,0,at,Se.width/4,Se.height/4,0,It.RGBA,Ct,null),Be.colorAttachment.set(Me)}(te,se,ye,fe)}})(z,b,L),z.clear({color:f.aN.transparent});for(let te=0;te{const oe=f.H();f.aQ(oe,0,ue.width,ue.height,0,0,1);const Se=ue.context.gl;return{u_matrix:oe,u_world:[Se.drawingBufferWidth,Se.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ae.paint.get("heatmap-opacity")}})(z,G),null,G.id,z.viewportBuffer,z.quadTriangleIndexBuffer,z.viewportSegments,G.paint,z.transform.zoom)}(b,L))})(t,l,p,m);break;case"line":(function(b,C,L,R){if(b.renderPass!=="translucent")return;const z=L.paint.get("line-opacity"),G=L.paint.get("line-width");if(z.constantOr(1)===0||G.constantOr(1)===0)return;const q=b.depthModeForSublayer(0,yi.ReadOnly),K=b.colorModeForRenderPass(),te=L.paint.get("line-dasharray"),se=L.paint.get("line-pattern"),ue=se.constantOr(1),ae=L.paint.get("line-gradient"),fe=L.getCrossfadeParameters(),ye=ue?"linePattern":te?"lineSDF":ae?"lineGradient":"line",oe=b.context,Se=oe.gl;let Me=!0;for(const Be of R){const Qe=C.getTile(Be);if(ue&&!Qe.patternsLoaded())continue;const ot=Qe.getBucket(L);if(!ot)continue;const It=ot.programConfigurations.get(L.id),Ct=b.context.program.get(),at=b.useProgram(ye,It),ft=Me||at.program!==Ct,Nt=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Be),ai=se.constantOr(null);if(ai&&Qe.imageAtlas){const ri=Qe.imageAtlas,$i=ri.patternPositions[ai.to.toString()],gi=ri.patternPositions[ai.from.toString()];$i&&gi&&It.setConstantPatternPositions($i,gi)}const yt=Nt?Be:null,bt=ue?nl(b,Qe,L,fe,yt):te?Go(b,Qe,L,te,fe,yt):ae?_a(b,Qe,L,ot.lineClipsArray.length,yt):qo(b,Qe,L,yt);if(ue)oe.activeTexture.set(Se.TEXTURE0),Qe.imageAtlasTexture.bind(Se.LINEAR,Se.CLAMP_TO_EDGE),It.updatePaintBuffers(fe);else if(te&&(ft||b.lineAtlas.dirty))oe.activeTexture.set(Se.TEXTURE0),b.lineAtlas.bind(oe);else if(ae){const ri=ot.gradients[L.id];let $i=ri.texture;if(L.gradientVersion!==ri.version){let gi=256;if(L.stepInterpolant){const xi=C.getSource().maxzoom,en=Be.canonical.z===xi?Math.ceil(1<0?l.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const l=this.imageManager.getPattern(t.from.toString()),p=this.imageManager.getPattern(t.to.toString());return!l||!p}useProgram(t,l){this.cache=this.cache||{};const p=t+(l?l.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Uo(this.context,hr[t],l,Xo[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[p]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ie(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:l}=this.context.gl;return this.width!==t||this.height!==l}}class On{constructor(t,l){this.points=t,this.planes=l}static fromInvProjectionMatrix(t,l,p){const m=Math.pow(2,p),b=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(L=>{const R=1/(L=f.ag([],L,t))[3]/l*m;return f.b1(L,L,[R,R,1/L[3],R])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const R=function(K,te){var se=te[0],ue=te[1],ae=te[2],fe=se*se+ue*ue+ae*ae;return fe>0&&(fe=1/Math.sqrt(fe)),K[0]=te[0]*fe,K[1]=te[1]*fe,K[2]=te[2]*fe,K}([],function(K,te,se){var ue=te[0],ae=te[1],fe=te[2],ye=se[0],oe=se[1],Se=se[2];return K[0]=ae*Se-fe*oe,K[1]=fe*ye-ue*Se,K[2]=ue*oe-ae*ye,K}([],Ze([],b[L[0]],b[L[1]]),Ze([],b[L[2]],b[L[1]]))),z=-((G=R)[0]*(q=b[L[1]])[0]+G[1]*q[1]+G[2]*q[2]);var G,q;return R.concat(z)});return new On(b,C)}}class v{constructor(t,l){this.min=t,this.max=l,this.center=function(p,m,b){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,b){return p[0]=m[0]+b[0],p[1]=m[1]+b[1],p[2]=m[2]+b[2],p}([],this.min,this.max))}quadrant(t){const l=[t%2==0,t<2],p=ze(this.min),m=ze(this.max);for(let b=0;b=0&&C++;if(C===0)return 0;C!==l.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let b=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let L=0;Lthis.max[m]-this.min[m])return 0}return 1}}class r{constructor(t=0,l=0,p=0,m=0){if(isNaN(t)||t<0||isNaN(l)||l<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=l,this.left=p,this.right=m}interpolate(t,l,p){return l.top!=null&&t.top!=null&&(this.top=f.z.number(t.top,l.top,p)),l.bottom!=null&&t.bottom!=null&&(this.bottom=f.z.number(t.bottom,l.bottom,p)),l.left!=null&&t.left!=null&&(this.left=f.z.number(t.left,l.left,p)),l.right!=null&&t.right!=null&&(this.right=f.z.number(t.right,l.right,p)),this}getCenter(t,l){const p=f.ad((this.left+t-this.right)/2,0,t),m=f.ad((this.top+l-this.bottom)/2,0,l);return new f.P(p,m)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new r(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const a=85.051129;class u{constructor(t,l,p,m,b){this.tileSize=512,this._renderWorldCopies=b===void 0||!!b,this._minZoom=t||0,this._maxZoom=l||22,this._minPitch=p??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new f.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new r,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new u(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new f.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const l=-f.b3(t,-180,180)*Math.PI/180;this.angle!==l&&(this._unmodified=!1,this.angle=l,this._calcMatrices(),this.rotationMatrix=function(){var p=new f.A(4);return f.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,m,b){var C=m[0],L=m[1],R=m[2],z=m[3],G=Math.sin(b),q=Math.cos(b);p[0]=C*q+R*G,p[1]=L*q+z*G,p[2]=C*-G+R*q,p[3]=L*-G+z*q}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const l=f.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==l&&(this._unmodified=!1,this._pitch=l,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const l=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==l&&(this._unmodified=!1,this._zoom=l,this.tileZoom=Math.max(0,Math.floor(l)),this.scale=this.zoomScale(l),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,l,p){this._unmodified=!1,this._edgeInsets.interpolate(t,l,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const l=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,l)}getVisibleUnwrappedCoordinates(t){const l=[new f.b4(0,t)];if(this._renderWorldCopies){const p=this.pointCoordinate(new f.P(0,0)),m=this.pointCoordinate(new f.P(this.width,0)),b=this.pointCoordinate(new f.P(this.width,this.height)),C=this.pointCoordinate(new f.P(0,this.height)),L=Math.floor(Math.min(p.x,m.x,b.x,C.x)),R=Math.floor(Math.max(p.x,m.x,b.x,C.x)),z=1;for(let G=L-z;G<=R+z;G++)G!==0&&l.push(new f.b4(G,t))}return l}coveringTiles(t){var l,p;let m=this.coveringZoomLevel(t);const b=m;if(t.minzoom!==void 0&&mt.maxzoom&&(m=t.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),L=f.Z.fromLngLat(this.center),R=Math.pow(2,m),z=[R*C.x,R*C.y,0],G=[R*L.x,R*L.y,0],q=On.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let K=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(K=m);const te=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,se=oe=>({aabb:new v([oe*R,0,0],[(oe+1)*R,R,0]),zoom:0,x:0,y:0,wrap:oe,fullyVisible:!1}),ue=[],ae=[],fe=m,ye=t.reparseOverscaled?b:m;if(this._renderWorldCopies)for(let oe=1;oe<=3;oe++)ue.push(se(-oe)),ue.push(se(oe));for(ue.push(se(0));ue.length>0;){const oe=ue.pop(),Se=oe.x,Me=oe.y;let Be=oe.fullyVisible;if(!Be){const at=oe.aabb.intersects(q);if(at===0)continue;Be=at===2}const Qe=t.terrain?z:G,ot=oe.aabb.distanceX(Qe),It=oe.aabb.distanceY(Qe),Ct=Math.max(Math.abs(ot),Math.abs(It));if(oe.zoom===fe||Ct>te+(1<=K){const at=fe-oe.zoom,ft=z[0]-.5-(Se<>1),ai=oe.zoom+1;let yt=oe.aabb.quadrant(at);if(t.terrain){const bt=new f.S(ai,oe.wrap,ai,ft,Nt),ri=t.terrain.getMinMaxElevation(bt),$i=(l=ri.minElevation)!==null&&l!==void 0?l:this.elevation,gi=(p=ri.maxElevation)!==null&&p!==void 0?p:this.elevation;yt=new v([yt.min[0],yt.min[1],$i],[yt.max[0],yt.max[1],gi])}ue.push({aabb:yt,zoom:ai,x:ft,y:Nt,wrap:oe.wrap,fullyVisible:Be})}}return ae.sort((oe,Se)=>oe.distanceSq-Se.distanceSq).map(oe=>oe.tileID)}resize(t,l){this.width=t,this.height=l,this.pixelsToGLUnits=[2/t,-2/l],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const l=f.ad(t.lat,-85.051129,a);return new f.P(f.O(t.lng)*this.worldSize,f.Q(l)*this.worldSize)}unproject(t){return new f.Z(t.x/this.worldSize,t.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(t){const l=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,t),b=t.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-b))return;const C=p+l-b,L=Math.cos(this._pitch)*this.cameraToCenterDistance/C/f.b5(1,m.lat),R=this.scaleZoom(L/this.tileSize);this._elevation=b,this._center=m,this.zoom=R}setLocationAtPoint(t,l){const p=this.pointCoordinate(l),m=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(t),C=new f.Z(b.x-(p.x-m.x),b.y-(p.y-m.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,l){return l?this.coordinatePoint(this.locationCoordinate(t),l.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,l){return this.coordinateLocation(this.pointCoordinate(t,l))}locationCoordinate(t){return f.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,l){if(l){const K=l.pointCoordinate(t);if(K!=null)return K}const p=[t.x,t.y,0,1],m=[t.x,t.y,1,1];f.ag(p,p,this.pixelMatrixInverse),f.ag(m,m,this.pixelMatrixInverse);const b=p[3],C=m[3],L=p[1]/b,R=m[1]/C,z=p[2]/b,G=m[2]/C,q=z===G?0:(0-z)/(G-z);return new f.Z(f.z.number(p[0]/b,m[0]/C,q)/this.worldSize,f.z.number(L,R,q)/this.worldSize)}coordinatePoint(t,l=0,p=this.pixelMatrix){const m=[t.x*this.worldSize,t.y*this.worldSize,l,1];return f.ag(m,m,p),new f.P(m[0]/m[3],m[1]/m[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Ne().extend(this.pointLocation(new f.P(0,t))).extend(this.pointLocation(new f.P(this.width,t))).extend(this.pointLocation(new f.P(this.width,this.height))).extend(this.pointLocation(new f.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ne([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(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,a])}calculateTileMatrix(t){const l=t.canonical,p=this.worldSize/this.zoomScale(l.z),m=l.x+Math.pow(2,l.z)*t.wrap,b=f.ao(new Float64Array(16));return f.J(b,b,[m*p,l.y*p,0]),f.K(b,b,[p/f.X,p/f.X,1]),b}calculatePosMatrix(t,l=!1){const p=t.key,m=l?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const b=this.calculateTileMatrix(t);return f.L(b,l?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,b),m[p]=new Float32Array(b),m[p]}calculateFogMatrix(t){const l=t.key,p=this._fogMatrixCache;if(p[l])return p[l];const m=this.calculateTileMatrix(t);return f.L(m,this.fogMatrix,m),p[l]=new Float32Array(m),p[l]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,l){l=f.ad(+l,this.minZoom,this.maxZoom);const p={center:new f.N(t.lng,t.lat),zoom:l};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const oe=179.9999999999;m=[-oe,oe]}const b=this.tileSize*this.zoomScale(p.zoom);let C=0,L=b,R=0,z=b,G=0,q=0;const{x:K,y:te}=this.size;if(this.latRange){const oe=this.latRange;C=f.Q(oe[1])*b,L=f.Q(oe[0])*b,L-CL&&(fe=L-oe)}if(m){const oe=(R+z)/2;let Se=se;this._renderWorldCopies&&(Se=f.b3(se,oe-b/2,oe+b/2));const Me=K/2;Se-Mez&&(ae=z-Me)}if(ae!==void 0||fe!==void 0){const oe=new f.P(ae??se,fe??ue);p.center=this.unproject.call({worldSize:b},oe).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:l,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=l,this.zoom=p,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,l=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=f.b5(1,this.center.lat)*this.worldSize;let m=f.ao(new Float64Array(16));f.K(m,m,[this.width/2,-this.height/2,1]),f.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=f.ao(new Float64Array(16)),f.K(m,m,[1,-1,1]),f.J(m,m,[-1,-1,0]),f.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),L=b-C*this._pixelPerMeter/Math.cos(this._pitch),R=C<0?L:b,z=Math.PI/2+this._pitch,G=this._fov*(.5+t.y/this.height),q=Math.sin(G)*R/Math.sin(f.ad(Math.PI-z-G,.01,Math.PI-.01)),K=this.getHorizon(),te=2*Math.atan(K/this.cameraToCenterDistance)*(.5+t.y/(2*K)),se=Math.sin(te)*R/Math.sin(f.ad(Math.PI-z-te,.01,Math.PI-.01)),ue=Math.min(q,se);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ue+R),this.nearZ=this.height/50,m=new Float64Array(16),f.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-t.x/this.width,m[9]=2*t.y/this.height,this.projectionMatrix=f.af(m),f.K(m,m,[1,-1,1]),f.J(m,m,[0,0,-this.cameraToCenterDistance]),f.b7(m,m,this._pitch),f.ae(m,m,this.angle),f.J(m,m,[-l,-p,0]),this.mercatorMatrix=f.K([],m,[this.worldSize,this.worldSize,this.worldSize]),f.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=f.L(new Float64Array(16),this.labelPlaneMatrix,m),f.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=f.at([],m),this.fogMatrix=new Float64Array(16),f.b6(this.fogMatrix,this._fov,this.width/this.height,b,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,f.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),f.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),f.b7(this.fogMatrix,this.fogMatrix,this._pitch),f.ae(this.fogMatrix,this.fogMatrix,this.angle),f.J(this.fogMatrix,this.fogMatrix,[-l,-p,0]),f.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),f.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=f.L(new Float64Array(16),this.labelPlaneMatrix,m);const ae=this.width%2/2,fe=this.height%2/2,ye=Math.cos(this.angle),oe=Math.sin(this.angle),Se=l-Math.round(l)+ye*ae+oe*fe,Me=p-Math.round(p)+ye*fe+oe*ae,Be=new Float64Array(m);if(f.J(Be,Be,[Se>.5?Se-1:Se,Me>.5?Me-1:Me,0]),this.alignedModelViewProjectionMatrix=Be,m=f.at(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new f.P(0,0)),l=[t.x*this.worldSize,t.y*this.worldSize,0,1];return f.ag(l,l,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new f.P(0,t))}getCameraQueryGeometry(t){const l=this.getCameraPoint();if(t.length===1)return[t[0],l];{let p=l.x,m=l.y,b=l.x,C=l.y;for(const L of t)p=Math.min(p,L.x),m=Math.min(m,L.y),b=Math.max(b,L.x),C=Math.max(C,L.y);return[new f.P(p,m),new f.P(b,m),new f.P(b,C),new f.P(p,C),new f.P(p,m)]}}lngLatToCameraDepth(t,l){const p=this.locationCoordinate(t),m=[p.x*this.worldSize,p.y*this.worldSize,l,1];return f.ag(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function y(x,t){let l,p=!1,m=null,b=null;const C=()=>{m=null,p&&(x.apply(b,l),m=setTimeout(C,t),p=!1)};return(...L)=>(p=!0,b=this,l=L,m||C(),m)}class E{constructor(t){this._getCurrentHash=()=>{const l=window.location.hash.replace("#","");if(this._hashName){let p;return l.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return l.split("/")},this._onHashChange=()=>{const l=this._getCurrentHash();if(l.length>=3&&!l.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(l[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+l[2],+l[1]],zoom:+l[0],bearing:p,pitch:+(l[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const l=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,l)},this._removeHash=()=>{const l=this._getCurrentHash();if(l.length===0)return;const p=l.join("/");let m=p;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${p}`);let b=window.location.hash.replace(m,"");b.startsWith("#&")?b=b.slice(0,1)+b.slice(2):b==="#"&&(b="");let C=window.location.href.replace(/(#.+)?$/,b);C=C.replace("&&","&"),window.history.replaceState(window.history.state,null,C)},this._updateHash=y(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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()),this._removeHash(),delete this._map,this}getHashString(t){const l=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,m),C=Math.round(l.lng*b)/b,L=Math.round(l.lat*b)/b,R=this._map.getBearing(),z=this._map.getPitch();let G="";if(G+=t?`/${C}/${L}/${p}`:`${p}/${L}/${C}`,(R||z)&&(G+="/"+Math.round(10*R)/10),z&&(G+=`/${Math.round(z)}`),this._hashName){const q=this._hashName;let K=!1;const te=window.location.hash.slice(1).split("&").map(se=>{const ue=se.split("=")[0];return ue===q?(K=!0,`${ue}=${G}`):se}).filter(se=>se);return K||te.push(`${q}=${G}`),`#${te.join("&")}`}return`#${G}`}}const M={linearity:.3,easing:f.b8(0,0,.3,1)},B=f.e({deceleration:2500,maxSpeed:1400},M),W=f.e({deceleration:20,maxSpeed:1400},M),ne=f.e({deceleration:1e3,maxSpeed:360},M),me=f.e({deceleration:1e3,maxSpeed:90},M);class Ee{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:N.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,l=N.now();for(;t.length>0&&l-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const l={zoom:0,bearing:0,pitch:0,pan:new f.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)l.zoom+=b.zoomDelta||0,l.bearing+=b.bearingDelta||0,l.pitch+=b.pitchDelta||0,b.panDelta&&l.pan._add(b.panDelta),b.around&&(l.around=b.around),b.pinchAround&&(l.pinchAround=b.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(l.pan.mag()){const b=ht(l.pan.mag(),p,f.e({},B,t||{}));m.offset=l.pan.mult(b.amount/l.pan.mag()),m.center=this._map.transform.center,Xe(m,b)}if(l.zoom){const b=ht(l.zoom,p,W);m.zoom=this._map.transform.zoom+b.amount,Xe(m,b)}if(l.bearing){const b=ht(l.bearing,p,ne);m.bearing=this._map.transform.bearing+f.ad(b.amount,-179,179),Xe(m,b)}if(l.pitch){const b=ht(l.pitch,p,me);m.pitch=this._map.transform.pitch+b.amount,Xe(m,b)}if(m.zoom||m.bearing){const b=l.pinchAround===void 0?l.around:l.pinchAround;m.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),f.e(m,{noMoveStart:!0})}}function Xe(x,t){(!x.duration||x.durationl.unproject(R)),L=b.reduce((R,z,G,q)=>R.add(z.div(q.length)),new f.P(0,0));super(t,{points:b,point:L,lngLats:C,lngLat:l.unproject(L),originalEvent:p}),this._defaultPrevented=!1}}class ni extends f.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,l,p){super(t,{originalEvent:p}),this._defaultPrevented=!1}}class ci{constructor(t,l){this._map=t,this._clickTolerance=l.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ni(t.type,this._map,t))}mousedown(t,l){return this._mousedownPos=l,this._firePreventable(new tt(t.type,this._map,t))}mouseup(t){this._map.fire(new tt(t.type,this._map,t))}click(t,l){this._mousedownPos&&this._mousedownPos.dist(l)>=this._clickTolerance||this._map.fire(new tt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new tt(t.type,this._map,t))}mouseover(t){this._map.fire(new tt(t.type,this._map,t))}mouseout(t){this._map.fire(new tt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Yt(t.type,this._map,t))}touchmove(t){this._map.fire(new Yt(t.type,this._map,t))}touchend(t){this._map.fire(new Yt(t.type,this._map,t))}touchcancel(t){this._map.fire(new Yt(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ci{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new tt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new tt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ri{constructor(t){this._map=t}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(t){return this.transform.pointLocation(f.P.convert(t),this._map.terrain)}}class bn{constructor(t,l){this._map=t,this._tr=new Ri(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=l.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,l){this.isEnabled()&&t.shiftKey&&t.button===0&&(V.disableDrag(),this._startPos=this._lastPos=l,this._active=!0)}mousemoveWindow(t,l){if(!this._active)return;const p=l;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)b.fitScreenCoordinates(p,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(V.remove(this._box),this._box=null),V.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,l){return this._map.fire(new f.k(t,{originalEvent:l}))}}function wn(x,t){if(x.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${x.length}, points ${t.length}`);const l={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),p.length===this.numTouches&&(this.centroid=function(m){const b=new f.P(0,0);for(const C of m)b._add(C);return b.div(m.length)}(l),this.touches=wn(p,l)))}touchmove(t,l,p){if(this.aborted||!this.centroid)return;const m=wn(p,l);for(const b in this.touches){const C=m[b];(!C||C.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(t,l,p){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class Nr{constructor(t){this.singleTap=new gr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,l,p){this.singleTap.touchstart(t,l,p)}touchmove(t,l,p){this.singleTap.touchmove(t,l,p)}touchend(t,l,p){const m=this.singleTap.touchend(t,l,p);if(m){const b=t.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(m)<30;if(b&&C||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Is{constructor(t){this._tr=new Ri(t),this._zoomIn=new Nr({numTouches:1,numTaps:2}),this._zoomOut=new Nr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,l,p){this._zoomIn.touchstart(t,l,p),this._zoomOut.touchstart(t,l,p)}touchmove(t,l,p){this._zoomIn.touchmove(t,l,p),this._zoomOut.touchmove(t,l,p)}touchend(t,l,p){const m=this._zoomIn.touchend(t,l,p),b=this._zoomOut.touchend(t,l,p),C=this._tr;return m?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(m)},{originalEvent:t})}):b?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(b)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Li{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const l=this._moveFunction(...t);if(l.bearingDelta||l.pitchDelta||l.around||l.panDelta)return this._active=!0,l}dragStart(t,l){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=l.length?l[0]:l,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,l){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const m=l.length?l[0]:l;return!this._moved&&m.dist(p){x.mousedown=x.dragStart,x.mousemoveWindow=x.dragMove,x.mouseup=x.dragEnd,x.contextmenu=t=>{t.preventDefault()}},na=({enable:x,clickTolerance:t,bearingDegreesPerPixelMoved:l=.8})=>{const p=new yn({checkCorrectEvent:m=>V.mouseButton(m)===0&&m.ctrlKey||V.mouseButton(m)===2});return new Li({clickTolerance:t,move:(m,b)=>({bearingDelta:(b.x-m.x)*l}),moveStateManager:p,enable:x,assignEvents:po})},Qr=({enable:x,clickTolerance:t,pitchDegreesPerPixelMoved:l=-.5})=>{const p=new yn({checkCorrectEvent:m=>V.mouseButton(m)===0&&m.ctrlKey||V.mouseButton(m)===2});return new Li({clickTolerance:t,move:(m,b)=>({pitchDelta:(b.y-m.y)*l}),moveStateManager:p,enable:x,assignEvents:po})};class xl{constructor(t,l){this._clickTolerance=t.clickTolerance||1,this._map=l,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new f.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(t,l,p){return this._calculateTransform(t,l,p)}touchmove(t,l,p){if(this._active&&!(p.length0&&(this._active=!0);const m=wn(p,l),b=new f.P(0,0),C=new f.P(0,0);let L=0;for(const z in m){const G=m[z],q=this._touches[z];q&&(b._add(G),C._add(G.sub(q)),L++,m[z]=G)}if(this._touches=m,LMath.abs(x.x)}class Yu extends bl{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,l,p){super.touchstart(t,l,p),this._currentTouchCount=p.length}_start(t){this._lastPoints=t,qs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,l,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=t[0].sub(this._lastPoints[0]),b=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,b,p.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(m.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(t,l,p){if(this._valid!==void 0)return this._valid;const m=t.mag()>=2,b=l.mag()>=2;if(!m&&!b)return;if(!m||!b)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const C=t.y>0==l.y>0;return qs(t)&&qs(l)&&C}}const sh={panStep:100,bearingStep:15,pitchStep:10};class Ku{constructor(t){this._tr=new Ri(t);const l=sh;this._panStep=l.panStep,this._bearingStep=l.bearingStep,this._pitchStep=l.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let l=0,p=0,m=0,b=0,C=0;switch(t.keyCode){case 61:case 107:case 171:case 187:l=1;break;case 189:case 109:case 173:l=-1;break;case 37:t.shiftKey?p=-1:(t.preventDefault(),b=-1);break;case 39:t.shiftKey?p=1:(t.preventDefault(),b=1);break;case 38:t.shiftKey?m=1:(t.preventDefault(),C=-1);break;case 40:t.shiftKey?m=-1:(t.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:L=>{const R=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:oh,zoom:l?Math.round(R.zoom)+l*(t.shiftKey?2:1):R.zoom,bearing:R.bearing+p*this._bearingStep,pitch:R.pitch+m*this._pitchStep,offset:[-b*this._panStep,-C*this._panStep],center:R.center},{originalEvent:t})}}}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 oh(x){return x*(2-x)}const Ju=4.000244140625;class Qu{constructor(t,l){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=t,this._tr=new Ri(t),this._triggerRenderFrame=l,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled()||this._map.cooperativeGestures.shouldPreventWheelEvent(t))return;let l=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const p=N.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,l!==0&&l%Ju==0?this._type="wheel":l!==0&&Math.abs(l)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=l,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(m*l)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,l+=this._lastValue)),t.shiftKey&&l&&(l/=4),this._type&&(this._lastWheelEvent=t,this._delta-=l,this._active||this._start(t)),t.preventDefault()}_start(t){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 l=V.mousePos(this._map.getCanvas(),t),p=this._tr;this._around=l.y>p.transform.height/2-p.transform.getHorizon()?f.N.convert(this._aroundCenter?p.center:p.unproject(l)):f.N.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const R=this._type==="wheel"&&Math.abs(this._delta)>Ju?this._wheelZoomRate:this._defaultZoomRate;let z=2/(1+Math.exp(-Math.abs(this._delta*R)));this._delta<0&&z!==0&&(z=1/z);const G=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(G*z))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const l=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,p=this._startZoom,m=this._easing;let b,C=!1;const L=N.now()-this._lastWheelEventTime;if(this._type==="wheel"&&p&&m&&L){const R=Math.min(L/200,1),z=m(R);b=f.z.number(p,l,z),R<1?this._frameId||(this._frameId=!0):C=!0}else b=l,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:b-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let l=f.b9;if(this._prevEase){const p=this._prevEase,m=(N.now()-p.start)/p.duration,b=p.easing(m+.01)-p.easing(m),C=.27/Math.sqrt(b*b+1e-4)*.01,L=Math.sqrt(.0729-C*C);l=f.b8(C,L,.25,1)}return this._prevEase={start:N.now(),duration:t,easing:l},l}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class $u{constructor(t,l){this._clickZoom=t,this._tapZoom=l}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 kl{constructor(t){this._tr=new Ri(t),this.reset()}reset(){this._active=!1}dblclick(t,l){return t.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(l)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ah{constructor(){this._tap=new Nr({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(t,l,p){if(!this._swipePoint)if(this._tapTime){const m=l[0],b=t.timeStamp-this._tapTime<500,C=this._tapPoint.dist(m)<30;b&&C?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(t,l,p)}touchmove(t,l,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=l[0],b=m.y-this._swipePoint.y;return this._swipePoint=m,t.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(t,l,p)}touchend(t,l,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(t,l,p);m&&(this._tapTime=t.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wr{constructor(t,l,p){this._el=t,this._mousePan=l,this._touchPan=p}enable(t){this._inertiaOptions=t||{},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 $r{constructor(t,l,p){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=l,this._mousePitch=p}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 ec{constructor(t,l,p,m){this._el=t,this._touchZoom=l,this._touchRotate=p,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),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 es{constructor(t,l){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=l,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=V.create("div","maplibregl-cooperative-gesture-screen",t);let l=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(l=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=l,this._container.appendChild(m);const b=document.createElement("div");b.className="maplibregl-mobile-message",b.textContent=p,this._container.appendChild(b),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(V.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(t){this._onCooperativeGesture(t.touches.length===1)}wheel(t){if(!this._map.scrollZoom.isEnabled())return;const l=this.shouldPreventWheelEvent(t);this._onCooperativeGesture(l)}shouldPreventWheelEvent(t){return!!this.isEnabled()&&!(t[this._bypassKey]||t.ctrlKey)}_onCooperativeGesture(t){this._enabled&&t&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Gs=x=>x.zoom||x.drag||x.pitch||x.rotate;class jf extends f.k{}function tc(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class Uf{constructor(t,l){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,b)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=m.type==="renderFrame"?void 0:m,L={needsRenderFrame:!1},R={},z={},G=m.touches,q=G?this._getMapTouches(G):void 0,K=q?V.touchPos(this._map.getCanvas(),q):V.mousePos(this._map.getCanvas(),m);for(const{handlerName:ue,handler:ae,allowed:fe}of this._handlers){if(!ae.isEnabled())continue;let ye;this._blockedByActive(z,fe,ue)?ae.reset():ae[b||m.type]&&(ye=ae[b||m.type](m,K,q),this.mergeHandlerResult(L,R,ye,ue,C),ye&&ye.needsRenderFrame&&this._triggerRenderFrame()),(ye||ae.isActive())&&(z[ue]=ae)}const te={};for(const ue in this._previousActiveHandlers)z[ue]||(te[ue]=C);this._previousActiveHandlers=z,(Object.keys(te).length||tc(L))&&(this._changes.push([L,R,te]),this._triggerRenderFrame()),(Object.keys(z).length||tc(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=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ee(t),this._bearingSnap=l.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(l);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,b,C]of this._listeners)V.addEventListener(m,b,m===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[t,l,p]of this._listeners)V.removeEventListener(t,l,t===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(t){const l=this._map,p=l.getCanvasContainer();this._add("mapEvent",new ci(l,t));const m=l.boxZoom=new bn(l,t);this._add("boxZoom",m),t.interactive&&t.boxZoom&&m.enable();const b=l.cooperativeGestures=new es(l,t.cooperativeGestures);this._add("cooperativeGestures",b),t.cooperativeGestures&&b.enable();const C=new Is(l),L=new kl(l);l.doubleClickZoom=new $u(L,C),this._add("tapZoom",C),this._add("clickZoom",L),t.interactive&&t.doubleClickZoom&&l.doubleClickZoom.enable();const R=new ah;this._add("tapDragZoom",R);const z=l.touchPitch=new Yu(l);this._add("touchPitch",z),t.interactive&&t.touchPitch&&l.touchPitch.enable(t.touchPitch);const G=na(t),q=Qr(t);l.dragRotate=new $r(t,G,q),this._add("mouseRotate",G,["mousePitch"]),this._add("mousePitch",q,["mouseRotate"]),t.interactive&&t.dragRotate&&l.dragRotate.enable();const K=(({enable:ye,clickTolerance:oe})=>{const Se=new yn({checkCorrectEvent:Me=>V.mouseButton(Me)===0&&!Me.ctrlKey});return new Li({clickTolerance:oe,move:(Me,Be)=>({around:Be,panDelta:Be.sub(Me)}),activateOnStart:!0,moveStateManager:Se,enable:ye,assignEvents:po})})(t),te=new xl(t,l);l.dragPan=new Wr(p,K,te),this._add("mousePan",K),this._add("touchPan",te,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&l.dragPan.enable(t.dragPan);const se=new Hu,ue=new Wu;l.touchZoomRotate=new ec(p,ue,se,R),this._add("touchRotate",se,["touchPan","touchZoom"]),this._add("touchZoom",ue,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&l.touchZoomRotate.enable(t.touchZoomRotate);const ae=l.scrollZoom=new Qu(l,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),t.interactive&&t.scrollZoom&&l.scrollZoom.enable(t.scrollZoom);const fe=l.keyboard=new Ku(l);this._add("keyboard",fe),t.interactive&&t.keyboard&&l.keyboard.enable(),this._add("blockableMapEvent",new Ci(l))}_add(t,l,p){this._handlers.push({handlerName:t,handler:l,allowed:p}),this._handlersById[t]=l}stop(t){if(!this._updatingCamera){for(const{handler:l}of this._handlers)l.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Gs(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,l,p){for(const m in t)if(m!==p&&(!l||l.indexOf(m)<0))return!0;return!1}_getMapTouches(t){const l=[];for(const p of t)this._el.contains(p.target)&&l.push(p);return l}mergeHandlerResult(t,l,p,m,b){if(!p)return;f.e(t,p);const C={handlerName:m,originalEvent:p.originalEvent||b};p.zoomDelta!==void 0&&(l.zoom=C),p.panDelta!==void 0&&(l.drag=C),p.pitchDelta!==void 0&&(l.pitch=C),p.bearingDelta!==void 0&&(l.rotate=C)}_applyChanges(){const t={},l={},p={};for(const[m,b,C]of this._changes)m.panDelta&&(t.panDelta=(t.panDelta||new f.P(0,0))._add(m.panDelta)),m.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(t.around=m.around),m.pinchAround!==void 0&&(t.pinchAround=m.pinchAround),m.noInertia&&(t.noInertia=m.noInertia),f.e(l,b),f.e(p,C);this._updateMapTransform(t,l,p),this._changes=[]}_updateMapTransform(t,l,p){const m=this._map,b=m._getTransformForUpdate(),C=m.terrain;if(!(tc(t)||C&&this._terrainMovement))return this._fireEvents(l,p,!0);let{panDelta:L,zoomDelta:R,bearingDelta:z,pitchDelta:G,around:q,pinchAround:K}=t;K!==void 0&&(q=K),m._stop(!0),q=q||m.transform.centerPoint;const te=b.pointLocation(L?q.sub(L):q);z&&(b.bearing+=z),G&&(b.pitch+=G),R&&(b.zoom+=R),C?this._terrainMovement||!l.drag&&!l.zoom?l.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(L)):b.setLocationAtPoint(te,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(te,q)):b.setLocationAtPoint(te,q),m._applyUpdatedTransform(b),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(l,p,!0)}_fireEvents(t,l,p){const m=Gs(this._eventsInProgress),b=Gs(t),C={};for(const q in t){const{originalEvent:K}=t[q];this._eventsInProgress[q]||(C[`${q}start`]=K),this._eventsInProgress[q]=t[q]}!m&&b&&this._fireEvent("movestart",b.originalEvent);for(const q in C)this._fireEvent(q,C[q]);b&&this._fireEvent("move",b.originalEvent);for(const q in t){const{originalEvent:K}=t[q];this._fireEvent(q,K)}const L={};let R;for(const q in this._eventsInProgress){const{handlerName:K,originalEvent:te}=this._eventsInProgress[q];this._handlersById[K].isActive()||(delete this._eventsInProgress[q],R=l[K]||te,L[`${q}end`]=R)}for(const q in L)this._fireEvent(q,L[q]);const z=Gs(this._eventsInProgress),G=(m||b)&&!z;if(G&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const q=this._map._getTransformForUpdate();q.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(q)}if(p&&G){this._updatingCamera=!0;const q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),K=te=>te!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new jf("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Vf extends f.E{constructor(t,l){super(),this._renderFrameCallback=()=>{const p=Math.min((N.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=l.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new f.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,l){return this.jumpTo({center:t},l)}panBy(t,l,p){return t=f.P.convert(t).mult(-1),this.panTo(this.transform.center,f.e({offset:t},l),p)}panTo(t,l,p){return this.easeTo(f.e({center:t},l),p)}getZoom(){return this.transform.zoom}setZoom(t,l){return this.jumpTo({zoom:t},l),this}zoomTo(t,l,p){return this.easeTo(f.e({zoom:t},l),p)}zoomIn(t,l){return this.zoomTo(this.getZoom()+1,t,l),this}zoomOut(t,l){return this.zoomTo(this.getZoom()-1,t,l),this}getBearing(){return this.transform.bearing}setBearing(t,l){return this.jumpTo({bearing:t},l),this}getPadding(){return this.transform.padding}setPadding(t,l){return this.jumpTo({padding:t},l),this}rotateTo(t,l,p){return this.easeTo(f.e({bearing:t},l),p)}resetNorth(t,l){return this.rotateTo(0,f.e({duration:1e3},t),l),this}resetNorthPitch(t,l){return this.easeTo(f.e({bearing:0,pitch:0,duration:1e3},t),l),this}snapToNorth(t,l){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=f.z.number(b,ae,Qe)),this._rotating&&(m.bearing=f.z.number(C,z,Qe)),this._pitching&&(m.pitch=f.z.number(L,G,Qe)),this._padding&&(m.interpolatePadding(R,q,Qe),te=m.centerPoint.add(K)),this.terrain&&!t.freezeElevation&&this._updateElevation(Qe),Se)m.setLocationAtPoint(Se,Me);else{const ot=m.zoomScale(m.zoom-b),It=ae>b?Math.min(2,oe):Math.max(.5,oe),Ct=Math.pow(It,1-Qe),at=m.unproject(fe.add(ye.mult(Qe*Ct)).mult(ot));m.setLocationAtPoint(m.renderWorldCopies?at.wrap():at,te)}this._applyUpdatedTransform(m),this._fireMoveEvents(l)},Qe=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(l,Qe)},t),this}_prepareEase(t,l,p={}){this._moving=!0,l||p.moving||this.fire(new f.k("movestart",t)),this._zooming&&!p.zooming&&this.fire(new f.k("zoomstart",t)),this._rotating&&!p.rotating&&this.fire(new f.k("rotatestart",t)),this._pitching&&!p.pitching&&this.fire(new f.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const l=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&l!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(p-(l-(p*t+this._elevationStart))/(1-t)),this._elevationTarget=l}this.transform.elevation=f.z.number(this._elevationStart,this._elevationTarget,t)}_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(t){if(!this.transformCameraUpdate)return;const l=t.clone(),{center:p,zoom:m,pitch:b,bearing:C,elevation:L}=this.transformCameraUpdate(l);p&&(l.center=p),m!==void 0&&(l.zoom=m),b!==void 0&&(l.pitch=b),C!==void 0&&(l.bearing=C),L!==void 0&&(l.elevation=L),this.transform.apply(l)}_fireMoveEvents(t){this.fire(new f.k("move",t)),this._zooming&&this.fire(new f.k("zoom",t)),this._rotating&&this.fire(new f.k("rotate",t)),this._pitching&&this.fire(new f.k("pitch",t))}_afterEase(t,l){if(this._easeId&&l&&this._easeId===l)return;delete this._easeId;const p=this._zooming,m=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new f.k("zoomend",t)),m&&this.fire(new f.k("rotateend",t)),b&&this.fire(new f.k("pitchend",t)),this.fire(new f.k("moveend",t))}flyTo(t,l){var p;if(!t.essential&&N.prefersReducedMotion){const bt=f.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(bt,l)}this.stop(),t=f.e({offset:[0,0],speed:1.2,curve:1.42,easing:f.b9},t);const m=this._getTransformForUpdate(),b=this.getZoom(),C=this.getBearing(),L=this.getPitch(),R=this.getPadding(),z="bearing"in t?this._normalizeBearing(t.bearing,C):C,G="pitch"in t?+t.pitch:L,q="padding"in t?t.padding:m.padding,K=f.P.convert(t.offset);let te=m.centerPoint.add(K);const se=m.pointLocation(te),{center:ue,zoom:ae}=m.getConstrained(f.N.convert(t.center||se),(p=t.zoom)!==null&&p!==void 0?p:b);this._normalizeCenter(ue);const fe=m.zoomScale(ae-b),ye=m.project(se),oe=m.project(ue).sub(ye);let Se=t.curve;const Me=Math.max(m.width,m.height),Be=Me/fe,Qe=oe.mag();if("minZoom"in t){const bt=f.ad(Math.min(t.minZoom,b,ae),m.minZoom,m.maxZoom),ri=Me/m.zoomScale(bt-b);Se=Math.sqrt(ri/Qe*2)}const ot=Se*Se;function It(bt){const ri=(Be*Be-Me*Me+(bt?-1:1)*ot*ot*Qe*Qe)/(2*(bt?Be:Me)*ot*Qe);return Math.log(Math.sqrt(ri*ri+1)-ri)}function Ct(bt){return(Math.exp(bt)-Math.exp(-bt))/2}function at(bt){return(Math.exp(bt)+Math.exp(-bt))/2}const ft=It(!1);let Nt=function(bt){return at(ft)/at(ft+Se*bt)},ai=function(bt){return Me*((at(ft)*(Ct(ri=ft+Se*bt)/at(ri))-Ct(ft))/ot)/Qe;var ri},yt=(It(!0)-ft)/Se;if(Math.abs(Qe)<1e-6||!isFinite(yt)){if(Math.abs(Me-Be)<1e-6)return this.easeTo(t,l);const bt=Be0,Nt=ri=>Math.exp(bt*Se*ri)}return t.duration="duration"in t?+t.duration:1e3*yt/("screenSpeed"in t?+t.screenSpeed/Se:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=C!==z,this._pitching=G!==L,this._padding=!m.isPaddingEqual(q),this._prepareEase(l,!1),this.terrain&&this._prepareElevation(ue),this._ease(bt=>{const ri=bt*yt,$i=1/Nt(ri);m.zoom=bt===1?ae:b+m.scaleZoom($i),this._rotating&&(m.bearing=f.z.number(C,z,bt)),this._pitching&&(m.pitch=f.z.number(L,G,bt)),this._padding&&(m.interpolatePadding(R,q,bt),te=m.centerPoint.add(K)),this.terrain&&!t.freezeElevation&&this._updateElevation(bt);const gi=bt===1?ue:m.unproject(ye.add(oe.mult(ai(ri))).mult($i));m.setLocationAtPoint(m.renderWorldCopies?gi.wrap():gi,te),this._applyUpdatedTransform(m),this._fireMoveEvents(l)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(l)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,l){var p;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,l)}return t||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(t,l,p){p.animate===!1||p.duration===0?(t(1),l()):(this._easeStart=N.now(),this._easeOptions=p,this._onEaseFrame=t,this._onEaseEnd=l,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,l){t=f.b3(t,-180,180);const p=Math.abs(t-l);return Math.abs(t-360-l)180?-360:p<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(f.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const ic={compact:!0,customAttribution:'MapLibre'};class La{constructor(t=ic){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=l=>{!l||l.sourceDataType!=="metadata"&&l.sourceDataType!=="visibility"&&l.dataType!=="style"&&l.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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=V.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=V.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=V.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(){V.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(t,l){const p=this._map._getUIString(`AttributionControl.${l}`);t.title=p,t.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const l=this._map.style.sourceCaches;for(const m in l){const b=l[m];if(b.used||b.usedForTerrain){const C=b.getSource();C.attribution&&t.indexOf(C.attribution)<0&&t.push(C.attribution)}}t=t.filter(m=>String(m).trim()),t.sort((m,b)=>m.length-b.length),t=t.filter((m,b)=>{for(let C=b+1;C=0)return!1;return!0});const p=t.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,t.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Es{constructor(t={}){this._updateCompact=()=>{const l=this._container.children;if(l.length){const p=l[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=V.create("div","maplibregl-ctrl");const l=V.create("a","maplibregl-ctrl-logo");return l.target="_blank",l.rel="noopener nofollow",l.href="https://maplibre.org/",l.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),l.setAttribute("rel","noopener nofollow"),this._container.appendChild(l),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){V.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Mt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const l=++this._id;return this._queue.push({callback:t,id:l,cancelled:!1}),l}remove(t){const l=this._currentlyRunning,p=l?this._queue.concat(l):this._queue;for(const m of p)if(m.id===t)return void(m.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const l=this._currentlyRunning=this._queue;this._queue=[];for(const p of l)if(!p.cancelled&&(p.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var lh=f.Y([{name:"a_pos3d",type:"Int16",components:3}]);class nc extends f.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,l){this.sourceCache.update(t,l),this._renderableTilesKeys=[];const p={};for(const m of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:l}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),f.aQ(m.posMatrix,0,f.X,0,f.X,0,1),this._tiles[m.key]=new gs(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(t){for(const l in this._tiles){const p=this._tiles[l];(!t||p.tileID.equals(t)||p.tileID.isChildOf(t)||t.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const l={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(t.canonical)){const b=t.clone();b.posMatrix=new Float64Array(16),f.aQ(b.posMatrix,0,f.X,0,f.X,0,1),l[p]=b}else if(m.canonical.isChildOf(t.canonical)){const b=t.clone();b.posMatrix=new Float64Array(16);const C=m.canonical.z-t.canonical.z,L=m.canonical.x-(m.canonical.x>>C<>C<>C;f.aQ(b.posMatrix,0,z,0,z,0,1),f.J(b.posMatrix,b.posMatrix,[-L*z,-R*z,0]),l[p]=b}else if(t.canonical.isChildOf(m.canonical)){const b=t.clone();b.posMatrix=new Float64Array(16);const C=t.canonical.z-m.canonical.z,L=t.canonical.x-(t.canonical.x>>C<>C<>C;f.aQ(b.posMatrix,0,f.X,0,f.X,0,1),f.J(b.posMatrix,b.posMatrix,[L*z,R*z,0]),f.K(b.posMatrix,b.posMatrix,[1/2**C,1/2**C,0]),l[p]=b}}return l}getSourceTile(t,l){const p=this.sourceCache._source;let m=t.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(t.scaledTo(m--).key);return b}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(l=>l.timeAdded>=t)}}class uh{constructor(t,l,p){this.painter=t,this.sourceCache=new nc(l),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,l,p,m=f.X){var b;if(!(l>=0&&l=0&&pt.canonical.z&&(t.canonical.z>=m?b=t.canonical.z-m:f.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=t.canonical.x-(t.canonical.x>>b<>b<>8<<4|b>>8,l[C+3]=0;const p=new f.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(l.buffer)),m=new Ie(t,p,t.gl.RGBA,{premultiply:!1});return m.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const l=new Uint8Array(4),p=this.painter.context,m=p.gl,b=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(b,L-C-1,1,1,m.RGBA,m.UNSIGNED_BYTE,l),p.bindFramebuffer.set(null);const R=l[0]+(l[2]>>4<<8),z=l[1]+((15&l[2])<<8),G=this.coordsIndex[255-l[3]],q=G&&this.sourceCache.getTileByID(G);if(!q)return null;const K=this._coordsTextureSize,te=(1<t.id!==l),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const l of this._recentlyUsed)if(!this._objects[l].inUse)return this._objects[l];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const Ts={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ch{constructor(t,l){this.painter=t,this.terrain=l,this.pool=new Sl(t.context,30,l.sourceCache.tileSize*l.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,l){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(p=>!t._layers[p].isHidden(l)),this._coordsDescendingInv={};for(const p in t.sourceCaches){this._coordsDescendingInv[p]={};const m=t.sourceCaches[p].getVisibleCoordinates();for(const b of m){const C=this.terrain.sourceCache.getTerrainCoords(b);for(const L in C)this._coordsDescendingInv[p][L]||(this._coordsDescendingInv[p][L]=[]),this._coordsDescendingInv[p][L].push(C[L])}}this._coordsDescendingInvStr={};for(const p of t._order){const m=t._layers[p],b=m.source;if(Ts[m.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const C in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][C]=this._coordsDescendingInv[b][C].map(L=>L.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[m][p.tileID.key];b&&b!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const l=t.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ts[l]&&(this._prevType&&Ts[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(t.id),!m))return!0;if(Ts[this._prevType]||Ts[l]&&m){this._prevType=l;const b=this._stacks.length-1,C=this._stacks[b]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(ta(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[b]){const z=this.pool.getObjectForId(L.rtt[b].id);if(z.stamp===L.rtt[b].stamp){this.pool.useObject(z);continue}}const R=this.pool.getOrCreateFreeObject();this.pool.useObject(R),this.pool.stampObject(R),L.rtt[b]={id:R.id,stamp:R.stamp},p.context.bindFramebuffer.set(R.fbo.framebuffer),p.context.clear({color:f.aN.transparent,stencil:0}),p.currentStencilSource=void 0;for(let z=0;z{x.touchstart=x.dragStart,x.touchmoveWindow=x.dragMove,x.touchend=x.dragEnd},sc={showCompass:!0,showZoom:!0,visualizePitch:!1};class fh{constructor(t,l,p=!1){this.mousedown=C=>{this.startMouse(f.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),V.mousePos(this.element,C)),V.addEventListener(window,"mousemove",this.mousemove),V.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,V.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=V.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),V.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),V.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=V.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 m=t.dragRotate._mouseRotate.getClickTolerance(),b=t.dragRotate._mousePitch.getClickTolerance();this.element=l,this.mouseRotate=na({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:L,bearingDegreesPerPixelMoved:R=.8})=>{const z=new ia;return new Li({clickTolerance:L,move:(G,q)=>({bearingDelta:(q.x-G.x)*R}),moveStateManager:z,enable:C,assignEvents:hh})})({clickTolerance:m,enable:!0}),this.map=t,p&&(this.mousePitch=Qr({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:L,pitchDegreesPerPixelMoved:R=-.5})=>{const z=new ia;return new Li({clickTolerance:L,move:(G,q)=>({pitchDelta:(q.y-G.y)*R}),moveStateManager:z,enable:C,assignEvents:hh})})({clickTolerance:b,enable:!0})),V.addEventListener(l,"mousedown",this.mousedown),V.addEventListener(l,"touchstart",this.touchstart,{passive:!1}),V.addEventListener(l,"touchcancel",this.reset)}startMouse(t,l){this.mouseRotate.dragStart(t,l),this.mousePitch&&this.mousePitch.dragStart(t,l),V.disableDrag()}startTouch(t,l){this.touchRotate.dragStart(t,l),this.touchPitch&&this.touchPitch.dragStart(t,l),V.disableDrag()}moveMouse(t,l){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(t,l)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(t,l)||{};b&&p.setPitch(p.getPitch()+b)}}moveTouch(t,l){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(t,l)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(t,l)||{};b&&p.setPitch(p.getPitch()+b)}}off(){const t=this.element;V.removeEventListener(t,"mousedown",this.mousedown),V.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),V.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),V.removeEventListener(window,"touchend",this.touchend),V.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){V.enableDrag(),V.removeEventListener(window,"mousemove",this.mousemove),V.removeEventListener(window,"mouseup",this.mouseup),V.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),V.removeEventListener(window,"touchend",this.touchend)}}let mo;function dh(x,t,l){const p=new f.N(x.lng,x.lat);if(x=new f.N(x.lng,x.lat),t){const m=new f.N(x.lng-360,x.lat),b=new f.N(x.lng+360,x.lat),C=l.locationPoint(x).distSqr(t);l.locationPoint(m).distSqr(t)180;){const m=l.locationPoint(x);if(m.x>=0&&m.y>=0&&m.x<=l.width&&m.y<=l.height)break;x.lng>l.center.lng?x.lng-=360:x.lng+=360}return x.lng!==p.lng&&l.locationPoint(x).y>l.height/2-l.getHorizon()?x:p}const oc={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 go(x,t,l){const p=x.classList;for(const m in oc)p.remove(`maplibregl-${l}-anchor-${m}`);p.add(`maplibregl-${l}-anchor-${t}`)}class Gi extends f.E{constructor(t){if(super(),this._onKeyPress=l=>{const p=l.code,m=l.charCode||l.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=l=>{const p=l.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=l=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((l==null?void 0:l.type)==="terrain"||(l==null?void 0:l.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?dh(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let b="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||l&&l.type!=="moveend"||(this._pos=this._pos.round()),V.setTransform(this._element,`${oc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${b}`),N.frameAsync(new AbortController).then(()=>{this._updateOpacity(l&&l.type==="moveend")}).catch(()=>{})},this._onMove=l=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=l.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=l.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 f.k("dragstart"))),this.fire(new f.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 f.k("dragend")),this._state="inactive"},this._addDragHandler=l=>{this._element.contains(l.originalEvent.target)&&(l.preventDefault(),this._positionDelta=l.point.sub(this._pos).add(this._offset),this._pointerdownPos=l.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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=f.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=V.create("div");const l=V.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;l.setAttributeNS(null,"display","block"),l.setAttributeNS(null,"height",`${p}px`),l.setAttributeNS(null,"width",`${m}px`),l.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const b=V.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"stroke","none"),b.setAttributeNS(null,"stroke-width","1"),b.setAttributeNS(null,"fill","none"),b.setAttributeNS(null,"fill-rule","evenodd");const C=V.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const L=V.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");const R=[{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 fe of R){const ye=V.createNS("http://www.w3.org/2000/svg","ellipse");ye.setAttributeNS(null,"opacity","0.04"),ye.setAttributeNS(null,"cx","10.5"),ye.setAttributeNS(null,"cy","5.80029008"),ye.setAttributeNS(null,"rx",fe.rx),ye.setAttributeNS(null,"ry",fe.ry),L.appendChild(ye)}const z=V.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);const G=V.createNS("http://www.w3.org/2000/svg","path");G.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"),z.appendChild(G);const q=V.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"fill","#000000");const K=V.createNS("http://www.w3.org/2000/svg","path");K.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"),q.appendChild(K);const te=V.createNS("http://www.w3.org/2000/svg","g");te.setAttributeNS(null,"transform","translate(6.0, 7.0)"),te.setAttributeNS(null,"fill","#FFFFFF");const se=V.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ue=V.createNS("http://www.w3.org/2000/svg","circle");ue.setAttributeNS(null,"fill","#000000"),ue.setAttributeNS(null,"opacity","0.25"),ue.setAttributeNS(null,"cx","5.5"),ue.setAttributeNS(null,"cy","5.5"),ue.setAttributeNS(null,"r","5.4999962");const ae=V.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),se.appendChild(ue),se.appendChild(ae),C.appendChild(L),C.appendChild(z),C.appendChild(q),C.appendChild(te),C.appendChild(se),l.appendChild(C),l.setAttributeNS(null,"height",p*this._scale+"px"),l.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(l),this._offset=f.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",l=>{l.preventDefault()}),this._element.addEventListener("mousedown",l=>{l.preventDefault()}),go(this._element,this._anchor,"marker"),t&&t.className)for(const l of t.className.split(" "))this._element.classList.add(l);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.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("terrain",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),V.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=f.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const m=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var l,p;if(!(!((l=this._map)===null||l===void 0)&&l.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,b=m.terrain.depthAtPoint(this._pos),C=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,C)-b<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/m.transform._pixelPerMeter,R=Math.sin(m.getPitch()*Math.PI/180)*L,z=m.terrain.depthAtPoint(new f.P(this._pos.x,this._pos.y-this._offset.y)),G=m.transform.lngLatToCameraDepth(this._lngLat,C+R)-z>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&G&&this._popup.remove(),this._element.style.opacity=G?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=f.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,l){return t===void 0&&l===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),l!==void 0&&(this._opacityWhenCovered=l),this._map&&this._updateOpacity(!0),this}}const Hl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Aa=0,Ma=!1;const ph={maxWidth:100,unit:"metric"};function ac(x,t,l){const p=l&&l.maxWidth||100,m=x._container.clientHeight/2,b=x.unproject([0,m]),C=x.unproject([p,m]),L=b.distanceTo(C);if(l&&l.unit==="imperial"){const R=3.2808*L;R>5280?Il(t,p,R/5280,x._getUIString("ScaleControl.Miles")):Il(t,p,R,x._getUIString("ScaleControl.Feet"))}else l&&l.unit==="nautical"?Il(t,p,L/1852,x._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Il(t,p,L/1e3,x._getUIString("ScaleControl.Kilometers")):Il(t,p,L,x._getUIString("ScaleControl.Meters"))}function Il(x,t,l,p){const m=function(b){const C=Math.pow(10,`${Math.floor(b)}`.length-1);let L=b/C;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(R){const z=Math.pow(10,Math.ceil(-Math.log(R)/Math.LN10));return Math.round(R*z)/z}(L),C*L}(l);x.style.width=t*(m/l)+"px",x.innerHTML=`${m} ${p}`}const Cs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Yl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Zt(x){if(x){if(typeof x=="number"){const t=Math.round(Math.abs(x)/Math.SQRT2);return{center:new f.P(0,0),top:new f.P(0,x),"top-left":new f.P(t,t),"top-right":new f.P(-t,t),bottom:new f.P(0,-x),"bottom-left":new f.P(t,-t),"bottom-right":new f.P(-t,-t),left:new f.P(x,0),right:new f.P(-x,0)}}if(x instanceof f.P||Array.isArray(x)){const t=f.P.convert(x);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:f.P.convert(x.center||[0,0]),top:f.P.convert(x.top||[0,0]),"top-left":f.P.convert(x["top-left"]||[0,0]),"top-right":f.P.convert(x["top-right"]||[0,0]),bottom:f.P.convert(x.bottom||[0,0]),"bottom-left":f.P.convert(x["bottom-left"]||[0,0]),"bottom-right":f.P.convert(x["bottom-right"]||[0,0]),left:f.P.convert(x.left||[0,0]),right:f.P.convert(x.right||[0,0])}}return Zt(new f.P(0,0))}const ti=D;I.AJAXError=f.bg,I.Evented=f.E,I.LngLat=f.N,I.MercatorCoordinate=f.Z,I.Point=f.P,I.addProtocol=f.bh,I.config=f.a,I.removeProtocol=f.bi,I.AttributionControl=La,I.BoxZoomHandler=bn,I.CanvasSource=An,I.CooperativeGesturesHandler=es,I.DoubleClickZoomHandler=$u,I.DragPanHandler=Wr,I.DragRotateHandler=$r,I.EdgeInsets=r,I.FullscreenControl=class extends f.E{constructor(x={}){super(),this._onFullscreenChange=()=>{var t;let l=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=l==null?void 0:l.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)l=l.shadowRoot.fullscreenElement;l===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,x&&x.container&&(x.container instanceof HTMLElement?this._container=x.container:f.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(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const x=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);V.create("span","maplibregl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.title=x}_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 f.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new f.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()}},I.GeoJSONSource=to,I.GeolocateControl=class extends f.E{constructor(x){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new f.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new f.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const l=new f.N(t.coords.longitude,t.coords.latitude),p=t.coords.accuracy,m=this._map.getBearing(),b=f.e({bearing:m},this.options.fitBoundsOptions),C=Ne.fromLngLat(l,p);this._map.fitBounds(C,b,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const l=new f.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(l).addTo(this._map),this._userLocationDotMarker.setLngLat(l).addTo(this._map),this._accuracy=t.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=t=>{if(this._map){if(this.options.trackUserLocation)if(t.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 l=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=l,this._geolocateButton.setAttribute("aria-label",l),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Ma)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new f.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=V.create("button","maplibregl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){f.w("Geolocation support is not available so the GeolocateControl will be disabled.");const l=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=l,this._geolocateButton.setAttribute("aria-label",l)}else{const l=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=l,this._geolocateButton.setAttribute("aria-label",l)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=V.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Gi({element:this._dotElement}),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Gi({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",l=>{l.geolocateSource||this._watchState!=="ACTIVE_LOCK"||l.originalEvent&&l.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 f.k("trackuserlocationend")),this.fire(new f.k("userlocationlostfocus")))})}},this.options=f.e({},Hl,x)}onAdd(x){return this._map=x,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return f._(this,arguments,void 0,function*(t=!1){if(mo!==void 0&&!t)return mo;if(window.navigator.permissions===void 0)return mo=!!window.navigator.geolocation,mo;try{mo=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{mo=!!window.navigator.geolocation}return mo})}().then(t=>this._finishSetupUI(t)),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(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Aa=0,Ma=!1}_isOutOfMapMaxBounds(x){const t=this._map.getMaxBounds(),l=x.coords;return t&&(l.longitudet.getEast()||l.latitudet.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 x=this._map.getBounds(),t=x.getSouthEast(),l=x.getNorthEast(),p=t.distanceTo(l),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return f.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 f.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Aa--,Ma=!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 f.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 f.k("trackuserlocationstart")),this.fire(new f.k("userlocationfocus"));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 x;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Aa++,Aa>1?(x={maximumAge:6e5,timeout:0},Ma=!0):(x=this.options.positionOptions,Ma=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,x)}}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)}},I.Hash=E,I.ImageSource=Kr,I.KeyboardHandler=Ku,I.LngLatBounds=Ne,I.LogoControl=Es,I.Map=class extends Vf{constructor(x){f.be.mark(f.bf.create);const t=Object.assign(Object.assign({},qf),x);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new u(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Mt,this._controls=[],this._mapId=f.a4(),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new f.k("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new f.k("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},kt),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ke.addThrottleControl(()=>this.isMoving()),this._requestManager=new Re(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1;const p=y(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{l?p(m):l=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Uf(this,t),this._hash=t.hash&&new E(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,f.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new La(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Es,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new f.k(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new f.k(`${l.dataType}dataloading`,l))}),this.on("dataabort",l=>{this.fire(new f.k("sourcedataabort",l))})}_getMapId(){return this._mapId}addControl(x,t){if(t===void 0&&(t=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.onAdd)return this.fire(new f.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const l=x.onAdd(this);this._controls.push(x);const p=this._controlPositions[t];return t.indexOf("bottom")!==-1?p.insertBefore(l,p.firstChild):p.appendChild(l),this}removeControl(x){if(!x||!x.onRemove)return this.fire(new f.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(x);return t>-1&&this._controls.splice(t,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}calculateCameraOptionsFromTo(x,t,l,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(l,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(x,t,l,p)}resize(x){var t;const l=this._containerDimensions(),p=l[0],m=l[1],b=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,b),this.painter.resize(p,m,b),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const R=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,R),this.painter.resize(p,m,R)}this.transform.resize(p,m),(t=this._requestedCameraState)===null||t===void 0||t.resize(p,m);const C=!this._moving;return C&&(this.stop(),this.fire(new f.k("movestart",x)).fire(new f.k("move",x))),this.fire(new f.k("resize",x)),C&&this.fire(new f.k("moveend",x)),this}_getClampedPixelRatio(x,t){const{0:l,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),b=x*m,C=t*m;return Math.min(b>l?l/b:1,C>p?p/C:1)*m}getPixelRatio(){var x;return(x=this._overridePixelRatio)!==null&&x!==void 0?x:devicePixelRatio}setPixelRatio(x){this._overridePixelRatio=x,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(x){return this.transform.setMaxBounds(Ne.convert(x)),this._update()}setMinZoom(x){if((x=x??-2)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x&&this.setZoom(x),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x&&this.setPitch(x),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this._update()}project(x){return this.transform.locationPoint(f.N.convert(x),this.style&&this.terrain)}unproject(x){return this.transform.pointLocation(f.P.convert(x),this.terrain)}isMoving(){var x;return this._moving||((x=this.handlers)===null||x===void 0?void 0:x.isMoving())}isZooming(){var x;return this._zooming||((x=this.handlers)===null||x===void 0?void 0:x.isZooming())}isRotating(){var x;return this._rotating||((x=this.handlers)===null||x===void 0?void 0:x.isRotating())}_createDelegatedListener(x,t,l){if(x==="mouseenter"||x==="mouseover"){let p=!1;return{layer:t,listener:l,delegates:{mousemove:b=>{const C=this.getLayer(t)?this.queryRenderedFeatures(b.point,{layers:[t]}):[];C.length?p||(p=!0,l.call(this,new tt(x,this,b.originalEvent,{features:C}))):p=!1},mouseout:()=>{p=!1}}}}if(x==="mouseleave"||x==="mouseout"){let p=!1;return{layer:t,listener:l,delegates:{mousemove:C=>{(this.getLayer(t)?this.queryRenderedFeatures(C.point,{layers:[t]}):[]).length?p=!0:p&&(p=!1,l.call(this,new tt(x,this,C.originalEvent)))},mouseout:C=>{p&&(p=!1,l.call(this,new tt(x,this,C.originalEvent)))}}}}{const p=m=>{const b=this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[];b.length&&(m.features=b,l.call(this,m),delete m.features)};return{layer:t,listener:l,delegates:{[x]:p}}}}on(x,t,l){if(l===void 0)return super.on(x,t);const p=this._createDelegatedListener(x,t,l);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(x,t,l){if(l===void 0)return super.once(x,t);const p=this._createDelegatedListener(x,t,l);for(const m in p.delegates)this.once(m,p.delegates[m]);return this}off(x,t,l){return l===void 0?super.off(x,t):(this._delegatedListeners&&this._delegatedListeners[x]&&(p=>{const m=this._delegatedListeners[x];for(let b=0;bthis._updateStyle(x,t));const l=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!x)),x?(this.style=new qr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x,t,l):this.style.loadJSON(x,t,l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new qr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,t){if(typeof x=="string"){const l=this._requestManager.transformRequest(x,"Style");f.h(l,new AbortController).then(p=>{this._updateDiff(p.data,t)}).catch(p=>{p&&this.fire(new f.j(p))})}else typeof x=="object"&&this._updateDiff(x,t)}_updateDiff(x,t){try{this.style.setState(x,t)&&this._update(!0)}catch(l){f.w(`Unable to perform style diff: ${l.message||l.error||l}. Rebuilding the style from scratch.`),this._updateStyle(x,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():f.w("There is no style added to the map.")}addSource(x,t){return this._lazyInitEmptyStyle(),this.style.addSource(x,t),this._update(!0)}isSourceLoaded(x){const t=this.style&&this.style.sourceCaches[x];if(t!==void 0)return t.loaded();this.fire(new f.j(new Error(`There is no source with ID '${x}'`)))}setTerrain(x){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),x){const t=this.style.sourceCaches[x.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${x.source}`);this.terrain===null&&t.reload();for(const l in this.style._layers){const p=this.style._layers[l];p.type==="hillshade"&&p.source===x.source&&f.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 uh(this.painter,t,x),this.painter.renderToTexture=new ch(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=l=>{l.dataType==="style"?this.terrain.sourceCache.freeRtt():l.dataType==="source"&&l.tile&&(l.sourceId!==x.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(l.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 f.k("terrain",{terrain:x})),this}getTerrain(){var x,t;return(t=(x=this.terrain)===null||x===void 0?void 0:x.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const x=this.style&&this.style.sourceCaches;for(const t in x){const l=x[t]._tiles;for(const p in l){const m=l[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(x){return this.style.removeSource(x),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,t,l={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:b,stretchY:C,content:L,textFitWidth:R,textFitHeight:z}=l;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||f.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new f.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:G,height:q,data:K}=t,te=t;return this.style.addImage(x,{data:new f.R({width:G,height:q},new Uint8Array(K)),pixelRatio:p,stretchX:b,stretchY:C,content:L,textFitWidth:R,textFitHeight:z,sdf:m,version:0,userImage:te}),te.onAdd&&te.onAdd(this,x),this}}{const{width:G,height:q,data:K}=N.getImageData(t);this.style.addImage(x,{data:new f.R({width:G,height:q},K),pixelRatio:p,stretchX:b,stretchY:C,content:L,textFitWidth:R,textFitHeight:z,sdf:m,version:0})}}updateImage(x,t){const l=this.style.getImage(x);if(!l)return this.fire(new f.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=t instanceof HTMLImageElement||f.b(t)?N.getImageData(t):t,{width:m,height:b,data:C}=p;if(m===void 0||b===void 0)return this.fire(new f.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==l.data.width||b!==l.data.height)return this.fire(new f.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(t instanceof HTMLImageElement||f.b(t));return l.data.replace(C,L),this.style.updateImage(x,l),this}getImage(x){return this.style.getImage(x)}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new f.j(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x){return ke.getImage(this._requestManager.transformRequest(x,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(x,t){return this._lazyInitEmptyStyle(),this.style.addLayer(x,t),this._update(!0)}moveLayer(x,t){return this.style.moveLayer(x,t),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(x,t,l){return this.style.setLayerZoomRange(x,t,l),this._update(!0)}setFilter(x,t,l={}){return this.style.setFilter(x,t,l),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,t,l,p={}){return this.style.setPaintProperty(x,t,l,p),this._update(!0)}getPaintProperty(x,t){return this.style.getPaintProperty(x,t)}setLayoutProperty(x,t,l,p={}){return this.style.setLayoutProperty(x,t,l,p),this._update(!0)}getLayoutProperty(x,t){return this.style.getLayoutProperty(x,t)}setGlyphs(x,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(x,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(x,t,l={}){return this._lazyInitEmptyStyle(),this.style.addSprite(x,t,l,p=>{p||this._update(!0)}),this}removeSprite(x){return this._lazyInitEmptyStyle(),this.style.removeSprite(x),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(x,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(x,t,l=>{l||this._update(!0)}),this}setLight(x,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(x){return this._lazyInitEmptyStyle(),this.style.setSky(x),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(x,t){return this.style.setFeatureState(x,t),this._update()}removeFeatureState(x,t){return this.style.removeFeatureState(x,t),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let x=0,t=0;return this._container&&(x=this._container.clientWidth||400,t=this._container.clientHeight||300),[x,t]}_setupContainer(){const x=this._container;x.classList.add("maplibregl-map");const t=this._canvasContainer=V.create("div","maplibregl-canvas-container",x);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=V.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const l=this._containerDimensions(),p=this._getClampedPixelRatio(l[0],l[1]);this._resizeCanvas(l[0],l[1],p);const m=this._controlContainer=V.create("div","maplibregl-control-container",x),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{b[C]=V.create("div",`maplibregl-ctrl-${C} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,t,l){this._canvas.width=Math.floor(l*x),this._canvas.height=Math.floor(l*t),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const x={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{t={requestedAttributes:x},p&&(t.statusMessage=p.statusMessage,t.type=p.type)},{once:!0});const l=this._canvas.getContext("webgl2",x)||this._canvas.getContext("webgl",x);if(!l){const p="Failed to initialize WebGL";throw t?(t.message=p,new Error(JSON.stringify(t))):new Error(p)}this.painter=new mr(l,this.transform),Q.testSupport(l)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_render(x){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(x),this._removed)return;let l=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,b=N.now();this.style.zoomHistory.update(m,b);const C=new f.a9(m,{now:b,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=C.crossFadingFactor();L===1&&L===this._crossFadingFactor||(l=!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,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new f.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,f.be.mark(f.bf.load),this.fire(new f.k("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new f.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,f.be.mark(f.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var x;this._hash&&this._hash.remove();for(const l of this._controls)l.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),ke.removeThrottleControl(this._imageQueueHandle),(x=this._resizeObserver)===null||x===void 0||x.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),f.be.clearMetrics(),this._removed=!0,this.fire(new f.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then(x=>{f.be.frame(x),this._frameRequest=null,this._render(x)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get version(){return rc}getCameraTargetElevation(){return this.transform.elevation}},I.MapMouseEvent=tt,I.MapTouchEvent=Yt,I.MapWheelEvent=ni,I.Marker=Gi,I.NavigationControl=class{constructor(x){this._updateZoomButtons=()=>{const t=this._map.getZoom(),l=t===this._map.getMaxZoom(),p=t===this._map.getMinZoom();this._zoomInButton.disabled=l,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",l.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const t=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=t},this._setButtonTitle=(t,l)=>{const p=this._map._getUIString(`NavigationControl.${l}`);t.title=p,t.setAttribute("aria-label",p)},this.options=f.e({},sc,x),this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),V.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),V.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=V.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(x){return this._map=x,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 fh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.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(x,t){const l=V.create("button",x,this._container);return l.type="button",l.addEventListener("click",t),l}},I.Popup=class extends f.E{constructor(x){super(),this.remove=()=>(this._content&&V.remove(this._content),this._container&&(V.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 f.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var l;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=V.create("div","maplibregl-popup",this._map.getContainer()),this._tip=V.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._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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?dh(this._lngLat,this._flatPos,this._map.transform):(l=this._lngLat)===null||l===void 0?void 0:l.wrap(),this._trackPointer&&!t)return;const p=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const b=Zt(this.options.offset);if(!m){const L=this._container.offsetWidth,R=this._container.offsetHeight;let z;z=p.y+b.bottom.ythis._map.transform.height-R?["bottom"]:[],p.xthis._map.transform.width-L/2&&z.push("right"),m=z.length===0?"bottom":z.join("-")}let C=p.add(b[m]);this.options.subpixelPositioning||(C=C.round()),V.setTransform(this._container,`${oc[m]} translate(${C.x}px,${C.y}px)`),go(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=f.e(Object.create(Cs),x)}addTo(x){return this._map&&this.remove(),this._map=x,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 f.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(x){return this._lngLat=f.N.convert(x),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(x){return this.setDOMContent(document.createTextNode(x))}setHTML(x){const t=document.createDocumentFragment(),l=document.createElement("body");let p;for(l.innerHTML=x;p=l.firstChild,p;)t.appendChild(p);return this.setDOMContent(t)}getMaxWidth(){var x;return(x=this._container)===null||x===void 0?void 0:x.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=V.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(x),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(x){return this._container&&this._container.classList.add(x),this}removeClassName(x){return this._container&&this._container.classList.remove(x),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){if(this._container)return this._container.classList.toggle(x)}setSubpixelPositioning(x){this.options.subpixelPositioning=x}_createCloseButton(){this.options.closeButton&&(this._closeButton=V.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const x=this._container.querySelector(Yl);x&&x.focus()}},I.RasterDEMTileSource=Ki,I.RasterTileSource=Je,I.ScaleControl=class{constructor(x){this._onMove=()=>{ac(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ac(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ph),x)}getDefaultPosition(){return"bottom-left"}onAdd(x){return this._map=x,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-scale",x.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},I.ScrollZoomHandler=Qu,I.Style=qr,I.TerrainControl=class{constructor(x){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=x}onAdd(x){return this._map=x,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain",this._container),V.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(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},I.TwoFingersTouchPitchHandler=Yu,I.TwoFingersTouchRotateHandler=Hu,I.TwoFingersTouchZoomHandler=Wu,I.TwoFingersTouchZoomRotateHandler=ec,I.VectorTileSource=Hn,I.VideoSource=hi,I.addSourceType=(x,t)=>f._(void 0,void 0,void 0,function*(){if(zs(x))throw new Error(`A source type called "${x}" already exists.`);((l,p)=>{ms[l]=p})(x,t)}),I.clearPrewarmedResources=function(){const x=vt;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(et),vt=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()"))},I.getMaxParallelImageRequests=function(){return f.a.MAX_PARALLEL_IMAGE_REQUESTS},I.getRTLTextPluginStatus=function(){return ei().getRTLTextPluginStatus()},I.getVersion=function(){return ti},I.getWorkerCount=function(){return Ot.workerCount},I.getWorkerUrl=function(){return f.a.WORKER_URL},I.importScriptInWorkers=function(x){return _t().broadcast("IS",x)},I.prewarm=function(){vi().acquire(et)},I.setMaxParallelImageRequests=function(x){f.a.MAX_PARALLEL_IMAGE_REQUESTS=x},I.setRTLTextPlugin=function(x,t){return ei().setRTLTextPlugin(x,t)},I.setWorkerCount=function(x){Ot.workerCount=x},I.setWorkerUrl=function(x){f.a.WORKER_URL=x}});var k=c;return k})})(Yv);var aw=Yv.exports;const fs=ow(aw);function ay(s){let o;return c=>{if(c)for(let d in c){let _=o==null?void 0:o[d],k=c[d];_!==k&&s(d,k,_)}else if(o)for(let d in o)s(d,void 0,o[d]);o=c}}function lw(s,...o){let c=[s];for(let d of o)if(d)Array.isArray(d)&&d[0]===s?c.push(...d.slice(1)):c.push(d);else continue;if(c.length!==1)return c.length===2?c[1]:c}function uw(s){return s===!0?["has","point_count"]:s===!1?["!",["has","point_count"]]:void 0}function of(s,o){return["case",["boolean",["feature-state","hover"],!1],o,s]}var Hc=cw;function cw(s){var o,c,d;if(s){if(Array.isArray(s)){for(o=[],c=s.length,d=0;d{d=null}),ps())},i(_){c||(Dt(d),c=!0)},o(_){Xt(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function fw(s,o,c){let d,_,k,I,f,D,F,j,N,V,Q,re,{$$slots:Ae={},$$scope:xe}=o,{id:Te=eh("layer")}=o,{source:Ce=void 0}=o,{sourceLayer:ke=void 0}=o,{beforeId:Re=void 0}=o,{beforeLayerType:ze=void 0}=o,{type:Oe}=o,{paint:Ze=void 0}=o,{layout:je=void 0}=o,{filter:He=void 0}=o,{applyToClusters:pt=void 0}=o,{minzoom:Ie=void 0}=o,{maxzoom:Pt=void 0}=o,{manageHoverState:st=!1}=o,{hovered:Ue=null}=o,{interactive:lt=!0}=o,{hoverCursor:Lt=void 0}=o,{eventsIfTopMost:ct=!1}=o;const Qt=Mf(),{map:ii,source:nt,self:Ft,minzoom:jt,maxzoom:qt,eventTopMost:et,layerInfo:Ot}=nw();Pn(s,ii,be=>c(31,N=be)),Pn(s,nt,be=>c(32,V=be)),Pn(s,Ft,be=>c(0,j=be)),Pn(s,jt,be=>c(34,re=be)),Pn(s,qt,be=>c(33,Q=be)),Ro(()=>{j&&N&&(Ot.delete(j),N==null||N.removeLayer(j))});let mt;function vt(be){var Yi,Hn;if(!lt||!j||!N||ct&&et(be)!==j)return;let Rt=be.features??[],Ke=(Hn=(Yi=Rt[0])==null?void 0:Yi.properties)==null?void 0:Hn.cluster_id,Ne={event:be,map:N,clusterId:Ke,layer:j,source:f,features:Rt};Qt(be.type,Ne)}function _e(be){var Yi,Hn;if(!lt||!j||!N||ct&&et(be)!==j)return;Lt&&(N.getCanvas().style.cursor=Lt);let Rt=be.features??[];c(6,Ue=Rt[0]??null);let Ke=(Hn=(Yi=Rt[0])==null?void 0:Yi.properties)==null?void 0:Hn.cluster_id;Qt("mouseenter",{event:be,map:N,clusterId:Ke,layer:j,source:f,features:Rt})}function vi(be){var Yi,Hn,Je;if(!lt||!N)return;if(ct&&et(be)!==j){c(6,Ue=null),st&&mt!==void 0&&(N==null||N.setFeatureState({source:f,sourceLayer:ke,id:mt},{hover:!1}),mt=void 0);return}N.getCanvas().style.cursor=Lt;let Rt=be.features??[],Ke=(Hn=(Yi=Rt[0])==null?void 0:Yi.properties)==null?void 0:Hn.cluster_id,Ne=(Je=Rt[0])==null?void 0:Je.id;Ne!==mt&&(st&&(mt!==void 0&&(N==null||N.setFeatureState({source:f,id:mt,sourceLayer:ke},{hover:!1})),N==null||N.setFeatureState({source:f,id:Ne,sourceLayer:ke},{hover:!0})),mt=Ne,c(6,Ue=Rt[0]??null)),Qt("mousemove",{event:be,map:N,clusterId:Ke,layer:j,source:f,features:Rt})}function Kt(be){if(!(!lt||!j||!N)){if(Lt&&(N.getCanvas().style.cursor=""),c(6,Ue=null),st&&mt!==void 0){const Rt={source:f,id:mt,sourceLayer:ke};N==null||N.setFeatureState(Rt,{hover:!1}),mt=void 0}Qt("mouseleave",{map:N,layer:j,source:f})}}let _t=!0;function he(be){N&&(N.off("click",be,vt),N.off("dblclick",be,vt),N.off("contextmenu",be,vt),N.off("mouseenter",be,_e),N.off("mousemove",be,vi),N.off("mouseleave",be,Kt))}return Ro(()=>{N&&j&&he(j)}),s.$$set=be=>{"id"in be&&c(7,Te=be.id),"source"in be&&c(8,Ce=be.source),"sourceLayer"in be&&c(9,ke=be.sourceLayer),"beforeId"in be&&c(10,Re=be.beforeId),"beforeLayerType"in be&&c(11,ze=be.beforeLayerType),"type"in be&&c(12,Oe=be.type),"paint"in be&&c(13,Ze=be.paint),"layout"in be&&c(14,je=be.layout),"filter"in be&&c(15,He=be.filter),"applyToClusters"in be&&c(16,pt=be.applyToClusters),"minzoom"in be&&c(17,Ie=be.minzoom),"maxzoom"in be&&c(18,Pt=be.maxzoom),"manageHoverState"in be&&c(19,st=be.manageHoverState),"hovered"in be&&c(6,Ue=be.hovered),"interactive"in be&&c(20,lt=be.interactive),"hoverCursor"in be&&c(21,Lt=be.hoverCursor),"eventsIfTopMost"in be&&c(22,ct=be.eventsIfTopMost),"$$scope"in be&&c(35,xe=be.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&65536&&c(30,d=uw(pt)),s.$$.dirty[0]&1073774592&&c(24,_=lw("all",d,He)),s.$$.dirty[0]&131072|s.$$.dirty[1]&8&&c(26,k=Ie??re),s.$$.dirty[0]&262144|s.$$.dirty[1]&4&&c(25,I=Pt??Q),s.$$.dirty[0]&256|s.$$.dirty[1]&2&&c(29,f=Ce||V),s.$$.dirty[0]&654343809|s.$$.dirty[1]&1&&N&&j!==Te&&f){j&&(he(j),Ot.delete(j));let be=Re;if(!Re&&ze){let Rt=N.getStyle().layers,Ke=typeof ze=="function"?ze:Yi=>Yi.type===ze,Ne=Rt==null?void 0:Rt.find(Ke);Ne&&(be=Ne.id)}Co(Ft,j=Te,j),N.addLayer(Hc({id:j,type:Oe,source:f,"source-layer":ke,filter:_,paint:Ze,layout:je,minzoom:k,maxzoom:I}),be),c(23,_t=!0),N.on("click",j,vt),N.on("dblclick",j,vt),N.on("contextmenu",j,vt),N.on("mouseenter",j,_e),N.on("mousemove",j,vi),N.on("mouseleave",j,Kt)}s.$$.dirty[0]&1048577&&j&&Ot.set(j,{interactive:lt}),s.$$.dirty[0]&1|s.$$.dirty[1]&1&&c(28,D=j?ay((be,Rt)=>N==null?void 0:N.setPaintProperty(j,be,Rt)):void 0),s.$$.dirty[0]&1|s.$$.dirty[1]&1&&c(27,F=j?ay((be,Rt)=>N==null?void 0:N.setLayoutProperty(j,be,Rt)):void 0),s.$$.dirty[0]&268443648&&(D==null||D(Ze)),s.$$.dirty[0]&134234112&&(F==null||F(je)),s.$$.dirty[0]&100663297|s.$$.dirty[1]&1&&j&&(N==null||N.setLayerZoomRange(j,k,I)),s.$$.dirty[0]&25165825|s.$$.dirty[1]&1&&j&&(_t?c(23,_t=!1):N==null||N.setFilter(j,_))},[j,ii,nt,Ft,jt,qt,Ue,Te,Ce,ke,Re,ze,Oe,Ze,je,He,pt,Ie,Pt,st,lt,Lt,ct,_t,_,I,k,F,D,f,d,N,V,Q,re,xe,Ae]}class Jv extends qn{constructor(o){super(),Vn(this,o,fw,hw,gn,{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 dw(s){let o;const c=s[15].default,d=Po(c,s,s[23],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&8388608)&&Ao(d,c,_,_[23],o?Lo(c,_[23],k,null):Mo(_[23]),null)},i(_){o||(Dt(d,_),o=!0)},o(_){Xt(d,_),o=!1},d(_){d&&d.d(_)}}}function pw(s){let o,c,d;function _(I){s[16](I)}let k={id:s[1],type:"fill",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],minzoom:s[9],maxzoom:s[10],hoverCursor:s[11],manageHoverState:s[12],eventsIfTopMost:s[13],interactive:s[14],$$slots:{default:[dw]},$$scope:{ctx:s}};return s[0]!==void 0&&(k.hovered=s[0]),o=new Jv({props:k}),pa.push(()=>Df(o,"hovered",_)),o.$on("click",s[17]),o.$on("dblclick",s[18]),o.$on("contextmenu",s[19]),o.$on("mouseenter",s[20]),o.$on("mousemove",s[21]),o.$on("mouseleave",s[22]),{c(){rn(o.$$.fragment)},m(I,f){Wi(o,I,f),d=!0},p(I,[f]){const D={};f&2&&(D.id=I[1]),f&4&&(D.source=I[2]),f&8&&(D.sourceLayer=I[3]),f&16&&(D.beforeId=I[4]),f&32&&(D.beforeLayerType=I[5]),f&64&&(D.paint=I[6]),f&128&&(D.layout=I[7]),f&256&&(D.filter=I[8]),f&512&&(D.minzoom=I[9]),f&1024&&(D.maxzoom=I[10]),f&2048&&(D.hoverCursor=I[11]),f&4096&&(D.manageHoverState=I[12]),f&8192&&(D.eventsIfTopMost=I[13]),f&16384&&(D.interactive=I[14]),f&8388608&&(D.$$scope={dirty:f,ctx:I}),!c&&f&1&&(c=!0,D.hovered=I[0],Rf(()=>c=!1)),o.$set(D)},i(I){d||(Dt(o.$$.fragment,I),d=!0)},o(I){Xt(o.$$.fragment,I),d=!1},d(I){Xi(o,I)}}}function mw(s,o,c){let{$$slots:d={},$$scope:_}=o,{id:k=eh("fill")}=o,{source:I=void 0}=o,{sourceLayer:f=void 0}=o,{beforeId:D=void 0}=o,{beforeLayerType:F=void 0}=o,{paint:j}=o,{layout:N=void 0}=o,{filter:V=void 0}=o,{minzoom:Q=void 0}=o,{maxzoom:re=void 0}=o,{hoverCursor:Ae=void 0}=o,{manageHoverState:xe=!1}=o,{hovered:Te=null}=o,{eventsIfTopMost:Ce=!1}=o,{interactive:ke=!0}=o;function Re(Ie){Te=Ie,c(0,Te)}function ze(Ie){cs.call(this,s,Ie)}function Oe(Ie){cs.call(this,s,Ie)}function Ze(Ie){cs.call(this,s,Ie)}function je(Ie){cs.call(this,s,Ie)}function He(Ie){cs.call(this,s,Ie)}function pt(Ie){cs.call(this,s,Ie)}return s.$$set=Ie=>{"id"in Ie&&c(1,k=Ie.id),"source"in Ie&&c(2,I=Ie.source),"sourceLayer"in Ie&&c(3,f=Ie.sourceLayer),"beforeId"in Ie&&c(4,D=Ie.beforeId),"beforeLayerType"in Ie&&c(5,F=Ie.beforeLayerType),"paint"in Ie&&c(6,j=Ie.paint),"layout"in Ie&&c(7,N=Ie.layout),"filter"in Ie&&c(8,V=Ie.filter),"minzoom"in Ie&&c(9,Q=Ie.minzoom),"maxzoom"in Ie&&c(10,re=Ie.maxzoom),"hoverCursor"in Ie&&c(11,Ae=Ie.hoverCursor),"manageHoverState"in Ie&&c(12,xe=Ie.manageHoverState),"hovered"in Ie&&c(0,Te=Ie.hovered),"eventsIfTopMost"in Ie&&c(13,Ce=Ie.eventsIfTopMost),"interactive"in Ie&&c(14,ke=Ie.interactive),"$$scope"in Ie&&c(23,_=Ie.$$scope)},[Te,k,I,f,D,F,j,N,V,Q,re,Ae,xe,Ce,ke,d,Re,ze,Oe,Ze,je,He,pt,_]}class Qv extends qn{constructor(o){super(),Vn(this,o,mw,pw,gn,{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 gw(s,o,c){let d;const{map:_}=Ol();Pn(s,_,D=>c(4,d=D));let{position:k="top-left"}=o,{container:I=void 0}=o,f=null;return Ro(()=>{d!=null&&d.loaded()&&f&&d.removeControl(f)}),s.$$set=D=>{"position"in D&&c(1,k=D.position),"container"in D&&c(2,I=D.container)},s.$$.update=()=>{if(s.$$.dirty&30&&d&&!f){let D;typeof I=="string"?D=document.querySelector(I)??void 0:D=I,c(3,f=new fs.FullscreenControl({container:D})),d.addControl(f,k)}},[_,k,I,f,d]}class yw extends qn{constructor(o){super(),Vn(this,o,gw,null,gn,{position:1,container:2})}}function $v(s,o,c,d,_){let k=!1;s.getSource(o)&&(k=!0,s.removeSource(o));const I=()=>{d(o)&&(s.addSource(o,c),_())};if(k){const f=()=>{o&&(s.getSource(o)?setTimeout(f,1):I())};f()}else I()}function e0(s,o,c){Gb().then(()=>{let d=Nb(s);if(!d)return;d.getSource(o)===c&&d.removeSource(o)})}function cy(s){let o=s[0],c,d,_=hy(s);return{c(){_.c(),c=Yr()},m(k,I){_.m(k,I),Tt(k,c,I),d=!0},p(k,I){I&1&&gn(o,o=k[0])?(ds(),Xt(_,1,1,Un),ps(),_=hy(k),_.c(),Dt(_,1),_.m(c.parentNode,c)):_.p(k,I)},i(k){d||(Dt(_),d=!0)},o(k){Xt(_),d=!1},d(k){k&&St(c),_.d(k)}}}function hy(s){let o;const c=s[19].default,d=Po(c,s,s[18],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&262144)&&Ao(d,c,_,_[18],o?Lo(c,_[18],k,null):Mo(_[18]),null)},i(_){o||(Dt(d,_),o=!0)},o(_){Xt(d,_),o=!1},d(_){d&&d.d(_)}}}function _w(s){let o,c,d=s[0]&&cy(s);return{c(){d&&d.c(),o=Yr()},m(_,k){d&&d.m(_,k),Tt(_,o,k),c=!0},p(_,[k]){_[0]?d?(d.p(_,k),k&1&&Dt(d,1)):(d=cy(_),d.c(),Dt(d,1),d.m(o.parentNode,o)):d&&(ds(),Xt(d,1,1,()=>{d=null}),ps())},i(_){c||(Dt(d),c=!0)},o(_){Xt(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function vw(s,o,c){let d,_,k,{$$slots:I={},$$scope:f}=o,{id:D=eh("geojson")}=o,{data:F}=o,{generateId:j=!1}=o,{promoteId:N=void 0}=o,{filter:V=void 0}=o,{lineMetrics:Q=void 0}=o,{cluster:re=void 0}=o,{maxzoom:Ae=void 0}=o,{attribution:xe=void 0}=o,{buffer:Te=void 0}=o,{tolerance:Ce=void 0}=o;const{map:ke,cluster:Re,self:ze}=Hv();Pn(s,ke,je=>c(17,_=je)),Pn(s,Re,je=>c(20,k=je)),Pn(s,ze,je=>c(0,d=je));let Oe,Ze=!0;return Ro(()=>{d&&Oe&&_&&(e0(ke,d,Oe),Co(ze,d=null,d),c(15,Oe=void 0))}),s.$$set=je=>{"id"in je&&c(4,D=je.id),"data"in je&&c(5,F=je.data),"generateId"in je&&c(6,j=je.generateId),"promoteId"in je&&c(7,N=je.promoteId),"filter"in je&&c(8,V=je.filter),"lineMetrics"in je&&c(9,Q=je.lineMetrics),"cluster"in je&&c(10,re=je.cluster),"maxzoom"in je&&c(11,Ae=je.maxzoom),"attribution"in je&&c(12,xe=je.attribution),"buffer"in je&&c(13,Te=je.buffer),"tolerance"in je&&c(14,Ce=je.tolerance),"$$scope"in je&&c(18,f=je.$$scope)},s.$$.update=()=>{s.$$.dirty&1024&&Co(Re,k=re,k),s.$$.dirty&196593&&_&&d!==D&&(Co(ze,d=D,d),$v(_,d,Hc({type:"geojson",data:F,filter:V,lineMetrics:Q,generateId:j,promoteId:N,cluster:!!re,clusterMinPoints:re==null?void 0:re.minPoints,clusterMaxZoom:re==null?void 0:re.maxZoom,clusterRadius:re==null?void 0:re.radius,clusterProperties:re==null?void 0:re.properties,maxzoom:Ae,attribution:xe,buffer:Te,tolerance:Ce}),je=>_&&je===d,()=>{d&&(c(15,Oe=_==null?void 0:_.getSource(d)),c(16,Ze=!0))})),s.$$.dirty&131088&&(_==null||_.on("style.load",()=>{c(15,Oe=_==null?void 0:_.getSource(D))})),s.$$.dirty&98336&&Oe&&(Ze?c(16,Ze=!1):Oe.setData(F)),s.$$.dirty&33792&&(Oe==null||Oe.setClusterOptions(Hc({cluster:!!re,clusterMaxZoom:re==null?void 0:re.maxZoom,clusterRadius:re==null?void 0:re.radius})))},[d,ke,Re,ze,D,F,j,N,V,Q,re,Ae,xe,Te,Ce,Oe,Ze,_,f,I]}class Gp extends qn{constructor(o){super(),Vn(this,o,vw,_w,gn,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}}function xw(s,o,c){let d;const{map:_}=Ol();Pn(s,_,V=>c(8,d=V));let{position:k="top-left"}=o,{positionOptions:I=void 0}=o,{fitBoundsOptions:f=void 0}=o,{trackUserLocation:D=!1}=o,{showAccuracyCircle:F=!0}=o,{showUserLocation:j=!0}=o,{control:N=null}=o;return Ro(()=>{d!=null&&d.loaded()&&N&&d.removeControl(N)}),s.$$set=V=>{"position"in V&&c(2,k=V.position),"positionOptions"in V&&c(3,I=V.positionOptions),"fitBoundsOptions"in V&&c(4,f=V.fitBoundsOptions),"trackUserLocation"in V&&c(5,D=V.trackUserLocation),"showAccuracyCircle"in V&&c(6,F=V.showAccuracyCircle),"showUserLocation"in V&&c(7,j=V.showUserLocation),"control"in V&&c(1,N=V.control)},s.$$.update=()=>{s.$$.dirty&510&&d&&!N&&(c(1,N=new fs.GeolocateControl({positionOptions:I,fitBoundsOptions:f,trackUserLocation:D,showAccuracyCircle:F,showUserLocation:j})),d.addControl(N,k))},[_,N,k,I,f,D,F,j,d]}class bw extends qn{constructor(o){super(),Vn(this,o,xw,null,gn,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function ww(s){let o;const c=s[15].default,d=Po(c,s,s[23],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&8388608)&&Ao(d,c,_,_[23],o?Lo(c,_[23],k,null):Mo(_[23]),null)},i(_){o||(Dt(d,_),o=!0)},o(_){Xt(d,_),o=!1},d(_){d&&d.d(_)}}}function kw(s){let o,c,d;function _(I){s[16](I)}let k={id:s[1],type:"line",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],minzoom:s[9],maxzoom:s[10],hoverCursor:s[11],manageHoverState:s[12],eventsIfTopMost:s[13],interactive:s[14],$$slots:{default:[ww]},$$scope:{ctx:s}};return s[0]!==void 0&&(k.hovered=s[0]),o=new Jv({props:k}),pa.push(()=>Df(o,"hovered",_)),o.$on("click",s[17]),o.$on("dblclick",s[18]),o.$on("contextmenu",s[19]),o.$on("mouseenter",s[20]),o.$on("mousemove",s[21]),o.$on("mouseleave",s[22]),{c(){rn(o.$$.fragment)},m(I,f){Wi(o,I,f),d=!0},p(I,[f]){const D={};f&2&&(D.id=I[1]),f&4&&(D.source=I[2]),f&8&&(D.sourceLayer=I[3]),f&16&&(D.beforeId=I[4]),f&32&&(D.beforeLayerType=I[5]),f&64&&(D.paint=I[6]),f&128&&(D.layout=I[7]),f&256&&(D.filter=I[8]),f&512&&(D.minzoom=I[9]),f&1024&&(D.maxzoom=I[10]),f&2048&&(D.hoverCursor=I[11]),f&4096&&(D.manageHoverState=I[12]),f&8192&&(D.eventsIfTopMost=I[13]),f&16384&&(D.interactive=I[14]),f&8388608&&(D.$$scope={dirty:f,ctx:I}),!c&&f&1&&(c=!0,D.hovered=I[0],Rf(()=>c=!1)),o.$set(D)},i(I){d||(Dt(o.$$.fragment,I),d=!0)},o(I){Xt(o.$$.fragment,I),d=!1},d(I){Xi(o,I)}}}function Sw(s,o,c){let{$$slots:d={},$$scope:_}=o,{id:k=eh("line")}=o,{source:I=void 0}=o,{sourceLayer:f=void 0}=o,{beforeId:D=void 0}=o,{beforeLayerType:F=void 0}=o,{paint:j}=o,{layout:N=void 0}=o,{filter:V=void 0}=o,{minzoom:Q=void 0}=o,{maxzoom:re=void 0}=o,{hoverCursor:Ae=void 0}=o,{manageHoverState:xe=!1}=o,{hovered:Te=null}=o,{eventsIfTopMost:Ce=!1}=o,{interactive:ke=!0}=o;function Re(Ie){Te=Ie,c(0,Te)}function ze(Ie){cs.call(this,s,Ie)}function Oe(Ie){cs.call(this,s,Ie)}function Ze(Ie){cs.call(this,s,Ie)}function je(Ie){cs.call(this,s,Ie)}function He(Ie){cs.call(this,s,Ie)}function pt(Ie){cs.call(this,s,Ie)}return s.$$set=Ie=>{"id"in Ie&&c(1,k=Ie.id),"source"in Ie&&c(2,I=Ie.source),"sourceLayer"in Ie&&c(3,f=Ie.sourceLayer),"beforeId"in Ie&&c(4,D=Ie.beforeId),"beforeLayerType"in Ie&&c(5,F=Ie.beforeLayerType),"paint"in Ie&&c(6,j=Ie.paint),"layout"in Ie&&c(7,N=Ie.layout),"filter"in Ie&&c(8,V=Ie.filter),"minzoom"in Ie&&c(9,Q=Ie.minzoom),"maxzoom"in Ie&&c(10,re=Ie.maxzoom),"hoverCursor"in Ie&&c(11,Ae=Ie.hoverCursor),"manageHoverState"in Ie&&c(12,xe=Ie.manageHoverState),"hovered"in Ie&&c(0,Te=Ie.hovered),"eventsIfTopMost"in Ie&&c(13,Ce=Ie.eventsIfTopMost),"interactive"in Ie&&c(14,ke=Ie.interactive),"$$scope"in Ie&&c(23,_=Ie.$$scope)},[Te,k,I,f,D,F,j,N,V,Q,re,Ae,xe,Ce,ke,d,Re,ze,Oe,Ze,je,He,pt,_]}class Zp extends qn{constructor(o){super(),Vn(this,o,Sw,kw,gn,{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 Iw(s,o,c){let d;const _=Mf();let{layer:k=void 0}=o;const{map:I}=Ol();Pn(s,I,j=>c(2,d=j));function f(j){_(j.type,{...j,map:I})}const D=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],F=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return Ro(()=>{if(d)if(k)for(const j of D)d.off(j,k,f);else for(const j of F)d.off(j,f)}),s.$$set=j=>{"layer"in j&&c(1,k=j.layer)},s.$$.update=()=>{if(s.$$.dirty&6&&d)if(k)for(const j of D)d.on(j,k,f);else for(const j of F)d.on(j,f)},[I,k,d]}class Ew extends qn{constructor(o){super(),Vn(this,o,Iw,null,gn,{layer:1})}}function Tw(s){let o=s.getCenter(),c=Math.round(s.getZoom()*100)/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,d),k=Math.round(o.lat*_)/_,I=Math.round(o.lng*_)/_,f=`${c}/${k}/${I}`,D=s.getBearing(),F=s.getPitch();return(D||F)&&(f+=`/${Math.round(D*10)/10}`),F&&(f+=`/${Math.round(F)}`),`#${f}`}function Cw(s){return s.replace("#","").split("/").map(parseFloat)}var mu=Wp;function Wp(s,o){return s===o||s!==s&&o!==o?!0:typeof s!=typeof o||{}.toString.call(s)!={}.toString.call(o)||s!==Object(s)||!s?!1:Array.isArray(s)?fy(s,o):{}.toString.call(s)=="[object Set]"?fy(Array.from(s),Array.from(o)):{}.toString.call(s)=="[object Object]"?Lw(s,o):Pw(s,o)}function Pw(s,o){return s.toString()===o.toString()}function fy(s,o){var c=s.length;if(c!=o.length)return!1;for(var d=0;dc(6,d=j));let{position:k="top-left"}=o,{showCompass:I=!0}=o,{showZoom:f=!0}=o,{visualizePitch:D=!1}=o,F=null;return Ro(()=>{d!=null&&d.loaded()&&F&&d.removeControl(F)}),s.$$set=j=>{"position"in j&&c(1,k=j.position),"showCompass"in j&&c(2,I=j.showCompass),"showZoom"in j&&c(3,f=j.showZoom),"visualizePitch"in j&&c(4,D=j.visualizePitch)},s.$$.update=()=>{s.$$.dirty&126&&d&&!F&&(c(5,F=new fs.NavigationControl({showCompass:I,showZoom:f,visualizePitch:D})),d.addControl(F,k))},[_,k,I,f,D,F,d]}class Mw extends qn{constructor(o){super(),Vn(this,o,Aw,null,gn,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function Rw(s,o,c){let d;const{map:_}=Ol();Pn(s,_,F=>c(5,d=F));let{position:k="bottom-left"}=o,{maxWidth:I=void 0}=o,{unit:f="metric"}=o,D=null;return Ro(()=>{d!=null&&d.loaded()&&D&&d.removeControl(D)}),s.$$set=F=>{"position"in F&&c(1,k=F.position),"maxWidth"in F&&c(2,I=F.maxWidth),"unit"in F&&c(3,f=F.unit)},s.$$.update=()=>{s.$$.dirty&62&&d&&!D&&(c(4,D=new fs.ScaleControl({maxWidth:I,unit:f})),d.addControl(D,k))},[_,k,I,f,D,d]}class Dw extends qn{constructor(o){super(),Vn(this,o,Rw,null,gn,{position:1,maxWidth:2,unit:3})}}const{window:zw}=Bb,Nw=s=>({map:s[0]&16,loadedImages:s[0]&32,allImagesLoaded:s[0]&64}),dy=s=>({map:s[4],loadedImages:s[5],allImagesLoaded:s[6]});function py(s){let o,c,d=s[3]&&my(s);const _=s[40].default,k=Po(_,s,s[39],dy);return{c(){d&&d.c(),o=Vt(),k&&k.c()},m(I,f){d&&d.m(I,f),Tt(I,o,f),k&&k.m(I,f),c=!0},p(I,f){I[3]?d?(d.p(I,f),f[0]&8&&Dt(d,1)):(d=my(I),d.c(),Dt(d,1),d.m(o.parentNode,o)):d&&(ds(),Xt(d,1,1,()=>{d=null}),ps()),k&&k.p&&(!c||f[0]&112|f[1]&256)&&Ao(k,_,I,I[39],c?Lo(_,I[39],f,Nw):Mo(I[39]),dy)},i(I){c||(Dt(d),Dt(k,I),c=!0)},o(I){Xt(d),Xt(k,I),c=!1},d(I){I&&St(o),d&&d.d(I),k&&k.d(I)}}}function my(s){let o,c,d,_,k,I,f,D;return o=new Mw({props:{position:s[7]}}),d=new bw({props:{position:s[7],fitBoundsOptions:{maxZoom:12}}}),k=new yw({props:{position:s[7]}}),f=new Dw({props:{position:s[7]}}),{c(){rn(o.$$.fragment),c=Vt(),rn(d.$$.fragment),_=Vt(),rn(k.$$.fragment),I=Vt(),rn(f.$$.fragment)},m(F,j){Wi(o,F,j),Tt(F,c,j),Wi(d,F,j),Tt(F,_,j),Wi(k,F,j),Tt(F,I,j),Wi(f,F,j),D=!0},p(F,j){const N={};j[0]&128&&(N.position=F[7]),o.$set(N);const V={};j[0]&128&&(V.position=F[7]),d.$set(V);const Q={};j[0]&128&&(Q.position=F[7]),k.$set(Q);const re={};j[0]&128&&(re.position=F[7]),f.$set(re)},i(F){D||(Dt(o.$$.fragment,F),Dt(d.$$.fragment,F),Dt(k.$$.fragment,F),Dt(f.$$.fragment,F),D=!0)},o(F){Xt(o.$$.fragment,F),Xt(d.$$.fragment,F),Xt(k.$$.fragment,F),Xt(f.$$.fragment,F),D=!1},d(F){F&&(St(c),St(_),St(I)),Xi(o,F),Xi(d,F),Xi(k,F),Xi(f,F)}}}function Ow(s){let o,c,d,_,k,I=s[4]&&s[0]&&py(s);return{c(){o=gt("div"),I&&I.c(),Ln(o,"class",c=iy(s[2])+" svelte-p00lfq"),Ln(o,"data-testid","map-container"),ny(o,"expand-map",!s[2])},m(f,D){Tt(f,o,D),I&&I.m(o,null),s[41](o),d=!0,_||(k=[xr(zw,"hashchange",s[11]),Fb(s[10].call(null,o))],_=!0)},p(f,D){f[4]&&f[0]?I?(I.p(f,D),D[0]&17&&Dt(I,1)):(I=py(f),I.c(),Dt(I,1),I.m(o,null)):I&&(ds(),Xt(I,1,1,()=>{I=null}),ps()),(!d||D[0]&4&&c!==(c=iy(f[2])+" svelte-p00lfq"))&&Ln(o,"class",c),(!d||D[0]&4)&&ny(o,"expand-map",!f[2])},i(f){d||(Dt(I),d=!0)},o(f){Xt(I),d=!1},d(f){f&&St(o),I&&I.d(),s[41](null),_=!1,ma(k)}}}function Fw(s,o,c){let d,_,k,I,{$$slots:f={},$$scope:D}=o,{map:F=null}=o,{mapContainer:j=void 0}=o,{class:N=void 0}=o,{style:V}=o,{diffStyleUpdates:Q=!1}=o,{center:re=void 0}=o,{zoom:Ae=void 0}=o,{pitch:xe=0}=o,{bearing:Te=0}=o,{bounds:Ce=void 0}=o,{hash:ke=!1}=o,{updateHash:Re=be=>{window.history.replaceState(window.history.state,"",be)}}=o,{loaded:ze=!1}=o,{minZoom:Oe=0}=o,{maxZoom:Ze=22}=o,{antialias:je=void 0}=o,{zoomOnDoubleClick:He=!0}=o,{locale:pt=void 0}=o,{interactive:Ie=!0}=o,{attributionControl:Pt=!0}=o,{cooperativeGestures:st=!1}=o,{preserveDrawingBuffer:Ue=!1}=o,{maxBounds:lt=void 0}=o,{images:Lt=[]}=o,{standardControls:ct=!1}=o,{filterLayers:Qt=void 0}=o,{transformRequest:ii=void 0}=o;const nt=Mf(),{map:Ft,loadedImages:jt}=iw();Pn(s,Ft,be=>c(4,k=be)),Pn(s,jt,be=>c(5,I=be));let qt=new Set;async function et(be,Rt=!1){if(k&&!(!k.loaded()&&!Rt))if("url"in be){qt.add(be.id);try{let Ke=await k.loadImage(be.url);k==null||k.addImage(be.id,Ke.data,be.options),I.add(be.id),jt.set(I)}catch(Ke){nt("error",Ke)}finally{qt.delete(be.id)}}else k.addImage(be.id,be.data,be.options),I.add(be.id),jt.set(I)}let Ot,mt,vt,_e;function vi(be){return _t(),Co(Ft,k=new fs.Map(Hc({container:be,style:V,locale:pt,center:re,zoom:Ae,pitch:xe,bearing:Te,minZoom:Oe,maxZoom:Ze,antialias:je,interactive:Ie,preserveDrawingBuffer:Ue,maxBounds:lt,bounds:Ce,attributionControl:Pt,transformRequest:ii,cooperativeGestures:st})),k),k.on("load",Rt=>{Rt.target.getContainer().setAttribute("data-testid","map"),Rt.target.getCanvas().setAttribute("data-testid","map-canvas"),c(0,ze=!0),nt("load",k)}),k.on("error",Rt=>nt("error",{...Rt,map:k})),k.on("movestart",Rt=>nt("movestart",{...Rt,map:k})),k.on("moveend",Rt=>{if(c(12,re=Rt.target.getCenter()),c(13,Ae=Rt.target.getZoom()),c(14,xe=Rt.target.getPitch()),c(15,Te=Rt.target.getBearing()),c(16,Ce=Rt.target.getBounds()),nt("moveend",{...Rt,map:k}),ke){let Ke=new URL(window.location.href.replace(/(#.+)?$/,Tw(k)));Re(Ke)}}),k.on("click",Rt=>nt("click",{...Rt,map:k})),k.on("dblclick",Rt=>nt("dblclick",{...Rt,map:k})),k.on("contextmenu",Rt=>nt("contextmenu",{...Rt,map:k})),k.on("zoomstart",Rt=>nt("zoomstart",{...Rt,map:k})),k.on("zoom",Rt=>{nt("zoom",{...Rt,map:k})}),k.on("zoomend",Rt=>{nt("zoomend",{...Rt,map:k})}),k.on("style.load",()=>{if(k){const Rt=k.getStyle();if(c(36,Ot=Rt.layers.map(Ke=>Ke.id)),c(37,mt=Object.keys(Rt.sources)),_e)for(const[Ke,Ne]of Object.entries(_e))k.addSource(Ke,Ne);if(vt)for(const Ke of vt)k.addLayer(Ke);for(const Ke of Lt)et(Ke,!0)}}),k.on("styledata",Rt=>{if(k&&Qt){const Ke=k.getStyle().layers;if(Ke)for(let Ne of Ke)Qt(Ne)||k.setLayoutProperty(Ne.id,"visibility","none")}nt("styledata",{...Rt,map:k})}),{destroy(){c(0,ze=!1),k==null||k.remove(),Co(Ft,k=null,k)}}}let Kt=V;function _t(){if(ke){let be=Cw(window.location.hash);be.length>=3&&(c(13,Ae=be[0]),c(12,re=[be[2],be[1]])),be.length==5&&(c(15,Te=be[3]),c(14,xe=be[4]))}}function he(be){pa[be?"unshift":"push"](()=>{j=be,c(1,j)})}return s.$$set=be=>{"map"in be&&c(17,F=be.map),"mapContainer"in be&&c(1,j=be.mapContainer),"class"in be&&c(2,N=be.class),"style"in be&&c(18,V=be.style),"diffStyleUpdates"in be&&c(19,Q=be.diffStyleUpdates),"center"in be&&c(12,re=be.center),"zoom"in be&&c(13,Ae=be.zoom),"pitch"in be&&c(14,xe=be.pitch),"bearing"in be&&c(15,Te=be.bearing),"bounds"in be&&c(16,Ce=be.bounds),"hash"in be&&c(20,ke=be.hash),"updateHash"in be&&c(21,Re=be.updateHash),"loaded"in be&&c(0,ze=be.loaded),"minZoom"in be&&c(22,Oe=be.minZoom),"maxZoom"in be&&c(23,Ze=be.maxZoom),"antialias"in be&&c(24,je=be.antialias),"zoomOnDoubleClick"in be&&c(25,He=be.zoomOnDoubleClick),"locale"in be&&c(26,pt=be.locale),"interactive"in be&&c(27,Ie=be.interactive),"attributionControl"in be&&c(28,Pt=be.attributionControl),"cooperativeGestures"in be&&c(29,st=be.cooperativeGestures),"preserveDrawingBuffer"in be&&c(30,Ue=be.preserveDrawingBuffer),"maxBounds"in be&&c(31,lt=be.maxBounds),"images"in be&&c(32,Lt=be.images),"standardControls"in be&&c(3,ct=be.standardControls),"filterLayers"in be&&c(33,Qt=be.filterLayers),"transformRequest"in be&&c(34,ii=be.transformRequest),"$$scope"in be&&c(39,D=be.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&8&&c(7,d=typeof ct=="boolean"?void 0:ct),s.$$.dirty[0]&16&&c(17,F=k),s.$$.dirty[0]&786448|s.$$.dirty[1]&224&&k&&!mu(V,Kt)){const be=k.getStyle();if(Ot&&(vt=be.layers.filter(Rt=>!Ot.includes(Rt.id))),mt){const Rt=Object.keys(be.sources).filter(Ke=>!mt.includes(Ke));_e={};for(const Ke of Rt)_e[Ke]=be.sources[Ke]}c(38,Kt=V),k.setStyle(V,{diff:Q}),Co(jt,I=new Set,I),c(35,qt=new Set)}if(s.$$.dirty[0]&49|s.$$.dirty[1]&18&&ze&&k!=null&&k.loaded())for(let be of Lt)!I.has(be.id)&&!qt.has(be.id)&&!k.hasImage(be.id)&&et(be);if(s.$$.dirty[0]&32|s.$$.dirty[1]&2&&c(6,_=Lt.every(be=>I.has(be.id))),s.$$.dirty[0]&61456&&k){let be={};re!=null&&!mu(re,k==null?void 0:k.getCenter())&&(be.center=re),Ae!=null&&!mu(Ae,k==null?void 0:k.getZoom())&&(be.zoom=Ae),Te!=null&&!mu(Te,k==null?void 0:k.getBearing())&&(be.bearing=Te),xe!=null&&!mu(xe,k==null?void 0:k.getPitch())&&(be.pitch=xe),Object.keys(be).length&&k.easeTo(be)}s.$$.dirty[0]&65552&&Ce&&!mu(Ce,k==null?void 0:k.getBounds())&&(k==null||k.fitBounds(Ce)),s.$$.dirty[0]&33554448&&(He?k==null||k.doubleClickZoom.enable():k==null||k.doubleClickZoom.disable())},[ze,j,N,ct,k,I,_,d,Ft,jt,vi,_t,re,Ae,xe,Te,Ce,F,V,Q,ke,Re,Oe,Ze,je,He,pt,Ie,Pt,st,Ue,lt,Lt,Qt,ii,qt,Ot,mt,Kt,D,f,he]}class Bw extends qn{constructor(o){super(),Vn(this,o,Fw,Ow,gn,{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 jw=s=>({features:s[0]&16,data:s[0]&16,map:s[0]&4,close:s[0]&1}),gy=s=>{var o;return{features:s[4],data:((o=s[4])==null?void 0:o[0])??null,map:s[2],close:s[31]}};function yy(s){var _;let o,c,d=(((_=s[4])==null?void 0:_.length)||s[3]instanceof fs.Marker)&&_y(s);return{c(){o=gt("div"),d&&d.c()},m(k,I){Tt(k,o,I),d&&d.m(o,null),s[32](o),c=!0},p(k,I){var f;(f=k[4])!=null&&f.length||k[3]instanceof fs.Marker?d?(d.p(k,I),I[0]&24&&Dt(d,1)):(d=_y(k),d.c(),Dt(d,1),d.m(o,null)):d&&(ds(),Xt(d,1,1,()=>{d=null}),ps())},i(k){c||(Dt(d),c=!0)},o(k){Xt(d),c=!1},d(k){k&&St(o),d&&d.d(),s[32](null)}}}function _y(s){let o;const c=s[30].default,d=Po(c,s,s[29],gy);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k[0]&536870933)&&Ao(d,c,_,_[29],o?Lo(c,_[29],k,jw):Mo(_[29]),gy)},i(_){o||(Dt(d,_),o=!0)},o(_){Xt(d,_),o=!1},d(_){d&&d.d(_)}}}function Uw(s){let o,c,d=s[9].default&&yy(s);return{c(){d&&d.c(),o=Yr()},m(_,k){d&&d.m(_,k),Tt(_,o,k),c=!0},p(_,k){_[9].default?d?(d.p(_,k),k[0]&512&&Dt(d,1)):(d=yy(_),d.c(),Dt(d,1),d.m(o.parentNode,o)):d&&(ds(),Xt(d,1,1,()=>{d=null}),ps())},i(_){c||(Dt(d),c=!0)},o(_){Xt(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function Vw(s,o,c){let d,_,k,I,f,D,{$$slots:F={},$$scope:j}=o;const N=Ob(F);let{closeButton:V=void 0}=o,{closeOnClickOutside:Q=!0}=o,{closeOnClickInside:re=!1}=o,{closeOnMove:Ae=!1}=o,{openOn:xe="click"}=o,{openIfTopMost:Te=!0}=o,{focusAfterOpen:Ce=!0}=o,{anchor:ke=void 0}=o,{offset:Re=void 0}=o,{popupClass:ze=void 0}=o,{maxWidth:Oe=void 0}=o,{lngLat:Ze=void 0}=o,{html:je=void 0}=o,{open:He=!1}=o;const pt=Mf(),{map:Ie,popupTarget:Pt,layerEvent:st,layer:Ue,eventTopMost:lt}=Ol();Pn(s,Ie,Ke=>c(2,k=Ke)),Pn(s,Pt,Ke=>c(3,f=Ke)),Pn(s,st,Ke=>c(28,I=Ke)),Pn(s,Ue,Ke=>c(35,D=Ke));const Lt=["click","dblclick","contextmenu"];let ct,Qt=!1,ii;function nt(){if(!ct)return;let Ke=ct.getElement();!Ke||Ke===ii||(ii=Ke,xe==="hover"&&(ii.style.pointerEvents="none"),ii.addEventListener("mouseenter",()=>{c(24,Qt=!0)},{passive:!0}),ii.addEventListener("mouseleave",()=>{c(24,Qt=!1)},{passive:!0}),ii.addEventListener("click",()=>{re&&c(0,He=!1)},{passive:!0}))}Vb(()=>{if(k)return k.on("click",_t),k.on("contextmenu",_t),typeof f=="string"&&(k.on("click",f,Ot),k.on("dblclick",f,Ot),k.on("contextmenu",f,Ot),k.on("mousemove",f,Kt),k.on("mouseleave",f,vi),k.on("touchstart",f,vt),k.on("touchend",f,_e)),()=>{k!=null&&k.loaded()&&(ct==null||ct.remove(),k.off("click",_t),k.off("contextmenu",_t),f instanceof fs.Marker?f.getPopup()===ct&&f.setPopup(void 0):typeof f=="string"&&(k.off("click",f,Ot),k.off("dblclick",f,Ot),k.off("contextmenu",f,Ot),k.off("mousemove",f,Kt),k.off("mouseleave",f,vi),k.off("touchstart",f,vt),k.off("touchend",f,_e)))}});function Ft(Ke){return Te?!("marker"in Ke)&&!rw(Ke)&<(Ke)!==D:!1}let jt=null,qt="normal";function et(Ke){"layerType"in Ke&&Ke.layerType==="deckgl"?(c(10,Ze=Ke.coordinate),c(4,jt=Ke.object?[Ke.object]:null)):(c(10,Ze=Ke.lngLat),c(4,jt=Ke.features??[]))}function Ot(Ke){Ke.type!==xe||Ft(Ke)||(et(Ke),setTimeout(()=>c(0,He=!0)))}let mt=null;function vt(Ke){mt=Ke.point}function _e(Ke){if(!mt||xe!=="hover")return;let Ne=mt.dist(Ke.point);mt=null,Ne<3&&(c(10,Ze=Ke.lngLat),c(4,jt=Ke.features??[]),ct.isOpen()?c(25,qt="justOpened"):(c(25,qt="opening"),c(0,He=!0)))}function vi(Ke){xe!=="hover"||mt||qt!=="normal"||(c(0,He=!1),c(4,jt=null))}function Kt(Ke){if(!(xe!=="hover"||mt||qt!=="normal")){if(Ft(Ke)){c(0,He=!1),c(4,jt=null);return}c(0,He=!0),c(4,jt=Ke.features??[]),c(10,Ze=Ke.lngLat)}}function _t(Ke){if(qt==="justOpened"){c(25,qt="normal");return}if(!Q)return;let Ne=[ii,f instanceof fs.Marker?f==null?void 0:f.getElement():null];He&&ct.isOpen()&&!Ne.some(Yi=>Yi==null?void 0:Yi.contains(Ke.originalEvent.target))&&(Ke.type==="contextmenu"&&xe==="contextmenu"||Ke.type!=="contextmenu")&&c(0,He=!1)}Ro(()=>{k&&(ct!=null&&ct.isOpen())&&ct.remove()});let he;const be=()=>c(0,He=!1);function Rt(Ke){pa[Ke?"unshift":"push"](()=>{he=Ke,c(1,he)})}return s.$$set=Ke=>{"closeButton"in Ke&&c(11,V=Ke.closeButton),"closeOnClickOutside"in Ke&&c(12,Q=Ke.closeOnClickOutside),"closeOnClickInside"in Ke&&c(13,re=Ke.closeOnClickInside),"closeOnMove"in Ke&&c(14,Ae=Ke.closeOnMove),"openOn"in Ke&&c(15,xe=Ke.openOn),"openIfTopMost"in Ke&&c(16,Te=Ke.openIfTopMost),"focusAfterOpen"in Ke&&c(17,Ce=Ke.focusAfterOpen),"anchor"in Ke&&c(18,ke=Ke.anchor),"offset"in Ke&&c(19,Re=Ke.offset),"popupClass"in Ke&&c(20,ze=Ke.popupClass),"maxWidth"in Ke&&c(21,Oe=Ke.maxWidth),"lngLat"in Ke&&c(10,Ze=Ke.lngLat),"html"in Ke&&c(22,je=Ke.html),"open"in Ke&&c(0,He=Ke.open),"$$scope"in Ke&&c(29,j=Ke.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&14336&&c(27,d=V??(!Q&&!re)),s.$$.dirty[0]&146685952&&(ct||(c(23,ct=new fs.Popup({closeButton:d,closeOnClick:!1,closeOnMove:Ae,focusAfterOpen:Ce,maxWidth:Oe,className:ze,anchor:ke,offset:Re})),ii=ct.getElement(),ct.on("open",()=>{c(0,He=!0),nt(),pt("open",ct)}),ct.on("close",()=>{c(0,He=!1),pt("close",ct)}),ct.on("hover",()=>{pt("hover",ct)}))),s.$$.dirty[0]&8421384&&ct&&f instanceof fs.Marker&&(xe==="click"?f.setPopup(ct):f.getPopup()===ct&&f.setPopup(void 0)),s.$$.dirty[0]&268468224&&Lt.includes(xe)&&(I==null?void 0:I.type)===xe&&(Ot(I),Co(st,I=null,I)),s.$$.dirty[0]&268468224&&c(26,_=xe==="hover"&&((I==null?void 0:I.type)==="mousemove"||(I==null?void 0:I.type)==="mouseenter")),s.$$.dirty[0]&352354304&&xe==="hover"&&st&&(_&&I&&et(I),c(0,He=(_||Qt)??!1)),s.$$.dirty[0]&12582914&&(he?ct.setDOMContent(he):je&&ct.setHTML(je)),s.$$.dirty[0]&8389632&&Ze&&ct.setLngLat(Ze),s.$$.dirty[0]&41943045&&k){let Ke=ct.isOpen();He&&!Ke?(ct.addTo(k),qt==="opening"&&c(25,qt="justOpened")):!He&&Ke&&ct.remove()}},[He,he,k,f,jt,Ie,Pt,st,Ue,N,Ze,V,Q,re,Ae,xe,Te,Ce,ke,Re,ze,Oe,je,ct,Qt,qt,_,d,I,j,F,be,Rt]}class Xp extends qn{constructor(o){super(),Vn(this,o,Vw,Uw,gn,{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 Iu=Math.pow,Ar=(s,o,c)=>new Promise((d,_)=>{var k=D=>{try{f(c.next(D))}catch(F){_(F)}},I=D=>{try{f(c.throw(D))}catch(F){_(F)}},f=D=>D.done?d(D.value):Promise.resolve(D.value).then(k,I);f((c=c.apply(s,o)).next())}),hs=Uint8Array,wu=Uint16Array,qw=Int32Array,t0=new hs([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]),i0=new hs([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]),Gw=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n0=function(s,o){for(var c=new wu(31),d=0;d<31;++d)c[d]=o+=1<>1|(Bi&21845)<<1,ca=(ca&52428)>>2|(ca&13107)<<2,ca=(ca&61680)>>4|(ca&3855)<<4,lp[Bi]=((ca&65280)>>8|(ca&255)<<8)>>1;var ca,Bi,Uc=function(s,o,c){for(var d=s.length,_=0,k=new wu(o);_>D]=F}else for(f=new wu(d),_=0;_>15-s[_]);return f},th=new hs(288);for(Bi=0;Bi<144;++Bi)th[Bi]=8;var Bi;for(Bi=144;Bi<256;++Bi)th[Bi]=9;var Bi;for(Bi=256;Bi<280;++Bi)th[Bi]=7;var Bi;for(Bi=280;Bi<288;++Bi)th[Bi]=8;var Bi,o0=new hs(32);for(Bi=0;Bi<32;++Bi)o0[Bi]=5;var Bi,Hw=Uc(th,9,1),Yw=Uc(o0,5,1),zd=function(s){for(var o=s[0],c=1;co&&(o=s[c]);return o},Hs=function(s,o,c){var d=o/8|0;return(s[d]|s[d+1]<<8)>>(o&7)&c},Nd=function(s,o){var c=o/8|0;return(s[c]|s[c+1]<<8|s[c+2]<<16)>>(o&7)},Kw=function(s){return(s+7)/8|0},Jw=function(s,o,c){(o==null||o<0)&&(o=0),(c==null||c>s.length)&&(c=s.length);var d=new hs(c-o);return d.set(s.subarray(o,c)),d},Qw=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],us=function(s,o,c){var d=new Error(o||Qw[s]);if(d.code=s,Error.captureStackTrace&&Error.captureStackTrace(d,us),!c)throw d;return d},Hp=function(s,o,c,d){var _=s.length,k=d?d.length:0;if(!_||o.f&&!o.l)return c||new hs(0);var I=!c||o.i!=2,f=o.i;c||(c=new hs(_*3));var D=function(Kt){var _t=c.length;if(Kt>_t){var he=new hs(Math.max(_t*2,Kt));he.set(c),c=he}},F=o.f||0,j=o.p||0,N=o.b||0,V=o.l,Q=o.d,re=o.m,Ae=o.n,xe=_*8;do{if(!V){F=Hs(s,j,1);var Te=Hs(s,j+1,3);if(j+=3,Te)if(Te==1)V=Hw,Q=Yw,re=9,Ae=5;else if(Te==2){var ze=Hs(s,j,31)+257,Oe=Hs(s,j+10,15)+4,Ze=ze+Hs(s,j+5,31)+1;j+=14;for(var je=new hs(Ze),He=new hs(19),pt=0;pt>4;if(Ce<16)je[pt++]=Ce;else{var lt=0,Lt=0;for(Ce==16?(Lt=3+Hs(s,j,3),j+=2,lt=je[pt-1]):Ce==17?(Lt=3+Hs(s,j,7),j+=3):Ce==18&&(Lt=11+Hs(s,j,127),j+=7);Lt--;)je[pt++]=lt}}var ct=je.subarray(0,ze),Qt=je.subarray(ze);re=zd(ct),Ae=zd(Qt),V=Uc(ct,re,1),Q=Uc(Qt,Ae,1)}else us(1);else{var Ce=Kw(j)+4,ke=s[Ce-4]|s[Ce-3]<<8,Re=Ce+ke;if(Re>_){f&&us(0);break}I&&D(N+ke),c.set(s.subarray(Ce,Re),N),o.b=N+=ke,o.p=j=Re*8,o.f=F;continue}if(j>xe){f&&us(0);break}}I&&D(N+131072);for(var ii=(1<>4;if(j+=lt&15,j>xe){f&&us(0);break}if(lt||us(2),jt<256)c[N++]=jt;else if(jt==256){Ft=j,V=null;break}else{var qt=jt-254;if(jt>264){var pt=jt-257,et=t0[pt];qt=Hs(s,j,(1<>4;Ot||us(3),j+=Ot&15;var Qt=Xw[mt];if(mt>3){var et=i0[mt];Qt+=Nd(s,j)&(1<xe){f&&us(0);break}I&&D(N+131072);var vt=N+qt;if(N>3&1)+(o>>4&1);d>0;d-=!s[c++]);return c+(o&2)},t2=function(s){var o=s.length;return(s[o-4]|s[o-3]<<8|s[o-2]<<16|s[o-1]<<24)>>>0},i2=function(s,o){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&us(6,"invalid zlib data"),(s[1]>>5&1)==+!o&&us(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function n2(s,o){return Hp(s,{i:2},o&&o.out,o&&o.dictionary)}function r2(s,o){var c=e2(s);return c+8>s.length&&us(6,"invalid gzip data"),Hp(s.subarray(c,-8),{i:2},o&&o.out||new hs(t2(s)),o&&o.dictionary)}function s2(s,o){return Hp(s.subarray(i2(s,o&&o.dictionary),-4),{i:2},o&&o.out,o&&o.dictionary)}function up(s,o){return s[0]==31&&s[1]==139&&s[2]==8?r2(s,o):(s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31?n2(s,o):s2(s,o)}var o2=typeof TextDecoder<"u"&&new TextDecoder,a2=0;try{o2.decode($w,{stream:!0}),a2=1}catch{}var a0=(s,o)=>s*Iu(2,o),Lc=(s,o)=>Math.floor(s/Iu(2,o)),af=(s,o)=>a0(s.getUint16(o+1,!0),8)+s.getUint8(o),l0=(s,o)=>a0(s.getUint32(o+2,!0),16)+s.getUint16(o,!0),l2=(s,o,c,d,_)=>{if(s!==d.getUint8(_))return s-d.getUint8(_);const k=af(d,_+1);if(o!==k)return o-k;const I=af(d,_+4);return c!==I?c-I:0},u2=(s,o,c,d)=>{const _=u0(s,o|128,c,d);return _?{z:o,x:c,y:d,offset:_[0],length:_[1],isDir:!0}:null},vy=(s,o,c,d)=>{const _=u0(s,o,c,d);return _?{z:o,x:c,y:d,offset:_[0],length:_[1],isDir:!1}:null},u0=(s,o,c,d)=>{let _=0,k=s.byteLength/17-1;for(;_<=k;){const I=k+_>>1,f=l2(o,c,d,s,I*17);if(f>0)_=I+1;else if(f<0)k=I-1;else return[l0(s,I*17+7),s.getUint32(I*17+13,!0)]}return null},c2=(s,o)=>s.isDir&&!o.isDir?1:!s.isDir&&o.isDir?-1:s.z!==o.z?s.z-o.z:s.x!==o.x?s.x-o.x:s.y-o.y,c0=(s,o)=>{const c=s.getUint8(o*17);return{z:c&127,x:af(s,o*17+1),y:af(s,o*17+4),offset:l0(s,o*17+7),length:s.getUint32(o*17+13,!0),isDir:c>>7===1}},xy=s=>{const o=[],c=new DataView(s);for(let d=0;d{s.sort(c2);const o=new ArrayBuffer(17*s.length),c=new Uint8Array(o);for(let d=0;d>8&255,c[d*17+3]=_.x>>16&255,c[d*17+4]=_.y&255,c[d*17+5]=_.y>>8&255,c[d*17+6]=_.y>>16&255,c[d*17+7]=_.offset&255,c[d*17+8]=Lc(_.offset,8)&255,c[d*17+9]=Lc(_.offset,16)&255,c[d*17+10]=Lc(_.offset,24)&255,c[d*17+11]=Lc(_.offset,32)&255,c[d*17+12]=Lc(_.offset,48)&255,c[d*17+13]=_.length&255,c[d*17+14]=_.length>>8&255,c[d*17+15]=_.length>>16&255,c[d*17+16]=_.length>>24&255}return o},f2=(s,o)=>{if(s.byteLength<17)return null;const c=s.byteLength/17,d=c0(s,c-1);if(d.isDir){const _=d.z,k=o.z-_,I=Math.trunc(o.x/(1<(o,c)=>{if(c instanceof AbortController)return s(o,c);const d=new AbortController;return s(o,d).then(_=>c(void 0,_.data,_.cacheControl||"",_.expires||""),_=>c(_)).catch(_=>c(_)),{cancel:()=>d.abort()}},g2=class{constructor(){this.tilev4=(s,o)=>Ar(this,null,function*(){if(s.type==="json"){const N=s.url.substr(10);let V=this.tiles.get(N);V||(V=new by(N),this.tiles.set(N,V));const Q=yield V.getHeader();return{data:{tiles:[`${s.url}/{z}/{x}/{y}`],minzoom:Q.minZoom,maxzoom:Q.maxZoom,bounds:[Q.minLon,Q.minLat,Q.maxLon,Q.maxLat]}}}const c=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),d=s.url.match(c);if(!d)throw new Error("Invalid PMTiles protocol URL");const _=d[1];let k=this.tiles.get(_);k||(k=new by(_),this.tiles.set(_,k));const I=d[2],f=d[3],D=d[4],F=yield k.getHeader(),j=yield k==null?void 0:k.getZxy(+I,+f,+D,o.signal);return j?{data:new Uint8Array(j.data),cacheControl:j.cacheControl,expires:j.expires}:F.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=m2(this.tilev4),this.tiles=new Map}add(s){this.tiles.set(s.source.getKey(),s)}get(s){return this.tiles.get(s)}};function gu(s,o){return(o>>>0)*4294967296+(s>>>0)}function y2(s,o){const c=o.buf;let d=c[o.pos++],_=(d&112)>>4;if(d<128||(d=c[o.pos++],_|=(d&127)<<3,d<128)||(d=c[o.pos++],_|=(d&127)<<10,d<128)||(d=c[o.pos++],_|=(d&127)<<17,d<128)||(d=c[o.pos++],_|=(d&127)<<24,d<128)||(d=c[o.pos++],_|=(d&1)<<31,d<128))return gu(s,_);throw new Error("Expected varint not more than 10 bytes")}function Ac(s){const o=s.buf;let c=o[s.pos++],d=c&127;return c<128||(c=o[s.pos++],d|=(c&127)<<7,c<128)||(c=o[s.pos++],d|=(c&127)<<14,c<128)||(c=o[s.pos++],d|=(c&127)<<21,c<128)?d:(c=o[s.pos],d|=(c&15)<<28,y2(d,s))}function _2(s,o,c,d){if(d===0){c===1&&(o[0]=s-1-o[0],o[1]=s-1-o[1]);const _=o[0];o[0]=o[1],o[1]=_}}var v2=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function x2(s,o,c){if(s>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(o>Iu(2,s)-1||c>Iu(2,s)-1)throw Error("tile x/y outside zoom level bounds");const d=v2[s],_=Iu(2,s);let k=0,I=0,f=0;const D=[o,c];let F=_/2;for(;F>0;)k=(D[0]&F)>0?1:0,I=(D[1]&F)>0?1:0,f+=F*F*(3*k^I),_2(F,D,k,I),F=F/2;return d+f}function f0(s,o){return Ar(this,null,function*(){if(o===1||o===0)return s;if(o===2){if(typeof globalThis.DecompressionStream>"u")return up(new Uint8Array(s));const c=new Response(s).body;if(!c)throw Error("Failed to read response stream");const d=c.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(d).arrayBuffer()}throw Error("Compression method not supported")})}var b2=127;function w2(s,o){let c=0,d=s.length-1;for(;c<=d;){const _=d+c>>1,k=o-s[_].tileId;if(k>0)c=_+1;else if(k<0)d=_-1;else return s[_]}return d>=0&&(s[d].runLength===0||o-s[d].tileId=300)throw Error(`Bad response code: ${D.status}`);const j=D.headers.get("Content-Length");if(D.status===200&&(!j||+j>o))throw _&&_.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield D.arrayBuffer(),etag:F||void 0,cacheControl:D.headers.get("Cache-Control")||void 0,expires:D.headers.get("Expires")||void 0}})}};function Ys(s,o){const c=s.getUint32(o+4,!0),d=s.getUint32(o+0,!0);return c*Iu(2,32)+d}function S2(s,o){const c=new DataView(s),d=c.getUint8(7);if(d>3)throw Error(`Archive is spec version ${d} but this library supports up to spec version 3`);return{specVersion:d,rootDirectoryOffset:Ys(c,8),rootDirectoryLength:Ys(c,16),jsonMetadataOffset:Ys(c,24),jsonMetadataLength:Ys(c,32),leafDirectoryOffset:Ys(c,40),leafDirectoryLength:Ys(c,48),tileDataOffset:Ys(c,56),tileDataLength:Ys(c,64),numAddressedTiles:Ys(c,72),numTileEntries:Ys(c,80),numTileContents:Ys(c,88),clustered:c.getUint8(96)===1,internalCompression:c.getUint8(97),tileCompression:c.getUint8(98),tileType:c.getUint8(99),minZoom:c.getUint8(100),maxZoom:c.getUint8(101),minLon:c.getInt32(102,!0)/1e7,minLat:c.getInt32(106,!0)/1e7,maxLon:c.getInt32(110,!0)/1e7,maxLat:c.getInt32(114,!0)/1e7,centerZoom:c.getUint8(118),centerLon:c.getInt32(119,!0)/1e7,centerLat:c.getInt32(123,!0)/1e7,etag:o}}function d0(s){const o={buf:new Uint8Array(s),pos:0},c=Ac(o),d=[];let _=0;for(let k=0;k0?d[k].offset=d[k-1].offset+d[k-1].length:d[k].offset=I-1}return d}function I2(s){const o=new DataView(s);return o.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):o.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var cp=class extends Error{};function E2(s,o){return Ar(this,null,function*(){const c=yield s.getBytes(0,16384);if(new DataView(c.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(I2(c.data)<3)return[yield h0.getHeader(s)];const _=c.data.slice(0,b2),k=S2(_,c.etag),I=c.data.slice(k.rootDirectoryOffset,k.rootDirectoryOffset+k.rootDirectoryLength),f=`${s.getKey()}|${k.etag||""}|${k.rootDirectoryOffset}|${k.rootDirectoryLength}`,D=d0(yield o(I,k.internalCompression));return[k,[f,D.length,D]]})}function T2(s,o,c,d,_){return Ar(this,null,function*(){const k=yield s.getBytes(c,d,void 0,_.etag),I=yield o(k.data,_.internalCompression),f=d0(I);if(f.length===0)throw new Error("Empty directory is invalid");return f})}var C2=class{constructor(s=100,o=!0,c=f0){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=s,this.counter=1,this.decompress=c}getHeader(s){return Ar(this,null,function*(){const o=s.getKey(),c=this.cache.get(o);if(c)return c.lastUsed=this.counter++,yield c.data;const d=new Promise((_,k)=>{E2(s,this.decompress).then(I=>{I[1]&&this.cache.set(I[1][0],{lastUsed:this.counter++,data:Promise.resolve(I[1][2])}),_(I[0]),this.prune()}).catch(I=>{k(I)})});return this.cache.set(o,{lastUsed:this.counter++,data:d}),d})}getDirectory(s,o,c,d){return Ar(this,null,function*(){const _=`${s.getKey()}|${d.etag||""}|${o}|${c}`,k=this.cache.get(_);if(k)return k.lastUsed=this.counter++,yield k.data;const I=new Promise((f,D)=>{T2(s,this.decompress,o,c,d).then(F=>{f(F),this.prune()}).catch(F=>{D(F)})});return this.cache.set(_,{lastUsed:this.counter++,data:I}),I})}getArrayBuffer(s,o,c,d){return Ar(this,null,function*(){const _=`${s.getKey()}|${d.etag||""}|${o}|${c}`,k=this.cache.get(_);if(k)return k.lastUsed=this.counter++,yield k.data;const I=new Promise((f,D)=>{s.getBytes(o,c,void 0,d.etag).then(F=>{f(F.data),this.cache.has(_),this.prune()}).catch(F=>{D(F)})});return this.cache.set(_,{lastUsed:this.counter++,data:I}),I})}prune(){if(this.cache.size>=this.maxCacheEntries){let s=1/0,o;this.cache.forEach((c,d)=>{c.lastUsed{this.getHeader(s).then(k=>{d(),this.invalidations.delete(o)}).catch(k=>{_(k)})});this.invalidations.set(o,c)})}},by=class{constructor(s,o,c){typeof s=="string"?this.source=new k2(s):this.source=s,c?this.decompress=c:this.decompress=f0,o?this.cache=o:this.cache=new C2}getHeader(){return Ar(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(s,o,c,d){return Ar(this,null,function*(){const _=x2(s,o,c),k=yield this.cache.getHeader(this.source);if(k.specVersion<3)return h0.getZxy(k,this.source,this.cache,s,o,c,d);if(sk.maxZoom)return;let I=k.rootDirectoryOffset,f=k.rootDirectoryLength;for(let D=0;D<=3;D++){const F=yield this.cache.getDirectory(this.source,I,f,k),j=w2(F,_);if(j){if(j.runLength>0){const N=yield this.source.getBytes(k.tileDataOffset+j.offset,j.length,d,k.etag);return{data:yield this.decompress(N.data,k.tileCompression),cacheControl:N.cacheControl,expires:N.expires}}I=k.leafDirectoryOffset+j.offset,f=j.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(s,o,c,d){return Ar(this,null,function*(){try{return yield this.getZxyAttempt(s,o,c,d)}catch(_){if(_ instanceof cp)return this.cache.invalidate(this.source),yield this.getZxyAttempt(s,o,c,d);throw _}})}getMetadataAttempt(){return Ar(this,null,function*(){const s=yield this.cache.getHeader(this.source),o=yield this.source.getBytes(s.jsonMetadataOffset,s.jsonMetadataLength,void 0,s.etag),c=yield this.decompress(o.data,s.internalCompression),d=new TextDecoder("utf-8");return JSON.parse(d.decode(c))})}getMetadata(){return Ar(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(s){if(s instanceof cp)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw s}})}};function wy(s){let o=s[0],c,d,_=ky(s);return{c(){_.c(),c=Yr()},m(k,I){_.m(k,I),Tt(k,c,I),d=!0},p(k,I){I&1&&gn(o,o=k[0])?(ds(),Xt(_,1,1,Un),ps(),_=ky(k),_.c(),Dt(_,1),_.m(c.parentNode,c)):_.p(k,I)},i(k){d||(Dt(_),d=!0)},o(k){Xt(_),d=!1},d(k){k&&St(c),_.d(k)}}}function ky(s){let o;const c=s[15].default,d=Po(c,s,s[14],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&16384)&&Ao(d,c,_,_[14],o?Lo(c,_[14],k,null):Mo(_[14]),null)},i(_){o||(Dt(d,_),o=!0)},o(_){Xt(d,_),o=!1},d(_){d&&d.d(_)}}}function P2(s){let o,c,d=s[0]&&wy(s);return{c(){d&&d.c(),o=Yr()},m(_,k){d&&d.m(_,k),Tt(_,o,k),c=!0},p(_,[k]){_[0]?d?(d.p(_,k),k&1&&Dt(d,1)):(d=wy(_),d.c(),Dt(d,1),d.m(o.parentNode,o)):d&&(ds(),Xt(d,1,1,()=>{d=null}),ps())},i(_){c||(Dt(d),c=!0)},o(_){Xt(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function L2(s,o,c){let d,_,{$$slots:k={},$$scope:I}=o,{id:f=eh("vector")}=o,{url:D=null}=o,{tiles:F=null}=o,{promoteId:j=null}=o,{bounds:N=null}=o,{scheme:V=null}=o,{attribution:Q=null}=o,{minzoom:re=null}=o,{maxzoom:Ae=null}=o,{volatile:xe=null}=o;if(D&&D.includes("pmtiles://")&&!fs.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let Re=new g2;fs.addProtocol("pmtiles",Re.tile)}const{map:Te,self:Ce}=Hv();Pn(s,Te,Re=>c(13,_=Re)),Pn(s,Ce,Re=>c(0,d=Re));let ke;return Ro(()=>{d&&_&&(e0(Te,d,ke),Co(Ce,d=null,d),ke=void 0)}),s.$$set=Re=>{"id"in Re&&c(3,f=Re.id),"url"in Re&&c(4,D=Re.url),"tiles"in Re&&c(5,F=Re.tiles),"promoteId"in Re&&c(6,j=Re.promoteId),"bounds"in Re&&c(7,N=Re.bounds),"scheme"in Re&&c(8,V=Re.scheme),"attribution"in Re&&c(9,Q=Re.attribution),"minzoom"in Re&&c(10,re=Re.minzoom),"maxzoom"in Re&&c(11,Ae=Re.maxzoom),"volatile"in Re&&c(12,xe=Re.volatile),"$$scope"in Re&&c(14,I=Re.$$scope)},s.$$.update=()=>{s.$$.dirty&16377&&_&&d!==f&&(Co(Ce,d=f,d),$v(_,d,Hc({type:"vector",url:D,tiles:F,promoteId:j,bounds:N,scheme:V,attribution:Q,minzoom:re,maxzoom:Ae,volatile:xe}),Re=>_&&Re===d,()=>{d&&(ke=_==null?void 0:_.getSource(d))})),s.$$.dirty&8200&&(_==null||_.on("style.load",()=>{ke=_==null?void 0:_.getSource(f)}))},[d,Te,Ce,f,D,F,j,N,V,Q,re,Ae,xe,_,I,k]}class A2 extends qn{constructor(o){super(),Vn(this,o,L2,P2,gn,{id:3,url:4,tiles:5,promoteId:6,bounds:7,scheme:8,attribution:9,minzoom:10,maxzoom:11,volatile:12})}}const M2="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(M2);const R2=[{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"}],D2={decimalLatitude:40.123,decimalLongitude:-74.123},z2=[{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}],N2=[{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},{verbatimCoordinates:"53 16.3863,4 52.8171",verbatimLatitude:"53 16.3863",verbatimLongitude:"4 52.8171",decimalLatitude:53.273105,decimalLongitude:4.88029},{verbatimCoordinates:"50 8.2914,-5 2.4447",verbatimLatitude:"50 8.2914",verbatimLongitude:"-5 2.4447",decimalLatitude:50.13819,decimalLongitude:-5.040745},{verbatimCoordinates:"N 48° 30,6410', E 18° 57,4583'",verbatimLatitude:"N 48° 30,6410'",verbatimLongitude:"E 18° 57,4583'",decimalLatitude:48.51068,decimalLongitude:18.95764},{verbatimCoordinates:"1.23456, 18.33453",verbatimLatitude:"1.23456",verbatimLongitude:"18.33453",decimalLatitude:1.23456,decimalLongitude:18.33453}];function O2(){const s=[];return R2.forEach(o=>{o.decimalLatitude?s.push(o):s.push({...o,...D2})}),[...s,...z2,...N2]}const F2=O2();F2.map(s=>s.verbatimCoordinates);var Yc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function p0(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function B2(s){if(s.__esModule)return s;var o=s.default;if(typeof o=="function"){var c=function d(){return this instanceof d?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};c.prototype=o.prototype}else c={};return Object.defineProperty(c,"__esModule",{value:!0}),Object.keys(s).forEach(function(d){var _=Object.getOwnPropertyDescriptor(s,d);Object.defineProperty(c,d,_.get?_:{enumerable:!0,get:function(){return s[d]}})}),c}var Sy=Object.prototype.toString,m0=function(s){var o=Sy.call(s),c=o==="[object Arguments]";return c||(c=o!=="[object Array]"&&s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&Sy.call(s.callee)==="[object Function]"),c},Od,Iy;function j2(){if(Iy)return Od;Iy=1;var s;if(!Object.keys){var o=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=m0,_=Object.prototype.propertyIsEnumerable,k=!_.call({toString:null},"toString"),I=_.call(function(){},"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],D=function(V){var Q=V.constructor;return Q&&Q.prototype===V},F={$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},j=function(){if(typeof window>"u")return!1;for(var V in window)try{if(!F["$"+V]&&o.call(window,V)&&window[V]!==null&&typeof window[V]=="object")try{D(window[V])}catch{return!0}}catch{return!0}return!1}(),N=function(V){if(typeof window>"u"||!j)return D(V);try{return D(V)}catch{return!1}};s=function(V){var Q=V!==null&&typeof V=="object",re=c.call(V)==="[object Function]",Ae=d(V),xe=Q&&c.call(V)==="[object String]",Te=[];if(!Q&&!re&&!Ae)throw new TypeError("Object.keys called on a non-object");var Ce=I&&re;if(xe&&V.length>0&&!o.call(V,0))for(var ke=0;ke0)for(var Re=0;Re"u"||!ar?Pi:ar(Uint8Array),zl={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Pi:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pi:ArrayBuffer,"%ArrayIteratorPrototype%":yu&&ar?ar([][Symbol.iterator]()):Pi,"%AsyncFromSyncIteratorPrototype%":Pi,"%AsyncFunction%":bu,"%AsyncGenerator%":bu,"%AsyncGeneratorFunction%":bu,"%AsyncIteratorPrototype%":bu,"%Atomics%":typeof Atomics>"u"?Pi:Atomics,"%BigInt%":typeof BigInt>"u"?Pi:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pi:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pi:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pi:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":lk,"%eval%":eval,"%EvalError%":uk,"%Float32Array%":typeof Float32Array>"u"?Pi:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pi:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pi:FinalizationRegistry,"%Function%":_0,"%GeneratorFunction%":bu,"%Int8Array%":typeof Int8Array>"u"?Pi:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pi:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pi:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":yu&&ar?ar(ar([][Symbol.iterator]())):Pi,"%JSON%":typeof JSON=="object"?JSON:Pi,"%Map%":typeof Map>"u"?Pi:Map,"%MapIteratorPrototype%":typeof Map>"u"||!yu||!ar?Pi:ar(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pi:Promise,"%Proxy%":typeof Proxy>"u"?Pi:Proxy,"%RangeError%":ck,"%ReferenceError%":hk,"%Reflect%":typeof Reflect>"u"?Pi:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pi:Set,"%SetIteratorPrototype%":typeof Set>"u"||!yu||!ar?Pi:ar(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pi:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":yu&&ar?ar(""[Symbol.iterator]()):Pi,"%Symbol%":yu?Symbol:Pi,"%SyntaxError%":Tu,"%ThrowTypeError%":dk,"%TypedArray%":mk,"%TypeError%":Eu,"%Uint8Array%":typeof Uint8Array>"u"?Pi:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pi:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pi:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pi:Uint32Array,"%URIError%":fk,"%WeakMap%":typeof WeakMap>"u"?Pi:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pi:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pi:WeakSet};if(ar)try{null.error}catch(s){var gk=ar(ar(s));zl["%Error.prototype%"]=gk}var yk=function s(o){var c;if(o==="%AsyncFunction%")c=Bd("async function () {}");else if(o==="%GeneratorFunction%")c=Bd("function* () {}");else if(o==="%AsyncGeneratorFunction%")c=Bd("async function* () {}");else if(o==="%AsyncGenerator%"){var d=s("%AsyncGeneratorFunction%");d&&(c=d.prototype)}else if(o==="%AsyncIteratorPrototype%"){var _=s("%AsyncGenerator%");_&&ar&&(c=ar(_.prototype))}return zl[o]=c,c},Ly={__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"]},ih=Jp,lf=y0,_k=ih.call(Function.call,Array.prototype.concat),vk=ih.call(Function.apply,Array.prototype.splice),Ay=ih.call(Function.call,String.prototype.replace),uf=ih.call(Function.call,String.prototype.slice),xk=ih.call(Function.call,RegExp.prototype.exec),bk=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,wk=/\\(\\)?/g,kk=function(s){var o=uf(s,0,1),c=uf(s,-1);if(o==="%"&&c!=="%")throw new Tu("invalid intrinsic syntax, expected closing `%`");if(c==="%"&&o!=="%")throw new Tu("invalid intrinsic syntax, expected opening `%`");var d=[];return Ay(s,bk,function(_,k,I,f){d[d.length]=I?Ay(f,wk,"$1"):k||_}),d},Sk=function(s,o){var c=s,d;if(lf(Ly,c)&&(d=Ly[c],c="%"+d[0]+"%"),lf(zl,c)){var _=zl[c];if(_===bu&&(_=yk(c)),typeof _>"u"&&!o)throw new Eu("intrinsic "+s+" exists, but is not available. Please file an issue!");return{alias:d,name:c,value:_}}throw new Tu("intrinsic "+s+" does not exist!")},zo=function(s,o){if(typeof s!="string"||s.length===0)throw new Eu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof o!="boolean")throw new Eu('"allowMissing" argument must be a boolean');if(xk(/^%?[^%]*%?$/,s)===null)throw new Tu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var c=kk(s),d=c.length>0?c[0]:"",_=Sk("%"+d+"%",o),k=_.name,I=_.value,f=!1,D=_.alias;D&&(d=D[0],vk(c,_k([0,1],D)));for(var F=1,j=!0;F=c.length){var re=Dl(I,N);j=!!re,j&&"get"in re&&!("originalValue"in re.get)?I=re.get:I=I[N]}else j=lf(I,N),I=I[N];j&&!f&&(zl[k]=I)}}return I},Ik=zo,Yh=Ik("%Object.defineProperty%",!0)||!1;if(Yh)try{Yh({},"a",{value:1})}catch{Yh=!1}var Qp=Yh,Ek=zo,Kh=Ek("%Object.getOwnPropertyDescriptor%",!0);if(Kh)try{Kh([],"length")}catch{Kh=null}var $p=Kh,My=Qp,Tk=g0,_u=Qa,Ry=$p,em=function(s,o,c){if(!s||typeof s!="object"&&typeof s!="function")throw new _u("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new _u("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _u("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _u("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _u("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _u("`loose`, if provided, must be a boolean");var d=arguments.length>3?arguments[3]:null,_=arguments.length>4?arguments[4]:null,k=arguments.length>5?arguments[5]:null,I=arguments.length>6?arguments[6]:!1,f=!!Ry&&Ry(s,o);if(My)My(s,o,{configurable:k===null&&f?f.configurable:!k,enumerable:d===null&&f?f.enumerable:!d,value:c,writable:_===null&&f?f.writable:!_});else if(I||!d&&!_&&!k)s[o]=c;else throw new Tk("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},hp=Qp,v0=function(){return!!hp};v0.hasArrayLengthDefineBug=function(){if(!hp)return null;try{return hp([],"length",{value:1}).length!==1}catch{return!0}};var tm=v0,Ck=Yp,Pk=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Lk=Object.prototype.toString,Ak=Array.prototype.concat,Dy=em,Mk=function(s){return typeof s=="function"&&Lk.call(s)==="[object Function]"},x0=tm(),Rk=function(s,o,c,d){if(o in s){if(d===!0){if(s[o]===c)return}else if(!Mk(d)||!d())return}x0?Dy(s,o,c,!0):Dy(s,o,c)},b0=function(s,o){var c=arguments.length>2?arguments[2]:{},d=Ck(o);Pk&&(d=Ak.call(d,Object.getOwnPropertySymbols(o)));for(var _=0;_4294967295||Nk(o)!==o)throw new Oy("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],d=!0,_=!0;if("length"in s&&Ny){var k=Ny(s,"length");k&&!k.configurable&&(d=!1),k&&!k.writable&&(_=!1)}return(d||_||!c)&&(zk?zy(s,"length",o,!0,!0):zy(s,"length",o)),s};(function(s){var o=Jp,c=zo,d=Ok,_=Qa,k=c("%Function.prototype.apply%"),I=c("%Function.prototype.call%"),f=c("%Reflect.apply%",!0)||o.call(I,k),D=Qp,F=c("%Math.max%");s.exports=function(N){if(typeof N!="function")throw new _("a function is required");var V=f(o,I,arguments);return d(V,1+F(0,N.length-(arguments.length-1)),!0)};var j=function(){return f(o,k,arguments)};D?D(s.exports,"apply",{value:j}):s.exports.apply=j})(w0);var Ru=w0.exports,k0=zo,S0=Ru,Fk=S0(k0("String.prototype.indexOf")),Ds=function(s,o){var c=k0(s,!!o);return typeof c=="function"&&Fk(s,".prototype.")>-1?S0(c):c},Bk=Yp,I0=zf(),E0=Ds,Fy=Object,jk=E0("Array.prototype.push"),By=E0("Object.prototype.propertyIsEnumerable"),Uk=I0?Object.getOwnPropertySymbols:null,T0=function(s,o){if(s==null)throw new TypeError("target must be an object");var c=Fy(s);if(arguments.length===1)return c;for(var d=1;d2&&!!arguments[2];return(!c||nS)&&(iS?jy(s,"name",o,!0,!0):jy(s,"name",o)),s},oS=sS,aS=Qa,lS=Object,A0=oS(function(){if(this==null||this!==lS(this))throw new aS("RegExp.prototype.flags getter called on non-object");var s="";return this.hasIndices&&(s+="d"),this.global&&(s+="g"),this.ignoreCase&&(s+="i"),this.multiline&&(s+="m"),this.dotAll&&(s+="s"),this.unicode&&(s+="u"),this.unicodeSets&&(s+="v"),this.sticky&&(s+="y"),s},"get flags",!0),uS=A0,cS=Fl.supportsDescriptors,hS=Object.getOwnPropertyDescriptor,M0=function(){if(cS&&/a/mig.flags==="gim"){var s=hS(RegExp.prototype,"flags");if(s&&typeof s.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var o="",c={};if(Object.defineProperty(c,"hasIndices",{get:function(){o+="d"}}),Object.defineProperty(c,"sticky",{get:function(){o+="y"}}),o==="dy")return s.get}}return uS},fS=Fl.supportsDescriptors,dS=M0,pS=Object.getOwnPropertyDescriptor,mS=Object.defineProperty,gS=TypeError,Uy=Object.getPrototypeOf,yS=/a/,_S=function(){if(!fS||!Uy)throw new gS("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var s=dS(),o=Uy(yS),c=pS(o,"flags");return(!c||c.get!==s)&&mS(o,"flags",{configurable:!0,enumerable:!1,get:s}),s},vS=Fl,xS=Ru,bS=A0,R0=M0,wS=_S,D0=xS(R0());vS(D0,{getPolyfill:R0,implementation:bS,shim:wS});var kS=D0,Jh={exports:{}},SS=zf,Bl=function(){return SS()&&!!Symbol.toStringTag},IS=Bl(),ES=Ds,fp=ES("Object.prototype.toString"),Nf=function(s){return IS&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:fp(s)==="[object Arguments]"},z0=function(s){return Nf(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&fp(s)!=="[object Array]"&&fp(s.callee)==="[object Function]"},TS=function(){return Nf(arguments)}();Nf.isLegacyArguments=z0;var N0=TS?Nf:z0;const CS={},PS=Object.freeze(Object.defineProperty({__proto__:null,default:CS},Symbol.toStringTag,{value:"Module"})),LS=B2(PS);var im=typeof Map=="function"&&Map.prototype,Ud=Object.getOwnPropertyDescriptor&&im?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,cf=im&&Ud&&typeof Ud.get=="function"?Ud.get:null,Vy=im&&Map.prototype.forEach,nm=typeof Set=="function"&&Set.prototype,Vd=Object.getOwnPropertyDescriptor&&nm?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,hf=nm&&Vd&&typeof Vd.get=="function"?Vd.get:null,qy=nm&&Set.prototype.forEach,AS=typeof WeakMap=="function"&&WeakMap.prototype,qc=AS?WeakMap.prototype.has:null,MS=typeof WeakSet=="function"&&WeakSet.prototype,Gc=MS?WeakSet.prototype.has:null,RS=typeof WeakRef=="function"&&WeakRef.prototype,Gy=RS?WeakRef.prototype.deref:null,DS=Boolean.prototype.valueOf,zS=Object.prototype.toString,NS=Function.prototype.toString,OS=String.prototype.match,rm=String.prototype.slice,Xa=String.prototype.replace,FS=String.prototype.toUpperCase,Zy=String.prototype.toLowerCase,O0=RegExp.prototype.test,Wy=Array.prototype.concat,So=Array.prototype.join,BS=Array.prototype.slice,Xy=Math.floor,dp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,qd=Object.getOwnPropertySymbols,pp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Cu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Mr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Cu||!0)?Symbol.toStringTag:null,F0=Object.prototype.propertyIsEnumerable,Hy=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function Yy(s,o){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||O0.call(/e/,o))return o;var c=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var d=s<0?-Xy(-s):Xy(s);if(d!==s){var _=String(d),k=rm.call(o,_.length+1);return Xa.call(_,c,"$&_")+"."+Xa.call(Xa.call(k,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xa.call(o,c,"$&_")}var mp=LS,Ky=mp.custom,Jy=j0(Ky)?Ky:null,jS=function s(o,c,d,_){var k=c||{};if(Za(k,"quoteStyle")&&k.quoteStyle!=="single"&&k.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Za(k,"maxStringLength")&&(typeof k.maxStringLength=="number"?k.maxStringLength<0&&k.maxStringLength!==1/0:k.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var I=Za(k,"customInspect")?k.customInspect:!0;if(typeof I!="boolean"&&I!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Za(k,"indent")&&k.indent!==null&&k.indent!==" "&&!(parseInt(k.indent,10)===k.indent&&k.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Za(k,"numericSeparator")&&typeof k.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=k.numericSeparator;if(typeof o>"u")return"undefined";if(o===null)return"null";if(typeof o=="boolean")return o?"true":"false";if(typeof o=="string")return V0(o,k);if(typeof o=="number"){if(o===0)return 1/0/o>0?"0":"-0";var D=String(o);return f?Yy(o,D):D}if(typeof o=="bigint"){var F=String(o)+"n";return f?Yy(o,F):F}var j=typeof k.depth>"u"?5:k.depth;if(typeof d>"u"&&(d=0),d>=j&&j>0&&typeof o=="object")return gp(o)?"[Array]":"[Object]";var N=rI(k,d);if(typeof _>"u")_=[];else if(U0(_,o)>=0)return"[Circular]";function V(st,Ue,lt){if(Ue&&(_=BS.call(_),_.push(Ue)),lt){var Lt={depth:k.depth};return Za(k,"quoteStyle")&&(Lt.quoteStyle=k.quoteStyle),s(st,Lt,d+1,_)}return s(st,k,d+1,_)}if(typeof o=="function"&&!Qy(o)){var Q=YS(o),re=Bh(o,V);return"[Function"+(Q?": "+Q:" (anonymous)")+"]"+(re.length>0?" { "+So.call(re,", ")+" }":"")}if(j0(o)){var Ae=Cu?Xa.call(String(o),/^(Symbol\(.*\))_[^)]*$/,"$1"):pp.call(o);return typeof o=="object"&&!Cu?Mc(Ae):Ae}if(tI(o)){for(var xe="<"+Zy.call(String(o.nodeName)),Te=o.attributes||[],Ce=0;Ce",xe}if(gp(o)){if(o.length===0)return"[]";var ke=Bh(o,V);return N&&!nI(ke)?"["+yp(ke,N)+"]":"[ "+So.call(ke,", ")+" ]"}if(qS(o)){var Re=Bh(o,V);return!("cause"in Error.prototype)&&"cause"in o&&!F0.call(o,"cause")?"{ ["+String(o)+"] "+So.call(Wy.call("[cause]: "+V(o.cause),Re),", ")+" }":Re.length===0?"["+String(o)+"]":"{ ["+String(o)+"] "+So.call(Re,", ")+" }"}if(typeof o=="object"&&I){if(Jy&&typeof o[Jy]=="function"&&mp)return mp(o,{depth:j-d});if(I!=="symbol"&&typeof o.inspect=="function")return o.inspect()}if(KS(o)){var ze=[];return Vy&&Vy.call(o,function(st,Ue){ze.push(V(Ue,o,!0)+" => "+V(st,o))}),$y("Map",cf.call(o),ze,N)}if($S(o)){var Oe=[];return qy&&qy.call(o,function(st){Oe.push(V(st,o))}),$y("Set",hf.call(o),Oe,N)}if(JS(o))return Gd("WeakMap");if(eI(o))return Gd("WeakSet");if(QS(o))return Gd("WeakRef");if(ZS(o))return Mc(V(Number(o)));if(XS(o))return Mc(V(dp.call(o)));if(WS(o))return Mc(DS.call(o));if(GS(o))return Mc(V(String(o)));if(typeof window<"u"&&o===window)return"{ [object Window] }";if(typeof globalThis<"u"&&o===globalThis||typeof Yc<"u"&&o===Yc)return"{ [object globalThis] }";if(!VS(o)&&!Qy(o)){var Ze=Bh(o,V),je=Hy?Hy(o)===Object.prototype:o instanceof Object||o.constructor===Object,He=o instanceof Object?"":"null prototype",pt=!je&&Mr&&Object(o)===o&&Mr in o?rm.call($a(o),8,-1):He?"Object":"",Ie=je||typeof o.constructor!="function"?"":o.constructor.name?o.constructor.name+" ":"",Pt=Ie+(pt||He?"["+So.call(Wy.call([],pt||[],He||[]),": ")+"] ":"");return Ze.length===0?Pt+"{}":N?Pt+"{"+yp(Ze,N)+"}":Pt+"{ "+So.call(Ze,", ")+" }"}return String(o)};function B0(s,o,c){var d=(c.quoteStyle||o)==="double"?'"':"'";return d+s+d}function US(s){return Xa.call(String(s),/"/g,""")}function gp(s){return $a(s)==="[object Array]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function VS(s){return $a(s)==="[object Date]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function Qy(s){return $a(s)==="[object RegExp]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function qS(s){return $a(s)==="[object Error]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function GS(s){return $a(s)==="[object String]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function ZS(s){return $a(s)==="[object Number]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function WS(s){return $a(s)==="[object Boolean]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function j0(s){if(Cu)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!pp)return!1;try{return pp.call(s),!0}catch{}return!1}function XS(s){if(!s||typeof s!="object"||!dp)return!1;try{return dp.call(s),!0}catch{}return!1}var HS=Object.prototype.hasOwnProperty||function(s){return s in this};function Za(s,o){return HS.call(s,o)}function $a(s){return zS.call(s)}function YS(s){if(s.name)return s.name;var o=OS.call(NS.call(s),/^function\s*([\w$]+)/);return o?o[1]:null}function U0(s,o){if(s.indexOf)return s.indexOf(o);for(var c=0,d=s.length;co.maxStringLength){var c=s.length-o.maxStringLength,d="... "+c+" more character"+(c>1?"s":"");return V0(rm.call(s,0,o.maxStringLength),o)+d}var _=Xa.call(Xa.call(s,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,iI);return B0(_,"single",o)}function iI(s){var o=s.charCodeAt(0),c={8:"b",9:"t",10:"n",12:"f",13:"r"}[o];return c?"\\"+c:"\\x"+(o<16?"0":"")+FS.call(o.toString(16))}function Mc(s){return"Object("+s+")"}function Gd(s){return s+" { ? }"}function $y(s,o,c,d){var _=d?yp(c,d):So.call(c,", ");return s+" ("+o+") {"+_+"}"}function nI(s){for(var o=0;o=0)return!1;return!0}function rI(s,o){var c;if(s.indent===" ")c=" ";else if(typeof s.indent=="number"&&s.indent>0)c=So.call(Array(s.indent+1)," ");else return null;return{base:c,prev:So.call(Array(o+1),c)}}function yp(s,o){if(s.length===0)return"";var c=` -`+o.prev+o.base;return c+So.call(s,","+c)+` -`+o.prev}function Bh(s,o){var c=gp(s),d=[];if(c){d.length=s.length;for(var _=0;_=c)return o+1;var d=a_(s,o);if(d<55296||d>56319)return o+1;var _=a_(s,o+1);return _<56320||_>57343?o+1:o+2},Wd=function(s){var o=0;return{next:function(){var c=o>=s.length,d;return c||(d=s[o],o+=1),{done:c,value:d}}}},l_=function(s,o){if(CI(s)||n_(s))return Wd(s);if(PI(s)){var c=0;return{next:function(){var d=RI(s,c),_=MI(s,c,d);return c=d,{done:d>s.length,value:_}}}}if(o&&typeof s["_es6-shim iterator_"]<"u")return s["_es6-shim iterator_"]()};if(!LI&&!AI)Jh.exports=function(s){if(s!=null)return l_(s,!0)};else{var DI=H0,zI=K0,u_=Ks("Map.prototype.forEach",!0),c_=Ks("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var h_=Ks("Map.prototype.iterator",!0),f_=Ks("Set.prototype.iterator",!0);var d_=Ks("Map.prototype.@@iterator",!0)||Ks("Map.prototype._es6-shim iterator_",!0),p_=Ks("Set.prototype.@@iterator",!0)||Ks("Set.prototype._es6-shim iterator_",!0),NI=function(s){if(DI(s)){if(h_)return r_(h_(s));if(d_)return d_(s);if(u_){var o=[];return u_(s,function(d,_){o_(o,[_,d])}),Wd(o)}}if(zI(s)){if(f_)return r_(f_(s));if(p_)return p_(s);if(c_){var c=[];return c_(s,function(d){o_(c,d)}),Wd(c)}}};Jh.exports=function(s){return NI(s)||l_(s)}}}var OI=Jh.exports,m_=function(s){return s!==s},J0=function(s,o){return s===0&&o===0?1/s===1/o:!!(s===o||m_(s)&&m_(o))},FI=J0,Q0=function(){return typeof Object.is=="function"?Object.is:FI},BI=Q0,jI=Fl,UI=function(){var s=BI();return jI(Object,{is:s},{is:function(){return Object.is!==s}}),s},VI=Fl,qI=Ru,GI=J0,$0=Q0,ZI=UI,e1=qI($0(),Object);VI(e1,{getPolyfill:$0,implementation:GI,shim:ZI});var WI=e1,XI=Ru,t1=Ds,HI=zo,_p=HI("%ArrayBuffer%",!0),Qh=t1("ArrayBuffer.prototype.byteLength",!0),YI=t1("Object.prototype.toString"),g_=!!_p&&!Qh&&new _p(0).slice,y_=!!g_&&XI(g_),i1=Qh||y_?function(s){if(!s||typeof s!="object")return!1;try{return Qh?Qh(s):y_(s,0),!0}catch{return!1}}:_p?function(s){return YI(s)==="[object ArrayBuffer]"}:function(s){return!1},KI=Date.prototype.getDay,JI=function(s){try{return KI.call(s),!0}catch{return!1}},QI=Object.prototype.toString,$I="[object Date]",eE=Bl(),tE=function(s){return typeof s!="object"||s===null?!1:eE?JI(s):QI.call(s)===$I},vp=Ds,n1=Bl(),r1,s1,xp,bp;if(n1){r1=vp("Object.prototype.hasOwnProperty"),s1=vp("RegExp.prototype.exec"),xp={};var Xd=function(){throw xp};bp={toString:Xd,valueOf:Xd},typeof Symbol.toPrimitive=="symbol"&&(bp[Symbol.toPrimitive]=Xd)}var iE=vp("Object.prototype.toString"),nE=Object.getOwnPropertyDescriptor,rE="[object RegExp]",sE=n1?function(s){if(!s||typeof s!="object")return!1;var o=nE(s,"lastIndex"),c=o&&r1(o,"value");if(!c)return!1;try{s1(s,bp)}catch(d){return d===xp}}:function(s){return!s||typeof s!="object"&&typeof s!="function"?!1:iE(s)===rE},oE=Ds,__=oE("SharedArrayBuffer.prototype.byteLength",!0),aE=__?function(s){if(!s||typeof s!="object")return!1;try{return __(s),!0}catch{return!1}}:function(s){return!1},lE=Number.prototype.toString,uE=function(s){try{return lE.call(s),!0}catch{return!1}},cE=Object.prototype.toString,hE="[object Number]",fE=Bl(),dE=function(s){return typeof s=="number"?!0:typeof s!="object"?!1:fE?uE(s):cE.call(s)===hE},o1=Ds,pE=o1("Boolean.prototype.toString"),mE=o1("Object.prototype.toString"),gE=function(s){try{return pE(s),!0}catch{return!1}},yE="[object Boolean]",_E=Bl(),vE=function(s){return typeof s=="boolean"?!0:s===null||typeof s!="object"?!1:_E&&Symbol.toStringTag in s?gE(s):mE(s)===yE},wp={exports:{}},xE=Object.prototype.toString,bE=Kp();if(bE){var wE=Symbol.prototype.toString,kE=/^Symbol\(.*\)$/,SE=function(s){return typeof s.valueOf()!="symbol"?!1:kE.test(wE.call(s))};wp.exports=function(s){if(typeof s=="symbol")return!0;if(xE.call(s)!=="[object Symbol]")return!1;try{return SE(s)}catch{return!1}}}else wp.exports=function(s){return!1};var IE=wp.exports,kp={exports:{}},v_=typeof BigInt<"u"&&BigInt,EE=function(){return typeof v_=="function"&&typeof BigInt=="function"&&typeof v_(42)=="bigint"&&typeof BigInt(42)=="bigint"},TE=EE();if(TE){var CE=BigInt.prototype.valueOf,PE=function(s){try{return CE.call(s),!0}catch{}return!1};kp.exports=function(s){return s===null||typeof s>"u"||typeof s=="boolean"||typeof s=="string"||typeof s=="number"||typeof s=="symbol"||typeof s=="function"?!1:typeof s=="bigint"?!0:PE(s)}}else kp.exports=function(s){return!1};var LE=kp.exports,AE=W0,ME=dE,RE=vE,DE=IE,zE=LE,NE=function(s){if(s==null||typeof s!="object"&&typeof s!="function")return null;if(AE(s))return"String";if(ME(s))return"Number";if(RE(s))return"Boolean";if(DE(s))return"Symbol";if(zE(s))return"BigInt"},pf=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,x_=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,mf;pf||(mf=function(s){return!1});var Sp=pf?pf.prototype.has:null,Hd=x_?x_.prototype.has:null;!mf&&!Sp&&(mf=function(s){return!1});var OE=mf||function(s){if(!s||typeof s!="object")return!1;try{if(Sp.call(s,Sp),Hd)try{Hd.call(s,Hd)}catch{return!0}return s instanceof pf}catch{}return!1},Ip={exports:{}},FE=zo,a1=Ds,BE=FE("%WeakSet%",!0),Yd=a1("WeakSet.prototype.has",!0);if(Yd){var Kd=a1("WeakMap.prototype.has",!0);Ip.exports=function(s){if(!s||typeof s!="object")return!1;try{if(Yd(s,Yd),Kd)try{Kd(s,Kd)}catch{return!0}return s instanceof BE}catch{}return!1}}else Ip.exports=function(s){return!1};var jE=Ip.exports,UE=H0,VE=K0,qE=OE,GE=jE,ZE=function(s){if(s&&typeof s=="object"){if(UE(s))return"Map";if(VE(s))return"Set";if(qE(s))return"WeakMap";if(GE(s))return"WeakSet"}return!1},l1=Function.prototype.toString,ku=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ep,$h;if(typeof ku=="function"&&typeof Object.defineProperty=="function")try{Ep=Object.defineProperty({},"length",{get:function(){throw $h}}),$h={},ku(function(){throw 42},null,Ep)}catch(s){s!==$h&&(ku=null)}else ku=null;var WE=/^\s*class\b/,Tp=function(s){try{var o=l1.call(s);return WE.test(o)}catch{return!1}},Jd=function(s){try{return Tp(s)?!1:(l1.call(s),!0)}catch{return!1}},ef=Object.prototype.toString,XE="[object Object]",HE="[object Function]",YE="[object GeneratorFunction]",KE="[object HTMLAllCollection]",JE="[object HTML document.all class]",QE="[object HTMLCollection]",$E=typeof Symbol=="function"&&!!Symbol.toStringTag,eT=!(0 in[,]),Cp=function(){return!1};if(typeof document=="object"){var tT=document.all;ef.call(tT)===ef.call(document.all)&&(Cp=function(s){if((eT||!s)&&(typeof s>"u"||typeof s=="object"))try{var o=ef.call(s);return(o===KE||o===JE||o===QE||o===XE)&&s("")==null}catch{}return!1})}var iT=ku?function(s){if(Cp(s))return!0;if(!s||typeof s!="function"&&typeof s!="object")return!1;try{ku(s,null,Ep)}catch(o){if(o!==$h)return!1}return!Tp(s)&&Jd(s)}:function(s){if(Cp(s))return!0;if(!s||typeof s!="function"&&typeof s!="object")return!1;if($E)return Jd(s);if(Tp(s))return!1;var o=ef.call(s);return o!==HE&&o!==YE&&!/^\[object HTML/.test(o)?!1:Jd(s)},nT=iT,rT=Object.prototype.toString,u1=Object.prototype.hasOwnProperty,sT=function(s,o,c){for(var d=0,_=s.length;d<_;d++)u1.call(s,d)&&(c==null?o(s[d],d,s):o.call(c,s[d],d,s))},oT=function(s,o,c){for(var d=0,_=s.length;d<_;d++)c==null?o(s.charAt(d),d,s):o.call(c,s.charAt(d),d,s)},aT=function(s,o,c){for(var d in s)u1.call(s,d)&&(c==null?o(s[d],d,s):o.call(c,s[d],d,s))},lT=function(s,o,c){if(!nT(o))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=c),rT.call(s)==="[object Array]"?sT(s,o,d):typeof s=="string"?oT(s,o,d):aT(s,o,d)},uT=lT,cT=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Qd=cT,hT=typeof globalThis>"u"?Yc:globalThis,fT=function(){for(var s=[],o=0;o"u"?Yc:globalThis,Pp=dT(),cm=um("String.prototype.slice"),$d=Object.getPrototypeOf,mT=um("Array.prototype.indexOf",!0)||function(s,o){for(var c=0;c-1?o:o!=="Object"?!1:yT(s)}return tf?gT(s):null},vT=Ds,k_=vT("ArrayBuffer.prototype.byteLength",!0),xT=i1,bT=function(s){return xT(s)?k_?k_(s):s.byteLength:NaN},h1=$k,No=Ds,S_=kS,wT=zo,Pu=OI,kT=G0,I_=WI,E_=N0,T_=Z0,C_=i1,P_=tE,L_=sE,A_=aE,M_=Yp,R_=NE,D_=ZE,z_=_T,N_=bT,O_=No("SharedArrayBuffer.prototype.byteLength",!0),F_=No("Date.prototype.getTime"),ep=Object.getPrototypeOf,B_=No("Object.prototype.toString"),_f=wT("%Set%",!0),Lp=No("Map.prototype.has",!0),vf=No("Map.prototype.get",!0),j_=No("Map.prototype.size",!0),xf=No("Set.prototype.add",!0),f1=No("Set.prototype.delete",!0),bf=No("Set.prototype.has",!0),nf=No("Set.prototype.size",!0);function U_(s,o,c,d){for(var _=Pu(s),k;(k=_.next())&&!k.done;)if(Qs(o,k.value,c,d))return f1(s,k.value),!0;return!1}function d1(s){if(typeof s>"u")return null;if(typeof s!="object")return typeof s=="symbol"?!1:typeof s=="string"||typeof s=="number"?+s==+s:!0}function ST(s,o,c,d,_,k){var I=d1(c);if(I!=null)return I;var f=vf(o,I),D=h1({},_,{strict:!1});return typeof f>"u"&&!Lp(o,I)||!Qs(d,f,D,k)?!1:!Lp(s,I)&&Qs(d,f,D,k)}function IT(s,o,c){var d=d1(c);return d??(bf(o,d)&&!bf(s,d))}function V_(s,o,c,d,_,k){for(var I=Pu(s),f,D;(f=I.next())&&!f.done;)if(D=f.value,Qs(c,D,_,k)&&Qs(d,vf(o,D),_,k))return f1(s,D),!0;return!1}function Qs(s,o,c,d){var _=c||{};if(_.strict?I_(s,o):s===o)return!0;var k=R_(s),I=R_(o);if(k!==I)return!1;if(!s||!o||typeof s!="object"&&typeof o!="object")return _.strict?I_(s,o):s==o;var f=d.has(s),D=d.has(o),F;if(f&&D){if(d.get(s)===d.get(o))return!0}else F={};return f||d.set(s,F),D||d.set(o,F),CT(s,o,_,d)}function q_(s){return!s||typeof s!="object"||typeof s.length!="number"||typeof s.copy!="function"||typeof s.slice!="function"||s.length>0&&typeof s[0]!="number"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function ET(s,o,c,d){if(nf(s)!==nf(o))return!1;for(var _=Pu(s),k=Pu(o),I,f,D;(I=_.next())&&!I.done;)if(I.value&&typeof I.value=="object")D||(D=new _f),xf(D,I.value);else if(!bf(o,I.value)){if(c.strict||!IT(s,o,I.value))return!1;D||(D=new _f),xf(D,I.value)}if(D){for(;(f=k.next())&&!f.done;)if(f.value&&typeof f.value=="object"){if(!U_(D,f.value,c.strict,d))return!1}else if(!c.strict&&!bf(s,f.value)&&!U_(D,f.value,c.strict,d))return!1;return nf(D)===0}return!0}function TT(s,o,c,d){if(j_(s)!==j_(o))return!1;for(var _=Pu(s),k=Pu(o),I,f,D,F,j,N;(I=_.next())&&!I.done;)if(F=I.value[0],j=I.value[1],F&&typeof F=="object")D||(D=new _f),xf(D,F);else if(N=vf(o,F),typeof N>"u"&&!Lp(o,F)||!Qs(j,N,c,d)){if(c.strict||!ST(s,o,F,j,c,d))return!1;D||(D=new _f),xf(D,F)}if(D){for(;(f=k.next())&&!f.done;)if(F=f.value[0],N=f.value[1],F&&typeof F=="object"){if(!V_(D,s,F,N,c,d))return!1}else if(!c.strict&&(!s.has(F)||!Qs(vf(s,F),N,c,d))&&!V_(D,s,F,N,h1({},c,{strict:!1}),d))return!1;return nf(D)===0}return!0}function CT(s,o,c,d){var _,k;if(typeof s!=typeof o||s==null||o==null||B_(s)!==B_(o)||E_(s)!==E_(o))return!1;var I=T_(s),f=T_(o);if(I!==f)return!1;var D=s instanceof Error,F=o instanceof Error;if(D!==F||(D||F)&&(s.name!==o.name||s.message!==o.message))return!1;var j=L_(s),N=L_(o);if(j!==N||(j||N)&&(s.source!==o.source||S_(s)!==S_(o)))return!1;var V=P_(s),Q=P_(o);if(V!==Q||(V||Q)&&F_(s)!==F_(o)||c.strict&&ep&&ep(s)!==ep(o))return!1;var re=z_(s),Ae=z_(o);if(re!==Ae)return!1;if(re||Ae){if(s.length!==o.length)return!1;for(_=0;_=0;_--)if(Oe[_]!=Ze[_])return!1;for(_=Oe.length-1;_>=0;_--)if(k=Oe[_],!Qs(s[k],o[k],c,d))return!1;var je=D_(s),He=D_(o);return je!==He?!1:je==="Set"||He==="Set"?ET(s,o,c,d):je==="Map"?TT(s,o,c,d):!0}var PT=function(s,o,c){return Qs(s,o,c,kT())};const LT=p0(PT);var AT=Object.defineProperty,Hi=(s,o)=>AT(s,"name",{value:o,configurable:!0}),MT=class{constructor(s){this.direction=!1,this.compareProperties=!0;var o,c,d;this.precision=10**-((o=s==null?void 0:s.precision)!=null?o:17),this.direction=(c=s==null?void 0:s.direction)!=null?c:!1,this.compareProperties=(d=s==null?void 0:s.compareProperties)!=null?d:!0}compare(s,o){if(s.type!==o.type||!Oc(s,o))return!1;switch(s.type){case"Point":return this.compareCoord(s.coordinates,o.coordinates);case"LineString":return this.compareLine(s.coordinates,o.coordinates);case"Polygon":return this.comparePolygon(s,o);case"GeometryCollection":return this.compareGeometryCollection(s,o);case"Feature":return this.compareFeature(s,o);case"FeatureCollection":return this.compareFeatureCollection(s,o);default:if(s.type.startsWith("Multi")){const c=Ap(s),d=Ap(o);return c.every(_=>d.some(k=>this.compare(_,k)))}}return!1}compareCoord(s,o){return s.length===o.length&&s.every((c,d)=>Math.abs(c-o[d])=0&&(c=[].concat(s.slice(d,s.length),s.slice(1,d+1))),c}comparePath(s,o){return s.every((c,d)=>this.compareCoord(c,o[d]))}comparePolygon(s,o){if(this.compareLine(s.coordinates[0],o.coordinates[0],1,!0)){const c=s.coordinates.slice(1,s.coordinates.length),d=o.coordinates.slice(1,o.coordinates.length);return c.every(_=>d.some(k=>this.compareLine(_,k,1,!0)))}return!1}compareGeometryCollection(s,o){return Oc(s.geometries,o.geometries)&&this.compareBBox(s,o)&&s.geometries.every((c,d)=>this.compare(c,o.geometries[d]))}compareFeature(s,o){return s.id===o.id&&(this.compareProperties?LT(s.properties,o.properties):!0)&&this.compareBBox(s,o)&&this.compare(s.geometry,o.geometry)}compareFeatureCollection(s,o){return Oc(s.features,o.features)&&this.compareBBox(s,o)&&s.features.every((c,d)=>this.compare(c,o.features[d]))}compareBBox(s,o){return!s.bbox&&!o.bbox||(s.bbox&&o.bbox?this.compareCoord(s.bbox,o.bbox):!1)}};Hi(MT,"GeojsonEquality");function Oc(s,o){return s.coordinates?s.coordinates.length===o.coordinates.length:s.length===o.length}Hi(Oc,"sameLength");function Ap(s){return s.coordinates.map(o=>({type:s.type.replace("Multi",""),coordinates:o}))}Hi(Ap,"explode");var Hr=63710088e-1,p1={centimeters:Hr*100,centimetres:Hr*100,degrees:360/(2*Math.PI),feet:Hr*3.28084,inches:Hr*39.37,kilometers:Hr/1e3,kilometres:Hr/1e3,meters:Hr,metres:Hr,miles:Hr/1609.344,millimeters:Hr*1e3,millimetres:Hr*1e3,nauticalmiles:Hr/1852,radians:1,yards:Hr*1.0936},G_={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 eo(s,o,c={}){const d={type:"Feature"};return(c.id===0||c.id)&&(d.id=c.id),c.bbox&&(d.bbox=c.bbox),d.properties=o||{},d.geometry=s,d}Hi(eo,"feature");function RT(s,o,c={}){switch(s){case"Point":return Io(o).geometry;case"LineString":return fa(o).geometry;case"Polygon":return nh(o).geometry;case"MultiPoint":return g1(o).geometry;case"MultiLineString":return m1(o).geometry;case"MultiPolygon":return Of(o).geometry;default:throw new Error(s+" is invalid")}}Hi(RT,"geometry");function Io(s,o,c={}){if(!s)throw new Error("coordinates is required");if(!Array.isArray(s))throw new Error("coordinates must be an Array");if(s.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!wf(s[0])||!wf(s[1]))throw new Error("coordinates must contain numbers");return eo({type:"Point",coordinates:s},o,c)}Hi(Io,"point");function DT(s,o,c={}){return Ka(s.map(d=>Io(d,o)),c)}Hi(DT,"points");function nh(s,o,c={}){for(const d of s){if(d.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(d[d.length-1].length!==d[0].length)throw new Error("First and last Position are not equivalent.");for(let _=0;_nh(d,o)),c)}Hi(zT,"polygons");function fa(s,o,c={}){if(s.length<2)throw new Error("coordinates must be an array of two or more positions");return eo({type:"LineString",coordinates:s},o,c)}Hi(fa,"lineString");function NT(s,o,c={}){return Ka(s.map(d=>fa(d,o)),c)}Hi(NT,"lineStrings");function Ka(s,o={}){const c={type:"FeatureCollection"};return o.id&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.features=s,c}Hi(Ka,"featureCollection");function m1(s,o,c={}){return eo({type:"MultiLineString",coordinates:s},o,c)}Hi(m1,"multiLineString");function g1(s,o,c={}){return eo({type:"MultiPoint",coordinates:s},o,c)}Hi(g1,"multiPoint");function Of(s,o,c={}){return eo({type:"MultiPolygon",coordinates:s},o,c)}Hi(Of,"multiPolygon");function OT(s,o,c={}){return eo({type:"GeometryCollection",geometries:s},o,c)}Hi(OT,"geometryCollection");function FT(s,o=0){if(o&&!(o>=0))throw new Error("precision must be a positive number");const c=Math.pow(10,o||0);return Math.round(s*c)/c}Hi(FT,"round");function hm(s,o="kilometers"){const c=p1[o];if(!c)throw new Error(o+" units is invalid");return s*c}Hi(hm,"radiansToLength");function Ff(s,o="kilometers"){const c=p1[o];if(!c)throw new Error(o+" units is invalid");return s/c}Hi(Ff,"lengthToRadians");function BT(s,o){return y1(Ff(s,o))}Hi(BT,"lengthToDegrees");function jT(s){let o=s%360;return o<0&&(o+=360),o}Hi(jT,"bearingToAzimuth");function y1(s){return s%(2*Math.PI)*180/Math.PI}Hi(y1,"radiansToDegrees");function UT(s){return s%360*Math.PI/180}Hi(UT,"degreesToRadians");function VT(s,o="kilometers",c="kilometers"){if(!(s>=0))throw new Error("length must be a positive number");return hm(Ff(s,o),c)}Hi(VT,"convertLength");function qT(s,o="meters",c="kilometers"){if(!(s>=0))throw new Error("area must be a positive number");const d=G_[o];if(!d)throw new Error("invalid original units");const _=G_[c];if(!_)throw new Error("invalid final units");return s/d*_}Hi(qT,"convertArea");function wf(s){return!isNaN(s)&&s!==null&&!Array.isArray(s)}Hi(wf,"isNumber");function fm(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}Hi(fm,"isObject");function GT(s){if(!s)throw new Error("bbox is required");if(!Array.isArray(s))throw new Error("bbox must be an Array");if(s.length!==4&&s.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");s.forEach(o=>{if(!wf(o))throw new Error("bbox must only contain numbers")})}Hi(GT,"validateBBox");function ZT(s){if(!s)throw new Error("id is required");if(["string","number"].indexOf(typeof s)===-1)throw new Error("id must be a number or a string")}Hi(ZT,"validateId");/** - * 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 WT(s,o){var c={label:0,sent:function(){if(k[0]&1)throw k[1];return k[1]},trys:[],ops:[]},d,_,k,I;return I={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function f(F){return function(j){return D([F,j])}}function D(F){if(d)throw new TypeError("Generator is already executing.");for(;c;)try{if(d=1,_&&(k=F[0]&2?_.return:F[0]?_.throw||((k=_.return)&&k.call(_),0):_.next)&&!(k=k.call(_,F[1])).done)return k;switch(_=0,k&&(F=[F[0]&2,k.value]),F[0]){case 0:case 1:k=F;break;case 4:return c.label++,{value:F[1],done:!1};case 5:c.label++,_=F[1],F=[0];continue;case 7:F=c.ops.pop(),c.trys.pop();continue;default:if(k=c.trys,!(k=k.length>0&&k[k.length-1])&&(F[0]===6||F[0]===2)){c=0;continue}if(F[0]===3&&(!k||F[1]>k[0]&&F[1]o?1:s0){if(o.right===null)break;if(c(s,o.right.key)>0){var f=o.right;if(o.right=f.left,f.left=o,o=f,o.right===null)break}_.right=o,_=o,o=o.right}else break}return _.right=o.left,k.left=o.right,o.left=d.right,o.right=d.left,o}function tp(s,o,c,d){var _=new Ja(s,o);if(c===null)return _.left=_.right=null,_;c=Wa(s,c,d);var k=d(s,c.key);return k<0?(_.left=c.left,_.right=c,c.left=null):k>=0&&(_.right=c.right,_.left=c,c.right=null),_}function Z_(s,o,c){var d=null,_=null;if(o){o=Wa(s,o,c);var k=c(o.key,s);k===0?(d=o.left,_=o.right):k<0?(_=o.right,o.right=null,d=o):(d=o.left,o.left=null,_=o)}return{left:d,right:_}}function HT(s,o,c){return o===null?s:(s===null||(o=Wa(s.key,o,c),o.left=s),o)}function Mp(s,o,c,d,_){if(s){d(""+o+(c?"└── ":"├── ")+_(s)+` -`);var k=o+(c?" ":"│ ");s.left&&Mp(s.left,k,!1,d,_),s.right&&Mp(s.right,k,!0,d,_)}}var dm=function(){function s(o){o===void 0&&(o=XT),this._root=null,this._size=0,this._comparator=o}return s.prototype.insert=function(o,c){return this._size++,this._root=tp(o,c,this._root,this._comparator)},s.prototype.add=function(o,c){var d=new Ja(o,c);this._root===null&&(d.left=d.right=null,this._size++,this._root=d);var _=this._comparator,k=Wa(o,this._root,_),I=_(o,k.key);return I===0?this._root=k:(I<0?(d.left=k.left,d.right=k,k.left=null):I>0&&(d.right=k.right,d.left=k,k.right=null),this._size++,this._root=d),this._root},s.prototype.remove=function(o){this._root=this._remove(o,this._root,this._comparator)},s.prototype._remove=function(o,c,d){var _;if(c===null)return null;c=Wa(o,c,d);var k=d(o,c.key);return k===0?(c.left===null?_=c.right:(_=Wa(o,c.left,d),_.right=c.right),this._size--,_):c},s.prototype.pop=function(){var o=this._root;if(o){for(;o.left;)o=o.left;return this._root=Wa(o.key,this._root,this._comparator),this._root=this._remove(o.key,this._root,this._comparator),{key:o.key,data:o.data}}return null},s.prototype.findStatic=function(o){for(var c=this._root,d=this._comparator;c;){var _=d(o,c.key);if(_===0)return c;_<0?c=c.left:c=c.right}return null},s.prototype.find=function(o){return this._root&&(this._root=Wa(o,this._root,this._comparator),this._comparator(o,this._root.key)!==0)?null:this._root},s.prototype.contains=function(o){for(var c=this._root,d=this._comparator;c;){var _=d(o,c.key);if(_===0)return!0;_<0?c=c.left:c=c.right}return!1},s.prototype.forEach=function(o,c){for(var d=this._root,_=[],k=!1;!k;)d!==null?(_.push(d),d=d.left):_.length!==0?(d=_.pop(),o.call(c,d),d=d.right):k=!0;return this},s.prototype.range=function(o,c,d,_){for(var k=[],I=this._comparator,f=this._root,D;k.length!==0||f;)if(f)k.push(f),f=f.left;else{if(f=k.pop(),D=I(f.key,c),D>0)break;if(I(f.key,o)>=0&&d.call(_,f))return this;f=f.right}return this},s.prototype.keys=function(){var o=[];return this.forEach(function(c){var d=c.key;return o.push(d)}),o},s.prototype.values=function(){var o=[];return this.forEach(function(c){var d=c.data;return o.push(d)}),o},s.prototype.min=function(){return this._root?this.minNode(this._root).key:null},s.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},s.prototype.minNode=function(o){if(o===void 0&&(o=this._root),o)for(;o.left;)o=o.left;return o},s.prototype.maxNode=function(o){if(o===void 0&&(o=this._root),o)for(;o.right;)o=o.right;return o},s.prototype.at=function(o){for(var c=this._root,d=!1,_=0,k=[];!d;)if(c)k.push(c),c=c.left;else if(k.length>0){if(c=k.pop(),_===o)return c;_++,c=c.right}else d=!0;return null},s.prototype.next=function(o){var c=this._root,d=null;if(o.right){for(d=o.right;d.left;)d=d.left;return d}for(var _=this._comparator;c;){var k=_(o.key,c.key);if(k===0)break;k<0?(d=c,c=c.left):c=c.right}return d},s.prototype.prev=function(o){var c=this._root,d=null;if(o.left!==null){for(d=o.left;d.right;)d=d.right;return d}for(var _=this._comparator;c;){var k=_(o.key,c.key);if(k===0)break;k<0?c=c.left:(d=c,c=c.right)}return d},s.prototype.clear=function(){return this._root=null,this._size=0,this},s.prototype.toList=function(){return KT(this._root)},s.prototype.load=function(o,c,d){c===void 0&&(c=[]),d===void 0&&(d=!1);var _=o.length,k=this._comparator;if(d&&zp(o,c,0,_-1,k),this._root===null)this._root=Rp(o,c,0,_),this._size=_;else{var I=JT(this.toList(),YT(o,c),k);_=this._size+_,this._root=Dp({head:I},0,_)}return this},s.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(s.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),s.prototype.toString=function(o){o===void 0&&(o=function(d){return String(d.key)});var c=[];return Mp(this._root,"",!0,function(d){return c.push(d)},o),c.join("")},s.prototype.update=function(o,c,d){var _=this._comparator,k=Z_(o,this._root,_),I=k.left,f=k.right;_(o,c)<0?f=tp(c,d,f,_):I=tp(c,d,I,_),this._root=HT(I,f,_)},s.prototype.split=function(o){return Z_(o,this._root,this._comparator)},s.prototype[Symbol.iterator]=function(){var o,c,d;return WT(this,function(_){switch(_.label){case 0:o=this._root,c=[],d=!1,_.label=1;case 1:return d?[3,6]:o===null?[3,2]:(c.push(o),o=o.left,[3,5]);case 2:return c.length===0?[3,4]:(o=c.pop(),[4,o]);case 3:return _.sent(),o=o.right,[3,5];case 4:d=!0,_.label=5;case 5:return[3,1];case 6:return[2]}})},s}();function Rp(s,o,c,d){var _=d-c;if(_>0){var k=c+Math.floor(_/2),I=s[k],f=o[k],D=new Ja(I,f);return D.left=Rp(s,o,c,k),D.right=Rp(s,o,k+1,d),D}return null}function YT(s,o){for(var c=new Ja(null,null),d=c,_=0;_0?(o=k=k.next=c.pop(),o=o.right):d=!0;return k.next=null,_.next}function Dp(s,o,c){var d=c-o;if(d>0){var _=o+Math.floor(d/2),k=Dp(s,o,_),I=s.head;return I.left=k,s.head=s.head.next,I.right=Dp(s,_+1,c),I}return null}function JT(s,o,c){for(var d=new Ja(null,null),_=d,k=s,I=o;k!==null&&I!==null;)c(k.key,I.key)<0?(_.next=k,k=k.next):(_.next=I,I=I.next),_=_.next;return k!==null?_.next=k:I!==null&&(_.next=I),d.next}function zp(s,o,c,d,_){if(!(c>=d)){for(var k=s[c+d>>1],I=c-1,f=d+1;;){do I++;while(_(s[I],k)<0);do f--;while(_(s[f],k)>0);if(I>=f)break;var D=s[I];s[I]=s[f],s[f]=D,D=o[I],o[I]=o[f],o[f]=D}zp(s,o,c,f,_),zp(s,o,f+1,d,_)}}const da=11102230246251565e-32,Lr=134217729,QT=(3+8*da)*da;function ip(s,o,c,d,_){let k,I,f,D,F=o[0],j=d[0],N=0,V=0;j>F==j>-F?(k=F,F=o[++N]):(k=j,j=d[++V]);let Q=0;if(NF==j>-F?(I=F+k,f=k-(I-F),F=o[++N]):(I=j+k,f=k-(I-j),j=d[++V]),k=I,f!==0&&(_[Q++]=f);NF==j>-F?(I=k+F,D=I-k,f=k-(I-D)+(F-D),F=o[++N]):(I=k+j,D=I-k,f=k-(I-D)+(j-D),j=d[++V]),k=I,f!==0&&(_[Q++]=f);for(;N=Ue||-st>=Ue||(N=s-He,f=s-(He+N)+(N-_),N=c-pt,F=c-(pt+N)+(N-_),N=o-Ie,D=o-(Ie+N)+(N-k),N=d-Pt,j=d-(Pt+N)+(N-k),f===0&&D===0&&F===0&&j===0)||(Ue=iC*I+QT*Math.abs(st),st+=He*j+Pt*f-(Ie*F+pt*D),st>=Ue||-st>=Ue))return st;Re=f*Pt,V=Lr*f,Q=V-(V-f),re=f-Q,V=Lr*Pt,Ae=V-(V-Pt),xe=Pt-Ae,ze=re*xe-(Re-Q*Ae-re*Ae-Q*xe),Oe=D*pt,V=Lr*D,Q=V-(V-D),re=D-Q,V=Lr*pt,Ae=V-(V-pt),xe=pt-Ae,Ze=re*xe-(Oe-Q*Ae-re*Ae-Q*xe),Te=ze-Ze,N=ze-Te,jr[0]=ze-(Te+N)+(N-Ze),Ce=Re+Te,N=Ce-Re,ke=Re-(Ce-N)+(Te-N),Te=ke-Oe,N=ke-Te,jr[1]=ke-(Te+N)+(N-Oe),je=Ce+Te,N=je-Ce,jr[2]=Ce-(je-N)+(Te-N),jr[3]=je;const lt=ip(4,vu,4,jr,W_);Re=He*j,V=Lr*He,Q=V-(V-He),re=He-Q,V=Lr*j,Ae=V-(V-j),xe=j-Ae,ze=re*xe-(Re-Q*Ae-re*Ae-Q*xe),Oe=Ie*F,V=Lr*Ie,Q=V-(V-Ie),re=Ie-Q,V=Lr*F,Ae=V-(V-F),xe=F-Ae,Ze=re*xe-(Oe-Q*Ae-re*Ae-Q*xe),Te=ze-Ze,N=ze-Te,jr[0]=ze-(Te+N)+(N-Ze),Ce=Re+Te,N=Ce-Re,ke=Re-(Ce-N)+(Te-N),Te=ke-Oe,N=ke-Te,jr[1]=ke-(Te+N)+(N-Oe),je=Ce+Te,N=je-Ce,jr[2]=Ce-(je-N)+(Te-N),jr[3]=je;const Lt=ip(lt,W_,4,jr,X_);Re=f*j,V=Lr*f,Q=V-(V-f),re=f-Q,V=Lr*j,Ae=V-(V-j),xe=j-Ae,ze=re*xe-(Re-Q*Ae-re*Ae-Q*xe),Oe=D*F,V=Lr*D,Q=V-(V-D),re=D-Q,V=Lr*F,Ae=V-(V-F),xe=F-Ae,Ze=re*xe-(Oe-Q*Ae-re*Ae-Q*xe),Te=ze-Ze,N=ze-Te,jr[0]=ze-(Te+N)+(N-Ze),Ce=Re+Te,N=Ce-Re,ke=Re-(Ce-N)+(Te-N),Te=ke-Oe,N=ke-Te,jr[1]=ke-(Te+N)+(N-Oe),je=Ce+Te,N=je-Ce,jr[2]=Ce-(je-N)+(Te-N),jr[3]=je;const ct=ip(Lt,X_,4,jr,H_);return H_[ct-1]}function rC(s,o,c,d,_,k){const I=(o-k)*(c-_),f=(s-_)*(d-k),D=I-f,F=Math.abs(I+f);return Math.abs(D)>=eC*F?D:-nC(s,o,c,d,_,k,F)}const zc=(s,o)=>s.ll.x<=o.x&&o.x<=s.ur.x&&s.ll.y<=o.y&&o.y<=s.ur.y,Np=(s,o)=>{if(o.ur.x{if(-Has.x*o.y-s.y*o.x,_1=(s,o)=>s.x*o.x+s.y*o.y,J_=(s,o,c)=>{const d=rC(s.x,s.y,o.x,o.y,c.x,c.y);return d>0?-1:d<0?1:0},kf=s=>Math.sqrt(_1(s,s)),aC=(s,o,c)=>{const d={x:o.x-s.x,y:o.y-s.y},_={x:c.x-s.x,y:c.y-s.y};return rf(_,d)/kf(_)/kf(d)},lC=(s,o,c)=>{const d={x:o.x-s.x,y:o.y-s.y},_={x:c.x-s.x,y:c.y-s.y};return _1(_,d)/kf(_)/kf(d)},Q_=(s,o,c)=>o.y===0?null:{x:s.x+o.x/o.y*(c-s.y),y:c},$_=(s,o,c)=>o.x===0?null:{x:c,y:s.y+o.y/o.x*(c-s.x)},uC=(s,o,c,d)=>{if(o.x===0)return $_(c,d,s.x);if(d.x===0)return $_(s,o,c.x);if(o.y===0)return Q_(c,d,s.y);if(d.y===0)return Q_(s,o,c.y);const _=rf(o,d);if(_==0)return null;const k={x:c.x-s.x,y:c.y-s.y},I=rf(k,o)/_,f=rf(k,d)/_,D=s.x+f*o.x,F=c.x+I*d.x,j=s.y+f*o.y,N=c.y+I*d.y,V=(D+F)/2,Q=(j+N)/2;return{x:V,y:Q}};class Ms{static compare(o,c){const d=Ms.comparePoints(o.point,c.point);return d!==0?d:(o.point!==c.point&&o.link(c),o.isLeft!==c.isLeft?o.isLeft?1:-1:Ya.compare(o.segment,c.segment))}static comparePoints(o,c){return o.xc.x?1:o.yc.y?1:0}constructor(o,c){o.events===void 0?o.events=[this]:o.events.push(this),this.point=o,this.isLeft=c}link(o){if(o.point===this.point)throw new Error("Tried to link already linked events");const c=o.point.events;for(let d=0,_=c.length;d<_;d++){const k=c[d];this.point.events.push(k),k.point=this.point}this.checkForConsuming()}checkForConsuming(){const o=this.point.events.length;for(let c=0;c{const k=_.otherSE;c.set(_,{sine:aC(this.point,o.point,k.point),cosine:lC(this.point,o.point,k.point)})};return(_,k)=>{c.has(_)||d(_),c.has(k)||d(k);const{sine:I,cosine:f}=c.get(_),{sine:D,cosine:F}=c.get(k);return I>=0&&D>=0?fF?-1:0:I<0&&D<0?fF?1:0:DI?1:0}}}let cC=0;class Ya{static compare(o,c){const d=o.leftSE.point.x,_=c.leftSE.point.x,k=o.rightSE.point.x,I=c.rightSE.point.x;if(If&&D>F)return-1;const N=o.comparePoint(c.leftSE.point);if(N<0)return 1;if(N>0)return-1;const V=c.comparePoint(o.rightSE.point);return V!==0?V:-1}if(d>_){if(fD&&f>j)return 1;const N=c.comparePoint(o.leftSE.point);if(N!==0)return N;const V=o.comparePoint(c.rightSE.point);return V<0?1:V>0?-1:1}if(fD)return 1;if(kI){const N=o.comparePoint(c.rightSE.point);if(N<0)return 1;if(N>0)return-1}if(k!==I){const N=F-f,V=k-d,Q=j-D,re=I-_;if(N>V&&Qre)return-1}return k>I?1:kj?1:o.idc.id?1:0}constructor(o,c,d,_){this.id=++cC,this.leftSE=o,o.segment=this,o.otherSE=c,this.rightSE=c,c.segment=this,c.otherSE=o,this.rings=d,this.windings=_}static fromRing(o,c,d){let _,k,I;const f=Ms.comparePoints(o,c);if(f<0)_=o,k=c,I=1;else if(f>0)_=c,k=o,I=-1;else throw new Error(`Tried to create degenerate segment at [${o.x}, ${o.y}]`);const D=new Ms(_,!0),F=new Ms(k,!1);return new Ya(D,F,[d],[I])}replaceRightSE(o){this.rightSE=o,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const o=this.leftSE.point.y,c=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:oc?o:c}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(o){return o.x===this.leftSE.point.x&&o.y===this.leftSE.point.y||o.x===this.rightSE.point.x&&o.y===this.rightSE.point.y}comparePoint(o){if(this.isAnEndpoint(o))return 0;const c=this.leftSE.point,d=this.rightSE.point,_=this.vector();if(c.x===d.x)return o.x===c.x?0:o.x0&&f.swapEvents(),Ms.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),d&&(_.checkForConsuming(),k.checkForConsuming()),c}swapEvents(){const o=this.rightSE;this.rightSE=this.leftSE,this.leftSE=o,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let c=0,d=this.windings.length;c0){const k=c;c=d,d=k}if(c.prev===d){const k=c;c=d,d=k}for(let k=0,I=d.rings.length;k_.length===1&&_[0].isSubject;this._isInResult=d(o)!==d(c);break}default:throw new Error(`Unrecognized operation type found ${Js.type}`)}return this._isInResult}}class ev{constructor(o,c,d){if(!Array.isArray(o)||o.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=c,this.isExterior=d,this.segments=[],typeof o[0][0]!="number"||typeof o[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const _=Jc.round(o[0][0],o[0][1]);this.bbox={ll:{x:_.x,y:_.y},ur:{x:_.x,y:_.y}};let k=_;for(let I=1,f=o.length;Ithis.bbox.ur.x&&(this.bbox.ur.x=D.x),D.y>this.bbox.ur.y&&(this.bbox.ur.y=D.y),k=D)}(_.x!==k.x||_.y!==k.y)&&this.segments.push(Ya.fromRing(k,_,this))}getSweepEvents(){const o=[];for(let c=0,d=this.segments.length;cthis.bbox.ur.x&&(this.bbox.ur.x=k.bbox.ur.x),k.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=k.bbox.ur.y),this.interiorRings.push(k)}this.multiPoly=c}getSweepEvents(){const o=this.exteriorRing.getSweepEvents();for(let c=0,d=this.interiorRings.length;cthis.bbox.ur.x&&(this.bbox.ur.x=k.bbox.ur.x),k.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=k.bbox.ur.y),this.polys.push(k)}this.isSubject=c}getSweepEvents(){const o=[];for(let c=0,d=this.polys.length;c0&&(o=I)}let c=o.segment.prevInResult(),d=c?c.prevInResult():null;for(;;){if(!c)return null;if(!d)return c.ringOut;if(d.ringOut!==c.ringOut)return d.ringOut.enclosingRing()!==c.ringOut?c.ringOut:c.ringOut.enclosingRing();c=d.prevInResult(),d=c?c.prevInResult():null}}}class iv{constructor(o){this.exteriorRing=o,o.poly=this,this.interiorRings=[]}addInterior(o){this.interiorRings.push(o),o.poly=this}getGeom(){const o=[this.exteriorRing.getGeom()];if(o[0]===null)return null;for(let c=0,d=this.interiorRings.length;c1&&arguments[1]!==void 0?arguments[1]:Ya.compare;this.queue=o,this.tree=new dm(c),this.segments=[]}process(o){const c=o.segment,d=[];if(o.consumedBy)return o.isLeft?this.queue.remove(o.otherSE):this.tree.remove(c),d;const _=o.isLeft?this.tree.add(c):this.tree.find(c);if(!_)throw new Error(`Unable to find segment #${c.id} [${c.leftSE.point.x}, ${c.leftSE.point.y}] -> [${c.rightSE.point.x}, ${c.rightSE.point.y}] in SweepLine tree.`);let k=_,I=_,f,D;for(;f===void 0;)k=this.tree.prev(k),k===null?f=null:k.key.consumedBy===void 0&&(f=k.key);for(;D===void 0;)I=this.tree.next(I),I===null?D=null:I.key.consumedBy===void 0&&(D=I.key);if(o.isLeft){let F=null;if(f){const N=f.getIntersection(c);if(N!==null&&(c.isAnEndpoint(N)||(F=N),!f.isAnEndpoint(N))){const V=this._splitSafely(f,N);for(let Q=0,re=V.length;Q0?(this.tree.remove(c),d.push(o)):(this.segments.push(c),c.prev=f)}else{if(f&&D){const F=f.getIntersection(D);if(F!==null){if(!f.isAnEndpoint(F)){const j=this._splitSafely(f,F);for(let N=0,V=j.length;Nnv)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const I=new dC(k);let f=k.size,D=k.pop();for(;D;){const j=D.key;if(k.size===f){const V=j.segment;throw new Error(`Unable to pop() ${j.isLeft?"left":"right"} SweepEvent [${j.point.x}, ${j.point.y}] from segment #${V.id} [${V.leftSE.point.x}, ${V.leftSE.point.y}] -> [${V.rightSE.point.x}, ${V.rightSE.point.y}] from queue.`)}if(k.size>nv)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(I.segments.length>pC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const N=I.process(j);for(let V=0,Q=N.length;V1?o-1:0),d=1;d1?o-1:0),d=1;d1?o-1:0),d=1;d1?o-1:0),d=1;dxC(s,"name",{value:o,configurable:!0});function zu(s,o,c){if(s!==null)for(var d,_,k,I,f,D,F,j=0,N=0,V,Q=s.type,re=Q==="FeatureCollection",Ae=Q==="Feature",xe=re?s.features.length:1,Te=0;TeD||re>F||Ae>j){f=N,D=d,F=re,j=Ae,k=0;return}var xe=fa([f,N],c.properties);if(o(xe,d,_,Ae,k)===!1)return!1;k++,f=N})===!1)return!1}}})}br(b1,"segmentEach");function TC(s,o,c){var d=c,_=!1;return b1(s,function(k,I,f,D,F){_===!1&&c===void 0?d=k:d=o(d,k,I,f,D,F),_=!0}),d}br(TC,"segmentReduce");function w1(s,o){if(!s)throw new Error("geojson is required");Bf(s,function(c,d,_){if(c.geometry!==null){var k=c.geometry.type,I=c.geometry.coordinates;switch(k){case"LineString":if(o(c,d,_,0,0)===!1)return!1;break;case"Polygon":for(var f=0;fAC(s,"name",{value:o,configurable:!0});function RC(s,o={}){const c=[];if(jl(s,_=>{c.push(_.coordinates)}),c.length<2)throw new Error("Must have at least 2 geometries");const d=v1.union(c[0],...c.slice(1));return d.length===0?null:d.length===1?nh(d[0],o.properties):Of(d,o.properties)}MC(RC,"union");var DC=Object.defineProperty,zC=(s,o)=>DC(s,"name",{value:o,configurable:!0});function k1(s,o={}){if(s.bbox!=null&&o.recompute!==!0)return s.bbox;const c=[1/0,1/0,-1/0,-1/0];return zu(s,d=>{c[0]>d[0]&&(c[0]=d[0]),c[1]>d[1]&&(c[1]=d[1]),c[2]NC(s,"name",{value:o,configurable:!0});function S1(s,o={}){const c=k1(s),d=(c[0]+c[2])/2,_=(c[1]+c[3])/2;return Io([d,_],o.properties,o)}OC(S1,"center");var I1={exports:{}};(function(s,o){(function(c,d){s.exports=d()})(Yc,function(){function c(v,r){if(!(v instanceof r))throw new TypeError("Cannot call a class as a function")}function d(v,r){for(var a=0;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function F(v,r,a){return F=D()?Reflect.construct:function(u,y,E){var M=[null];M.push.apply(M,y);var B=new(Function.bind.apply(u,M));return E&&f(B,E.prototype),B},F.apply(null,arguments)}function j(v){var r=typeof Map=="function"?new Map:void 0;return j=function(a){if(a===null||(u=a,Function.toString.call(u).indexOf("[native code]")===-1))return a;var u;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(r!==void 0){if(r.has(a))return r.get(a);r.set(a,y)}function y(){return F(a,arguments,I(this).constructor)}return y.prototype=Object.create(a.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f(y,a)},j(v)}function N(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function V(v,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N(v)}function Q(v){var r=D();return function(){var a,u=I(v);if(r){var y=I(this).constructor;a=Reflect.construct(u,arguments,y)}else a=u.apply(this,arguments);return V(this,a)}}function re(v,r,a){return re=typeof Reflect<"u"&&Reflect.get?Reflect.get:function(u,y,E){var M=function(W,ne){for(;!Object.prototype.hasOwnProperty.call(W,ne)&&(W=I(W))!==null;);return W}(u,y);if(M){var B=Object.getOwnPropertyDescriptor(M,y);return B.get?B.get.call(E):B.value}},re(v,r,a||v)}function Ae(v){return function(r){if(Array.isArray(r))return Te(r)}(v)||function(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}(v)||xe(v)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function xe(v,r){if(v){if(typeof v=="string")return Te(v,r);var a=Object.prototype.toString.call(v).slice(8,-1);return a==="Object"&&v.constructor&&(a=v.constructor.name),a==="Map"||a==="Set"?Array.from(v):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Te(v,r):void 0}}function Te(v,r){(r==null||r>v.length)&&(r=v.length);for(var a=0,u=new Array(r);a=v.length?{done:!0}:{done:!1,value:v[u++]}},e:function(W){throw W},f:y}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var E,M=!0,B=!1;return{s:function(){a=a.call(v)},n:function(){var W=a.next();return M=W.done,W},e:function(W){B=!0,E=W},f:function(){try{M||a.return==null||a.return()}finally{if(B)throw E}}}}var ke=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=v.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=v.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==v.JOIN_ROUND&&(this._quadrantSegments=v.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(r){this._joinStyle=r}},{key:"setSimplifyFactor",value:function(r){this._simplifyFactor=r<0?0:r}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(r){this._endCapStyle=r}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(r){this._mitreLimit=r}},{key:"setSingleSided",value:function(r){this._isSingleSided=r}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=v.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=v.CAP_ROUND,this._joinStyle=v.JOIN_ROUND,this._mitreLimit=v.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=v.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setQuadrantSegments(r)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];this.setQuadrantSegments(a),this.setEndCapStyle(u)}else if(arguments.length===4){var y=arguments[0],E=arguments[1],M=arguments[2],B=arguments[3];this.setQuadrantSegments(y),this.setEndCapStyle(E),this.setJoinStyle(M),this.setMitreLimit(B)}}}},{key:"bufferDistanceError",value:function(r){var a=Math.PI/2/r;return 1-Math.cos(a/2)}}]),v}();ke.CAP_ROUND=1,ke.CAP_FLAT=2,ke.CAP_SQUARE=3,ke.JOIN_ROUND=1,ke.JOIN_MITRE=2,ke.JOIN_BEVEL=3,ke.DEFAULT_QUADRANT_SEGMENTS=8,ke.DEFAULT_MITRE_LIMIT=5,ke.DEFAULT_SIMPLIFY_FACTOR=.01;var Re=function(v){k(a,v);var r=Q(a);function a(u){var y;return c(this,a),(y=r.call(this,u)).name=Object.keys({Exception:a})[0],y}return _(a,[{key:"toString",value:function(){return this.message}}]),a}(j(Error)),ze=function(v){k(a,v);var r=Q(a);function a(u){var y;return c(this,a),(y=r.call(this,u)).name=Object.keys({IllegalArgumentException:a})[0],y}return a}(Re),Oe=function(){function v(){c(this,v)}return _(v,[{key:"filter",value:function(r){}}]),v}();function Ze(){}function je(){}function He(){}var pt,Ie,Pt,st,Ue,lt,Lt,ct,Qt=function(){function v(){c(this,v)}return _(v,null,[{key:"equalsWithTolerance",value:function(r,a,u){return Math.abs(r-a)<=u}}]),v}(),ii=function(){function v(r,a){c(this,v),this.low=a||0,this.high=r||0}return _(v,null,[{key:"toBinaryString",value:function(r){var a,u="";for(a=2147483648;a>0;a>>>=1)u+=(r.high&a)===a?"1":"0";for(a=2147483648;a>0;a>>>=1)u+=(r.low&a)===a?"1":"0";return u}}]),v}();function nt(){}function Ft(){}nt.NaN=NaN,nt.isNaN=function(v){return Number.isNaN(v)},nt.isInfinite=function(v){return!Number.isFinite(v)},nt.MAX_VALUE=Number.MAX_VALUE,nt.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,nt.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(lt=2146435072,Lt=new Float64Array(1),ct=new Int32Array(Lt.buffer),nt.doubleToLongBits=function(v){Lt[0]=v;var r=0|ct[0],a=0|ct[1];return(a<)===lt&&1048575&a&&r!==0&&(r=0,a=2146959360),new ii(a,r)},nt.longBitsToDouble=function(v){return ct[0]=v.low,ct[1]=v.high,Lt[0]}):(pt=1023,Ie=Math.log2,Pt=Math.floor,st=Math.pow,Ue=function(){for(var v=53;v>0;v--){var r=st(2,v)-1;if(Pt(Ie(r))+1===v)return r}return 0}(),nt.doubleToLongBits=function(v){var r,a,u,y,E,M,B,W,ne;if(v<0||1/v===Number.NEGATIVE_INFINITY?(M=1<<31,v=-v):M=0,v===0)return new ii(W=M,ne=0);if(v===1/0)return new ii(W=2146435072|M,ne=0);if(v!=v)return new ii(W=2146959360,ne=0);if(y=0,ne=0,(r=Pt(v))>1)if(r<=Ue)(y=Pt(Ie(r)))<=20?(ne=0,W=r<<20-y&1048575):(ne=r%(a=st(2,u=y-20))<<32-u,W=r/a&1048575);else for(u=r,ne=0;(u=Pt(a=u/2))!==0;)y++,ne>>>=1,ne|=(1&W)<<31,W>>>=1,a!==u&&(W|=524288);if(B=y+pt,E=r===0,r=v-r,y<52&&r!==0)for(u=0;;){if((a=2*r)>=1?(r=a-1,E?(B--,E=!1):(u<<=1,u|=1,y++)):(r=a,E?--B==0&&(y++,E=!1):(u<<=1,y++)),y===20)W|=u,u=0;else if(y===52){ne|=u;break}if(a===1){y<20?W|=u<<20-y:y<52&&(ne|=u<<52-y);break}}return W|=B<<20,new ii(W|=M,ne)},nt.longBitsToDouble=function(v){var r,a,u,y,E=v.high,M=v.low,B=E&1<<31?-1:1;for(u=((2146435072&E)>>20)-pt,y=0,a=1<<19,r=1;r<=20;r++)E&a&&(y+=st(2,-r)),a>>>=1;for(a=1<<31,r=21;r<=52;r++)M&a&&(y+=st(2,-r)),a>>>=1;if(u===-1023){if(y===0)return 0*B;u=-1022}else{if(u===1024)return y===0?B/0:NaN;y+=1}return B*y*st(2,u)});var jt=function(v){k(a,v);var r=Q(a);function a(u){var y;return c(this,a),(y=r.call(this,u)).name=Object.keys({RuntimeException:a})[0],y}return a}(Re),qt=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,null,[{key:"constructor_",value:function(){if(arguments.length===0)jt.constructor_.call(this);else if(arguments.length===1){var u=arguments[0];jt.constructor_.call(this,u)}}}]),a}(jt),et=function(){function v(){c(this,v)}return _(v,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)v.shouldNeverReachHere(null);else if(arguments.length===1){var r=arguments[0];throw new qt("Should never reach here"+(r!==null?": "+r:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var r=arguments[0];v.isTrue(r,null)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];if(!a)throw u===null?new qt:new qt(u)}}},{key:"equals",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];v.equals(r,a,null)}else if(arguments.length===3){var u=arguments[0],y=arguments[1],E=arguments[2];if(!y.equals(u))throw new qt("Expected "+u+" but encountered "+y+(E!==null?": "+E:""))}}}]),v}(),Ot=new ArrayBuffer(8),mt=new Float64Array(Ot),vt=new Int32Array(Ot),_e=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getM",value:function(){return nt.NaN}},{key:"setOrdinate",value:function(r,a){switch(r){case v.X:this.x=a;break;case v.Y:this.y=a;break;case v.Z:this.setZ(a);break;default:throw new ze("Invalid ordinate index: "+r)}}},{key:"equals2D",value:function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var a=arguments[0],u=arguments[1];return!!Qt.equalsWithTolerance(this.x,a.x,u)&&!!Qt.equalsWithTolerance(this.y,a.y,u)}}},{key:"setM",value:function(r){throw new ze("Invalid ordinate index: "+v.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(r){switch(r){case v.X:return this.x;case v.Y:return this.y;case v.Z:return this.getZ()}throw new ze("Invalid ordinate index: "+r)}},{key:"equals3D",value:function(r){return this.x===r.x&&this.y===r.y&&(this.getZ()===r.getZ()||nt.isNaN(this.getZ())&&nt.isNaN(r.getZ()))}},{key:"equals",value:function(r){return r instanceof v&&this.equals2D(r)}},{key:"equalInZ",value:function(r,a){return Qt.equalsWithTolerance(this.getZ(),r.getZ(),a)}},{key:"setX",value:function(r){this.x=r}},{key:"compareTo",value:function(r){var a=r;return this.xa.x?1:this.ya.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(r){this.z=r}},{key:"clone",value:function(){try{return null}catch(r){if(r instanceof CloneNotSupportedException)return et.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw r}}},{key:"copy",value:function(){return new v(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(r){var a=this.x-r.x,u=this.y-r.y,y=this.getZ()-r.getZ();return Math.sqrt(a*a+u*u+y*y)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(r){this.y=r}},{key:"distance",value:function(r){var a=this.x-r.x,u=this.y-r.y;return Math.sqrt(a*a+u*u)}},{key:"hashCode",value:function(){var r=17;return r=37*(r=37*r+v.hashCode(this.x))+v.hashCode(this.y)}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ()}},{key:"interfaces_",get:function(){return[Ze,je,He]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)v.constructor_.call(this,0,0);else if(arguments.length===1){var r=arguments[0];v.constructor_.call(this,r.x,r.y,r.getZ())}else if(arguments.length===2){var a=arguments[0],u=arguments[1];v.constructor_.call(this,a,u,v.NULL_ORDINATE)}else if(arguments.length===3){var y=arguments[0],E=arguments[1],M=arguments[2];this.x=y,this.y=E,this.z=M}}},{key:"hashCode",value:function(r){return mt[0]=r,vt[0]^vt[1]}}]),v}(),vi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compare",value:function(r,a){var u=v.compare(r.x,a.x);if(u!==0)return u;var y=v.compare(r.y,a.y);return y!==0?y:this._dimensionsToTest<=2?0:v.compare(r.getZ(),a.getZ())}},{key:"interfaces_",get:function(){return[Ft]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)v.constructor_.call(this,2);else if(arguments.length===1){var r=arguments[0];if(r!==2&&r!==3)throw new ze("only 2 or 3 dimensions may be specified");this._dimensionsToTest=r}}},{key:"compare",value:function(r,a){return ra?1:nt.isNaN(r)?nt.isNaN(a)?0:-1:nt.isNaN(a)?1:0}}]),v}();_e.DimensionalComparator=vi,_e.NULL_ORDINATE=nt.NaN,_e.X=0,_e.Y=1,_e.Z=2,_e.M=3;var Kt=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(r){if(!(r instanceof v))return!1;var a=r;return this.isNull()?a.isNull():this._maxx===a.getMaxX()&&this._maxy===a.getMaxY()&&this._minx===a.getMinX()&&this._miny===a.getMinY()}},{key:"intersection",value:function(r){if(this.isNull()||r.isNull()||!this.intersects(r))return new v;var a=this._minx>r._minx?this._minx:r._minx,u=this._miny>r._miny?this._miny:r._miny;return new v(a,this._maxx=this._minx&&a.getMaxX()<=this._maxx&&a.getMinY()>=this._miny&&a.getMaxY()<=this._maxy}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];return!this.isNull()&&u>=this._minx&&u<=this._maxx&&y>=this._miny&&y<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return!this.isNull()&&!r.isNull()&&!(r._minx>this._maxx||r._maxxthis._maxy||r._maxythis._maxx)return!1;var M=u.x>y.x?u.x:y.x;if(Mthis._maxy)return!1;var W=u.y>y.y?u.y:y.y;return!(Wthis._maxx||nethis._maxy||methis._maxx&&(this._maxx=a._maxx),a._minythis._maxy&&(this._maxy=a._maxy))}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];this.isNull()?(this._minx=u,this._maxx=u,this._miny=y,this._maxy=y):(uthis._maxx&&(this._maxx=u),ythis._maxy&&(this._maxy=y))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var r=this.getWidth(),a=this.getHeight();return ra._minx?1:this._minya._miny?1:this._maxxa._maxx?1:this._maxya._maxy?1:0}},{key:"translate",value:function(r,a){if(this.isNull())return null;this.init(this.getMinX()+r,this.getMaxX()+r,this.getMinY()+a,this.getMaxY()+a)}},{key:"copy",value:function(){return new v(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(r){return!(!this.isNull()&&!r.isNull())||r._minx>this._maxx||r._maxxthis._maxy||r._maxya?r:a}},{key:"expandBy",value:function(){if(arguments.length===1){var r=arguments[0];this.expandBy(r,r)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];if(this.isNull())return null;this._minx-=a,this._maxx+=a,this._miny-=u,this._maxy+=u,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.covers(r)}if(arguments[0]instanceof _e){var a=arguments[0];return this.covers(a)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];return this.covers(u,y)}}},{key:"centre",value:function(){return this.isNull()?null:new _e((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof _e){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof v){var a=arguments[0];this._minx=a._minx,this._maxx=a._maxx,this._miny=a._miny,this._maxy=a._maxy}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];this.init(u.x,y.x,u.y,y.y)}else if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3];Er._maxx&&(a=this._minx-r._maxx);var u=0;return this._maxyr._maxy&&(u=this._miny-r._maxy),a===0?u:u===0?a:Math.sqrt(a*a+u*u)}},{key:"hashCode",value:function(){var r=17;return r=37*(r=37*(r=37*(r=37*r+_e.hashCode(this._minx))+_e.hashCode(this._maxx))+_e.hashCode(this._miny))+_e.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[Ze,He]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof _e){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof v){var a=arguments[0];this.init(a)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];this.init(u.x,y.x,u.y,y.y)}else if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3];this.init(E,M,B,W)}}},{key:"intersects",value:function(){if(arguments.length===3){var r=arguments[0],a=arguments[1],u=arguments[2];return u.x>=(r.xa.x?r.x:a.x)&&u.y>=(r.ya.y?r.y:a.y)}if(arguments.length===4){var y=arguments[0],E=arguments[1],M=arguments[2],B=arguments[3],W=Math.min(M.x,B.x),ne=Math.max(M.x,B.x),me=Math.min(y.x,E.x),Ee=Math.max(y.x,E.x);return!(me>ne)&&!(Eene)&&!(Ee=this.size())throw new to;return this.array[u]}},{key:"push",value:function(u){return this.array.push(u),u}},{key:"pop",value:function(){if(this.array.length===0)throw new Ki;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Ki;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(u){return this.array.indexOf(u)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),a}(Yn);function hi(v,r){return v.interfaces_&&v.interfaces_.indexOf(r)>-1}var An=function(){function v(r){c(this,v),this.str=r}return _(v,[{key:"append",value:function(r){this.str+=r}},{key:"setCharAt",value:function(r,a){this.str=this.str.substr(0,r)+a+this.str.substr(r+1)}},{key:"toString",value:function(){return this.str}}]),v}(),ms=function(){function v(r){c(this,v),this.value=r}return _(v,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(r){return this.valuer?1:0}}],[{key:"compare",value:function(r,a){return ra?1:0}},{key:"isNan",value:function(r){return Number.isNaN(r)}},{key:"valueOf",value:function(r){return new v(r)}}]),v}(),zs=function(){function v(){c(this,v)}return _(v,null,[{key:"isWhitespace",value:function(r){return r<=32&&r>=0||r===127}},{key:"toUpperCase",value:function(r){return r.toUpperCase()}}]),v}(),Ge=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"le",value:function(r){return this._hi9?(Ee=!0,Xe="9"):Xe="0"+me,B.append(Xe),u=u.subtract(v.valueOf(me)).multiply(v.TEN),Ee&&u.selfAdd(v.TEN);var ht=!0,tt=v.magnitude(u._hi);if(tt<0&&Math.abs(tt)>=W-ne&&(ht=!1),!ht)break}return a[0]=y,B.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var a=arguments[0];return this.add(-a)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof v){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0];return this.isNaN()?this:this.selfAdd(-a,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(r){return this.le(r)?this:r}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0];return this.selfDivide(a,0)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1],E=null,M=null,B=null,W=null,ne=null,me=null,Ee=null,Xe=null;return ne=this._hi/u,Xe=(E=(me=v.SPLIT*ne)-(E=me-ne))*(B=(Xe=v.SPLIT*u)-(B=Xe-u))-(Ee=ne*u)+E*(W=u-B)+(M=ne-E)*B+M*W,Xe=ne+(me=(this._hi-Ee-Xe+this._lo-ne*y)/u),this._hi=Xe,this._lo=ne-Xe+me,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof v){var r=arguments[0],a=null,u=null,y=null,E=null,M=null,B=null,W=null,ne=null;u=(M=this._hi/r._hi)-(a=(B=v.SPLIT*M)-(a=B-M)),ne=a*(y=(ne=v.SPLIT*r._hi)-(y=ne-r._hi))-(W=M*r._hi)+a*(E=r._hi-y)+u*y+u*E;var me=ne=M+(B=(this._hi-W-ne+this._lo-M*r._lo)/r._hi),Ee=M-ne+B;return new v(me,Ee)}if(typeof arguments[0]=="number"){var Xe=arguments[0];return nt.isNaN(Xe)?v.createNaN():v.copy(this).selfDivide(Xe,0)}}},{key:"ge",value:function(r){return this._hi>r._hi||this._hi===r._hi&&this._lo>=r._lo}},{key:"pow",value:function(r){if(r===0)return v.valueOf(1);var a=new v(this),u=v.valueOf(1),y=Math.abs(r);if(y>1)for(;y>0;)y%2==1&&u.selfMultiply(a),(y/=2)>0&&(a=a.sqr());else u=a;return r<0?u.reciprocal():u}},{key:"ceil",value:function(){if(this.isNaN())return v.NaN;var r=Math.ceil(this._hi),a=0;return r===this._hi&&(a=Math.ceil(this._lo)),new v(r,a)}},{key:"compareTo",value:function(r){var a=r;return this._hia._hi?1:this._loa._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var a=arguments[0];return this.init(a),this}}},{key:"max",value:function(r){return this.ge(r)?this:r}},{key:"sqrt",value:function(){if(this.isZero())return v.valueOf(0);if(this.isNegative())return v.NaN;var r=1/Math.sqrt(this._hi),a=this._hi*r,u=v.valueOf(a),y=this.subtract(u.sqr())._hi*(.5*r);return u.add(y)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0],u=null,y=null,E=null,M=null,B=null,W=null;return M=(E=this._hi+a)-(B=E-this._hi),y=(W=(M=a-B+(this._hi-M))+this._lo)+(E-(u=E+W)),this._hi=u+y,this._lo=y+(u-this._hi),this}}else if(arguments.length===2){var ne=arguments[0],me=arguments[1],Ee=null,Xe=null,ht=null,tt=null,Yt=null,ni=null,ci=null;tt=this._hi+ne,Xe=this._lo+me,Yt=tt-(ni=tt-this._hi),ht=Xe-(ci=Xe-this._lo);var Ci=(Ee=tt+(ni=(Yt=ne-ni+(this._hi-Yt))+Xe))+(ni=(ht=me-ci+(this._lo-ht))+(ni+(tt-Ee))),Ri=ni+(Ee-Ci);return this._hi=Ci,this._lo=Ri,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0];return this.selfMultiply(a,0)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1],E=null,M=null,B=null,W=null,ne=null,me=null;E=(ne=v.SPLIT*this._hi)-this._hi,me=v.SPLIT*u,E=ne-E,M=this._hi-E,B=me-u;var Ee=(ne=this._hi*u)+(me=E*(B=me-B)-ne+E*(W=u-B)+M*B+M*W+(this._hi*y+this._lo*u)),Xe=me+(E=ne-Ee);return this._hi=Ee,this._lo=Xe,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return v.NaN;var r=Math.floor(this._hi),a=0;return r===this._hi&&(a=Math.floor(this._lo)),new v(r,a)}},{key:"negate",value:function(){return this.isNaN()?this:new v(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(r){if(r instanceof CloneNotSupportedException)return null;throw r}}},{key:"multiply",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return r.isNaN()?v.createNaN():v.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var a=arguments[0];return nt.isNaN(a)?v.createNaN():v.copy(this).selfMultiply(a,0)}}},{key:"isNaN",value:function(){return nt.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var r=v.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var r=this.getSpecialNumberString();if(r!==null)return r;var a=new Array(1).fill(null),u=this.extractSignificantDigits(!0,a),y=a[0]+1,E=u;if(u.charAt(0)===".")E="0"+u;else if(y<0)E="0."+v.stringOfChar("0",-y)+u;else if(u.indexOf(".")===-1){var M=y-u.length;E=u+v.stringOfChar("0",M)+".0"}return this.isNegative()?"-"+E:E}},{key:"reciprocal",value:function(){var r,a,u,y,E=null,M=null,B=null,W=null;r=(u=1/this._hi)-(E=(B=v.SPLIT*u)-(E=B-u)),M=(W=v.SPLIT*this._hi)-this._hi;var ne=u+(B=(1-(y=u*this._hi)-(W=E*(M=W-M)-y+E*(a=this._hi-M)+r*M+r*a)-u*this._lo)/this._hi);return new v(ne,u-ne+B)}},{key:"toSciNotation",value:function(){if(this.isZero())return v.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var a=new Array(1).fill(null),u=this.extractSignificantDigits(!1,a),y=v.SCI_NOT_EXPONENT_CHAR+a[0];if(u.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+u);var E="";u.length>1&&(E=u.substring(1));var M=u.charAt(0)+"."+E;return this.isNegative()?"-"+M+y:M+y}},{key:"abs",value:function(){return this.isNaN()?v.NaN:this.isNegative()?this.negate():new v(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(r){return this._hir._hi||this._hi===r._hi&&this._lo>r._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?v.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[He,Ze,je]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this.init(r)}else if(arguments[0]instanceof v){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var u=arguments[0];v.constructor_.call(this,v.parse(u))}}else if(arguments.length===2){var y=arguments[0],E=arguments[1];this.init(y,E)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1],u=arguments[2],y=arguments[3];return v.determinant(v.valueOf(r),v.valueOf(a),v.valueOf(u),v.valueOf(y))}if(arguments[3]instanceof v&&arguments[2]instanceof v&&arguments[0]instanceof v&&arguments[1]instanceof v){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3],ne=E.multiply(W).selfSubtract(M.multiply(B));return ne}}},{key:"sqr",value:function(r){return v.valueOf(r).selfMultiply(r)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var r=arguments[0];return v.parse(r)}if(typeof arguments[0]=="number"){var a=arguments[0];return new v(a)}}},{key:"sqrt",value:function(r){return v.valueOf(r).sqrt()}},{key:"parse",value:function(r){for(var a=0,u=r.length;zs.isWhitespace(r.charAt(a));)a++;var y=!1;if(a=u);){var Ee=r.charAt(a);if(a++,zs.isDigit(Ee)){var Xe=Ee-"0";M.selfMultiply(v.TEN),M.selfAdd(Xe),B++}else{if(Ee!=="."){if(Ee==="e"||Ee==="E"){var ht=r.substring(a);try{ne=ms.parseInt(ht)}catch(Ci){throw Ci instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+ht+" in string "+r):Ci}break}throw new NumberFormatException("Unexpected character '"+Ee+"' at position "+a+" in string "+r)}W=B,me=!0}}var tt=M;me||(W=B);var Yt=B-W-ne;if(Yt===0)tt=M;else if(Yt>0){var ni=v.TEN.pow(Yt);tt=M.divide(ni)}else if(Yt<0){var ci=v.TEN.pow(-Yt);tt=M.multiply(ci)}return y?tt.negate():tt}},{key:"createNaN",value:function(){return new v(nt.NaN,nt.NaN)}},{key:"copy",value:function(r){return new v(r)}},{key:"magnitude",value:function(r){var a=Math.abs(r),u=Math.log(a)/Math.log(10),y=Math.trunc(Math.floor(u));return 10*Math.pow(10,y)<=a&&(y+=1),y}},{key:"stringOfChar",value:function(r,a){for(var u=new An,y=0;y0){if(M<=0)return v.signum(B);y=E+M}else{if(!(E<0)||M>=0)return v.signum(B);y=-E-M}var W=v.DP_SAFE_EPSILON*y;return B>=W||-B>=W?v.signum(B):2}},{key:"signum",value:function(r){return r>0?1:r<0?-1:0}}]),v}();wr.DP_SAFE_EPSILON=1e-15;var li=function(){function v(){c(this,v)}return _(v,[{key:"getM",value:function(r){if(this.hasM()){var a=this.getDimension()-this.getMeasures();return this.getOrdinate(r,a)}return nt.NaN}},{key:"setOrdinate",value:function(r,a,u){}},{key:"getZ",value:function(r){return this.hasZ()?this.getOrdinate(r,2):nt.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(r,a){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(r){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(r){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(r){}},{key:"copy",value:function(){}},{key:"getY",value:function(r){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[je]}}]),v}();li.X=0,li.Y=1,li.Z=2,li.M=3;var ei=function(){function v(){c(this,v)}return _(v,null,[{key:"index",value:function(r,a,u){return wr.orientationIndex(r,a,u)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var r=arguments[0],a=r.length-1;if(a<3)throw new ze("Ring has fewer than 4 points, so orientation cannot be determined");for(var u=r[0],y=0,E=1;E<=a;E++){var M=r[E];M.y>u.y&&(u=M,y=E)}var B=y;do(B-=1)<0&&(B=a);while(r[B].equals2D(u)&&B!==y);var W=y;do W=(W+1)%a;while(r[W].equals2D(u)&&W!==y);var ne=r[B],me=r[W];if(ne.equals2D(u)||me.equals2D(u)||ne.equals2D(me))return!1;var Ee=v.index(ne,u,me),Xe=null;return Xe=Ee===0?ne.x>me.x:Ee>0,Xe}if(hi(arguments[0],li)){var ht=arguments[0],tt=ht.size()-1;if(tt<3)throw new ze("Ring has fewer than 4 points, so orientation cannot be determined");for(var Yt=ht.getCoordinate(0),ni=0,ci=1;ci<=tt;ci++){var Ci=ht.getCoordinate(ci);Ci.y>Yt.y&&(Yt=Ci,ni=ci)}var Ri=null,bn=ni;do(bn-=1)<0&&(bn=tt),Ri=ht.getCoordinate(bn);while(Ri.equals2D(Yt)&&bn!==ni);var wn=null,gr=ni;do gr=(gr+1)%tt,wn=ht.getCoordinate(gr);while(wn.equals2D(Yt)&&gr!==ni);if(Ri.equals2D(Yt)||wn.equals2D(Yt)||Ri.equals2D(wn))return!1;var Nr=v.index(Ri,Yt,wn);return Nr===0?Ri.x>wn.x:Nr>0}}}]),v}();ei.CLOCKWISE=-1,ei.RIGHT=ei.CLOCKWISE,ei.COUNTERCLOCKWISE=1,ei.LEFT=ei.COUNTERCLOCKWISE,ei.COLLINEAR=0,ei.STRAIGHT=ei.COLLINEAR;var gs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(r,a){var u=this.getRightmostSideOfSegment(r,a);return u<0&&(u=this.getRightmostSideOfSegment(r,a-1)),u<0&&(this._minCoord=null,this.checkForRightmostCoordinate(r)),u}},{key:"findRightmostEdgeAtVertex",value:function(){var r=this._minDe.getEdge().getCoordinates();et.isTrue(this._minIndex>0&&this._minIndexthis._minCoord.y&&u.y>this._minCoord.y&&y===ei.CLOCKWISE)&&(E=!0),E&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(r,a){var u=r.getEdge().getCoordinates();if(a<0||a+1>=u.length||u[a].y===u[a+1].y)return-1;var y=Je.LEFT;return u[a].ythis._minCoord.x)&&(this._minDe=r,this._minIndex=u,this._minCoord=a[u])}},{key:"findRightmostEdgeAtNode",value:function(){var r=this._minDe.getNode().getEdges();this._minDe=r.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(r){for(var a=r.iterator();a.hasNext();){var u=a.next();u.isForward()&&this.checkForRightmostCoordinate(u)}et.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,this.getRightmostSide(this._minDe,this._minIndex)===Je.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),v}(),ut=function(v){k(a,v);var r=Q(a);function a(u,y){var E;return c(this,a),(E=r.call(this,y?u+" [ "+y+" ]":u)).pt=y?new _e(y):void 0,E.name=Object.keys({TopologyException:a})[0],E}return _(a,[{key:"getCoordinate",value:function(){return this.pt}}]),a}(jt),mi=function(){function v(){c(this,v),this.array=[]}return _(v,[{key:"addLast",value:function(r){this.array.push(r)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}]),v}(),rt=function(v,r){k(u,v);var a=Q(u);function u(y){var E;return c(this,u),(E=a.call(this)).array=[],y instanceof be&&E.addAll(y),E}return _(u,[{key:"interfaces_",get:function(){return[Yn,be]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(y){return arguments.length===1?this.array.push(y):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(y){var E,M=Ce(y);try{for(M.s();!(E=M.n()).done;){var B=E.value;this.array.push(B)}}catch(W){M.e(W)}finally{M.f()}}},{key:"set",value:function(y,E){var M=this.array[y];return this.array[y]=E,M}},{key:"iterator",value:function(){return new Kn(this)}},{key:"get",value:function(y){if(y<0||y>=this.size())throw new to;return this.array[y]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(y){y?this.array.sort(function(E,M){return y.compare(E,M)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(y){for(var E=0,M=this.array.length;E=1&&a.getDepth(Je.LEFT)<=0&&!a.isInteriorAreaEdge()&&a.setInResult(!0)}}},{key:"computeDepths",value:function(r){var a=new Yi,u=new mi,y=r.getNode();for(u.addLast(y),a.add(y),r.setVisited(!0);!u.isEmpty();){var E=u.removeFirst();a.add(E),this.computeNodeDepth(E);for(var M=E.getEdges().iterator();M.hasNext();){var B=M.next().getSym();if(!B.isVisited()){var W=B.getNode();a.contains(W)||(u.addLast(W),a.add(W))}}}}},{key:"compareTo",value:function(r){var a=r;return this._rightMostCoord.xa._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var r=new Kt,a=this._dirEdgeList.iterator();a.hasNext();)for(var u=a.next().getEdge().getCoordinates(),y=0;ya.x?r.x:a.x,W=r.y>a.y?r.y:a.y,ne=u.xy.x?u.x:y.x,Xe=u.y>y.y?u.y:y.y,ht=((E>ne?E:ne)+(Bme?M:me)+(Wu?u:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var y=arguments[0],E=arguments[1],M=arguments[2];return yM?M:y}}},{key:"wrap",value:function(r,a){return r<0?a- -r%a:r%a}},{key:"max",value:function(){if(arguments.length===3){var r=arguments[0],a=arguments[1],u=arguments[2],y=r;return a>y&&(y=a),u>y&&(y=u),y}if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3],ne=E;return M>ne&&(ne=M),B>ne&&(ne=B),W>ne&&(ne=W),ne}}},{key:"average",value:function(r,a){return(r+a)/2}}]),v}();ur.LOG_10=Math.log(10);var Sn=function(){function v(){c(this,v)}return _(v,null,[{key:"segmentToSegment",value:function(r,a,u,y){if(r.equals(a))return v.pointToSegment(r,u,y);if(u.equals(y))return v.pointToSegment(y,r,a);var E=!1;if(Kt.intersects(r,a,u,y)){var M=(a.x-r.x)*(y.y-u.y)-(a.y-r.y)*(y.x-u.x);if(M===0)E=!0;else{var B=(r.y-u.y)*(y.x-u.x)-(r.x-u.x)*(y.y-u.y),W=((r.y-u.y)*(a.x-r.x)-(r.x-u.x)*(a.y-r.y))/M,ne=B/M;(ne<0||ne>1||W<0||W>1)&&(E=!0)}}else E=!0;return E?ur.min(v.pointToSegment(r,u,y),v.pointToSegment(a,u,y),v.pointToSegment(u,r,a),v.pointToSegment(y,r,a)):0}},{key:"pointToSegment",value:function(r,a,u){if(a.x===u.x&&a.y===u.y)return r.distance(a);var y=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),E=((r.x-a.x)*(u.x-a.x)+(r.y-a.y)*(u.y-a.y))/y;if(E<=0)return r.distance(a);if(E>=1)return r.distance(u);var M=((a.y-r.y)*(u.x-a.x)-(a.x-r.x)*(u.y-a.y))/y;return Math.abs(M)*Math.sqrt(y)}},{key:"pointToLinePerpendicular",value:function(r,a,u){var y=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),E=((a.y-r.y)*(u.x-a.x)-(a.x-r.x)*(u.y-a.y))/y;return Math.abs(E)*Math.sqrt(y)}},{key:"pointToSegmentString",value:function(r,a){if(a.length===0)throw new ze("Line array must contain at least one vertex");for(var u=r.distance(a[0]),y=0;y0)&&(M=W,E=B)}return E}}},{key:"extend",value:function(r,a,u){var y=r.create(u,a.getDimension()),E=a.size();if(v.copy(a,0,y,0,E),E>0)for(var M=E;M0)&&(a=y)}return a}}]),v}(),$=function(){function v(){c(this,v)}return _(v,null,[{key:"toDimensionSymbol",value:function(r){switch(r){case v.FALSE:return v.SYM_FALSE;case v.TRUE:return v.SYM_TRUE;case v.DONTCARE:return v.SYM_DONTCARE;case v.P:return v.SYM_P;case v.L:return v.SYM_L;case v.A:return v.SYM_A}throw new ze("Unknown dimension value: "+r)}},{key:"toDimensionValue",value:function(r){switch(zs.toUpperCase(r)){case v.SYM_FALSE:return v.FALSE;case v.SYM_TRUE:return v.TRUE;case v.SYM_DONTCARE:return v.DONTCARE;case v.SYM_P:return v.P;case v.SYM_L:return v.L;case v.SYM_A:return v.A}throw new ze("Unknown dimension symbol: "+r)}}]),v}();$.P=0,$.L=1,$.A=2,$.FALSE=-1,$.TRUE=-2,$.DONTCARE=-3,$.SYM_FALSE="F",$.SYM_TRUE="T",$.SYM_DONTCARE="*",$.SYM_P="0",$.SYM_L="1",$.SYM_A="2";var ge=function(){function v(){c(this,v)}return _(v,[{key:"filter",value:function(r){}}]),v}(),we=function(){function v(){c(this,v)}return _(v,[{key:"filter",value:function(r,a){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),v}(),Le=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new Kt:this._points.expandEnvelope(new Kt)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new a(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof _t){var u=arguments[0],y=arguments[1];if(!this.isEquivalentClass(u))return!1;var E=u;if(this._points.size()!==E._points.size())return!1;for(var M=0;M0){var E=this._points.copy();ee.reverse(E),this._points=E}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?$.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var u=this._points.copy();return ee.reverse(u),this.getFactory().createLineString(u)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return _t.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return H.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var u=arguments[0],y=u,E=0,M=0;E= 2)");this._points=u}},{key:"isCoordinate",value:function(u){for(var y=0;y=1&&this.getCoordinateSequence().size()= 4)")}},{key:"getGeometryType",value:function(){return _t.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var u=arguments[0],y=arguments[1];Le.constructor_.call(this,u,y),this.validateConstruction()}}]),a}(Le);zi.MINIMUM_VALID_SIZE=4;var ji=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"setOrdinate",value:function(u,y){switch(u){case a.X:this.x=y;break;case a.Y:this.y=y;break;default:throw new ze("Invalid ordinate index: "+u)}}},{key:"getZ",value:function(){return _e.NULL_ORDINATE}},{key:"getOrdinate",value:function(u){switch(u){case a.X:return this.x;case a.Y:return this.y}throw new ze("Invalid ordinate index: "+u)}},{key:"setZ",value:function(u){throw new ze("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(u){this.x=u.x,this.y=u.y,this.z=u.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)_e.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof a){var u=arguments[0];_e.constructor_.call(this,u.x,u.y)}else if(arguments[0]instanceof _e){var y=arguments[0];_e.constructor_.call(this,y.x,y.y)}}else if(arguments.length===2){var E=arguments[0],M=arguments[1];_e.constructor_.call(this,E,M,_e.NULL_ORDINATE)}}}]),a}(_e);ji.X=0,ji.Y=1,ji.Z=-1,ji.M=-1;var fi=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(u,y){switch(u){case a.X:this.x=y;break;case a.Y:this.y=y;break;case a.M:this._m=y;break;default:throw new ze("Invalid ordinate index: "+u)}}},{key:"setM",value:function(u){this._m=u}},{key:"getZ",value:function(){return _e.NULL_ORDINATE}},{key:"getOrdinate",value:function(u){switch(u){case a.X:return this.x;case a.Y:return this.y;case a.M:return this._m}throw new ze("Invalid ordinate index: "+u)}},{key:"setZ",value:function(u){throw new ze("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(u){this.x=u.x,this.y=u.y,this.z=u.getZ(),this._m=u.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)_e.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof a){var u=arguments[0];_e.constructor_.call(this,u.x,u.y),this._m=u._m}else if(arguments[0]instanceof _e){var y=arguments[0];_e.constructor_.call(this,y.x,y.y),this._m=this.getM()}}else if(arguments.length===3){var E=arguments[0],M=arguments[1],B=arguments[2];_e.constructor_.call(this,E,M,_e.NULL_ORDINATE),this._m=B}}}]),a}(_e);fi.X=0,fi.Y=1,fi.Z=-1,fi.M=2;var Ii=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(u,y){switch(u){case _e.X:this.x=y;break;case _e.Y:this.y=y;break;case _e.Z:this.z=y;break;case _e.M:this._m=y;break;default:throw new ze("Invalid ordinate index: "+u)}}},{key:"setM",value:function(u){this._m=u}},{key:"getOrdinate",value:function(u){switch(u){case _e.X:return this.x;case _e.Y:return this.y;case _e.Z:return this.getZ();case _e.M:return this.getM()}throw new ze("Invalid ordinate index: "+u)}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(u){this.x=u.x,this.y=u.y,this.z=u.getZ(),this._m=u.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)_e.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof a){var u=arguments[0];_e.constructor_.call(this,u),this._m=u._m}else if(arguments[0]instanceof _e){var y=arguments[0];_e.constructor_.call(this,y),this._m=this.getM()}}else if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3];_e.constructor_.call(this,E,M,B),this._m=W}}}]),a}(_e),Mi=function(){function v(){c(this,v)}return _(v,null,[{key:"measures",value:function(r){return r instanceof ji?0:r instanceof fi||r instanceof Ii?1:0}},{key:"dimension",value:function(r){return r instanceof ji?2:r instanceof fi?3:r instanceof Ii?4:3}},{key:"create",value:function(){if(arguments.length===1){var r=arguments[0];return v.create(r,0)}if(arguments.length===2){var a=arguments[0],u=arguments[1];return a===2?new ji:a===3&&u===0?new _e:a===3&&u===1?new fi:a===4&&u===1?new Ii:new _e}}}]),v}(),sn=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getCoordinate",value:function(u){return this.get(u)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&hi(arguments[0],be)){for(var u=arguments[0],y=arguments[1],E=!1,M=u.iterator();M.hasNext();)this.add(M.next(),y),E=!0;return E}return re(I(a.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var u=re(I(a.prototype),"clone",this).call(this),y=0;y=1){var W=this.get(this.size()-1);if(W.equals2D(M))return null}re(I(a.prototype),"add",this).call(this,M)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var ne=arguments[0],me=arguments[1];return this.add(ne,me),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Ee=arguments[0],Xe=arguments[1],ht=arguments[2];if(ht)for(var tt=0;tt=0;Yt--)this.add(Ee[Yt],Xe);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof _e){var ni=arguments[0],ci=arguments[1],Ci=arguments[2];if(!Ci){var Ri=this.size();if(Ri>0){if(ni>0){var bn=this.get(ni-1);if(bn.equals2D(ci))return null}if(niLi&&(Or=-1);for(var yn=Is;yn!==Li;yn+=Or)this.add(gr[yn],Nr);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var u=this.get(0).copy();this.add(u,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var y=arguments[0],E=arguments[1];this.ensureCapacity(y.length),this.add(y,E)}}}}]),a}(rt);sn.coordArrayType=new Array(0).fill(null);var wi=function(){function v(){c(this,v)}return _(v,null,[{key:"isRing",value:function(r){return!(r.length<4)&&!!r[0].equals2D(r[r.length-1])}},{key:"ptNotInList",value:function(r,a){for(var u=0;u=r?a:[]}},{key:"indexOf",value:function(r,a){for(var u=0;u0)&&(a=r[u]);return a}},{key:"extract",value:function(r,a,u){a=ur.clamp(a,0,r.length);var y=(u=ur.clamp(u,-1,r.length))-a+1;u<0&&(y=0),a>=r.length&&(y=0),uy.length)return 1;if(u.length===0)return 0;var E=wi.compare(u,y);return wi.isEqualReversed(u,y)?0:E}},{key:"OLDcompare",value:function(r,a){var u=r,y=a;if(u.lengthy.length)return 1;if(u.length===0)return 0;for(var E=wi.increasingDirection(u),M=wi.increasingDirection(y),B=E>0?0:u.length-1,W=M>0?0:u.length-1,ne=0;ne0){var r=new ki(17*this._coordinates.length);r.append("("),r.append(this._coordinates[0]);for(var a=1;a3&&(y=3),y<2&&(y=2),new Ns(u,y)}if(arguments.length===3){var E=arguments[0],M=arguments[1],B=arguments[2],W=M-B;return B>1&&(B=1),W>3&&(W=3),W<2&&(W=2),new Ns(E,W+B,B)}}}},{key:"interfaces_",get:function(){return[Dr,He]}}],[{key:"instance",value:function(){return v.instanceObject}}]),v}();Fo.instanceObject=new Fo;var Gn=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"copyInternal",value:function(){for(var u=new Array(this._geometries.length).fill(null),y=0;y=0?r:a}}]),v}(),hn=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"readResolve",value:function(){return v.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[He]}}],[{key:"constructor_",value:function(){this._name=null;var r=arguments[0];this._name=r,v.nameToTypeMap.put(r,this)}}]),v}();hn.nameToTypeMap=new Fu,on.Type=hn,on.FIXED=new hn("FIXED"),on.FLOATING=new hn("FLOATING"),on.FLOATING_SINGLE=new hn("FLOATING SINGLE"),on.maximumPreciseValue=9007199254740992;var io=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"copyInternal",value:function(){for(var u=new Array(this._geometries.length).fill(null),y=0;y1){if(W instanceof Bt)return this.createMultiPolygon(v.toPolygonArray(r));if(W instanceof Le)return this.createMultiLineString(v.toLineStringArray(r));if(W instanceof Ve)return this.createMultiPoint(v.toPointArray(r));et.shouldNeverReachHere("Unhandled geometry type: "+W.getGeometryType())}return W}},{key:"createMultiPointFromCoords",value:function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof _e){var r=arguments[0];return this.createPoint(r!==null?this.getCoordinateSequenceFactory().create([r]):null)}if(hi(arguments[0],li)){var a=arguments[0];return new Ve(a,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(hi(arguments[0],li)){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Array){var a=arguments[0];return this.createPolygon(this.createLinearRing(a))}if(arguments[0]instanceof zi){var u=arguments[0];return this.createPolygon(u,null)}}else if(arguments.length===2){var y=arguments[0],E=arguments[1];return new Bt(y,E,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new Ht(null,this);if(arguments.length===1){var r=arguments[0];return new Ht(r,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return this.createLinearRing(r!==null?this.getCoordinateSequenceFactory().create(r):null)}if(hi(arguments[0],li)){var a=arguments[0];return new zi(a,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new Gn(null,this);if(arguments.length===1){var r=arguments[0];return new Gn(r,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new Ai(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new Ai(r,this)}if(hi(arguments[0],li)){var a=arguments[0];if(a===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(a.size()).fill(null),y=0;y="a"&&r<="z"||r>="A"&&r<="Z"}},{key:"isNumeric_",value:function(r,a){return r>="0"&&r<="9"||r=="."&&!(a!==void 0&&a)}},{key:"isWhiteSpace_",value:function(r){return r==" "||r==" "||r=="\r"||r==` -`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var r,a=this.nextChar_(),u=this.index_,y=a;if(a=="(")r=Rn;else if(a==",")r=hr;else if(a==")")r=qr;else if(this.isNumeric_(a)||a=="-")r=no,y=this.readNumber_();else if(this.isAlpha_(a))r=ys,y=this.readText_();else{if(this.isWhiteSpace_(a))return this.nextToken();if(a!=="")throw new Error("Unexpected character: "+a);r=Si}return{position:u,value:y,type:r}}},{key:"readNumber_",value:function(){var r,a=this.index_,u=!1,y=!1;do r=="."?u=!0:r!="e"&&r!="E"||(y=!0),r=this.nextChar_();while(this.isNumeric_(r,u)||!y&&(r=="e"||r=="E")||y&&(r=="-"||r=="+"));return parseFloat(this.wkt.substring(a,this.index_--))}},{key:"readText_",value:function(){var r,a=this.index_;do r=this.nextChar_();while(this.isAlpha_(r));return this.wkt.substring(a,this.index_--).toUpperCase()}}]),v}(),jo=function(){function v(r,a){c(this,v),this.lexer_=r,this.token_,this.layout_=an,this.factory=a}return _(v,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(r){return this.token_.type==r}},{key:"match",value:function(r){var a=this.isTokenType(r);return a&&this.consume_(),a}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var r=an,a=this.token_;if(this.isTokenType(ys)){var u=a.value;u==="Z"?r=Jr:u==="M"?r=Os:u==="ZM"&&(r=fn),r!==an&&this.consume_()}return r}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Rn)){var r=[];do r.push(this.parseGeometry_());while(this.match(hr));if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Rn)){var r=this.parsePoint_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Rn)){var r=this.parsePointList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Rn)){var r=this.parseLineStringTextList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var r;if(this.match(Rn)){if(r=this.token_.type==Rn?this.parsePointTextList_():this.parsePointList_(),this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Rn)){var r=this.parseLineStringTextList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Rn)){var r=this.parsePolygonTextList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var r=[],a=this.layout_.length,u=0;u1?r.createPolygon(ci[0],ci.slice(1)):r.createPolygon(ci[0])},y=this.token_;if(this.match(ys)){var E=y.value;if(this.layout_=this.parseGeometryLayout_(),E=="GEOMETRYCOLLECTION"){var M=this.parseGeometryCollectionText_();return r.createGeometryCollection(M)}switch(E){case"POINT":var B=this.parsePointText_();return B?r.createPoint(F(_e,Ae(B))):r.createPoint();case"LINESTRING":var W=this.parseLineStringText_().map(a);return r.createLineString(W);case"LINEARRING":var ne=this.parseLineStringText_().map(a);return r.createLinearRing(ne);case"POLYGON":var me=this.parsePolygonText_();return me&&me.length!==0?u(me):r.createPolygon();case"MULTIPOINT":var Ee=this.parseMultiPointText_();if(!Ee||Ee.length===0)return r.createMultiPoint();var Xe=Ee.map(a).map(function(ni){return r.createPoint(ni)});return r.createMultiPoint(Xe);case"MULTILINESTRING":var ht=this.parseMultiLineStringText_().map(function(ni){return r.createLineString(ni.map(a))});return r.createMultiLineString(ht);case"MULTIPOLYGON":var tt=this.parseMultiPolygonText_();if(!tt||tt.length===0)return r.createMultiPolygon();var Yt=tt.map(u);return r.createMultiPolygon(Yt);default:throw new Error("Invalid geometry type: "+E)}}throw new Error(this.formatErrorMessage_())}}]),v}();function Uo(v){if(v.isEmpty())return"";var r=v.getCoordinate(),a=[r.x,r.y];return r.z===void 0||Number.isNaN(r.z)||a.push(r.z),r.m===void 0||Number.isNaN(r.m)||a.push(r.m),a.join(" ")}function _s(v){for(var r=v.getCoordinates().map(function(E){var M=[E.x,E.y];return E.z===void 0||Number.isNaN(E.z)||M.push(E.z),E.m===void 0||Number.isNaN(E.m)||M.push(E.m),M}),a=[],u=0,y=r.length;u0&&(r+=" "+u),v.isEmpty()?r+" "+cr:r+" ("+a(v)+")"}var so=function(){function v(r){c(this,v),this.geometryFactory=r||new Vr,this.precisionModel=this.geometryFactory.getPrecisionModel()}return _(v,[{key:"read",value:function(r){var a=new tl(r);return new jo(a,this.geometryFactory).parse()}},{key:"write",value:function(r){return ro(r)}}]),v}(),il=function(){function v(r){c(this,v),this.parser=new so(r)}return _(v,[{key:"write",value:function(r){return this.parser.write(r)}}],[{key:"toLineString",value:function(r,a){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+a.x+" "+a.y+" )"}}]),v}(),Ji=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getIndexAlongSegment",value:function(r,a){return this.computeIntLineIndex(),this._intLineIndex[r][a]}},{key:"getTopologySummary",value:function(){var r=new ki;return this.isEndPoint()&&r.append(" endpoint"),this._isProper&&r.append(" proper"),this.isCollinear()&&r.append(" collinear"),r.toString()}},{key:"computeIntersection",value:function(r,a,u,y){this._inputLines[0][0]=r,this._inputLines[0][1]=a,this._inputLines[1][0]=u,this._inputLines[1][1]=y,this._result=this.computeIntersect(r,a,u,y)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var r=arguments[0],a=this.getEdgeDistance(r,0),u=this.getEdgeDistance(r,1);a>u?(this._intLineIndex[r][0]=0,this._intLineIndex[r][1]=1):(this._intLineIndex[r][0]=1,this._intLineIndex[r][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(r){this._precisionModel=r}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var r=arguments[0],a=0;aE?y:E;else{var B=Math.abs(r.x-a.x),W=Math.abs(r.y-a.y);(M=y>E?B:W)!==0||r.equals(a)||(M=Math.max(B,W))}return et.isTrue(!(M===0&&!r.equals(a)),"Bad distance calculation"),M}},{key:"nonRobustComputeEdgeDistance",value:function(r,a,u){var y=r.x-a.x,E=r.y-a.y,M=Math.sqrt(y*y+E*E);return et.isTrue(!(M===0&&!r.equals(a)),"Invalid distance calculation"),M}}]),v}();Ji.DONT_INTERSECT=0,Ji.DO_INTERSECT=1,Ji.COLLINEAR=2,Ji.NO_INTERSECTION=0,Ji.POINT_INTERSECTION=1,Ji.COLLINEAR_INTERSECTION=2;var vs=function(v){k(a,v);var r=Q(a);function a(){return c(this,a),r.call(this)}return _(a,[{key:"isInSegmentEnvelopes",value:function(u){var y=new Kt(this._inputLines[0][0],this._inputLines[0][1]),E=new Kt(this._inputLines[1][0],this._inputLines[1][1]);return y.contains(u)&&E.contains(u)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return re(I(a.prototype),"computeIntersection",this).apply(this,arguments);var u=arguments[0],y=arguments[1],E=arguments[2];if(this._isProper=!1,Kt.intersects(y,E,u)&&ei.index(y,E,u)===0&&ei.index(E,y,u)===0)return this._isProper=!0,(u.equals(y)||u.equals(E))&&(this._isProper=!1),this._result=Ji.POINT_INTERSECTION,null;this._result=Ji.NO_INTERSECTION}},{key:"intersection",value:function(u,y,E,M){var B=this.intersectionSafe(u,y,E,M);return this.isInSegmentEnvelopes(B)||(B=new _e(a.nearestEndpoint(u,y,E,M))),this._precisionModel!==null&&this._precisionModel.makePrecise(B),B}},{key:"checkDD",value:function(u,y,E,M,B){var W=wr.intersection(u,y,E,M),ne=this.isInSegmentEnvelopes(W);cn.out.println("DD in env = "+ne+" --------------------- "+W),B.distance(W)>1e-4&&cn.out.println("Distance = "+B.distance(W))}},{key:"intersectionSafe",value:function(u,y,E,M){var B=si.intersection(u,y,E,M);return B===null&&(B=a.nearestEndpoint(u,y,E,M)),B}},{key:"computeCollinearIntersection",value:function(u,y,E,M){var B=Kt.intersects(u,y,E),W=Kt.intersects(u,y,M),ne=Kt.intersects(E,M,u),me=Kt.intersects(E,M,y);return B&&W?(this._intPt[0]=E,this._intPt[1]=M,Ji.COLLINEAR_INTERSECTION):ne&&me?(this._intPt[0]=u,this._intPt[1]=y,Ji.COLLINEAR_INTERSECTION):B&&ne?(this._intPt[0]=E,this._intPt[1]=u,!E.equals(u)||W||me?Ji.COLLINEAR_INTERSECTION:Ji.POINT_INTERSECTION):B&&me?(this._intPt[0]=E,this._intPt[1]=y,!E.equals(y)||W||ne?Ji.COLLINEAR_INTERSECTION:Ji.POINT_INTERSECTION):W&&ne?(this._intPt[0]=M,this._intPt[1]=u,!M.equals(u)||B||me?Ji.COLLINEAR_INTERSECTION:Ji.POINT_INTERSECTION):W&&me?(this._intPt[0]=M,this._intPt[1]=y,!M.equals(y)||B||ne?Ji.COLLINEAR_INTERSECTION:Ji.POINT_INTERSECTION):Ji.NO_INTERSECTION}},{key:"computeIntersect",value:function(u,y,E,M){if(this._isProper=!1,!Kt.intersects(u,y,E,M))return Ji.NO_INTERSECTION;var B=ei.index(u,y,E),W=ei.index(u,y,M);if(B>0&&W>0||B<0&&W<0)return Ji.NO_INTERSECTION;var ne=ei.index(E,M,u),me=ei.index(E,M,y);return ne>0&&me>0||ne<0&&me<0?Ji.NO_INTERSECTION:B===0&&W===0&&ne===0&&me===0?this.computeCollinearIntersection(u,y,E,M):(B===0||W===0||ne===0||me===0?(this._isProper=!1,u.equals2D(E)||u.equals2D(M)?this._intPt[0]=u:y.equals2D(E)||y.equals2D(M)?this._intPt[0]=y:B===0?this._intPt[0]=new _e(E):W===0?this._intPt[0]=new _e(M):ne===0?this._intPt[0]=new _e(u):me===0&&(this._intPt[0]=new _e(y))):(this._isProper=!0,this._intPt[0]=this.intersection(u,y,E,M)),Ji.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(u,y,E,M){var B=u,W=Sn.pointToSegment(u,E,M),ne=Sn.pointToSegment(y,E,M);return ney&&(u=a.x,y=r.x),this._p.x>=u&&this._p.x<=y&&(this._isPointOnSegment=!0),null}if(r.y>this._p.y&&a.y<=this._p.y||a.y>this._p.y&&r.y<=this._p.y){var E=ei.index(r,a,this._p);if(E===ei.COLLINEAR)return this._isPointOnSegment=!0,null;a.ythis.location.length){var a=new Array(3).fill(null);a[Je.ON]=this.location[Je.ON],a[Je.LEFT]=he.NONE,a[Je.RIGHT]=he.NONE,this.location=a}for(var u=0;u1&&r.append(he.toLocationSymbol(this.location[Je.LEFT])),r.append(he.toLocationSymbol(this.location[Je.ON])),this.location.length>1&&r.append(he.toLocationSymbol(this.location[Je.RIGHT])),r.toString()}},{key:"setLocations",value:function(r,a,u){this.location[Je.ON]=r,this.location[Je.LEFT]=a,this.location[Je.RIGHT]=u}},{key:"get",value:function(r){return r1}},{key:"isAnyNull",value:function(){for(var r=0;rthis._maxNodeDegree&&(this._maxNodeDegree=a),r=this.getNext(r)}while(r!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(r,a,u){var y=r.getCoordinates();if(a){var E=1;u&&(E=0);for(var M=E;M=0;W--)this._pts.add(y[W])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)}},{key:"containsPoint",value:function(r){var a=this.getLinearRing();if(!a.getEnvelopeInternal().contains(r)||!Gr.isInRing(r,a.getCoordinates()))return!1;for(var u=this._holes.iterator();u.hasNext();)if(u.next().containsPoint(r))return!1;return!0}},{key:"addHole",value:function(r){this._holes.add(r)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var r=arguments[0];this.mergeLabel(r,0),this.mergeLabel(r,1)}else if(arguments.length===2){var a=arguments[0],u=arguments[1],y=a.getLocation(u,Je.RIGHT);if(y===he.NONE)return null;if(this._label.getLocation(u)===he.NONE)return this._label.setLocation(u,y),null}}},{key:"setShell",value:function(r){this._shell=r,r!==null&&r.addHole(this)}},{key:"toPolygon",value:function(r){for(var a=new Array(this._holes.size()).fill(null),u=0;u=2,"found partial label"),this.computeIM(r)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0&&arguments.length===1){var r=arguments[0];this._label=r}}}]),v}(),Go=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"isIncidentEdgeInResult",value:function(){for(var u=this.getEdges().getEdges().iterator();u.hasNext();)if(u.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(u){u.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(u){}},{key:"computeMergedLocation",value:function(u,y){var E=he.NONE;if(E=this._label.getLocation(y),!u.isNull(y)){var M=u.getLocation(y);E!==he.BOUNDARY&&(E=M)}return E}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return re(I(a.prototype),"setLabel",this).apply(this,arguments);var u=arguments[0],y=arguments[1];this._label===null?this._label=new Qi(u,y):this._label.setLocation(u,y)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof a){var u=arguments[0];this.mergeLabel(u._label)}else if(arguments[0]instanceof Qi)for(var y=arguments[0],E=0;E<2;E++){var M=this.computeMergedLocation(y,E),B=this._label.getLocation(E);B===he.NONE&&this._label.setLocation(E,M)}}},{key:"add",value:function(u){this._edges.insert(u),u.setNode(this)}},{key:"setLabelBoundary",value:function(u){if(this._label===null)return null;var y=he.NONE;this._label!==null&&(y=this._label.getLocation(u));var E=null;switch(y){case he.BOUNDARY:E=he.INTERIOR;break;case he.INTERIOR:default:E=he.BOUNDARY}this._label.setLocation(u,E)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var u=arguments[0],y=arguments[1];this._coord=u,this._edges=y,this._label=new Qi(0,he.NONE)}}]),a}(nl),Fs=function(v){k(a,v);var r=Q(a);function a(){return c(this,a),r.apply(this,arguments)}return a}(Jn);function rl(v){return v==null?0:v.color}function Ti(v){return v==null?null:v.parent}function Zr(v,r){v!==null&&(v.color=r)}function va(v){return v==null?null:v.left}function sl(v){return v==null?null:v.right}var Zo=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),(u=r.call(this)).root_=null,u.size_=0,u}return _(a,[{key:"get",value:function(u){for(var y=this.root_;y!==null;){var E=u.compareTo(y.key);if(E<0)y=y.left;else{if(!(E>0))return y.value;y=y.right}}return null}},{key:"put",value:function(u,y){if(this.root_===null)return this.root_={key:u,value:y,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var E,M,B=this.root_;do if(E=B,(M=u.compareTo(B.key))<0)B=B.left;else{if(!(M>0)){var W=B.value;return B.value=y,W}B=B.right}while(B!==null);var ne={key:u,left:null,right:null,value:y,parent:E,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return M<0?E.left=ne:E.right=ne,this.fixAfterInsertion(ne),this.size_++,null}},{key:"fixAfterInsertion",value:function(u){var y;for(u.color=1;u!=null&&u!==this.root_&&u.parent.color===1;)Ti(u)===va(Ti(Ti(u)))?rl(y=sl(Ti(Ti(u))))===1?(Zr(Ti(u),0),Zr(y,0),Zr(Ti(Ti(u)),1),u=Ti(Ti(u))):(u===sl(Ti(u))&&(u=Ti(u),this.rotateLeft(u)),Zr(Ti(u),0),Zr(Ti(Ti(u)),1),this.rotateRight(Ti(Ti(u)))):rl(y=va(Ti(Ti(u))))===1?(Zr(Ti(u),0),Zr(y,0),Zr(Ti(Ti(u)),1),u=Ti(Ti(u))):(u===va(Ti(u))&&(u=Ti(u),this.rotateRight(u)),Zr(Ti(u),0),Zr(Ti(Ti(u)),1),this.rotateLeft(Ti(Ti(u))));this.root_.color=0}},{key:"values",value:function(){var u=new rt,y=this.getFirstEntry();if(y!==null)for(u.add(y.value);(y=a.successor(y))!==null;)u.add(y.value);return u}},{key:"entrySet",value:function(){var u=new Yi,y=this.getFirstEntry();if(y!==null)for(u.add(y);(y=a.successor(y))!==null;)u.add(y);return u}},{key:"rotateLeft",value:function(u){if(u!=null){var y=u.right;u.right=y.left,y.left!=null&&(y.left.parent=u),y.parent=u.parent,u.parent==null?this.root_=y:u.parent.left===u?u.parent.left=y:u.parent.right=y,y.left=u,u.parent=y}}},{key:"rotateRight",value:function(u){if(u!=null){var y=u.left;u.left=y.right,y.right!=null&&(y.right.parent=u),y.parent=u.parent,u.parent==null?this.root_=y:u.parent.right===u?u.parent.right=y:u.parent.left=y,y.right=u,u.parent=y}}},{key:"getFirstEntry",value:function(){var u=this.root_;if(u!=null)for(;u.left!=null;)u=u.left;return u}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(u){for(var y=this.root_;y!==null;){var E=u.compareTo(y.key);if(E<0)y=y.left;else{if(!(E>0))return!0;y=y.right}}return!1}}],[{key:"successor",value:function(u){var y;if(u===null)return null;if(u.right!==null){for(y=u.right;y.left!==null;)y=y.left;return y}y=u.parent;for(var E=u;y!==null&&E===y.right;)E=y,y=y.parent;return y}}]),a}(Fs),Wo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"find",value:function(r){return this.nodeMap.get(r)}},{key:"addNode",value:function(){if(arguments[0]instanceof _e){var r=arguments[0],a=this.nodeMap.get(r);return a===null&&(a=this.nodeFact.createNode(r),this.nodeMap.put(r,a)),a}if(arguments[0]instanceof Go){var u=arguments[0],y=this.nodeMap.get(u.getCoordinate());return y===null?(this.nodeMap.put(u.getCoordinate(),u),u):(y.mergeLabel(u),y)}}},{key:"print",value:function(r){for(var a=this.iterator();a.hasNext();)a.next().print(r)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(r){for(var a=new rt,u=this.iterator();u.hasNext();){var y=u.next();y.getLabel().getLocation(r)===he.BOUNDARY&&a.add(y)}return a}},{key:"add",value:function(r){var a=r.getCoordinate();this.addNode(a).add(r)}}],[{key:"constructor_",value:function(){this.nodeMap=new Zo,this.nodeFact=null;var r=arguments[0];this.nodeFact=r}}]),v}(),In=function(){function v(){c(this,v)}return _(v,null,[{key:"isNorthern",value:function(r){return r===v.NE||r===v.NW}},{key:"isOpposite",value:function(r,a){return r!==a&&(r-a+4)%4===2}},{key:"commonHalfPlane",value:function(r,a){if(r===a)return r;if((r-a+4)%4===2)return-1;var u=ra?r:a)===3?3:u}},{key:"isInHalfPlane",value:function(r,a){return a===v.SE?r===v.SE||r===v.SW:r===a||r===a+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1];if(r===0&&a===0)throw new ze("Cannot compute the quadrant for point ( "+r+", "+a+" )");return r>=0?a>=0?v.NE:v.SE:a>=0?v.NW:v.SW}if(arguments[0]instanceof _e&&arguments[1]instanceof _e){var u=arguments[0],y=arguments[1];if(y.x===u.x&&y.y===u.y)throw new ze("Cannot compute the quadrant for two identical points "+u);return y.x>=u.x?y.y>=u.y?v.NE:v.SE:y.y>=u.y?v.NW:v.SW}}}]),v}();In.NE=0,In.NW=1,In.SW=2,In.SE=3;var Xo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compareDirection",value:function(r){return this._dx===r._dx&&this._dy===r._dy?0:this._quadrant>r._quadrant?1:this._quadrant2){M.linkDirectedEdgesForMinimalEdgeRings();var B=M.buildMinimalRings(),W=this.findShell(B);W!==null?(this.placePolygonHoles(W,B),a.add(W)):u.addAll(B)}else y.add(M)}return y}},{key:"buildMaximalEdgeRings",value:function(r){for(var a=new rt,u=r.iterator();u.hasNext();){var y=u.next();if(y.isInResult()&&y.getLabel().isArea()&&y.getEdgeRing()===null){var E=new _a(y,this._geometryFactory);a.add(E),E.setInResult()}}return a}},{key:"placePolygonHoles",value:function(r,a){for(var u=a.iterator();u.hasNext();){var y=u.next();y.isHole()&&y.setShell(r)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(r){for(var a=0,u=null,y=r.iterator();y.hasNext();){var E=y.next();E.isHole()||(u=E,a++)}return et.isTrue(a<=1,"found two shells in MinimalEdgeRing list"),u}},{key:"add",value:function(){if(arguments.length===1){var r=arguments[0];this.add(r.getEdgeEnds(),r.getNodes())}else if(arguments.length===2){var a=arguments[0],u=arguments[1];zr.linkResultDirectedEdges(u);var y=this.buildMaximalEdgeRings(a),E=new rt,M=this.buildMinimalEdgeRings(y,this._shellList,E);this.sortShellsAndHoles(M,this._shellList,E),this.placeFreeHoles(this._shellList,E)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new rt;var r=arguments[0];this._geometryFactory=r}},{key:"findEdgeRingContaining",value:function(r,a){for(var u=r.getLinearRing(),y=u.getEnvelopeInternal(),E=u.getCoordinateN(0),M=null,B=null,W=a.iterator();W.hasNext();){var ne=W.next(),me=ne.getLinearRing(),Ee=me.getEnvelopeInternal();if(!Ee.equals(y)&&Ee.contains(y)){E=wi.ptNotInList(u.getCoordinates(),me.getCoordinates());var Xe=!1;Gr.isInRing(E,me.getCoordinates())&&(Xe=!0),Xe&&(M===null||B.contains(Ee))&&(B=(M=ne).getLinearRing().getEnvelopeInternal())}}return M}}]),v}(),Bs=function(){function v(){c(this,v)}return _(v,[{key:"getBounds",value:function(){}}]),v}(),pi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[Bs,He]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var r=arguments[0],a=arguments[1];this._bounds=r,this._item=a}}]),v}(),xs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"poll",value:function(){if(this.isEmpty())return null;var r=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),r}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(r){for(var a=null,u=this._items.get(r);2*r<=this._size&&((a=2*r)!==this._size&&this._items.get(a+1).compareTo(this._items.get(a))<0&&a++,this._items.get(a).compareTo(u)<0);r=a)this._items.set(r,this._items.get(a));this._items.set(r,u)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(r){this._items.add(null),this._size+=1;var a=this._size;for(this._items.set(0,r);r.compareTo(this._items.get(Math.trunc(a/2)))<0;a/=2)this._items.set(a,this._items.get(Math.trunc(a/2)));this._items.set(a,r)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new rt,this._items.add(null)}}]),v}(),ju=function(){function v(){c(this,v)}return _(v,[{key:"insert",value:function(r,a){}},{key:"remove",value:function(r,a){}},{key:"query",value:function(){}}]),v}(),Zn=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(r){et.isTrue(this._bounds===null),this._childBoundables.add(r)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[Bs,He]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new rt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var r=arguments[0];this._level=r}}}]),v}(),oo={reverseOrder:function(){return{compare:function(v,r){return r.compareTo(v)}}},min:function(v){return oo.sort(v),v.get(0)},sort:function(v,r){var a=v.toArray();r?Fe.sort(a,r):Fe.sort(a);for(var u=v.iterator(),y=0,E=a.length;yv.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,r,a),null):(this.expand(this._boundable2,this._boundable1,!0,r,a),null);if(u)return this.expand(this._boundable1,this._boundable2,!1,r,a),null;if(y)return this.expand(this._boundable2,this._boundable1,!0,r,a),null;throw new ze("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(v.isComposite(this._boundable1)||v.isComposite(this._boundable2))}},{key:"compareTo",value:function(r){var a=r;return this._distancea._distance?1:0}},{key:"expand",value:function(r,a,u,y,E){for(var M=r.getChildBoundables().iterator();M.hasNext();){var B=M.next(),W=null;(W=u?new v(a,B,this._itemDistance):new v(B,a,this._itemDistance)).getDistance()-2),y.getLevel()===u)return E.add(y),null;for(var M=y.getChildBoundables().iterator();M.hasNext();){var B=M.next();B instanceof Zn?this.boundablesAtLevel(u,B,E):(et.isTrue(B instanceof pi),u===-1&&E.add(B))}return null}}},{key:"query",value:function(){if(arguments.length===1){var r=arguments[0];this.build();var a=new rt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.queryInternal(r,this._root,a),a}if(arguments.length===2){var u=arguments[0],y=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),u)&&this.queryInternal(u,this._root,y)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.remove(r,this._root,a)}if(arguments.length===3){var u=arguments[0],y=arguments[1],E=arguments[2],M=this.removeItem(y,E);if(M)return!0;for(var B=null,W=y.getChildBoundables().iterator();W.hasNext();){var ne=W.next();if(this.getIntersectsOp().intersects(ne.getBounds(),u)&&ne instanceof Zn&&(M=this.remove(u,ne,E))){B=ne;break}}return B!==null&&B.getChildBoundables().isEmpty()&&y.getChildBoundables().remove(B),M}}},{key:"createHigherLevels",value:function(r,a){et.isTrue(!r.isEmpty());var u=this.createParentBoundables(r,a+1);return u.size()===1?u.get(0):this.createHigherLevels(u,a+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var r=arguments[0],a=0,u=r.getChildBoundables().iterator();u.hasNext();){var y=u.next();if(y instanceof Zn){var E=this.depth(y);E>a&&(a=E)}}return a+1}}},{key:"createParentBoundables",value:function(r,a){et.isTrue(!r.isEmpty());var u=new rt;u.add(this.createNode(a));var y=new rt(r);oo.sort(y,this.getComparator());for(var E=y.iterator();E.hasNext();){var M=E.next();this.lastNode(u).getChildBoundables().size()===this.getNodeCapacity()&&u.add(this.createNode(a)),this.lastNode(u).addChildBoundable(M)}return u}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[He]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new rt,this._nodeCapacity=null,arguments.length===0)v.constructor_.call(this,v.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var r=arguments[0];et.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}}},{key:"compareDoubles",value:function(r,a){return r>a?1:r0);for(var E=new rt,M=0;M=0;){var Ee=ne.poll(),Xe=Ee.getDistance();if(Xe>=W)break;if(Ee.isLeaves())if(me.size()Xe&&(me.poll(),me.add(Ee));var tt=me.peek();W=tt.getDistance()}else Ee.expandToQueue(ne,W)}return a.getItems(me)}}},{key:"createNode",value:function(u){return new ll(u)}},{key:"size",value:function(){return arguments.length===0?re(I(a.prototype),"size",this).call(this):re(I(a.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof Kt))return re(I(a.prototype),"insert",this).apply(this,arguments);var u=arguments[0],y=arguments[1];if(u.isNull())return null;re(I(a.prototype),"insert",this).call(this,u,y)}},{key:"getIntersectsOp",value:function(){return a.intersectsOp}},{key:"verticalSlices",value:function(u,y){for(var E=Math.trunc(Math.ceil(u.size()/y)),M=new Array(y).fill(null),B=u.iterator(),W=0;W0;){var ne=W.poll(),me=ne.getDistance();if(me>=M)break;ne.isLeaves()?(M=me,B=ne):ne.expandToQueue(W,M)}return B===null?null:[B.getBoundable(0).getItem(),B.getBoundable(1).getItem()]}}else{if(arguments.length===2){var Ee=arguments[0],Xe=arguments[1];if(this.isEmpty()||Ee.isEmpty())return null;var ht=new lo(this.getRoot(),Ee.getRoot(),Xe);return this.nearestNeighbour(ht)}if(arguments.length===3){var tt=arguments[0],Yt=arguments[1],ni=arguments[2],ci=new pi(tt,Yt),Ci=new lo(this.getRoot(),ci,ni);return this.nearestNeighbour(Ci)[0]}if(arguments.length===4){var Ri=arguments[0],bn=arguments[1],wn=arguments[2],gr=arguments[3],Nr=new pi(Ri,bn),Is=new lo(this.getRoot(),Nr,wn);return this.nearestNeighbourK(Is,gr)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var u=arguments[0],y=arguments[1],E=nt.POSITIVE_INFINITY,M=new xs;for(M.add(u);!M.isEmpty();){var B=M.poll(),W=B.getDistance();if(W>y)return!1;if(B.maximumDistance()<=y)return!0;if(B.isLeaves()){if((E=W)<=y)return!0}else B.expandToQueue(M,E)}return!1}if(arguments.length===3){var ne=arguments[0],me=arguments[1],Ee=arguments[2],Xe=new lo(this.getRoot(),ne.getRoot(),me);return this.isWithinDistance(Xe,Ee)}}},{key:"interfaces_",get:function(){return[ju,He]}}],[{key:"constructor_",value:function(){if(arguments.length===0)a.constructor_.call(this,a.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var u=arguments[0];uo.constructor_.call(this,u)}}},{key:"centreX",value:function(u){return a.avg(u.getMinX(),u.getMaxX())}},{key:"avg",value:function(u,y){return(u+y)/2}},{key:"getItems",value:function(u){for(var y=new Array(u.size()).fill(null),E=0;!u.isEmpty();){var M=u.poll();y[E]=M.getBoundable(0).getItem(),E++}return y}},{key:"centreY",value:function(u){return a.avg(u.getMinY(),u.getMaxY())}}]),a}(uo),ll=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"computeBounds",value:function(){for(var u=null,y=this.getChildBoundables().iterator();y.hasNext();){var E=y.next();u===null?u=new Kt(E.getBounds()):u.expandToInclude(E.getBounds())}return u}}],[{key:"constructor_",value:function(){var u=arguments[0];Zn.constructor_.call(this,u)}}]),a}(Zn);kr.STRtreeNode=ll,kr.xComparator=new(function(){function v(){c(this,v)}return _(v,[{key:"interfaces_",get:function(){return[Ft]}},{key:"compare",value:function(r,a){return uo.compareDoubles(kr.centreX(r.getBounds()),kr.centreX(a.getBounds()))}}]),v}()),kr.yComparator=new(function(){function v(){c(this,v)}return _(v,[{key:"interfaces_",get:function(){return[Ft]}},{key:"compare",value:function(r,a){return uo.compareDoubles(kr.centreY(r.getBounds()),kr.centreY(a.getBounds()))}}]),v}()),kr.intersectsOp=new(function(){function v(){c(this,v)}return _(v,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(r,a){return r.intersects(a)}}]),v}()),kr.DEFAULT_NODE_CAPACITY=10;var Vl=function(){function v(){c(this,v)}return _(v,null,[{key:"relativeSign",value:function(r,a){return ra?1:0}},{key:"compare",value:function(r,a,u){if(a.equals2D(u))return 0;var y=v.relativeSign(a.x,u.x),E=v.relativeSign(a.y,u.y);switch(r){case 0:return v.compareValue(y,E);case 1:return v.compareValue(E,y);case 2:return v.compareValue(E,-y);case 3:return v.compareValue(-y,E);case 4:return v.compareValue(-y,-E);case 5:return v.compareValue(-E,-y);case 6:return v.compareValue(-E,y);case 7:return v.compareValue(y,-E)}return et.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(r,a){return r<0?-1:r>0?1:a<0?-1:a>0?1:0}}]),v}(),ql=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(r){var a=r;return this.segmentIndexa.segmentIndex?1:this.coord.equals2D(a.coord)?0:this._isInterior?a._isInterior?Vl.compare(this._segmentOctant,this.coord,a.coord):1:-1}},{key:"isEndPoint",value:function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var r=arguments[0],a=arguments[1],u=arguments[2],y=arguments[3];this._segString=r,this.coord=new _e(a),this.segmentIndex=u,this._segmentOctant=y,this._isInterior=!a.equals2D(r.getCoordinate(u))}}]),v}(),Gl=function(){function v(){c(this,v)}return _(v,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),v}(),js=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getSplitCoordinates",value:function(){var r=new sn;this.addEndpoints();for(var a=this.iterator(),u=a.next();a.hasNext();){var y=a.next();this.addEdgeCoordinates(u,y,r),u=y}return r.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var r=new rt;this.findCollapsesFromInsertedNodes(r),this.findCollapsesFromExistingVertices(r);for(var a=r.iterator();a.hasNext();){var u=a.next().intValue();this.add(this._edge.getCoordinate(u),u)}}},{key:"createSplitEdgePts",value:function(r,a){var u=a.segmentIndex-r.segmentIndex+2;if(u===2)return[new _e(r.coord),new _e(a.coord)];var y=this._edge.getCoordinate(a.segmentIndex),E=a.isInterior()||!a.coord.equals2D(y);E||u--;var M=new Array(u).fill(null),B=0;M[B++]=new _e(r.coord);for(var W=r.segmentIndex+1;W<=a.segmentIndex;W++)M[B++]=this._edge.getCoordinate(W);return E&&(M[B]=new _e(a.coord)),M}},{key:"print",value:function(r){r.println("Intersections:");for(var a=this.iterator();a.hasNext();)a.next().print(r)}},{key:"findCollapsesFromExistingVertices",value:function(r){for(var a=0;a=0?a>=0?u>=y?0:1:u>=y?7:6:a>=0?u>=y?3:2:u>=y?4:5}if(arguments[0]instanceof _e&&arguments[1]instanceof _e){var E=arguments[0],M=arguments[1],B=M.x-E.x,W=M.y-E.y;if(B===0&&W===0)throw new ze("Cannot compute the octant for two identical points "+E);return v.octant(B,W)}}}]),v}(),Uu=function(){function v(){c(this,v)}return _(v,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(r){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(r){}},{key:"getData",value:function(){}}]),v}(),Vu=function(){function v(){c(this,v)}return _(v,[{key:"addIntersection",value:function(r,a){}},{key:"interfaces_",get:function(){return[Uu]}}]),v}(),bs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(r){return this._pts[r]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))}},{key:"setData",value:function(r){this._data=r}},{key:"safeOctant",value:function(r,a){return r.equals2D(a)?0:Zl.octant(r,a)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];this.addIntersectionNode(r,a)}else if(arguments.length===4){var u=arguments[0],y=arguments[1],E=arguments[3],M=new _e(u.getIntersection(E));this.addIntersection(M,y)}}},{key:"toString",value:function(){return il.toLineString(new Ns(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(r,a){var u=a,y=u+1;if(y=0&&u>=0||a<=0&&u<=0?Math.max(a,u):0}if(arguments[0]instanceof _e){var y=arguments[0];return ei.index(this.p0,this.p1,y)}}},{key:"toGeometry",value:function(r){return r.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(r){if(!(r instanceof v))return!1;var a=r;return this.p0.equals(a.p0)&&this.p1.equals(a.p1)}},{key:"intersection",value:function(r){var a=new vs;return a.computeIntersection(this.p0,this.p1,r.p0,r.p1),a.hasIntersection()?a.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof _e){var r=arguments[0];if(r.equals(this.p0)||r.equals(this.p1))return new _e(r);var a=this.projectionFactor(r),u=new _e;return u.x=this.p0.x+a*(this.p1.x-this.p0.x),u.y=this.p0.y+a*(this.p1.y-this.p0.y),u}if(arguments[0]instanceof v){var y=arguments[0],E=this.projectionFactor(y.p0),M=this.projectionFactor(y.p1);if(E>=1&&M>=1||E<=0&&M<=0)return null;var B=this.project(y.p0);E<0&&(B=this.p0),E>1&&(B=this.p1);var W=this.project(y.p1);return M<0&&(W=this.p0),M>1&&(W=this.p1),new v(B,W)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(r){return r===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(r){return Sn.pointToLinePerpendicular(r,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return v.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(r){if(r.equals(this.p0))return 0;if(r.equals(this.p1))return 1;var a=this.p1.x-this.p0.x,u=this.p1.y-this.p0.y,y=a*a+u*u;return y<=0?nt.NaN:((r.x-this.p0.x)*a+(r.y-this.p0.y)*u)/y}},{key:"closestPoints",value:function(r){var a=this.intersection(r);if(a!==null)return[a,a];var u=new Array(2).fill(null),y=nt.MAX_VALUE,E=null,M=this.closestPoint(r.p0);y=M.distance(r.p0),u[0]=M,u[1]=r.p0;var B=this.closestPoint(r.p1);(E=B.distance(r.p1))0&&a<1?this.project(r):this.p0.distance(r)1||nt.isNaN(a))&&(a=1),a}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(r){var a=this.p1.getY()-this.p0.getY(),u=this.p0.getX()-this.p1.getX(),y=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),E=a*a+u*u,M=a*a-u*u,B=r.getX(),W=r.getY();return new _e((-M*B-2*a*u*W-2*a*y)/E,(M*W-2*a*u*B-2*u*y)/E)}},{key:"distance",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return Sn.segmentToSegment(this.p0,this.p1,r.p0,r.p1)}if(arguments[0]instanceof _e){var a=arguments[0];return Sn.pointToSegment(a,this.p0,this.p1)}}},{key:"pointAlong",value:function(r){var a=new _e;return a.x=this.p0.x+r*(this.p1.x-this.p0.x),a.y=this.p0.y+r*(this.p1.y-this.p0.y),a}},{key:"hashCode",value:function(){var r=nt.doubleToLongBits(this.p0.x);r^=31*nt.doubleToLongBits(this.p0.y);var a=Math.trunc(r)^Math.trunc(r>>32),u=nt.doubleToLongBits(this.p1.x);return u^=31*nt.doubleToLongBits(this.p1.y),a^(Math.trunc(u)^Math.trunc(u>>32))}},{key:"interfaces_",get:function(){return[Ze,He]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)v.constructor_.call(this,new _e,new _e);else if(arguments.length===1){var r=arguments[0];v.constructor_.call(this,r.p0,r.p1)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];this.p0=a,this.p1=u}else if(arguments.length===4){var y=arguments[0],E=arguments[1],M=arguments[2],B=arguments[3];v.constructor_.call(this,new _e(y,E),new _e(M,B))}}},{key:"midPoint",value:function(r,a){return new _e((r.x+a.x)/2,(r.y+a.y)/2)}}]),v}(),qu=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"overlap",value:function(){if(arguments.length!==2&&arguments.length===4){var r=arguments[0],a=arguments[1],u=arguments[2],y=arguments[3];r.getLineSegment(a,this._overlapSeg1),u.getLineSegment(y,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new En,this._overlapSeg2=new En}}]),v}(),Yo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getLineSegment",value:function(r,a){a.p0=this._pts[r],a.p1=this._pts[r+1]}},{key:"computeSelect",value:function(r,a,u,y){var E=this._pts[a],M=this._pts[u];if(u-a==1)return y.select(this,a),null;if(!r.intersects(E,M))return null;var B=Math.trunc((a+u)/2);a=r.length-1)return r.length-1;for(var y=In.quadrant(r[u],r[u+1]),E=a+1;EE.getId()&&(E.computeOverlaps(B,u),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new rt,this._index=new kr,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0&&arguments.length===1){var u=arguments[0];cl.constructor_.call(this,u)}}}]),a}(cl),hl=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"overlap",value:function(){if(arguments.length!==4)return re(I(a.prototype),"overlap",this).apply(this,arguments);var u=arguments[0],y=arguments[1],E=arguments[2],M=arguments[3],B=u.getContext(),W=E.getContext();this._si.processIntersections(B,y,W,M)}}],[{key:"constructor_",value:function(){this._si=null;var u=arguments[0];this._si=u}}]),a}(qu);ba.SegmentOverlapAction=hl;var fr=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"isDeletable",value:function(r,a,u,y){var E=this._inputLine[r],M=this._inputLine[a],B=this._inputLine[u];return!!this.isConcave(E,M,B)&&!!this.isShallow(E,M,B,y)&&this.isShallowSampled(E,M,r,u,y)}},{key:"deleteShallowConcavities",value:function(){for(var r=1,a=this.findNextNonDeletedIndex(r),u=this.findNextNonDeletedIndex(a),y=!1;u=0;y--)this.addPt(r[y])}},{key:"isRedundant",value:function(r){if(this._ptList.size()<1)return!1;var a=this._ptList.get(this._ptList.size()-1);return r.distance(a)Math.PI;)r-=v.PI_TIMES_2;for(;r<=-Math.PI;)r+=v.PI_TIMES_2;return r}},{key:"angle",value:function(){if(arguments.length===1){var r=arguments[0];return Math.atan2(r.y,r.x)}if(arguments.length===2){var a=arguments[0],u=arguments[1],y=u.x-a.x,E=u.y-a.y;return Math.atan2(E,y)}}},{key:"isAcute",value:function(r,a,u){var y=r.x-a.x,E=r.y-a.y;return y*(u.x-a.x)+E*(u.y-a.y)>0}},{key:"isObtuse",value:function(r,a,u){var y=r.x-a.x,E=r.y-a.y;return y*(u.x-a.x)+E*(u.y-a.y)<0}},{key:"interiorAngle",value:function(r,a,u){var y=v.angle(a,r),E=v.angle(a,u);return Math.abs(E-y)}},{key:"normalizePositive",value:function(r){if(r<0){for(;r<0;)r+=v.PI_TIMES_2;r>=v.PI_TIMES_2&&(r=0)}else{for(;r>=v.PI_TIMES_2;)r-=v.PI_TIMES_2;r<0&&(r=0)}return r}},{key:"angleBetween",value:function(r,a,u){var y=v.angle(a,r),E=v.angle(a,u);return v.diff(y,E)}},{key:"diff",value:function(r,a){var u=null;return(u=rMath.PI&&(u=2*Math.PI-u),u}},{key:"toRadians",value:function(r){return r*Math.PI/180}},{key:"getTurn",value:function(r,a){var u=Math.sin(a-r);return u>0?v.COUNTERCLOCKWISE:u<0?v.CLOCKWISE:v.NONE}},{key:"angleBetweenOriented",value:function(r,a,u){var y=v.angle(a,r),E=v.angle(a,u)-y;return E<=-Math.PI?E+v.PI_TIMES_2:E>Math.PI?E-v.PI_TIMES_2:E}}]),v}();Nn.PI_TIMES_2=2*Math.PI,Nn.PI_OVER_2=Math.PI/2,Nn.PI_OVER_4=Math.PI/4,Nn.COUNTERCLOCKWISE=ei.COUNTERCLOCKWISE,Nn.CLOCKWISE=ei.CLOCKWISE,Nn.NONE=ei.COLLINEAR;var dr=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"addNextSegment",value:function(r,a){if(this._s0=this._s1,this._s1=this._s2,this._s2=r,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 u=ei.index(this._s0,this._s1,this._s2),y=u===ei.CLOCKWISE&&this._side===Je.LEFT||u===ei.COUNTERCLOCKWISE&&this._side===Je.RIGHT;u===0?this.addCollinear(a):y?this.addOutsideTurn(u,a):this.addInsideTurn(u,a)}},{key:"addLineEndCap",value:function(r,a){var u=new En(r,a),y=new En;this.computeOffsetSegment(u,Je.LEFT,this._distance,y);var E=new En;this.computeOffsetSegment(u,Je.RIGHT,this._distance,E);var M=a.x-r.x,B=a.y-r.y,W=Math.atan2(B,M);switch(this._bufParams.getEndCapStyle()){case ke.CAP_ROUND:this._segList.addPt(y.p1),this.addDirectedFillet(a,W+Math.PI/2,W-Math.PI/2,ei.CLOCKWISE,this._distance),this._segList.addPt(E.p1);break;case ke.CAP_FLAT:this._segList.addPt(y.p1),this._segList.addPt(E.p1);break;case ke.CAP_SQUARE:var ne=new _e;ne.x=Math.abs(this._distance)*Math.cos(W),ne.y=Math.abs(this._distance)*Math.sin(W);var me=new _e(y.p1.x+ne.x,y.p1.y+ne.y),Ee=new _e(E.p1.x+ne.x,E.p1.y+ne.y);this._segList.addPt(me),this._segList.addPt(Ee)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(r,a,u,y){var E=si.intersection(a.p0,a.p1,u.p0,u.p1);if(E!==null&&(y<=0?1:E.distance(r)/Math.abs(y))<=this._bufParams.getMitreLimit())return this._segList.addPt(E),null;this.addLimitedMitreJoin(a,u,y,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(r,a){if(this._offset0.p1.distance(this._offset1.p0)=Ee&&(W-=2*Math.PI),this._segList.addPt(a),this.addDirectedFillet(r,W,Ee,y,E),this._segList.addPt(u)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(r,a,u){this._s1=r,this._s2=a,this._side=u,this._seg1.setCoordinates(r,a),this.computeOffsetSegment(this._seg1,u,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(r,a,u,y){var E=this._seg0.p1,M=Nn.angle(E,this._seg0.p0),B=Nn.angleBetweenOriented(this._seg0.p0,E,this._seg1.p1)/2,W=Nn.normalize(M+B),ne=Nn.normalize(W+Math.PI),me=y*u,Ee=u-me*Math.abs(Math.sin(B)),Xe=E.x+me*Math.cos(ne),ht=E.y+me*Math.sin(ne),tt=new _e(Xe,ht),Yt=new En(E,tt),ni=Yt.pointAlongOffset(1,Ee),ci=Yt.pointAlongOffset(1,-Ee);this._side===Je.LEFT?(this._segList.addPt(ni),this._segList.addPt(ci)):(this._segList.addPt(ci),this._segList.addPt(ni))}},{key:"addDirectedFillet",value:function(r,a,u,y,E){var M=y===ei.CLOCKWISE?-1:1,B=Math.abs(a-u),W=Math.trunc(B/this._filletAngleQuantum+.5);if(W<1)return null;for(var ne=B/W,me=new _e,Ee=0;Ee0){var u=new _e((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(u);var y=new _e((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(y)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(r){var a=new _e(r.x+this._distance,r.y);this._segList.addPt(a),this.addDirectedFillet(r,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(r,a){this._segList.addPt(r.p1),this._segList.addPt(a.p0)}},{key:"init",value:function(r){this._distance=r,this._maxCurveSegmentError=r*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new fl,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(r*v.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(r){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===ke.JOIN_BEVEL||this._bufParams.getJoinStyle()===ke.JOIN_MITRE?(r&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,ei.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){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 En,this._seg1=new En,this._offset0=new En,this._offset1=new En,this._side=0,this._hasNarrowConcaveAngle=!1;var r=arguments[0],a=arguments[1],u=arguments[2];this._precisionModel=r,this._bufParams=a,this._li=new vs,this._filletAngleQuantum=Math.PI/2/a.getQuadrantSegments(),a.getQuadrantSegments()>=8&&a.getJoinStyle()===ke.JOIN_ROUND&&(this._closingSegLengthFactor=v.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)}}]),v}();dr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,dr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,dr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,dr.MAX_CLOSING_SEG_LEN_FACTOR=80;var Ko=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getOffsetCurve",value:function(r,a){if(this._distance=a,a===0)return null;var u=a<0,y=Math.abs(a),E=this.getSegGen(y);r.length<=1?this.computePointCurve(r[0],E):this.computeOffsetCurve(r,u,E);var M=E.getCoordinates();return u&&wi.reverse(M),M}},{key:"computeSingleSidedBufferCurve",value:function(r,a,u){var y=this.simplifyTolerance(this._distance);if(a){u.addSegments(r,!0);var E=fr.simplify(r,-y),M=E.length-1;u.initSideSegments(E[M],E[M-1],Je.LEFT),u.addFirstSegment();for(var B=M-2;B>=0;B--)u.addNextSegment(E[B],!0)}else{u.addSegments(r,!1);var W=fr.simplify(r,y),ne=W.length-1;u.initSideSegments(W[0],W[1],Je.LEFT),u.addFirstSegment();for(var me=2;me<=ne;me++)u.addNextSegment(W[me],!0)}u.addLastSegment(),u.closeRing()}},{key:"computeRingBufferCurve",value:function(r,a,u){var y=this.simplifyTolerance(this._distance);a===Je.RIGHT&&(y=-y);var E=fr.simplify(r,y),M=E.length-1;u.initSideSegments(E[M-1],E[0],a);for(var B=1;B<=M;B++){var W=B!==1;u.addNextSegment(E[B],W)}u.closeRing()}},{key:"computeLineBufferCurve",value:function(r,a){var u=this.simplifyTolerance(this._distance),y=fr.simplify(r,u),E=y.length-1;a.initSideSegments(y[0],y[1],Je.LEFT);for(var M=2;M<=E;M++)a.addNextSegment(y[M],!0);a.addLastSegment(),a.addLineEndCap(y[E-1],y[E]);var B=fr.simplify(r,-u),W=B.length-1;a.initSideSegments(B[W],B[W-1],Je.LEFT);for(var ne=W-2;ne>=0;ne--)a.addNextSegment(B[ne],!0);a.addLastSegment(),a.addLineEndCap(B[1],B[0]),a.closeRing()}},{key:"computePointCurve",value:function(r,a){switch(this._bufParams.getEndCapStyle()){case ke.CAP_ROUND:a.createCircle(r);break;case ke.CAP_SQUARE:a.createSquare(r)}}},{key:"getLineCurve",value:function(r,a){if(this._distance=a,this.isLineOffsetEmpty(a))return null;var u=Math.abs(a),y=this.getSegGen(u);if(r.length<=1)this.computePointCurve(r[0],y);else if(this._bufParams.isSingleSided()){var E=a<0;this.computeSingleSidedBufferCurve(r,E,y)}else this.computeLineBufferCurve(r,y);return y.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(r){return r*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(r,a,u){if(this._distance=u,r.length<=2)return this.getLineCurve(r,u);if(u===0)return v.copyCoordinates(r);var y=this.getSegGen(u);return this.computeRingBufferCurve(r,a,y),y.getCoordinates()}},{key:"computeOffsetCurve",value:function(r,a,u){var y=this.simplifyTolerance(this._distance);if(a){var E=fr.simplify(r,-y),M=E.length-1;u.initSideSegments(E[M],E[M-1],Je.LEFT),u.addFirstSegment();for(var B=M-2;B>=0;B--)u.addNextSegment(E[B],!0)}else{var W=fr.simplify(r,y),ne=W.length-1;u.initSideSegments(W[0],W[1],Je.LEFT),u.addFirstSegment();for(var me=2;me<=ne;me++)u.addNextSegment(W[me],!0)}u.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(r){return r===0||r<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(r){return new dr(this._precisionModel,this._bufParams,r)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],a=arguments[1];this._precisionModel=r,this._bufParams=a}},{key:"copyCoordinates",value:function(r){for(var a=new Array(r.length).fill(null),u=0;uE.getMaxY()||this.findStabbedSegments(r,y.getDirectedEdges(),a)}return a}if(arguments.length===3){if(hi(arguments[2],Yn)&&arguments[0]instanceof _e&&arguments[1]instanceof Ho)for(var M=arguments[0],B=arguments[1],W=arguments[2],ne=B.getEdge().getCoordinates(),me=0;methis._seg.p1.y&&this._seg.reverse();var Ee=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(Eethis._seg.p1.y||ei.index(this._seg.p0,this._seg.p1,M)===ei.RIGHT)){var Xe=B.getDepth(Je.LEFT);this._seg.p0.equals(ne[me])||(Xe=B.getDepth(Je.RIGHT));var ht=new ka(this._seg,Xe);W.add(ht)}}else if(hi(arguments[2],Yn)&&arguments[0]instanceof _e&&hi(arguments[1],Yn))for(var tt=arguments[0],Yt=arguments[1],ni=arguments[2],ci=Yt.iterator();ci.hasNext();){var Ci=ci.next();Ci.isForward()&&this.findStabbedSegments(tt,Ci,ni)}}}},{key:"getDepth",value:function(r){var a=this.findStabbedSegments(r);return a.size()===0?0:oo.min(a)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new En;var r=arguments[0];this._subgraphs=r}}]),v}(),ka=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compareTo",value:function(r){var a=r;if(this._upwardSeg.minX()>=a._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=a._upwardSeg.minX())return-1;var u=this._upwardSeg.orientationIndex(a._upwardSeg);return u!==0||(u=-1*a._upwardSeg.orientationIndex(this._upwardSeg))!==0?u:this._upwardSeg.compareTo(a._upwardSeg)}},{key:"compareX",value:function(r,a){var u=r.p0.compareTo(a.p0);return u!==0?u:r.p1.compareTo(a.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],a=arguments[1];this._upwardSeg=new En(r),this._leftDepth=a}}]),v}();wa.DepthSegment=ka;var dl=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,null,[{key:"constructor_",value:function(){Re.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),a}(Re),Jo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getY",value:function(){var r=this.y/this.w;if(nt.isNaN(r)||nt.isInfinite(r))throw new dl;return r}},{key:"getX",value:function(){var r=this.x/this.w;if(nt.isNaN(r)||nt.isInfinite(r))throw new dl;return r}},{key:"getCoordinate",value:function(){var r=new _e;return r.x=this.getX(),r.y=this.getY(),r}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var r=arguments[0];this.x=r.x,this.y=r.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var a=arguments[0],u=arguments[1];this.x=a,this.y=u,this.w=1}else if(arguments[0]instanceof v&&arguments[1]instanceof v){var y=arguments[0],E=arguments[1];this.x=y.y*E.w-E.y*y.w,this.y=E.x*y.w-y.x*E.w,this.w=y.x*E.y-E.x*y.y}else if(arguments[0]instanceof _e&&arguments[1]instanceof _e){var M=arguments[0],B=arguments[1];this.x=M.y-B.y,this.y=B.x-M.x,this.w=M.x*B.y-B.x*M.y}}else if(arguments.length===3){var W=arguments[0],ne=arguments[1],me=arguments[2];this.x=W,this.y=ne,this.w=me}else if(arguments.length===4){var Ee=arguments[0],Xe=arguments[1],ht=arguments[2],tt=arguments[3],Yt=Ee.y-Xe.y,ni=Xe.x-Ee.x,ci=Ee.x*Xe.y-Xe.x*Ee.y,Ci=ht.y-tt.y,Ri=tt.x-ht.x,bn=ht.x*tt.y-tt.x*ht.y;this.x=ni*bn-Ri*ci,this.y=Ci*ci-Yt*bn,this.w=Yt*Ri-Ci*ni}}}]),v}(),Ni=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"area",value:function(){return v.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return v.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(r){if(r===null)throw new ze("Supplied point is null.");return v.interpolateZ(r,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return v.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return v.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return v.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return v.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return v.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return v.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var r=arguments[0],a=arguments[1],u=arguments[2];this.p0=r,this.p1=a,this.p2=u}},{key:"area",value:function(r,a,u){return Math.abs(((u.x-r.x)*(a.y-r.y)-(a.x-r.x)*(u.y-r.y))/2)}},{key:"signedArea",value:function(r,a,u){return((u.x-r.x)*(a.y-r.y)-(a.x-r.x)*(u.y-r.y))/2}},{key:"det",value:function(r,a,u,y){return r*y-a*u}},{key:"interpolateZ",value:function(r,a,u,y){var E=a.x,M=a.y,B=u.x-E,W=y.x-E,ne=u.y-M,me=y.y-M,Ee=B*me-W*ne,Xe=r.x-E,ht=r.y-M,tt=(me*Xe-W*ht)/Ee,Yt=(-ne*Xe+B*ht)/Ee;return a.getZ()+tt*(u.getZ()-a.getZ())+Yt*(y.getZ()-a.getZ())}},{key:"longestSideLength",value:function(r,a,u){var y=r.distance(a),E=a.distance(u),M=u.distance(r),B=y;return E>B&&(B=E),M>B&&(B=M),B}},{key:"circumcentreDD",value:function(r,a,u){var y=Ge.valueOf(r.x).subtract(u.x),E=Ge.valueOf(r.y).subtract(u.y),M=Ge.valueOf(a.x).subtract(u.x),B=Ge.valueOf(a.y).subtract(u.y),W=Ge.determinant(y,E,M,B).multiply(2),ne=y.sqr().add(E.sqr()),me=M.sqr().add(B.sqr()),Ee=Ge.determinant(E,ne,B,me),Xe=Ge.determinant(y,ne,M,me),ht=Ge.valueOf(u.x).subtract(Ee.divide(W)).doubleValue(),tt=Ge.valueOf(u.y).add(Xe.divide(W)).doubleValue();return new _e(ht,tt)}},{key:"isAcute",value:function(r,a,u){return!!Nn.isAcute(r,a,u)&&!!Nn.isAcute(a,u,r)&&!!Nn.isAcute(u,r,a)}},{key:"circumcentre",value:function(r,a,u){var y=u.x,E=u.y,M=r.x-y,B=r.y-E,W=a.x-y,ne=a.y-E,me=2*v.det(M,B,W,ne),Ee=v.det(B,M*M+B*B,ne,W*W+ne*ne),Xe=v.det(M,M*M+B*B,W,W*W+ne*ne);return new _e(y-Ee/me,E+Xe/me)}},{key:"perpendicularBisector",value:function(r,a){var u=a.x-r.x,y=a.y-r.y,E=new Jo(r.x+u/2,r.y+y/2,1),M=new Jo(r.x-y+u/2,r.y+u+y/2,1);return new Jo(E,M)}},{key:"angleBisector",value:function(r,a,u){var y=a.distance(r),E=y/(y+a.distance(u)),M=u.x-r.x,B=u.y-r.y;return new _e(r.x+E*M,r.y+E*B)}},{key:"area3D",value:function(r,a,u){var y=a.x-r.x,E=a.y-r.y,M=a.getZ()-r.getZ(),B=u.x-r.x,W=u.y-r.y,ne=u.getZ()-r.getZ(),me=E*ne-M*W,Ee=M*B-y*ne,Xe=y*W-E*B,ht=me*me+Ee*Ee+Xe*Xe,tt=Math.sqrt(ht)/2;return tt}},{key:"centroid",value:function(r,a,u){var y=(r.x+a.x+u.x)/3,E=(r.y+a.y+u.y)/3;return new _e(y,E)}},{key:"inCentre",value:function(r,a,u){var y=a.distance(u),E=r.distance(u),M=r.distance(a),B=y+E+M,W=(y*r.x+E*a.x+M*u.x)/B,ne=(y*r.y+E*a.y+M*u.y)/B;return new _e(W,ne)}}]),v}(),pl=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"addRingSide",value:function(r,a,u,y,E){if(a===0&&r.length=zi.MINIMUM_VALID_SIZE&&ei.isCCW(r)&&(M=E,B=y,u=Je.opposite(u));var W=this._curveBuilder.getRingCurve(r,u,a);this.addCurve(W,M,B)}},{key:"addRingBothSides",value:function(r,a){this.addRingSide(r,a,Je.LEFT,he.EXTERIOR,he.INTERIOR),this.addRingSide(r,a,Je.RIGHT,he.INTERIOR,he.EXTERIOR)}},{key:"addPoint",value:function(r){if(this._distance<=0)return null;var a=r.getCoordinates(),u=this._curveBuilder.getLineCurve(a,this._distance);this.addCurve(u,he.EXTERIOR,he.INTERIOR)}},{key:"addPolygon",value:function(r){var a=this._distance,u=Je.LEFT;this._distance<0&&(a=-this._distance,u=Je.RIGHT);var y=r.getExteriorRing(),E=wi.removeRepeatedPoints(y.getCoordinates());if(this._distance<0&&this.isErodedCompletely(y,this._distance)||this._distance<=0&&E.length<3)return null;this.addRingSide(E,a,u,he.EXTERIOR,he.INTERIOR);for(var M=0;M0&&this.isErodedCompletely(B,-this._distance)||this.addRingSide(W,a,Je.opposite(u),he.INTERIOR,he.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(r,a){var u=new Ni(r[0],r[1],r[2]),y=u.inCentre();return Sn.pointToSegment(y,u.p0,u.p1)E}},{key:"addCollection",value:function(r){for(var a=0;a=this._max)throw new Rt;var r=this._parent.getGeometryN(this._index++);return r instanceof Ht?(this._subcollectionIterator=new v(r),this._subcollectionIterator.next()):r}},{key:"remove",value:function(){throw new Ke(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Gl]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var r=arguments[0];this._parent=r,this._atStart=!0,this._index=0,this._max=r.getNumGeometries()}},{key:"isAtomic",value:function(r){return!(r instanceof Ht)}}]),v}(),qi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"locate",value:function(r){return v.locate(r,this._geom)}},{key:"interfaces_",get:function(){return[yi]}}],[{key:"constructor_",value:function(){this._geom=null;var r=arguments[0];this._geom=r}},{key:"locatePointInPolygon",value:function(r,a){if(a.isEmpty())return he.EXTERIOR;var u=a.getExteriorRing(),y=v.locatePointInRing(r,u);if(y!==he.INTERIOR)return y;for(var E=0;E=0;E--){var M=this._edgeList.get(E),B=M.getSym();y===null&&(y=B),u!==null&&B.setNext(u),u=M}y.setNext(u)}},{key:"computeDepths",value:function(){if(arguments.length===1){var u=arguments[0],y=this.findIndex(u),E=u.getDepth(Je.LEFT),M=u.getDepth(Je.RIGHT),B=this.computeDepths(y+1,this._edgeList.size(),E),W=this.computeDepths(0,y,B);if(W!==M)throw new ut("depth mismatch at "+u.getCoordinate())}else if(arguments.length===3){for(var ne=arguments[0],me=arguments[1],Ee=arguments[2],Xe=Ee,ht=ne;ht=0;B--){var W=this._resultAreaEdgeList.get(B),ne=W.getSym();switch(y===null&&W.getEdgeRing()===u&&(y=W),M){case this._SCANNING_FOR_INCOMING:if(ne.getEdgeRing()!==u)continue;E=ne,M=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(W.getEdgeRing()!==u)continue;E.setNextMin(W),M=this._SCANNING_FOR_INCOMING}}M===this._LINKING_TO_OUTGOING&&(et.isTrue(y!==null,"found null for first outgoing dirEdge"),et.isTrue(y.getEdgeRing()===u,"unable to link last incoming dirEdge"),E.setNextMin(y))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var u=0,y=this.iterator();y.hasNext();){var E=y.next();E.isInResult()&&u++}return u}if(arguments.length===1){for(var M=arguments[0],B=0,W=this.iterator();W.hasNext();){var ne=W.next();ne.getEdgeRing()===M&&B++}return B}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var u=he.NONE,y=this.iterator();y.hasNext();){var E=y.next(),M=E.getSym();if(!E.isLineEdge()){if(E.isInResult()){u=he.INTERIOR;break}if(M.isInResult()){u=he.EXTERIOR;break}}}if(u===he.NONE)return null;for(var B=u,W=this.iterator();W.hasNext();){var ne=W.next(),me=ne.getSym();ne.isLineEdge()?ne.getEdge().setCovered(B===he.INTERIOR):(ne.isInResult()&&(B=he.EXTERIOR),me.isInResult()&&(B=he.INTERIOR))}}},{key:"computeLabelling",value:function(u){re(I(a.prototype),"computeLabelling",this).call(this,u),this._label=new Qi(he.NONE);for(var y=this.iterator();y.hasNext();)for(var E=y.next().getEdge().getLabel(),M=0;M<2;M++){var B=E.getLocation(M);B!==he.INTERIOR&&B!==he.BOUNDARY||this._label.setLocation(M,he.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),a}(Ui),Wl=function(v){k(a,v);var r=Q(a);function a(){return c(this,a),r.call(this)}return _(a,[{key:"createNode",value:function(u){return new Go(u,new Qo)}}]),a}(xa),Sa=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compareTo",value:function(r){var a=r;return v.compareOriented(this._pts,this._orientation,a._pts,a._orientation)}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var r=arguments[0];this._pts=r,this._orientation=v.orientation(r)}},{key:"orientation",value:function(r){return wi.increasingDirection(r)===1}},{key:"compareOriented",value:function(r,a,u,y){for(var E=a?1:-1,M=y?1:-1,B=a?r.length:-1,W=y?u.length:-1,ne=a?0:r.length-1,me=y?0:u.length-1;;){var Ee=r[ne].compareTo(u[me]);if(Ee!==0)return Ee;var Xe=(ne+=E)===B,ht=(me+=M)===W;if(Xe&&!ht)return-1;if(!Xe&&ht)return 1;if(Xe&&ht)return 0}}}]),v}(),Ia=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"print",value:function(r){r.print("MULTILINESTRING ( ");for(var a=0;a0&&r.print(","),r.print("(");for(var y=u.getCoordinates(),E=0;E0&&r.print(","),r.print(y[E].x+" "+y[E].y);r.println(")")}r.print(") ")}},{key:"addAll",value:function(r){for(var a=r.iterator();a.hasNext();)this.add(a.next())}},{key:"findEdgeIndex",value:function(r){for(var a=0;ar?1:this.dista?1:0}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var r=arguments[0],a=arguments[1],u=arguments[2];this.coord=new _e(r),this.segmentIndex=a,this.dist=u}}]),v}(),ws=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"print",value:function(r){r.println("Intersections:");for(var a=this.iterator();a.hasNext();)a.next().print(r)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(r){this.addEndpoints();for(var a=this.iterator(),u=a.next();a.hasNext();){var y=a.next(),E=this.createSplitEdge(u,y);r.add(E),u=y}}},{key:"addEndpoints",value:function(){var r=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[r],r,0)}},{key:"createSplitEdge",value:function(r,a){var u=a.segmentIndex-r.segmentIndex+2,y=this.edge.pts[a.segmentIndex],E=a.dist>0||!a.coord.equals2D(y);E||u--;var M=new Array(u).fill(null),B=0;M[B++]=new _e(r.coord);for(var W=r.segmentIndex+1;W<=a.segmentIndex;W++)M[B++]=this.edge.pts[W];return E&&(M[B]=a.coord),new ks(M,new Qi(this.edge._label))}},{key:"add",value:function(r,a,u){var y=new gl(r,a,u),E=this._nodeMap.get(y);return E!==null?E:(this._nodeMap.put(y,y),y)}},{key:"isIntersection",value:function(r){for(var a=this.iterator();a.hasNext();)if(a.next().coord.equals(r))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Zo,this.edge=null;var r=arguments[0];this.edge=r}}]),v}(),Us=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])||v.isTrue(this._matrix[he.INTERIOR][he.BOUNDARY])||v.isTrue(this._matrix[he.BOUNDARY][he.INTERIOR])||v.isTrue(this._matrix[he.BOUNDARY][he.BOUNDARY]))&&this._matrix[he.EXTERIOR][he.INTERIOR]===$.FALSE&&this._matrix[he.EXTERIOR][he.BOUNDARY]===$.FALSE}},{key:"isCoveredBy",value:function(){return(v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])||v.isTrue(this._matrix[he.INTERIOR][he.BOUNDARY])||v.isTrue(this._matrix[he.BOUNDARY][he.INTERIOR])||v.isTrue(this._matrix[he.BOUNDARY][he.BOUNDARY]))&&this._matrix[he.INTERIOR][he.EXTERIOR]===$.FALSE&&this._matrix[he.BOUNDARY][he.EXTERIOR]===$.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var r=arguments[0],a=0;a=0&&a>=0&&this.setAtLeast(r,a,u)}},{key:"isWithin",value:function(){return v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&this._matrix[he.INTERIOR][he.EXTERIOR]===$.FALSE&&this._matrix[he.BOUNDARY][he.EXTERIOR]===$.FALSE}},{key:"isTouches",value:function(r,a){return r>a?this.isTouches(a,r):(r===$.A&&a===$.A||r===$.L&&a===$.L||r===$.L&&a===$.A||r===$.P&&a===$.A||r===$.P&&a===$.L)&&this._matrix[he.INTERIOR][he.INTERIOR]===$.FALSE&&(v.isTrue(this._matrix[he.INTERIOR][he.BOUNDARY])||v.isTrue(this._matrix[he.BOUNDARY][he.INTERIOR])||v.isTrue(this._matrix[he.BOUNDARY][he.BOUNDARY]))}},{key:"isOverlaps",value:function(r,a){return r===$.P&&a===$.P||r===$.A&&a===$.A?v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&v.isTrue(this._matrix[he.INTERIOR][he.EXTERIOR])&&v.isTrue(this._matrix[he.EXTERIOR][he.INTERIOR]):r===$.L&&a===$.L&&this._matrix[he.INTERIOR][he.INTERIOR]===1&&v.isTrue(this._matrix[he.INTERIOR][he.EXTERIOR])&&v.isTrue(this._matrix[he.EXTERIOR][he.INTERIOR])}},{key:"isEquals",value:function(r,a){return r===a&&v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&this._matrix[he.INTERIOR][he.EXTERIOR]===$.FALSE&&this._matrix[he.BOUNDARY][he.EXTERIOR]===$.FALSE&&this._matrix[he.EXTERIOR][he.INTERIOR]===$.FALSE&&this._matrix[he.EXTERIOR][he.BOUNDARY]===$.FALSE}},{key:"toString",value:function(){for(var r=new ki("123456789"),a=0;a<3;a++)for(var u=0;u<3;u++)r.setCharAt(3*a+u,$.toDimensionSymbol(this._matrix[a][u]));return r.toString()}},{key:"setAll",value:function(r){for(var a=0;a<3;a++)for(var u=0;u<3;u++)this._matrix[a][u]=r}},{key:"get",value:function(r,a){return this._matrix[r][a]}},{key:"transpose",value:function(){var r=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=r,r=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=r,r=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=r,this}},{key:"matches",value:function(r){if(r.length!==9)throw new ze("Should be length 9: "+r);for(var a=0;a<3;a++)for(var u=0;u<3;u++)if(!v.matches(this._matrix[a][u],r.charAt(3*a+u)))return!1;return!0}},{key:"add",value:function(r){for(var a=0;a<3;a++)for(var u=0;u<3;u++)this.setAtLeast(a,u,r.get(a,u))}},{key:"isDisjoint",value:function(){return this._matrix[he.INTERIOR][he.INTERIOR]===$.FALSE&&this._matrix[he.INTERIOR][he.BOUNDARY]===$.FALSE&&this._matrix[he.BOUNDARY][he.INTERIOR]===$.FALSE&&this._matrix[he.BOUNDARY][he.BOUNDARY]===$.FALSE}},{key:"isCrosses",value:function(r,a){return r===$.P&&a===$.L||r===$.P&&a===$.A||r===$.L&&a===$.A?v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&v.isTrue(this._matrix[he.INTERIOR][he.EXTERIOR]):r===$.L&&a===$.P||r===$.A&&a===$.P||r===$.A&&a===$.L?v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&v.isTrue(this._matrix[he.EXTERIOR][he.INTERIOR]):r===$.L&&a===$.L&&this._matrix[he.INTERIOR][he.INTERIOR]===0}},{key:"interfaces_",get:function(){return[je]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll($.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var r=arguments[0];v.constructor_.call(this),this.set(r)}else if(arguments[0]instanceof v){var a=arguments[0];v.constructor_.call(this),this._matrix[he.INTERIOR][he.INTERIOR]=a._matrix[he.INTERIOR][he.INTERIOR],this._matrix[he.INTERIOR][he.BOUNDARY]=a._matrix[he.INTERIOR][he.BOUNDARY],this._matrix[he.INTERIOR][he.EXTERIOR]=a._matrix[he.INTERIOR][he.EXTERIOR],this._matrix[he.BOUNDARY][he.INTERIOR]=a._matrix[he.BOUNDARY][he.INTERIOR],this._matrix[he.BOUNDARY][he.BOUNDARY]=a._matrix[he.BOUNDARY][he.BOUNDARY],this._matrix[he.BOUNDARY][he.EXTERIOR]=a._matrix[he.BOUNDARY][he.EXTERIOR],this._matrix[he.EXTERIOR][he.INTERIOR]=a._matrix[he.EXTERIOR][he.INTERIOR],this._matrix[he.EXTERIOR][he.BOUNDARY]=a._matrix[he.EXTERIOR][he.BOUNDARY],this._matrix[he.EXTERIOR][he.EXTERIOR]=a._matrix[he.EXTERIOR][he.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var r=arguments[0],a=arguments[1];return a===$.SYM_DONTCARE||a===$.SYM_TRUE&&(r>=0||r===$.TRUE)||a===$.SYM_FALSE&&r===$.FALSE||a===$.SYM_P&&r===$.P||a===$.SYM_L&&r===$.L||a===$.SYM_A&&r===$.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var u=arguments[0],y=arguments[1],E=new v(u);return E.matches(y)}}},{key:"isTrue",value:function(r){return r>=0||r===$.TRUE}}]),v}(),pr=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(r){return r===null||r.length===0?null:(this.ensureCapacity(this._size+r.length),cn.arraycopy(r,0,this._data,this._size,r.length),void(this._size+=r.length))}},{key:"ensureCapacity",value:function(r){if(r<=this._data.length)return null;var a=Math.max(r,2*this._data.length);this._data=Fe.copyOf(this._data,a)}},{key:"toArray",value:function(){var r=new Array(this._size).fill(null);return cn.arraycopy(this._data,0,r,0,this._size),r}},{key:"add",value:function(r){this.ensureCapacity(this._size+1),this._data[this._size]=r,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)v.constructor_.call(this,10);else if(arguments.length===1){var r=arguments[0];this._data=new Array(r).fill(null)}}}]),v}(),yl=function(){function v(){c(this,v)}return _(v,[{key:"getChainStartIndices",value:function(r){var a=0,u=new pr(Math.trunc(r.length/2));u.add(a);do{var y=this.findChainEnd(r,a);u.add(y),a=y}while(au?a:u}},{key:"getMinX",value:function(r){var a=this.pts[this.startIndex[r]].x,u=this.pts[this.startIndex[r+1]].x;return aa&&(y=1),this._depth[r][u]=y}}}},{key:"getDelta",value:function(r){return this._depth[r][Je.RIGHT]-this._depth[r][Je.LEFT]}},{key:"getLocation",value:function(r,a){return this._depth[r][a]<=0?he.EXTERIOR:he.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var r=arguments[0],a=0;a<2;a++)for(var u=1;u<3;u++){var y=r.getLocation(a,u);y!==he.EXTERIOR&&y!==he.INTERIOR||(this.isNull(a,u)?this._depth[a][u]=v.depthAtLocation(y):this._depth[a][u]+=v.depthAtLocation(y))}else if(arguments.length===3){var E=arguments[0],M=arguments[1],B=arguments[2];B===he.INTERIOR&&this._depth[E][M]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var r=0;r<2;r++)for(var a=0;a<3;a++)this._depth[r][a]=v.NULL_VALUE}},{key:"depthAtLocation",value:function(r){return r===he.EXTERIOR?0:r===he.INTERIOR?1:v.NULL_VALUE}}]),v}();Ca.NULL_VALUE=-1;var ks=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var u=new Array(2).fill(null);return u[0]=this.pts[0],u[1]=this.pts[1],new a(u,Qi.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(u){this._isIsolated=u}},{key:"setName",value:function(u){this._name=u}},{key:"equals",value:function(u){if(!(u instanceof a))return!1;var y=u;if(this.pts.length!==y.pts.length)return!1;for(var E=!0,M=!0,B=this.pts.length,W=0;W0?this.pts[0]:null;if(arguments.length===1){var u=arguments[0];return this.pts[u]}}},{key:"print",value:function(u){u.print("edge "+this._name+": "),u.print("LINESTRING (");for(var y=0;y0&&u.print(","),u.print(this.pts[y].x+" "+this.pts[y].y);u.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(u){a.updateIM(this._label,u)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(u){u.print("edge "+this._name+": ");for(var y=this.pts.length-1;y>=0;y--)u.print(this.pts[y]+" ");u.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Ta(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new Kt;for(var u=0;u0&&u.append(","),u.append(this.pts[y].x+" "+this.pts[y].y);return u.append(") "+this._label+" "+this._depthDelta),u.toString()}},{key:"isPointwiseEqual",value:function(u){if(this.pts.length!==u.pts.length)return!1;for(var y=0;yy||this._maxyM;if(B)return!1;var W=this.intersectsToleranceSquare(r,a);return et.isTrue(!(B&&W),"Found bad envelope test"),W}},{key:"initCorners",value:function(r){var a=.5;this._minx=r.x-a,this._maxx=r.x+a,this._miny=r.y-a,this._maxy=r.y+a,this._corner[0]=new _e(this._maxx,this._maxy),this._corner[1]=new _e(this._minx,this._maxy),this._corner[2]=new _e(this._minx,this._miny),this._corner[3]=new _e(this._maxx,this._miny)}},{key:"intersects",value:function(r,a){return this._scaleFactor===1?this.intersectsScaled(r,a):(this.copyScaled(r,this._p0Scaled),this.copyScaled(a,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(r){return Math.round(r*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(r,a){a.x=this.scale(r.x),a.y=this.scale(r.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var r=v.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Kt(this._originalPt.x-r,this._originalPt.x+r,this._originalPt.y-r,this._originalPt.y+r)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(r,a){return this._li.computeIntersection(r,a,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,a,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,a,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,a,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(r,a){var u=!1,y=!1;return this._li.computeIntersection(r,a,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(r,a,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(u=!0),this._li.computeIntersection(r,a,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(y=!0),this._li.computeIntersection(r,a,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!u||!y)||!!r.equals(this._pt)||!!a.equals(this._pt))))}},{key:"addSnappedNode",value:function(r,a){var u=r.getCoordinate(a),y=r.getCoordinate(a+1);return!!this.intersects(u,y)&&(r.addIntersection(this.getCoordinate(),a),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var r=arguments[0],a=arguments[1],u=arguments[2];if(this._originalPt=r,this._pt=r,this._scaleFactor=a,this._li=u,a<=0)throw new ze("Scale factor must be non-zero");a!==1&&(this._pt=new _e(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new _e,this._p1Scaled=new _e),this.initCorners(this._pt)}}]),v}();ho.SAFE_ENV_EXPANSION_FACTOR=.75;var Xl=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"select",value:function(){if(arguments.length!==1&&arguments.length===2){var r=arguments[0],a=arguments[1];r.getLineSegment(a,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new En}}]),v}(),Vs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"snap",value:function(){if(arguments.length===1){var r=arguments[0];return this.snap(r,null,-1)}if(arguments.length===3){var a=arguments[0],u=arguments[1],y=arguments[2],E=a.getSafeEnvelope(),M=new Ss(a,u,y);return this._index.query(E,new(function(){function B(){c(this,B)}return _(B,[{key:"interfaces_",get:function(){return[al]}},{key:"visitItem",value:function(W){W.select(E,M)}}]),B}())),M.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var r=arguments[0];this._index=r}}]),v}(),Ss=function(v){k(a,v);var r=Q(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof Yo))return re(I(a.prototype),"select",this).apply(this,arguments);var u=arguments[0],y=arguments[1],E=u.getContext();if(this._parentEdge===E&&(y===this._hotPixelVertexIndex||y+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(E,y)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var u=arguments[0],y=arguments[1],E=arguments[2];this._hotPixel=u,this._parentEdge=y,this._hotPixelVertexIndex=E}}]),a}(Xl);Vs.HotPixelSnapAction=Ss;var _l=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"processIntersections",value:function(r,a,u,y){if(r===u&&a===y)return null;var E=r.getCoordinates()[a],M=r.getCoordinates()[a+1],B=u.getCoordinates()[y],W=u.getCoordinates()[y+1];if(this._li.computeIntersection(E,M,B,W),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var ne=0;ne=0;r--){try{this.bufferReducedPrecision(r)}catch(E){if(!(E instanceof ut))throw E;this._saveException=E}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],u=v.precisionScaleFactor(this._argGeom,this._distance,a),y=new on(u);this.bufferFixedPrecision(y)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var r=this._argGeom.getFactory().getPrecisionModel();r.getType()===on.FIXED?this.bufferFixedPrecision(r):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(r){this._bufParams.setQuadrantSegments(r)}},{key:"bufferOriginalPrecision",value:function(){try{var r=new ea(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(a){if(!(a instanceof jt))throw a;this._saveException=a}}},{key:"getResultGeometry",value:function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(r){this._bufParams.setEndCapStyle(r)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new ke,this._resultGeometry=null,this._saveException=null,arguments.length===1){var r=arguments[0];this._argGeom=r}else if(arguments.length===2){var a=arguments[0],u=arguments[1];this._argGeom=a,this._bufParams=u}}},{key:"bufferOp",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1],u=new v(r),y=u.getResultGeometry(a);return y}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof _t&&typeof arguments[1]=="number"){var E=arguments[0],M=arguments[1],B=arguments[2],W=new v(E);W.setQuadrantSegments(B);var ne=W.getResultGeometry(M);return ne}if(arguments[2]instanceof ke&&arguments[0]instanceof _t&&typeof arguments[1]=="number"){var me=arguments[0],Ee=arguments[1],Xe=arguments[2],ht=new v(me,Xe),tt=ht.getResultGeometry(Ee);return tt}}else if(arguments.length===4){var Yt=arguments[0],ni=arguments[1],ci=arguments[2],Ci=arguments[3],Ri=new v(Yt);Ri.setQuadrantSegments(ci),Ri.setEndCapStyle(Ci);var bn=Ri.getResultGeometry(ni);return bn}}},{key:"precisionScaleFactor",value:function(r,a,u){var y=r.getEnvelopeInternal(),E=ur.max(Math.abs(y.getMaxX()),Math.abs(y.getMaxY()),Math.abs(y.getMinX()),Math.abs(y.getMinY()))+2*(a>0?a:0),M=u-Math.trunc(Math.log(E)/Math.log(10)+1);return Math.pow(10,M)}}]),v}();_i.CAP_ROUND=ke.CAP_ROUND,_i.CAP_BUTT=ke.CAP_FLAT,_i.CAP_FLAT=ke.CAP_FLAT,_i.CAP_SQUARE=ke.CAP_SQUARE,_i.MAX_PRECISION_DIGITS=12;var ta=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],vl=function(){function v(r){c(this,v),this.geometryFactory=r||new Vr}return _(v,[{key:"read",value:function(r){var a,u=(a=typeof r=="string"?JSON.parse(r):r).type;if(!mr[u])throw new Error("Unknown GeoJSON type: "+a.type);return ta.indexOf(u)!==-1?mr[u].call(this,a.coordinates):u==="GeometryCollection"?mr[u].call(this,a.geometries):mr[u].call(this,a)}},{key:"write",value:function(r){var a=r.getGeometryType();if(!On[a])throw new Error("Geometry is not supported");return On[a].call(this,r)}}]),v}(),mr={Feature:function(v){var r={};for(var a in v)r[a]=v[a];if(v.geometry){var u=v.geometry.type;if(!mr[u])throw new Error("Unknown GeoJSON type: "+v.type);r.geometry=this.read(v.geometry)}return v.bbox&&(r.bbox=mr.bbox.call(this,v.bbox)),r},FeatureCollection:function(v){var r={};if(v.features){r.features=[];for(var a=0;a1?0:s<-1?Di:Math.acos(s)}function Nl(s){return s>1?To:s<-1?-To:Math.asin(s)}function Fc(){}function Tf(s,o){s&&av.hasOwnProperty(s.type)&&av[s.type](s,o)}var ov={Feature:function(s,o){Tf(s.geometry,o)},FeatureCollection:function(s,o){for(var c=s.features,d=-1,_=c.length;++d<_;)Tf(c[d].geometry,o)}},av={Sphere:function(s,o){o.sphere()},Point:function(s,o){s=s.coordinates,o.point(s[0],s[1],s[2])},MultiPoint:function(s,o){for(var c=s.coordinates,d=-1,_=c.length;++d<_;)s=c[d],o.point(s[0],s[1],s[2])},LineString:function(s,o){Op(s.coordinates,o,0)},MultiLineString:function(s,o){for(var c=s.coordinates,d=-1,_=c.length;++d<_;)Op(c[d],o,0)},Polygon:function(s,o){lv(s.coordinates,o)},MultiPolygon:function(s,o){for(var c=s.coordinates,d=-1,_=c.length;++d<_;)lv(c[d],o)},GeometryCollection:function(s,o){for(var c=s.geometries,d=-1,_=c.length;++d<_;)Tf(c[d],o)}};function Op(s,o,c){var d=-1,_=s.length-c,k;for(o.lineStart();++d<_;)k=s[d],o.point(k[0],k[1],k[2]);o.lineEnd()}function lv(s,o){var c=-1,d=s.length;for(o.polygonStart();++cDi?s-Do:s<-Di?s+Do:s,o]}jp.invert=jp;function VC(s,o,c){return(s%=Do)?o||c?T1(cv(s),hv(o,c)):cv(s):o||c?hv(o,c):jp}function uv(s){return function(o,c){return o+=s,[o>Di?o-Do:o<-Di?o+Do:o,c]}}function cv(s){var o=uv(s);return o.invert=uv(-s),o}function hv(s,o){var c=vn(s),d=xn(s),_=vn(o),k=xn(o);function I(f,D){var F=vn(D),j=vn(f)*F,N=xn(f)*F,V=xn(D),Q=V*c+j*d;return[Lu(N*_-Q*k,j*c-V*d),Nl(Q*_+N*k)]}return I.invert=function(f,D){var F=vn(D),j=vn(f)*F,N=xn(f)*F,V=xn(D),Q=V*_-N*k;return[Lu(N*_+V*k,j*c+Q*d),Nl(Q*c-j*d)]},I}function qC(s,o,c,d,_,k){if(c){var I=vn(o),f=xn(o),D=d*c;_==null?(_=o+d*Do,k=o-D/2):(_=fv(I,_),k=fv(I,k),(d>0?_k)&&(_+=d*Do));for(var F,j=_;d>0?j>k:j1&&s.push(s.pop().concat(s.shift()))},result:function(){var c=s;return s=[],o=null,c}}}function GC(s,o,c,d,_,k){var I=s[0],f=s[1],D=o[0],F=o[1],j=0,N=1,V=D-I,Q=F-f,re;if(re=c-I,!(!V&&re>0)){if(re/=V,V<0){if(re0){if(re>N)return;re>j&&(j=re)}if(re=_-I,!(!V&&re<0)){if(re/=V,V<0){if(re>N)return;re>j&&(j=re)}else if(V>0){if(re0)){if(re/=Q,Q<0){if(re0){if(re>N)return;re>j&&(j=re)}if(re=k-f,!(!Q&&re<0)){if(re/=Q,Q<0){if(re>N)return;re>j&&(j=re)}else if(Q>0){if(re0&&(s[0]=I+j*V,s[1]=f+j*Q),N<1&&(o[0]=I+N*V,o[1]=f+N*Q),!0}}}}}function sf(s,o){return lr(s[0]-o[0])=0;--f)_.point((N=j[f])[0],N[1]);else d(V.x,V.p.x,-1,_);V=V.p}V=V.o,j=V.z,Q=!Q}while(!V.v);_.lineEnd()}}}function dv(s){if(o=s.length){for(var o,c=0,d=s[0],_;++co?1:s>=o?0:NaN}function ZC(s){return s.length===1&&(s=WC(s)),{left:function(o,c,d,_){for(d==null&&(d=0),_==null&&(_=o.length);d<_;){var k=d+_>>>1;s(o[k],c)<0?d=k+1:_=k}return d},right:function(o,c,d,_){for(d==null&&(d=0),_==null&&(_=o.length);d<_;){var k=d+_>>>1;s(o[k],c)>0?_=k:d=k+1}return d}}}function WC(s){return function(o,c){return L1(s(o),c)}}ZC(L1);function A1(s){for(var o=s.length,c,d=-1,_=0,k,I;++d=0;)for(I=s[o],c=I.length;--c>=0;)k[--_]=I[c];return k}var Bc=1e9,Wh=-Bc;function XC(s,o,c,d){function _(F,j){return s<=F&&F<=c&&o<=j&&j<=d}function k(F,j,N,V){var Q=0,re=0;if(F==null||(Q=I(F,N))!==(re=I(j,N))||D(F,j)<0^N>0)do V.point(Q===0||Q===3?s:c,Q>1?d:o);while((Q=(Q+N+4)%4)!==re);else V.point(j[0],j[1])}function I(F,j){return lr(F[0]-s)0?0:3:lr(F[0]-c)0?2:1:lr(F[1]-o)0?1:0:j>0?3:2}function f(F,j){return D(F.x,j.x)}function D(F,j){var N=I(F,1),V=I(j,1);return N!==V?N-V:N===0?j[1]-F[1]:N===1?F[0]-j[0]:N===2?F[1]-j[1]:j[0]-F[0]}return function(F){var j=F,N=C1(),V,Q,re,Ae,xe,Te,Ce,ke,Re,ze,Oe,Ze={point:je,lineStart:Pt,lineEnd:st,polygonStart:pt,polygonEnd:Ie};function je(lt,Lt){_(lt,Lt)&&j.point(lt,Lt)}function He(){for(var lt=0,Lt=0,ct=Q.length;Ltd&&(et-jt)*(d-qt)>(Ot-qt)*(s-jt)&&++lt:Ot<=d&&(et-jt)*(d-qt)<(Ot-qt)*(s-jt)&&--lt;return lt}function pt(){j=N,V=[],Q=[],Oe=!0}function Ie(){var lt=He(),Lt=Oe&<,ct=(V=A1(V)).length;(Lt||ct)&&(F.polygonStart(),Lt&&(F.lineStart(),k(null,null,1,F),F.lineEnd()),ct&&P1(V,f,lt,k,F),F.polygonEnd()),j=F,V=Q=re=null}function Pt(){Ze.point=Ue,Q&&Q.push(re=[]),ze=!0,Re=!1,Ce=ke=NaN}function st(){V&&(Ue(Ae,xe),Te&&Re&&N.rejoin(),V.push(N.result())),Ze.point=je,Re&&j.lineEnd()}function Ue(lt,Lt){var ct=_(lt,Lt);if(Q&&re.push([lt,Lt]),ze)Ae=lt,xe=Lt,Te=ct,ze=!1,ct&&(j.lineStart(),j.point(lt,Lt));else if(ct&&Re)j.point(lt,Lt);else{var Qt=[Ce=Math.max(Wh,Math.min(Bc,Ce)),ke=Math.max(Wh,Math.min(Bc,ke))],ii=[lt=Math.max(Wh,Math.min(Bc,lt)),Lt=Math.max(Wh,Math.min(Bc,Lt))];GC(Qt,ii,s,o,c,d)?(Re||(j.lineStart(),j.point(Qt[0],Qt[1])),j.point(ii[0],ii[1]),ct||j.lineEnd(),Oe=!1):ct&&(j.lineStart(),j.point(lt,Lt),Oe=!1)}Ce=lt,ke=Lt,Re=ct}return Ze}}var rp=el();function HC(s,o){var c=o[0],d=o[1],_=[xn(c),-vn(c),0],k=0,I=0;rp.reset();for(var f=0,D=s.length;f=0?1:-1,je=Ze*Oe,He=je>Di,pt=re*Re;if(rp.add(Lu(pt*Ze*xn(je),Ae*ze+pt*vn(je))),k+=He?Oe+Ze*Do:Oe,He^V>=c^Ce>=c){var Ie=Cf(Au(N),Au(Te));Bp(Ie);var Pt=Cf(_,Ie);Bp(Pt);var st=(He^Oe>=0?-1:1)*Nl(Pt[2]);(d>st||d===st&&(Ie[0]||Ie[1]))&&(I+=He^Oe>=0?1:-1)}}return(k<-un||kQc&&(Qc=s),oLf&&(Lf=o)}el();function M1(s,o,c,d){return function(_,k){var I=o(k),f=_.invert(d[0],d[1]),D=C1(),F=o(D),j=!1,N,V,Q,re={point:Ae,lineStart:Te,lineEnd:Ce,polygonStart:function(){re.point=ke,re.lineStart=Re,re.lineEnd=ze,V=[],N=[]},polygonEnd:function(){re.point=Ae,re.lineStart=Te,re.lineEnd=Ce,V=A1(V);var Oe=HC(N,f);V.length?(j||(k.polygonStart(),j=!0),P1(V,JC,Oe,c,k)):Oe&&(j||(k.polygonStart(),j=!0),k.lineStart(),c(null,null,1,k),k.lineEnd()),j&&(k.polygonEnd(),j=!1),V=N=null},sphere:function(){k.polygonStart(),k.lineStart(),c(null,null,1,k),k.lineEnd(),k.polygonEnd()}};function Ae(Oe,Ze){var je=_(Oe,Ze);s(Oe=je[0],Ze=je[1])&&k.point(Oe,Ze)}function xe(Oe,Ze){var je=_(Oe,Ze);I.point(je[0],je[1])}function Te(){re.point=xe,I.lineStart()}function Ce(){re.point=Ae,I.lineEnd()}function ke(Oe,Ze){Q.push([Oe,Ze]);var je=_(Oe,Ze);F.point(je[0],je[1])}function Re(){F.lineStart(),Q=[]}function ze(){ke(Q[0][0],Q[0][1]),F.lineEnd();var Oe=F.clean(),Ze=D.result(),je,He=Ze.length,pt,Ie,Pt;if(Q.pop(),N.push(Q),Q=null,!!He){if(Oe&1){if(Ie=Ze[0],(pt=Ie.length-1)>0){for(j||(k.polygonStart(),j=!0),k.lineStart(),je=0;je1&&Oe&2&&Ze.push(Ze.pop().concat(Ze.shift())),V.push(Ze.filter(KC))}}return re}}function KC(s){return s.length>1}function JC(s,o){return((s=s.x)[0]<0?s[1]-To-un:To-s[1])-((o=o.x)[0]<0?o[1]-To-un:To-o[1])}const gv=M1(function(){return!0},QC,eP,[-Di,-To]);function QC(s){var o=NaN,c=NaN,d=NaN,_;return{lineStart:function(){s.lineStart(),_=1},point:function(k,I){var f=k>0?Di:-Di,D=lr(k-o);lr(D-Di)0?To:-To),s.point(d,c),s.lineEnd(),s.lineStart(),s.point(f,c),s.point(k,c),_=0):d!==f&&D>=Di&&(lr(o-d)un?jC((xn(o)*(k=vn(d))*xn(c)-xn(d)*(_=vn(o))*xn(s))/(_*k*I)):(o+d)/2}function eP(s,o,c,d){var _;if(s==null)_=c*To,d.point(-Di,_),d.point(0,_),d.point(Di,_),d.point(Di,0),d.point(Di,-_),d.point(0,-_),d.point(-Di,-_),d.point(-Di,0),d.point(-Di,_);else if(lr(s[0]-o[0])>un){var k=s[0]0,_=lr(c)>un;function k(j,N,V,Q){qC(Q,s,o,V,j,N)}function I(j,N){return vn(j)*vn(N)>c}function f(j){var N,V,Q,re,Ae;return{lineStart:function(){re=Q=!1,Ae=1},point:function(xe,Te){var Ce=[xe,Te],ke,Re=I(xe,Te),ze=d?Re?0:F(xe,Te):Re?F(xe+(xe<0?Di:-Di),Te):0;if(!N&&(re=Q=Re)&&j.lineStart(),Re!==Q&&(ke=D(N,Ce),(!ke||sf(N,ke)||sf(Ce,ke))&&(Ce[0]+=un,Ce[1]+=un,Re=I(Ce[0],Ce[1]))),Re!==Q)Ae=0,Re?(j.lineStart(),ke=D(Ce,N),j.point(ke[0],ke[1])):(ke=D(N,Ce),j.point(ke[0],ke[1]),j.lineEnd()),N=ke;else if(_&&N&&d^Re){var Oe;!(ze&V)&&(Oe=D(Ce,N,!0))&&(Ae=0,d?(j.lineStart(),j.point(Oe[0][0],Oe[0][1]),j.point(Oe[1][0],Oe[1][1]),j.lineEnd()):(j.point(Oe[1][0],Oe[1][1]),j.lineEnd(),j.lineStart(),j.point(Oe[0][0],Oe[0][1])))}Re&&(!N||!sf(N,Ce))&&j.point(Ce[0],Ce[1]),N=Ce,Q=Re,V=ze},lineEnd:function(){Q&&j.lineEnd(),N=null},clean:function(){return Ae|(re&&Q)<<1}}}function D(j,N,V){var Q=Au(j),re=Au(N),Ae=[1,0,0],xe=Cf(Q,re),Te=qh(xe,xe),Ce=xe[0],ke=Te-Ce*Ce;if(!ke)return!V&&j;var Re=c*Te/ke,ze=-c*Ce/ke,Oe=Cf(Ae,xe),Ze=Gh(Ae,Re),je=Gh(xe,ze);np(Ze,je);var He=Oe,pt=qh(Ze,He),Ie=qh(He,He),Pt=pt*pt-Ie*(qh(Ze,Ze)-1);if(!(Pt<0)){var st=Nu(Pt),Ue=Gh(He,(-pt-st)/Ie);if(np(Ue,Ze),Ue=Fp(Ue),!V)return Ue;var lt=j[0],Lt=N[0],ct=j[1],Qt=N[1],ii;Lt0^Ue[1]<(lr(Ue[0]-lt)Di^(lt<=Ue[0]&&Ue[0]<=Lt)){var qt=Gh(He,(-pt+st)/Ie);return np(qt,Ze),[Ue,Fp(qt)]}}}function F(j,N){var V=d?s:Di-s,Q=0;return j<-V?Q|=1:j>V&&(Q|=2),N<-V?Q|=4:N>V&&(Q|=8),Q}return M1(I,f,k,d?[0,-s]:[-Di,s-Di])}function R1(s){return function(o){var c=new Up;for(var d in s)c[d]=s[d];return c.stream=o,c}}function Up(){}Up.prototype={constructor:Up,point:function(s,o){this.stream.point(s,o)},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 D1(s,o,c){var d=o[1][0]-o[0][0],_=o[1][1]-o[0][1],k=s.clipExtent&&s.clipExtent();s.scale(150).translate([0,0]),k!=null&&s.clipExtent(null),UC(c,s.stream(mv));var I=mv.result(),f=Math.min(d/(I[1][0]-I[0][0]),_/(I[1][1]-I[0][1])),D=+o[0][0]+(d-f*(I[1][0]+I[0][0]))/2,F=+o[0][1]+(_-f*(I[1][1]+I[0][1]))/2;return k!=null&&s.clipExtent(k),s.scale(f*150).translate([D,F])}function iP(s,o,c){return D1(s,[[0,0],o],c)}var yv=16,nP=vn(30*As);function _v(s,o){return+o?sP(s,o):rP(s)}function rP(s){return R1({point:function(o,c){o=s(o,c),this.stream.point(o[0],o[1])}})}function sP(s,o){function c(d,_,k,I,f,D,F,j,N,V,Q,re,Ae,xe){var Te=F-d,Ce=j-_,ke=Te*Te+Ce*Ce;if(ke>4*o&&Ae--){var Re=I+V,ze=f+Q,Oe=D+re,Ze=Nu(Re*Re+ze*ze+Oe*Oe),je=Nl(Oe/=Ze),He=lr(lr(Oe)-1)o||lr((Te*st+Ce*Ue)/ke-.5)>.3||I*V+f*Q+D*re2?Ue[2]%360*As:0,Pt()):[F*Ga,j*Ga,N*Ga]},He.precision=function(Ue){return arguments.length?(Oe=_v(Ie,ze=Ue*Ue),st()):Nu(ze)},He.fitExtent=function(Ue,lt){return D1(He,Ue,lt)},He.fitSize=function(Ue,lt){return iP(He,Ue,lt)};function Pt(){Q=T1(V=VC(F,j,N),o);var Ue=o(f,D);return k=d-Ue[0]*c,I=_+Ue[1]*c,st()}function st(){return Ze=je=null,He}return function(){return o=s.apply(this,arguments),He.invert=o.invert&&pt,Pt()}}function z1(s){return function(o,c){var d=vn(o),_=vn(c),k=s(d*_);return[k*_*xn(o),k*xn(c)]}}function N1(s){return function(o,c){var d=Nu(o*o+c*c),_=s(d),k=xn(_),I=vn(_);return[Lu(o*k,d*I),Nl(d&&c*k/d)]}}var uP=z1(function(s){return Nu(2/(1+s))});uP.invert=N1(function(s){return 2*Nl(s/2)});var O1=z1(function(s){return(s=E1(s))&&s/xn(s)});O1.invert=N1(function(s){return s});function cP(){return aP(O1).scale(79.4188).clipAngle(180-.001)}function vv(s,o){return[s,o]}vv.invert=vv;var hP=Object.defineProperty,Ou=(s,o)=>hP(s,"name",{value:o,configurable:!0}),{BufferOp:fP,GeoJSONReader:dP,GeoJSONWriter:pP}=BC;function mP(s,o,c){c=c||{};var d=c.units||"kilometers",_=c.steps||8;if(!s)throw new Error("geojson is required");if(typeof c!="object")throw new Error("options must be an object");if(typeof _!="number")throw new Error("steps must be an number");if(o===void 0)throw new Error("radius is required");if(_<=0)throw new Error("steps must be greater than 0");var k=[];switch(s.type){case"GeometryCollection":return jl(s,function(I){var f=Zc(I,o,d,_);f&&k.push(f)}),Ka(k);case"FeatureCollection":return If(s,function(I){var f=Zc(I,o,d,_);f&&If(f,function(D){D&&k.push(D)})}),Ka(k)}return Zc(s,o,d,_)}Ou(mP,"buffer");function Zc(s,o,c,d){var _=s.properties||{},k=s.type==="Feature"?s.geometry:s;if(k.type==="GeometryCollection"){var I=[];return jl(s,function(Ae){var xe=Zc(Ae,o,c,d);xe&&I.push(xe)}),Ka(I)}var f=F1(k),D={type:k.type,coordinates:mm(k.coordinates,f)},F=new dP,j=F.read(D),N=hm(Ff(o,c),"meters"),V=fP.bufferOp(j,N,d),Q=new pP;if(V=Q.write(V),!pm(V.coordinates)){var re={type:V.type,coordinates:gm(V.coordinates,f)};return eo(re,_)}}Ou(Zc,"bufferFeature");function pm(s){return Array.isArray(s[0])?pm(s[0]):isNaN(s[0])}Ou(pm,"coordsIsNaN");function mm(s,o){return typeof s[0]!="object"?o(s):s.map(function(c){return mm(c,o)})}Ou(mm,"projectCoords");function gm(s,o){return typeof s[0]!="object"?o.invert(s):s.map(function(c){return gm(c,o)})}Ou(gm,"unprojectCoords");function F1(s){var o=S1(s).geometry.coordinates,c=[-o[0],-o[1]];return cP().rotate(c).scale(Hr)}Ou(F1,"defineProjection");var gP=Object.defineProperty,yP=(s,o)=>gP(s,"name",{value:o,configurable:!0});function _P(s){const o=[];if(jl(s,_=>{o.push(_.coordinates)}),o.length<2)throw new Error("Must have at least two features");const c=s.features[0].properties||{},d=v1.difference(o[0],...o.slice(1));return d.length===0?null:d.length===1?nh(d[0],c):Of(d,c)}yP(_P,"difference");Ka([]);const vP=[{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"}],xP={decimalLatitude:40.123,decimalLongitude:-74.123},bP=[{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}],wP=[{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},{verbatimCoordinates:"53 16.3863,4 52.8171",verbatimLatitude:"53 16.3863",verbatimLongitude:"4 52.8171",decimalLatitude:53.273105,decimalLongitude:4.88029},{verbatimCoordinates:"50 8.2914,-5 2.4447",verbatimLatitude:"50 8.2914",verbatimLongitude:"-5 2.4447",decimalLatitude:50.13819,decimalLongitude:-5.040745},{verbatimCoordinates:"N 48° 30,6410', E 18° 57,4583'",verbatimLatitude:"N 48° 30,6410'",verbatimLongitude:"E 18° 57,4583'",decimalLatitude:48.51068,decimalLongitude:18.95764},{verbatimCoordinates:"1.23456, 18.33453",verbatimLatitude:"1.23456",verbatimLongitude:"18.33453",decimalLatitude:1.23456,decimalLongitude:18.33453}];function kP(){const s=[];return vP.forEach(o=>{o.decimalLatitude?s.push(o):s.push({...o,...xP})}),[...s,...bP,...wP]}const SP=kP();SP.map(s=>s.verbatimCoordinates);function xv(s,o,c){let d=["match",s];for(let[_,k]of Object.entries(o))d.push(_),d.push(k);return d.push(c),d}const IP={scenario:"U",showRatings:{green:!0,amber:!0,red:!0},showClasses:{A:!0,B:!0,C:!0,Unclassified:!0},showDirections:{both:!0,"one-way":!0}},$s={green:"#006853",amber:"#ffd833",red:"#b73d25"},Af=["U","X","Y","Z"],bv=["red","amber","green"];function wv(s,o,c){const d=s.slice();return d[4]=o[c],d}function kv(s){let o,c=(s[3].properties.name||"Unnamed road")+"",d,_,k,I,f=s[3].properties.class+"",D,F,j,N,V,Q=s[3].properties.direction+"",re,Ae,xe,Te,Ce=s[3].properties.length+"",ke,Re,ze,Oe,Ze,je,He,pt=s[3].properties.road_average_width+"",Ie,Pt,st=s[3].properties.road_minimum_width+"",Ue,lt,Lt,ct,Qt,ii=s[3].properties.pavement_average_width+"",nt,Ft,jt,qt,et,Ot=Eo(Af),mt=[];for(let vt=0;vt({3:d}),({data:d})=>d?8:0]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&136&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function CP(s){let o,c;return o=new Zp({props:{sourceLayer:s[2],filter:Iv(s[1]),layout:{visibility:s[0]=="roads"?"visible":"none"},manageHoverState:!0,paint:{"line-width":of(5,10),"line-color":xv(["get",`rating_${s[1].scenario}`],$s,"black")},beforeId:"Road numbers",$$slots:{default:[TP]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,[_]){const k={};_&4&&(k.sourceLayer=d[2]),_&2&&(k.filter=Iv(d[1])),_&1&&(k.layout={visibility:d[0]=="roads"?"visible":"none"}),_&2&&(k.paint={"line-width":of(5,10),"line-color":xv(["get",`rating_${d[1].scenario}`],$s,"black")}),_&128&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function Iv(s){let o=Object.entries(s.showRatings).filter(_=>_[1]).map(_=>_[0]),c=Object.entries(s.showClasses).filter(_=>_[1]).map(_=>_[0]),d=Object.entries(s.showDirections).filter(_=>_[1]).map(_=>_[0]);return["all",["has","class"],["in",["get","class"],["literal",c]],["in",["get",`rating_${s.scenario}`],["literal",o]],["in",["get","direction"],["literal",d]]]}function PP(s,o,c){let{show:d}=o,{roadFilters:_}=o,{sourceLayer:k}=o;return s.$$set=I=>{"show"in I&&c(0,d=I.show),"roadFilters"in I&&c(1,_=I.roadFilters),"sourceLayer"in I&&c(2,k=I.sourceLayer)},[d,_,k]}class B1 extends qn{constructor(o){super(),Vn(this,o,PP,CP,gn,{show:0,roadFilters:1,sourceLayer:2})}}function Ev(s,o,c){const d=s.slice();return d[3]=o[c],d}function Tv(s,o,c){const d=s.slice();d[6]=o[c];const _=d[2].properties[`counts_${d[3]}_${d[6]}`];d[7]=_;const k=d[2].properties[`lengths_${d[3]}_${d[6]}`];return d[8]=k,d}function Cv(s){let o,c=s[2].properties.name+"",d,_,k,I,f,D,F,j,N,V,Q,re,Ae=Eo(Af),xe=[];for(let Te=0;Te({2:d}),({data:d})=>d?4:0]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&2052&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function MP(s){let o,c,d,_;return o=new Qv({props:{filter:["all",["has","name"],["in",s[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]],layout:{visibility:s[0].endsWith("-summary")?"visible":"none"},manageHoverState:!0,paint:{"fill-color":"cyan","fill-opacity":of(.2,.8)},beforeId:"Road numbers",$$slots:{default:[AP]},$$scope:{ctx:s}}}),d=new Zp({props:{filter:["all",["has","name"],["in",s[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]],layout:{visibility:s[0].endsWith("-summary")?"visible":"none"},paint:{"line-width":5,"line-color":"black"}}}),{c(){rn(o.$$.fragment),c=Vt(),rn(d.$$.fragment)},m(k,I){Wi(o,k,I),Tt(k,c,I),Wi(d,k,I),_=!0},p(k,I){const f={};I&1&&(f.filter=["all",["has","name"],["in",k[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]]),I&1&&(f.layout={visibility:k[0].endsWith("-summary")?"visible":"none"}),I&2048&&(f.$$scope={dirty:I,ctx:k}),o.$set(f);const D={};I&1&&(D.filter=["all",["has","name"],["in",k[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]]),I&1&&(D.layout={visibility:k[0].endsWith("-summary")?"visible":"none"}),d.$set(D)},i(k){_||(Dt(o.$$.fragment,k),Dt(d.$$.fragment,k),_=!0)},o(k){Xt(o.$$.fragment,k),Xt(d.$$.fragment,k),_=!1},d(k){k&&St(c),Xi(o,k),Xi(d,k)}}}function RP(s){let o,c;return o=new Gp({props:{data:s[1],generateId:!0,$$slots:{default:[MP]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,[_]){const k={};_&2&&(k.data=d[1]),_&2049&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function DP(s,o,c){let{show:d}=o,{url:_}=o;return s.$$set=k=>{"show"in k&&c(0,d=k.show),"url"in k&&c(1,_=k.url)},[d,_]}class zP extends qn{constructor(o){super(),Vn(this,o,DP,RP,gn,{show:0,url:1})}}function Av(s,o,c){const d=s.slice();return d[11]=o[c],d[12]=o,d[13]=c,d}function Mv(s,o,c){const d=s.slice();return d[14]=o[c][0],d[15]=o[c][1],d}function Rv(s){let o,c,d,_=s[14]+"",k,I,f=s[15]+"",D,F,j,N,V;return j=Vv(s[4][0]),{c(){o=gt("label"),c=gt("input"),d=Vt(),k=di(_),I=di(": "),D=di(f),F=Vt(),Ln(c,"type","radio"),c.__value=s[14],Nc(c,c.__value),j.p(c)},m(Q,re){Tt(Q,o,re),We(o,c),c.checked=c.__value===s[0].scenario,We(o,d),We(o,k),We(o,I),We(o,D),We(o,F),N||(V=xr(c,"change",s[3]),N=!0)},p(Q,re){re&1&&(c.checked=c.__value===Q[0].scenario)},d(Q){Q&&St(o),j.r(),N=!1,V()}}}function Dv(s){let o,c,d,_=s[11]+"",k,I,f,D;function F(){s[8].call(c,s[11])}return{c(){o=gt("label"),c=gt("input"),d=Vt(),k=di(_),I=Vt(),Ln(c,"type","checkbox")},m(j,N){Tt(j,o,N),We(o,c),c.checked=s[0].showClasses[s[11]],We(o,d),We(o,k),We(o,I),f||(D=xr(c,"change",F),f=!0)},p(j,N){s=j,N&3&&(c.checked=s[0].showClasses[s[11]])},d(j){j&&St(o),f=!1,D()}}}function NP(s){let o,c,d,_,k,I,f,D,F,j,N,V,Q,re,Ae,xe,Te,Ce,ke,Re,ze,Oe,Ze,je,He,pt,Ie,Pt,st,Ue,lt,Lt,ct,Qt,ii,nt=Eo(s[2]),Ft=[];for(let et=0;et{"filters"in re&&c(0,d=re.filters)},[d,_,k,f,I,D,F,j,N,V,Q]}class FP extends qn{constructor(o){super(),Vn(this,o,OP,NP,gn,{filters:0})}}function zv(s){let o,c=s[3].properties.GEO_ID+"",d,_,k,I,f=s[3].properties.aggregate_kerb_length.toLocaleString()+"",D,F,j,N,V,Q=s[3].properties.number_of_cars_and_vans.toLocaleString()+"",re,Ae,xe,Te,Ce=s[3].properties.kerb_length_per_car.toLocaleString()+"",ke,Re;return{c(){o=gt("h1"),d=di(c),_=Vt(),k=gt("p"),I=di("aggregate_kerb_length: "),D=di(f),F=di(` - meters`),j=Vt(),N=gt("p"),V=di("number_of_cars_and_vans: "),re=di(Q),Ae=Vt(),xe=gt("p"),Te=di("kerb_length_per_car: "),ke=di(Ce),Re=di(` - meters`)},m(ze,Oe){Tt(ze,o,Oe),We(o,d),Tt(ze,_,Oe),Tt(ze,k,Oe),We(k,I),We(k,D),We(k,F),Tt(ze,j,Oe),Tt(ze,N,Oe),We(N,V),We(N,re),Tt(ze,Ae,Oe),Tt(ze,xe,Oe),We(xe,Te),We(xe,ke),We(xe,Re)},p(ze,Oe){Oe&8&&c!==(c=ze[3].properties.GEO_ID+"")&&Ur(d,c),Oe&8&&f!==(f=ze[3].properties.aggregate_kerb_length.toLocaleString()+"")&&Ur(D,f),Oe&8&&Q!==(Q=ze[3].properties.number_of_cars_and_vans.toLocaleString()+"")&&Ur(re,Q),Oe&8&&Ce!==(Ce=ze[3].properties.kerb_length_per_car.toLocaleString()+"")&&Ur(ke,Ce)},d(ze){ze&&(St(o),St(_),St(k),St(j),St(N),St(Ae),St(xe))}}}function BP(s){var d;let o,c=((d=s[3])==null?void 0:d.properties)&&zv(s);return{c(){c&&c.c(),o=Yr()},m(_,k){c&&c.m(_,k),Tt(_,o,k)},p(_,k){var I;(I=_[3])!=null&&I.properties?c?c.p(_,k):(c=zv(_),c.c(),c.m(o.parentNode,o)):c&&(c.d(1),c=null)},d(_){_&&St(o),c&&c.d(_)}}}function jP(s){let o,c;return o=new Xp({props:{openOn:"hover",$$slots:{default:[BP,({data:d})=>({3:d}),({data:d})=>d?8:0]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&24&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function UP(s){let o,c,d,_;return o=new Qv({props:{layout:{visibility:s[0]=="census-area"?"visible":"none"},manageHoverState:!0,paint:{"fill-color":s[2],"fill-opacity":of(.6,.9)},beforeId:"Road numbers",$$slots:{default:[jP]},$$scope:{ctx:s}}}),d=new Zp({props:{layout:{visibility:s[0].endsWith("-area")?"visible":"none"},paint:{"line-width":2,"line-color":"black"}}}),{c(){rn(o.$$.fragment),c=Vt(),rn(d.$$.fragment)},m(k,I){Wi(o,k,I),Tt(k,c,I),Wi(d,k,I),_=!0},p(k,I){const f={};I&1&&(f.layout={visibility:k[0]=="census-area"?"visible":"none"}),I&16&&(f.$$scope={dirty:I,ctx:k}),o.$set(f);const D={};I&1&&(D.layout={visibility:k[0].endsWith("-area")?"visible":"none"}),d.$set(D)},i(k){_||(Dt(o.$$.fragment,k),Dt(d.$$.fragment,k),_=!0)},o(k){Xt(o.$$.fragment,k),Xt(d.$$.fragment,k),_=!1},d(k){k&&St(c),Xi(o,k),Xi(d,k)}}}function VP(s){let o,c;return o=new Gp({props:{data:s[1],generateId:!0,$$slots:{default:[UP]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,[_]){const k={};_&2&&(k.data=d[1]),_&17&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function qP(s,o,c){let{show:d}=o,{url:_}=o,k=["let","kerb_length_per_car_js",["/",["get","aggregate_kerb_length"],["get","number_of_cars_and_vans"]],["interpolate-hcl",["linear"],["var","kerb_length_per_car_js"],0,["to-color","#ff0000"],2.5,["to-color","#ff1111"],5,["to-color","#ff2222"],7.5,["to-color","#ff4444"],15,["to-color","#ffdddd"],20,["to-color","#ffffff"]]];return s.$$set=I=>{"show"in I&&c(0,d=I.show),"url"in I&&c(1,_=I.url)},[d,_,k]}class GP extends qn{constructor(o){super(),Vn(this,o,qP,VP,gn,{show:0,url:1})}}const ZP=s=>({dialog:s&1}),Nv=s=>({dialog:s[0]});function WP(s){let o,c,d,_,k;const I=s[4].default,f=Po(I,s,s[3],Nv);return{c(){o=gt("dialog"),c=gt("article"),f&&f.c(),o.open=!0},m(D,F){Tt(D,o,F),We(o,c),f&&f.m(c,null),s[6](o),d=!0,_||(k=[xr(window,"click",s[1]),xr(window,"keydown",s[2]),xr(o,"close",s[5])],_=!0)},p(D,[F]){f&&f.p&&(!d||F&9)&&Ao(f,I,D,D[3],d?Lo(I,D[3],F,ZP):Mo(D[3]),Nv)},i(D){d||(Dt(f,D),d=!0)},o(D){Xt(f,D),d=!1},d(D){D&&St(o),f&&f.d(D),s[6](null),_=!1,ma(k)}}}function XP(s,o,c){let{$$slots:d={},$$scope:_}=o,k;function I(j){k.open&&j.target==k&&k.close()}function f(j){(j.key=="Escape"||j.key=="Enter")&&(j.stopPropagation(),k.close())}function D(j){cs.call(this,s,j)}function F(j){pa[j?"unshift":"push"](()=>{k=j,c(0,k)})}return s.$$set=j=>{"$$scope"in j&&c(3,_=j.$$scope)},[k,I,f,_,d,D,F]}class HP extends qn{constructor(o){super(),Vn(this,o,XP,WP,gn,{})}}function Ov(s){let o,c;return o=new HP({props:{$$slots:{default:[YP]},$$scope:{ctx:s}}}),o.$on("close",s[3]),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&17&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function YP(s){let o,c,d,_,k,I,f,D,F,j,N,V,Q,re,Ae,xe,Te,Ce,ke,Re,ze,Oe,Ze,je,He,pt,Ie,Pt,st,Ue,lt,Lt,ct,Qt,ii,nt,Ft,jt,qt,et,Ot,mt,vt,_e,vi;return{c(){o=gt("h1"),o.textContent="About this tool",c=Vt(),d=gt("p"),d.textContent=`This uses OS MasterMap Highways Network data, using road classification - and average width. According to the table below (thresholds and - methodology TBD), each road is assigned a rating.`,_=Vt(),k=gt("table"),I=gt("tr"),I.innerHTML=' A Roads B Roads C Roads Unclassified Roads',f=Vt(),D=gt("tr"),F=gt("th"),F.textContent="Green",j=Vt(),N=gt("td"),N.textContent="≥ ???",V=Vt(),Q=gt("td"),Q.textContent="≥ 12.8m",re=Vt(),Ae=gt("td"),Ae.textContent="≥ 10.0m",xe=Vt(),Te=gt("td"),Te.textContent="≥ 9.5m",Ce=Vt(),ke=gt("tr"),Re=gt("th"),Re.textContent="Amber",ze=Vt(),Oe=gt("td"),Oe.textContent="???m - ???",Ze=Vt(),je=gt("td"),je.textContent="11.5m - 12.8m",He=Vt(),pt=gt("td"),pt.textContent="9.1m - 10.0m",Ie=Vt(),Pt=gt("td"),Pt.textContent="8.4m - 9.5m",st=Vt(),Ue=gt("tr"),lt=gt("th"),lt.textContent="Red",Lt=Vt(),ct=gt("td"),ct.textContent="< ???",Qt=Vt(),ii=gt("td"),ii.textContent="< 11.5m",nt=Vt(),Ft=gt("td"),Ft.textContent="< 9.1m",jt=Vt(),qt=gt("td"),qt.textContent="< 8.4m",et=Vt(),Ot=gt("p"),Ot.textContent="OS data is copyright to Ordnance Survey.",mt=Vt(),vt=gt("button"),vt.textContent="OK",Ln(F,"class","svelte-dgq6bh"),Rs(F,"color",$s.green),Ln(Re,"class","svelte-dgq6bh"),Rs(Re,"color",$s.amber),Ln(lt,"class","svelte-dgq6bh"),Rs(lt,"color",$s.red)},m(Kt,_t){Tt(Kt,o,_t),Tt(Kt,c,_t),Tt(Kt,d,_t),Tt(Kt,_,_t),Tt(Kt,k,_t),We(k,I),We(k,f),We(k,D),We(D,F),We(D,j),We(D,N),We(D,V),We(D,Q),We(D,re),We(D,Ae),We(D,xe),We(D,Te),We(k,Ce),We(k,ke),We(ke,Re),We(ke,ze),We(ke,Oe),We(ke,Ze),We(ke,je),We(ke,He),We(ke,pt),We(ke,Ie),We(ke,Pt),We(k,st),We(k,Ue),We(Ue,lt),We(Ue,Lt),We(Ue,ct),We(Ue,Qt),We(Ue,ii),We(Ue,nt),We(Ue,Ft),We(Ue,jt),We(Ue,qt),Tt(Kt,et,_t),Tt(Kt,Ot,_t),Tt(Kt,mt,_t),Tt(Kt,vt,_t),_e||(vi=xr(vt,"click",s[2]),_e=!0)},p:Un,d(Kt){Kt&&(St(o),St(c),St(d),St(_),St(k),St(et),St(Ot),St(mt),St(vt)),_e=!1,vi()}}}function KP(s){let o,c,d,_,k,I,f=s[0]&&Ov(s);return{c(){o=gt("button"),o.textContent="About",c=Vt(),f&&f.c(),d=Yr()},m(D,F){Tt(D,o,F),Tt(D,c,F),f&&f.m(D,F),Tt(D,d,F),_=!0,k||(I=xr(o,"click",s[1]),k=!0)},p(D,[F]){D[0]?f?(f.p(D,F),F&1&&Dt(f,1)):(f=Ov(D),f.c(),Dt(f,1),f.m(d.parentNode,d)):f&&(ds(),Xt(f,1,1,()=>{f=null}),ps())},i(D){_||(Dt(f),_=!0)},o(D){Xt(f),_=!1},d(D){D&&(St(o),St(c),St(d)),f&&f.d(D),k=!1,I()}}}function JP(s,o,c){let d=!1;return[d,()=>c(0,d=!0),()=>c(0,d=!1),()=>c(0,d=!1)]}class QP extends qn{constructor(o){super(),Vn(this,o,JP,KP,gn,{})}}function $P(s){let o;return{c(){o=gt("p"),o.innerHTML=`Data source not specified. If you're developing locally, try this - . Otherwise, you might not have access to this.`},m(c,d){Tt(c,o,d)},p:Un,i:Un,o:Un,d(c){c&&St(o)}}}function eL(s){let o,c;return o=new $b({props:{$$slots:{main:[uL],left:[nL]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&131087&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function Fv(s){let o,c,d,_;const k=[iL,tL],I=[];function f(D,F){return D[3]>=10?0:1}return o=f(s),c=I[o]=k[o](s),{c(){c.c(),d=Yr()},m(D,F){I[o].m(D,F),Tt(D,d,F),_=!0},p(D,F){let j=o;o=f(D),o===j?I[o].p(D,F):(ds(),Xt(I[j],1,1,()=>{I[j]=null}),ps(),c=I[o],c?c.p(D,F):(c=I[o]=k[o](D),c.c()),Dt(c,1),c.m(d.parentNode,d))},i(D){_||(Dt(c),_=!0)},o(D){Xt(c),_=!1},d(D){D&&St(d),I[o].d(D)}}}function tL(s){let o;return{c(){o=gt("p"),o.textContent="Zoom in more to see roads"},m(c,d){Tt(c,o,d)},p:Un,i:Un,o:Un,d(c){c&&St(o)}}}function iL(s){let o,c,d;function _(I){s[15](I)}let k={};return s[2]!==void 0&&(k.filters=s[2]),o=new FP({props:k}),pa.push(()=>Df(o,"filters",_)),{c(){rn(o.$$.fragment)},m(I,f){Wi(o,I,f),d=!0},p(I,f){const D={};!c&&f&4&&(c=!0,D.filters=I[2],Rf(()=>c=!1)),o.$set(D)},i(I){d||(Dt(o.$$.fragment,I),d=!0)},o(I){Xt(o.$$.fragment,I),d=!1},d(I){Xi(o,I)}}}function nL(s){let o,c,d,_,k,I,f,D,F,j,N,V,Q,re,Ae,xe,Te,Ce,ke,Re,ze,Oe,Ze,je,He,pt,Ie,Pt;_=new QP({});let st=s[1]=="roads"&&Fv(s);return pt=Vv(s[11][0]),{c(){o=gt("div"),c=gt("h1"),c.textContent="Pavement Parking",d=Vt(),rn(_.$$.fragment),k=Vt(),I=gt("fieldset"),f=gt("legend"),f.textContent="Show:",D=Vt(),F=gt("label"),j=gt("input"),N=di(` - Roads`),V=Vt(),Q=gt("label"),re=gt("input"),Ae=di(` - LAD boundaries`),xe=Vt(),Te=gt("label"),Ce=gt("input"),ke=di(` - Combined Authority boundaries`),Re=Vt(),ze=gt("label"),Oe=gt("input"),Ze=di(` - Parking demand by Output Area`),je=Vt(),st&&st.c(),Ln(j,"type","radio"),j.__value="roads",Nc(j,j.__value),Ln(re,"type","radio"),re.__value="lad-summary",Nc(re,re.__value),Ln(Ce,"type","radio"),Ce.__value="ca-summary",Nc(Ce,Ce.__value),Ln(Oe,"type","radio"),Oe.__value="census-area",Nc(Oe,Oe.__value),Ln(o,"slot","left"),pt.p(j,re,Ce,Oe)},m(Ue,lt){Tt(Ue,o,lt),We(o,c),We(o,d),Wi(_,o,null),We(o,k),We(o,I),We(I,f),We(I,D),We(I,F),We(F,j),j.checked=j.__value===s[1],We(F,N),We(I,V),We(I,Q),We(Q,re),re.checked=re.__value===s[1],We(Q,Ae),We(I,xe),We(I,Te),We(Te,Ce),Ce.checked=Ce.__value===s[1],We(Te,ke),We(I,Re),We(I,ze),We(ze,Oe),Oe.checked=Oe.__value===s[1],We(ze,Ze),We(o,je),st&&st.m(o,null),He=!0,Ie||(Pt=[xr(j,"change",s[10]),xr(re,"change",s[12]),xr(Ce,"change",s[13]),xr(Oe,"change",s[14])],Ie=!0)},p(Ue,lt){lt&2&&(j.checked=j.__value===Ue[1]),lt&2&&(re.checked=re.__value===Ue[1]),lt&2&&(Ce.checked=Ce.__value===Ue[1]),lt&2&&(Oe.checked=Oe.__value===Ue[1]),Ue[1]=="roads"?st?(st.p(Ue,lt),lt&2&&Dt(st,1)):(st=Fv(Ue),st.c(),Dt(st,1),st.m(o,null)):st&&(ds(),Xt(st,1,1,()=>{st=null}),ps())},i(Ue){He||(Dt(_.$$.fragment,Ue),Dt(st),He=!0)},o(Ue){Xt(_.$$.fragment,Ue),Xt(st),He=!1},d(Ue){Ue&&St(o),Xi(_),st&&st.d(),pt.r(),Ie=!1,ma(Pt)}}}function rL(s){let o,c;return o=new A2({props:{url:`pmtiles://${s[5]}`,$$slots:{default:[oL]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&131078&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function sL(s){let o,c;return o=new Gp({props:{data:s[5],generateId:!0,$$slots:{default:[aL]},$$scope:{ctx:s}}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&131078&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function oL(s){let o,c;return o=new B1({props:{show:s[1],roadFilters:s[2],sourceLayer:"pavements"}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&2&&(k.show=d[1]),_&4&&(k.roadFilters=d[2]),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function aL(s){let o,c;return o=new B1({props:{show:s[1],roadFilters:s[2],sourceLayer:void 0}}),{c(){rn(o.$$.fragment)},m(d,_){Wi(o,d,_),c=!0},p(d,_){const k={};_&2&&(k.show=d[1]),_&4&&(k.roadFilters=d[2]),o.$set(k)},i(d){c||(Dt(o.$$.fragment,d),c=!0)},o(d){Xt(o.$$.fragment,d),c=!1},d(d){Xi(o,d)}}}function lL(s){let o,c,d,_,k,I,f,D,F;o=new Ew({}),o.$on("zoom",s[8]);const j=[sL,rL],N=[];function V(Q,re){return Q[5].endsWith(".geojson")?0:Q[5].endsWith(".pmtiles")?1:-1}return~(d=V(s))&&(_=N[d]=j[d](s)),I=new zP({props:{show:s[1],url:s[6]}}),D=new GP({props:{show:s[1],url:s[7]}}),{c(){rn(o.$$.fragment),c=Vt(),_&&_.c(),k=Vt(),rn(I.$$.fragment),f=Vt(),rn(D.$$.fragment)},m(Q,re){Wi(o,Q,re),Tt(Q,c,re),~d&&N[d].m(Q,re),Tt(Q,k,re),Wi(I,Q,re),Tt(Q,f,re),Wi(D,Q,re),F=!0},p(Q,re){_&&_.p(Q,re);const Ae={};re&2&&(Ae.show=Q[1]),I.$set(Ae);const xe={};re&2&&(xe.show=Q[1]),D.$set(xe)},i(Q){F||(Dt(o.$$.fragment,Q),Dt(_),Dt(I.$$.fragment,Q),Dt(D.$$.fragment,Q),F=!0)},o(Q){Xt(o.$$.fragment,Q),Xt(_),Xt(I.$$.fragment,Q),Xt(D.$$.fragment,Q),F=!1},d(Q){Q&&(St(c),St(k),St(f)),Xi(o,Q),~d&&N[d].d(Q),Xi(I,Q),Xi(D,Q)}}}function uL(s){let o,c,d,_;function k(f){s[9](f)}let I={style:"https://api.maptiler.com/maps/uk-openzoomstack-light/style.json?key=MZEJTanw3WpxRvt7qDfo",hash:!0,bounds:s[4],$$slots:{default:[lL]},$$scope:{ctx:s}};return s[0]!==void 0&&(I.map=s[0]),c=new Bw({props:I}),pa.push(()=>Df(c,"map",k)),{c(){o=gt("div"),rn(c.$$.fragment),Ln(o,"slot","main"),Rs(o,"position","relative"),Rs(o,"width","100%"),Rs(o,"height","100vh")},m(f,D){Tt(f,o,D),Wi(c,o,null),_=!0},p(f,D){const F={};D&131078&&(F.$$scope={dirty:D,ctx:f}),!d&&D&1&&(d=!0,F.map=f[0],Rf(()=>d=!1)),c.$set(F)},i(f){_||(Dt(c.$$.fragment,f),_=!0)},o(f){Xt(c.$$.fragment,f),_=!1},d(f){f&&St(o),Xi(c)}}}function cL(s){let o,c,d,_;const k=[eL,$P],I=[];function f(D,F){return D[5]?0:1}return o=f(s),c=I[o]=k[o](s),{c(){c.c(),d=Yr()},m(D,F){I[o].m(D,F),Tt(D,d,F),_=!0},p(D,[F]){c.p(D,F)},i(D){_||(Dt(c),_=!0)},o(D){Xt(c),_=!1},d(D){D&&St(d),I[o].d(D)}}}function hL(s,o,c){let d=window.location.hash?void 0:[-5.96,49.89,2.31,55.94],_="roads",k=IP,f=new URLSearchParams(window.location.search).get("data")||"",D=f.replace(f.endsWith(".geojson")?"pavements.geojson":"pavements.pmtiles","summaries.geojson"),F=f.replace(f.endsWith(".geojson")?"pavements.geojson":"pavements.pmtiles","output_areas.geojson"),j,N=0;function V(){c(3,N=j.getZoom())}const Q=[[]];function re(Re){j=Re,c(0,j)}function Ae(){_=this.__value,c(1,_)}function xe(){_=this.__value,c(1,_)}function Te(){_=this.__value,c(1,_)}function Ce(){_=this.__value,c(1,_)}function ke(Re){k=Re,c(2,k)}return s.$$.update=()=>{s.$$.dirty&1&&j&&V()},[j,_,k,N,d,f,D,F,V,re,Ae,Q,xe,Te,Ce,ke]}class fL extends qn{constructor(o){super(),Vn(this,o,hL,cL,gn,{})}}new fL({target:document.getElementById("app")}); diff --git a/assets/main-f18bdacd.js b/assets/main-f18bdacd.js new file mode 100644 index 0000000..726ecb6 --- /dev/null +++ b/assets/main-f18bdacd.js @@ -0,0 +1,624 @@ +var Lb=Object.defineProperty;var Ab=(s,o,c)=>o in s?Lb(s,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[o]=c;var Md=(s,o,c)=>(Ab(s,typeof o!="symbol"?o+"":o,c),c);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const _ of document.querySelectorAll('link[rel="modulepreload"]'))d(_);new MutationObserver(_=>{for(const k of _)if(k.type==="childList")for(const I of k.addedNodes)I.tagName==="LINK"&&I.rel==="modulepreload"&&d(I)}).observe(document,{childList:!0,subtree:!0});function c(_){const k={};return _.integrity&&(k.integrity=_.integrity),_.referrerPolicy&&(k.referrerPolicy=_.referrerPolicy),_.crossOrigin==="use-credentials"?k.credentials="include":_.crossOrigin==="anonymous"?k.credentials="omit":k.credentials="same-origin",k}function d(_){if(_.ep)return;_.ep=!0;const k=c(_);fetch(_.href,k)}})();function bn(){}function Mb(s,o){for(const c in o)s[c]=o[c];return s}function Ov(s){return s()}function ey(){return Object.create(null)}function ma(s){s.forEach(Ov)}function Vp(s){return typeof s=="function"}function gn(s,o){return s!=s?o==o:s!==o||s&&typeof s=="object"||typeof s=="function"}function Rb(s){return Object.keys(s).length===0}function Fv(s,...o){if(s==null){for(const d of o)d(void 0);return bn}const c=s.subscribe(...o);return c.unsubscribe?()=>c.unsubscribe():c}function Db(s){let o;return Fv(s,c=>o=c)(),o}function Ln(s,o,c){s.$$.on_destroy.push(Fv(o,c))}function Po(s,o,c,d){if(s){const _=Bv(s,o,c,d);return s[0](_)}}function Bv(s,o,c,d){return s[1]&&d?Mb(c.ctx.slice(),s[1](d(o))):c.ctx}function Lo(s,o,c,d){if(s[2]&&d){const _=s[2](d(c));if(o.dirty===void 0)return _;if(typeof _=="object"){const k=[],I=Math.max(o.dirty.length,_.length);for(let f=0;f32){const o=[],c=s.ctx.length/32;for(let d=0;ds.removeEventListener(o,c,d)}function An(s,o,c){c==null?s.removeAttribute(o):s.getAttribute(o)!==c&&s.setAttribute(o,c)}function jv(s){let o;return{p(...c){o=c,o.forEach(d=>s.push(d))},r(){o.forEach(c=>s.splice(s.indexOf(c),1))}}}function Fb(s){return Array.from(s.childNodes)}function Ur(s,o){o=""+o,s.data!==o&&(s.data=o)}function Nc(s,o){s.value=o??""}function Rs(s,o,c,d){c==null?s.style.removeProperty(o):s.style.setProperty(o,c,d?"important":"")}function iy(s,o,c){s.classList.toggle(o,!!c)}function Bb(s,o,{bubbles:c=!1,cancelable:d=!1}={}){return new CustomEvent(s,{detail:o,bubbles:c,cancelable:d})}let Xc;function jc(s){Xc=s}function $c(){if(!Xc)throw new Error("Function called outside component initialization");return Xc}function jb(s){$c().$$.on_mount.push(s)}function Ro(s){$c().$$.on_destroy.push(s)}function Mf(){const s=$c();return(o,c,{cancelable:d=!1}={})=>{const _=s.$$.callbacks[o];if(_){const k=Bb(o,c,{cancelable:d});return _.slice().forEach(I=>{I.call(s,k)}),!k.defaultPrevented}return!0}}function Uv(s,o){return $c().$$.context.set(s,o),o}function Ub(s){return $c().$$.context.get(s)}function cs(s,o){const c=s.$$.callbacks[o.type];c&&c.slice().forEach(d=>d.call(this,o))}const xu=[],pa=[];let Su=[];const sp=[],Vv=Promise.resolve();let op=!1;function qv(){op||(op=!0,Vv.then(Gv))}function Vb(){return qv(),Vv}function ap(s){Su.push(s)}function Rf(s){sp.push(s)}const Rd=new Set;let du=0;function Gv(){if(du!==0)return;const s=Xc;do{try{for(;dus.indexOf(d)===-1?o.push(d):c.push(d)),c.forEach(d=>d()),Su=o}const Xh=new Set;let Rl;function ds(){Rl={r:0,c:[],p:Rl}}function ps(){Rl.r||ma(Rl.c),Rl=Rl.p}function Bt(s,o){s&&s.i&&(Xh.delete(s),s.i(o))}function $t(s,o,c,d){if(s&&s.o){if(Xh.has(s))return;Xh.add(s),Rl.c.push(()=>{Xh.delete(s),d&&(c&&s.d(1),d())}),s.o(o)}else d&&d()}function Eo(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function Df(s,o,c){const d=s.$$.props[o];d!==void 0&&(s.$$.bound[d]=c,c(s.$$.ctx[d]))}function un(s){s&&s.c()}function rn(s,o,c){const{fragment:d,after_update:_}=s.$$;d&&d.m(o,c),ap(()=>{const k=s.$$.on_mount.map(Ov).filter(Vp);s.$$.on_destroy?s.$$.on_destroy.push(...k):ma(k),s.$$.on_mount=[]}),_.forEach(ap)}function sn(s,o){const c=s.$$;c.fragment!==null&&(Gb(c.after_update),ma(c.on_destroy),c.fragment&&c.fragment.d(o),c.on_destroy=c.fragment=null,c.ctx=[])}function Zb(s,o){s.$$.dirty[0]===-1&&(xu.push(s),qv(),s.$$.dirty.fill(0)),s.$$.dirty[o/31|0]|=1<{const re=ne.length?ne[0]:V;return F.ctx&&_(F.ctx[N],F.ctx[N]=re)&&(!F.skip_bound&&F.bound[N]&&F.bound[N](re),j&&Zb(s,N)),V}):[],F.update(),j=!0,ma(F.before_update),F.fragment=d?d(F.ctx):!1,o.target){if(o.hydrate){const N=Fb(o.target);F.fragment&&F.fragment.l(N),N.forEach(St)}else F.fragment&&F.fragment.c();o.intro&&Bt(s.$$.fragment),rn(s,o.target,o.anchor),Gv()}jc(D)}class qn{constructor(){Md(this,"$$");Md(this,"$$set")}$destroy(){sn(this,1),this.$destroy=bn}$on(o,c){if(!Vp(c))return bn;const d=this.$$.callbacks[o]||(this.$$.callbacks[o]=[]);return d.push(c),()=>{const _=d.indexOf(c);_!==-1&&d.splice(_,1)}}$set(o){this.$$set&&!Rb(o)&&(this.$$.skip_bound=!0,this.$$set(o),this.$$.skip_bound=!1)}}const Wb="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wb);const pu=[];function Dd(s,o){return{subscribe:ko(s,o).subscribe}}function ko(s,o=bn){let c;const d=new Set;function _(f){if(gn(s,f)&&(s=f,c)){const D=!pu.length;for(const F of d)F[1](),pu.push(F,s);if(D){for(let F=0;F{d.delete(F),d.size===0&&c&&(c(),c=null)}}return{set:_,update:k,subscribe:I}}const Xb=s=>({}),ny=s=>({}),Hb=s=>({}),ry=s=>({});function Yb(s){let o,c,d,_;const k=s[1].left,I=Po(k,s,s[0],ry),f=s[1].main,D=Po(f,s,s[0],ny);return{c(){o=mt("div"),I&&I.c(),c=qt(),d=mt("div"),D&&D.c(),An(o,"class","left svelte-k43lgc"),An(d,"class","main svelte-k43lgc")},m(F,j){Tt(F,o,j),I&&I.m(o,null),Tt(F,c,j),Tt(F,d,j),D&&D.m(d,null),_=!0},p(F,[j]){I&&I.p&&(!_||j&1)&&Ao(I,k,F,F[0],_?Lo(k,F[0],j,Hb):Mo(F[0]),ry),D&&D.p&&(!_||j&1)&&Ao(D,f,F,F[0],_?Lo(f,F[0],j,Xb):Mo(F[0]),ny)},i(F){_||(Bt(I,F),Bt(D,F),_=!0)},o(F){$t(I,F),$t(D,F),_=!1},d(F){F&&(St(o),St(c),St(d)),I&&I.d(F),D&&D.d(F)}}}function Kb(s,o,c){let{$$slots:d={},$$scope:_}=o;return s.$$set=k=>{"$$scope"in k&&c(0,_=k.$$scope)},[_,d]}class Jb extends qn{constructor(o){super(),Vn(this,o,Kb,Yb,gn,{})}}let Qb=Date.now();function eh(s){return`${s}-${Qb++}`}const qp=Symbol.for("svelte-maplibre");function Ol(){return Ub(qp)}function $b(s){let o=new WeakMap;return c=>{var I;let d=o.get(c.originalEvent);if(d!==void 0)return d;let k=(I=c.target.queryRenderedFeatures(c.point).find(f=>{var D;return(D=s.get(f.layer.id))==null?void 0:D.interactive}))==null?void 0:I.layer.id;return o.set(c.originalEvent,k),k}}function ew(){let s=new Map;return Uv(qp,{map:ko(null),source:Dd(null),layer:Dd(null),popupTarget:Dd(null),cluster:ko(),loadedImages:ko(new Set),minzoom:ko(0),maxzoom:ko(24),layerEvent:ko(null),layerInfo:s,eventTopMost:$b(s)})}function sy(s){return{subscribe:s.subscribe}}function Zv({key:s,setPopupTarget:o=!1,setCluster:c=!1,setMouseEvent:d=!1}){let _=Ol(),k=ko(null),I=sy(k),f={..._,[s]:sy(k)};if(o&&(f.popupTarget=I),d){let D=ko(null);f.layerEvent=D,_.layerEvent=D}return c&&(f.cluster=ko()),Uv(qp,f),{..._,self:k}}function Wv(){return Zv({key:"source",setCluster:!0})}function tw(s=!0){return Zv({key:"layer",setPopupTarget:s,setMouseEvent:s})}function iw(s){return"layerType"in s&&s.layerType==="deckgl"}var nw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rw(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Xv={exports:{}};/** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.5.1/LICENSE.txt + */(function(s,o){(function(c,d){s.exports=d()})(nw,function(){var c={},d={};function _(I,f,D){if(d[I]=D,I==="index"){var F="var sharedModule = {}; ("+d.shared+")(sharedModule); ("+d.worker+")(sharedModule);",j={};return d.shared(j),d.index(c,j),typeof window<"u"&&c.setWorkerUrl(window.URL.createObjectURL(new Blob([F],{type:"text/javascript"}))),c}}_("shared",["exports"],function(I){function f(i,e,n,h){return new(n||(n=Promise))(function(g,w){function S(A){try{P(h.next(A))}catch(O){w(O)}}function T(A){try{P(h.throw(A))}catch(O){w(O)}}function P(A){var O;A.done?g(A.value):(O=A.value,O instanceof n?O:new n(function(U){U(O)})).then(S,T)}P((h=h.apply(i,e||[])).next())})}function D(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var F=j;function j(i,e){this.x=i,this.y=e}j.prototype={clone:function(){return new j(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,n=i.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),n=Math.sin(i),h=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=h,this},_rotateAround:function(i,e){var n=Math.cos(i),h=Math.sin(i),g=e.y+h*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-h*(this.y-e.y),this.y=g,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},j.convert=function(i){return i instanceof j?i:Array.isArray(i)?new j(i[0],i[1]):i};var N=D(F),V=ne;function ne(i,e,n,h){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=n,this.p2y=h}ne.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var n=i,h=0;h<8;h++){var g=this.sampleCurveX(n)-i;if(Math.abs(g)g?S=n:T=n,n=.5*(T-S)+S;return n},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var re=D(V);let Ae,we;function Te(){return Ae==null&&(Ae=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ae}function Ce(){if(we==null&&(we=!1,Te())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let h=0;h<5*5;h++){const g=4*h;e.fillStyle=`rgb(${g},${g+1},${g+2})`,e.fillRect(h%5,Math.floor(h/5),1,1)}const n=e.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&n[h]!==h){we=!0;break}}}return we||!1}function ke(i,e,n,h){const g=new re(i,e,n,h);return w=>g.solve(w)}const Re=ke(.25,.1,.25,1);function ze(i,e,n){return Math.min(n,Math.max(e,i))}function Oe(i,e,n){const h=n-e,g=((i-e)%h+h)%h+e;return g===e?n:g}function Ze(i,...e){for(const n of e)for(const h in n)i[h]=n[h];return i}let je=1;function Ve(i,e,n){const h={};for(const g in i)h[g]=e.call(this,i[g],g,i);return h}function st(i,e,n){const h={};for(const g in i)e.call(this,i[g],g,i)&&(h[g]=i[g]);return h}function Se(i){return Array.isArray(i)?i.map(Se):typeof i=="object"&&i?Ve(i,Se):i}const Lt={};function _t(i){Lt[i]||(typeof console<"u"&&console.warn(i),Lt[i]=!0)}function We(i,e,n){return(n.y-i.y)*(e.x-i.x)>(e.y-i.y)*(n.x-i.x)}function dt(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let bt=null;function lt(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const It="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Wt(i,e,n,h,g){return f(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const w=new VideoFrame(i,{timestamp:0});try{const S=w==null?void 0:w.format;if(!S||!S.startsWith("BGR")&&!S.startsWith("RGB"))throw new Error(`Unrecognized format ${S}`);const T=S.startsWith("BGR"),P=new Uint8ClampedArray(h*g*4);if(yield w.copyTo(P,function(A,O,U,Z,Y){const J=4*Math.max(-O,0),te=(Math.max(0,U)-U)*Z*4+J,le=4*Z,de=Math.max(0,O),De=Math.max(0,U);return{rect:{x:de,y:De,width:Math.min(A.width,O+Z)-de,height:Math.min(A.height,U+Y)-De},layout:[{offset:te,stride:le}]}}(i,e,n,h,g)),T)for(let A=0;Adt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,vi=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){const h=Ot(i.url);if(h)return h(i,e);if(dt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:pt},e)}if(!(/^file:/.test(n=i.url)||/^file:/.test(_e())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(h,g){return f(this,void 0,void 0,function*(){const w=new Request(h.url,{method:h.method||"GET",body:h.body,credentials:h.credentials,headers:h.headers,cache:h.cache,referrer:_e(),signal:g.signal});h.type!=="json"||w.headers.has("Accept")||w.headers.set("Accept","application/json");const S=yield fetch(w);if(!S.ok){const A=yield S.blob();throw new vt(S.status,S.statusText,h.url,A)}let T;T=h.type==="arrayBuffer"||h.type==="image"?S.arrayBuffer():h.type==="json"?S.json():S.text();const P=yield T;if(g.signal.aborted)throw Gt();return{data:P,cacheControl:S.headers.get("Cache-Control"),expires:S.headers.get("Expires")}})}(i,e);if(dt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:pt},e)}var n;return function(h,g){return new Promise((w,S)=>{var T;const P=new XMLHttpRequest;P.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(P.responseType="arraybuffer");for(const A in h.headers)P.setRequestHeader(A,h.headers[A]);h.type==="json"&&(P.responseType="text",!((T=h.headers)===null||T===void 0)&&T.Accept||P.setRequestHeader("Accept","application/json")),P.withCredentials=h.credentials==="include",P.onerror=()=>{S(new Error(P.statusText))},P.onload=()=>{if(!g.signal.aborted)if((P.status>=200&&P.status<300||P.status===0)&&P.response!==null){let A=P.response;if(h.type==="json")try{A=JSON.parse(P.response)}catch(O){return void S(O)}w({data:A,cacheControl:P.getResponseHeader("Cache-Control"),expires:P.getResponseHeader("Expires")})}else{const A=new Blob([P.response],{type:P.getResponseHeader("Content-Type")});S(new vt(P.status,P.statusText,h.url,A))}},g.signal.addEventListener("abort",()=>{P.abort(),S(Gt())}),P.send(h.body)})}(i,e)};function Jt(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),n=window.location;return e.protocol===n.protocol&&e.host===n.host}function yt(i,e,n){n[i]&&n[i].indexOf(e)!==-1||(n[i]=n[i]||[],n[i].push(e))}function he(i,e,n){if(n&&n[i]){const h=n[i].indexOf(e);h!==-1&&n[i].splice(h,1)}}class xe{constructor(e,n={}){Ze(this,n),this.type=e}}class Dt extends xe{constructor(e,n={}){super("error",Ze({error:e},n))}}class Ke{on(e,n){return this._listeners=this._listeners||{},yt(e,n,this._listeners),this}off(e,n){return he(e,n,this._listeners),he(e,n,this._oneTimeListeners),this}once(e,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},yt(e,n,this._oneTimeListeners),this):new Promise(h=>this.once(e,h))}fire(e,n){typeof e=="string"&&(e=new xe(e,n||{}));const h=e.type;if(this.listens(h)){e.target=this;const g=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const T of g)T.call(this,e);const w=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const T of w)he(h,T,this._oneTimeListeners),T.call(this,e);const S=this._eventedParent;S&&(Ze(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),S.fire(e))}else e instanceof Dt&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,n){return this._eventedParent=e,this._eventedParentData=n,this}}var Ne={$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"},projection:{type:"projection"},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":{}}},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},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",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-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-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}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},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 Xi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Hn(i,e){const n={};for(const h in i)h!=="ref"&&(n[h]=i[h]);return Xi.forEach(h=>{h in e&&(n[h]=e[h])}),n}function Je(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let n=0;n`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const $=[gs,ut,mi,rt,Kn,ur,Rr,H(si),In,Dr,ce];function Q(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Q(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const n of $)if(!Q(n,e))return null}}return`Expected ${X(i)} but found ${X(e)} instead.`}function ge(i,e){return e.some(n=>n.kind===i.kind)}function be(i,e){return e.some(n=>n==="null"?i===null:n==="array"?Array.isArray(i):n==="object"?i&&!Array.isArray(i)&&typeof i=="object":n===typeof i)}function Le(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const pe=.96422,Ue=.82521,$e=4/29,Fe=6/29,ft=3*Fe*Fe,jt=Fe*Fe*Fe,Qt=Math.PI/180,ui=180/Math.PI;function bi(i){return(i%=360)<0&&(i+=360),i}function Yt([i,e,n,h]){let g,w;const S=zi((.2225045*(i=Ai(i))+.7168786*(e=Ai(e))+.0606169*(n=Ai(n)))/1);i===e&&e===n?g=w=S:(g=zi((.4360747*i+.3850649*e+.1430804*n)/pe),w=zi((.0139322*i+.0971045*e+.7141733*n)/Ue));const T=116*S-16;return[T<0?0:T,500*(g-S),200*(S-w),h]}function Ai(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function zi(i){return i>jt?Math.pow(i,1/3):i/ft+$e}function ji([i,e,n,h]){let g=(i+16)/116,w=isNaN(e)?g:g+e/500,S=isNaN(n)?g:g-n/200;return g=1*Ii(g),w=pe*Ii(w),S=Ue*Ii(S),[fi(3.1338561*w-1.6168667*g-.4906146*S),fi(-.9787684*w+1.9161415*g+.033454*S),fi(.0719453*w-.2289914*g+1.4052427*S),h]}function fi(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Ii(i){return i>Fe?i*i*i:ft*(i-$e)}function Mi(i){return parseInt(i.padEnd(2,i),16)/255}function tn(i,e){return wi(e?i/100:i,0,1)}function wi(i,e,n){return Math.min(Math.max(e,i),n)}function Rn(i){return!i.some(Number.isNaN)}const Oo={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 ki{constructor(e,n,h,g=1,w=!0){this.r=e,this.g=n,this.b=h,this.a=g,w||(this.r*=g,this.g*=g,this.b*=g,g||this.overwriteGetter("rgb",[e,n,h,g]))}static parse(e){if(e instanceof ki)return e;if(typeof e!="string")return;const n=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const g=Oo[h];if(g){const[S,T,P]=g;return[S/255,T/255,P/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const S=h.length<6?1:2;let T=1;return[Mi(h.slice(T,T+=S)),Mi(h.slice(T,T+=S)),Mi(h.slice(T,T+=S)),Mi(h.slice(T,T+S)||"ff")]}if(h.startsWith("rgb")){const S=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(S){const[T,P,A,O,U,Z,Y,J,te,le,de,De]=S,ve=[O||" ",Y||" ",le].join("");if(ve===" "||ve===" /"||ve===",,"||ve===",,,"){const Pe=[A,Z,te].join(""),qe=Pe==="%%%"?100:Pe===""?255:0;if(qe){const nt=[wi(+P/qe,0,1),wi(+U/qe,0,1),wi(+J/qe,0,1),de?tn(+de,De):1];if(Rn(nt))return nt}}return}}const w=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[S,T,P,A,O,U,Z,Y,J]=w,te=[P||" ",O||" ",Z].join("");if(te===" "||te===" /"||te===",,"||te===",,,"){const le=[+T,wi(+A,0,100),wi(+U,0,100),Y?tn(+Y,J):1];if(Rn(le))return function([de,De,ve,Pe]){function qe(nt){const Pt=(nt+de/30)%12,ei=De*Math.min(ve,1-ve);return ve-ei*Math.max(-1,Math.min(Pt-3,9-Pt,1))}return de=bi(de),De/=100,ve/=100,[qe(0),qe(8),qe(4),Pe]}(le)}}}(e);return n?new ki(...n,!1):void 0}get rgb(){const{r:e,g:n,b:h,a:g}=this,w=g||1/0;return this.overwriteGetter("rgb",[e/w,n/w,h/w,g])}get hcl(){return this.overwriteGetter("hcl",function(e){const[n,h,g,w]=Yt(e),S=Math.sqrt(h*h+g*g);return[Math.round(1e4*S)?bi(Math.atan2(g,h)*ui):NaN,S,n,w]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Yt(this.rgb))}overwriteGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}toString(){const[e,n,h,g]=this.rgb;return`rgba(${[e,n,h].map(w=>Math.round(255*w)).join(",")},${g})`}}ki.black=new ki(0,0,0,1),ki.white=new ki(1,1,1,1),ki.transparent=new ki(0,0,0,0),ki.red=new ki(1,0,0,1);class Ns{constructor(e,n,h){this.sensitivity=e?n?"variant":"case":n?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,n){return this.collator.compare(e,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Fo{constructor(e,n,h,g,w){this.text=e,this.image=n,this.scale=h,this.fontStack=g,this.textColor=w}}class Gn{constructor(e){this.sections=e}static fromString(e){return new Gn([new Fo(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Gn?e:Gn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Jn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Jn)return e;if(typeof e=="number")return new Jn([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const n of e)if(typeof n!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Jn(e)}}toString(){return JSON.stringify(this.values)}}const Fu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class nn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof nn)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let n=0;n=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof n=="number"&&n>=0&&n<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[i,e,n,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[i,e,n,h]:[i,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Vr(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ki||i instanceof Ns||i instanceof Gn||i instanceof Jn||i instanceof nn||i instanceof hn)return!0;if(Array.isArray(i)){for(const e of i)if(!Vr(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Vr(i[e]))return!1;return!0}return!1}function on(i){if(i===null)return gs;if(typeof i=="string")return mi;if(typeof i=="boolean")return rt;if(typeof i=="number")return ut;if(i instanceof ki)return Kn;if(i instanceof Ns)return cn;if(i instanceof Gn)return ur;if(i instanceof Jn)return In;if(i instanceof nn)return ce;if(i instanceof hn)return Dr;if(Array.isArray(i)){const e=i.length;let n;for(const h of i){const g=on(h);if(n){if(n===g)continue;n=si;break}n=g}return H(n||si,e)}return Rr}function Jr(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ki||i instanceof Gn||i instanceof Jn||i instanceof nn||i instanceof hn?i.toString():JSON.stringify(i)}class Os{constructor(e,n){this.type=e,this.value=n}static parse(e,n){if(e.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Vr(e[1]))return n.error("invalid value");const h=e[1];let g=on(h);const w=n.expectedType;return g.kind!=="array"||g.N!==0||!w||w.kind!=="array"||typeof w.N=="number"&&w.N!==0||(g=w),new Os(g,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class fn{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Bo={string:mi,number:ut,boolean:rt,object:Rr};class cr{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");let h,g=1;const w=e[0];if(w==="array"){let T,P;if(e.length>2){const A=e[1];if(typeof A!="string"||!(A in Bo)||A==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);T=Bo[A],g++}else T=si;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return n.error('The length argument to "array" must be a positive integer literal',2);P=e[2],g++}h=H(T,P)}else{if(!Bo[w])throw new Error(`Types doesn't contain name = ${w}`);h=Bo[w]}const S=[];for(;ge.outputDefined())}}const ys={"to-boolean":rt,"to-color":Kn,"to-number":ut,"to-string":mi};class Dn{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");const h=e[0];if(!ys[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&e.length!==2)return n.error("Expected one argument.");const g=ys[h],w=[];for(let S=1;S4?`Invalid rbga value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:io(n[0],n[1],n[2],n[3]),!h))return new ki(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new fn(h||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const h of this.args){n=h.evaluate(e);const g=Jn.parse(n);if(g)return g}throw new fn(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const h of this.args){n=h.evaluate(e);const g=nn.parse(n);if(g)return g}throw new fn(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const h of this.args){if(n=h.evaluate(e),n===null)return 0;const g=Number(n);if(!isNaN(g))return g}throw new fn(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return Gn.fromString(Jr(this.args[0].evaluate(e)));case"resolvedImage":return hn.fromString(Jr(this.args[0].evaluate(e)));default:return Jr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const qr=["Unknown","Point","LineString","Polygon"];class no{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"?qr[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(e){let n=this._parseColorCache[e];return n||(n=this._parseColorCache[e]=ki.parse(e)),n}}class hr{constructor(e,n,h=[],g,w=new ti,S=[]){this.registry=e,this.path=h,this.key=h.map(T=>`[${T}]`).join(""),this.scope=w,this.errors=S,this.expectedType=g,this._isConstant=n}parse(e,n,h,g,w={}){return n?this.concat(n,h,g)._parse(e,w):this._parse(e,w)}_parse(e,n){function h(g,w,S){return S==="assert"?new cr(w,[g]):S==="coerce"?new Dn(w,[g]):g}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const g=e[0];if(typeof g!="string")return this.error(`Expression name must be a string, but found ${typeof g} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const w=this.registry[g];if(w){let S=w.parse(e,this);if(!S)return null;if(this.expectedType){const T=this.expectedType,P=S.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||P.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(T.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(T.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(T,P))return null}else S=h(S,T,n.typeAnnotation||"coerce");else S=h(S,T,n.typeAnnotation||"coerce");else S=h(S,T,n.typeAnnotation||"coerce");else S=h(S,T,n.typeAnnotation||"assert")}if(!(S instanceof Os)&&S.type.kind!=="resolvedImage"&&this._isConstant(S)){const T=new no;try{S=new Os(S.type,S.evaluate(T))}catch(P){return this.error(P.message),null}}return S}return this.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,n,h){const g=typeof e=="number"?this.path.concat(e):this.path,w=h?this.scope.concat(h):this.scope;return new hr(this.registry,this._isConstant,g,n||null,w,this.errors)}error(e,...n){const h=`${this.key}${n.map(g=>`[${g}]`).join("")}`;this.errors.push(new li(h,e))}checkSubtype(e,n){const h=Q(e,n);return h&&this.error(h),h}}class Si{constructor(e,n){this.type=n.type,this.bindings=[].concat(e),this.result=n}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const n of this.bindings)e(n[1]);e(this.result)}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const h=[];for(let w=1;w=h.length)throw new fn(`Array index out of bounds: ${n} > ${h.length-1}.`);if(n!==Math.floor(n))throw new fn(`Array index must be an integer, but found ${n} instead.`);return h[n]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class jo{constructor(e,n){this.type=rt,this.needle=e,this.haystack=n}static parse(e,n){if(e.length!==3)return n.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const h=n.parse(e[1],1,si),g=n.parse(e[2],2,si);return h&&g?ge(h.type,[rt,mi,ut,gs,si])?new jo(h,g):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${X(h.type)} instead`):null}evaluate(e){const n=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!h)return!1;if(!be(n,["boolean","string","number","null"]))throw new fn(`Expected first argument to be of type boolean, string, number or null, but found ${X(on(n))} instead.`);if(!be(h,["string","array"]))throw new fn(`Expected second argument to be of type array or string, but found ${X(on(h))} instead.`);return h.indexOf(n)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Uo{constructor(e,n,h){this.type=ut,this.needle=e,this.haystack=n,this.fromIndex=h}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=n.parse(e[1],1,si),g=n.parse(e[2],2,si);if(!h||!g)return null;if(!ge(h.type,[rt,mi,ut,gs,si]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${X(h.type)} instead`);if(e.length===4){const w=n.parse(e[3],3,ut);return w?new Uo(h,g,w):null}return new Uo(h,g)}evaluate(e){const n=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!be(n,["boolean","string","number","null"]))throw new fn(`Expected first argument to be of type boolean, string, number or null, but found ${X(on(n))} instead.`);if(!be(h,["string","array"]))throw new fn(`Expected second argument to be of type array or string, but found ${X(on(h))} instead.`);if(this.fromIndex){const g=this.fromIndex.evaluate(e);return h.indexOf(n,g)}return h.indexOf(n)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class _s{constructor(e,n,h,g,w,S){this.inputType=e,this.type=n,this.input=h,this.cases=g,this.outputs=w,this.otherwise=S}static parse(e,n){if(e.length<5)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return n.error("Expected an even number of arguments.");let h,g;n.expectedType&&n.expectedType.kind!=="value"&&(g=n.expectedType);const w={},S=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return Z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof J=="number"&&Math.floor(J)!==J)return Z.error("Numeric branch labels must be integer values.");if(h){if(Z.checkSubtype(h,on(J)))return null}else h=on(J);if(w[String(J)]!==void 0)return Z.error("Branch labels must be unique.");w[String(J)]=S.length}const Y=n.parse(U,A,g);if(!Y)return null;g=g||Y.type,S.push(Y)}const T=n.parse(e[1],1,si);if(!T)return null;const P=n.parse(e[e.length-1],e.length-1,g);return P?T.type.kind!=="value"&&n.concat(1).checkSubtype(h,T.type)?null:new _s(h,g,T,w,S,P):null}evaluate(e){const n=this.input.evaluate(e);return(on(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Vo{constructor(e,n,h){this.type=e,this.branches=n,this.otherwise=h}static parse(e,n){if(e.length<4)return n.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return n.error("Expected an odd number of arguments.");let h;n.expectedType&&n.expectedType.kind!=="value"&&(h=n.expectedType);const g=[];for(let S=1;Sn.outputDefined())&&this.otherwise.outputDefined()}}class ya{constructor(e,n,h,g){this.type=e,this.input=n,this.beginIndex=h,this.endIndex=g}static parse(e,n){if(e.length<=2||e.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=n.parse(e[1],1,si),g=n.parse(e[2],2,ut);if(!h||!g)return null;if(!ge(h.type,[H(si),mi,si]))return n.error(`Expected first argument to be of type array or string, but found ${X(h.type)} instead`);if(e.length===4){const w=n.parse(e[3],3,ut);return w?new ya(h.type,h,g,w):null}return new ya(h.type,h,g)}evaluate(e){const n=this.input.evaluate(e),h=this.beginIndex.evaluate(e);if(!be(n,["string","array"]))throw new fn(`Expected first argument to be of type array or string, but found ${X(on(n))} instead.`);if(this.endIndex){const g=this.endIndex.evaluate(e);return n.slice(h,g)}return n.slice(h)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ro(i,e){const n=i.length-1;let h,g,w=0,S=n,T=0;for(;w<=S;)if(T=Math.floor((w+S)/2),h=i[T],g=i[T+1],h<=e){if(T===n||ee))throw new fn("Input is not a number.");S=T-1}return 0}class so{constructor(e,n,h){this.type=e,this.input=n,this.labels=[],this.outputs=[];for(const[g,w]of h)this.labels.push(g),this.outputs.push(w)}static parse(e,n){if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");const h=n.parse(e[1],1,ut);if(!h)return null;const g=[];let w=null;n.expectedType&&n.expectedType.kind!=="value"&&(w=n.expectedType);for(let S=1;S=T)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);const U=n.parse(P,O,w);if(!U)return null;w=w||U.type,g.push([T,U])}return new so(w,h,g)}evaluate(e){const n=this.labels,h=this.outputs;if(n.length===1)return h[0].evaluate(e);const g=this.input.evaluate(e);if(g<=n[0])return h[0].evaluate(e);const w=n.length;return g>=n[w-1]?h[w-1].evaluate(e):h[ro(n,g)].evaluate(e)}eachChild(e){e(this.input);for(const n of this.outputs)e(n)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function il(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Yi=vs;function vs(i,e,n,h){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=n,this.p2y=h}vs.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var n=i,h=0;h<8;h++){var g=this.sampleCurveX(n)-i;if(Math.abs(g)g?S=n:T=n,n=.5*(T-S)+S;return n},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var Bu=il(Yi);function Gr(i,e,n){return i+n*(e-i)}function zn(i,e,n){return i.map((h,g)=>Gr(h,e[g],n))}const Ki={number:Gr,color:function(i,e,n,h="rgb"){switch(h){case"rgb":{const[g,w,S,T]=zn(i.rgb,e.rgb,n);return new ki(g,w,S,T,!1)}case"hcl":{const[g,w,S,T]=i.hcl,[P,A,O,U]=e.hcl;let Z,Y;if(isNaN(g)||isNaN(P))isNaN(g)?isNaN(P)?Z=NaN:(Z=P,S!==1&&S!==0||(Y=A)):(Z=g,O!==1&&O!==0||(Y=w));else{let De=P-g;P>g&&De>180?De-=360:P180&&(De+=360),Z=g+n*De}const[J,te,le,de]=function([De,ve,Pe,qe]){return De=isNaN(De)?0:De*Qt,ji([Pe,Math.cos(De)*ve,Math.sin(De)*ve,qe])}([Z,Y??Gr(w,A,n),Gr(S,O,n),Gr(T,U,n)]);return new ki(J,te,le,de,!1)}case"lab":{const[g,w,S,T]=ji(zn(i.lab,e.lab,n));return new ki(g,w,S,T,!1)}}},array:zn,padding:function(i,e,n){return new Jn(zn(i.values,e.values,n))},variableAnchorOffsetCollection:function(i,e,n){const h=i.values,g=e.values;if(h.length!==g.length)throw new fn(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${e.toString()}`);const w=[];for(let S=0;Stypeof O!="number"||O<0||O>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:A}}}if(e.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(w=n.parse(w,2,ut),!w)return null;const T=[];let P=null;h==="interpolate-hcl"||h==="interpolate-lab"?P=Kn:n.expectedType&&n.expectedType.kind!=="value"&&(P=n.expectedType);for(let A=0;A=O)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Z);const J=n.parse(U,Y,P);if(!J)return null;P=P||J.type,T.push([O,J])}return Le(P,ut)||Le(P,Kn)||Le(P,In)||Le(P,ce)||Le(P,H(ut))?new Nn(P,h,g,w,T):n.error(`Type ${X(P)} is not interpolatable.`)}evaluate(e){const n=this.labels,h=this.outputs;if(n.length===1)return h[0].evaluate(e);const g=this.input.evaluate(e);if(g<=n[0])return h[0].evaluate(e);const w=n.length;if(g>=n[w-1])return h[w-1].evaluate(e);const S=ro(n,g),T=Nn.interpolationFactor(this.interpolation,g,n[S],n[S+1]),P=h[S].evaluate(e),A=h[S+1].evaluate(e);switch(this.operator){case"interpolate":return Ki[this.type.kind](P,A,T);case"interpolate-hcl":return Ki.color(P,A,T,"hcl");case"interpolate-lab":return Ki.color(P,A,T,"lab")}}eachChild(e){e(this.input);for(const n of this.outputs)e(n)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function qo(i,e,n,h){const g=h-n,w=i-n;return g===0?0:e===1?w/g:(Math.pow(e,w)-1)/(Math.pow(e,g)-1)}class _a{constructor(e,n){this.type=e,this.args=n}static parse(e,n){if(e.length<2)return n.error("Expectected at least one argument.");let h=null;const g=n.expectedType;g&&g.kind!=="value"&&(h=g);const w=[];for(const T of e.slice(1)){const P=n.parse(T,1+w.length,h,void 0,{typeAnnotation:"omit"});if(!P)return null;h=h||P.type,w.push(P)}if(!h)throw new Error("No output type");const S=g&&w.some(T=>Q(g,T.type));return new _a(S?si:h,w)}evaluate(e){let n,h=null,g=0;for(const w of this.args)if(g++,h=w.evaluate(e),h&&h instanceof hn&&!h.available&&(n||(n=h.name),h=null,g===this.args.length&&(h=n)),h!==null)break;return h}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function nl(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Go(i,e,n,h){return h.compare(e,n)===0}function Fs(i,e,n){const h=i!=="=="&&i!=="!=";return class Hv{constructor(w,S,T){this.type=rt,this.lhs=w,this.rhs=S,this.collator=T,this.hasUntypedArgument=w.type.kind==="value"||S.type.kind==="value"}static parse(w,S){if(w.length!==3&&w.length!==4)return S.error("Expected two or three arguments.");const T=w[0];let P=S.parse(w[1],1,si);if(!P)return null;if(!nl(T,P.type))return S.concat(1).error(`"${T}" comparisons are not supported for type '${X(P.type)}'.`);let A=S.parse(w[2],2,si);if(!A)return null;if(!nl(T,A.type))return S.concat(2).error(`"${T}" comparisons are not supported for type '${X(A.type)}'.`);if(P.type.kind!==A.type.kind&&P.type.kind!=="value"&&A.type.kind!=="value")return S.error(`Cannot compare types '${X(P.type)}' and '${X(A.type)}'.`);h&&(P.type.kind==="value"&&A.type.kind!=="value"?P=new cr(A.type,[P]):P.type.kind!=="value"&&A.type.kind==="value"&&(A=new cr(P.type,[A])));let O=null;if(w.length===4){if(P.type.kind!=="string"&&A.type.kind!=="string"&&P.type.kind!=="value"&&A.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(O=S.parse(w[3],3,cn),!O)return null}return new Hv(P,A,O)}evaluate(w){const S=this.lhs.evaluate(w),T=this.rhs.evaluate(w);if(h&&this.hasUntypedArgument){const P=on(S),A=on(T);if(P.kind!==A.kind||P.kind!=="string"&&P.kind!=="number")throw new fn(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${P.kind}, ${A.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const P=on(S),A=on(T);if(P.kind!=="string"||A.kind!=="string")return e(w,S,T)}return this.collator?n(w,S,T,this.collator.evaluate(w)):e(w,S,T)}eachChild(w){w(this.lhs),w(this.rhs),this.collator&&w(this.collator)}outputDefined(){return!0}}}const rl=Fs("==",function(i,e,n){return e===n},Go),Ti=Fs("!=",function(i,e,n){return e!==n},function(i,e,n,h){return!Go(0,e,n,h)}),Zr=Fs("<",function(i,e,n){return e",function(i,e,n){return e>n},function(i,e,n,h){return h.compare(e,n)>0}),sl=Fs("<=",function(i,e,n){return e<=n},function(i,e,n,h){return h.compare(e,n)<=0}),Zo=Fs(">=",function(i,e,n){return e>=n},function(i,e,n,h){return h.compare(e,n)>=0});class Wo{constructor(e,n,h){this.type=cn,this.locale=h,this.caseSensitive=e,this.diacriticSensitive=n}static parse(e,n){if(e.length!==2)return n.error("Expected one argument.");const h=e[1];if(typeof h!="object"||Array.isArray(h))return n.error("Collator options argument must be an object.");const g=n.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,rt);if(!g)return null;const w=n.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,rt);if(!w)return null;let S=null;return h.locale&&(S=n.parse(h.locale,1,mi),!S)?null:new Wo(g,w,S)}evaluate(e){return new Ns(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class En{constructor(e,n,h,g,w){this.type=mi,this.number=e,this.locale=n,this.currency=h,this.minFractionDigits=g,this.maxFractionDigits=w}static parse(e,n){if(e.length!==3)return n.error("Expected two arguments.");const h=n.parse(e[1],1,ut);if(!h)return null;const g=e[2];if(typeof g!="object"||Array.isArray(g))return n.error("NumberFormat options argument must be an object.");let w=null;if(g.locale&&(w=n.parse(g.locale,1,mi),!w))return null;let S=null;if(g.currency&&(S=n.parse(g.currency,1,mi),!S))return null;let T=null;if(g["min-fraction-digits"]&&(T=n.parse(g["min-fraction-digits"],1,ut),!T))return null;let P=null;return g["max-fraction-digits"]&&(P=n.parse(g["max-fraction-digits"],1,ut),!P)?null:new En(h,w,S,T,P)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Xo{constructor(e){this.type=ur,this.sections=e}static parse(e,n){if(e.length<2)return n.error("Expected at least one argument.");const h=e[1];if(!Array.isArray(h)&&typeof h=="object")return n.error("First argument must be an image or text section.");const g=[];let w=!1;for(let S=1;S<=e.length-1;++S){const T=e[S];if(w&&typeof T=="object"&&!Array.isArray(T)){w=!1;let P=null;if(T["font-scale"]&&(P=n.parse(T["font-scale"],1,ut),!P))return null;let A=null;if(T["text-font"]&&(A=n.parse(T["text-font"],1,H(mi)),!A))return null;let O=null;if(T["text-color"]&&(O=n.parse(T["text-color"],1,Kn),!O))return null;const U=g[g.length-1];U.scale=P,U.font=A,U.textColor=O}else{const P=n.parse(e[S],1,si);if(!P)return null;const A=P.type.kind;if(A!=="string"&&A!=="value"&&A!=="null"&&A!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");w=!0,g.push({content:P,scale:null,font:null,textColor:null})}}return new Xo(g)}evaluate(e){return new Gn(this.sections.map(n=>{const h=n.content.evaluate(e);return on(h)===Dr?new Fo("",h,null,null,null):new Fo(Jr(h),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)}))}eachChild(e){for(const n of this.sections)e(n.content),n.scale&&e(n.scale),n.font&&e(n.font),n.textColor&&e(n.textColor)}outputDefined(){return!1}}class Ho{constructor(e){this.type=Dr,this.input=e}static parse(e,n){if(e.length!==2)return n.error("Expected two arguments.");const h=n.parse(e[1],1,mi);return h?new Ho(h):n.error("No image name provided.")}evaluate(e){const n=this.input.evaluate(e),h=hn.fromString(n);return h&&e.availableImages&&(h.available=e.availableImages.indexOf(n)>-1),h}eachChild(e){e(this.input)}outputDefined(){return!1}}class xa{constructor(e){this.type=ut,this.input=e}static parse(e,n){if(e.length!==2)return n.error(`Expected 1 argument, but found ${e.length-1} instead.`);const h=n.parse(e[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${X(h.type)} instead.`):new xa(h):null}evaluate(e){const n=this.input.evaluate(e);if(typeof n=="string"||Array.isArray(n))return n.length;throw new fn(`Expected value to be of type string or array, but found ${X(on(n))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const zr=8192;function ol(i,e){const n=(180+i[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,g=Math.pow(2,e.z);return[Math.round(n*g*zr),Math.round(h*g*zr)]}function Bs(i,e){const n=Math.pow(2,e.z);return[(g=(i[0]/zr+e.x)/n,360*g-180),(h=(i[1]/zr+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*h)*Math.PI/180))-90)];var h,g}function pi(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function xs(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function ju(i,e,n){const h=i[0]-e[0],g=i[1]-e[1],w=i[0]-n[0],S=i[1]-n[1];return h*S-w*g==0&&h*w<=0&&g*S<=0}function Zn(i,e,n,h){return(g=[h[0]-n[0],h[1]-n[1]])[0]*(w=[e[0]-i[0],e[1]-i[1]])[1]-g[1]*w[0]!=0&&!(!Ul(i,e,n,h)||!Ul(n,h,i,e));var g,w}function oo(i,e,n){for(const h of n)for(let g=0;g(g=i)[1]!=(S=T[P+1])[1]>g[1]&&g[0]<(S[0]-w[0])*(g[1]-w[1])/(S[1]-w[1])+w[0]&&(h=!h)}var g,w,S;return h}function lo(i,e){for(const n of e)if(ao(i,n))return!0;return!1}function al(i,e){for(const n of i)if(!ao(n,e))return!1;for(let n=0;n0&&T<0||S<0&&T>0}function kr(i,e,n){const h=[];for(let g=0;gn[2]){const g=.5*h;let w=i[0]-n[0]>g?-h:n[0]-i[0]>g?h:0;w===0&&(w=i[0]-n[2]>g?-h:n[2]-i[0]>g?h:0),i[0]+=w}pi(e,i)}function ql(i,e,n,h){const g=Math.pow(2,h.z)*zr,w=[h.x*zr,h.y*zr],S=[];for(const T of i)for(const P of T){const A=[P.x+w[0],P.y+w[1]];Vl(A,e,n,g),S.push(A)}return S}function Gl(i,e,n,h){const g=Math.pow(2,h.z)*zr,w=[h.x*zr,h.y*zr],S=[];for(const P of i){const A=[];for(const O of P){const U=[O.x+w[0],O.y+w[1]];pi(e,U),A.push(U)}S.push(A)}if(e[2]-e[0]<=g/2){(T=e)[0]=T[1]=1/0,T[2]=T[3]=-1/0;for(const P of S)for(const A of P)Vl(A,e,n,g)}var T;return S}class js{constructor(e,n){this.type=rt,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Vr(e[1])){const h=e[1];if(h.type==="FeatureCollection"){const g=[];for(const w of h.features){const{type:S,coordinates:T}=w.geometry;S==="Polygon"&&g.push(T),S==="MultiPolygon"&&g.push(...T)}if(g.length)return new js(h,{type:"MultiPolygon",coordinates:g})}else if(h.type==="Feature"){const g=h.geometry.type;if(g==="Polygon"||g==="MultiPolygon")return new js(h,h.geometry)}else if(h.type==="Polygon"||h.type==="MultiPolygon")return new js(h,h)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(n,h){const g=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],S=n.canonicalID();if(h.type==="Polygon"){const T=kr(h.coordinates,w,S),P=ql(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!ao(A,T))return!1}if(h.type==="MultiPolygon"){const T=ll(h.coordinates,w,S),P=ql(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!lo(A,T))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(n,h){const g=[1/0,1/0,-1/0,-1/0],w=[1/0,1/0,-1/0,-1/0],S=n.canonicalID();if(h.type==="Polygon"){const T=kr(h.coordinates,w,S),P=Gl(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!al(A,T))return!1}if(h.type==="MultiPolygon"){const T=ll(h.coordinates,w,S),P=Gl(n.geometry(),g,w,S);if(!xs(g,w))return!1;for(const A of P)if(!uo(A,T))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Zl=class{constructor(i=[],e=Uu){if(this.data=i,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:e,compare:n}=this,h=e[i];for(;i>0;){const g=i-1>>1,w=e[g];if(n(h,w)>=0)break;e[i]=w,i=g}e[i]=h}_down(i){const{data:e,compare:n}=this,h=this.length>>1,g=e[i];for(;i=0)break;e[i]=S,i=w}e[i]=g}};function Uu(i,e){return ie?1:0}function Vu(i,e,n,h,g){bs(i,e,n,h||i.length-1,g||qu)}function bs(i,e,n,h,g){for(;h>n;){if(h-n>600){var w=h-n+1,S=e-n+1,T=Math.log(w),P=.5*Math.exp(2*T/3),A=.5*Math.sqrt(T*P*(w-P)/w)*(S-w/2<0?-1:1);bs(i,e,Math.max(n,Math.floor(e-S*P/w+A)),Math.min(h,Math.floor(e+(w-S)*P/w+A)),g)}var O=i[e],U=n,Z=h;for(Tn(i,n,e),g(i[h],O)>0&&Tn(i,n,h);U0;)Z--}g(i[n],O)===0?Tn(i,n,Z):Tn(i,++Z,h),Z<=e&&(n=Z+1),e<=Z&&(h=Z-1)}}function Tn(i,e,n){var h=i[e];i[e]=i[n],i[n]=h}function qu(i,e){return ie?1:0}function Yo(i,e){if(i.length<=1)return[i];const n=[];let h,g;for(const w of i){const S=ul(w);S!==0&&(w.area=Math.abs(S),g===void 0&&(g=S<0),g===S<0?(h&&n.push(h),h=[w]):h.push(w))}if(h&&n.push(h),e>1)for(let w=0;w1?(A=e[P+1][0],O=e[P+1][1]):Y>0&&(A+=U/this.kx*Y,O+=Z/this.ky*Y)),U=this.wrap(n[0]-A)*this.kx,Z=(n[1]-O)*this.ky;const J=U*U+Z*Z;J180;)e-=360;return e}}function fl(i,e){return e[0]-i[0]}function On(i){return i[1]-i[0]+1}function dr(i,e){return i[1]>=i[0]&&i[1]i[1])return[null,null];const n=On(i);if(e){if(n===2)return[i,null];const g=Math.floor(n/2);return[[i[0],i[0]+g],[i[0]+g,i[1]]]}if(n===1)return[i,null];const h=Math.floor(n/2)-1;return[[i[0],i[0]+h],[i[0]+h+1,i[1]]]}function wa(i,e){if(!dr(e,i.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let h=e[0];h<=e[1];++h)pi(n,i[h]);return n}function ka(i){const e=[1/0,1/0,-1/0,-1/0];for(const n of i)for(const h of n)pi(e,h);return e}function dl(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Jo(i,e,n){if(!dl(i)||!dl(e))return NaN;let h=0,g=0;return i[2]e[2]&&(h=i[0]-e[2]),i[1]>e[3]&&(g=i[1]-e[3]),i[3]=h)return h;if(xs(g,w)){if(Qo(i,e))return 0}else if(Qo(e,i))return 0;let S=1/0;for(const T of i)for(let P=0,A=T.length,O=A-1;P0;){const P=S.pop();if(P[0]>=w)continue;const A=P[1],O=e?50:100;if(On(A)<=O){if(!dr(A,i.length))return NaN;if(e){const U=Ui(i,A,n,h);if(isNaN(U)||U===0)return U;w=Math.min(w,U)}else for(let U=A[0];U<=A[1];++U){const Z=qi(i[U],n,h);if(w=Math.min(w,Z),w===0)return 0}}else{const U=Ko(A,e);Sa(S,w,h,i,T,U[0]),Sa(S,w,h,i,T,U[1])}}return w}function Ea(i,e,n,h,g,w=1/0){let S=Math.min(w,g.distance(i[0],n[0]));if(S===0)return S;const T=new Zl([[0,[0,i.length-1],[0,n.length-1]]],fl);for(;T.length>0;){const P=T.pop();if(P[0]>=S)continue;const A=P[1],O=P[2],U=e?50:100,Z=h?50:100;if(On(A)<=U&&On(O)<=Z){if(!dr(A,i.length)&&dr(O,n.length))return NaN;let Y;if(e&&h)Y=yi(i,A,n,O,g),S=Math.min(S,Y);else if(e&&!h){const J=i.slice(A[0],A[1]+1);for(let te=O[0];te<=O[1];++te)if(Y=Ni(n[te],J,g),S=Math.min(S,Y),S===0)return S}else if(!e&&h){const J=n.slice(O[0],O[1]+1);for(let te=A[0];te<=A[1];++te)if(Y=Ni(i[te],J,g),S=Math.min(S,Y),S===0)return S}else Y=ml(i,A,n,O,g),S=Math.min(S,Y)}else{const Y=Ko(A,e),J=Ko(O,h);Ia(T,S,g,i,n,Y[0],J[0]),Ia(T,S,g,i,n,Y[0],J[1]),Ia(T,S,g,i,n,Y[1],J[0]),Ia(T,S,g,i,n,Y[1],J[1])}}return S}function gl(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class ws{constructor(e,n){this.type=ut,this.geojson=e,this.geometries=n}static parse(e,n){if(e.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Vr(e[1])){const h=e[1];if(h.type==="FeatureCollection")return new ws(h,h.features.map(g=>gl(g.geometry)).flat());if(h.type==="Feature")return new ws(h,gl(h.geometry));if("type"in h&&"coordinates"in h)return new ws(h,gl(h))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(n,h){const g=n.geometry(),w=g.flat().map(P=>Bs([P.x,P.y],n.canonical));if(g.length===0)return NaN;const S=new fr(w[0][1]);let T=1/0;for(const P of h){switch(P.type){case"Point":T=Math.min(T,Ea(w,!1,[P.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Ea(w,!1,P.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,$o(w,!1,P.coordinates,S,T))}if(T===0)return T}return T}(e,this.geometries);if(e.geometryType()==="LineString")return function(n,h){const g=n.geometry(),w=g.flat().map(P=>Bs([P.x,P.y],n.canonical));if(g.length===0)return NaN;const S=new fr(w[0][1]);let T=1/0;for(const P of h){switch(P.type){case"Point":T=Math.min(T,Ea(w,!0,[P.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Ea(w,!0,P.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,$o(w,!0,P.coordinates,S,T))}if(T===0)return T}return T}(e,this.geometries);if(e.geometryType()==="Polygon")return function(n,h){const g=n.geometry();if(g.length===0||g[0].length===0)return NaN;const w=Yo(g,0).map(P=>P.map(A=>A.map(O=>Bs([O.x,O.y],n.canonical)))),S=new fr(w[0][0][0][1]);let T=1/0;for(const P of h)for(const A of w){switch(P.type){case"Point":T=Math.min(T,$o([P.coordinates],!1,A,S,T));break;case"LineString":T=Math.min(T,$o(P.coordinates,!0,A,S,T));break;case"Polygon":T=Math.min(T,Wl(A,P.coordinates,S,T))}if(T===0)return T}return T}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Us={"==":rl,"!=":Ti,">":va,"<":Zr,">=":Zo,"<=":sl,array:cr,at:tl,boolean:cr,case:Vo,coalesce:_a,collator:Wo,format:Xo,image:Ho,in:jo,"index-of":Uo,interpolate:Nn,"interpolate-hcl":Nn,"interpolate-lab":Nn,length:xa,let:Si,literal:Os,match:_s,number:cr,"number-format":En,object:cr,slice:ya,step:so,string:cr,"to-boolean":Dn,"to-color":Dn,"to-number":Dn,"to-string":Dn,var:ga,within:js,distance:ws};class pr{constructor(e,n,h,g){this.name=e,this.type=n,this._evaluate=h,this.args=g}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,n){const h=e[0],g=pr.definitions[h];if(!g)return n.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const w=Array.isArray(g)?g[0]:g.type,S=Array.isArray(g)?[[g[1],g[2]]]:g.overloads,T=S.filter(([A])=>!Array.isArray(A)||A.length===e.length-1);let P=null;for(const[A,O]of T){P=new hr(n.registry,ea,n.path,null,n.scope);const U=[];let Z=!1;for(let Y=1;Y{return Z=U,Array.isArray(Z)?`(${Z.map(X).join(", ")})`:`(${X(Z.type)}...)`;var Z}).join(" | "),O=[];for(let U=1;U{n=e?n&&ea(h):n&&h instanceof Os}),!!n&&Pa(i)&&ho(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Pa(i){if(i instanceof pr&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof js||i instanceof ws)return!1;let e=!0;return i.eachChild(n=>{e&&!Pa(n)&&(e=!1)}),e}function co(i){if(i instanceof pr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(n=>{e&&!co(n)&&(e=!1)}),e}function ho(i,e){if(i instanceof pr&&e.indexOf(i.name)>=0)return!1;let n=!0;return i.eachChild(h=>{n&&!ho(h,e)&&(n=!1)}),n}function Xl(i){return{result:"success",value:i}}function Vs(i){return{result:"error",value:i}}function Ss(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function _l(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function fo(i){return!!i.expression&&i.expression.interpolated}function _i(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ta(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function vl(i){return i}function mr(i,e){const n=e.type==="color",h=i.stops&&typeof i.stops[0][0]=="object",g=h||!(h||i.property!==void 0),w=i.type||(fo(e)?"exponential":"interval");if(n||e.type==="padding"){const O=n?ki.parse:Jn.parse;(i=wr({},i)).stops&&(i.stops=i.stops.map(U=>[U[0],O(U[1])])),i.default=O(i.default?i.default:e.default)}if(i.colorSpace&&(S=i.colorSpace)!=="rgb"&&S!=="hcl"&&S!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var S;let T,P,A;if(w==="exponential")T=a;else if(w==="interval")T=r;else if(w==="categorical"){T=v,P=Object.create(null);for(const O of i.stops)P[O[0]]=O[1];A=typeof i.stops[0][0]}else{if(w!=="identity")throw new Error(`Unknown function type "${w}"`);T=u}if(h){const O={},U=[];for(let J=0;JJ[0]),evaluate:({zoom:J},te)=>a({stops:Z,base:i.base},e,J).evaluate(J,te)}}if(g){const O=w==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:O,interpolationFactor:Nn.interpolationFactor.bind(void 0,O),zoomStops:i.stops.map(U=>U[0]),evaluate:({zoom:U})=>T(i,e,U,P,A)}}return{kind:"source",evaluate(O,U){const Z=U&&U.properties?U.properties[i.property]:void 0;return Z===void 0?Fn(i.default,e.default):T(i,e,Z,P,A)}}}function Fn(i,e,n){return i!==void 0?i:e!==void 0?e:n!==void 0?n:void 0}function v(i,e,n,h,g){return Fn(typeof n===g?h[n]:void 0,i.default,e.default)}function r(i,e,n){if(_i(n)!=="number")return Fn(i.default,e.default);const h=i.stops.length;if(h===1||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[h-1][0])return i.stops[h-1][1];const g=ro(i.stops.map(w=>w[0]),n);return i.stops[g][1]}function a(i,e,n){const h=i.base!==void 0?i.base:1;if(_i(n)!=="number")return Fn(i.default,e.default);const g=i.stops.length;if(g===1||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[g-1][0])return i.stops[g-1][1];const w=ro(i.stops.map(O=>O[0]),n),S=function(O,U,Z,Y){const J=Y-Z,te=O-Z;return J===0?0:U===1?te/J:(Math.pow(U,te)-1)/(Math.pow(U,J)-1)}(n,h,i.stops[w][0],i.stops[w+1][0]),T=i.stops[w][1],P=i.stops[w+1][1],A=Ki[e.type]||vl;return typeof T.evaluate=="function"?{evaluate(...O){const U=T.evaluate.apply(void 0,O),Z=P.evaluate.apply(void 0,O);if(U!==void 0&&Z!==void 0)return A(U,Z,S,i.colorSpace)}}:A(T,P,S,i.colorSpace)}function u(i,e,n){switch(e.type){case"color":n=ki.parse(n);break;case"formatted":n=Gn.fromString(n.toString());break;case"resolvedImage":n=hn.fromString(n.toString());break;case"padding":n=Jn.parse(n);break;default:_i(n)===e.type||e.type==="enum"&&e.values[n]||(n=void 0)}return Fn(n,i.default,e.default)}pr.register(Us,{error:[{kind:"error"},[mi],(i,[e])=>{throw new fn(e.evaluate(i))}],typeof:[mi,[si],(i,[e])=>X(on(e.evaluate(i)))],"to-rgba":[H(ut,4),[Kn],(i,[e])=>{const[n,h,g,w]=e.evaluate(i).rgb;return[255*n,255*h,255*g,w]}],rgb:[Kn,[ut,ut,ut],yl],rgba:[Kn,[ut,ut,ut,ut],yl],has:{type:rt,overloads:[[[mi],(i,[e])=>Ta(e.evaluate(i),i.properties())],[[mi,Rr],(i,[e,n])=>Ta(e.evaluate(i),n.evaluate(i))]]},get:{type:si,overloads:[[[mi],(i,[e])=>Ca(e.evaluate(i),i.properties())],[[mi,Rr],(i,[e,n])=>Ca(e.evaluate(i),n.evaluate(i))]]},"feature-state":[si,[mi],(i,[e])=>Ca(e.evaluate(i),i.featureState||{})],properties:[Rr,[],i=>i.properties()],"geometry-type":[mi,[],i=>i.geometryType()],id:[si,[],i=>i.id()],zoom:[ut,[],i=>i.globals.zoom],"heatmap-density":[ut,[],i=>i.globals.heatmapDensity||0],"line-progress":[ut,[],i=>i.globals.lineProgress||0],accumulated:[si,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ut,ks(ut),(i,e)=>{let n=0;for(const h of e)n+=h.evaluate(i);return n}],"*":[ut,ks(ut),(i,e)=>{let n=1;for(const h of e)n*=h.evaluate(i);return n}],"-":{type:ut,overloads:[[[ut,ut],(i,[e,n])=>e.evaluate(i)-n.evaluate(i)],[[ut],(i,[e])=>-e.evaluate(i)]]},"/":[ut,[ut,ut],(i,[e,n])=>e.evaluate(i)/n.evaluate(i)],"%":[ut,[ut,ut],(i,[e,n])=>e.evaluate(i)%n.evaluate(i)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(i,[e,n])=>Math.pow(e.evaluate(i),n.evaluate(i))],sqrt:[ut,[ut],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ut,[ut],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ut,[ut],(i,[e])=>Math.log(e.evaluate(i))],log2:[ut,[ut],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ut,[ut],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ut,[ut],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ut,[ut],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ut,[ut],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ut,[ut],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ut,[ut],(i,[e])=>Math.atan(e.evaluate(i))],min:[ut,ks(ut),(i,e)=>Math.min(...e.map(n=>n.evaluate(i)))],max:[ut,ks(ut),(i,e)=>Math.max(...e.map(n=>n.evaluate(i)))],abs:[ut,[ut],(i,[e])=>Math.abs(e.evaluate(i))],round:[ut,[ut],(i,[e])=>{const n=e.evaluate(i);return n<0?-Math.round(-n):Math.round(n)}],floor:[ut,[ut],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ut,[ut],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[rt,[mi,si],(i,[e,n])=>i.properties()[e.value]===n.value],"filter-id-==":[rt,[si],(i,[e])=>i.id()===e.value],"filter-type-==":[rt,[mi],(i,[e])=>i.geometryType()===e.value],"filter-<":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h{const n=i.id(),h=e.value;return typeof n==typeof h&&n":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h>g}],"filter-id->":[rt,[si],(i,[e])=>{const n=i.id(),h=e.value;return typeof n==typeof h&&n>h}],"filter-<=":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h<=g}],"filter-id-<=":[rt,[si],(i,[e])=>{const n=i.id(),h=e.value;return typeof n==typeof h&&n<=h}],"filter->=":[rt,[mi,si],(i,[e,n])=>{const h=i.properties()[e.value],g=n.value;return typeof h==typeof g&&h>=g}],"filter-id->=":[rt,[si],(i,[e])=>{const n=i.id(),h=e.value;return typeof n==typeof h&&n>=h}],"filter-has":[rt,[si],(i,[e])=>e.value in i.properties()],"filter-has-id":[rt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[rt,[H(mi)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[rt,[H(si)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[rt,[mi,H(si)],(i,[e,n])=>n.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[rt,[mi,H(si)],(i,[e,n])=>function(h,g,w,S){for(;w<=S;){const T=w+S>>1;if(g[T]===h)return!0;g[T]>h?S=T-1:w=T+1}return!1}(i.properties()[e.value],n.value,0,n.value.length-1)],all:{type:rt,overloads:[[[rt,rt],(i,[e,n])=>e.evaluate(i)&&n.evaluate(i)],[ks(rt),(i,e)=>{for(const n of e)if(!n.evaluate(i))return!1;return!0}]]},any:{type:rt,overloads:[[[rt,rt],(i,[e,n])=>e.evaluate(i)||n.evaluate(i)],[ks(rt),(i,e)=>{for(const n of e)if(n.evaluate(i))return!0;return!1}]]},"!":[rt,[rt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[rt,[mi],(i,[e])=>{const n=i.globals&&i.globals.isSupportedScript;return!n||n(e.evaluate(i))}],upcase:[mi,[mi],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[mi,[mi],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[mi,ks(si),(i,e)=>e.map(n=>Jr(n.evaluate(i))).join("")],"resolved-locale":[mi,[cn],(i,[e])=>e.evaluate(i).resolvedLocale()]});class y{constructor(e,n){var h;this.expression=e,this._warningHistory={},this._evaluator=new no,this._defaultValue=n?(h=n).type==="color"&&ta(h.default)?new ki(0,0,0,0):h.type==="color"?ki.parse(h.default)||null:h.type==="padding"?Jn.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?nn.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(e,n,h,g,w,S){return this._evaluator.globals=e,this._evaluator.feature=n,this._evaluator.featureState=h,this._evaluator.canonical=g,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=S,this.expression.evaluate(this._evaluator)}evaluate(e,n,h,g,w,S){this._evaluator.globals=e,this._evaluator.feature=n||null,this._evaluator.featureState=h||null,this._evaluator.canonical=g,this._evaluator.availableImages=w||null,this._evaluator.formattedSection=S||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new fn(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){return this._warningHistory[T.message]||(this._warningHistory[T.message]=!0,typeof console<"u"&&console.warn(T.message)),this._defaultValue}}}function E(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Us}function M(i,e){const n=new hr(Us,ea,[],e?function(g){const w={color:Kn,string:mi,number:ut,enum:mi,boolean:rt,formatted:ur,padding:In,resolvedImage:Dr,variableAnchorOffsetCollection:ce};return g.type==="array"?H(w[g.value]||si,g.length):w[g.type]}(e):void 0),h=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Xl(new y(h,e)):Vs(n.errors)}class B{constructor(e,n){this.kind=e,this._styleExpression=n,this.isStateDependent=e!=="constant"&&!co(n.expression)}evaluateWithoutErrorHandling(e,n,h,g,w,S){return this._styleExpression.evaluateWithoutErrorHandling(e,n,h,g,w,S)}evaluate(e,n,h,g,w,S){return this._styleExpression.evaluate(e,n,h,g,w,S)}}class W{constructor(e,n,h,g){this.kind=e,this.zoomStops=h,this._styleExpression=n,this.isStateDependent=e!=="camera"&&!co(n.expression),this.interpolationType=g}evaluateWithoutErrorHandling(e,n,h,g,w,S){return this._styleExpression.evaluateWithoutErrorHandling(e,n,h,g,w,S)}evaluate(e,n,h,g,w,S){return this._styleExpression.evaluate(e,n,h,g,w,S)}interpolationFactor(e,n,h){return this.interpolationType?Nn.interpolationFactor(this.interpolationType,e,n,h):0}}function ie(i,e){const n=M(i,e);if(n.result==="error")return n;const h=n.value.expression,g=Pa(h);if(!g&&!Ss(e))return Vs([new li("","data expressions not supported")]);const w=ho(h,["zoom"]);if(!w&&!_l(e))return Vs([new li("","zoom expressions not supported")]);const S=Ee(h);return S||w?S instanceof li?Vs([S]):S instanceof Nn&&!fo(e)?Vs([new li("",'"interpolate" expressions cannot be used with this property')]):Xl(S?new W(g?"camera":"composite",n.value,S.labels,S instanceof Nn?S.interpolation:void 0):new B(g?"constant":"source",n.value)):Vs([new li("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class me{constructor(e,n){this._parameters=e,this._specification=n,wr(this,mr(this._parameters,this._specification))}static deserialize(e){return new me(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ee(i){let e=null;if(i instanceof Si)e=Ee(i.result);else if(i instanceof _a){for(const n of i.args)if(e=Ee(n),e)break}else(i instanceof so||i instanceof Nn)&&i.input instanceof pr&&i.input.name==="zoom"&&(e=i);return e instanceof li||i.eachChild(n=>{const h=Ee(n);h instanceof li?e=h:!e&&h?e=new li("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&h&&e!==h&&(e=new li("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function He(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!He(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const ct={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tt(i){if(i==null)return{filter:()=>!0,needGeometry:!1};He(i)||(i=ci(i));const e=M(i,ct);if(e.result==="error")throw new Error(e.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,h,g)=>e.value.evaluate(n,h,{},g),needGeometry:ni(i)}}function Kt(i,e){return ie?1:0}function ni(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Ci(i[1],i[2],e):e==="any"?(n=i.slice(1),["any"].concat(n.map(ci))):e==="all"?["all"].concat(i.slice(1).map(ci)):e==="none"?["all"].concat(i.slice(1).map(ci).map(kn)):e==="in"?Ri(i[1],i.slice(2)):e==="!in"?kn(Ri(i[1],i.slice(2))):e==="has"?wn(i[1]):e!=="!has"||kn(wn(i[1]));var n}function Ci(i,e,n){switch(i){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,i,e]}}function Ri(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(n=>typeof n!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Kt)]]:["filter-in-small",i,["literal",e]]}}function wn(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function kn(i){return["!",i]}function gr(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let g="[";for(const w of i)g+=`${gr(w)},`;return`${g}]`}const n=Object.keys(i).sort();let h="{";for(let g=0;gh.maximum?[new Ge(e,n,`${n} is greater than the maximum value ${h.maximum}`)]:[]}function na(i){const e=i.valueSpec,n=Li(i.value.type);let h,g,w,S={};const T=n!=="categorical"&&i.value.property===void 0,P=!T,A=_i(i.value.stops)==="array"&&_i(i.value.stops[0])==="array"&&_i(i.value.stops[0][0])==="object",O=yn({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(Y){if(n==="identity")return[new Ge(Y.key,Y.value,'identity function may not have a "stops" property')];let J=[];const te=Y.value;return J=J.concat(ia({key:Y.key,value:te,valueSpec:Y.valueSpec,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec,arrayElementValidator:U})),_i(te)==="array"&&te.length===0&&J.push(new Ge(Y.key,te,"array must have at least one stop")),J},default:function(Y){return Y.validateSpec({key:Y.key,value:Y.value,valueSpec:e,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec})}}});return n==="identity"&&T&&O.push(new Ge(i.key,i.value,'missing required property "property"')),n==="identity"||i.value.stops||O.push(new Ge(i.key,i.value,'missing required property "stops"')),n==="exponential"&&i.valueSpec.expression&&!fo(i.valueSpec)&&O.push(new Ge(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(P&&!Ss(i.valueSpec)?O.push(new Ge(i.key,i.value,"property functions not supported")):T&&!_l(i.valueSpec)&&O.push(new Ge(i.key,i.value,"zoom functions not supported"))),n!=="categorical"&&!A||i.value.property!==void 0||O.push(new Ge(i.key,i.value,'"property" property is required')),O;function U(Y){let J=[];const te=Y.value,le=Y.key;if(_i(te)!=="array")return[new Ge(le,te,`array expected, ${_i(te)} found`)];if(te.length!==2)return[new Ge(le,te,`array length 2 expected, length ${te.length} found`)];if(A){if(_i(te[0])!=="object")return[new Ge(le,te,`object expected, ${_i(te[0])} found`)];if(te[0].zoom===void 0)return[new Ge(le,te,"object stop key must have zoom")];if(te[0].value===void 0)return[new Ge(le,te,"object stop key must have value")];if(w&&w>Li(te[0].zoom))return[new Ge(le,te[0].zoom,"stop zoom values must appear in ascending order")];Li(te[0].zoom)!==w&&(w=Li(te[0].zoom),g=void 0,S={}),J=J.concat(yn({key:`${le}[0]`,value:te[0],valueSpec:{zoom:{}},validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec,objectElementValidators:{zoom:po,value:Z}}))}else J=J.concat(Z({key:`${le}[0]`,value:te[0],valueSpec:{},validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec},te));return E(Or(te[1]))?J.concat([new Ge(`${le}[1]`,te[1],"expressions are not allowed in function stops.")]):J.concat(Y.validateSpec({key:`${le}[1]`,value:te[1],valueSpec:e,validateSpec:Y.validateSpec,style:Y.style,styleSpec:Y.styleSpec}))}function Z(Y,J){const te=_i(Y.value),le=Li(Y.value),de=Y.value!==null?Y.value:J;if(h){if(te!==h)return[new Ge(Y.key,de,`${te} stop domain type must match previous stop domain type ${h}`)]}else h=te;if(te!=="number"&&te!=="string"&&te!=="boolean")return[new Ge(Y.key,de,"stop domain value must be a number, string, or boolean")];if(te!=="number"&&n!=="categorical"){let De=`number expected, ${te} found`;return Ss(e)&&n===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ge(Y.key,de,De)]}return n!=="categorical"||te!=="number"||isFinite(le)&&Math.floor(le)===le?n!=="categorical"&&te==="number"&&g!==void 0&&lenew Ge(`${i.key}${h.key}`,i.value,h.message));const n=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!n.outputDefined())return[new Ge(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!co(n))return[new Ge(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!co(n))return[new Ge(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ho(n,["zoom","feature-state"]))return[new Ge(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Pa(n))return[new Ge(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function xl(i){const e=i.key,n=i.value,h=i.valueSpec,g=[];return Array.isArray(h.values)?h.values.indexOf(Li(n))===-1&&g.push(new Ge(e,n,`expected one of [${h.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(h.values).indexOf(Li(n))===-1&&g.push(new Ge(e,n,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(n)} found`)),g}function bl(i){return He(Or(i.value))?Qr(wr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):wl(i)}function wl(i){const e=i.value,n=i.key;if(_i(e)!=="array")return[new Ge(n,e,`array expected, ${_i(e)} found`)];const h=i.styleSpec;let g,w=[];if(e.length<1)return[new Ge(n,e,"filter array must have at least 1 element")];switch(w=w.concat(xl({key:`${n}[0]`,value:e[0],valueSpec:h.filter_operator,style:i.style,styleSpec:i.styleSpec})),Li(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Li(e[1])==="$type"&&w.push(new Ge(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&w.push(new Ge(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(g=_i(e[1]),g!=="string"&&w.push(new Ge(`${n}[1]`,e[1],`string expected, ${g} found`)));for(let S=2;S{A in n&&e.push(new Ge(h,n[A],`"${A}" is prohibited for ref layers`))}),g.layers.forEach(A=>{Li(A.id)===T&&(P=A)}),P?P.ref?e.push(new Ge(h,n.ref,"ref cannot reference another ref layer")):S=Li(P.type):e.push(new Ge(h,n.ref,`ref layer "${T}" not found`))}else if(S!=="background")if(n.source){const P=g.sources&&g.sources[n.source],A=P&&Li(P.type);P?A==="vector"&&S==="raster"?e.push(new Ge(h,n.source,`layer "${n.id}" requires a raster source`)):A!=="raster-dem"&&S==="hillshade"?e.push(new Ge(h,n.source,`layer "${n.id}" requires a raster-dem source`)):A==="raster"&&S!=="raster"?e.push(new Ge(h,n.source,`layer "${n.id}" requires a vector source`)):A!=="vector"||n["source-layer"]?A==="raster-dem"&&S!=="hillshade"?e.push(new Ge(h,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!n.paint||!n.paint["line-gradient"]||A==="geojson"&&P.lineMetrics||e.push(new Ge(h,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ge(h,n,`layer "${n.id}" must specify a "source-layer"`)):e.push(new Ge(h,n.source,`source "${n.source}" not found`))}else e.push(new Ge(h,n,'missing required property "source"'));return e=e.concat(yn({key:h,value:n,valueSpec:w.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${h}.type`,value:n.type,valueSpec:w.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:n,objectKey:"type"}),filter:bl,layout:P=>yn({layer:n,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Xu(wr({layerType:S},A))}}),paint:P=>yn({layer:n,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":A=>Wu(wr({layerType:S},A))}})}})),e}function qs(i){const e=i.value,n=i.key,h=_i(e);return h!=="string"?[new Ge(n,e,`string expected, ${h} found`)]:[]}const Yu={promoteId:function({key:i,value:e}){if(_i(e)==="string")return qs({key:i,value:e});{const n=[];for(const h in e)n.push(...qs({key:`${i}.${h}`,value:e[h]}));return n}}};function sh(i){const e=i.value,n=i.key,h=i.styleSpec,g=i.style,w=i.validateSpec;if(!e.type)return[new Ge(n,e,'"type" is required')];const S=Li(e.type);let T;switch(S){case"vector":case"raster":return T=yn({key:n,value:e,valueSpec:h[`source_${S.replace("-","_")}`],style:i.style,styleSpec:h,objectElementValidators:Yu,validateSpec:w}),T;case"raster-dem":return T=function(P){var A;const O=(A=P.sourceName)!==null&&A!==void 0?A:"",U=P.value,Z=P.styleSpec,Y=Z.source_raster_dem,J=P.style;let te=[];const le=_i(U);if(U===void 0)return te;if(le!=="object")return te.push(new Ge("source_raster_dem",U,`object expected, ${le} found`)),te;const de=Li(U.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],ve=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Pe in U)!de&&De.includes(Pe)?te.push(new Ge(Pe,U[Pe],`In "${O}": "${Pe}" is only valid when "encoding" is set to "custom". ${ve} encoding found`)):Y[Pe]?te=te.concat(P.validateSpec({key:Pe,value:U[Pe],valueSpec:Y[Pe],validateSpec:P.validateSpec,style:J,styleSpec:Z})):te.push(new Ge(Pe,U[Pe],`unknown property "${Pe}"`));return te}({sourceName:n,value:e,style:i.style,styleSpec:h,validateSpec:w}),T;case"geojson":if(T=yn({key:n,value:e,valueSpec:h.source_geojson,style:g,styleSpec:h,validateSpec:w,objectElementValidators:Yu}),e.cluster)for(const P in e.clusterProperties){const[A,O]=e.clusterProperties[P],U=typeof A=="string"?[A,["accumulated"],["get",P]]:A;T.push(...Qr({key:`${n}.${P}.map`,value:O,validateSpec:w,expressionContext:"cluster-map"})),T.push(...Qr({key:`${n}.${P}.reduce`,value:U,validateSpec:w,expressionContext:"cluster-reduce"}))}return T;case"video":return yn({key:n,value:e,valueSpec:h.source_video,style:g,validateSpec:w,styleSpec:h});case"image":return yn({key:n,value:e,valueSpec:h.source_image,style:g,validateSpec:w,styleSpec:h});case"canvas":return[new Ge(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xl({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:g,validateSpec:w,styleSpec:h})}}function Ku(i){const e=i.value,n=i.styleSpec,h=n.light,g=i.style;let w=[];const S=_i(e);if(e===void 0)return w;if(S!=="object")return w=w.concat([new Ge("light",e,`object expected, ${S} found`)]),w;for(const T in e){const P=T.match(/^(.*)-transition$/);w=w.concat(P&&h[P[1]]&&h[P[1]].transition?i.validateSpec({key:T,value:e[T],valueSpec:n.transition,validateSpec:i.validateSpec,style:g,styleSpec:n}):h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],validateSpec:i.validateSpec,style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)])}return w}function oh(i){const e=i.value,n=i.styleSpec,h=n.sky,g=i.style,w=_i(e);if(e===void 0)return[];if(w!=="object")return[new Ge("sky",e,`object expected, ${w} found`)];let S=[];for(const T in e)S=S.concat(h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)]);return S}function Ju(i){const e=i.value,n=i.styleSpec,h=n.terrain,g=i.style;let w=[];const S=_i(e);if(e===void 0)return w;if(S!=="object")return w=w.concat([new Ge("terrain",e,`object expected, ${S} found`)]),w;for(const T in e)w=w.concat(h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],validateSpec:i.validateSpec,style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)]);return w}function Qu(i){let e=[];const n=i.value,h=i.key;if(Array.isArray(n)){const g=[],w=[];for(const S in n)n[S].id&&g.includes(n[S].id)&&e.push(new Ge(h,n,`all the sprites' ids must be unique, but ${n[S].id} is duplicated`)),g.push(n[S].id),n[S].url&&w.includes(n[S].url)&&e.push(new Ge(h,n,`all the sprites' URLs must be unique, but ${n[S].url} is duplicated`)),w.push(n[S].url),e=e.concat(yn({key:`${h}[${S}]`,value:n[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return qs({key:h,value:n})}const $u={"*":()=>[],array:ia,boolean:function(i){const e=i.value,n=i.key,h=_i(e);return h!=="boolean"?[new Ge(n,e,`boolean expected, ${h} found`)]:[]},number:po,color:function(i){const e=i.key,n=i.value,h=_i(n);return h!=="string"?[new Ge(e,n,`color expected, ${h} found`)]:ki.parse(String(n))?[]:[new Ge(e,n,`color expected, "${n}" found`)]},constants:Is,enum:xl,filter:bl,function:na,layer:Hu,object:yn,source:sh,light:Ku,sky:oh,terrain:Ju,projection:function(i){const e=i.value,n=i.styleSpec,h=n.projection,g=i.style,w=_i(e);if(e===void 0)return[];if(w!=="object")return[new Ge("projection",e,`object expected, ${w} found`)];let S=[];for(const T in e)S=S.concat(h[T]?i.validateSpec({key:T,value:e[T],valueSpec:h[T],style:g,styleSpec:n}):[new Ge(T,e[T],`unknown property "${T}"`)]);return S},string:qs,formatted:function(i){return qs(i).length===0?[]:Qr(i)},resolvedImage:function(i){return qs(i).length===0?[]:Qr(i)},padding:function(i){const e=i.key,n=i.value;if(_i(n)==="array"){if(n.length<1||n.length>4)return[new Ge(e,n,`padding requires 1 to 4 values; ${n.length} values found`)];const h={type:"number"};let g=[];for(let w=0;w[]}})),i.constants&&(n=n.concat(Is({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:kl}))),ec(n)}function $r(i){return function(e){return i({...e,validateSpec:kl})}}function ec(i){return[].concat(i).sort((e,n)=>e.line-n.line)}function es(i){return function(...e){return ec(i.apply(this,e))}}Wr.source=es($r(sh)),Wr.sprite=es($r(Qu)),Wr.glyphs=es($r(ah)),Wr.light=es($r(Ku)),Wr.sky=es($r(oh)),Wr.terrain=es($r(Ju)),Wr.layer=es($r(Hu)),Wr.filter=es($r(bl)),Wr.paintProperty=es($r(Wu)),Wr.layoutProperty=es($r(Xu));const Gs=Wr,jf=Gs.light,tc=Gs.sky,Uf=Gs.paintProperty,Vf=Gs.layoutProperty;function ic(i,e){let n=!1;if(e&&e.length)for(const h of e)i.fire(new Dt(new Error(h.message))),n=!0;return n}class La{constructor(e,n,h){const g=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const S=new Int32Array(this.arrayBuffer);e=S[0],this.d=(n=S[1])+2*(h=S[2]);for(let P=0;P=U[J+0]&&g>=U[J+1])?(T[Y]=!0,S.push(O[Y])):T[Y]=!1}}}}_forEachCell(e,n,h,g,w,S,T,P){const A=this._convertToCellCoord(e),O=this._convertToCellCoord(n),U=this._convertToCellCoord(h),Z=this._convertToCellCoord(g);for(let Y=A;Y<=U;Y++)for(let J=O;J<=Z;J++){const te=this.d*J+Y;if((!P||P(this._convertFromCellCoord(Y),this._convertFromCellCoord(J),this._convertFromCellCoord(Y+1),this._convertFromCellCoord(J+1)))&&w.call(this,e,n,h,g,te,S,T,P))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,n=3+this.cells.length+1+1;let h=0;for(let S=0;S=0)continue;const S=i[w];g[w]=Es[n].shallow.indexOf(w)>=0?S:Sl(S,e)}i instanceof Error&&(g.message=i.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(g.$name=n),g}function Ts(i){if(uh(i))return i;if(Array.isArray(i))return i.map(Ts);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);const e=nc(i)||"Object";if(!Es[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:n}=Es[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(i);const h=Object.create(n.prototype);for(const g of Object.keys(i)){if(g==="$name")continue;const w=i[g];h[g]=Es[e].shallow.indexOf(g)>=0?w:Ts(w)}return h}class ch{constructor(){this.first=!0}update(e,n){const h=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=n):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function rc(i){for(const e of i)if(sc(e.charCodeAt(0)))return!0;return!1}function qf(i){for(const e of i)if(!hh(e.charCodeAt(0)))return!1;return!0}function hh(i){return!(Et.Arabic(i)||Et["Arabic Supplement"](i)||Et["Arabic Extended-A"](i)||Et["Arabic Presentation Forms-A"](i)||Et["Arabic Presentation Forms-B"](i))}function sc(i){return!(i!==746&&i!==747&&(i<4352||!(Et["Bopomofo Extended"](i)||Et.Bopomofo(i)||Et["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Et["CJK Compatibility Ideographs"](i)||Et["CJK Compatibility"](i)||Et["CJK Radicals Supplement"](i)||Et["CJK Strokes"](i)||!(!Et["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Et["CJK Unified Ideographs Extension A"](i)||Et["CJK Unified Ideographs"](i)||Et["Enclosed CJK Letters and Months"](i)||Et["Hangul Compatibility Jamo"](i)||Et["Hangul Jamo Extended-A"](i)||Et["Hangul Jamo Extended-B"](i)||Et["Hangul Jamo"](i)||Et["Hangul Syllables"](i)||Et.Hiragana(i)||Et["Ideographic Description Characters"](i)||Et.Kanbun(i)||Et["Kangxi Radicals"](i)||Et["Katakana Phonetic Extensions"](i)||Et.Katakana(i)&&i!==12540||!(!Et["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Et["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Et["Unified Canadian Aboriginal Syllabics"](i)||Et["Unified Canadian Aboriginal Syllabics Extended"](i)||Et["Vertical Forms"](i)||Et["Yijing Hexagram Symbols"](i)||Et["Yi Syllables"](i)||Et["Yi Radicals"](i))))}function fh(i){return!(sc(i)||function(e){return!!(Et["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Et["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Et["Letterlike Symbols"](e)||Et["Number Forms"](e)||Et["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Et["Control Pictures"](e)&&e!==9251||Et["Optical Character Recognition"](e)||Et["Enclosed Alphanumerics"](e)||Et["Geometric Shapes"](e)||Et["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Et["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Et["CJK Symbols and Punctuation"](e)||Et.Katakana(e)||Et["Private Use Area"](e)||Et["CJK Compatibility Forms"](e)||Et["Small Form Variants"](e)||Et["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function mo(i){return i>=1424&&i<=2303||Et["Arabic Presentation Forms-A"](i)||Et["Arabic Presentation Forms-B"](i)}function dh(i,e){return!(!e&&mo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Et.Khmer(i))}function oc(i){for(const e of i)if(mo(e.charCodeAt(0)))return!0;return!1}const go=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Gi{constructor(e,n){this.zoom=e,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.zoomHistory=n.zoomHistory,this.transition=n.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ch,this.transition={})}isSupportedScript(e){return function(n,h){for(const g of n)if(!dh(g.charCodeAt(0),h))return!1;return!0}(e,go.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,n=e-Math.floor(e),h=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*n}}}class Hl{constructor(e,n){this.property=e,this.value=n,this.expression=function(h,g){if(ta(h))return new me(h,g);if(E(h)){const w=ie(h,g);if(w.result==="error")throw new Error(w.value.map(S=>`${S.key}: ${S.message}`).join(", "));return w.value}{let w=h;return g.type==="color"&&typeof h=="string"?w=ki.parse(h):g.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?g.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(w=nn.parse(h)):w=Jn.parse(h),{kind:"constant",evaluate:()=>w}}}(n===void 0?e.specification.default:n,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,n,h){return this.property.possiblyEvaluate(this,e,n,h)}}class Aa{constructor(e){this.property=e,this.value=new Hl(e,void 0)}transitioned(e,n){return new ph(this.property,this.value,n,Ze({},e.transition,this.transition),e.now)}untransitioned(){return new ph(this.property,this.value,null,{},0)}}class Ma{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Se(this._values[e].value.value)}setValue(e,n){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Aa(this._values[e].property)),this._values[e].value=new Hl(this._values[e].property,n===null?void 0:Se(n))}getTransition(e){return Se(this._values[e].transition)}setTransition(e,n){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Aa(this._values[e].property)),this._values[e].transition=Se(n)||void 0}serialize(){const e={};for(const n of Object.keys(this._values)){const h=this.getValue(n);h!==void 0&&(e[n]=h);const g=this.getTransition(n);g!==void 0&&(e[`${n}-transition`]=g)}return e}transitioned(e,n){const h=new ac(this._properties);for(const g of Object.keys(this._values))h._values[g]=this._values[g].transitioned(e,n._values[g]);return h}untransitioned(){const e=new ac(this._properties);for(const n of Object.keys(this._values))e._values[n]=this._values[n].untransitioned();return e}}class ph{constructor(e,n,h,g,w){this.property=e,this.value=n,this.begin=w+g.delay||0,this.end=this.begin+g.duration||0,e.specification.transition&&(g.delay||g.duration)&&(this.prior=h)}possiblyEvaluate(e,n,h){const g=e.now||0,w=this.value.possiblyEvaluate(e,n,h),S=this.prior;if(S){if(g>this.end)return this.prior=null,w;if(this.value.isDataDriven())return this.prior=null,w;if(g=1)return 1;const A=P*P,O=A*P;return 4*(P<.5?O:3*(P-A)+O-.75)}(T))}}return w}}class ac{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,n,h){const g=new Yl(this._properties);for(const w of Object.keys(this._values))g._values[w]=this._values[w].possiblyEvaluate(e,n,h);return g}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Il{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Se(this._values[e].value)}setValue(e,n){this._values[e]=new Hl(this._values[e].property,n===null?void 0:Se(n))}serialize(){const e={};for(const n of Object.keys(this._values)){const h=this.getValue(n);h!==void 0&&(e[n]=h)}return e}possiblyEvaluate(e,n,h){const g=new Yl(this._properties);for(const w of Object.keys(this._values))g._values[w]=this._values[w].possiblyEvaluate(e,n,h);return g}}class Cs{constructor(e,n,h){this.property=e,this.value=n,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,n,h,g){return this.property.evaluate(this.value,this.parameters,e,n,h,g)}}class Yl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Xt{constructor(e){this.specification=e}possiblyEvaluate(e,n){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(n)}interpolate(e,n,h){const g=Ki[this.specification.type];return g?g(e,n,h):e}}class ii{constructor(e,n){this.specification=e,this.overrides=n}possiblyEvaluate(e,n,h,g){return new Cs(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(n,null,{},h,g)}:e.expression,n)}interpolate(e,n,h){if(e.value.kind!=="constant"||n.value.kind!=="constant")return e;if(e.value.value===void 0||n.value.value===void 0)return new Cs(this,{kind:"constant",value:void 0},e.parameters);const g=Ki[this.specification.type];if(g){const w=g(e.value.value,n.value.value,h);return new Cs(this,{kind:"constant",value:w},e.parameters)}return e}evaluate(e,n,h,g,w,S){return e.kind==="constant"?e.value:e.evaluate(n,h,g,w,S)}}class x extends ii{possiblyEvaluate(e,n,h,g){if(e.value===void 0)return new Cs(this,{kind:"constant",value:void 0},n);if(e.expression.kind==="constant"){const w=e.expression.evaluate(n,null,{},h,g),S=e.property.specification.type==="resolvedImage"&&typeof w!="string"?w.name:w,T=this._calculate(S,S,S,n);return new Cs(this,{kind:"constant",value:T},n)}if(e.expression.kind==="camera"){const w=this._calculate(e.expression.evaluate({zoom:n.zoom-1}),e.expression.evaluate({zoom:n.zoom}),e.expression.evaluate({zoom:n.zoom+1}),n);return new Cs(this,{kind:"constant",value:w},n)}return new Cs(this,e.expression,n)}evaluate(e,n,h,g,w,S){if(e.kind==="source"){const T=e.evaluate(n,h,g,w,S);return this._calculate(T,T,T,n)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(n.zoom)-1},h,g),e.evaluate({zoom:Math.floor(n.zoom)},h,g),e.evaluate({zoom:Math.floor(n.zoom)+1},h,g),n):e.value}_calculate(e,n,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:h,to:n}}interpolate(e){return e}}class t{constructor(e){this.specification=e}possiblyEvaluate(e,n,h,g){if(e.value!==void 0){if(e.expression.kind==="constant"){const w=e.expression.evaluate(n,null,{},h,g);return this._calculate(w,w,w,n)}return this._calculate(e.expression.evaluate(new Gi(Math.floor(n.zoom-1),n)),e.expression.evaluate(new Gi(Math.floor(n.zoom),n)),e.expression.evaluate(new Gi(Math.floor(n.zoom+1),n)),n)}}_calculate(e,n,h,g){return g.zoom>g.zoomHistory.lastIntegerZoom?{from:e,to:n}:{from:h,to:n}}interpolate(e){return e}}class l{constructor(e){this.specification=e}possiblyEvaluate(e,n,h,g){return!!e.expression.evaluate(n,null,{},h,g)}interpolate(){return!1}}class p{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in e){const h=e[n];h.specification.overridable&&this.overridableProperties.push(n);const g=this.defaultPropertyValues[n]=new Hl(h,void 0),w=this.defaultTransitionablePropertyValues[n]=new Aa(h);this.defaultTransitioningPropertyValues[n]=w.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=g.possiblyEvaluate({})}}}Rt("DataDrivenProperty",ii),Rt("DataConstantProperty",Xt),Rt("CrossFadedDataDrivenProperty",x),Rt("CrossFadedProperty",t),Rt("ColorRampProperty",l);const m="-transition";class b extends Ke{constructor(e,n){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),n.layout&&(this._unevaluatedLayout=new Il(n.layout)),n.paint)){this._transitionablePaint=new Ma(n.paint);for(const h in e.paint)this.setPaintProperty(h,e.paint[h],{validate:!1});for(const h in e.layout)this.setLayoutProperty(h,e.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Yl(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,n,h={}){n!=null&&this._validate(Vf,`layers.${this.id}.layout.${e}`,e,n,h)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,n):this.visibility=n)}getPaintProperty(e){return e.endsWith(m)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,n,h={}){if(n!=null&&this._validate(Uf,`layers.${this.id}.paint.${e}`,e,n,h))return!1;if(e.endsWith(m))return this._transitionablePaint.setTransition(e.slice(0,-11),n||void 0),!1;{const g=this._transitionablePaint._values[e],w=g.property.specification["property-type"]==="cross-faded-data-driven",S=g.value.isDataDriven(),T=g.value;this._transitionablePaint.setValue(e,n),this._handleSpecialPaintPropertyUpdate(e);const P=this._transitionablePaint._values[e].value;return P.isDataDriven()||S||w||this._handleOverridablePaintPropertyUpdate(e,T,P)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,n,h){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,n){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,n)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),st(e,(n,h)=>!(n===void 0||h==="layout"&&!Object.keys(n).length||h==="paint"&&!Object.keys(n).length))}_validate(e,n,h,g,w={}){return(!w||w.validate!==!1)&&ic(this,e.call(Gs,{key:n,layerType:this.type,objectKey:h,value:g,styleSpec:Ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const n=this.paint.get(e);if(n instanceof Cs&&Ss(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const C={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class L{constructor(e,n){this._structArray=e,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class R{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,n){return e._trim(),n&&(e.isTransferred=!0,n.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const n=Object.create(this.prototype);return n.arrayBuffer=e.arrayBuffer,n.length=e.length,n.capacity=e.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function z(i,e=1){let n=0,h=0;return{members:i.map(g=>{const w=C[g.type].BYTES_PER_ELEMENT,S=n=G(n,Math.max(e,w)),T=g.components||1;return h=Math.max(h,w),n+=w*T,{name:g.name,type:g.type,components:T,offset:S}}),size:G(n,Math.max(h,e)),alignment:e}}function G(i,e){return Math.ceil(i/e)*e}class q extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n){const h=this.length;return this.resize(h+1),this.emplace(h,e,n)}emplace(e,n,h){const g=2*e;return this.int16[g+0]=n,this.int16[g+1]=h,e}}q.prototype.bytesPerElement=4,Rt("StructArrayLayout2i4",q);class K extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.int16[w+0]=n,this.int16[w+1]=h,this.int16[w+2]=g,e}}K.prototype.bytesPerElement=6,Rt("StructArrayLayout3i6",K);class ee extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g){const w=this.length;return this.resize(w+1),this.emplace(w,e,n,h,g)}emplace(e,n,h,g,w){const S=4*e;return this.int16[S+0]=n,this.int16[S+1]=h,this.int16[S+2]=g,this.int16[S+3]=w,e}}ee.prototype.bytesPerElement=8,Rt("StructArrayLayout4i8",ee);class se extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=6*e;return this.int16[P+0]=n,this.int16[P+1]=h,this.int16[P+2]=g,this.int16[P+3]=w,this.int16[P+4]=S,this.int16[P+5]=T,e}}se.prototype.bytesPerElement=12,Rt("StructArrayLayout2i4i12",se);class ue extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=4*e,A=8*e;return this.int16[P+0]=n,this.int16[P+1]=h,this.uint8[A+4]=g,this.uint8[A+5]=w,this.uint8[A+6]=S,this.uint8[A+7]=T,e}}ue.prototype.bytesPerElement=8,Rt("StructArrayLayout2i4ub8",ue);class ae extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n){const h=this.length;return this.resize(h+1),this.emplace(h,e,n)}emplace(e,n,h){const g=2*e;return this.float32[g+0]=n,this.float32[g+1]=h,e}}ae.prototype.bytesPerElement=8,Rt("StructArrayLayout2f8",ae);class fe extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S,T,P,A,O){const U=this.length;return this.resize(U+1),this.emplace(U,e,n,h,g,w,S,T,P,A,O)}emplace(e,n,h,g,w,S,T,P,A,O,U){const Z=10*e;return this.uint16[Z+0]=n,this.uint16[Z+1]=h,this.uint16[Z+2]=g,this.uint16[Z+3]=w,this.uint16[Z+4]=S,this.uint16[Z+5]=T,this.uint16[Z+6]=P,this.uint16[Z+7]=A,this.uint16[Z+8]=O,this.uint16[Z+9]=U,e}}fe.prototype.bytesPerElement=20,Rt("StructArrayLayout10ui20",fe);class ye extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S,T,P,A,O,U,Z){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,n,h,g,w,S,T,P,A,O,U,Z)}emplace(e,n,h,g,w,S,T,P,A,O,U,Z,Y){const J=12*e;return this.int16[J+0]=n,this.int16[J+1]=h,this.int16[J+2]=g,this.int16[J+3]=w,this.uint16[J+4]=S,this.uint16[J+5]=T,this.uint16[J+6]=P,this.uint16[J+7]=A,this.int16[J+8]=O,this.int16[J+9]=U,this.int16[J+10]=Z,this.int16[J+11]=Y,e}}ye.prototype.bytesPerElement=24,Rt("StructArrayLayout4i4ui4i24",ye);class oe extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.float32[w+0]=n,this.float32[w+1]=h,this.float32[w+2]=g,e}}oe.prototype.bytesPerElement=12,Rt("StructArrayLayout3f12",oe);class Ie extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint32[1*e+0]=n,e}}Ie.prototype.bytesPerElement=4,Rt("StructArrayLayout1ul4",Ie);class Me extends R{_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(e,n,h,g,w,S,T,P,A){const O=this.length;return this.resize(O+1),this.emplace(O,e,n,h,g,w,S,T,P,A)}emplace(e,n,h,g,w,S,T,P,A,O){const U=10*e,Z=5*e;return this.int16[U+0]=n,this.int16[U+1]=h,this.int16[U+2]=g,this.int16[U+3]=w,this.int16[U+4]=S,this.int16[U+5]=T,this.uint32[Z+3]=P,this.uint16[U+8]=A,this.uint16[U+9]=O,e}}Me.prototype.bytesPerElement=20,Rt("StructArrayLayout6i1ul2ui20",Me);class Be extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=6*e;return this.int16[P+0]=n,this.int16[P+1]=h,this.int16[P+2]=g,this.int16[P+3]=w,this.int16[P+4]=S,this.int16[P+5]=T,e}}Be.prototype.bytesPerElement=12,Rt("StructArrayLayout2i2i2i12",Be);class Qe extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w){const S=this.length;return this.resize(S+1),this.emplace(S,e,n,h,g,w)}emplace(e,n,h,g,w,S){const T=4*e,P=8*e;return this.float32[T+0]=n,this.float32[T+1]=h,this.float32[T+2]=g,this.int16[P+6]=w,this.int16[P+7]=S,e}}Qe.prototype.bytesPerElement=16,Rt("StructArrayLayout2f1f2i16",Qe);class ot extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,n,h,g,w,S){const T=this.length;return this.resize(T+1),this.emplace(T,e,n,h,g,w,S)}emplace(e,n,h,g,w,S,T){const P=16*e,A=4*e,O=8*e;return this.uint8[P+0]=n,this.uint8[P+1]=h,this.float32[A+1]=g,this.float32[A+2]=w,this.int16[O+6]=S,this.int16[O+7]=T,e}}ot.prototype.bytesPerElement=16,Rt("StructArrayLayout2ub2f2i16",ot);class Ct extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.uint16[w+0]=n,this.uint16[w+1]=h,this.uint16[w+2]=g,e}}Ct.prototype.bytesPerElement=6,Rt("StructArrayLayout3ui6",Ct);class At extends R{_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(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,te,le,de){const De=this.length;return this.resize(De+1),this.emplace(De,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,te,le,de)}emplace(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,te,le,de,De){const ve=24*e,Pe=12*e,qe=48*e;return this.int16[ve+0]=n,this.int16[ve+1]=h,this.uint16[ve+2]=g,this.uint16[ve+3]=w,this.uint32[Pe+2]=S,this.uint32[Pe+3]=T,this.uint32[Pe+4]=P,this.uint16[ve+10]=A,this.uint16[ve+11]=O,this.uint16[ve+12]=U,this.float32[Pe+7]=Z,this.float32[Pe+8]=Y,this.uint8[qe+36]=J,this.uint8[qe+37]=te,this.uint8[qe+38]=le,this.uint32[Pe+10]=de,this.int16[ve+22]=De,e}}At.prototype.bytesPerElement=48,Rt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",At);class at extends R{_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(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,te,le,de,De,ve,Pe,qe,nt,Pt,ei,kt,xt,Zt,zt){const Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,te,le,de,De,ve,Pe,qe,nt,Pt,ei,kt,xt,Zt,zt)}emplace(e,n,h,g,w,S,T,P,A,O,U,Z,Y,J,te,le,de,De,ve,Pe,qe,nt,Pt,ei,kt,xt,Zt,zt,Mt){const Ye=32*e,Ht=16*e;return this.int16[Ye+0]=n,this.int16[Ye+1]=h,this.int16[Ye+2]=g,this.int16[Ye+3]=w,this.int16[Ye+4]=S,this.int16[Ye+5]=T,this.int16[Ye+6]=P,this.int16[Ye+7]=A,this.uint16[Ye+8]=O,this.uint16[Ye+9]=U,this.uint16[Ye+10]=Z,this.uint16[Ye+11]=Y,this.uint16[Ye+12]=J,this.uint16[Ye+13]=te,this.uint16[Ye+14]=le,this.uint16[Ye+15]=de,this.uint16[Ye+16]=De,this.uint16[Ye+17]=ve,this.uint16[Ye+18]=Pe,this.uint16[Ye+19]=qe,this.uint16[Ye+20]=nt,this.uint16[Ye+21]=Pt,this.uint16[Ye+22]=ei,this.uint32[Ht+12]=kt,this.float32[Ht+13]=xt,this.float32[Ht+14]=Zt,this.uint16[Ye+30]=zt,this.uint16[Ye+31]=Mt,e}}at.prototype.bytesPerElement=64,Rt("StructArrayLayout8i15ui1ul2f2ui64",at);class ht extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.float32[1*e+0]=n,e}}ht.prototype.bytesPerElement=4,Rt("StructArrayLayout1f4",ht);class Nt extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=3*e;return this.uint16[6*e+0]=n,this.float32[w+1]=h,this.float32[w+2]=g,e}}Nt.prototype.bytesPerElement=12,Rt("StructArrayLayout1ui2f12",Nt);class ai extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n,h){const g=this.length;return this.resize(g+1),this.emplace(g,e,n,h)}emplace(e,n,h,g){const w=4*e;return this.uint32[2*e+0]=n,this.uint16[w+2]=h,this.uint16[w+3]=g,e}}ai.prototype.bytesPerElement=8,Rt("StructArrayLayout1ul2ui8",ai);class gt extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,n){const h=this.length;return this.resize(h+1),this.emplace(h,e,n)}emplace(e,n,h){const g=2*e;return this.uint16[g+0]=n,this.uint16[g+1]=h,e}}gt.prototype.bytesPerElement=4,Rt("StructArrayLayout2ui4",gt);class wt extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const n=this.length;return this.resize(n+1),this.emplace(n,e)}emplace(e,n){return this.uint16[1*e+0]=n,e}}wt.prototype.bytesPerElement=2,Rt("StructArrayLayout1ui2",wt);class ri extends R{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,n,h,g){const w=this.length;return this.resize(w+1),this.emplace(w,e,n,h,g)}emplace(e,n,h,g,w){const S=4*e;return this.float32[S+0]=n,this.float32[S+1]=h,this.float32[S+2]=g,this.float32[S+3]=w,e}}ri.prototype.bytesPerElement=16,Rt("StructArrayLayout4f16",ri);class Ji extends L{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 N(this.anchorPointX,this.anchorPointY)}}Ji.prototype.size=20;class gi extends Me{get(e){return new Ji(this,e)}}Rt("CollisionBoxArray",gi);class xi extends L{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}xi.prototype.size=48;class Qi extends At{get(e){return new xi(this,e)}}Rt("PlacedSymbolArray",Qi);class Qn extends L{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}Qn.prototype.size=64;class ts extends at{get(e){return new Qn(this,e)}}Rt("SymbolInstanceArray",ts);class $i extends ht{getoffsetX(e){return this.float32[1*e+0]}}Rt("GlyphOffsetArray",$i);class Sr extends K{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Rt("SymbolLineVertexArray",Sr);class yr extends L{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]}}yr.prototype.size=12;class $n extends Nt{get(e){return new yr(this,e)}}Rt("TextAnchorOffsetArray",$n);class er extends L{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]}}er.prototype.size=8;class is extends ai{get(e){return new er(this,e)}}Rt("FeatureIndexArray",is);class ra extends q{}class Kl extends q{}class Ra extends q{}class sa extends se{}class Jl extends ue{}class lc extends ae{}class Wn extends fe{}class ns extends ye{}class yo extends oe{}class Da extends Ie{}class tr extends Be{}class ir extends ot{}class Bn extends Ct{}class an extends gt{}const za=z([{name:"a_pos",components:2,type:"Int16"}],4),{members:uc}=za;class Cn{constructor(e=[]){this.segments=e}prepareSegment(e,n,h,g){let w=this.segments[this.segments.length-1];return e>Cn.MAX_VERTEX_ARRAY_LENGTH&&_t(`Max vertices per segment is ${Cn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!w||w.vertexLength+e>Cn.MAX_VERTEX_ARRAY_LENGTH||w.sortKey!==g)&&(w={vertexOffset:n.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},g!==void 0&&(w.sortKey=g),this.segments.push(w)),w}get(){return this.segments}destroy(){for(const e of this.segments)for(const n in e.vaos)e.vaos[n].destroy()}static simpleSegment(e,n,h,g){return new Cn([{vertexOffset:e,primitiveOffset:n,vertexLength:h,primitiveLength:g,vaos:{},sortKey:0}])}}function mh(i,e){return 256*(i=ze(Math.floor(i),0,255))+ze(Math.floor(e),0,255)}Cn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Rt("SegmentVector",Cn);const Ql=z([{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 $l={exports:{}},_o={exports:{}};_o.exports=function(i,e){var n,h,g,w,S,T,P,A;for(h=i.length-(n=3&i.length),g=e,S=3432918353,T=461845907,A=0;A>>16)*S&65535)<<16)&4294967295)<<15|P>>>17))*T+(((P>>>16)*T&65535)<<16)&4294967295)<<13|g>>>19))+((5*(g>>>16)&65535)<<16)&4294967295))+((58964+(w>>>16)&65535)<<16);switch(P=0,n){case 3:P^=(255&i.charCodeAt(A+2))<<16;case 2:P^=(255&i.charCodeAt(A+1))<<8;case 1:g^=P=(65535&(P=(P=(65535&(P^=255&i.charCodeAt(A)))*S+(((P>>>16)*S&65535)<<16)&4294967295)<<15|P>>>17))*T+(((P>>>16)*T&65535)<<16)&4294967295}return g^=i.length,g=2246822507*(65535&(g^=g>>>16))+((2246822507*(g>>>16)&65535)<<16)&4294967295,g=3266489909*(65535&(g^=g>>>13))+((3266489909*(g>>>16)&65535)<<16)&4294967295,(g^=g>>>16)>>>0};var gh=_o.exports,cc={exports:{}};cc.exports=function(i,e){for(var n,h=i.length,g=e^h,w=0;h>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(w)|(255&i.charCodeAt(++w))<<8|(255&i.charCodeAt(++w))<<16|(255&i.charCodeAt(++w))<<24))+((1540483477*(n>>>16)&65535)<<16),g=1540483477*(65535&g)+((1540483477*(g>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),h-=4,++w;switch(h){case 3:g^=(255&i.charCodeAt(w+2))<<16;case 2:g^=(255&i.charCodeAt(w+1))<<8;case 1:g=1540483477*(65535&(g^=255&i.charCodeAt(w)))+((1540483477*(g>>>16)&65535)<<16)}return g=1540483477*(65535&(g^=g>>>13))+((1540483477*(g>>>16)&65535)<<16),(g^=g>>>15)>>>0};var hc=gh,fc=cc.exports;$l.exports=hc,$l.exports.murmur3=hc,$l.exports.murmur2=fc;var eu=D($l.exports);class Na{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,n,h,g){this.ids.push(gm(e)),this.positions.push(n,h,g)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=gm(e);let h=0,g=this.ids.length-1;for(;h>1;this.ids[S]>=n?g=S:h=S+1}const w=[];for(;this.ids[h]===n;)w.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return w}static serialize(e,n){const h=new Float64Array(e.ids),g=new Uint32Array(e.positions);return Gf(h,g,0,h.length-1),n&&n.push(h.buffer,g.buffer),{ids:h,positions:g}}static deserialize(e){const n=new Na;return n.ids=e.ids,n.positions=e.positions,n.indexed=!0,n}}function gm(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:eu(String(i))}function Gf(i,e,n,h){for(;n>1];let w=n-1,S=h+1;for(;;){do w++;while(i[w]g);if(w>=S)break;yh(i,w,S),yh(e,3*w,3*S),yh(e,3*w+1,3*S+1),yh(e,3*w+2,3*S+2)}S-n`u_${g}`),this.type=h}setUniform(e,n,h){e.set(h.constantOr(this.value))}getBinding(e,n,h){return this.type==="color"?new _m(e,n):new _h(e,n)}}class tu{constructor(e,n){this.uniformNames=n.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=e.tlbr}setUniform(e,n,h,g){const w=g==="u_pattern_to"?this.patternTo:g==="u_pattern_from"?this.patternFrom:g==="u_pixel_ratio_to"?this.pixelRatioTo:g==="u_pixel_ratio_from"?this.pixelRatioFrom:null;w&&e.set(w)}getBinding(e,n,h){return h.substr(0,9)==="u_pattern"?new ym(e,n):new _h(e,n)}}class oa{constructor(e,n,h,g){this.expression=e,this.type=h,this.maxValue=0,this.paintVertexAttributes=n.map(w=>({name:`a_${w}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(e,n,h,g,w){const S=this.paintVertexArray.length,T=this.expression.evaluate(new Gi(0),n,{},g,[],w);this.paintVertexArray.resize(e),this._setPaintValue(S,e,T)}updatePaintArray(e,n,h,g){const w=this.expression.evaluate({zoom:0},h,g);this._setPaintValue(e,n,w)}_setPaintValue(e,n,h){if(this.type==="color"){const g=Zf(h);for(let w=e;w`u_${T}_t`),this.type=h,this.useIntegerZoom=g,this.zoom=w,this.maxValue=0,this.paintVertexAttributes=n.map(T=>({name:`a_${T}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(e,n,h,g,w){const S=this.expression.evaluate(new Gi(this.zoom),n,{},g,[],w),T=this.expression.evaluate(new Gi(this.zoom+1),n,{},g,[],w),P=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(P,e,S,T)}updatePaintArray(e,n,h,g){const w=this.expression.evaluate({zoom:this.zoom},h,g),S=this.expression.evaluate({zoom:this.zoom+1},h,g);this._setPaintValue(e,n,w,S)}_setPaintValue(e,n,h,g){if(this.type==="color"){const w=Zf(h),S=Zf(g);for(let T=e;T`#define HAS_UNIFORM_${g}`))}return e}getBinderAttributes(){const e=[];for(const n in this.binders){const h=this.binders[n];if(h instanceof oa||h instanceof Zs)for(let g=0;g!0){this.programConfigurations={};for(const g of e)this.programConfigurations[g.id]=new vm(g,n,h);this.needsUpload=!1,this._featureMap=new Na,this._bufferOffset=0}populatePaintArrays(e,n,h,g,w,S){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(e,n,g,w,S);n.id!==void 0&&this._featureMap.add(n.id,h,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,n,h,g){for(const w of h)this.needsUpload=this.programConfigurations[w.id].updatePaintArrays(e,this._featureMap,n,w,g)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function B1(i,e){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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function xm(i,e,n){const h={color:{source:ae,composite:ri},number:{source:ht,composite:ae}},g=function(w){return{"line-pattern":{source:Wn,composite:Wn},"fill-pattern":{source:Wn,composite:Wn},"fill-extrusion-pattern":{source:Wn,composite:Wn}}[w]}(i);return g&&g[n]||h[e][n]}Rt("ConstantBinder",dc),Rt("CrossFadedConstantBinder",tu),Rt("SourceExpressionBinder",oa),Rt("CrossFadedCompositeBinder",Oa),Rt("CompositeExpressionBinder",Zs),Rt("ProgramConfiguration",vm,{omit:["_buffers"]}),Rt("ProgramConfigurationSet",Tl);const Sn=8192,Wf=Math.pow(2,14)-1,bm=-Wf-1;function Cl(i){const e=Sn/i.extent,n=i.loadGeometry();for(let h=0;hS.x+1||PS.y+1)&&_t("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function Pl(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Cl(i):[]}}function vh(i,e,n,h,g){i.emplaceBack(2*e+(h+1)/2,2*n+(g+1)/2)}class Xf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Kl,this.indexArray=new Bn,this.segments=new Cn,this.programConfigurations=new Tl(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){const g=this.layers[0],w=[];let S=null,T=!1;g.type==="circle"&&(S=g.layout.get("circle-sort-key"),T=!S.isConstant());for(const{feature:P,id:A,index:O,sourceLayerIndex:U}of e){const Z=this.layers[0]._featureFilter.needGeometry,Y=Pl(P,Z);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),Y,h))continue;const J=T?S.evaluate(Y,{},h):void 0,te={id:A,properties:P.properties,type:P.type,sourceLayerIndex:U,index:O,geometry:Z?Y.geometry:Cl(P),patterns:{},sortKey:J};w.push(te)}T&&w.sort((P,A)=>P.sortKey-A.sortKey);for(const P of w){const{geometry:A,index:O,sourceLayerIndex:U}=P,Z=e[O].feature;this.addFeature(P,A,O,h),n.featureIndex.insert(Z,A,O,U,this.index)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,n,h,g){for(const w of n)for(const S of w){const T=S.x,P=S.y;if(T<0||T>=Sn||P<0||P>=Sn)continue;const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),O=A.vertexLength;vh(this.layoutVertexArray,T,P,-1,-1),vh(this.layoutVertexArray,T,P,1,-1),vh(this.layoutVertexArray,T,P,1,1),vh(this.layoutVertexArray,T,P,-1,1),this.indexArray.emplaceBack(O,O+1,O+2),this.indexArray.emplaceBack(O,O+3,O+2),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},g)}}function wm(i,e){for(let n=0;n1){if(Hf(i,e))return!0;for(let h=0;h1?n:n.sub(e)._mult(g)._add(e))}function Im(i,e){let n,h,g,w=!1;for(let S=0;Se.y!=g.y>e.y&&e.x<(g.x-h.x)*(e.y-h.y)/(g.y-h.y)+h.x&&(w=!w)}return w}function iu(i,e){let n=!1;for(let h=0,g=i.length-1;he.y!=S.y>e.y&&e.x<(S.x-w.x)*(e.y-w.y)/(S.y-w.y)+w.x&&(n=!n)}return n}function q1(i,e,n){const h=n[0],g=n[2];if(i.xg.x&&e.x>g.x||i.yg.y&&e.y>g.y)return!1;const w=We(i,e,n[0]);return w!==We(i,e,n[1])||w!==We(i,e,n[2])||w!==We(i,e,n[3])}function pc(i,e,n){const h=e.paint.get(i).value;return h.kind==="constant"?h.value:n.programConfigurations.get(e.id).getMaxValue(i)}function xh(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function bh(i,e,n,h,g){if(!e[0]&&!e[1])return i;const w=N.convert(e)._mult(g);n==="viewport"&&w._rotate(-h);const S=[];for(let T=0;TPm(le,te))}(A,P),Y=U?O*T:O;for(const J of g)for(const te of J){const le=U?te:Pm(te,P);let de=Y;const De=wh([],[te.x,te.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?de*=De[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(de*=S.cameraToCenterDistance/De[3]),j1(Z,le,de))return!0}return!1}}function Pm(i,e){const n=wh([],[i.x,i.y,0,1],e);return new N(n[0]/n[3],n[1]/n[3])}class Lm extends Xf{}let Am;Rt("HeatmapBucket",Lm,{omit:["layers"]});var X1={get paint(){return Am=Am||new p({"heatmap-radius":new ii(Ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ii(Ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Xt(Ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new l(Ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Xt(Ne.paint_heatmap["heatmap-opacity"])})}};function Jf(i,{width:e,height:n},h,g){if(g){if(g instanceof Uint8ClampedArray)g=new Uint8Array(g.buffer);else if(g.length!==e*n*h)throw new RangeError(`mismatched image size. expected: ${g.length} but got: ${e*n*h}`)}else g=new Uint8Array(e*n*h);return i.width=e,i.height=n,i.data=g,i}function Mm(i,{width:e,height:n},h){if(e===i.width&&n===i.height)return;const g=Jf({},{width:e,height:n},h);Qf(i,g,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,n)},h),i.width=e,i.height=n,i.data=g.data}function Qf(i,e,n,h,g,w){if(g.width===0||g.height===0)return e;if(g.width>i.width||g.height>i.height||n.x>i.width-g.width||n.y>i.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>e.width||g.height>e.height||h.x>e.width-g.width||h.y>e.height-g.height)throw new RangeError("out of range destination coordinates for image copy");const S=i.data,T=e.data;if(S===T)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P{e[i.evaluationKey]=P;const A=i.expression.evaluate(e);g.data[S+T+0]=Math.floor(255*A.r/A.a),g.data[S+T+1]=Math.floor(255*A.g/A.a),g.data[S+T+2]=Math.floor(255*A.b/A.a),g.data[S+T+3]=Math.floor(255*A.a)};if(i.clips)for(let S=0,T=0;S80*n){T=1/0,P=1/0;let O=-1/0,U=-1/0;for(let Z=n;ZO&&(O=Y),J>U&&(U=J)}A=Math.max(O-T,U-P),A=A!==0?32767/A:0}return yc(w,S,n,T,P,A,0),S}function Nm(i,e,n,h,g){let w;if(g===function(S,T,P,A){let O=0;for(let U=T,Z=P-A;U0)for(let S=e;S=e;S-=h)w=Bm(S/h|0,i[S],i[S+1],w);return w&&kh(w,w.next)&&(vc(w),w=w.next),w}function Ll(i,e){if(!i)return i;e||(e=i);let n,h=i;do if(n=!1,h.steiner||!kh(h,h.next)&&_n(h.prev,h,h.next)!==0)h=h.next;else{if(vc(h),h=e=h.prev,h===h.next)break;n=!0}while(n||h!==e);return e}function yc(i,e,n,h,g,w,S){if(!i)return;!S&&w&&function(P,A,O,U){let Z=P;do Z.z===0&&(Z.z=$f(Z.x,Z.y,A,O,U)),Z.prevZ=Z.prev,Z.nextZ=Z.next,Z=Z.next;while(Z!==P);Z.prevZ.nextZ=null,Z.prevZ=null,function(Y){let J,te=1;do{let le,de=Y;Y=null;let De=null;for(J=0;de;){J++;let ve=de,Pe=0;for(let nt=0;nt0||qe>0&&ve;)Pe!==0&&(qe===0||!ve||de.z<=ve.z)?(le=de,de=de.nextZ,Pe--):(le=ve,ve=ve.nextZ,qe--),De?De.nextZ=le:Y=le,le.prevZ=De,De=le;de=ve}De.nextZ=null,te*=2}while(J>1)}(Z)}(i,h,g,w);let T=i;for(;i.prev!==i.next;){const P=i.prev,A=i.next;if(w?ex(i,h,g,w):$1(i))e.push(P.i,i.i,A.i),vc(i),i=A.next,T=A.next;else if((i=A)===T){S?S===1?yc(i=tx(Ll(i),e),e,n,h,g,w,2):S===2&&ix(i,e,n,h,g,w):yc(Ll(i),e,n,h,g,w,1);break}}}function $1(i){const e=i.prev,n=i,h=i.next;if(_n(e,n,h)>=0)return!1;const g=e.x,w=n.x,S=h.x,T=e.y,P=n.y,A=h.y,O=gw?g>S?g:S:w>S?w:S,Y=T>P?T>A?T:A:P>A?P:A;let J=h.next;for(;J!==e;){if(J.x>=O&&J.x<=Z&&J.y>=U&&J.y<=Y&&ru(g,T,w,P,S,A,J.x,J.y)&&_n(J.prev,J,J.next)>=0)return!1;J=J.next}return!0}function ex(i,e,n,h){const g=i.prev,w=i,S=i.next;if(_n(g,w,S)>=0)return!1;const T=g.x,P=w.x,A=S.x,O=g.y,U=w.y,Z=S.y,Y=TP?T>A?T:A:P>A?P:A,le=O>U?O>Z?O:Z:U>Z?U:Z,de=$f(Y,J,e,n,h),De=$f(te,le,e,n,h);let ve=i.prevZ,Pe=i.nextZ;for(;ve&&ve.z>=de&&Pe&&Pe.z<=De;){if(ve.x>=Y&&ve.x<=te&&ve.y>=J&&ve.y<=le&&ve!==g&&ve!==S&&ru(T,O,P,U,A,Z,ve.x,ve.y)&&_n(ve.prev,ve,ve.next)>=0||(ve=ve.prevZ,Pe.x>=Y&&Pe.x<=te&&Pe.y>=J&&Pe.y<=le&&Pe!==g&&Pe!==S&&ru(T,O,P,U,A,Z,Pe.x,Pe.y)&&_n(Pe.prev,Pe,Pe.next)>=0))return!1;Pe=Pe.nextZ}for(;ve&&ve.z>=de;){if(ve.x>=Y&&ve.x<=te&&ve.y>=J&&ve.y<=le&&ve!==g&&ve!==S&&ru(T,O,P,U,A,Z,ve.x,ve.y)&&_n(ve.prev,ve,ve.next)>=0)return!1;ve=ve.prevZ}for(;Pe&&Pe.z<=De;){if(Pe.x>=Y&&Pe.x<=te&&Pe.y>=J&&Pe.y<=le&&Pe!==g&&Pe!==S&&ru(T,O,P,U,A,Z,Pe.x,Pe.y)&&_n(Pe.prev,Pe,Pe.next)>=0)return!1;Pe=Pe.nextZ}return!0}function tx(i,e){let n=i;do{const h=n.prev,g=n.next.next;!kh(h,g)&&Om(h,n,n.next,g)&&_c(h,g)&&_c(g,h)&&(e.push(h.i,n.i,g.i),vc(n),vc(n.next),n=i=g),n=n.next}while(n!==i);return Ll(n)}function ix(i,e,n,h,g,w){let S=i;do{let T=S.next.next;for(;T!==S.prev;){if(S.i!==T.i&&ax(S,T)){let P=Fm(S,T);return S=Ll(S,S.next),P=Ll(P,P.next),yc(S,e,n,h,g,w,0),void yc(P,e,n,h,g,w,0)}T=T.next}S=S.next}while(S!==i)}function nx(i,e){return i.x-e.x}function rx(i,e){const n=function(g,w){let S=w;const T=g.x,P=g.y;let A,O=-1/0;do{if(P<=S.y&&P>=S.next.y&&S.next.y!==S.y){const te=S.x+(P-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(te<=T&&te>O&&(O=te,A=S.x=S.x&&S.x>=Z&&T!==S.x&&ru(PA.x||S.x===A.x&&sx(A,S)))&&(A=S,J=te)}S=S.next}while(S!==U);return A}(i,e);if(!n)return e;const h=Fm(n,i);return Ll(h,h.next),Ll(n,n.next)}function sx(i,e){return _n(i.prev,i,e.prev)<0&&_n(e.next,i,i.next)<0}function $f(i,e,n,h,g){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-n)*g|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-h)*g|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ox(i){let e=i,n=i;do(e.x=(i-S)*(w-T)&&(i-S)*(h-T)>=(n-S)*(e-T)&&(n-S)*(w-T)>=(g-S)*(h-T)}function ax(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(n,h){let g=n;do{if(g.i!==n.i&&g.next.i!==n.i&&g.i!==h.i&&g.next.i!==h.i&&Om(g,g.next,n,h))return!0;g=g.next}while(g!==n);return!1}(i,e)&&(_c(i,e)&&_c(e,i)&&function(n,h){let g=n,w=!1;const S=(n.x+h.x)/2,T=(n.y+h.y)/2;do g.y>T!=g.next.y>T&&g.next.y!==g.y&&S<(g.next.x-g.x)*(T-g.y)/(g.next.y-g.y)+g.x&&(w=!w),g=g.next;while(g!==n);return w}(i,e)&&(_n(i.prev,i,e.prev)||_n(i,e.prev,e))||kh(i,e)&&_n(i.prev,i,i.next)>0&&_n(e.prev,e,e.next)>0)}function _n(i,e,n){return(e.y-i.y)*(n.x-e.x)-(e.x-i.x)*(n.y-e.y)}function kh(i,e){return i.x===e.x&&i.y===e.y}function Om(i,e,n,h){const g=Ih(_n(i,e,n)),w=Ih(_n(i,e,h)),S=Ih(_n(n,h,i)),T=Ih(_n(n,h,e));return g!==w&&S!==T||!(g!==0||!Sh(i,n,e))||!(w!==0||!Sh(i,h,e))||!(S!==0||!Sh(n,i,h))||!(T!==0||!Sh(n,e,h))}function Sh(i,e,n){return e.x<=Math.max(i.x,n.x)&&e.x>=Math.min(i.x,n.x)&&e.y<=Math.max(i.y,n.y)&&e.y>=Math.min(i.y,n.y)}function Ih(i){return i>0?1:i<0?-1:0}function _c(i,e){return _n(i.prev,i,i.next)<0?_n(i,e,i.next)>=0&&_n(i,i.prev,e)>=0:_n(i,e,i.prev)<0||_n(i,i.next,e)<0}function Fm(i,e){const n=ed(i.i,i.x,i.y),h=ed(e.i,e.x,e.y),g=i.next,w=e.prev;return i.next=e,e.prev=i,n.next=g,g.prev=n,h.next=n,n.prev=h,w.next=h,h.prev=w,h}function Bm(i,e,n,h){const g=ed(i,e,n);return h?(g.next=h.next,g.prev=h,h.next.prev=g,h.next=g):(g.prev=g,g.next=g),g}function vc(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ed(i,e,n){return{i,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function td(i,e,n){const h=n.patternDependencies;let g=!1;for(const w of e){const S=w.paint.get(`${i}-pattern`);S.isConstant()||(g=!0);const T=S.constantOr(null);T&&(g=!0,h[T.to]=!0,h[T.from]=!0)}return g}function id(i,e,n,h,g){const w=g.patternDependencies;for(const S of e){const T=S.paint.get(`${i}-pattern`).value;if(T.kind!=="constant"){let P=T.evaluate({zoom:h-1},n,{},g.availableImages),A=T.evaluate({zoom:h},n,{},g.availableImages),O=T.evaluate({zoom:h+1},n,{},g.availableImages);P=P&&P.name?P.name:P,A=A&&A.name?A.name:A,O=O&&O.name?O.name:O,w[P]=!0,w[A]=!0,w[O]=!0,n.patterns[S.id]={min:P,mid:A,max:O}}}return n}class nd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ra,this.indexArray=new Bn,this.indexArray2=new an,this.programConfigurations=new Tl(e.layers,e.zoom),this.segments=new Cn,this.segments2=new Cn,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){this.hasPattern=td("fill",this.layers,n);const g=this.layers[0].layout.get("fill-sort-key"),w=!g.isConstant(),S=[];for(const{feature:T,id:P,index:A,sourceLayerIndex:O}of e){const U=this.layers[0]._featureFilter.needGeometry,Z=Pl(T,U);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),Z,h))continue;const Y=w?g.evaluate(Z,{},h,n.availableImages):void 0,J={id:P,properties:T.properties,type:T.type,sourceLayerIndex:O,index:A,geometry:U?Z.geometry:Cl(T),patterns:{},sortKey:Y};S.push(J)}w&&S.sort((T,P)=>T.sortKey-P.sortKey);for(const T of S){const{geometry:P,index:A,sourceLayerIndex:O}=T;if(this.hasPattern){const U=id("fill",this.layers,T,this.zoom,n);this.patternFeatures.push(U)}else this.addFeature(T,P,A,h,{});n.featureIndex.insert(e[A].feature,P,A,O,this.index)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}addFeatures(e,n,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,n,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Q1),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,n,h,g,w){for(const S of Yo(n,500)){let T=0;for(const Y of S)T+=Y.length;const P=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),A=P.vertexLength,O=[],U=[];for(const Y of S){if(Y.length===0)continue;Y!==S[0]&&U.push(O.length/2);const J=this.segments2.prepareSegment(Y.length,this.layoutVertexArray,this.indexArray2),te=J.vertexLength;this.layoutVertexArray.emplaceBack(Y[0].x,Y[0].y),this.indexArray2.emplaceBack(te+Y.length-1,te),O.push(Y[0].x),O.push(Y[0].y);for(let le=1;le>3}if(g--,h===1||h===2)w+=i.readSVarint(),S+=i.readSVarint(),h===1&&(e&&T.push(e),e=[]),e.push(new dx(w,S));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&T.push(e),T},su.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,n=1,h=0,g=0,w=0,S=1/0,T=-1/0,P=1/0,A=-1/0;i.pos>3}if(h--,n===1||n===2)(g+=i.readSVarint())T&&(T=g),(w+=i.readSVarint())A&&(A=w);else if(n!==7)throw new Error("unknown command "+n)}return[S,P,T,A]},su.prototype.toGeoJSON=function(i,e,n){var h,g,w=this.extent*Math.pow(2,n),S=this.extent*i,T=this.extent*e,P=this.loadGeometry(),A=su.types[this.type];function O(Y){for(var J=0;J>3;g=S===1?h.readString():S===2?h.readFloat():S===3?h.readDouble():S===4?h.readVarint64():S===5?h.readVarint():S===6?h.readSVarint():S===7?h.readBoolean():null}return g}(n))}Gm.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new gx(this._pbf,e,this.extent,this._keys,this._values)};var _x=qm;function vx(i,e,n){if(i===3){var h=new _x(n,n.readVarint()+n.pos);h.length&&(e[h.name]=h)}}Fa.VectorTile=function(i,e){this.layers=i.readFields(vx,{},e)},Fa.VectorTileFeature=Vm,Fa.VectorTileLayer=qm;const xx=Fa.VectorTileFeature.types,rd=Math.pow(2,13);function xc(i,e,n,h,g,w,S,T){i.emplaceBack(e,n,2*Math.floor(h*rd)+S,g*rd*2,w*rd*2,Math.round(T))}class sd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new sa,this.centroidVertexArray=new ra,this.indexArray=new Bn,this.programConfigurations=new Tl(e.layers,e.zoom),this.segments=new Cn,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){this.features=[],this.hasPattern=td("fill-extrusion",this.layers,n);for(const{feature:g,id:w,index:S,sourceLayerIndex:T}of e){const P=this.layers[0]._featureFilter.needGeometry,A=Pl(g,P);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),A,h))continue;const O={id:w,sourceLayerIndex:T,index:S,geometry:P?A.geometry:Cl(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(id("fill-extrusion",this.layers,O,this.zoom,n)):this.addFeature(O,O.geometry,S,h,{}),n.featureIndex.insert(g,O.geometry,S,T,this.index,!0)}}addFeatures(e,n,h){for(const g of this.features){const{geometry:w}=g;this.addFeature(g,w,g.index,n,h)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fx),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,hx.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,n,h,g,w){for(const S of Yo(n,500)){const T={x:0,y:0,vertexCount:0};let P=0;for(const J of S)P+=J.length;let A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const J of S){if(J.length===0||wx(J))continue;let te=0;for(let le=0;le=1){const De=J[le-1];if(!bx(de,De)){A.vertexLength+4>Cn.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ve=de.sub(De)._perp()._unit(),Pe=De.dist(de);te+Pe>32768&&(te=0),xc(this.layoutVertexArray,de.x,de.y,ve.x,ve.y,0,0,te),xc(this.layoutVertexArray,de.x,de.y,ve.x,ve.y,0,1,te),T.x+=2*de.x,T.y+=2*de.y,T.vertexCount+=2,te+=Pe,xc(this.layoutVertexArray,De.x,De.y,ve.x,ve.y,0,0,te),xc(this.layoutVertexArray,De.x,De.y,ve.x,ve.y,0,1,te),T.x+=2*De.x,T.y+=2*De.y,T.vertexCount+=2;const qe=A.vertexLength;this.indexArray.emplaceBack(qe,qe+2,qe+1),this.indexArray.emplaceBack(qe+1,qe+2,qe+3),A.vertexLength+=4,A.primitiveLength+=2}}}}if(A.vertexLength+P>Cn.MAX_VERTEX_ARRAY_LENGTH&&(A=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),xx[e.type]!=="Polygon")continue;const O=[],U=[],Z=A.vertexLength;for(const J of S)if(J.length!==0){J!==S[0]&&U.push(O.length/2);for(let te=0;teSn)||i.y===e.y&&(i.y<0||i.y>Sn)}function wx(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Sn)||i.every(e=>e.y<0)||i.every(e=>e.y>Sn)}let Zm;Rt("FillExtrusionBucket",sd,{omit:["layers","features"]});var kx={get paint(){return Zm=Zm||new p({"fill-extrusion-opacity":new Xt(Ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ii(Ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Xt(Ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Xt(Ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new x(Ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ii(Ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ii(Ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Xt(Ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Sx extends b{constructor(e){super(e,kx)}createBucket(e){return new sd(e)}queryRadius(){return xh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,n,h,g,w,S,T,P){const A=bh(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,T),O=this.paint.get("fill-extrusion-height").evaluate(n,h),U=this.paint.get("fill-extrusion-base").evaluate(n,h),Z=function(J,te,le,de){const De=[];for(const ve of J){const Pe=[ve.x,ve.y,0,1];wh(Pe,Pe,te),De.push(new N(Pe[0]/Pe[3],Pe[1]/Pe[3]))}return De}(A,P),Y=function(J,te,le,de){const De=[],ve=[],Pe=de[8]*te,qe=de[9]*te,nt=de[10]*te,Pt=de[11]*te,ei=de[8]*le,kt=de[9]*le,xt=de[10]*le,Zt=de[11]*le;for(const zt of J){const Mt=[],Ye=[];for(const Ht of zt){const Vt=Ht.x,oi=Ht.y,Vi=de[0]*Vt+de[4]*oi+de[12],Fi=de[1]*Vt+de[5]*oi+de[13],jn=de[2]*Vt+de[6]*oi+de[14],Ps=de[3]*Vt+de[7]*oi+de[15],rr=jn+nt,pn=Ps+Pt,Er=Vi+ei,Tr=Fi+kt,Cr=jn+xt,mn=Ps+Zt,Un=new N((Vi+Pe)/pn,(Fi+qe)/pn);Un.z=rr/pn,Mt.push(Un);const _r=new N(Er/mn,Tr/mn);_r.z=Cr/mn,Ye.push(_r)}De.push(Mt),ve.push(Ye)}return[De,ve]}(g,U,O,P);return function(J,te,le){let de=1/0;km(le,te)&&(de=Wm(le,te[0]));for(let De=0;Den.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new Jl,this.layoutVertexArray2=new lc,this.indexArray=new Bn,this.programConfigurations=new Tl(e.layers,e.zoom),this.segments=new Cn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(e,n,h){this.hasPattern=td("line",this.layers,n);const g=this.layers[0].layout.get("line-sort-key"),w=!g.isConstant(),S=[];for(const{feature:T,id:P,index:A,sourceLayerIndex:O}of e){const U=this.layers[0]._featureFilter.needGeometry,Z=Pl(T,U);if(!this.layers[0]._featureFilter.filter(new Gi(this.zoom),Z,h))continue;const Y=w?g.evaluate(Z,{},h):void 0,J={id:P,properties:T.properties,type:T.type,sourceLayerIndex:O,index:A,geometry:U?Z.geometry:Cl(T),patterns:{},sortKey:Y};S.push(J)}w&&S.sort((T,P)=>T.sortKey-P.sortKey);for(const T of S){const{geometry:P,index:A,sourceLayerIndex:O}=T;if(this.hasPattern){const U=id("line",this.layers,T,this.zoom,n);this.patternFeatures.push(U)}else this.addFeature(T,P,A,h,{});n.featureIndex.insert(e[A].feature,P,A,O,this.index)}}update(e,n,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,n,this.stateDependentLayers,h)}addFeatures(e,n,h){for(const g of this.patternFeatures)this.addFeature(g,g.geometry,g.index,n,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Cx)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ex),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,n,h,g,w){const S=this.layers[0].layout,T=S.get("line-join").evaluate(e,{}),P=S.get("line-cap"),A=S.get("line-miter-limit"),O=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const U of n)this.addLine(U,e,T,P,A,O);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,w,g)}addLine(e,n,h,g,w,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let de=0;de=2&&e[P-1].equals(e[P-2]);)P--;let A=0;for(;A0;if(Pt&&de>A){const Zt=Z.dist(Y);if(Zt>2*O){const zt=Z.sub(Z.sub(Y)._mult(O/Zt)._round());this.updateDistance(Y,zt),this.addCurrentVertex(zt,te,0,0,U),Y=zt}}const kt=Y&&J;let xt=kt?h:T?"butt":g;if(kt&&xt==="round"&&(qew&&(xt="bevel"),xt==="bevel"&&(qe>2&&(xt="flipbevel"),qe100)De=le.mult(-1);else{const Zt=qe*te.add(le).mag()/te.sub(le).mag();De._perp()._mult(Zt*(ei?-1:1))}this.addCurrentVertex(Z,De,0,0,U),this.addCurrentVertex(Z,De.mult(-1),0,0,U)}else if(xt==="bevel"||xt==="fakeround"){const Zt=-Math.sqrt(qe*qe-1),zt=ei?Zt:0,Mt=ei?0:Zt;if(Y&&this.addCurrentVertex(Z,te,zt,Mt,U),xt==="fakeround"){const Ye=Math.round(180*nt/Math.PI/20);for(let Ht=1;Ht2*O){const zt=Z.add(J.sub(Z)._mult(O/Zt)._round());this.updateDistance(Z,zt),this.addCurrentVertex(zt,le,0,0,U),Z=zt}}}}addCurrentVertex(e,n,h,g,w,S=!1){const T=n.y*g-n.x,P=-n.y-n.x*g;this.addHalfVertex(e,n.x+n.y*h,n.y-n.x*h,S,!1,h,w),this.addHalfVertex(e,T,P,S,!0,-g,w),this.distance>Xm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,n,h,g,w,S))}addHalfVertex({x:e,y:n},h,g,w,S,T,P){const A=.5*(this.lineClips?this.scaledDistance*(Xm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(w?1:0),(n<<1)+(S?1:0),Math.round(63*h)+128,Math.round(63*g)+128,1+(T===0?0:T<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 O=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,O),P.primitiveLength++),S?this.e2=O:this.e1=O}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,n){this.distance+=e.dist(n),this.updateScaledDistance()}}let Hm,Ym;Rt("LineBucket",od,{omit:["layers","patternFeatures"]});var Km={get paint(){return Ym=Ym||new p({"line-opacity":new ii(Ne.paint_line["line-opacity"]),"line-color":new ii(Ne.paint_line["line-color"]),"line-translate":new Xt(Ne.paint_line["line-translate"]),"line-translate-anchor":new Xt(Ne.paint_line["line-translate-anchor"]),"line-width":new ii(Ne.paint_line["line-width"]),"line-gap-width":new ii(Ne.paint_line["line-gap-width"]),"line-offset":new ii(Ne.paint_line["line-offset"]),"line-blur":new ii(Ne.paint_line["line-blur"]),"line-dasharray":new t(Ne.paint_line["line-dasharray"]),"line-pattern":new x(Ne.paint_line["line-pattern"]),"line-gradient":new l(Ne.paint_line["line-gradient"])})},get layout(){return Hm=Hm||new p({"line-cap":new Xt(Ne.layout_line["line-cap"]),"line-join":new ii(Ne.layout_line["line-join"]),"line-miter-limit":new Xt(Ne.layout_line["line-miter-limit"]),"line-round-limit":new Xt(Ne.layout_line["line-round-limit"]),"line-sort-key":new ii(Ne.layout_line["line-sort-key"])})}};class Ax extends ii{possiblyEvaluate(e,n){return n=new Gi(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(e,n)}evaluate(e,n,h,g){return n=Ze({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(e,n,h,g)}}let Eh;class Mx extends b{constructor(e){super(e,Km),this.gradientVersion=0,Eh||(Eh=new Ax(Km.paint.properties["line-width"].specification),Eh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const n=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(n)&&n._styleExpression.expression instanceof so,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,n){super.recalculate(e,n),this.paint._values["line-floorwidth"]=Eh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new od(e)}queryRadius(e){const n=e,h=Jm(pc("line-width",this,n),pc("line-gap-width",this,n)),g=pc("line-offset",this,n);return h/2+Math.abs(g)+xh(this.paint.get("line-translate"))}queryIntersectsFeature(e,n,h,g,w,S,T){const P=bh(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,T),A=T/2*Jm(this.paint.get("line-width").evaluate(n,h),this.paint.get("line-gap-width").evaluate(n,h)),O=this.paint.get("line-offset").evaluate(n,h);return O&&(g=function(U,Z){const Y=[];for(let J=0;J=3){for(let le=0;le0?e+2*i:i}const Rx=z([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Dx=z([{name:"a_projected_pos",components:3,type:"Float32"}],4);z([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const zx=z([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);z([{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 Qm=z([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Nx=z([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ox(i,e,n){return i.sections.forEach(h=>{h.text=function(g,w,S){const T=w.layout.get("text-transform").evaluate(S,{});return T==="uppercase"?g=g.toLocaleUpperCase():T==="lowercase"&&(g=g.toLocaleLowerCase()),go.applyArabicShaping&&(g=go.applyArabicShaping(g)),g}(h.text,e,n)}),i}z([{name:"triangle",components:3,type:"Uint16"}]),z([{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"}]),z([{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"}]),z([{type:"Float32",name:"offsetX"}]),z([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),z([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const wc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Pn=24,$m=Oi,eg=function(i,e,n,h,g){var w,S,T=8*g-h-1,P=(1<>1,O=-7,U=n?g-1:0,Z=n?-1:1,Y=i[e+U];for(U+=Z,w=Y&(1<<-O)-1,Y>>=-O,O+=T;O>0;w=256*w+i[e+U],U+=Z,O-=8);for(S=w&(1<<-O)-1,w>>=-O,O+=h;O>0;S=256*S+i[e+U],U+=Z,O-=8);if(w===0)w=1-A;else{if(w===P)return S?NaN:1/0*(Y?-1:1);S+=Math.pow(2,h),w-=A}return(Y?-1:1)*S*Math.pow(2,w-h)},tg=function(i,e,n,h,g,w){var S,T,P,A=8*w-g-1,O=(1<>1,Z=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,Y=h?0:w-1,J=h?1:-1,te=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(T=isNaN(e)?1:0,S=O):(S=Math.floor(Math.log(e)/Math.LN2),e*(P=Math.pow(2,-S))<1&&(S--,P*=2),(e+=S+U>=1?Z/P:Z*Math.pow(2,1-U))*P>=2&&(S++,P/=2),S+U>=O?(T=0,S=O):S+U>=1?(T=(e*P-1)*Math.pow(2,g),S+=U):(T=e*Math.pow(2,U-1)*Math.pow(2,g),S=0));g>=8;i[n+Y]=255&T,Y+=J,T/=256,g-=8);for(S=S<0;i[n+Y]=255&S,Y+=J,S/=256,A-=8);i[n+Y-J]|=128*te};function Oi(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Oi.Varint=0,Oi.Fixed64=1,Oi.Bytes=2,Oi.Fixed32=5;var ad=4294967296,ig=1/ad,ng=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function aa(i){return i.type===Oi.Bytes?i.readVarint()+i.pos:i.pos+1}function ou(i,e,n){return n?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function rg(i,e,n){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(h);for(var g=n.pos-1;g>=i;g--)n.buf[g+h]=n.buf[g]}function Fx(i,e){for(var n=0;n>>8,i[n+2]=e>>>16,i[n+3]=e>>>24}function sg(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}Oi.prototype={destroy:function(){this.buf=null},readFields:function(i,e,n){for(n=n||this.length;this.pos>3,w=this.pos;this.type=7&h,i(g,e,this),this.pos===w&&this.skip(h)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Th(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=sg(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Th(this.buf,this.pos)+Th(this.buf,this.pos+4)*ad;return this.pos+=8,i},readSFixed64:function(){var i=Th(this.buf,this.pos)+sg(this.buf,this.pos+4)*ad;return this.pos+=8,i},readFloat:function(){var i=eg(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=eg(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,n,h=this.buf;return e=127&(n=h[this.pos++]),n<128?e:(e|=(127&(n=h[this.pos++]))<<7,n<128?e:(e|=(127&(n=h[this.pos++]))<<14,n<128?e:(e|=(127&(n=h[this.pos++]))<<21,n<128?e:function(g,w,S){var T,P,A=S.buf;if(T=(112&(P=A[S.pos++]))>>4,P<128||(T|=(127&(P=A[S.pos++]))<<3,P<128)||(T|=(127&(P=A[S.pos++]))<<10,P<128)||(T|=(127&(P=A[S.pos++]))<<17,P<128)||(T|=(127&(P=A[S.pos++]))<<24,P<128)||(T|=(1&(P=A[S.pos++]))<<31,P<128))return ou(g,T,w);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=h[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&ng?function(n,h,g){return ng.decode(n.subarray(h,g))}(this.buf,e,i):function(n,h,g){for(var w="",S=h;S239?4:O>223?3:O>191?2:1;if(S+Z>g)break;Z===1?O<128&&(U=O):Z===2?(192&(T=n[S+1]))==128&&(U=(31&O)<<6|63&T)<=127&&(U=null):Z===3?(P=n[S+2],(192&(T=n[S+1]))==128&&(192&P)==128&&((U=(15&O)<<12|(63&T)<<6|63&P)<=2047||U>=55296&&U<=57343)&&(U=null)):Z===4&&(P=n[S+2],A=n[S+3],(192&(T=n[S+1]))==128&&(192&P)==128&&(192&A)==128&&((U=(15&O)<<18|(63&T)<<12|(63&P)<<6|63&A)<=65535||U>=1114112)&&(U=null)),U===null?(U=65533,Z=1):U>65535&&(U-=65536,w+=String.fromCharCode(U>>>10&1023|55296),U=56320|1023&U),w+=String.fromCharCode(U),S+=Z}return w}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Oi.Bytes)return i.push(this.readVarint(e));var n=aa(this);for(i=i||[];this.pos127;);else if(e===Oi.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Oi.Fixed32)this.pos+=4;else{if(e!==Oi.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,n){var h,g;if(e>=0?(h=e%4294967296|0,g=e/4294967296|0):(g=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,g=g+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(w,S,T){T.buf[T.pos++]=127&w|128,w>>>=7,T.buf[T.pos++]=127&w|128,w>>>=7,T.buf[T.pos++]=127&w|128,w>>>=7,T.buf[T.pos++]=127&w|128,T.buf[T.pos]=127&(w>>>=7)}(h,0,n),function(w,S){var T=(7&w)<<4;S.buf[S.pos++]|=T|((w>>>=3)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w|((w>>>=7)?128:0),w&&(S.buf[S.pos++]=127&w)))))}(g,n)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(h,g,w){for(var S,T,P=0;P55295&&S<57344){if(!T){S>56319||P+1===g.length?(h[w++]=239,h[w++]=191,h[w++]=189):T=S;continue}if(S<56320){h[w++]=239,h[w++]=191,h[w++]=189,T=S;continue}S=T-55296<<10|S-56320|65536,T=null}else T&&(h[w++]=239,h[w++]=191,h[w++]=189,T=null);S<128?h[w++]=S:(S<2048?h[w++]=S>>6|192:(S<65536?h[w++]=S>>12|224:(h[w++]=S>>18|240,h[w++]=S>>12&63|128),h[w++]=S>>6&63|128),h[w++]=63&S|128)}return w}(this.buf,i,this.pos);var n=this.pos-e;n>=128&&rg(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),tg(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),tg(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&rg(n,h,this),this.pos=n-1,this.writeVarint(h),this.pos+=h},writeMessage:function(i,e,n){this.writeTag(i,Oi.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Fx,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Bx,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Vx,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,jx,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Ux,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,qx,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Gx,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Zx,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Wx,e)},writeBytesField:function(i,e){this.writeTag(i,Oi.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Oi.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Oi.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Oi.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Oi.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Oi.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Oi.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Oi.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Oi.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Oi.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var ld=D($m);const ud=3;function Xx(i,e,n){i===1&&n.readMessage(Hx,e)}function Hx(i,e,n){if(i===3){const{id:h,bitmap:g,width:w,height:S,left:T,top:P,advance:A}=n.readMessage(Yx,{});e.push({id:h,bitmap:new gc({width:w+2*ud,height:S+2*ud},g),metrics:{width:w,height:S,left:T,top:P,advance:A}})}}function Yx(i,e,n){i===1?e.id=n.readVarint():i===2?e.bitmap=n.readBytes():i===3?e.width=n.readVarint():i===4?e.height=n.readVarint():i===5?e.left=n.readSVarint():i===6?e.top=n.readSVarint():i===7&&(e.advance=n.readVarint())}const og=ud;function ag(i){let e=0,n=0;for(const S of i)e+=S.w*S.h,n=Math.max(n,S.w);i.sort((S,T)=>T.h-S.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let g=0,w=0;for(const S of i)for(let T=h.length-1;T>=0;T--){const P=h[T];if(!(S.w>P.w||S.h>P.h)){if(S.x=P.x,S.y=P.y,w=Math.max(w,S.y+S.h),g=Math.max(g,S.x+S.w),S.w===P.w&&S.h===P.h){const A=h.pop();T=0&&h>=e&&Ph[this.text.charCodeAt(h)];h--)n--;this.text=this.text.substring(e,n),this.sectionIndex=this.sectionIndex.slice(e,n)}substring(e,n){const h=new lu;return h.text=this.text.substring(e,n),h.sectionIndex=this.sectionIndex.slice(e,n),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,n)=>Math.max(e,this.sections[n].scale),0)}addTextSection(e,n){this.text+=e.text,this.sections.push(Sc.forText(e.scale,e.fontStack||n));const h=this.sections.length-1;for(let g=0;g=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ch(i,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J){const te=lu.fromFeature(i,g);let le;U===I.ai.vertical&&te.verticalizePunctuation();const{processBidirectionalText:de,processStyledBidirectionalText:De}=go;if(de&&te.sections.length===1){le=[];const qe=de(te.toString(),hd(te,A,w,e,h,Y));for(const nt of qe){const Pt=new lu;Pt.text=nt,Pt.sections=te.sections;for(let ei=0;ei0&&la>or&&(or=la)}else{const as=Pt[Ei.fontStack],Xn=as&&as[en];if(Xn&&Xn.rect)fu=Xn.rect,dn=Xn.metrics;else{const la=nt[Ei.fontStack],Pc=la&&la[en];if(!Pc)continue;dn=Pc.metrics}Xr=(Un-Ei.scale)*Pn}Ls?(qe.verticalizable=!0,Pr.push({glyph:en,imageName:xo,x:oi,y:Vi+Xr,vertical:Ls,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Zi,metrics:dn,rect:fu}),oi+=bo*Ei.scale+Ye):(Pr.push({glyph:en,imageName:xo,x:oi,y:Vi+Xr,vertical:Ls,scale:Ei.scale,fontStack:Ei.fontStack,sectionIndex:Zi,metrics:dn,rect:fu}),oi+=dn.advance*Ei.scale+Ye)}Pr.length!==0&&(Fi=Math.max(oi-Ye,Fi),$x(Pr,0,Pr.length-1,Ps,or)),oi=0;const os=xt*Un+or;sr.lineOffset=Math.max(or,_r),Vi+=os,jn=Math.max(os,jn),++rr}var pn;const Er=Vi-kc,{horizontalAlign:Tr,verticalAlign:Cr}=fd(Zt);(function(mn,Un,_r,sr,Pr,or,os,Br,Ei){const Zi=(Un-_r)*Pr;let en=0;en=or!==os?-Br*sr-kc:(-sr*Ei+.5)*os;for(const Xr of mn)for(const dn of Xr.positionedGlyphs)dn.x+=Zi,dn.y+=en})(qe.positionedLines,Ps,Tr,Cr,Fi,jn,xt,Er,kt.length),qe.top+=-Cr*Er,qe.bottom=qe.top+Er,qe.left+=-Tr*Fi,qe.right=qe.left+Fi}(Pe,e,n,h,le,S,T,P,U,A,Z,J),!function(qe){for(const nt of qe)if(nt.positionedGlyphs.length!==0)return!1;return!0}(ve)&&Pe}const Ph={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Kx={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Jx={40:!0};function ug(i,e,n,h,g,w){if(e.imageName){const S=h[e.imageName];return S?S.displaySize[0]*e.scale*Pn/w+g:0}{const S=n[e.fontStack],T=S&&S[i];return T?T.metrics.advance*e.scale+g:0}}function cg(i,e,n,h){const g=Math.pow(i-e,2);return h?i=0;let A=0;for(let U=0;UA){const O=Math.ceil(w/A);g*=O/S,S=O}return{x1:h,y1:g,x2:h+w,y2:g+S}}function pg(i,e,n,h,g,w){const S=i.image;let T;if(S.content){const le=S.content,de=S.pixelRatio||1;T=[le[0]/de,le[1]/de,S.displaySize[0]-le[2]/de,S.displaySize[1]-le[3]/de]}const P=e.left*w,A=e.right*w;let O,U,Z,Y;n==="width"||n==="both"?(Y=g[0]+P-h[3],U=g[0]+A+h[1]):(Y=g[0]+(P+A-S.displaySize[0])/2,U=Y+S.displaySize[0]);const J=e.top*w,te=e.bottom*w;return n==="height"||n==="both"?(O=g[1]+J-h[0],Z=g[1]+te+h[2]):(O=g[1]+(J+te-S.displaySize[1])/2,Z=O+S.displaySize[1]),{image:S,top:O,right:U,bottom:Z,left:Y,collisionPadding:T}}const Ic=255,vo=128,ja=Ic*vo;function mg(i,e){const{expression:n}=e;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Gi(i+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:h,interpolationType:g}=n;let w=0;for(;wS.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Kf([]),this.placementViewportMatrix=Kf([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=mg(this.zoom,n["text-size"]),this.iconSizeData=mg(this.zoom,n["icon-size"]);const h=this.layers[0].layout,g=h.get("symbol-sort-key"),w=h.get("symbol-z-order");this.canOverlap=dd(h,"text-overlap","text-allow-overlap")!=="never"||dd(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=w!=="viewport-y"&&!g.isConstant(),this.sortFeaturesByY=(w==="viewport-y"||w==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(S=>I.ai[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=e.sourceID}createArrays(){this.text=new md(new Tl(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new md(new Tl(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new $i,this.lineVertexArray=new Sr,this.symbolInstances=new ts,this.textAnchorOffsets=new $n}calculateGlyphDependencies(e,n,h,g,w){for(let S=0;S0)&&(S.value.kind!=="constant"||S.value.value.length>0),O=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,U=w.get("symbol-sort-key");if(this.features=[],!A&&!O)return;const Z=n.iconDependencies,Y=n.glyphDependencies,J=n.availableImages,te=new Gi(this.zoom);for(const{feature:le,id:de,index:De,sourceLayerIndex:ve}of e){const Pe=g._featureFilter.needGeometry,qe=Pl(le,Pe);if(!g._featureFilter.filter(te,qe,h))continue;let nt,Pt;if(Pe||(qe.geometry=Cl(le)),A){const kt=g.getValueAndResolveTokens("text-field",qe,h,J),xt=Gn.factory(kt),Zt=this.hasRTLText=this.hasRTLText||nb(xt);(!Zt||go.getRTLTextPluginStatus()==="unavailable"||Zt&&go.isParsed())&&(nt=Ox(xt,g,qe))}if(O){const kt=g.getValueAndResolveTokens("icon-image",qe,h,J);Pt=kt instanceof hn?kt:hn.fromString(kt)}if(!nt&&!Pt)continue;const ei=this.sortFeaturesByKey?U.evaluate(qe,{},h):void 0;if(this.features.push({id:de,text:nt,icon:Pt,index:De,sourceLayerIndex:ve,geometry:qe.geometry,properties:le.properties,type:tb[le.type],sortKey:ei}),Pt&&(Z[Pt.name]=!0),nt){const kt=S.evaluate(qe,{},h).join(","),xt=w.get("text-rotation-alignment")!=="viewport"&&w.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(I.ai.vertical)>=0;for(const Zt of nt.sections)if(Zt.image)Z[Zt.image.name]=!0;else{const zt=rc(nt.toString()),Mt=Zt.fontStack||kt,Ye=Y[Mt]=Y[Mt]||{};this.calculateGlyphDependencies(Zt.text,Ye,xt,this.allowVerticalPlacement,zt)}}}w.get("symbol-placement")==="line"&&(this.features=function(le){const de={},De={},ve=[];let Pe=0;function qe(kt){ve.push(le[kt]),Pe++}function nt(kt,xt,Zt){const zt=De[kt];return delete De[kt],De[xt]=zt,ve[zt].geometry[0].pop(),ve[zt].geometry[0]=ve[zt].geometry[0].concat(Zt[0]),zt}function Pt(kt,xt,Zt){const zt=de[xt];return delete de[xt],de[kt]=zt,ve[zt].geometry[0].shift(),ve[zt].geometry[0]=Zt[0].concat(ve[zt].geometry[0]),zt}function ei(kt,xt,Zt){const zt=Zt?xt[0][xt[0].length-1]:xt[0][0];return`${kt}:${zt.x}:${zt.y}`}for(let kt=0;ktkt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,de)=>le.sortKey-de.sortKey)}update(e,n,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,n,this.layers,h),this.icon.programConfigurations.updatePaintArrays(e,n,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,n){const h=this.lineVertexArray.length;if(e.segment!==void 0){let g=e.dist(n[e.segment+1]),w=e.dist(n[e.segment]);const S={};for(let T=e.segment+1;T=0;T--)S[T]={x:n[T].x,y:n[T].y,tileUnitDistanceFromAnchor:w},T>0&&(w+=n[T-1].dist(n[T]));for(let T=0;T0}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(e,n){const h=e.placedSymbolArray.get(n),g=h.vertexStartIndex+4*h.numGlyphs;for(let w=h.vertexStartIndex;wg[T]-g[P]||w[P]-w[T]),S}addToSortKeyRanges(e,n){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===n?h.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const h=this.symbolInstances.get(n);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((g,w,S)=>{g>=0&&S.indexOf(g)===w&&this.addIndicesForPlacedSymbol(this.text,g)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let gg,yg;Rt("SymbolBucket",uu,{omit:["layers","collisionBoxArray","features","compareText"]}),uu.MAX_GLYPHS=65535,uu.addDynamicAttributes=pd;var yd={get paint(){return yg=yg||new p({"icon-opacity":new ii(Ne.paint_symbol["icon-opacity"]),"icon-color":new ii(Ne.paint_symbol["icon-color"]),"icon-halo-color":new ii(Ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new ii(Ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ii(Ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Xt(Ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Xt(Ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new ii(Ne.paint_symbol["text-opacity"]),"text-color":new ii(Ne.paint_symbol["text-color"],{runtimeType:Kn,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ii(Ne.paint_symbol["text-halo-color"]),"text-halo-width":new ii(Ne.paint_symbol["text-halo-width"]),"text-halo-blur":new ii(Ne.paint_symbol["text-halo-blur"]),"text-translate":new Xt(Ne.paint_symbol["text-translate"]),"text-translate-anchor":new Xt(Ne.paint_symbol["text-translate-anchor"])})},get layout(){return gg=gg||new p({"symbol-placement":new Xt(Ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Xt(Ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Xt(Ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ii(Ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Xt(Ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Xt(Ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Xt(Ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Xt(Ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Xt(Ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Xt(Ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new ii(Ne.layout_symbol["icon-size"]),"icon-text-fit":new Xt(Ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Xt(Ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new ii(Ne.layout_symbol["icon-image"]),"icon-rotate":new ii(Ne.layout_symbol["icon-rotate"]),"icon-padding":new ii(Ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Xt(Ne.layout_symbol["icon-keep-upright"]),"icon-offset":new ii(Ne.layout_symbol["icon-offset"]),"icon-anchor":new ii(Ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Xt(Ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Xt(Ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Xt(Ne.layout_symbol["text-rotation-alignment"]),"text-field":new ii(Ne.layout_symbol["text-field"]),"text-font":new ii(Ne.layout_symbol["text-font"]),"text-size":new ii(Ne.layout_symbol["text-size"]),"text-max-width":new ii(Ne.layout_symbol["text-max-width"]),"text-line-height":new Xt(Ne.layout_symbol["text-line-height"]),"text-letter-spacing":new ii(Ne.layout_symbol["text-letter-spacing"]),"text-justify":new ii(Ne.layout_symbol["text-justify"]),"text-radial-offset":new ii(Ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Xt(Ne.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ii(Ne.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ii(Ne.layout_symbol["text-anchor"]),"text-max-angle":new Xt(Ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Xt(Ne.layout_symbol["text-writing-mode"]),"text-rotate":new ii(Ne.layout_symbol["text-rotate"]),"text-padding":new Xt(Ne.layout_symbol["text-padding"]),"text-keep-upright":new Xt(Ne.layout_symbol["text-keep-upright"]),"text-transform":new ii(Ne.layout_symbol["text-transform"]),"text-offset":new ii(Ne.layout_symbol["text-offset"]),"text-allow-overlap":new Xt(Ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Xt(Ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Xt(Ne.layout_symbol["text-ignore-placement"]),"text-optional":new Xt(Ne.layout_symbol["text-optional"])})}};class _g{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:gs,this.defaultValue=e}evaluate(e){if(e.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(e.formattedSection))return n.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Rt("FormatSectionOverride",_g,{omit:["defaultValue"]});class Ah extends b{constructor(e){super(e,yd)}recalculate(e,n){if(super.recalculate(e,n),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 h=this.layout.get("text-writing-mode");if(h){const g=[];for(const w of h)g.indexOf(w)<0&&g.push(w);this.layout._values["text-writing-mode"]=g}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,n,h,g){const w=this.layout.get(e).evaluate(n,{},h,g),S=this._unevaluatedLayout._values[e];return S.isDataDriven()||E(S.value)||!w?w:function(T,P){return P.replace(/{([^{}]+)}/g,(A,O)=>T&&O in T?String(T[O]):"")}(n.properties,w)}createBucket(e){return new uu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of yd.paint.overridableProperties){if(!Ah.hasPaintOverride(this.layout,e))continue;const n=this.paint.get(e),h=new _g(n),g=new y(h,n.property.specification);let w=null;w=n.value.kind==="constant"||n.value.kind==="source"?new B("source",g):new W("composite",g,n.value.zoomStops),this.paint._values[e]=new Cs(n.property,w,n.parameters)}}_handleOverridablePaintPropertyUpdate(e,n,h){return!(!this.layout||n.isDataDriven()||h.isDataDriven())&&Ah.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,n){const h=e.get("text-field"),g=yd.paint.properties[n];let w=!1;const S=T=>{for(const P of T)if(g.overrides&&g.overrides.hasOverride(P))return void(w=!0)};if(h.value.kind==="constant"&&h.value.value instanceof Gn)S(h.value.value.sections);else if(h.value.kind==="source"){const T=A=>{w||(A instanceof Os&&on(A.value)===ur?S(A.value.sections):A instanceof Xo?S(A.sections):A.eachChild(T))},P=h.value;P._styleExpression&&T(P._styleExpression.expression)}return w}}let vg;var rb={get paint(){return vg=vg||new p({"background-color":new Xt(Ne.paint_background["background-color"]),"background-pattern":new t(Ne.paint_background["background-pattern"]),"background-opacity":new Xt(Ne.paint_background["background-opacity"])})}};class sb extends b{constructor(e){super(e,rb)}}let xg;var ob={get paint(){return xg=xg||new p({"raster-opacity":new Xt(Ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Xt(Ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Xt(Ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Xt(Ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Xt(Ne.paint_raster["raster-saturation"]),"raster-contrast":new Xt(Ne.paint_raster["raster-contrast"]),"raster-resampling":new Xt(Ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Xt(Ne.paint_raster["raster-fade-duration"])})}};class ab extends b{constructor(e){super(e,ob)}}class lb extends b{constructor(e){super(e,{}),this.onAdd=n=>{this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)},this.onRemove=n=>{this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)},this.implementation=e}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 ub{constructor(e){this._methodToThrottle=e,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 _d=63710088e-1;class Ua{constructor(e,n){if(isNaN(e)||isNaN(n))throw new Error(`Invalid LngLat object: (${e}, ${n})`);if(this.lng=+e,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ua(Oe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const n=Math.PI/180,h=this.lat*n,g=e.lat*n,w=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g)*Math.cos((e.lng-this.lng)*n);return _d*Math.acos(Math.min(w,1))}static convert(e){if(e instanceof Ua)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ua(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Ua(Number("lng"in e?e.lng:e.lon),Number(e.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 bg=2*Math.PI*_d;function wg(i){return bg*Math.cos(i*Math.PI/180)}function kg(i){return(180+i)/360}function Sg(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Ig(i,e){return i/wg(e)}function vd(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Mh{constructor(e,n,h=0){this.x=+e,this.y=+n,this.z=+h}static fromLngLat(e,n=0){const h=Ua.convert(e);return new Mh(kg(h.lng),Sg(h.lat),Ig(n,h.lat))}toLngLat(){return new Ua(360*this.x-180,vd(this.y))}toAltitude(){return this.z*wg(vd(this.y))}meterInMercatorCoordinateUnits(){return 1/bg*(e=vd(this.y),1/Math.cos(e*Math.PI/180));var e}}function Eg(i,e,n){var h=2*Math.PI*6378137/256/Math.pow(2,n);return[i*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}class xd{constructor(e,n,h){if(e<0||e>25||h<0||h>=Math.pow(2,e)||n<0||n>=Math.pow(2,e))throw new Error(`x=${n}, y=${h}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=n,this.y=h,this.key=Ec(0,e,e,n,h)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,n,h){const g=(S=this.y,T=this.z,P=Eg(256*(w=this.x),256*(S=Math.pow(2,T)-S-1),T),A=Eg(256*(w+1),256*(S+1),T),P[0]+","+P[1]+","+A[0]+","+A[1]);var w,S,T,P,A;const O=function(U,Z,Y){let J,te="";for(let le=U;le>0;le--)J=1<1?"@2x":"").replace(/{quadkey}/g,O).replace(/{bbox-epsg-3857}/g,g)}isChildOf(e){const n=this.z-e.z;return n>0&&e.x===this.x>>n&&e.y===this.y>>n}getTilePoint(e){const n=Math.pow(2,this.z);return new N((e.x*n-this.x)*Sn,(e.y*n-this.y)*Sn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Tg{constructor(e,n){this.wrap=e,this.canonical=n,this.key=Ec(e,n.z,n.z,n.x,n.y)}}class ss{constructor(e,n,h,g,w){if(e= z; overscaledZ = ${e}; z = ${h}`);this.overscaledZ=e,this.wrap=n,this.canonical=new xd(h,+g,+w),this.key=Ec(n,e,h,g,w)}clone(){return new ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-e;return e>this.canonical.z?new ss(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ss(e,this.wrap,e,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(e,n){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-e;return e>this.canonical.z?Ec(this.wrap*+n,e,this.canonical.z,this.canonical.x,this.canonical.y):Ec(this.wrap*+n,e,e,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const n=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>n&&e.canonical.y===this.canonical.y>>n}children(e){if(this.overscaledZ>=e)return[new ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,h=2*this.canonical.x,g=2*this.canonical.y;return[new ss(n,this.wrap,n,h,g),new ss(n,this.wrap,n,h+1,g),new ss(n,this.wrap,n,h,g+1),new ss(n,this.wrap,n,h+1,g+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=U),U=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(e+1)}unpack(e,n,h){return e*this.redFactor+n*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,n,h){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let g=n*this.dim,w=n*this.dim+this.dim,S=h*this.dim,T=h*this.dim+this.dim;switch(n){case-1:g=w-1;break;case 1:w=g+1}switch(h){case-1:S=T-1;break;case 1:T=S+1}const P=-n*this.dim,A=-h*this.dim;for(let O=S;O=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Lg{constructor(e,n,h,g,w){this.type="Feature",this._vectorTileFeature=e,e._z=n,e._x=h,e._y=g,this.properties=e.properties,this.id=w}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(e[n]=this[n]);return e}}class Ag{constructor(e,n){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new La(Sn,16,0),this.grid3D=new La(Sn,16,0),this.featureIndexArray=new is,this.promoteId=n}insert(e,n,h,g,w,S){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,g,w);const P=S?this.grid3D:this.grid;for(let A=0;A=0&&U[3]>=0&&P.insert(T,U[0],U[1],U[2],U[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Fa.VectorTile(new ld(this.rawTileData)).layers,this.sourceLayerCoder=new Pg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,n,h,g){this.loadVTLayers();const w=e.params||{},S=Sn/e.tileSize/e.scale,T=tt(w.filter),P=e.queryGeometry,A=e.queryPadding*S,O=Rg(P),U=this.grid.query(O.minX-A,O.minY-A,O.maxX+A,O.maxY+A),Z=Rg(e.cameraQueryGeometry),Y=this.grid3D.query(Z.minX-A,Z.minY-A,Z.maxX+A,Z.maxY+A,(le,de,De,ve)=>function(Pe,qe,nt,Pt,ei){for(const xt of Pe)if(qe<=xt.x&&nt<=xt.y&&Pt>=xt.x&&ei>=xt.y)return!0;const kt=[new N(qe,nt),new N(qe,ei),new N(Pt,ei),new N(Pt,nt)];if(Pe.length>2){for(const xt of kt)if(iu(Pe,xt))return!0}for(let xt=0;xt(ve||(ve=Cl(Pe)),qe.queryIntersectsFeature(P,Pe,nt,ve,this.z,e.transform,S,e.pixelPosMatrix)))}return J}loadMatchingFeature(e,n,h,g,w,S,T,P,A,O,U){const Z=this.bucketLayerIDs[n];if(S&&!function(le,de){for(let De=0;De=0)return!0;return!1}(S,Z))return;const Y=this.sourceLayerCoder.decode(h),J=this.vtLayers[Y].feature(g);if(w.needGeometry){const le=Pl(J,!0);if(!w.filter(new Gi(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!w.filter(new Gi(this.tileID.overscaledZ),J))return;const te=this.getId(J,Y);for(let le=0;le{const T=e instanceof Yl?e.get(S):null;return T&&T.evaluate?T.evaluate(n,h,g):T})}function Rg(i){let e=1/0,n=1/0,h=-1/0,g=-1/0;for(const w of i)e=Math.min(e,w.x),n=Math.min(n,w.y),h=Math.max(h,w.x),g=Math.max(g,w.y);return{minX:e,minY:n,maxX:h,maxY:g}}function cb(i,e){return e-i}function Dg(i,e,n,h,g){const w=[];for(let S=0;S=h&&U.x>=h||(O.x>=h?O=new N(h,O.y+(h-O.x)/(U.x-O.x)*(U.y-O.y))._round():U.x>=h&&(U=new N(h,O.y+(h-O.x)/(U.x-O.x)*(U.y-O.y))._round()),O.y>=g&&U.y>=g||(O.y>=g?O=new N(O.x+(g-O.y)/(U.y-O.y)*(U.x-O.x),g)._round():U.y>=g&&(U=new N(O.x+(g-O.y)/(U.y-O.y)*(U.x-O.x),g)._round()),P&&O.equals(P[P.length-1])||(P=[O],w.push(P)),P.push(U)))))}}return w}Rt("FeatureIndex",Ag,{omit:["rawTileData","sourceLayerCoder"]});class Va extends N{constructor(e,n,h,g){super(e,n),this.angle=h,g!==void 0&&(this.segment=g)}clone(){return new Va(this.x,this.y,this.angle,this.segment)}}function zg(i,e,n,h,g){if(e.segment===void 0||n===0)return!0;let w=e,S=e.segment+1,T=0;for(;T>-n/2;){if(S--,S<0)return!1;T-=i[S].dist(w),w=i[S]}T+=i[S].dist(i[S+1]),S++;const P=[];let A=0;for(;Th;)A-=P.shift().angleDelta;if(A>g)return!1;S++,T+=O.dist(U)}return!0}function Ng(i){let e=0;for(let n=0;nA){const J=(A-P)/Y,te=Ki.number(U.x,Z.x,J),le=Ki.number(U.y,Z.y,J),de=new Va(te,le,Z.angleTo(U),O);return de._round(),!S||zg(i,de,T,S,e)?de:void 0}P+=Y}}function fb(i,e,n,h,g,w,S,T,P){const A=Og(h,w,S),O=Fg(h,g),U=O*S,Z=i[0].x===0||i[0].x===P||i[0].y===0||i[0].y===P;return e-U=0&&Pe=0&&qe=0&&Z+A<=O){const nt=new Va(Pe,qe,De,J);nt._round(),h&&!zg(i,nt,w,h,g)||Y.push(nt)}}U+=de}return T||Y.length||S||(Y=Bg(i,U/2,n,h,g,w,S,!0,P)),Y}Rt("Anchor",Va);const cu=Fr;function jg(i,e,n,h){const g=[],w=i.image,S=w.pixelRatio,T=w.paddedRect.w-2*cu,P=w.paddedRect.h-2*cu;let A={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};const O=w.stretchX||[[0,T]],U=w.stretchY||[[0,P]],Z=(Ye,Ht)=>Ye+Ht[1]-Ht[0],Y=O.reduce(Z,0),J=U.reduce(Z,0),te=T-Y,le=P-J;let de=0,De=Y,ve=0,Pe=J,qe=0,nt=te,Pt=0,ei=le;if(w.content&&h){const Ye=w.content,Ht=Ye[2]-Ye[0],Vt=Ye[3]-Ye[1];(w.textFitWidth||w.textFitHeight)&&(A=dg(i)),de=Rh(O,0,Ye[0]),ve=Rh(U,0,Ye[1]),De=Rh(O,Ye[0],Ye[2]),Pe=Rh(U,Ye[1],Ye[3]),qe=Ye[0]-de,Pt=Ye[1]-ve,nt=Ht-De,ei=Vt-Pe}const kt=A.x1,xt=A.y1,Zt=A.x2-kt,zt=A.y2-xt,Mt=(Ye,Ht,Vt,oi)=>{const Vi=Dh(Ye.stretch-de,De,Zt,kt),Fi=zh(Ye.fixed-qe,nt,Ye.stretch,Y),jn=Dh(Ht.stretch-ve,Pe,zt,xt),Ps=zh(Ht.fixed-Pt,ei,Ht.stretch,J),rr=Dh(Vt.stretch-de,De,Zt,kt),pn=zh(Vt.fixed-qe,nt,Vt.stretch,Y),Er=Dh(oi.stretch-ve,Pe,zt,xt),Tr=zh(oi.fixed-Pt,ei,oi.stretch,J),Cr=new N(Vi,jn),mn=new N(rr,jn),Un=new N(rr,Er),_r=new N(Vi,Er),sr=new N(Fi/S,Ps/S),Pr=new N(pn/S,Tr/S),or=e*Math.PI/180;if(or){const Ei=Math.sin(or),Zi=Math.cos(or),en=[Zi,-Ei,Ei,Zi];Cr._matMult(en),mn._matMult(en),_r._matMult(en),Un._matMult(en)}const os=Ye.stretch+Ye.fixed,Br=Ht.stretch+Ht.fixed;return{tl:Cr,tr:mn,bl:_r,br:Un,tex:{x:w.paddedRect.x+cu+os,y:w.paddedRect.y+cu+Br,w:Vt.stretch+Vt.fixed-os,h:oi.stretch+oi.fixed-Br},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:sr,pixelOffsetBR:Pr,minFontScaleX:nt/S/Zt,minFontScaleY:ei/S/zt,isSDF:n}};if(h&&(w.stretchX||w.stretchY)){const Ye=Ug(O,te,Y),Ht=Ug(U,le,J);for(let Vt=0;Vt0&&(te=Math.max(10,te),this.circleDiameter=te)}else{const Z=!((U=S.image)===null||U===void 0)&&U.content&&(S.image.textFitWidth||S.image.textFitHeight)?dg(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};Z.y1=Z.y1*T-P[0],Z.y2=Z.y2*T+P[2],Z.x1=Z.x1*T-P[3],Z.x2=Z.x2*T+P[1];const Y=S.collisionPadding;if(Y&&(Z.x1-=Y[0]*T,Z.y1-=Y[1]*T,Z.x2+=Y[2]*T,Z.y2+=Y[3]*T),O){const J=new N(Z.x1,Z.y1),te=new N(Z.x2,Z.y1),le=new N(Z.x1,Z.y2),de=new N(Z.x2,Z.y2),De=O*Math.PI/180;J._rotate(De),te._rotate(De),le._rotate(De),de._rotate(De),Z.x1=Math.min(J.x,te.x,le.x,de.x),Z.x2=Math.max(J.x,te.x,le.x,de.x),Z.y1=Math.min(J.y,te.y,le.y,de.y),Z.y2=Math.max(J.y,te.y,le.y,de.y)}e.emplaceBack(n.x,n.y,Z.x1,Z.y1,Z.x2,Z.y2,h,g,w)}this.boxEndIndex=e.length}}class db{constructor(e=[],n=(h,g)=>hg?1:0){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:h}=this,g=n[e];for(;e>0;){const w=e-1>>1,S=n[w];if(h(g,S)>=0)break;n[e]=S,e=w}n[e]=g}_down(e){const{data:n,compare:h}=this,g=this.length>>1,w=n[e];for(;e=0)break;n[e]=n[S],e=S}n[e]=w}}function pb(i,e=1,n=!1){let h=1/0,g=1/0,w=-1/0,S=-1/0;const T=i[0];for(let Y=0;Yw)&&(w=J.x),(!Y||J.y>S)&&(S=J.y)}const P=Math.min(w-h,S-g);let A=P/2;const O=new db([],mb);if(P===0)return new N(h,g);for(let Y=h;YU.d||!U.d)&&(U=Y,n&&console.log("found best %d after %d probes",Math.round(1e4*Y.d)/1e4,Z)),Y.max-U.d<=e||(A=Y.h/2,O.push(new hu(Y.p.x-A,Y.p.y-A,A,i)),O.push(new hu(Y.p.x+A,Y.p.y-A,A,i)),O.push(new hu(Y.p.x-A,Y.p.y+A,A,i)),O.push(new hu(Y.p.x+A,Y.p.y+A,A,i)),Z+=4)}return n&&(console.log(`num probes: ${Z}`),console.log(`best distance: ${U.d}`)),U.p}function mb(i,e){return e.max-i.max}function hu(i,e,n,h){this.p=new N(i,e),this.h=n,this.d=function(g,w){let S=!1,T=1/0;for(let P=0;Pg.y!=J.y>g.y&&g.x<(J.x-Y.x)*(g.y-Y.y)/(J.y-Y.y)+Y.x&&(S=!S),T=Math.min(T,Sm(g,Y,J))}}return(S?1:-1)*Math.sqrt(T)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var nr;I.ar=void 0,(nr=I.ar||(I.ar={}))[nr.center=1]="center",nr[nr.left=2]="left",nr[nr.right=3]="right",nr[nr.top=4]="top",nr[nr.bottom=5]="bottom",nr[nr["top-left"]=6]="top-left",nr[nr["top-right"]=7]="top-right",nr[nr["bottom-left"]=8]="bottom-left",nr[nr["bottom-right"]=9]="bottom-right";const qa=7,bd=Number.POSITIVE_INFINITY;function Vg(i,e){return e[1]!==bd?function(n,h,g){let w=0,S=0;switch(h=Math.abs(h),g=Math.abs(g),n){case"top-right":case"top-left":case"top":S=g-qa;break;case"bottom-right":case"bottom-left":case"bottom":S=-g+qa}switch(n){case"top-right":case"bottom-right":case"right":w=-h;break;case"top-left":case"bottom-left":case"left":w=h}return[w,S]}(i,e[0],e[1]):function(n,h){let g=0,w=0;h<0&&(h=0);const S=h/Math.SQRT2;switch(n){case"top-right":case"top-left":w=S-qa;break;case"bottom-right":case"bottom-left":w=-S+qa;break;case"bottom":w=-h+qa;break;case"top":w=h-qa}switch(n){case"top-right":case"bottom-right":g=-S;break;case"top-left":case"bottom-left":g=S;break;case"left":g=h;break;case"right":g=-h}return[g,w]}(i,e[0])}function qg(i,e,n){var h;const g=i.layout,w=(h=g.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(e,{},n);if(w){const T=w.values,P=[];for(let A=0;AZ*Pn);O.startsWith("top")?U[1]-=qa:O.startsWith("bottom")&&(U[1]+=qa),P[A+1]=U}return new nn(P)}const S=g.get("text-variable-anchor");if(S){let T;T=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[g.get("text-radial-offset").evaluate(e,{},n)*Pn,bd]:g.get("text-offset").evaluate(e,{},n).map(A=>A*Pn);const P=[];for(const A of S)P.push(A,Vg(A,T));return new nn(P)}return null}function wd(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function gb(i,e,n,h,g,w,S,T,P,A,O){let U=w.textMaxSize.evaluate(e,{});U===void 0&&(U=S);const Z=i.layers[0].layout,Y=Z.get("icon-offset").evaluate(e,{},O),J=Zg(n.horizontal),te=S/24,le=i.tilePixelRatio*te,de=i.tilePixelRatio*U/24,De=i.tilePixelRatio*T,ve=i.tilePixelRatio*Z.get("symbol-spacing"),Pe=Z.get("text-padding")*i.tilePixelRatio,qe=function(Ye,Ht,Vt,oi=1){const Vi=Ye.get("icon-padding").evaluate(Ht,{},Vt),Fi=Vi&&Vi.values;return[Fi[0]*oi,Fi[1]*oi,Fi[2]*oi,Fi[3]*oi]}(Z,e,O,i.tilePixelRatio),nt=Z.get("text-max-angle")/180*Math.PI,Pt=Z.get("text-rotation-alignment")!=="viewport"&&Z.get("symbol-placement")!=="point",ei=Z.get("icon-rotation-alignment")==="map"&&Z.get("symbol-placement")!=="point",kt=Z.get("symbol-placement"),xt=ve/2,Zt=Z.get("icon-text-fit");let zt;h&&Zt!=="none"&&(i.allowVerticalPlacement&&n.vertical&&(zt=pg(h,n.vertical,Zt,Z.get("icon-text-fit-padding"),Y,te)),J&&(h=pg(h,J,Zt,Z.get("icon-text-fit-padding"),Y,te)));const Mt=(Ye,Ht)=>{Ht.x<0||Ht.x>=Sn||Ht.y<0||Ht.y>=Sn||function(Vt,oi,Vi,Fi,jn,Ps,rr,pn,Er,Tr,Cr,mn,Un,_r,sr,Pr,or,os,Br,Ei,Zi,en,Xr,dn,fu){const xo=Vt.addToLineVertexArray(oi,Vi);let bo,Ls,as,Xn,la=0,Pc=0,Yg=0,Kg=0,Ld=-1,Ad=-1;const ua={};let Jg=eu("");if(Vt.allowVerticalPlacement&&Fi.vertical){const vr=pn.layout.get("text-rotate").evaluate(Zi,{},dn)+90;as=new Nh(Er,oi,Tr,Cr,mn,Fi.vertical,Un,_r,sr,vr),rr&&(Xn=new Nh(Er,oi,Tr,Cr,mn,rr,or,os,sr,vr))}if(jn){const vr=pn.layout.get("icon-rotate").evaluate(Zi,{}),ls=pn.layout.get("icon-text-fit")!=="none",Al=jg(jn,vr,Xr,ls),Xs=rr?jg(rr,vr,Xr,ls):void 0;Ls=new Nh(Er,oi,Tr,Cr,mn,jn,or,os,!1,vr),la=4*Al.length;const Ml=Vt.iconSizeData;let wo=null;Ml.kind==="source"?(wo=[vo*pn.layout.get("icon-size").evaluate(Zi,{})],wo[0]>ja&&_t(`${Vt.layerIds[0]}: Value for "icon-size" is >= ${Ic}. Reduce your "icon-size".`)):Ml.kind==="composite"&&(wo=[vo*en.compositeIconSizes[0].evaluate(Zi,{},dn),vo*en.compositeIconSizes[1].evaluate(Zi,{},dn)],(wo[0]>ja||wo[1]>ja)&&_t(`${Vt.layerIds[0]}: Value for "icon-size" is >= ${Ic}. Reduce your "icon-size".`)),Vt.addSymbols(Vt.icon,Al,wo,Ei,Br,Zi,I.ai.none,oi,xo.lineStartIndex,xo.lineLength,-1,dn),Ld=Vt.icon.placedSymbolArray.length-1,Xs&&(Pc=4*Xs.length,Vt.addSymbols(Vt.icon,Xs,wo,Ei,Br,Zi,I.ai.vertical,oi,xo.lineStartIndex,xo.lineLength,-1,dn),Ad=Vt.icon.placedSymbolArray.length-1)}const Qg=Object.keys(Fi.horizontal);for(const vr of Qg){const ls=Fi.horizontal[vr];if(!bo){Jg=eu(ls.text);const Xs=pn.layout.get("text-rotate").evaluate(Zi,{},dn);bo=new Nh(Er,oi,Tr,Cr,mn,ls,Un,_r,sr,Xs)}const Al=ls.positionedLines.length===1;if(Yg+=Gg(Vt,oi,ls,Ps,pn,sr,Zi,Pr,xo,Fi.vertical?I.ai.horizontal:I.ai.horizontalOnly,Al?Qg:[vr],ua,Ld,en,dn),Al)break}Fi.vertical&&(Kg+=Gg(Vt,oi,Fi.vertical,Ps,pn,sr,Zi,Pr,xo,I.ai.vertical,["vertical"],ua,Ad,en,dn));const vb=bo?bo.boxStartIndex:Vt.collisionBoxArray.length,xb=bo?bo.boxEndIndex:Vt.collisionBoxArray.length,bb=as?as.boxStartIndex:Vt.collisionBoxArray.length,wb=as?as.boxEndIndex:Vt.collisionBoxArray.length,kb=Ls?Ls.boxStartIndex:Vt.collisionBoxArray.length,Sb=Ls?Ls.boxEndIndex:Vt.collisionBoxArray.length,Ib=Xn?Xn.boxStartIndex:Vt.collisionBoxArray.length,Eb=Xn?Xn.boxEndIndex:Vt.collisionBoxArray.length;let Ws=-1;const Fh=(vr,ls)=>vr&&vr.circleDiameter?Math.max(vr.circleDiameter,ls):ls;Ws=Fh(bo,Ws),Ws=Fh(as,Ws),Ws=Fh(Ls,Ws),Ws=Fh(Xn,Ws);const $g=Ws>-1?1:0;$g&&(Ws*=fu/Pn),Vt.glyphOffsetArray.length>=uu.MAX_GLYPHS&&_t("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Zi.sortKey!==void 0&&Vt.addToSortKeyRanges(Vt.symbolInstances.length,Zi.sortKey);const Tb=qg(pn,Zi,dn),[Cb,Pb]=function(vr,ls){const Al=vr.length,Xs=ls==null?void 0:ls.values;if((Xs==null?void 0:Xs.length)>0)for(let Ml=0;Ml=0?ua.right:-1,ua.center>=0?ua.center:-1,ua.left>=0?ua.left:-1,ua.vertical||-1,Ld,Ad,Jg,vb,xb,bb,wb,kb,Sb,Ib,Eb,Tr,Yg,Kg,la,Pc,$g,0,Un,Ws,Cb,Pb)}(i,Ht,Ye,n,h,g,zt,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,le,[Pe,Pe,Pe,Pe],Pt,P,De,qe,ei,Y,e,w,A,O,S)};if(kt==="line")for(const Ye of Dg(e.geometry,0,0,Sn,Sn)){const Ht=fb(Ye,ve,nt,n.vertical||J,h,24,de,i.overscaling,Sn);for(const Vt of Ht)J&&yb(i,J.text,xt,Vt)||Mt(Ye,Vt)}else if(kt==="line-center"){for(const Ye of e.geometry)if(Ye.length>1){const Ht=hb(Ye,nt,n.vertical||J,h,24,de);Ht&&Mt(Ye,Ht)}}else if(e.type==="Polygon")for(const Ye of Yo(e.geometry,0)){const Ht=pb(Ye,16);Mt(Ye[0],new Va(Ht.x,Ht.y,0))}else if(e.type==="LineString")for(const Ye of e.geometry)Mt(Ye,new Va(Ye[0].x,Ye[0].y,0));else if(e.type==="Point")for(const Ye of e.geometry)for(const Ht of Ye)Mt([Ht],new Va(Ht.x,Ht.y,0))}function Gg(i,e,n,h,g,w,S,T,P,A,O,U,Z,Y,J){const te=function(De,ve,Pe,qe,nt,Pt,ei,kt){const xt=qe.layout.get("text-rotate").evaluate(Pt,{})*Math.PI/180,Zt=[];for(const zt of ve.positionedLines)for(const Mt of zt.positionedGlyphs){if(!Mt.rect)continue;const Ye=Mt.rect||{};let Ht=og+1,Vt=!0,oi=1,Vi=0;const Fi=(nt||kt)&&Mt.vertical,jn=Mt.metrics.advance*Mt.scale/2;if(kt&&ve.verticalizable&&(Vi=zt.lineOffset/2-(Mt.imageName?-(Pn-Mt.metrics.width*Mt.scale)/2:(Mt.scale-1)*Pn)),Mt.imageName){const Ei=ei[Mt.imageName];Vt=Ei.sdf,oi=Ei.pixelRatio,Ht=Fr/oi}const Ps=nt?[Mt.x+jn,Mt.y]:[0,0];let rr=nt?[0,0]:[Mt.x+jn+Pe[0],Mt.y+Pe[1]-Vi],pn=[0,0];Fi&&(pn=rr,rr=[0,0]);const Er=Mt.metrics.isDoubleResolution?2:1,Tr=(Mt.metrics.left-Ht)*Mt.scale-jn+rr[0],Cr=(-Mt.metrics.top-Ht)*Mt.scale+rr[1],mn=Tr+Ye.w/Er*Mt.scale/oi,Un=Cr+Ye.h/Er*Mt.scale/oi,_r=new N(Tr,Cr),sr=new N(mn,Cr),Pr=new N(Tr,Un),or=new N(mn,Un);if(Fi){const Ei=new N(-jn,jn-kc),Zi=-Math.PI/2,en=Pn/2-jn,Xr=new N(5-kc-en,-(Mt.imageName?en:0)),dn=new N(...pn);_r._rotateAround(Zi,Ei)._add(Xr)._add(dn),sr._rotateAround(Zi,Ei)._add(Xr)._add(dn),Pr._rotateAround(Zi,Ei)._add(Xr)._add(dn),or._rotateAround(Zi,Ei)._add(Xr)._add(dn)}if(xt){const Ei=Math.sin(xt),Zi=Math.cos(xt),en=[Zi,-Ei,Ei,Zi];_r._matMult(en),sr._matMult(en),Pr._matMult(en),or._matMult(en)}const os=new N(0,0),Br=new N(0,0);Zt.push({tl:_r,tr:sr,bl:Pr,br:or,tex:Ye,writingMode:ve.writingMode,glyphOffset:Ps,sectionIndex:Mt.sectionIndex,isSDF:Vt,pixelOffsetTL:os,pixelOffsetBR:Br,minFontScaleX:0,minFontScaleY:0})}return Zt}(0,n,T,g,w,S,h,i.allowVerticalPlacement),le=i.textSizeData;let de=null;le.kind==="source"?(de=[vo*g.layout.get("text-size").evaluate(S,{})],de[0]>ja&&_t(`${i.layerIds[0]}: Value for "text-size" is >= ${Ic}. Reduce your "text-size".`)):le.kind==="composite"&&(de=[vo*Y.compositeTextSizes[0].evaluate(S,{},J),vo*Y.compositeTextSizes[1].evaluate(S,{},J)],(de[0]>ja||de[1]>ja)&&_t(`${i.layerIds[0]}: Value for "text-size" is >= ${Ic}. Reduce your "text-size".`)),i.addSymbols(i.text,te,de,T,w,S,A,e,P.lineStartIndex,P.lineLength,Z,J);for(const De of O)U[De]=i.text.placedSymbolArray.length-1;return 4*te.length}function Zg(i){for(const e in i)return i[e];return null}function yb(i,e,n,h){const g=i.compareText;if(e in g){const w=g[e];for(let S=w.length-1;S>=0;S--)if(h.dist(w[S])>4;if(g!==1)throw new Error(`Got v${g} data when expected v1.`);const w=Wg[15&h];if(!w)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(e,2,1),[T]=new Uint32Array(e,4,1);return new kd(T,S,w,e)}constructor(e,n=64,h=Float64Array,g){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=h,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const w=Wg.indexOf(this.ArrayType),S=2*e*this.ArrayType.BYTES_PER_ELEMENT,T=e*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-T%8)%8;if(w<0)throw new Error(`Unexpected typed array class: ${h}.`);g&&g instanceof ArrayBuffer?(this.data=g,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+T+P,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+S+T+P),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+T+P,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+w]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=e,this.coords[this._pos++]=n,h}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Sd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:w,coords:S,nodeSize:T}=this,P=[0,w.length-1,0],A=[];for(;P.length;){const O=P.pop()||0,U=P.pop()||0,Z=P.pop()||0;if(U-Z<=T){for(let le=Z;le<=U;le++){const de=S[2*le],De=S[2*le+1];de>=e&&de<=h&&De>=n&&De<=g&&A.push(w[le])}continue}const Y=Z+U>>1,J=S[2*Y],te=S[2*Y+1];J>=e&&J<=h&&te>=n&&te<=g&&A.push(w[Y]),(O===0?e<=J:n<=te)&&(P.push(Z),P.push(Y-1),P.push(1-O)),(O===0?h>=J:g>=te)&&(P.push(Y+1),P.push(U),P.push(1-O))}return A}within(e,n,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:w,nodeSize:S}=this,T=[0,g.length-1,0],P=[],A=h*h;for(;T.length;){const O=T.pop()||0,U=T.pop()||0,Z=T.pop()||0;if(U-Z<=S){for(let le=Z;le<=U;le++)Hg(w[2*le],w[2*le+1],e,n)<=A&&P.push(g[le]);continue}const Y=Z+U>>1,J=w[2*Y],te=w[2*Y+1];Hg(J,te,e,n)<=A&&P.push(g[Y]),(O===0?e-h<=J:n-h<=te)&&(T.push(Z),T.push(Y-1),T.push(1-O)),(O===0?e+h>=J:n+h>=te)&&(T.push(Y+1),T.push(U),T.push(1-O))}return P}}function Sd(i,e,n,h,g,w){if(g-h<=n)return;const S=h+g>>1;Xg(i,e,S,h,g,w),Sd(i,e,n,h,S-1,1-w),Sd(i,e,n,S+1,g,1-w)}function Xg(i,e,n,h,g,w){for(;g>h;){if(g-h>600){const A=g-h+1,O=n-h+1,U=Math.log(A),Z=.5*Math.exp(2*U/3),Y=.5*Math.sqrt(U*Z*(A-Z)/A)*(O-A/2<0?-1:1);Xg(i,e,n,Math.max(h,Math.floor(n-O*Z/A+Y)),Math.min(g,Math.floor(n+(A-O)*Z/A+Y)),w)}const S=e[2*n+w];let T=h,P=g;for(Tc(i,e,h,n),e[2*g+w]>S&&Tc(i,e,h,g);TS;)P--}e[2*h+w]===S?Tc(i,e,h,P):(P++,Tc(i,e,P,g)),P<=n&&(h=P+1),n<=P&&(g=P-1)}}function Tc(i,e,n,h){Id(i,n,h),Id(e,2*n,2*h),Id(e,2*n+1,2*h+1)}function Id(i,e,n){const h=i[e];i[e]=i[n],i[n]=h}function Hg(i,e,n,h){const g=i-n,w=e-h;return g*g+w*w}var Ed;I.bf=void 0,(Ed=I.bf||(I.bf={})).create="create",Ed.load="load",Ed.fullLoad="fullLoad";let Oh=null,Cc=[];const Td=1e3/60,Cd="loadTime",Pd="fullLoadTime",_b={mark(i){performance.mark(i)},frame(i){const e=i;Oh!=null&&Cc.push(e-Oh),Oh=e},clearMetrics(){Oh=null,Cc=[],performance.clearMeasures(Cd),performance.clearMeasures(Pd);for(const i in I.bf)performance.clearMarks(I.bf[i])},getPerformanceMetrics(){performance.measure(Cd,I.bf.create,I.bf.load),performance.measure(Pd,I.bf.create,I.bf.fullLoad);const i=performance.getEntriesByName(Cd)[0].duration,e=performance.getEntriesByName(Pd)[0].duration,n=Cc.length,h=1/(Cc.reduce((w,S)=>w+S,0)/n/1e3),g=Cc.filter(w=>w>Td).reduce((w,S)=>w+(S-Td)/Td,0);return{loadTime:i,fullLoadTime:e,fps:h,percentDroppedFrames:g/(n+g)*100,totalFrames:n}}};I.$=class extends ee{},I.A=nu,I.B=tc,I.C=function(i){if(bt==null){const e=i.navigator?i.navigator.userAgent:null;bt=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return bt},I.D=Xt,I.E=Ke,I.F=class{constructor(i,e){this.target=i,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new ub(()=>this.process()),this.subscription=function(n,h,g,w){return n.addEventListener(h,g,!1),{unsubscribe:()=>{n.removeEventListener(h,g,!1)}}}(this.target,"message",n=>this.receive(n)),this.globalScope=dt(self)?i:window}registerMessageHandler(i,e){this.messageHandlers[i]=e}sendAsync(i,e){return new Promise((n,h)=>{const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[g]={resolve:n,reject:h},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[g];const T={id:g,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const w=[],S=Object.assign(Object.assign({},i),{id:g,sourceMapId:this.mapId,origin:location.origin,data:Sl(i.data,w)});this.target.postMessage(S,{transfer:w})})}receive(i){const e=i.data,n=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[n];const h=this.abortControllers[n];return delete this.abortControllers[n],void(h&&h.abort())}if(dt(self)||e.mustQueue)return this.tasks[n]=e,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,e)}}process(){if(this.taskQueue.length===0)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){return f(this,void 0,void 0,function*(){if(e.type===""){const g=this.resolveRejects[i];return delete this.resolveRejects[i],g?void(e.error?g.reject(Ts(e.error)):g.resolve(Ts(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const n=Ts(e.data),h=new AbortController;this.abortControllers[i]=h;try{const g=yield this.messageHandlers[e.type](e.sourceMapId,n,h);this.completeTask(i,null,g)}catch(g){this.completeTask(i,g)}})}completeTask(i,e,n){const h=[];delete this.abortControllers[i];const g={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Sl(e):null,data:Sl(n,h)};this.target.postMessage(g,{transfer:h})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},I.G=pt,I.H=function(){var i=new nu(16);return nu!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},I.I=cd,I.J=function(i,e,n){var h,g,w,S,T,P,A,O,U,Z,Y,J,te=n[0],le=n[1],de=n[2];return e===i?(i[12]=e[0]*te+e[4]*le+e[8]*de+e[12],i[13]=e[1]*te+e[5]*le+e[9]*de+e[13],i[14]=e[2]*te+e[6]*le+e[10]*de+e[14],i[15]=e[3]*te+e[7]*le+e[11]*de+e[15]):(g=e[1],w=e[2],S=e[3],T=e[4],P=e[5],A=e[6],O=e[7],U=e[8],Z=e[9],Y=e[10],J=e[11],i[0]=h=e[0],i[1]=g,i[2]=w,i[3]=S,i[4]=T,i[5]=P,i[6]=A,i[7]=O,i[8]=U,i[9]=Z,i[10]=Y,i[11]=J,i[12]=h*te+T*le+U*de+e[12],i[13]=g*te+P*le+Z*de+e[13],i[14]=w*te+A*le+Y*de+e[14],i[15]=S*te+O*le+J*de+e[15]),i},I.K=function(i,e,n){var h=n[0],g=n[1],w=n[2];return i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i[3]=e[3]*h,i[4]=e[4]*g,i[5]=e[5]*g,i[6]=e[6]*g,i[7]=e[7]*g,i[8]=e[8]*w,i[9]=e[9]*w,i[10]=e[10]*w,i[11]=e[11]*w,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},I.L=Cm,I.M=function(i,e){const n={};for(let h=0;h{const e=window.document.createElement("video");return e.muted=!0,new Promise(n=>{e.onloadstart=()=>{n(e)};for(const h of i){const g=window.document.createElement("source");Jt(h)||(e.crossOrigin="Anonymous"),g.src=h,e.appendChild(g)}})},I.a4=function(){return je++},I.a5=gi,I.a6=uu,I.a7=tt,I.a8=Pl,I.a9=Gi,I.aA=function(i){i=i.slice();const e=Object.create(null);for(let n=0;n{"source"in S&&h[S.source]?n.push({command:"removeLayer",args:[S.id]}):w.push(S)}),n=n.concat(g),function(S,T,P){T=T||[];const A=(S=S||[]).map(ms),O=T.map(ms),U=S.reduce(zs,{}),Z=T.reduce(zs,{}),Y=A.slice(),J=Object.create(null);let te,le,de,De,ve;for(let Pe=0,qe=0;Pe@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,h,g,w)=>{const S=g||w;return e[h]=!S||S.toLowerCase(),""}),e["max-age"]){const n=parseInt(e["max-age"],10);isNaN(n)?delete e["max-age"]:e["max-age"]=n}return e},I.ac=function(i,e){const n=[];for(const h in i)h in e||n.push(h);return n},I.ad=ze,I.ae=function(i,e,n){var h=Math.sin(n),g=Math.cos(n),w=e[0],S=e[1],T=e[2],P=e[3],A=e[4],O=e[5],U=e[6],Z=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=w*g+A*h,i[1]=S*g+O*h,i[2]=T*g+U*h,i[3]=P*g+Z*h,i[4]=A*g-w*h,i[5]=O*g-S*h,i[6]=U*g-T*h,i[7]=Z*g-P*h,i},I.af=function(i){var e=new nu(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},I.ag=wh,I.ah=function(i,e){let n=0,h=0;if(i.kind==="constant")h=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:g,minZoom:w,maxZoom:S}=i,T=g?ze(Nn.interpolationFactor(g,e,w,S),0,1):0;i.kind==="camera"?h=Ki.number(i.minSize,i.maxSize,T):n=T}return{uSizeT:n,uSize:h}},I.aj=function(i,{uSize:e,uSizeT:n},{lowerSize:h,upperSize:g}){return i.kind==="source"?h/vo:i.kind==="composite"?Ki.number(h/vo,g/vo,n):e},I.ak=pd,I.al=function(i,e,n,h){const g=e.y-i.y,w=e.x-i.x,S=h.y-n.y,T=h.x-n.x,P=S*w-T*g;if(P===0)return null;const A=(T*(i.y-n.y)-S*(i.x-n.x))/P;return new N(i.x+A*w,i.y+A*g)},I.am=Dg,I.an=wm,I.ao=Kf,I.ap=function(i){let e=1/0,n=1/0,h=-1/0,g=-1/0;for(const w of i)e=Math.min(e,w.x),n=Math.min(n,w.y),h=Math.max(h,w.x),g=Math.max(g,w.y);return[e,n,h,g]},I.aq=Pn,I.as=dd,I.at=function(i,e){var n=e[0],h=e[1],g=e[2],w=e[3],S=e[4],T=e[5],P=e[6],A=e[7],O=e[8],U=e[9],Z=e[10],Y=e[11],J=e[12],te=e[13],le=e[14],de=e[15],De=n*T-h*S,ve=n*P-g*S,Pe=n*A-w*S,qe=h*P-g*T,nt=h*A-w*T,Pt=g*A-w*P,ei=O*te-U*J,kt=O*le-Z*J,xt=O*de-Y*J,Zt=U*le-Z*te,zt=U*de-Y*te,Mt=Z*de-Y*le,Ye=De*Mt-ve*zt+Pe*Zt+qe*xt-nt*kt+Pt*ei;return Ye?(i[0]=(T*Mt-P*zt+A*Zt)*(Ye=1/Ye),i[1]=(g*zt-h*Mt-w*Zt)*Ye,i[2]=(te*Pt-le*nt+de*qe)*Ye,i[3]=(Z*nt-U*Pt-Y*qe)*Ye,i[4]=(P*xt-S*Mt-A*kt)*Ye,i[5]=(n*Mt-g*xt+w*kt)*Ye,i[6]=(le*Pe-J*Pt-de*ve)*Ye,i[7]=(O*Pt-Z*Pe+Y*ve)*Ye,i[8]=(S*zt-T*xt+A*ei)*Ye,i[9]=(h*xt-n*zt-w*ei)*Ye,i[10]=(J*nt-te*Pe+de*De)*Ye,i[11]=(U*Pe-O*nt-Y*De)*Ye,i[12]=(T*kt-S*Zt-P*ei)*Ye,i[13]=(n*Zt-h*kt+g*ei)*Ye,i[14]=(te*ve-J*qe-le*De)*Ye,i[15]=(O*qe-U*ve+Z*De)*Ye,i):null},I.au=wd,I.av=fd,I.aw=kd,I.ax=function(){const i={},e=Ne.$version;for(const n in Ne.$root){const h=Ne.$root[n];if(h.required){let g=null;g=n==="version"?e:h.type==="array"?[]:{},g!=null&&(i[n]=g)}}return i},I.ay=ch,I.az=_e,I.b=lt,I.b0=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},I.b1=function(i,e,n){return i[0]=e[0]*n[0],i[1]=e[1]*n[1],i[2]=e[2]*n[2],i[3]=e[3]*n[3],i},I.b2=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},I.b3=Oe,I.b4=Tg,I.b5=Ig,I.b6=function(i,e,n,h,g){var w,S=1/Math.tan(e/2);return i[0]=S/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=S,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,g!=null&&g!==1/0?(i[10]=(g+h)*(w=1/(h-g)),i[14]=2*g*h*w):(i[10]=-1,i[14]=-2*h),i},I.b7=function(i,e,n){var h=Math.sin(n),g=Math.cos(n),w=e[4],S=e[5],T=e[6],P=e[7],A=e[8],O=e[9],U=e[10],Z=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=w*g+A*h,i[5]=S*g+O*h,i[6]=T*g+U*h,i[7]=P*g+Z*h,i[8]=A*g-w*h,i[9]=O*g-S*h,i[10]=U*g-T*h,i[11]=Z*g-P*h,i},I.b8=ke,I.b9=Re,I.bA=function(i){return i.message===Ut},I.bB=M,I.bC=go,I.ba=function(i){return i*Math.PI/180},I.bb=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},I.bc=class extends K{},I.bd=_d,I.be=_b,I.bg=vt,I.bh=function(i,e){et.REGISTERED_PROTOCOLS[i]=e},I.bi=function(i){delete et.REGISTERED_PROTOCOLS[i]},I.bj=function(i,e){const n={};for(let g=0;gMt*Pn)}let kt=S?"center":n.get("text-justify").evaluate(A,{},i.canonical);const xt=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(A,{},i.canonical)*Pn:1/0,Zt=()=>{i.bucket.allowVerticalPlacement&&rc(Pe)&&(J.vertical=Ch(te,i.glyphMap,i.glyphPositions,i.imagePositions,O,xt,w,Pt,"left",nt,de,I.ai.vertical,!0,Z,U))};if(!S&&ei){const zt=new Set;if(kt==="auto")for(let Ye=0;Yef(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(e)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),I.e=Ze,I.f=i=>new Promise((e,n)=>{const h=new Image;h.onload=()=>{e(h),URL.revokeObjectURL(h.src),h.onload=null,window.requestAnimationFrame(()=>{h.src=It})},h.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const g=new Blob([new Uint8Array(i)],{type:"image/png"});h.src=i.byteLength?URL.createObjectURL(g):It}),I.g=Ot,I.h=(i,e)=>vi(Ze(i,{type:"json"}),e),I.i=dt,I.j=Dt,I.k=xe,I.l=(i,e)=>vi(Ze(i,{type:"arrayBuffer"}),e),I.m=vi,I.n=function(i){return new ld(i).readFields(Xx,[])},I.o=gc,I.p=ag,I.q=p,I.r=jf,I.s=Jt,I.t=ic,I.u=Et,I.v=Ne,I.w=_t,I.x=Gs,I.y=function([i,e,n]){return e+=90,e*=Math.PI/180,n*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(n),y:i*Math.sin(e)*Math.sin(n),z:i*Math.cos(n)}},I.z=Ki}),_("worker",["./shared"],function(I){class f{constructor(H){this.keyCache={},H&&this.replace(H)}replace(H){this._layerConfigs={},this._layers={},this.update(H,[])}update(H,X){for(const Q of H){this._layerConfigs[Q.id]=Q;const ge=this._layers[Q.id]=I.aB(Q);ge._featureFilter=I.a7(ge.filter),this.keyCache[Q.id]&&delete this.keyCache[Q.id]}for(const Q of X)delete this.keyCache[Q],delete this._layerConfigs[Q],delete this._layers[Q];this.familiesBySource={};const $=I.bj(Object.values(this._layerConfigs),this.keyCache);for(const Q of $){const ge=Q.map(Fe=>this._layers[Fe.id]),be=ge[0];if(be.visibility==="none")continue;const Le=be.source||"";let pe=this.familiesBySource[Le];pe||(pe=this.familiesBySource[Le]={});const Ue=be.sourceLayer||"_geojsonTileLayer";let $e=pe[Ue];$e||($e=pe[Ue]=[]),$e.push(ge)}}}class D{constructor(H){const X={},$=[];for(const Le in H){const pe=H[Le],Ue=X[Le]={};for(const $e in pe){const Fe=pe[+$e];if(!Fe||Fe.bitmap.width===0||Fe.bitmap.height===0)continue;const ft={x:0,y:0,w:Fe.bitmap.width+2,h:Fe.bitmap.height+2};$.push(ft),Ue[$e]={rect:ft,metrics:Fe.metrics}}}const{w:Q,h:ge}=I.p($),be=new I.o({width:Q||1,height:ge||1});for(const Le in H){const pe=H[Le];for(const Ue in pe){const $e=pe[+Ue];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const Fe=X[Le][Ue].rect;I.o.copy($e.bitmap,be,{x:0,y:0},{x:Fe.x+1,y:Fe.y+1},$e.bitmap)}}this.image=be,this.positions=X}}I.bk("GlyphAtlas",D);class F{constructor(H){this.tileID=new I.S(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,X,$,Q){return I._(this,void 0,void 0,function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new I.a5;const ge=new I.bl(Object.keys(H.layers).sort()),be=new I.bm(this.tileID,this.promoteId);be.bucketLayerIDs=[];const Le={},pe={featureIndex:be,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:$},Ue=X.familiesBySource[this.source];for(const fi in Ue){const Ii=H.layers[fi];if(!Ii)continue;Ii.version===1&&I.w(`Vector tile source "${this.source}" layer "${fi}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Mi=ge.encode(fi),tn=[];for(let wi=0;wi=Rn.maxzoom||Rn.visibility!=="none"&&(j(wi,this.zoom,$),(Le[Rn.id]=Rn.createBucket({index:be.bucketLayerIDs.length,layers:wi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Mi,sourceID:this.source})).populate(tn,pe,this.tileID.canonical),be.bucketLayerIDs.push(wi.map(Oo=>Oo.id)))}}const $e=I.aG(pe.glyphDependencies,fi=>Object.keys(fi).map(Number));this.inFlightDependencies.forEach(fi=>fi==null?void 0:fi.abort()),this.inFlightDependencies=[];let Fe=Promise.resolve({});if(Object.keys($e).length){const fi=new AbortController;this.inFlightDependencies.push(fi),Fe=Q.sendAsync({type:"GG",data:{stacks:$e,source:this.source,tileID:this.tileID,type:"glyphs"}},fi)}const ft=Object.keys(pe.iconDependencies);let jt=Promise.resolve({});if(ft.length){const fi=new AbortController;this.inFlightDependencies.push(fi),jt=Q.sendAsync({type:"GI",data:{icons:ft,source:this.source,tileID:this.tileID,type:"icons"}},fi)}const Qt=Object.keys(pe.patternDependencies);let ui=Promise.resolve({});if(Qt.length){const fi=new AbortController;this.inFlightDependencies.push(fi),ui=Q.sendAsync({type:"GI",data:{icons:Qt,source:this.source,tileID:this.tileID,type:"patterns"}},fi)}const[bi,Yt,Ai]=yield Promise.all([Fe,jt,ui]),zi=new D(bi),ji=new I.bn(Yt,Ai);for(const fi in Le){const Ii=Le[fi];Ii instanceof I.a6?(j(Ii.layers,this.zoom,$),I.bo({bucket:Ii,glyphMap:bi,glyphPositions:zi.positions,imageMap:Yt,imagePositions:ji.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ii.hasPattern&&(Ii instanceof I.bp||Ii instanceof I.bq||Ii instanceof I.br)&&(j(Ii.layers,this.zoom,$),Ii.addFeatures(pe,this.tileID.canonical,ji.patternPositions))}return this.status="done",{buckets:Object.values(Le).filter(fi=>!fi.isEmpty()),featureIndex:be,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:zi.image,imageAtlas:ji,glyphMap:this.returnDependencies?bi:null,iconMap:this.returnDependencies?Yt:null,glyphPositions:this.returnDependencies?zi.positions:null}})}}function j(ce,H,X){const $=new I.a9(H);for(const Q of ce)Q.recalculate($,X)}class N{constructor(H,X,$){this.actor=H,this.layerIndex=X,this.availableImages=$,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(H,X){return I._(this,void 0,void 0,function*(){const $=yield I.l(H.request,X);try{return{vectorTile:new I.bs.VectorTile(new I.bt($.data)),rawData:$.data,cacheControl:$.cacheControl,expires:$.expires}}catch(Q){const ge=new Uint8Array($.data);let be=`Unable to parse the tile at ${H.request.url}, `;throw be+=ge[0]===31&&ge[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Q.message}`,new Error(be)}})}loadTile(H){return I._(this,void 0,void 0,function*(){const X=H.uid,$=!!(H&&H.request&&H.request.collectResourceTiming)&&new I.bu(H.request),Q=new F(H);this.loading[X]=Q;const ge=new AbortController;Q.abort=ge;try{const be=yield this.loadVectorTile(H,ge);if(delete this.loading[X],!be)return null;const Le=be.rawData,pe={};be.expires&&(pe.expires=be.expires),be.cacheControl&&(pe.cacheControl=be.cacheControl);const Ue={};if($){const Fe=$.finish();Fe&&(Ue.resourceTiming=JSON.parse(JSON.stringify(Fe)))}Q.vectorTile=be.vectorTile;const $e=Q.parse(be.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[X]=Q,this.fetching[X]={rawTileData:Le,cacheControl:pe,resourceTiming:Ue};try{const Fe=yield $e;return I.e({rawTileData:Le.slice(0)},Fe,pe,Ue)}finally{delete this.fetching[X]}}catch(be){throw delete this.loading[X],Q.status="done",this.loaded[X]=Q,be}})}reloadTile(H){return I._(this,void 0,void 0,function*(){const X=H.uid;if(!this.loaded||!this.loaded[X])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const $=this.loaded[X];if($.showCollisionBoxes=H.showCollisionBoxes,$.status==="parsing"){const Q=yield $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor);let ge;if(this.fetching[X]){const{rawTileData:be,cacheControl:Le,resourceTiming:pe}=this.fetching[X];delete this.fetching[X],ge=I.e({rawTileData:be.slice(0)},Q,Le,pe)}else ge=Q;return ge}if($.status==="done"&&$.vectorTile)return $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(H){return I._(this,void 0,void 0,function*(){const X=this.loading,$=H.uid;X&&X[$]&&X[$].abort&&(X[$].abort.abort(),delete X[$])})}removeTile(H){return I._(this,void 0,void 0,function*(){this.loaded&&this.loaded[H.uid]&&delete this.loaded[H.uid]})}}class V{constructor(){this.loaded={}}loadTile(H){return I._(this,void 0,void 0,function*(){const{uid:X,encoding:$,rawImageData:Q,redFactor:ge,greenFactor:be,blueFactor:Le,baseShift:pe}=H,Ue=Q.width+2,$e=Q.height+2,Fe=I.b(Q)?new I.R({width:Ue,height:$e},yield I.bv(Q,-1,-1,Ue,$e)):Q,ft=new I.bw(X,Fe,$,ge,be,Le,pe);return this.loaded=this.loaded||{},this.loaded[X]=ft,ft})}removeTile(H){const X=this.loaded,$=H.uid;X&&X[$]&&delete X[$]}}function ne(ce,H){if(ce.length!==0){re(ce[0],H);for(var X=1;X=Math.abs(Le)?X-pe+Le:Le-pe+X,X=pe}X+$>=0!=!!H&&ce.reverse()}var Ae=I.bx(function ce(H,X){var $,Q=H&&H.type;if(Q==="FeatureCollection")for($=0;$>31}function dt(ce,H){for(var X=ce.loadGeometry(),$=ce.type,Q=0,ge=0,be=X.length,Le=0;Lece},Wt=Math.fround||(it=new Float32Array(1),ce=>(it[0]=+ce,it[0]));var it;const Ft=3,Ut=5,Gt=6;class et{constructor(H){this.options=Object.assign(Object.create(It),H),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(H){const{log:X,minZoom:$,maxZoom:Q}=this.options;X&&console.time("total time");const ge=`prepare ${H.length} points`;X&&console.time(ge),this.points=H;const be=[];for(let pe=0;pe=$;pe--){const Ue=+Date.now();Le=this.trees[pe]=this._createTree(this._cluster(Le,pe)),X&&console.log("z%d: %d clusters in %dms",pe,Le.numItems,+Date.now()-Ue)}return X&&console.timeEnd("total time"),this}getClusters(H,X){let $=((H[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,H[1]));let ge=H[2]===180?180:((H[2]+180)%360+360)%360-180;const be=Math.max(-90,Math.min(90,H[3]));if(H[2]-H[0]>=360)$=-180,ge=180;else if($>ge){const Fe=this.getClusters([$,Q,180,be],X),ft=this.getClusters([-180,Q,ge,be],X);return Fe.concat(ft)}const Le=this.trees[this._limitZoom(X)],pe=Le.range(vt($),_e(be),vt(ge),_e(Q)),Ue=Le.data,$e=[];for(const Fe of pe){const ft=this.stride*Fe;$e.push(Ue[ft+Ut]>1?Ot(Ue,ft,this.clusterProps):this.points[Ue[ft+Ft]])}return $e}getChildren(H){const X=this._getOriginId(H),$=this._getOriginZoom(H),Q="No cluster with the specified id.",ge=this.trees[$];if(!ge)throw new Error(Q);const be=ge.data;if(X*this.stride>=be.length)throw new Error(Q);const Le=this.options.radius/(this.options.extent*Math.pow(2,$-1)),pe=ge.within(be[X*this.stride],be[X*this.stride+1],Le),Ue=[];for(const $e of pe){const Fe=$e*this.stride;be[Fe+4]===H&&Ue.push(be[Fe+Ut]>1?Ot(be,Fe,this.clusterProps):this.points[be[Fe+Ft]])}if(Ue.length===0)throw new Error(Q);return Ue}getLeaves(H,X,$){const Q=[];return this._appendLeaves(Q,H,X=X||10,$=$||0,0),Q}getTile(H,X,$){const Q=this.trees[this._limitZoom(H)],ge=Math.pow(2,H),{extent:be,radius:Le}=this.options,pe=Le/be,Ue=($-pe)/ge,$e=($+1+pe)/ge,Fe={features:[]};return this._addTileFeatures(Q.range((X-pe)/ge,Ue,(X+1+pe)/ge,$e),Q.data,X,$,ge,Fe),X===0&&this._addTileFeatures(Q.range(1-pe/ge,Ue,1,$e),Q.data,ge,$,ge,Fe),X===ge-1&&this._addTileFeatures(Q.range(0,Ue,pe/ge,$e),Q.data,-1,$,ge,Fe),Fe.features.length?Fe:null}getClusterExpansionZoom(H){let X=this._getOriginZoom(H)-1;for(;X<=this.options.maxZoom;){const $=this.getChildren(H);if(X++,$.length!==1)break;H=$[0].properties.cluster_id}return X}_appendLeaves(H,X,$,Q,ge){const be=this.getChildren(X);for(const Le of be){const pe=Le.properties;if(pe&&pe.cluster?ge+pe.point_count<=Q?ge+=pe.point_count:ge=this._appendLeaves(H,pe.cluster_id,$,Q,ge):ge1;let $e,Fe,ft;if(Ue)$e=pt(X,pe,this.clusterProps),Fe=X[pe],ft=X[pe+1];else{const ui=this.points[X[pe+Ft]];$e=ui.properties;const[bi,Yt]=ui.geometry.coordinates;Fe=vt(bi),ft=_e(Yt)}const jt={type:1,geometry:[[Math.round(this.options.extent*(Fe*ge-$)),Math.round(this.options.extent*(ft*ge-Q))]],tags:$e};let Qt;Qt=Ue||this.options.generateId?X[pe+Ft]:this.points[X[pe+Ft]].id,Qt!==void 0&&(jt.id=Qt),be.features.push(jt)}}_limitZoom(H){return Math.max(this.options.minZoom,Math.min(Math.floor(+H),this.options.maxZoom+1))}_cluster(H,X){const{radius:$,extent:Q,reduce:ge,minPoints:be}=this.options,Le=$/(Q*Math.pow(2,X)),pe=H.data,Ue=[],$e=this.stride;for(let Fe=0;FeX&&(bi+=pe[Ai+Ut])}if(bi>ui&&bi>=be){let Yt,Ai=ft*ui,zi=jt*ui,ji=-1;const fi=((Fe/$e|0)<<5)+(X+1)+this.points.length;for(const Ii of Qt){const Mi=Ii*$e;if(pe[Mi+2]<=X)continue;pe[Mi+2]=X;const tn=pe[Mi+Ut];Ai+=pe[Mi]*tn,zi+=pe[Mi+1]*tn,pe[Mi+4]=fi,ge&&(Yt||(Yt=this._map(pe,Fe,!0),ji=this.clusterProps.length,this.clusterProps.push(Yt)),ge(Yt,this._map(pe,Mi)))}pe[Fe+4]=fi,Ue.push(Ai/bi,zi/bi,1/0,fi,-1,bi),ge&&Ue.push(ji)}else{for(let Yt=0;Yt<$e;Yt++)Ue.push(pe[Fe+Yt]);if(bi>1)for(const Yt of Qt){const Ai=Yt*$e;if(!(pe[Ai+2]<=X)){pe[Ai+2]=X;for(let zi=0;zi<$e;zi++)Ue.push(pe[Ai+zi])}}}}return Ue}_getOriginId(H){return H-this.points.length>>5}_getOriginZoom(H){return(H-this.points.length)%32}_map(H,X,$){if(H[X+Ut]>1){const be=this.clusterProps[H[X+Gt]];return $?Object.assign({},be):be}const Q=this.points[H[X+Ft]].properties,ge=this.options.map(Q);return $&&ge===Q?Object.assign({},ge):ge}}function Ot(ce,H,X){return{type:"Feature",id:ce[H+Ft],properties:pt(ce,H,X),geometry:{type:"Point",coordinates:[($=ce[H],360*($-.5)),vi(ce[H+1])]}};var $}function pt(ce,H,X){const $=ce[H+Ut],Q=$>=1e4?`${Math.round($/1e3)}k`:$>=1e3?Math.round($/100)/10+"k":$,ge=ce[H+Gt],be=ge===-1?{}:Object.assign({},X[ge]);return Object.assign(be,{cluster:!0,cluster_id:ce[H+Ft],point_count:$,point_count_abbreviated:Q})}function vt(ce){return ce/360+.5}function _e(ce){const H=Math.sin(ce*Math.PI/180),X=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return X<0?0:X>1?1:X}function vi(ce){const H=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(H))/Math.PI-90}function Jt(ce,H,X,$){let Q=$;const ge=H+(X-H>>1);let be,Le=X-H;const pe=ce[H],Ue=ce[H+1],$e=ce[X],Fe=ce[X+1];for(let ft=H+3;ftQ)be=ft,Q=jt;else if(jt===Q){const Qt=Math.abs(ft-ge);Qt$&&(be-H>3&&Jt(ce,H,be,$),ce[be+2]=Q,X-be>3&&Jt(ce,be,X,$))}function yt(ce,H,X,$,Q,ge){let be=Q-X,Le=ge-$;if(be!==0||Le!==0){const pe=((ce-X)*be+(H-$)*Le)/(be*be+Le*Le);pe>1?(X=Q,$=ge):pe>0&&(X+=be*pe,$+=Le*pe)}return be=ce-X,Le=H-$,be*be+Le*Le}function he(ce,H,X,$){const Q={id:ce??null,type:H,geometry:X,tags:$,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(H==="Point"||H==="MultiPoint"||H==="LineString")xe(Q,X);else if(H==="Polygon")xe(Q,X[0]);else if(H==="MultiLineString")for(const ge of X)xe(Q,ge);else if(H==="MultiPolygon")for(const ge of X)xe(Q,ge[0]);return Q}function xe(ce,H){for(let X=0;X0&&(be+=$?(Q*$e-Ue*ge)/2:Math.sqrt(Math.pow(Ue-Q,2)+Math.pow($e-ge,2))),Q=Ue,ge=$e}const Le=H.length-3;H[2]=1,Jt(H,0,Le,X),H[Le+2]=1,H.size=Math.abs(be),H.start=0,H.end=H.size}function Xi(ce,H,X,$){for(let Q=0;Q1?1:X}function Hi(ce,H,X,$,Q,ge,be,Le){if($/=H,ge>=(X/=H)&&be<$)return ce;if(be=$)return null;const pe=[];for(const Ue of ce){const $e=Ue.geometry;let Fe=Ue.type;const ft=Q===0?Ue.minX:Ue.minY,jt=Q===0?Ue.maxX:Ue.maxY;if(ft>=X&&jt<$){pe.push(Ue);continue}if(jt=$)continue;let Qt=[];if(Fe==="Point"||Fe==="MultiPoint")to($e,Qt,X,$,Q);else if(Fe==="LineString")Yn($e,Qt,X,$,Q,!1,Le.lineMetrics);else if(Fe==="MultiLineString")hi($e,Qt,X,$,Q,!1);else if(Fe==="Polygon")hi($e,Qt,X,$,Q,!0);else if(Fe==="MultiPolygon")for(const ui of $e){const bi=[];hi(ui,bi,X,$,Q,!0),bi.length&&Qt.push(bi)}if(Qt.length){if(Le.lineMetrics&&Fe==="LineString"){for(const ui of Qt)pe.push(he(Ue.id,Fe,ui,Ue.tags));continue}Fe!=="LineString"&&Fe!=="MultiLineString"||(Qt.length===1?(Fe="LineString",Qt=Qt[0]):Fe="MultiLineString"),Fe!=="Point"&&Fe!=="MultiPoint"||(Fe=Qt.length===3?"Point":"MultiPoint"),pe.push(he(Ue.id,Fe,Qt,Ue.tags))}}return pe.length?pe:null}function to(ce,H,X,$,Q){for(let ge=0;ge=X&&be<=$&&Mn(H,ce[ge],ce[ge+1],ce[ge+2])}}function Yn(ce,H,X,$,Q,ge,be){let Le=Kr(ce);const pe=Q===0?ms:zs;let Ue,$e,Fe=ce.start;for(let bi=0;biX&&($e=pe(Le,Yt,Ai,ji,fi,X),be&&(Le.start=Fe+Ue*$e)):Ii>$?Mi<$&&($e=pe(Le,Yt,Ai,ji,fi,$),be&&(Le.start=Fe+Ue*$e)):Mn(Le,Yt,Ai,zi),Mi=X&&($e=pe(Le,Yt,Ai,ji,fi,X),tn=!0),Mi>$&&Ii<=$&&($e=pe(Le,Yt,Ai,ji,fi,$),tn=!0),!ge&&tn&&(be&&(Le.end=Fe+Ue*$e),H.push(Le),Le=Kr(ce)),be&&(Fe+=Ue)}let ft=ce.length-3;const jt=ce[ft],Qt=ce[ft+1],ui=Q===0?jt:Qt;ui>=X&&ui<=$&&Mn(Le,jt,Qt,ce[ft+2]),ft=Le.length-3,ge&&ft>=3&&(Le[ft]!==Le[0]||Le[ft+1]!==Le[1])&&Mn(Le,Le[0],Le[1],Le[2]),Le.length&&H.push(Le)}function Kr(ce){const H=[];return H.size=ce.size,H.start=ce.start,H.end=ce.end,H}function hi(ce,H,X,$,Q,ge){for(const be of ce)Yn(be,H,X,$,Q,ge,!1)}function Mn(ce,H,X,$){ce.push(H,X,$)}function ms(ce,H,X,$,Q,ge){const be=(ge-H)/($-H);return Mn(ce,ge,X+(Q-X)*be,1),be}function zs(ce,H,X,$,Q,ge){const be=(ge-X)/(Q-X);return Mn(ce,H+($-H)*be,ge,1),be}function Ge(ce,H){const X=[];for(let $=0;$0&&H.size<(Q?be:$))return void(X.numPoints+=H.length/3);const Le=[];for(let pe=0;pebe)&&(X.numSimplified++,Le.push(H[pe],H[pe+1])),X.numPoints++;Q&&function(pe,Ue){let $e=0;for(let Fe=0,ft=pe.length,jt=ft-2;Fe0===Ue)for(let Fe=0,ft=pe.length;Fe24)throw new Error("maxZoom should be in the 0-24 range");if(X.promoteId&&X.generateId)throw new Error("promoteId and generateId cannot be used together.");let Q=function(ge,be){const Le=[];if(ge.type==="FeatureCollection")for(let pe=0;pe1&&console.time("creation"),jt=this.tiles[ft]=gs(H,X,$,Q,Ue),this.tileCoords.push({z:X,x:$,y:Q}),$e)){$e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",X,$,Q,jt.numFeatures,jt.numPoints,jt.numSimplified),console.timeEnd("creation"));const tn=`z${X}`;this.stats[tn]=(this.stats[tn]||0)+1,this.total++}if(jt.source=H,ge==null){if(X===Ue.indexMaxZoom||jt.numPoints<=Ue.indexMaxPoints)continue}else{if(X===Ue.maxZoom||X===ge)continue;if(ge!=null){const tn=ge-X;if($!==be>>tn||Q!==Le>>tn)continue}}if(jt.source=null,H.length===0)continue;$e>1&&console.time("clipping");const Qt=.5*Ue.buffer/Ue.extent,ui=.5-Qt,bi=.5+Qt,Yt=1+Qt;let Ai=null,zi=null,ji=null,fi=null,Ii=Hi(H,Fe,$-Qt,$+bi,0,jt.minX,jt.maxX,Ue),Mi=Hi(H,Fe,$+ui,$+Yt,0,jt.minX,jt.maxX,Ue);H=null,Ii&&(Ai=Hi(Ii,Fe,Q-Qt,Q+bi,1,jt.minY,jt.maxY,Ue),zi=Hi(Ii,Fe,Q+ui,Q+Yt,1,jt.minY,jt.maxY,Ue),Ii=null),Mi&&(ji=Hi(Mi,Fe,Q-Qt,Q+bi,1,jt.minY,jt.maxY,Ue),fi=Hi(Mi,Fe,Q+ui,Q+Yt,1,jt.minY,jt.maxY,Ue),Mi=null),$e>1&&console.timeEnd("clipping"),pe.push(Ai||[],X+1,2*$,2*Q),pe.push(zi||[],X+1,2*$,2*Q+1),pe.push(ji||[],X+1,2*$+1,2*Q),pe.push(fi||[],X+1,2*$+1,2*Q+1)}}getTile(H,X,$){H=+H,X=+X,$=+$;const Q=this.options,{extent:ge,debug:be}=Q;if(H<0||H>24)return null;const Le=1<1&&console.log("drilling down to z%d-%d-%d",H,X,$);let Ue,$e=H,Fe=X,ft=$;for(;!Ue&&$e>0;)$e--,Fe>>=1,ft>>=1,Ue=this.tiles[Rr($e,Fe,ft)];return Ue&&Ue.source?(be>1&&(console.log("found parent tile z%d-%d-%d",$e,Fe,ft),console.time("drilling down")),this.splitTile(Ue.source,$e,Fe,ft,H,X,$),be>1&&console.timeEnd("drilling down"),this.tiles[pe]?li(this.tiles[pe],ge):null):null}}function Rr(ce,H,X){return 32*((1<{Fe.properties=jt;const Qt={};for(const ui of ft)Qt[ui]=pe[ui].evaluate($e,Fe);return Qt},be.reduce=(jt,Qt)=>{Fe.properties=Qt;for(const ui of ft)$e.accumulated=jt[ui],jt[ui]=Ue[ui].evaluate($e,Fe)},be}(H)).load((yield this._pendingData).features):(Q=yield this._pendingData,new Kn(Q,H.geojsonVtOptions)),this.loaded={};const ge={};if($){const be=$.finish();be&&(ge.resourceTiming={},ge.resourceTiming[H.source]=JSON.parse(JSON.stringify(be)))}return ge}catch(ge){if(delete this._pendingRequest,I.bA(ge))return{abandoned:!0};throw ge}var Q})}getData(){return I._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(H){const X=this.loaded;return X&&X[H.uid]?super.reloadTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,X){return I._(this,void 0,void 0,function*(){let $=yield this.loadGeoJSON(H,X);if(delete this._pendingRequest,typeof $!="object")throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(Ae($,!0),H.filter){const Q=I.bB(H.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(be=>`${be.key}: ${be.message}`).join(", "));$={type:"FeatureCollection",features:$.features.filter(be=>Q.value.evaluate({zoom:0},be))}}return $})}loadGeoJSON(H,X){return I._(this,void 0,void 0,function*(){const{promoteId:$}=H;if(H.request){const Q=yield I.h(H.request,X);return this._dataUpdateable=cn(Q.data,$)?ur(Q.data,$):void 0,Q.data}if(typeof H.data=="string")try{const Q=JSON.parse(H.data);return this._dataUpdateable=cn(Q,$)?ur(Q,$):void 0,Q}catch{throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}if(!H.dataDiff)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${H.source}`);return function(Q,ge,be){var Le,pe,Ue,$e;if(ge.removeAll&&Q.clear(),ge.remove)for(const Fe of ge.remove)Q.delete(Fe);if(ge.add)for(const Fe of ge.add){const ft=si(Fe,be);ft!=null&&Q.set(ft,Fe)}if(ge.update)for(const Fe of ge.update){let ft=Q.get(Fe.id);if(ft==null)continue;const jt=!Fe.removeAllProperties&&(((Le=Fe.removeProperties)===null||Le===void 0?void 0:Le.length)>0||((pe=Fe.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0);if((Fe.newGeometry||Fe.removeAllProperties||jt)&&(ft=Object.assign({},ft),Q.set(Fe.id,ft),jt&&(ft.properties=Object.assign({},ft.properties))),Fe.newGeometry&&(ft.geometry=Fe.newGeometry),Fe.removeAllProperties)ft.properties={};else if(((Ue=Fe.removeProperties)===null||Ue===void 0?void 0:Ue.length)>0)for(const Qt of Fe.removeProperties)Object.prototype.hasOwnProperty.call(ft.properties,Qt)&&delete ft.properties[Qt];if((($e=Fe.addOrUpdateProperties)===null||$e===void 0?void 0:$e.length)>0)for(const{key:Qt,value:ui}of Fe.addOrUpdateProperties)ft.properties[Qt]=ui}}(this._dataUpdateable,H.dataDiff,$),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(H){return I._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getLeaves(H.clusterId,H.limit,H.offset)}}class Dr{constructor(H){this.self=H,this.actor=new I.F(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(X,$)=>{if(this.externalWorkerSourceTypes[X])throw new Error(`Worker source with name "${X}" already registered.`);this.externalWorkerSourceTypes[X]=$},this.self.addProtocol=I.bh,this.self.removeProtocol=I.bi,this.self.registerRTLTextPlugin=X=>{if(I.bC.isParsed())throw new Error("RTL text plugin already registered.");I.bC.setMethods(X)},this.actor.registerMessageHandler("LDT",(X,$)=>this._getDEMWorkerSource(X,$.source).loadTile($)),this.actor.registerMessageHandler("RDT",(X,$)=>I._(this,void 0,void 0,function*(){this._getDEMWorkerSource(X,$.source).removeTile($)})),this.actor.registerMessageHandler("GCEZ",(X,$)=>I._(this,void 0,void 0,function*(){return this._getWorkerSource(X,$.type,$.source).getClusterExpansionZoom($)})),this.actor.registerMessageHandler("GCC",(X,$)=>I._(this,void 0,void 0,function*(){return this._getWorkerSource(X,$.type,$.source).getClusterChildren($)})),this.actor.registerMessageHandler("GCL",(X,$)=>I._(this,void 0,void 0,function*(){return this._getWorkerSource(X,$.type,$.source).getClusterLeaves($)})),this.actor.registerMessageHandler("LD",(X,$)=>this._getWorkerSource(X,$.type,$.source).loadData($)),this.actor.registerMessageHandler("GD",(X,$)=>this._getWorkerSource(X,$.type,$.source).getData()),this.actor.registerMessageHandler("LT",(X,$)=>this._getWorkerSource(X,$.type,$.source).loadTile($)),this.actor.registerMessageHandler("RT",(X,$)=>this._getWorkerSource(X,$.type,$.source).reloadTile($)),this.actor.registerMessageHandler("AT",(X,$)=>this._getWorkerSource(X,$.type,$.source).abortTile($)),this.actor.registerMessageHandler("RMT",(X,$)=>this._getWorkerSource(X,$.type,$.source).removeTile($)),this.actor.registerMessageHandler("RS",(X,$)=>I._(this,void 0,void 0,function*(){if(!this.workerSources[X]||!this.workerSources[X][$.type]||!this.workerSources[X][$.type][$.source])return;const Q=this.workerSources[X][$.type][$.source];delete this.workerSources[X][$.type][$.source],Q.removeSource!==void 0&&Q.removeSource($)})),this.actor.registerMessageHandler("RM",X=>I._(this,void 0,void 0,function*(){delete this.layerIndexes[X],delete this.availableImages[X],delete this.workerSources[X],delete this.demWorkerSources[X]})),this.actor.registerMessageHandler("SR",(X,$)=>I._(this,void 0,void 0,function*(){this.referrer=$})),this.actor.registerMessageHandler("SRPS",(X,$)=>this._syncRTLPluginState(X,$)),this.actor.registerMessageHandler("IS",(X,$)=>I._(this,void 0,void 0,function*(){this.self.importScripts($)})),this.actor.registerMessageHandler("SI",(X,$)=>this._setImages(X,$)),this.actor.registerMessageHandler("UL",(X,$)=>I._(this,void 0,void 0,function*(){this._getLayerIndex(X).update($.layers,$.removedIds)})),this.actor.registerMessageHandler("SL",(X,$)=>I._(this,void 0,void 0,function*(){this._getLayerIndex(X).replace($)}))}_setImages(H,X){return I._(this,void 0,void 0,function*(){this.availableImages[H]=X;for(const $ in this.workerSources[H]){const Q=this.workerSources[H][$];for(const ge in Q)Q[ge].availableImages=X}})}_syncRTLPluginState(H,X){return I._(this,void 0,void 0,function*(){if(I.bC.isParsed())return I.bC.getState();if(X.pluginStatus!=="loading")return I.bC.setState(X),X;const $=X.pluginURL;if(this.self.importScripts($),I.bC.isParsed()){const Q={pluginStatus:"loaded",pluginURL:$};return I.bC.setState(Q),Q}throw I.bC.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${$}`)})}_getAvailableImages(H){let X=this.availableImages[H];return X||(X=[]),X}_getLayerIndex(H){let X=this.layerIndexes[H];return X||(X=this.layerIndexes[H]=new f),X}_getWorkerSource(H,X,$){if(this.workerSources[H]||(this.workerSources[H]={}),this.workerSources[H][X]||(this.workerSources[H][X]={}),!this.workerSources[H][X][$]){const Q={sendAsync:(ge,be)=>(ge.targetMapId=H,this.actor.sendAsync(ge,be))};switch(X){case"vector":this.workerSources[H][X][$]=new N(Q,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][X][$]=new In(Q,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][X][$]=new this.externalWorkerSourceTypes[X](Q,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][X][$]}_getDEMWorkerSource(H,X){return this.demWorkerSources[H]||(this.demWorkerSources[H]={}),this.demWorkerSources[H][X]||(this.demWorkerSources[H][X]=new V),this.demWorkerSources[H][X]}}return I.i(self)&&(self.worker=new Dr(self)),Dr}),_("index",["exports","./shared"],function(I,f){var D="4.5.1";let F,j;const N={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:x=>new Promise((t,l)=>{const p=requestAnimationFrame(t);x.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),l(f.c())})}),getImageData(x,t=0){return this.getImageCanvasContext(x).getImageData(-t,-t,x.width+2*t,x.height+2*t)},getImageCanvasContext(x){const t=window.document.createElement("canvas"),l=t.getContext("2d",{willReadFrequently:!0});if(!l)throw new Error("failed to create canvas 2d context");return t.width=x.width,t.height=x.height,l.drawImage(x,0,0,x.width,x.height),l},resolveURL:x=>(F||(F=document.createElement("a")),F.href=x,F.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(j==null&&(j=matchMedia("(prefers-reduced-motion: reduce)")),j.matches)}};class V{static testProp(t){if(!V.docStyle)return t[0];for(let l=0;l{window.removeEventListener("click",V.suppressClickInternal,!0)},0)}static getScale(t){const l=t.getBoundingClientRect();return{x:l.width/t.offsetWidth||1,y:l.height/t.offsetHeight||1,boundingClientRect:l}}static getPoint(t,l,p){const m=l.boundingClientRect;return new f.P((p.clientX-m.left)/l.x-t.clientLeft,(p.clientY-m.top)/l.y-t.clientTop)}static mousePos(t,l){const p=V.getScale(t);return V.getPoint(t,p,l)}static touchPos(t,l){const p=[],m=V.getScale(t);for(let b=0;b{re&&Ce(re),re=null,Te=!0},Ae.onerror=()=>{we=!0,re=null},Ae.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(x){let t,l,p,m;x.resetRequestQueue=()=>{t=[],l=0,p=0,m={}},x.addThrottleControl=R=>{const z=p++;return m[z]=R,z},x.removeThrottleControl=R=>{delete m[R],C()},x.getImage=(R,z,G=!0)=>new Promise((q,K)=>{ne.supported&&(R.headers||(R.headers={}),R.headers.accept="image/webp,*/*"),f.e(R,{type:"image"}),t.push({abortController:z,requestParameters:R,supportImageRefresh:G,state:"queued",onError:ee=>{K(ee)},onSuccess:ee=>{q(ee)}}),C()});const b=R=>f._(this,void 0,void 0,function*(){R.state="running";const{requestParameters:z,supportImageRefresh:G,onError:q,onSuccess:K,abortController:ee}=R,se=G===!1&&!f.i(self)&&!f.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((fe,ye)=>fe&&ye==="accept",!0));l++;const ue=se?L(z,ee):f.m(z,ee);try{const fe=yield ue;delete R.abortController,R.state="completed",fe.data instanceof HTMLImageElement||f.b(fe.data)?K(fe):fe.data&&K({data:yield(ae=fe.data,typeof createImageBitmap=="function"?f.d(ae):f.f(ae)),cacheControl:fe.cacheControl,expires:fe.expires})}catch(fe){delete R.abortController,q(fe)}finally{l--,C()}var ae}),C=()=>{const R=(()=>{for(const z of Object.keys(m))if(m[z]())return!0;return!1})()?f.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:f.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=l;z0;z++){const G=t.shift();G.abortController.signal.aborted?z--:b(G)}},L=(R,z)=>new Promise((G,q)=>{const K=new Image,ee=R.url,se=R.credentials;se&&se==="include"?K.crossOrigin="use-credentials":(se&&se==="same-origin"||!f.s(ee))&&(K.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{K.src="",q(f.c())}),K.fetchPriority="high",K.onload=()=>{K.onerror=K.onload=null,G({data:K})},K.onerror=()=>{K.onerror=K.onload=null,z.signal.aborted||q(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."))},K.src=ee})}(ke||(ke={})),ke.resetRequestQueue();class Re{constructor(t){this._transformRequestFn=t}transformRequest(t,l){return this._transformRequestFn&&this._transformRequestFn(t,l)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function ze(x){var t=new f.A(3);return t[0]=x[0],t[1]=x[1],t[2]=x[2],t}var Oe,Ze=function(x,t,l){return x[0]=t[0]-l[0],x[1]=t[1]-l[1],x[2]=t[2]-l[2],x};Oe=new f.A(3),f.A!=Float32Array&&(Oe[0]=0,Oe[1]=0,Oe[2]=0);var je=function(x){var t=x[0],l=x[1];return t*t+l*l};function Ve(x){const t=[];if(typeof x=="string")t.push({id:"default",url:x});else if(x&&x.length>0){const l=[];for(const{id:p,url:m}of x){const b=`${p}${m}`;l.indexOf(b)===-1&&(l.push(b),t.push({id:p,url:m}))}}return t}function st(x,t,l){const p=x.split("?");return p[0]+=`${t}${l}`,p.join("?")}(function(){var x=new f.A(2);f.A!=Float32Array&&(x[0]=0,x[1]=0)})();class Se{constructor(t,l,p,m){this.context=t,this.format=p,this.texture=t.gl.createTexture(),this.update(l,m)}update(t,l,p){const{width:m,height:b}=t,C=!(this.size&&this.size[0]===m&&this.size[1]===b||p),{context:L}=this,{gl:R}=L;if(this.useMipmap=!!(l&&l.useMipmap),R.bindTexture(R.TEXTURE_2D,this.texture),L.pixelStoreUnpackFlipY.set(!1),L.pixelStoreUnpack.set(1),L.pixelStoreUnpackPremultiplyAlpha.set(this.format===R.RGBA&&(!l||l.premultiply!==!1)),C)this.size=[m,b],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||f.b(t)?R.texImage2D(R.TEXTURE_2D,0,this.format,this.format,R.UNSIGNED_BYTE,t):R.texImage2D(R.TEXTURE_2D,0,this.format,m,b,0,this.format,R.UNSIGNED_BYTE,t.data);else{const{x:z,y:G}=p||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||f.b(t)?R.texSubImage2D(R.TEXTURE_2D,0,z,G,R.RGBA,R.UNSIGNED_BYTE,t):R.texSubImage2D(R.TEXTURE_2D,0,z,G,m,b,R.RGBA,R.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&R.generateMipmap(R.TEXTURE_2D)}bind(t,l,p){const{context:m}=this,{gl:b}=m;b.bindTexture(b.TEXTURE_2D,this.texture),p!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=b.LINEAR),t!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,t),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,p||t),this.filter=t),l!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,l),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,l),this.wrap=l)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Lt(x){const{userImage:t}=x;return!!(t&&t.render&&t.render())&&(x.data.replace(new Uint8Array(t.data.buffer)),!0)}class _t extends f.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new f.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:l,promiseResolve:p}of this.requestors)p(this._getImagesForIds(l));this.requestors=[]}}getImage(t){const l=this.images[t];if(l&&!l.data&&l.spriteData){const p=l.spriteData;l.data=new f.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),l.spriteData=null}return l}addImage(t,l){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,l)&&(this.images[t]=l)}_validate(t,l){let p=!0;const m=l.data||l.spriteData;return this._validateStretch(l.stretchX,m&&m.width)||(this.fire(new f.j(new Error(`Image "${t}" has invalid "stretchX" value`))),p=!1),this._validateStretch(l.stretchY,m&&m.height)||(this.fire(new f.j(new Error(`Image "${t}" has invalid "stretchY" value`))),p=!1),this._validateContent(l.content,l)||(this.fire(new f.j(new Error(`Image "${t}" has invalid "content" value`))),p=!1),p}_validateStretch(t,l){if(!t)return!0;let p=0;for(const m of t){if(m[0]{let m=!0;if(!this.isLoaded())for(const b of t)this.images[b]||(m=!1);this.isLoaded()||m?l(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:l})})}_getImagesForIds(t){const l={};for(const p of t){let m=this.getImage(p);m||(this.fire(new f.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?l[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:f.w(`Image "${p}" 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 l}getPixelSize(){const{width:t,height:l}=this.atlasImage;return{width:t,height:l}}getPattern(t){const l=this.patterns[t],p=this.getImage(t);if(!p)return null;if(l&&l.position.version===p.version)return l.position;if(l)l.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},b=new f.I(m,p);this.patterns[t]={bin:m,position:b}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const l=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Se(t,this.atlasImage,l.RGBA),this.atlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const b in this.patterns)t.push(this.patterns[b].bin);const{w:l,h:p}=f.p(t),m=this.atlasImage;m.resize({width:l||1,height:p||1});for(const b in this.patterns){const{bin:C}=this.patterns[b],L=C.x+1,R=C.y+1,z=this.getImage(b).data,G=z.width,q=z.height;f.R.copy(z,m,{x:0,y:0},{x:L,y:R},{width:G,height:q}),f.R.copy(z,m,{x:0,y:q-1},{x:L,y:R-1},{width:G,height:1}),f.R.copy(z,m,{x:0,y:0},{x:L,y:R+q},{width:G,height:1}),f.R.copy(z,m,{x:G-1,y:0},{x:L-1,y:R},{width:1,height:q}),f.R.copy(z,m,{x:0,y:0},{x:L+G,y:R},{width:1,height:q})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const l of t){if(this.callbackDispatchedThisFrame[l])continue;this.callbackDispatchedThisFrame[l]=!0;const p=this.getImage(l);p||f.w(`Image with ID: "${l}" was not found`),Lt(p)&&this.updateImage(l,p)}}}const We=1e20;function dt(x,t,l,p,m,b,C,L,R){for(let z=t;z-1);R++,b[R]=L,C[R]=z,C[R+1]=We}for(let L=0,R=0;L65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[b])return{stack:t,id:l,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[b]){const L=lt.loadGlyphRange(t,b,this.url,this.requestManager);p.requests[b]=L}const C=yield p.requests[b];for(const L in C)this._doesCharSupportLocalGlyph(+L)||(p.glyphs[+L]=C[+L]);return p.ranges[b]=!0,{stack:t,id:l,glyph:C[l]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(f.u["CJK Unified Ideographs"](t)||f.u["Hangul Syllables"](t)||f.u.Hiragana(t)||f.u.Katakana(t))}_tinySDF(t,l,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let b=t.tinySDF;if(!b){let L="400";/bold/i.test(l)?L="900":/medium/i.test(l)?L="500":/light/i.test(l)&&(L="200"),b=t.tinySDF=new lt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:L})}const C=b.draw(String.fromCharCode(p));return{id:p,bitmap:new f.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}}}}lt.loadGlyphRange=function(x,t,l,p){return f._(this,void 0,void 0,function*(){const m=256*t,b=m+255,C=p.transformRequest(l.replace("{fontstack}",x).replace("{range}",`${m}-${b}`),"Glyphs"),L=yield f.l(C,new AbortController);if(!L||!L.data)throw new Error(`Could not load glyph range. range: ${t}, ${m}-${b}`);const R={};for(const z of f.n(L.data))R[z.id]=z;return R})},lt.TinySDF=class{constructor({fontSize:x=24,buffer:t=3,radius:l=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:b="normal",fontStyle:C="normal"}={}){this.buffer=t,this.cutoff=p,this.radius=l;const L=this.size=x+4*t,R=this._createCanvas(L),z=this.ctx=R.getContext("2d",{willReadFrequently:!0});z.font=`${C} ${b} ${x}px ${m}`,z.textBaseline="alphabetic",z.textAlign="left",z.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(x){const t=document.createElement("canvas");return t.width=t.height=x,t}draw(x){const{width:t,actualBoundingBoxAscent:l,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:b}=this.ctx.measureText(x),C=Math.ceil(l),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-m))),R=Math.min(this.size-this.buffer,C+Math.ceil(p)),z=L+2*this.buffer,G=R+2*this.buffer,q=Math.max(z*G,0),K=new Uint8ClampedArray(q),ee={data:K,width:z,height:G,glyphWidth:L,glyphHeight:R,glyphTop:C,glyphLeft:0,glyphAdvance:t};if(L===0||R===0)return ee;const{ctx:se,buffer:ue,gridInner:ae,gridOuter:fe}=this;se.clearRect(ue,ue,L,R),se.fillText(x,ue,ue+C);const ye=se.getImageData(ue,ue,L,R);fe.fill(We,0,q),ae.fill(0,0,q);for(let oe=0;oe0?Qe*Qe:0,ae[Be]=Qe<0?Qe*Qe:0}}dt(fe,0,0,z,G,z,this.f,this.v,this.z),dt(ae,ue,ue,L,R,z,this.f,this.v,this.z);for(let oe=0;oe1&&(R=t[++L]);const G=Math.abs(z-R.left),q=Math.abs(z-R.right),K=Math.min(G,q);let ee;const se=b/p*(m+1);if(R.isDash){const ue=m-Math.abs(se);ee=Math.sqrt(K*K+ue*ue)}else ee=m-Math.sqrt(K*K+se*se);this.data[C+z]=Math.max(0,Math.min(255,ee+128))}}}addRegularDash(t){for(let L=t.length-1;L>=0;--L){const R=t[L],z=t[L+1];R.zeroLength?t.splice(L,1):z&&z.isDash===R.isDash&&(z.left=R.left,t.splice(L,1))}const l=t[0],p=t[t.length-1];l.isDash===p.isDash&&(l.left=p.left-this.width,p.right=l.right+this.width);const m=this.width*this.nextRow;let b=0,C=t[b];for(let L=0;L1&&(C=t[++b]);const R=Math.abs(L-C.left),z=Math.abs(L-C.right),G=Math.min(R,z);this.data[m+L]=Math.max(0,Math.min(255,(C.isDash?G:-G)+128))}}addDash(t,l){const p=l?7:0,m=2*p+1;if(this.nextRow+m>this.height)return f.w("LineAtlas out of space"),null;let b=0;for(let L=0;L{l.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[et]}numActive(){return Object.keys(this.active).length}}const pt=Math.floor(N.hardwareConcurrency/2);let vt,_e;function vi(){return vt||(vt=new Ot),vt}Ot.workerCount=f.C(globalThis)?Math.max(Math.min(pt,3),1):1;class Jt{constructor(t,l){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=l;const p=this.workerPool.acquire(l);for(let m=0;m{l.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,l){for(const p of this.actors)p.registerMessageHandler(t,l)}}function yt(){return _e||(_e=new Jt(vi(),f.G),_e.registerMessageHandler("GR",(x,t,l)=>f.m(t,l))),_e}function he(x,t){const l=f.H();return f.J(l,l,[1,1,0]),f.K(l,l,[.5*x.width,.5*x.height,1]),f.L(l,l,x.calculatePosMatrix(t.toUnwrapped()))}function xe(x,t,l,p,m,b){const C=function(q,K,ee){if(q)for(const se of q){const ue=K[se];if(ue&&ue.source===ee&&ue.type==="fill-extrusion")return!0}else for(const se in K){const ue=K[se];if(ue.source===ee&&ue.type==="fill-extrusion")return!0}return!1}(m&&m.layers,t,x.id),L=b.maxPitchScaleFactor(),R=x.tilesIn(p,L,C);R.sort(Dt);const z=[];for(const q of R)z.push({wrappedTileID:q.tileID.wrapped().key,queryResults:q.tile.queryRenderedFeatures(t,l,x._state,q.queryGeometry,q.cameraQueryGeometry,q.scale,m,b,L,he(x.transform,q.tileID))});const G=function(q){const K={},ee={};for(const se of q){const ue=se.queryResults,ae=se.wrappedTileID,fe=ee[ae]=ee[ae]||{};for(const ye in ue){const oe=ue[ye],Ie=fe[ye]=fe[ye]||{},Me=K[ye]=K[ye]||[];for(const Be of oe)Ie[Be.featureIndex]||(Ie[Be.featureIndex]=!0,Me.push(Be))}}return K}(z);for(const q in G)G[q].forEach(K=>{const ee=K.feature,se=x.getFeatureState(ee.layer["source-layer"],ee.id);ee.source=ee.layer.source,ee.layer["source-layer"]&&(ee.sourceLayer=ee.layer["source-layer"]),ee.state=se});return G}function Dt(x,t){const l=x.tileID,p=t.tileID;return l.overscaledZ-p.overscaledZ||l.canonical.y-p.canonical.y||l.wrap-p.wrap||l.canonical.x-p.canonical.x}function Ke(x,t,l){return f._(this,void 0,void 0,function*(){let p=x;if(x.url?p=(yield f.h(t.transformRequest(x.url,"Source"),l)).data:yield N.frameAsync(l),!p)return null;const m=f.M(f.e(p,x),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(b=>b.id)),m})}class Ne{constructor(t,l){t&&(l?this.setSouthWest(t).setNorthEast(l):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof f.N?new f.N(t.lng,t.lat):f.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof f.N?new f.N(t.lng,t.lat):f.N.convert(t),this}extend(t){const l=this._sw,p=this._ne;let m,b;if(t instanceof f.N)m=t,b=t;else{if(!(t instanceof Ne))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Ne.convert(t)):this.extend(f.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(f.N.convert(t)):this;if(m=t._sw,b=t._ne,!m||!b)return this}return l||p?(l.lng=Math.min(m.lng,l.lng),l.lat=Math.min(m.lat,l.lat),p.lng=Math.max(b.lng,p.lng),p.lat=Math.max(b.lat,p.lat)):(this._sw=new f.N(m.lng,m.lat),this._ne=new f.N(b.lng,b.lat)),this}getCenter(){return new f.N((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 f.N(this.getWest(),this.getNorth())}getSouthEast(){return new f.N(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(t){const{lng:l,lat:p}=f.N.convert(t);let m=this._sw.lng<=l&&l<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=l&&l>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(t){return t instanceof Ne?t:t&&new Ne(t)}static fromLngLat(t,l=0){const p=360*l/40075017,m=p/Math.cos(Math.PI/180*t.lat);return new Ne(new f.N(t.lng-m,t.lat-p),new f.N(t.lng+m,t.lat+p))}}class Xi{constructor(t,l,p){this.bounds=Ne.convert(this.validateBounds(t)),this.minzoom=l||0,this.maxzoom=p||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const l=Math.pow(2,t.z),p=Math.floor(f.O(this.bounds.getWest())*l),m=Math.floor(f.Q(this.bounds.getNorth())*l),b=Math.ceil(f.O(this.bounds.getEast())*l),C=Math.ceil(f.Q(this.bounds.getSouth())*l);return t.x>=p&&t.x=m&&t.y{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return f.e({},this._options)}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(l,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((b,C)=>{t.reloadPromise={resolve:b,reject:C}})}else t.actor=this.dispatcher.getActor(),m="LT";t.abortController=new AbortController;try{const b=yield t.actor.sendAsync({type:m,data:p},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,b)}catch(b){if(delete t.abortController,t.aborted)return;if(b&&b.status!==404)throw b;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,l){if(l&&l.resourceTiming&&(t.resourceTiming=l.resourceTiming),l&&this.map._refreshExpiredTiles&&t.setExpiryData(l),t.loadVectorData(l,this.map.painter),t.reloadPromise){const p=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(p.resolve).catch(p.reject)}}abortTile(t){return f._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return f._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Je extends f.E{constructor(t,l,p,m){super(),this.id=t,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=f.e({type:"raster"},l),f.e(this,f.M(l,["url","scheme","tileSize"]))}load(){return f._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new f.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Ke(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(f.e(this,t),t.bounds&&(this.tileBounds=new Xi(t.bounds,this.minzoom,this.maxzoom)),this.fire(new f.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new f.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new f.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return f.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const p=yield ke.getImage(this.map._requestManager.transformRequest(l,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&t.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,b=m.gl,C=p.data;t.texture=this.map.painter.getTileTexture(C.width),t.texture?t.texture.update(C,{useMipmap:!0}):(t.texture=new Se(m,C,b.RGBA,{useMipmap:!0}),t.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST),m.extTextureFilterAnisotropic&&b.texParameterf(b.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax)),t.state="loaded"}}catch(p){if(delete t.abortController,t.aborted)t.state="unloaded";else if(p)throw t.state="errored",p}})}abortTile(t){return f._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return f._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Hi extends Je{constructor(t,l,p,m){super(t,l,p,m),this.type="raster-dem",this.maxzoom=22,this._options=f.e({type:"raster-dem"},l),this.encoding=l.encoding||"mapbox",this.redFactor=l.redFactor,this.greenFactor=l.greenFactor,this.blueFactor=l.blueFactor,this.baseShift=l.baseShift}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(l,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const m=yield ke.getImage(p,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(m&&m.data){const b=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&t.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const C=f.b(b)&&f.U()?b:yield this.readImageNow(b),L={type:this.type,uid:t.uid,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const R=yield t.actor.sendAsync({type:"LDT",data:L});t.dem=R,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(m){if(delete t.abortController,t.aborted)t.state="unloaded";else if(m)throw t.state="errored",m}})}readImageNow(t){return f._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&f.V()){const l=t.width+2,p=t.height+2;try{return new f.R({width:l,height:p},yield f.W(t,-1,-1,l,p))}catch{}}return N.getImageData(t,1)})}_getNeighboringTiles(t){const l=t.canonical,p=Math.pow(2,l.z),m=(l.x-1+p)%p,b=l.x===0?t.wrap-1:t.wrap,C=(l.x+1+p)%p,L=l.x+1===p?t.wrap+1:t.wrap,R={};return R[new f.S(t.overscaledZ,b,l.z,m,l.y).key]={backfilled:!1},R[new f.S(t.overscaledZ,L,l.z,C,l.y).key]={backfilled:!1},l.y>0&&(R[new f.S(t.overscaledZ,b,l.z,m,l.y-1).key]={backfilled:!1},R[new f.S(t.overscaledZ,t.wrap,l.z,l.x,l.y-1).key]={backfilled:!1},R[new f.S(t.overscaledZ,L,l.z,C,l.y-1).key]={backfilled:!1}),l.y+10&&f.e(b,{resourceTiming:m}),this.fire(new f.k("data",Object.assign(Object.assign({},b),{sourceDataType:"metadata"}))),this.fire(new f.k("data",Object.assign(Object.assign({},b),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new f.k("dataabort",{dataType:"source"}));this.fire(new f.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(t){return f._(this,void 0,void 0,function*(){const l=t.actor?"RT":"LT";t.actor=this.actor;const p={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const m=yield this.actor.sendAsync({type:l,data:p},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(m,this.map.painter,l==="RT")})}abortTile(t){return f._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return f._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.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 f.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Yn=f.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Kr extends f.E{constructor(t,l,p,m){super(),this.id=t,this.dispatcher=p,this.coordinates=l.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=l}load(t){return f._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new f.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const l=yield ke.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,l&&l.data&&(this.image=l.data,t&&(this.coordinates=t),this._finishLoading())}catch(l){this._request=null,this._loaded=!0,this.fire(new f.j(l))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new f.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const l=t.map(f.Z.fromLngLat);this.tileID=function(m){let b=1/0,C=1/0,L=-1/0,R=-1/0;for(const K of m)b=Math.min(b,K.x),C=Math.min(C,K.y),L=Math.max(L,K.x),R=Math.max(R,K.y);const z=Math.max(L-b,R-C),G=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),q=Math.pow(2,G);return new f.a1(G,Math.floor((b+L)/2*q),Math.floor((C+R)/2*q))}(l),this.minzoom=this.maxzoom=this.tileID.z;const p=l.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new f.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,f.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,f.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,f.X,f.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new f.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,l=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Yn.members)),this.boundsSegments||(this.boundsSegments=f.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Se(t,this.image,l.RGBA),this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,p=!0)}p&&this.fire(new f.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return f._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class hi extends Kr{constructor(t,l,p,m){super(t,l,p,m),this.roundZoom=!0,this.type="video",this.options=l}load(){return f._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const l of t.urls)this.urls.push(this.map._requestManager.transformRequest(l,"Source").url);try{const l=yield f.a3(this.urls);if(this._loaded=!0,!l)return;this.video=l,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(l){this.fire(new f.j(l))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const l=this.video.seekable;tl.end(0)?this.fire(new f.j(new f.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${l.start(0)} and ${l.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,l=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Yn.members)),this.boundsSegments||(this.boundsSegments=f.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),l.texSubImage2D(l.TEXTURE_2D,0,0,0,l.RGBA,l.UNSIGNED_BYTE,this.video)):(this.texture=new Se(t,this.video,l.RGBA),this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,p=!0)}p&&this.fire(new f.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 Mn extends Kr{constructor(t,l,p,m){super(t,l,p,m),l.coordinates?Array.isArray(l.coordinates)&&l.coordinates.length===4&&!l.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(C=>typeof C!="number"))||this.fire(new f.j(new f.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new f.j(new f.a2(`sources.${t}`,null,'missing required property "coordinates"'))),l.animate&&typeof l.animate!="boolean"&&this.fire(new f.j(new f.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),l.canvas?typeof l.canvas=="string"||l.canvas instanceof HTMLCanvasElement||this.fire(new f.j(new f.a2(`sources.${t}`,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 f.j(new f.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=l,this.animate=l.animate===void 0||l.animate}load(){return f._(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 f.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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const l=this.map.painter.context,p=l.gl;this.boundsBuffer||(this.boundsBuffer=l.createVertexBuffer(this._boundsArray,Yn.members)),this.boundsSegments||(this.boundsSegments=f.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Se(l,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const b in this.tiles){const C=this.tiles[b];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,m=!0)}m&&this.fire(new f.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ms={},zs=x=>{switch(x){case"geojson":return to;case"image":return Kr;case"raster":return Je;case"raster-dem":return Hi;case"vector":return Hn;case"video":return hi;case"canvas":return Mn}return ms[x]},Ge="RTLPluginLoaded";class wr extends f.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=yt()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(l=>{throw this.status="error",l})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return f._(this,arguments,void 0,function*(l,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=N.resolveURL(l),!this.url)throw new Error(`requested url ${l} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return f._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new f.k(Ge))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let li=null;function ti(){return li||(li=new wr),li}class gs{constructor(t,l){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=f.a4(),this.uses=0,this.tileSize=l,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(t){const l=t+this.timeAdded;lb.getLayer(z)).filter(Boolean);if(R.length!==0){L.layers=R,L.stateDependentLayerIds&&(L.stateDependentLayers=L.stateDependentLayerIds.map(z=>R.filter(G=>G.id===z)[0]));for(const z of R)C[z.id]=L}}return C}(t.buckets,l.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const b=this.buckets[m];if(b instanceof f.a6){if(this.hasSymbolBuckets=!0,!p)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const b=this.buckets[m];if(b instanceof f.a6&&b.hasRTLText){this.hasRTLText=!0,ti().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const b=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,l.style.getLayer(m).queryRadius(b))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new f.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(t)}const l=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Se(t,this.imageAtlas.image,l.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Se(t,this.glyphAtlasImage,l.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,l,p,m,b,C,L,R,z,G){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:b,scale:C,tileSize:this.tileSize,pixelPosMatrix:G,transform:R,params:L,queryPadding:this.queryPadding*z},t,l,p):{}}querySourceFeatures(t,l){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),b=l&&l.sourceLayer?l.sourceLayer:"",C=m._geojsonTileLayer||m[b];if(!C)return;const L=f.a7(l&&l.filter),{z:R,x:z,y:G}=this.tileID.canonical,q={z:R,x:z,y:G};for(let K=0;Kp)m=!1;else if(l)if(this.expirationTime{this.remove(t,b)},p)),this.data[m].push(b),this.order.push(m),this.order.length>this.max){const C=this._getAndRemoveByKey(this.order[0]);C&&this.onRemove(C)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const l=this.data[t].shift();return l.timeout&&clearTimeout(l.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),l.value}getByKey(t){const l=this.data[t];return l?l[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,l){if(!this.has(t))return this;const p=t.wrapped().key,m=l===void 0?0:this.data[p].indexOf(l),b=this.data[p][m];return this.data[p].splice(m,1),b.timeout&&clearTimeout(b.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(b.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}filter(t){const l=[];for(const p in this.data)for(const m of this.data[p])t(m.value)||l.push(m);for(const p of l)this.remove(p.value.tileID,p)}}class mi{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,l,p){const m=String(l);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][m]=this.stateChanges[t][m]||{},f.e(this.stateChanges[t][m],p),this.deletedStates[t]===null){this.deletedStates[t]={};for(const b in this.state[t])b!==m&&(this.deletedStates[t][b]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][m]===null){this.deletedStates[t][m]={};for(const b in this.state[t][m])p[b]||(this.deletedStates[t][m][b]=null)}else for(const b in p)this.deletedStates[t]&&this.deletedStates[t][m]&&this.deletedStates[t][m][b]===null&&delete this.deletedStates[t][m][b]}removeFeatureState(t,l,p){if(this.deletedStates[t]===null)return;const m=String(l);if(this.deletedStates[t]=this.deletedStates[t]||{},p&&l!==void 0)this.deletedStates[t][m]!==null&&(this.deletedStates[t][m]=this.deletedStates[t][m]||{},this.deletedStates[t][m][p]=null);else if(l!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][m])for(p in this.deletedStates[t][m]={},this.stateChanges[t][m])this.deletedStates[t][m][p]=null;else this.deletedStates[t][m]=null;else this.deletedStates[t]=null}getState(t,l){const p=String(l),m=f.e({},(this.state[t]||{})[p],(this.stateChanges[t]||{})[p]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const b=this.deletedStates[t][l];if(b===null)return{};for(const C in b)delete m[C]}return m}initializeTileState(t,l){t.setFeatureState(this.state,l)}coalesceChanges(t,l){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const b={};for(const C in this.stateChanges[m])this.state[m][C]||(this.state[m][C]={}),f.e(this.state[m][C],this.stateChanges[m][C]),b[C]=this.state[m][C];p[m]=b}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const b={};if(this.deletedStates[m]===null)for(const C in this.state[m])b[C]={},this.state[m][C]={};else for(const C in this.deletedStates[m]){if(this.deletedStates[m][C]===null)this.state[m][C]={};else for(const L of Object.keys(this.deletedStates[m][C]))delete this.state[m][C][L];b[C]=this.state[m][C]}p[m]=p[m]||{},f.e(p[m],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in t)t[m].setFeatureState(p,l)}}class rt extends f.E{constructor(t,l,p){super(),this.id=t,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,b,C,L)=>{const R=new(zs(b.type))(m,b,C,L);if(R.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${R.id}`);return R})(t,l,p,this),this._tiles={},this._cache=new ut(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new mi,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}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 t in this._tiles){const l=this._tiles[t];if(l.state!=="loaded"&&l.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,l,p){return f._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,l,p)}catch(m){t.state="errored",m.status!==404?this._source.fire(new f.j(m,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new f.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const l in this._tiles){const p=this._tiles[l];p.upload(t),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Kn).map(t=>t.key)}getRenderableIds(t){const l=[];for(const p in this._tiles)this._isIdRenderable(p,t)&&l.push(this._tiles[p]);return t?l.sort((p,m)=>{const b=p.tileID,C=m.tileID,L=new f.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),R=new f.P(C.canonical.x,C.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-C.overscaledZ||R.y-L.y||R.x-L.x}).map(p=>p.tileID.key):l.map(p=>p.tileID).sort(Kn).map(p=>p.key)}hasRenderableParent(t){const l=this.findLoadedParent(t,0);return!!l&&this._isIdRenderable(l.tileID.key)}_isIdRenderable(t,l){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(l||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,l){return f._(this,void 0,void 0,function*(){const p=this._tiles[t];p&&(p.state!=="loading"&&(p.state=l),yield this._loadTile(p,t,l))})}_tileLoaded(t,l,p){t.timeAdded=N.now(),p==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(l,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new f.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const l=this.getRenderableIds();for(let m=0;m1||(Math.abs(C)>1&&(Math.abs(C+R)===1?C+=R:Math.abs(C-R)===1&&(C-=R)),b.dem&&m.dem&&(m.dem.backfillBorder(b.dem,C,L),m.neighboringTiles&&m.neighboringTiles[z]&&(m.neighboringTiles[z].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,l,p,m){for(const b in this._tiles){let C=this._tiles[b];if(m[b]||!C.hasData()||C.tileID.overscaledZ<=l||C.tileID.overscaledZ>p)continue;let L=C.tileID;for(;C&&C.tileID.overscaledZ>l+1;){const z=C.tileID.scaledTo(C.tileID.overscaledZ-1);C=this._tiles[z.key],C&&C.hasData()&&(L=z)}let R=L;for(;R.overscaledZ>l;)if(R=R.scaledTo(R.overscaledZ-1),t[R.key]){m[L.key]=L;break}}}findLoadedParent(t,l){if(t.key in this._loadedParentTiles){const p=this._loadedParentTiles[t.key];return p&&p.tileID.overscaledZ>=l?p:null}for(let p=t.overscaledZ-1;p>=l;p--){const m=t.scaledTo(p),b=this._getLoadedTile(m);if(b)return b}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const l=this._tiles[t.key];return l&&l.hasData()?l:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const l=Math.ceil(t.width/this._source.tileSize)+1,p=Math.ceil(t.height/this._source.tileSize)+1,m=Math.floor(l*p*(this._maxTileCacheZoomLevels===null?f.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(b)}handleWrapJump(t){const l=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,l){const p={};for(const m in this._tiles){const b=this._tiles[m];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+l),p[b.tileID.key]=b}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(t,l,p,m,b,C){const L={},R={},z=Object.keys(t),G=N.now();for(const q of z){const K=t[q],ee=this._tiles[q];if(!ee||ee.fadeEndTime!==0&&ee.fadeEndTime<=G)continue;const se=this.findLoadedParent(K,l),ue=this.findLoadedSibling(K),ae=se||ue||null;ae&&(this._addTile(ae.tileID),L[ae.tileID.key]=ae.tileID),R[q]=K}this._retainLoadedChildren(R,m,p,t);for(const q in L)t[q]||(this._coveredTiles[q]=!0,t[q]=L[q]);if(C){const q={},K={};for(const ee of b)this._tiles[ee.key].hasData()?q[ee.key]=ee:K[ee.key]=ee;for(const ee in K){const se=K[ee].children(this._source.maxzoom);this._tiles[se[0].key]&&this._tiles[se[1].key]&&this._tiles[se[2].key]&&this._tiles[se[3].key]&&(q[se[0].key]=t[se[0].key]=se[0],q[se[1].key]=t[se[1].key]=se[1],q[se[2].key]=t[se[2].key]=se[2],q[se[3].key]=t[se[3].key]=se[3],delete K[ee])}for(const ee in K){const se=K[ee],ue=this.findLoadedParent(se,this._source.minzoom),ae=this.findLoadedSibling(se),fe=ue||ae||null;if(fe){q[fe.tileID.key]=t[fe.tileID.key]=fe.tileID;for(const ye in q)q[ye].isChildOf(fe.tileID)&&delete q[ye]}}for(const ee in this._tiles)q[ee]||(this._coveredTiles[ee]=!0)}}update(t,l){if(!this._sourceLoaded||this._paused)return;let p;this.transform=t,this.terrain=l,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(G=>new f.S(G.canonical.z,G.wrap,G.canonical.z,G.canonical.x,G.canonical.y)):(p=t.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:l}),this._source.hasTile&&(p=p.filter(G=>this._source.hasTile(G)))):p=[];const m=t.coveringZoomLevel(this._source),b=Math.max(m-rt.maxOverzooming,this._source.minzoom),C=Math.max(m+rt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const G={};for(const q of p)if(q.canonical.z>this._source.minzoom){const K=q.scaledTo(q.canonical.z-1);G[K.key]=K;const ee=q.scaledTo(Math.max(this._source.minzoom,Math.min(q.canonical.z,5)));G[ee.key]=ee}p=p.concat(Object.values(G))}const L=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,L&&this.fire(new f.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const R=this._updateRetainedTiles(p,m);Rr(this._source.type)&&this._updateCoveredAndRetainedTiles(R,b,C,m,p,l);for(const G in R)this._tiles[G].clearFadeHold();const z=f.ac(this._tiles,R);for(const G of z){const q=this._tiles[G];q.hasSymbolBuckets&&!q.holdingForFade()?q.setHoldDuration(this.map._fadeDuration):q.hasSymbolBuckets&&!q.symbolFadeFinished()||this._removeTile(G)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,l){var p;const m={},b={},C=Math.max(l-rt.maxOverzooming,this._source.minzoom),L=Math.max(l+rt.maxUnderzooming,this._source.minzoom),R={};for(const z of t){const G=this._addTile(z);m[z.key]=z,G.hasData()||lthis._source.maxzoom){const K=z.children(this._source.maxzoom)[0],ee=this.getTile(K);if(ee&&ee.hasData()){m[K.key]=K;continue}}else{const K=z.children(this._source.maxzoom);if(m[K[0].key]&&m[K[1].key]&&m[K[2].key]&&m[K[3].key])continue}let q=G.wasRequested();for(let K=z.overscaledZ-1;K>=C;--K){const ee=z.scaledTo(K);if(b[ee.key])break;if(b[ee.key]=!0,G=this.getTile(ee),!G&&q&&(G=this._addTile(ee)),G){const se=G.hasData();if((se||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||q)&&(m[ee.key]=ee),q=G.wasRequested(),se)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const l=[];let p,m=this._tiles[t].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}l.push(m.key);const b=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(b),p)break;m=b}for(const b of l)this._loadedParentTiles[b]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const l=this._tiles[t].tileID,p=this._getLoadedTile(l);this._loadedSiblingTiles[l.key]=p}}_addTile(t){let l=this._tiles[t.key];if(l)return l;l=this._cache.getAndRemove(t),l&&(this._setTileReloadTimer(t.key,l),l.tileID=t,this._state.initializeTileState(l,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,l)));const p=l;return l||(l=new gs(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(l,t.key,l.state)),l.uses++,this._tiles[t.key]=l,p||this._source.fire(new f.k("dataloading",{tile:l,coord:l.tileID,dataType:"source"})),l}_setTileReloadTimer(t,l){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const p=l.getExpiryTimeout();p&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},p))}_removeTile(t){const l=this._tiles[t];l&&(l.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),l.uses>0||(l.hasData()&&l.state!=="reloading"?this._cache.add(l.tileID,l,l.getExpiryTimeout()):(l.aborted=!0,this._abortTile(l),this._unloadTile(l))))}_dataHandler(t){const l=t.sourceDataType;t.dataType==="source"&&l==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&l==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,l,p){const m=[],b=this.transform;if(!b)return m;const C=p?b.getCameraQueryGeometry(t):t,L=t.map(se=>b.pointCoordinate(se,this.terrain)),R=C.map(se=>b.pointCoordinate(se,this.terrain)),z=this.getIds();let G=1/0,q=1/0,K=-1/0,ee=-1/0;for(const se of R)G=Math.min(G,se.x),q=Math.min(q,se.y),K=Math.max(K,se.x),ee=Math.max(ee,se.y);for(let se=0;se=0&&oe[1].y+ye>=0){const Ie=L.map(Be=>ae.getTilePoint(Be)),Me=R.map(Be=>ae.getTilePoint(Be));m.push({tile:ue,tileID:ae,queryGeometry:Ie,cameraQueryGeometry:Me,scale:fe})}}return m}getVisibleCoordinates(t){const l=this.getRenderableIds(t).map(p=>this._tiles[p].tileID);for(const p of l)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return l}hasTransition(){if(this._source.hasTransition())return!0;if(Rr(this._source.type)){const t=N.now();for(const l in this._tiles)if(this._tiles[l].fadeEndTime>=t)return!0}return!1}setFeatureState(t,l,p){this._state.updateState(t=t||"_geojsonTileLayer",l,p)}removeFeatureState(t,l,p){this._state.removeFeatureState(t=t||"_geojsonTileLayer",l,p)}getFeatureState(t,l){return this._state.getState(t=t||"_geojsonTileLayer",l)}setDependencies(t,l,p){const m=this._tiles[t];m&&m.setDependencies(l,p)}reloadTilesForDependencies(t,l){for(const p in this._tiles)this._tiles[p].hasDependency(t,l)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(t,l))}}function Kn(x,t){const l=Math.abs(2*x.wrap)-+(x.wrap<0),p=Math.abs(2*t.wrap)-+(t.wrap<0);return x.overscaledZ-t.overscaledZ||p-l||t.canonical.y-x.canonical.y||t.canonical.x-x.canonical.x}function Rr(x){return x==="raster"||x==="image"||x==="video"}rt.maxOverzooming=10,rt.maxUnderzooming=3;class si{constructor(t,l){this.reset(t,l)}reset(t,l){this.points=t||[],this._distances=[0];for(let p=1;p0?(m-C)/L:0;return this.points[b].mult(1-R).add(this.points[l].mult(R))}}function cn(x,t){let l=!0;return x==="always"||x!=="never"&&t!=="never"||(l=!1),l}class ur{constructor(t,l,p){const m=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(t/p),this.yCellCount=Math.ceil(l/p);for(let C=0;Cthis.width||m<0||l>this.height)return[];const R=[];if(t<=0&&l<=0&&this.width<=p&&this.height<=m){if(b)return[{key:null,x1:t,y1:l,x2:p,y2:m}];for(let z=0;z0}hitTestCircle(t,l,p,m,b){const C=t-p,L=t+p,R=l-p,z=l+p;if(L<0||C>this.width||z<0||R>this.height)return!1;const G=[];return this._forEachCell(C,R,L,z,this._queryCellCircle,G,{hitTest:!0,overlapMode:m,circle:{x:t,y:l,radius:p},seenUids:{box:{},circle:{}}},b),G.length>0}_queryCell(t,l,p,m,b,C,L,R){const{seenUids:z,hitTest:G,overlapMode:q}=L,K=this.boxCells[b];if(K!==null){const se=this.bboxes;for(const ue of K)if(!z.box[ue]){z.box[ue]=!0;const ae=4*ue,fe=this.boxKeys[ue];if(t<=se[ae+2]&&l<=se[ae+3]&&p>=se[ae+0]&&m>=se[ae+1]&&(!R||R(fe))&&(!G||!cn(q,fe.overlapMode))&&(C.push({key:fe,x1:se[ae],y1:se[ae+1],x2:se[ae+2],y2:se[ae+3]}),G))return!0}}const ee=this.circleCells[b];if(ee!==null){const se=this.circles;for(const ue of ee)if(!z.circle[ue]){z.circle[ue]=!0;const ae=3*ue,fe=this.circleKeys[ue];if(this._circleAndRectCollide(se[ae],se[ae+1],se[ae+2],t,l,p,m)&&(!R||R(fe))&&(!G||!cn(q,fe.overlapMode))){const ye=se[ae],oe=se[ae+1],Ie=se[ae+2];if(C.push({key:fe,x1:ye-Ie,y1:oe-Ie,x2:ye+Ie,y2:oe+Ie}),G)return!0}}}return!1}_queryCellCircle(t,l,p,m,b,C,L,R){const{circle:z,seenUids:G,overlapMode:q}=L,K=this.boxCells[b];if(K!==null){const se=this.bboxes;for(const ue of K)if(!G.box[ue]){G.box[ue]=!0;const ae=4*ue,fe=this.boxKeys[ue];if(this._circleAndRectCollide(z.x,z.y,z.radius,se[ae+0],se[ae+1],se[ae+2],se[ae+3])&&(!R||R(fe))&&!cn(q,fe.overlapMode))return C.push(!0),!0}}const ee=this.circleCells[b];if(ee!==null){const se=this.circles;for(const ue of ee)if(!G.circle[ue]){G.circle[ue]=!0;const ae=3*ue,fe=this.circleKeys[ue];if(this._circlesCollide(se[ae],se[ae+1],se[ae+2],z.x,z.y,z.radius)&&(!R||R(fe))&&!cn(q,fe.overlapMode))return C.push(!0),!0}}}_forEachCell(t,l,p,m,b,C,L,R){const z=this._convertToXCellCoord(t),G=this._convertToYCellCoord(l),q=this._convertToXCellCoord(p),K=this._convertToYCellCoord(m);for(let ee=z;ee<=q;ee++)for(let se=G;se<=K;se++)if(b.call(this,t,l,p,m,this.xCellCount*se+ee,C,L,R))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,l,p,m,b,C){const L=m-t,R=b-l,z=p+C;return z*z>L*L+R*R}_circleAndRectCollide(t,l,p,m,b,C,L){const R=(C-m)/2,z=Math.abs(t-(m+R));if(z>R+p)return!1;const G=(L-b)/2,q=Math.abs(l-(b+G));if(q>G+p)return!1;if(z<=R||q<=G)return!0;const K=z-R,ee=q-G;return K*K+ee*ee<=p*p}}function In(x,t,l,p,m){const b=f.H();return t?(f.K(b,b,[1/m,1/m,1]),l||f.ae(b,b,p.angle)):f.L(b,p.labelPlaneMatrix,x),b}function Dr(x,t,l,p,m){if(t){const b=f.af(x);return f.K(b,b,[m,m,1]),l||f.ae(b,b,-p.angle),b}return p.glCoordMatrix}function ce(x,t,l){let p;l?(p=[x.x,x.y,l(x.x,x.y),1],f.ag(p,p,t)):(p=[x.x,x.y,0,1],function(b,C,L){const R=C[0],z=C[1];b[0]=L[0]*R+L[4]*z+L[12],b[1]=L[1]*R+L[5]*z+L[13],b[3]=L[3]*R+L[7]*z+L[15]}(p,p,t));const m=p[3];return{point:new f.P(p[0]/m,p[1]/m),signedDistanceFromCamera:m,isOccluded:!1}}function H(x,t){return .5+x/t*.5}function X(x,t){return x.x>=-t[0]&&x.x<=t[0]&&x.y>=-t[1]&&x.y<=t[1]}function $(x,t,l,p,m,b,C,L,R,z,G,q,K,ee,se){const ue=p?x.textSizeData:x.iconSizeData,ae=f.ah(ue,l.transform.zoom),fe=[256/l.width*2+1,256/l.height*2+1],ye=p?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;ye.clear();const oe=x.lineVertexArray,Ie=p?x.text.placedSymbolArray:x.icon.placedSymbolArray,Me=l.transform.width/l.transform.height;let Be=!1;for(let Qe=0;QeMath.abs(l.x-t.x)*p?{useVertical:!0}:(x===f.ai.vertical?t.yl.x)?{needsFlipping:!0}:null}function be(x,t,l,p,m,b,C,L,R,z,G){const q=l/24,K=t.lineOffsetX*q,ee=t.lineOffsetY*q;let se;if(t.numGlyphs>1){const ue=t.glyphStartIndex+t.numGlyphs,ae=t.lineStartIndex,fe=t.lineStartIndex+t.lineLength,ye=Q(q,L,K,ee,p,t,G,x);if(!ye)return{notEnoughRoom:!0};const oe=ce(ye.first.point,C,x.getElevation).point,Ie=ce(ye.last.point,C,x.getElevation).point;if(m&&!p){const Me=ge(t.writingMode,oe,Ie,z);if(Me)return Me}se=[ye.first];for(let Me=t.glyphStartIndex+1;Me0?oe.point:function(Be,Qe,ot,Ct,At,at){return Le(Be,Qe,ot,1,At,at)}(x.tileAnchorPoint,ye,ae,0,b,x),Me=ge(t.writingMode,ae,Ie,z);if(Me)return Me}const ue=ft(q*L.getoffsetX(t.glyphStartIndex),K,ee,p,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,x,G);if(!ue||x.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};se=[ue]}for(const ue of se)f.ak(R,ue.point,ue.angle);return{}}function Le(x,t,l,p,m,b){const C=x.add(x.sub(t)._unit()),L=m!==void 0?ce(C,m,b.getElevation).point:Ue(C.x,C.y,b).point,R=l.sub(L);return l.add(R._mult(p/R.mag()))}function pe(x,t,l){const p=t.projectionCache;if(p.projections[x])return p.projections[x];const m=new f.P(t.lineVertexArray.getx(x),t.lineVertexArray.gety(x)),b=Ue(m.x,m.y,t);if(b.signedDistanceFromCamera>0)return p.projections[x]=b.point,p.anyProjectionOccluded=p.anyProjectionOccluded||b.isOccluded,b.point;const C=x-l.direction;return function(L,R,z,G,q){return Le(L,R,z,G,void 0,q)}(l.distanceFromAnchor===0?t.tileAnchorPoint:new f.P(t.lineVertexArray.getx(C),t.lineVertexArray.gety(C)),m,l.previousVertex,l.absOffsetX-l.distanceFromAnchor+1,t)}function Ue(x,t,l){const p=x+l.translation[0],m=t+l.translation[1];let b;return!l.pitchWithMap&&l.projection.useSpecialProjectionForSymbols?(b=l.projection.projectTileCoordinates(p,m,l.unwrappedTileID,l.getElevation),b.point.x=(.5*b.point.x+.5)*l.width,b.point.y=(.5*-b.point.y+.5)*l.height):(b=ce(new f.P(p,m),l.labelPlaneMatrix,l.getElevation),b.isOccluded=!1),b}function $e(x,t,l){return x._unit()._perp()._mult(t*l)}function Fe(x,t,l,p,m,b,C,L,R){if(L.projectionCache.offsets[x])return L.projectionCache.offsets[x];const z=l.add(t);if(x+R.direction=m)return L.projectionCache.offsets[x]=z,z;const G=pe(x+R.direction,L,R),q=$e(G.sub(l),C,R.direction),K=l.add(q),ee=G.add(q);return L.projectionCache.offsets[x]=f.al(b,z,K,ee)||z,L.projectionCache.offsets[x]}function ft(x,t,l,p,m,b,C,L,R){const z=p?x-t:x+t;let G=z>0?1:-1,q=0;p&&(G*=-1,q=Math.PI),G<0&&(q+=Math.PI);let K,ee=G>0?b+m:b+m+1;L.projectionCache.cachedAnchorPoint?K=L.projectionCache.cachedAnchorPoint:(K=Ue(L.tileAnchorPoint.x,L.tileAnchorPoint.y,L).point,L.projectionCache.cachedAnchorPoint=K);let se,ue,ae=K,fe=K,ye=0,oe=0;const Ie=Math.abs(z),Me=[];let Be;for(;ye+oe<=Ie;){if(ee+=G,ee=C)return null;ye+=oe,fe=ae,ue=se;const Ct={absOffsetX:Ie,direction:G,distanceFromAnchor:ye,previousVertex:fe};if(ae=pe(ee,L,Ct),l===0)Me.push(fe),Be=ae.sub(fe);else{let At;const at=ae.sub(fe);At=at.mag()===0?$e(pe(ee+G,L,Ct).sub(ae),l,G):$e(at,l,G),ue||(ue=fe.add(At)),se=Fe(ee,At,ae,b,C,ue,l,L,Ct),Me.push(ue),Be=se.sub(ue)}oe=Be.mag()}const Qe=Be._mult((Ie-ye)/oe)._add(ue||fe),ot=q+Math.atan2(ae.y-fe.y,ae.x-fe.x);return Me.push(Qe),{point:Qe,angle:R?ot:0,path:Me}}const jt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Qt(x,t){for(let l=0;l=1;gi--)wt.push(ai.path[gi]);for(let gi=1;gixi.signedDistanceFromCamera<=0)?[]:gi.map(xi=>xi.point)}let Ji=[];if(wt.length>0){const gi=wt[0].clone(),xi=wt[0].clone();for(let Qi=1;Qi=at.x&&xi.x<=ht.x&&gi.y>=at.y&&xi.y<=ht.y?[wt]:xi.xht.x||xi.yht.y?[]:f.am([wt],at.x,at.y,ht.x,ht.y)}for(const gi of Ji){Nt.reset(gi,.25*At);let xi=0;xi=Nt.length<=.5*At?1:Math.ceil(Nt.paddedLength/ri)+1;for(let Qi=0;Qice(m,p,l.getElevation))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const l=[];let p=1/0,m=1/0,b=-1/0,C=-1/0;for(const G of t){const q=new f.P(G.x+ui,G.y+ui);p=Math.min(p,q.x),m=Math.min(m,q.y),b=Math.max(b,q.x),C=Math.max(C,q.y),l.push(q)}const L=this.grid.query(p,m,b,C).concat(this.ignoredGrid.query(p,m,b,C)),R={},z={};for(const G of L){const q=G.key;if(R[q.bucketInstanceId]===void 0&&(R[q.bucketInstanceId]={}),R[q.bucketInstanceId][q.featureIndex])continue;const K=[new f.P(G.x1,G.y1),new f.P(G.x2,G.y1),new f.P(G.x2,G.y2),new f.P(G.x1,G.y2)];f.an(l,K)&&(R[q.bucketInstanceId][q.featureIndex]=!0,z[q.bucketInstanceId]===void 0&&(z[q.bucketInstanceId]=[]),z[q.bucketInstanceId].push(q.featureIndex))}return z}insertCollisionBox(t,l,p,m,b,C){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:b,collisionGroupID:C,overlapMode:l},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,l,p,m,b,C){const L=p?this.ignoredGrid:this.grid,R={bucketInstanceId:m,featureIndex:b,collisionGroupID:C,overlapMode:l};for(let z=0;z=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(t,l,p,m){return p>=0&&t=0&&lthis.projectAndGetPerspectiveRatio(p,at.x,at.y,m,z));Ct=At.some(at=>!at.isOccluded),ot=At.map(at=>at.point)}else Ct=!0;return{box:f.ap(ot),allPointsOccluded:!Ct}}}function Yt(x,t,l){return t*(f.X/(x.tileSize*Math.pow(2,l-x.tileID.overscaledZ)))}class Ai{constructor(t,l,p,m){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?l:-l))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class zi{constructor(t,l,p,m,b){this.text=new Ai(t?t.text:null,l,p,b),this.icon=new Ai(t?t.icon:null,l,m,b)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ji{constructor(t,l,p){this.text=t,this.icon=l,this.skipFade=p}}class fi{constructor(){this.invProjMatrix=f.H(),this.viewportMatrix=f.H(),this.circles=[]}}class Ii{constructor(t,l,p,m,b){this.bucketInstanceId=t,this.featureIndex=l,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=b}}class Mi{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const l=++this.maxGroupID;this.collisionGroups[t]={ID:l,predicate:p=>p.collisionGroupID===l}}return this.collisionGroups[t]}}function tn(x,t,l,p,m){const{horizontalAlign:b,verticalAlign:C}=f.av(x);return new f.P(-(b-.5)*t+p[0]*m,-(C-.5)*l+p[1]*m)}class wi{constructor(t,l,p,m,b,C){this.transform=t.clone(),this.terrain=p,this.collisionIndex=new bi(this.transform,l),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Mi(b),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=C,C&&(C.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const l=this.terrain;return l?(p,m)=>l.getElevation(t,p,m):null}getBucketParts(t,l,p,m){const b=p.getBucket(l),C=p.latestFeatureIndex;if(!b||!C||l.id!==b.layerIds[0])return;const L=p.collisionBoxArray,R=b.layers[0].layout,z=b.layers[0].paint,G=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),q=p.tileSize/f.X,K=p.tileID.toUnwrapped(),ee=this.transform.calculatePosMatrix(K),se=R.get("text-pitch-alignment")==="map",ue=R.get("text-rotation-alignment")==="map",ae=Yt(p,1,this.transform.zoom),fe=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),ye=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),oe=In(ee,se,ue,this.transform,ae);let Ie=null;if(se){const Be=Dr(ee,se,ue,this.transform,ae);Ie=f.L([],this.transform.labelPlaneMatrix,Be)}this.retainedQueryData[b.bucketInstanceId]=new Ii(b.bucketInstanceId,C,b.sourceLayerIndex,b.index,p.tileID);const Me={bucket:b,layout:R,translationText:fe,translationIcon:ye,posMatrix:ee,unwrappedTileID:K,textLabelPlaneMatrix:oe,labelToScreenMatrix:Ie,scale:G,textPixelRatio:q,holdingForFade:p.holdingForFade(),collisionBoxArray:L,partiallyEvaluatedTextSize:f.ah(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(m)for(const Be of b.sortKeyRanges){const{sortKey:Qe,symbolInstanceStart:ot,symbolInstanceEnd:Ct}=Be;t.push({sortKey:Qe,symbolInstanceStart:ot,symbolInstanceEnd:Ct,parameters:Me})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Me})}attemptAnchorPlacement(t,l,p,m,b,C,L,R,z,G,q,K,ee,se,ue,ae,fe,ye,oe){const Ie=f.ar[t.textAnchor],Me=[t.textOffset0,t.textOffset1],Be=tn(Ie,p,m,Me,b),Qe=this.collisionIndex.placeCollisionBox(l,K,R,z,G,L,C,ae,q.predicate,oe,Be);if((!ye||this.collisionIndex.placeCollisionBox(ye,K,R,z,G,L,C,fe,q.predicate,oe,Be).placeable)&&Qe.placeable){let ot;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ee.crossTileID]&&this.prevPlacement.placements[ee.crossTileID]&&this.prevPlacement.placements[ee.crossTileID].text&&(ot=this.prevPlacement.variableOffsets[ee.crossTileID].anchor),ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ee.crossTileID]={textOffset:Me,width:p,height:m,anchor:Ie,textBoxScale:b,prevAnchor:ot},this.markUsedJustification(se,Ie,ee,ue),se.allowVerticalPlacement&&(this.markUsedOrientation(se,ue,ee),this.placedOrientations[ee.crossTileID]=ue),{shift:Be,placedGlyphBoxes:Qe}}}placeLayerBucketPart(t,l,p){const{bucket:m,layout:b,translationText:C,translationIcon:L,posMatrix:R,unwrappedTileID:z,textLabelPlaneMatrix:G,labelToScreenMatrix:q,textPixelRatio:K,holdingForFade:ee,collisionBoxArray:se,partiallyEvaluatedTextSize:ue,collisionGroup:ae}=t.parameters,fe=b.get("text-optional"),ye=b.get("icon-optional"),oe=f.as(b,"text-overlap","text-allow-overlap"),Ie=oe==="always",Me=f.as(b,"icon-overlap","icon-allow-overlap"),Be=Me==="always",Qe=b.get("text-rotation-alignment")==="map",ot=b.get("text-pitch-alignment")==="map",Ct=b.get("icon-text-fit")!=="none",At=b.get("symbol-z-order")==="viewport-y",at=Ie&&(Be||!m.hasIconData()||ye),ht=Be&&(Ie||!m.hasTextData()||fe);!m.collisionArrays&&se&&m.deserializeCollisionBoxes(se);const Nt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),ai=(gt,wt,ri)=>{var Ji,gi;if(l[gt.crossTileID])return;if(ee)return void(this.placements[gt.crossTileID]=new ji(!1,!1,!1));let xi=!1,Qi=!1,Qn=!0,ts=null,$i={box:null,placeable:!1,offscreen:null},Sr={box:null,placeable:!1,offscreen:null},yr=null,$n=null,er=null,is=0,ra=0,Kl=0;wt.textFeatureIndex?is=wt.textFeatureIndex:gt.useRuntimeCollisionCircles&&(is=gt.featureIndex),wt.verticalTextFeatureIndex&&(ra=wt.verticalTextFeatureIndex);const Ra=wt.textBox;if(Ra){const Wn=tr=>{let ir=f.ai.horizontal;if(m.allowVerticalPlacement&&!tr&&this.prevPlacement){const Bn=this.prevPlacement.placedOrientations[gt.crossTileID];Bn&&(this.placedOrientations[gt.crossTileID]=Bn,ir=Bn,this.markUsedOrientation(m,ir,gt))}return ir},ns=(tr,ir)=>{if(m.allowVerticalPlacement&>.numVerticalGlyphVertices>0&&wt.verticalTextBox){for(const Bn of m.writingModes)if(Bn===f.ai.vertical?($i=ir(),Sr=$i):$i=tr(),$i&&$i.placeable)break}else $i=tr()},yo=gt.textAnchorOffsetStartIndex,Da=gt.textAnchorOffsetEndIndex;if(Da===yo){const tr=(ir,Bn)=>{const an=this.collisionIndex.placeCollisionBox(ir,oe,K,R,z,ot,Qe,C,ae.predicate,Nt);return an&&an.placeable&&(this.markUsedOrientation(m,Bn,gt),this.placedOrientations[gt.crossTileID]=Bn),an};ns(()=>tr(Ra,f.ai.horizontal),()=>{const ir=wt.verticalTextBox;return m.allowVerticalPlacement&>.numVerticalGlyphVertices>0&&ir?tr(ir,f.ai.vertical):{box:null,offscreen:null}}),Wn($i&&$i.placeable)}else{let tr=f.ar[(gi=(Ji=this.prevPlacement)===null||Ji===void 0?void 0:Ji.variableOffsets[gt.crossTileID])===null||gi===void 0?void 0:gi.anchor];const ir=(an,za,uc)=>{const Cn=an.x2-an.x1,mh=an.y2-an.y1,Ql=gt.textBoxScale,$l=Ct&&Me==="never"?za:null;let _o=null,gh=oe==="never"?1:2,cc="never";tr&&gh++;for(let hc=0;hcir(Ra,wt.iconBox,f.ai.horizontal),()=>{const an=wt.verticalTextBox;return m.allowVerticalPlacement&&(!$i||!$i.placeable)&>.numVerticalGlyphVertices>0&&an?ir(an,wt.verticalIconBox,f.ai.vertical):{box:null,occluded:!0,offscreen:null}}),$i&&(xi=$i.placeable,Qn=$i.offscreen);const Bn=Wn($i&&$i.placeable);if(!xi&&this.prevPlacement){const an=this.prevPlacement.variableOffsets[gt.crossTileID];an&&(this.variableOffsets[gt.crossTileID]=an,this.markUsedJustification(m,an.anchor,gt,Bn))}}}if(yr=$i,xi=yr&&yr.placeable,Qn=yr&&yr.offscreen,gt.useRuntimeCollisionCircles){const Wn=m.text.placedSymbolArray.get(gt.centerJustifiedTextSymbolIndex),ns=f.aj(m.textSizeData,ue,Wn),yo=b.get("text-padding");$n=this.collisionIndex.placeCollisionCircles(oe,Wn,m.lineVertexArray,m.glyphOffsetArray,ns,R,z,G,q,p,ot,ae.predicate,gt.collisionCircleDiameter,yo,C,Nt),$n.circles.length&&$n.collisionDetected&&!p&&f.w("Collisions detected, but collision boxes are not shown"),xi=Ie||$n.circles.length>0&&!$n.collisionDetected,Qn=Qn&&$n.offscreen}if(wt.iconFeatureIndex&&(Kl=wt.iconFeatureIndex),wt.iconBox){const Wn=ns=>this.collisionIndex.placeCollisionBox(ns,Me,K,R,z,ot,Qe,L,ae.predicate,Nt,Ct&&ts?ts:void 0);Sr&&Sr.placeable&&wt.verticalIconBox?(er=Wn(wt.verticalIconBox),Qi=er.placeable):(er=Wn(wt.iconBox),Qi=er.placeable),Qn=Qn&&er.offscreen}const sa=fe||gt.numHorizontalGlyphVertices===0&>.numVerticalGlyphVertices===0,Jl=ye||gt.numIconVertices===0;sa||Jl?Jl?sa||(Qi=Qi&&xi):xi=Qi&&xi:Qi=xi=Qi&ξconst lc=Qi&&er.placeable;if(xi&&yr.placeable&&this.collisionIndex.insertCollisionBox(yr.box,oe,b.get("text-ignore-placement"),m.bucketInstanceId,Sr&&Sr.placeable&&ra?ra:is,ae.ID),lc&&this.collisionIndex.insertCollisionBox(er.box,Me,b.get("icon-ignore-placement"),m.bucketInstanceId,Kl,ae.ID),$n&&xi&&this.collisionIndex.insertCollisionCircles($n.circles,oe,b.get("text-ignore-placement"),m.bucketInstanceId,is,ae.ID),p&&this.storeCollisionData(m.bucketInstanceId,ri,wt,yr,er,$n),gt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[gt.crossTileID]=new ji(xi||at,Qi||ht,Qn||m.justReloaded),l[gt.crossTileID]=!0};if(At){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const gt=m.getSortedSymbolIndexes(this.transform.angle);for(let wt=gt.length-1;wt>=0;--wt){const ri=gt[wt];ai(m.symbolInstances.get(ri),m.collisionArrays[ri],ri)}}else for(let gt=t.symbolInstanceStart;gt=0&&(t.text.placedSymbolArray.get(L).crossTileID=b>=0&&L!==b?0:p.crossTileID)}markUsedOrientation(t,l,p){const m=l===f.ai.horizontal||l===f.ai.horizontalOnly?l:0,b=l===f.ai.vertical?l:0,C=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const L of C)t.text.placedSymbolArray.get(L).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const l=this.prevPlacement;let p=!1;this.prevZoomAdjustment=l?l.zoomAdjustment(this.transform.zoom):0;const m=l?l.symbolFadeChange(t):1,b=l?l.opacities:{},C=l?l.variableOffsets:{},L=l?l.placedOrientations:{};for(const R in this.placements){const z=this.placements[R],G=b[R];G?(this.opacities[R]=new zi(G,m,z.text,z.icon),p=p||z.text!==G.text.placed||z.icon!==G.icon.placed):(this.opacities[R]=new zi(null,m,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const R in b){const z=b[R];if(!this.opacities[R]){const G=new zi(z,m,!1,!1);G.isHidden()||(this.opacities[R]=G,p=p||z.text.placed||z.icon.placed)}}for(const R in C)this.variableOffsets[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.variableOffsets[R]=C[R]);for(const R in L)this.placedOrientations[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.placedOrientations[R]=L[R]);if(l&&l.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=l?l.lastPlacementChangeTime:t)}updateLayerOpacities(t,l){const p={};for(const m of l){const b=m.getBucket(t);b&&m.latestFeatureIndex&&t.id===b.layerIds[0]&&this.updateBucketOpacities(b,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(t,l,p,m){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const b=t.layers[0],C=b.layout,L=new zi(null,0,!1,!1,!0),R=C.get("text-allow-overlap"),z=C.get("icon-allow-overlap"),G=b._unevaluatedLayout.hasValue("text-variable-anchor")||b._unevaluatedLayout.hasValue("text-variable-anchor-offset"),q=C.get("text-rotation-alignment")==="map",K=C.get("text-pitch-alignment")==="map",ee=C.get("icon-text-fit")!=="none",se=new zi(null,0,R&&(z||!t.hasIconData()||C.get("icon-optional")),z&&(R||!t.hasTextData()||C.get("text-optional")),!0);!t.collisionArrays&&m&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(m);const ue=(fe,ye,oe)=>{for(let Ie=0;Ie0,ot=this.placedOrientations[ye.crossTileID],Ct=ot===f.ai.vertical,At=ot===f.ai.horizontal||ot===f.ai.horizontalOnly;if(oe>0||Ie>0){const ht=nn(Be.text);ue(t.text,oe,Ct?hn:ht),ue(t.text,Ie,At?hn:ht);const Nt=Be.text.isHidden();[ye.rightJustifiedTextSymbolIndex,ye.centerJustifiedTextSymbolIndex,ye.leftJustifiedTextSymbolIndex].forEach(wt=>{wt>=0&&(t.text.placedSymbolArray.get(wt).hidden=Nt||Ct?1:0)}),ye.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(ye.verticalPlacedTextSymbolIndex).hidden=Nt||At?1:0);const ai=this.variableOffsets[ye.crossTileID];ai&&this.markUsedJustification(t,ai.anchor,ye,ot);const gt=this.placedOrientations[ye.crossTileID];gt&&(this.markUsedJustification(t,"left",ye,gt),this.markUsedOrientation(t,gt,ye))}if(Qe){const ht=nn(Be.icon),Nt=!(ee&&ye.verticalPlacedIconSymbolIndex&&Ct);ye.placedIconSymbolIndex>=0&&(ue(t.icon,ye.numIconVertices,Nt?ht:hn),t.icon.placedSymbolArray.get(ye.placedIconSymbolIndex).hidden=Be.icon.isHidden()),ye.verticalPlacedIconSymbolIndex>=0&&(ue(t.icon,ye.numVerticalIconVertices,Nt?hn:ht),t.icon.placedSymbolArray.get(ye.verticalPlacedIconSymbolIndex).hidden=Be.icon.isHidden())}const at=ae&&ae.has(fe)?ae.get(fe):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ht=t.collisionArrays[fe];if(ht){let Nt=new f.P(0,0);if(ht.textBox||ht.verticalTextBox){let ai=!0;if(G){const gt=this.variableOffsets[Me];gt?(Nt=tn(gt.anchor,gt.width,gt.height,gt.textOffset,gt.textBoxScale),q&&Nt._rotate(K?this.transform.angle:-this.transform.angle)):ai=!1}if(ht.textBox||ht.verticalTextBox){let gt;ht.textBox&&(gt=Ct),ht.verticalTextBox&&(gt=At),Rn(t.textCollisionBox.collisionVertexArray,Be.text.placed,!ai||gt,at.text,Nt.x,Nt.y)}}if(ht.iconBox||ht.verticalIconBox){const ai=!!(!At&&ht.verticalIconBox);let gt;ht.iconBox&&(gt=ai),ht.verticalIconBox&&(gt=!ai),Rn(t.iconCollisionBox.collisionVertexArray,Be.icon.placed,gt,at.icon,ee?Nt.x:0,ee?Nt.y:0)}}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const fe=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=fe.invProjMatrix,t.placementViewportMatrix=fe.viewportMatrix,t.collisionCircleArray=fe.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function Rn(x,t,l,p,m,b){p&&p.length!==0||(p=[0,0,0,0]);const C=p[0]-ui,L=p[1]-ui,R=p[2]-ui,z=p[3]-ui;x.emplaceBack(t?1:0,l?1:0,m||0,b||0,C,L),x.emplaceBack(t?1:0,l?1:0,m||0,b||0,R,L),x.emplaceBack(t?1:0,l?1:0,m||0,b||0,R,z),x.emplaceBack(t?1:0,l?1:0,m||0,b||0,C,z)}const Oo=Math.pow(2,25),ki=Math.pow(2,24),Ns=Math.pow(2,17),Fo=Math.pow(2,16),Gn=Math.pow(2,9),Jn=Math.pow(2,8),Fu=Math.pow(2,1);function nn(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;const t=x.placed?1:0,l=Math.floor(127*x.opacity);return l*Oo+t*ki+l*Ns+t*Fo+l*Gn+t*Jn+l*Fu+t}const hn=0;function io(){return{isOccluded:(x,t,l)=>!1,getPitchedTextCorrection:(x,t,l)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(x,t,l,p){throw new Error("Not implemented.")},translatePosition:(x,t,l,p)=>function(m,b,C,L,R=!1){if(!C[0]&&!C[1])return[0,0];const z=R?L==="map"?m.angle:0:L==="viewport"?-m.angle:0;if(z){const G=Math.sin(z),q=Math.cos(z);C=[C[0]*q-C[1]*G,C[0]*G+C[1]*q]}return[R?C[0]:Yt(b,C[0],m.zoom),R?C[1]:Yt(b,C[1],m.zoom)]}(x,t,l,p),getCircleRadiusCorrection:x=>1}}class Vr{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,l,p,m,b){const C=this._bucketParts;for(;this._currentTileIndexL.sortKey-R.sortKey));this._currentPartIndex!this._forceFullPlacement&&N.now()-m>2;for(;this._currentPlacementIndex>=0;){const C=l[t[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 Vr(C)),this._inProgressLayer.continuePlacement(p[C.source],this.placement,this._showCollisionBoxes,C,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Jr=512/f.X/2;class Os{constructor(t,l,p){this.tileID=t,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let b=0;b({x:Math.floor(R.anchorX*Jr),y:Math.floor(R.anchorY*Jr)})),crossTileIDs:C.map(R=>R.crossTileID)};if(L.positions.length>128){const R=new f.aw(L.positions.length,16,Uint16Array);for(const{x:z,y:G}of L.positions)R.add(z,G);R.finish(),delete L.positions,L.index=R}this._symbolsByKey[b]=L}}getScaledCoordinates(t,l){const{x:p,y:m,z:b}=this.tileID.canonical,{x:C,y:L,z:R}=l.canonical,z=Jr/Math.pow(2,R-b),G=(L*f.X+t.anchorY)*z,q=m*f.X*Jr;return{x:Math.floor((C*f.X+t.anchorX)*z-p*f.X*Jr),y:Math.floor(G-q)}}findMatches(t,l,p){const m=this.tileID.canonical.zt)}}class fn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Bo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const l=Math.round((t-this.lng)/360);if(l!==0)for(const p in this.indexes){const m=this.indexes[p],b={};for(const C in m){const L=m[C];L.tileID=L.tileID.unwrapTo(L.tileID.wrap+l),b[L.tileID.key]=L}this.indexes[p]=b}this.lng=t}addBucket(t,l,p){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===l.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let b=0;bt.overscaledZ)for(const L in C){const R=C[L];R.tileID.isChildOf(t)&&R.findMatches(l.symbolInstances,t,m)}else{const L=C[t.scaledTo(Number(b)).key];L&&L.findMatches(l.symbolInstances,t,m)}}for(let b=0;b{l[p]=!0});for(const p in this.layerIndexes)l[p]||delete this.layerIndexes[p]}}const ys=(x,t)=>f.t(x,t&&t.filter(l=>l.identifier!=="source.canvas")),Dn=f.ax();class qr extends f.E{constructor(t,l={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=t,this.dispatcher=new Jt(vi(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new _t,this.imageManager.setEventedParent(this),this.glyphManager=new lt(t._requestManager,l.localIdeographFontFamily),this.lineAtlas=new Gt(256,512),this.crossTileSymbolIndex=new cr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new f.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",f.az()),ti().on(Ge,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const b=m.getSource();if(b&&b.vectorLayerIds)for(const C in this._layers){const L=this._layers[C];L.source===b.id&&this._validateLayer(L)}})}loadURL(t,l={},p){this.fire(new f.k("dataloading",{dataType:"style"})),l.validate=typeof l.validate!="boolean"||l.validate;const m=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const b=this._loadStyleRequest;f.h(m,this._loadStyleRequest).then(C=>{this._loadStyleRequest=null,this._load(C.data,l,p)}).catch(C=>{this._loadStyleRequest=null,C&&!b.signal.aborted&&this.fire(new f.j(C))})}loadJSON(t,l={},p){this.fire(new f.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,l.validate=l.validate!==!1,this._load(t,l,p)}).catch(()=>{})}loadEmpty(){this.fire(new f.k("dataloading",{dataType:"style"})),this._load(Dn,{validate:!1})}_load(t,l,p){var m;const b=l.transformStyle?l.transformStyle(p,t):t;if(!l.validate||!ys(this,f.x(b))){this._loaded=!0,this.stylesheet=b;for(const C in b.sources)this.addSource(C,b.sources[C],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new it(this.stylesheet.light),this.sky=new Ut(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new f.k("data",{dataType:"style"})),this.fire(new f.k("style.load"))}}_createLayers(){const t=f.aA(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(l=>l.id),this._layers={},this._serializedLayers=null;for(const l of t){const p=f.aB(l);p.setEventedParent(this,{layer:{id:l.id}}),this._layers[l.id]=p}}_loadSprite(t,l=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(b,C,L,R){return f._(this,void 0,void 0,function*(){const z=Ve(b),G=L>1?"@2x":"",q={},K={};for(const{id:ee,url:se}of z){const ue=C.transformRequest(st(se,G,".json"),"SpriteJSON");q[ee]=f.h(ue,R);const ae=C.transformRequest(st(se,G,".png"),"SpriteImage");K[ee]=ke.getImage(ae,R)}return yield Promise.all([...Object.values(q),...Object.values(K)]),function(ee,se){return f._(this,void 0,void 0,function*(){const ue={};for(const ae in ee){ue[ae]={};const fe=N.getImageCanvasContext((yield se[ae]).data),ye=(yield ee[ae]).data;for(const oe in ye){const{width:Ie,height:Me,x:Be,y:Qe,sdf:ot,pixelRatio:Ct,stretchX:At,stretchY:at,content:ht,textFitWidth:Nt,textFitHeight:ai}=ye[oe];ue[ae][oe]={data:null,pixelRatio:Ct,sdf:ot,stretchX:At,stretchY:at,content:ht,textFitWidth:Nt,textFitHeight:ai,spriteData:{width:Ie,height:Me,x:Be,y:Qe,context:fe}}}}return ue})}(q,K)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(b=>{if(this._spriteRequest=null,b)for(const C in b){this._spritesImagesIds[C]=[];const L=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter(R=>!(R in b)):[];for(const R of L)this.imageManager.removeImage(R),this._changedImages[R]=!0;for(const R in b[C]){const z=C==="default"?R:`${C}:${R}`;this._spritesImagesIds[C].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,b[C][R],!1):this.imageManager.addImage(z,b[C][R]),l&&(this._changedImages[z]=!0)}}}).catch(b=>{this._spriteRequest=null,m=b,this.fire(new f.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),l&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"}))}_validateLayer(t){const l=this.sourceCaches[t.source];if(!l)return;const p=t.sourceLayer;if(!p)return;const m=l.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new f.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const l=this._serializedAllLayers();if(!t||t.length===0)return Object.values(l);const p=[];for(const m of t)l[m]&&p.push(l[m]);return p}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const l=Object.keys(this._layers);for(const p of l){const m=this._layers[p];m.type!=="custom"&&(t[p]=m.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const l=this._changed;if(l){const m=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(m.length||b.length)&&this._updateWorkerLayers(m,b);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(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const b=this.sourceCaches[m];p[m]=b.used,b.used=!1}for(const m of this._order){const b=this._layers[m];b.recalculate(t,this._availableImages),!b.isHidden(t.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const m in p){const b=this.sourceCaches[m];!!p[m]!=!!b.used&&b.fire(new f.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,l&&this.fire(new f.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const l in this.sourceCaches)this.sourceCaches[l].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,l){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:l})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,l={}){var p;this._checkLoaded();const m=this.serialize();if(t=l.transformStyle?l.transformStyle(m,t):t,((p=l.validate)===null||p===void 0||p)&&ys(this,f.x(t)))return!1;(t=f.aC(t)).layers=f.aA(t.layers);const b=f.aD(m,t),C=this._getOperationsToPerform(b);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=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const l=[],p=[];for(const m of t)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":l.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":l.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":l.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":l.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":l.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":l.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":l.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":l.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":l.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":l.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":l.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":l.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":l.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":l.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":l.push(()=>{});break;default:p.push(m.command)}return{operations:l,unimplemented:p}}addImage(t,l){if(this.getImage(t))return this.fire(new f.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,l),this._afterImageUpdated(t)}updateImage(t,l){this.imageManager.updateImage(t,l)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new f.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,l,p={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!l.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(l).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(l.type)>=0&&this._validate(f.x.source,`sources.${t}`,l,null,p))return;this.map&&this.map._collectResourceTiming&&(l.collectResourceTiming=!0);const m=this.sourceCaches[t]=new rt(t,l,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:t})),m.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new f.j(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));const l=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],l.fire(new f.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),l.setEventedParent(null),l.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,l){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const p=this.sourceCaches[t].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(l),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,l,p={}){this._checkLoaded();const m=t.id;if(this.getLayer(m))return void this.fire(new f.j(new Error(`Layer "${m}" already exists on this map.`)));let b;if(t.type==="custom"){if(ys(this,f.aE(t)))return;b=f.aB(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(m,t.source),t=f.aC(t),t=f.e(t,{source:m})),this._validate(f.x.layer,`layers.${m}`,t,{arrayIndex:-1},p))return;b=f.aB(t),this._validateLayer(b),b.setEventedParent(this,{layer:{id:m}})}const C=l?this._order.indexOf(l):this._order.length;if(l&&C===-1)this.fire(new f.j(new Error(`Cannot add layer "${m}" before non-existing layer "${l}".`)));else{if(this._order.splice(C,0,m),this._layerOrderChanged=!0,this._layers[m]=b,this._removedLayers[m]&&b.source&&b.type!=="custom"){const L=this._removedLayers[m];delete this._removedLayers[m],L.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(t,l){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new f.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===l)return;const p=this._order.indexOf(t);this._order.splice(p,1);const m=l?this._order.indexOf(l):this._order.length;l&&m===-1?this.fire(new f.j(new Error(`Cannot move layer "${t}" before non-existing layer "${l}".`))):(this._order.splice(m,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const l=this._layers[t];if(!l)return void this.fire(new f.j(new Error(`Cannot remove non-existing layer "${t}".`)));l.setEventedParent(null);const p=this._order.indexOf(t);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=l,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],l.onRemove&&l.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,l,p){this._checkLoaded();const m=this.getLayer(t);m?m.minzoom===l&&m.maxzoom===p||(l!=null&&(m.minzoom=l),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new f.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,l,p={}){this._checkLoaded();const m=this.getLayer(t);if(m){if(!f.aF(m.filter,l))return l==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(f.x.filter,`layers.${m.id}.filter`,l,null,p)||(m.filter=f.aC(l),this._updateLayer(m)))}else this.fire(new f.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return f.aC(this.getLayer(t).filter)}setLayoutProperty(t,l,p,m={}){this._checkLoaded();const b=this.getLayer(t);b?f.aF(b.getLayoutProperty(l),p)||(b.setLayoutProperty(l,p,m),this._updateLayer(b)):this.fire(new f.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,l){const p=this.getLayer(t);if(p)return p.getLayoutProperty(l);this.fire(new f.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,l,p,m={}){this._checkLoaded();const b=this.getLayer(t);b?f.aF(b.getPaintProperty(l),p)||(b.setPaintProperty(l,p,m)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new f.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,l){return this.getLayer(t).getPaintProperty(l)}setFeatureState(t,l){this._checkLoaded();const p=t.source,m=t.sourceLayer,b=this.sourceCaches[p];if(b===void 0)return void this.fire(new f.j(new Error(`The source '${p}' does not exist in the map's style.`)));const C=b.getSource().type;C==="geojson"&&m?this.fire(new f.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):C!=="vector"||m?(t.id===void 0&&this.fire(new f.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(m,t.id,l)):this.fire(new f.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,l){this._checkLoaded();const p=t.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new f.j(new Error(`The source '${p}' does not exist in the map's style.`)));const b=m.getSource().type,C=b==="vector"?t.sourceLayer:void 0;b!=="vector"||C?l&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new f.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(C,t.id,l):this.fire(new f.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const l=t.source,p=t.sourceLayer,m=this.sourceCaches[l];if(m!==void 0)return m.getSource().type!=="vector"||p?(t.id===void 0&&this.fire(new f.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,t.id)):void this.fire(new f.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new f.j(new Error(`The source '${l}' does not exist in the map's style.`)))}getTransition(){return f.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=f.aG(this.sourceCaches,b=>b.serialize()),l=this._serializeByIds(this._order),p=this.map.getTerrain()||void 0,m=this.stylesheet;return f.aH({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:t,layers:l,terrain:p},b=>b!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const l=C=>this._layers[C].type==="fill-extrusion",p={},m=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(l(L)){p[L]=C;for(const R of t){const z=R[L];if(z)for(const G of z)m.push(G)}}}m.sort((C,L)=>L.intersectionZ-C.intersectionZ);const b=[];for(let C=this._order.length-1;C>=0;C--){const L=this._order[C];if(l(L))for(let R=m.length-1;R>=0;R--){const z=m[R].feature;if(p[z.layer.id]{const ot=fe.featureSortOrder;if(ot){const Ct=ot.indexOf(Be.featureIndex);return ot.indexOf(Qe.featureIndex)-Ct}return Qe.featureIndex-Be.featureIndex});for(const Be of Me)Ie.push(Be)}}for(const fe in se)se[fe].forEach(ye=>{const oe=ye.feature,Ie=z[L[fe].source].getFeatureState(oe.layer["source-layer"],oe.id);oe.source=oe.layer.source,oe.layer["source-layer"]&&(oe.sourceLayer=oe.layer["source-layer"]),oe.state=Ie});return se}(this._layers,C,this.sourceCaches,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(t,l){l&&l.filter&&this._validate(f.x.filter,"querySourceFeatures.filter",l.filter,null,l);const p=this.sourceCaches[t];return p?function(m,b){const C=m.getRenderableIds().map(z=>m.getTileByID(z)),L=[],R={};for(let z=0;zK.getTileByID(ee)).sort((ee,se)=>se.tileID.overscaledZ-ee.tileID.overscaledZ||(ee.tileID.isLessThan(se.tileID)?-1:1))}const q=this.crossTileSymbolIndex.addLayer(G,R[G.source],t.center.lng);C=C||q}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(N.now(),t.zoom))&&(this.pauseablePlacement=new on(t,this.map.terrain,this._order,b,l,p,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,R),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(N.now()),L=!0),C&&this.pauseablePlacement.placement.setStale()),L||C)for(const z of this._order){const G=this._layers[z];G.type==="symbol"&&this.placement.updateLayerOpacities(G,R[G.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(N.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,l){return f._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(l.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[l.source];return m&&m.setDependencies(l.tileID.key,l.type,l.icons),p})}getGlyphs(t,l){return f._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(l.stacks),m=this.sourceCaches[l.source];return m&&m.setDependencies(l.tileID.key,l.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,l={}){this._checkLoaded(),t&&this._validate(f.x.glyphs,"glyphs",t,null,l)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,l,p={},m){this._checkLoaded();const b=[{id:t,url:l}],C=[...Ve(this.stylesheet.sprite),...b];this._validate(f.x.sprite,"sprite",C,null,p)||(this.stylesheet.sprite=C,this._loadSprite(b,!0,m))}removeSprite(t){this._checkLoaded();const l=Ve(this.stylesheet.sprite);if(l.find(p=>p.id===t)){if(this._spritesImagesIds[t])for(const p of this._spritesImagesIds[t])this.imageManager.removeImage(p),this._changedImages[p]=!0;l.splice(l.findIndex(p=>p.id===t),1),this.stylesheet.sprite=l.length>0?l:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new f.k("data",{dataType:"style"}))}else this.fire(new f.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Ve(this.stylesheet.sprite)}setSprite(t,l={},p){this._checkLoaded(),t&&this._validate(f.x.sprite,"sprite",t,null,l)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,p):(this._unloadSprite(),p&&p(null)))}}var no=f.Y([{name:"a_pos",type:"Int16",components:2}]);const hr={prelude:Si(`#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:Si(`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:Si(`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:Si(`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:Si("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:Si(`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:Si(`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:Si("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_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Si("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:Si("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:Si(`#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:Si(`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:Si(`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:Si(`#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:Si(`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:Si(`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:Si(`#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:Si(`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:Si(`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:Si(`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:Si(`#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:Si(`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:Si(`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:Si(`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 +}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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:Si(`#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 +}`,`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 bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Si(`#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 +}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Si("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Si("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);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Si("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);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:Si("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Si(x,t){const l=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,p=t.match(/attribute ([\w]+) ([\w]+)/g),m=x.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),C=b?b.concat(m):m,L={};return{fragmentSource:x=x.replace(l,(R,z,G,q,K)=>(L[K]=!0,z==="define"?` +#ifndef HAS_UNIFORM_u_${K} +varying ${G} ${q} ${K}; +#else +uniform ${G} ${q} u_${K}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${K} + ${G} ${q} ${K} = u_${K}; +#endif +`)),vertexSource:t=t.replace(l,(R,z,G,q,K)=>{const ee=q==="float"?"vec2":"vec4",se=K.match(/color/)?"color":ee;return L[K]?z==="define"?` +#ifndef HAS_UNIFORM_u_${K} +uniform lowp float u_${K}_t; +attribute ${G} ${ee} a_${K}; +varying ${G} ${q} ${K}; +#else +uniform ${G} ${q} u_${K}; +#endif +`:se==="vec4"?` +#ifndef HAS_UNIFORM_u_${K} + ${K} = a_${K}; +#else + ${G} ${q} ${K} = u_${K}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${K} + ${K} = unpack_mix_${se}(a_${K}, u_${K}_t); +#else + ${G} ${q} ${K} = u_${K}; +#endif +`:z==="define"?` +#ifndef HAS_UNIFORM_u_${K} +uniform lowp float u_${K}_t; +attribute ${G} ${ee} a_${K}; +#else +uniform ${G} ${q} u_${K}; +#endif +`:se==="vec4"?` +#ifndef HAS_UNIFORM_u_${K} + ${G} ${q} ${K} = a_${K}; +#else + ${G} ${q} ${K} = u_${K}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${K} + ${G} ${q} ${K} = unpack_mix_${se}(a_${K}, u_${K}_t); +#else + ${G} ${q} ${K} = u_${K}; +#endif +`}),staticAttributes:p,staticUniforms:C}}class ga{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,l,p,m,b,C,L,R,z){this.context=t;let G=this.boundPaintVertexBuffers.length!==m.length;for(let q=0;!G&&q({u_matrix:x,u_texture:0,u_ele_delta:t,u_fog_matrix:l,u_fog_color:p?p.properties.get("fog-color"):f.aN.white,u_fog_ground_blend:p?p.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?p.calculateFogBlendOpacity(m):0,u_horizon_color:p?p.properties.get("horizon-color"):f.aN.white,u_horizon_fog_blend:p?p.properties.get("horizon-fog-blend"):1});function jo(x){const t=[];for(let l=0;l({u_depth:new f.aI(Be,Qe.u_depth),u_terrain:new f.aI(Be,Qe.u_terrain),u_terrain_dim:new f.aJ(Be,Qe.u_terrain_dim),u_terrain_matrix:new f.aK(Be,Qe.u_terrain_matrix),u_terrain_unpack:new f.aL(Be,Qe.u_terrain_unpack),u_terrain_exaggeration:new f.aJ(Be,Qe.u_terrain_exaggeration)}))(t,Me),this.binderUniforms=p?p.getUniforms(t,Me):[]}draw(t,l,p,m,b,C,L,R,z,G,q,K,ee,se,ue,ae,fe,ye){const oe=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(p),t.setStencilMode(m),t.setColorMode(b),t.setCullFace(C),R){t.activeTexture.set(oe.TEXTURE2),oe.bindTexture(oe.TEXTURE_2D,R.depthTexture),t.activeTexture.set(oe.TEXTURE3),oe.bindTexture(oe.TEXTURE_2D,R.texture);for(const Me in this.terrainUniforms)this.terrainUniforms[Me].set(R[Me])}for(const Me in this.fixedUniforms)this.fixedUniforms[Me].set(L[Me]);ue&&ue.setUniforms(t,this.binderUniforms,ee,{zoom:se});let Ie=0;switch(l){case oe.LINES:Ie=2;break;case oe.TRIANGLES:Ie=3;break;case oe.LINE_STRIP:Ie=1}for(const Me of K.get()){const Be=Me.vaos||(Me.vaos={});(Be[z]||(Be[z]=new ga)).bind(t,this,G,ue?ue.getPaintVertexBuffers():[],q,Me.vertexOffset,ae,fe,ye),oe.drawElements(l,Me.primitiveLength*Ie,oe.UNSIGNED_SHORT,Me.primitiveOffset*Ie*2)}}}function _s(x,t,l){const p=1/Yt(l,1,t.transform.tileZoom),m=Math.pow(2,l.tileID.overscaledZ),b=l.tileSize*Math.pow(2,t.transform.tileZoom)/m,C=b*(l.tileID.canonical.x+l.tileID.wrap*m),L=b*l.tileID.canonical.y;return{u_image:0,u_texsize:l.imageAtlasTexture.size,u_scale:[p,x.fromScale,x.toScale],u_fade:x.t,u_pixel_coord_upper:[C>>16,L>>16],u_pixel_coord_lower:[65535&C,65535&L]}}const Vo=(x,t,l,p)=>{const m=t.style.light,b=m.properties.get("position"),C=[b.x,b.y,b.z],L=function(){var z=new f.A(9);return f.A!=Float32Array&&(z[1]=0,z[2]=0,z[3]=0,z[5]=0,z[6]=0,z[7]=0),z[0]=1,z[4]=1,z[8]=1,z}();m.properties.get("anchor")==="viewport"&&function(z,G){var q=Math.sin(G),K=Math.cos(G);z[0]=K,z[1]=q,z[2]=0,z[3]=-q,z[4]=K,z[5]=0,z[6]=0,z[7]=0,z[8]=1}(L,-t.transform.angle),function(z,G,q){var K=G[0],ee=G[1],se=G[2];z[0]=K*q[0]+ee*q[3]+se*q[6],z[1]=K*q[1]+ee*q[4]+se*q[7],z[2]=K*q[2]+ee*q[5]+se*q[8]}(C,C,L);const R=m.properties.get("color");return{u_matrix:x,u_lightpos:C,u_lightintensity:m.properties.get("intensity"),u_lightcolor:[R.r,R.g,R.b],u_vertical_gradient:+l,u_opacity:p}},ya=(x,t,l,p,m,b,C)=>f.e(Vo(x,t,l,p),_s(b,t,C),{u_height_factor:-Math.pow(2,m.overscaledZ)/C.tileSize/8}),ro=x=>({u_matrix:x}),so=(x,t,l,p)=>f.e(ro(x),_s(l,t,p)),il=(x,t)=>({u_matrix:x,u_world:t}),Yi=(x,t,l,p,m)=>f.e(so(x,t,l,p),{u_world:m}),vs=(x,t,l,p)=>{const m=x.transform;let b,C;if(p.paint.get("circle-pitch-alignment")==="map"){const L=Yt(l,1,m.zoom);b=!0,C=[L,L]}else b=!1,C=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:x.translatePosMatrix(t.posMatrix,l,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+b,u_device_pixel_ratio:x.pixelRatio,u_extrude_scale:C}},Bu=(x,t,l)=>({u_matrix:x,u_inv_matrix:t,u_camera_to_center_distance:l.cameraToCenterDistance,u_viewport_size:[l.width,l.height]}),Gr=(x,t,l=1)=>({u_matrix:x,u_color:t,u_overlay:0,u_overlay_scale:l}),zn=x=>({u_matrix:x}),Ki=(x,t,l,p)=>({u_matrix:x,u_extrude_scale:Yt(t,1,l),u_intensity:p});function Nn(x,t){const l=Math.pow(2,t.canonical.z),p=t.canonical.y;return[new f.Z(0,p/l).toLngLat().lat,new f.Z(0,(p+1)/l).toLngLat().lat]}const qo=(x,t,l,p)=>{const m=x.transform;return{u_matrix:rl(x,t,l,p),u_ratio:1/Yt(t,1,m.zoom),u_device_pixel_ratio:x.pixelRatio,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},_a=(x,t,l,p,m)=>f.e(qo(x,t,l,m),{u_image:0,u_image_height:p}),nl=(x,t,l,p,m)=>{const b=x.transform,C=Fs(t,b);return{u_matrix:rl(x,t,l,m),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Yt(t,1,b.zoom),u_device_pixel_ratio:x.pixelRatio,u_image:0,u_scale:[C,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]]}},Go=(x,t,l,p,m,b)=>{const C=x.lineAtlas,L=Fs(t,x.transform),R=l.layout.get("line-cap")==="round",z=C.getDash(p.from,R),G=C.getDash(p.to,R),q=z.width*m.fromScale,K=G.width*m.toScale;return f.e(qo(x,t,l,b),{u_patternscale_a:[L/q,-z.height/2],u_patternscale_b:[L/K,-G.height/2],u_sdfgamma:C.width/(256*Math.min(q,K)*x.pixelRatio)/2,u_image:0,u_tex_y_a:z.y,u_tex_y_b:G.y,u_mix:m.t})};function Fs(x,t){return 1/Yt(x,1,t.tileZoom)}function rl(x,t,l,p){return x.translatePosMatrix(p?p.posMatrix:t.tileID.posMatrix,t,l.paint.get("line-translate"),l.paint.get("line-translate-anchor"))}const Ti=(x,t,l,p,m)=>{return{u_matrix:x,u_tl_parent:t,u_scale_parent:l,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:(C=m.paint.get("raster-saturation"),C>0?1-1/(1.001-C):-C),u_contrast_factor:(b=m.paint.get("raster-contrast"),b>0?1/(1-b):1+b),u_spin_weights:Zr(m.paint.get("raster-hue-rotate"))};var b,C};function Zr(x){x*=Math.PI/180;const t=Math.sin(x),l=Math.cos(x);return[(2*l+1)/3,(-Math.sqrt(3)*t-l+1)/3,(Math.sqrt(3)*t-l+1)/3]}const va=(x,t,l,p,m,b,C,L,R,z,G,q,K,ee)=>{const se=C.transform;return{u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:se.cameraToCenterDistance,u_pitch:se.pitch/360*2*Math.PI,u_rotate_symbol:+l,u_aspect_ratio:se.width/se.height,u_fade_change:C.options.fadeDuration?C.symbolFadeChange:1,u_matrix:L,u_label_plane_matrix:R,u_coord_matrix:z,u_is_text:+q,u_pitch_with_map:+p,u_is_along_line:m,u_is_variable_anchor:b,u_texsize:K,u_texture:0,u_translation:G,u_pitched_scale:ee}},sl=(x,t,l,p,m,b,C,L,R,z,G,q,K,ee,se)=>{const ue=C.transform;return f.e(va(x,t,l,p,m,b,C,L,R,z,G,q,K,se),{u_gamma_scale:p?Math.cos(ue._pitch)*ue.cameraToCenterDistance:1,u_device_pixel_ratio:C.pixelRatio,u_is_halo:+ee})},Zo=(x,t,l,p,m,b,C,L,R,z,G,q,K,ee)=>f.e(sl(x,t,l,p,m,b,C,L,R,z,G,!0,q,!0,ee),{u_texsize_icon:K,u_texture_icon:1}),Wo=(x,t,l)=>({u_matrix:x,u_opacity:t,u_color:l}),En=(x,t,l,p,m,b)=>f.e(function(C,L,R,z){const G=R.imageManager.getPattern(C.from.toString()),q=R.imageManager.getPattern(C.to.toString()),{width:K,height:ee}=R.imageManager.getPixelSize(),se=Math.pow(2,z.tileID.overscaledZ),ue=z.tileSize*Math.pow(2,R.transform.tileZoom)/se,ae=ue*(z.tileID.canonical.x+z.tileID.wrap*se),fe=ue*z.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:G.tl,u_pattern_br_a:G.br,u_pattern_tl_b:q.tl,u_pattern_br_b:q.br,u_texsize:[K,ee],u_mix:L.t,u_pattern_size_a:G.displaySize,u_pattern_size_b:q.displaySize,u_scale_a:L.fromScale,u_scale_b:L.toScale,u_tile_units_to_pixels:1/Yt(z,1,R.transform.tileZoom),u_pixel_coord_upper:[ae>>16,fe>>16],u_pixel_coord_lower:[65535&ae,65535&fe]}}(p,b,l,m),{u_matrix:x,u_opacity:t}),Xo={fillExtrusion:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_lightpos:new f.aO(x,t.u_lightpos),u_lightintensity:new f.aJ(x,t.u_lightintensity),u_lightcolor:new f.aO(x,t.u_lightcolor),u_vertical_gradient:new f.aJ(x,t.u_vertical_gradient),u_opacity:new f.aJ(x,t.u_opacity)}),fillExtrusionPattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_lightpos:new f.aO(x,t.u_lightpos),u_lightintensity:new f.aJ(x,t.u_lightintensity),u_lightcolor:new f.aO(x,t.u_lightcolor),u_vertical_gradient:new f.aJ(x,t.u_vertical_gradient),u_height_factor:new f.aJ(x,t.u_height_factor),u_image:new f.aI(x,t.u_image),u_texsize:new f.aP(x,t.u_texsize),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade),u_opacity:new f.aJ(x,t.u_opacity)}),fill:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix)}),fillPattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_image:new f.aI(x,t.u_image),u_texsize:new f.aP(x,t.u_texsize),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade)}),fillOutline:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_world:new f.aP(x,t.u_world)}),fillOutlinePattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_world:new f.aP(x,t.u_world),u_image:new f.aI(x,t.u_image),u_texsize:new f.aP(x,t.u_texsize),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade)}),circle:(x,t)=>({u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_scale_with_map:new f.aI(x,t.u_scale_with_map),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_extrude_scale:new f.aP(x,t.u_extrude_scale),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_matrix:new f.aK(x,t.u_matrix)}),collisionBox:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_pixel_extrude_scale:new f.aP(x,t.u_pixel_extrude_scale)}),collisionCircle:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_inv_matrix:new f.aK(x,t.u_inv_matrix),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_viewport_size:new f.aP(x,t.u_viewport_size)}),debug:(x,t)=>({u_color:new f.aM(x,t.u_color),u_matrix:new f.aK(x,t.u_matrix),u_overlay:new f.aI(x,t.u_overlay),u_overlay_scale:new f.aJ(x,t.u_overlay_scale)}),clippingMask:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix)}),heatmap:(x,t)=>({u_extrude_scale:new f.aJ(x,t.u_extrude_scale),u_intensity:new f.aJ(x,t.u_intensity),u_matrix:new f.aK(x,t.u_matrix)}),heatmapTexture:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_world:new f.aP(x,t.u_world),u_image:new f.aI(x,t.u_image),u_color_ramp:new f.aI(x,t.u_color_ramp),u_opacity:new f.aJ(x,t.u_opacity)}),hillshade:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_image:new f.aI(x,t.u_image),u_latrange:new f.aP(x,t.u_latrange),u_light:new f.aP(x,t.u_light),u_shadow:new f.aM(x,t.u_shadow),u_highlight:new f.aM(x,t.u_highlight),u_accent:new f.aM(x,t.u_accent)}),hillshadePrepare:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_image:new f.aI(x,t.u_image),u_dimension:new f.aP(x,t.u_dimension),u_zoom:new f.aJ(x,t.u_zoom),u_unpack:new f.aL(x,t.u_unpack)}),line:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels)}),lineGradient:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels),u_image:new f.aI(x,t.u_image),u_image_height:new f.aJ(x,t.u_image_height)}),linePattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_texsize:new f.aP(x,t.u_texsize),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_image:new f.aI(x,t.u_image),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels),u_scale:new f.aO(x,t.u_scale),u_fade:new f.aJ(x,t.u_fade)}),lineSDF:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ratio:new f.aJ(x,t.u_ratio),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_units_to_pixels:new f.aP(x,t.u_units_to_pixels),u_patternscale_a:new f.aP(x,t.u_patternscale_a),u_patternscale_b:new f.aP(x,t.u_patternscale_b),u_sdfgamma:new f.aJ(x,t.u_sdfgamma),u_image:new f.aI(x,t.u_image),u_tex_y_a:new f.aJ(x,t.u_tex_y_a),u_tex_y_b:new f.aJ(x,t.u_tex_y_b),u_mix:new f.aJ(x,t.u_mix)}),raster:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_tl_parent:new f.aP(x,t.u_tl_parent),u_scale_parent:new f.aJ(x,t.u_scale_parent),u_buffer_scale:new f.aJ(x,t.u_buffer_scale),u_fade_t:new f.aJ(x,t.u_fade_t),u_opacity:new f.aJ(x,t.u_opacity),u_image0:new f.aI(x,t.u_image0),u_image1:new f.aI(x,t.u_image1),u_brightness_low:new f.aJ(x,t.u_brightness_low),u_brightness_high:new f.aJ(x,t.u_brightness_high),u_saturation_factor:new f.aJ(x,t.u_saturation_factor),u_contrast_factor:new f.aJ(x,t.u_contrast_factor),u_spin_weights:new f.aO(x,t.u_spin_weights)}),symbolIcon:(x,t)=>({u_is_size_zoom_constant:new f.aI(x,t.u_is_size_zoom_constant),u_is_size_feature_constant:new f.aI(x,t.u_is_size_feature_constant),u_size_t:new f.aJ(x,t.u_size_t),u_size:new f.aJ(x,t.u_size),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_pitch:new f.aJ(x,t.u_pitch),u_rotate_symbol:new f.aI(x,t.u_rotate_symbol),u_aspect_ratio:new f.aJ(x,t.u_aspect_ratio),u_fade_change:new f.aJ(x,t.u_fade_change),u_matrix:new f.aK(x,t.u_matrix),u_label_plane_matrix:new f.aK(x,t.u_label_plane_matrix),u_coord_matrix:new f.aK(x,t.u_coord_matrix),u_is_text:new f.aI(x,t.u_is_text),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_is_along_line:new f.aI(x,t.u_is_along_line),u_is_variable_anchor:new f.aI(x,t.u_is_variable_anchor),u_texsize:new f.aP(x,t.u_texsize),u_texture:new f.aI(x,t.u_texture),u_translation:new f.aP(x,t.u_translation),u_pitched_scale:new f.aJ(x,t.u_pitched_scale)}),symbolSDF:(x,t)=>({u_is_size_zoom_constant:new f.aI(x,t.u_is_size_zoom_constant),u_is_size_feature_constant:new f.aI(x,t.u_is_size_feature_constant),u_size_t:new f.aJ(x,t.u_size_t),u_size:new f.aJ(x,t.u_size),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_pitch:new f.aJ(x,t.u_pitch),u_rotate_symbol:new f.aI(x,t.u_rotate_symbol),u_aspect_ratio:new f.aJ(x,t.u_aspect_ratio),u_fade_change:new f.aJ(x,t.u_fade_change),u_matrix:new f.aK(x,t.u_matrix),u_label_plane_matrix:new f.aK(x,t.u_label_plane_matrix),u_coord_matrix:new f.aK(x,t.u_coord_matrix),u_is_text:new f.aI(x,t.u_is_text),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_is_along_line:new f.aI(x,t.u_is_along_line),u_is_variable_anchor:new f.aI(x,t.u_is_variable_anchor),u_texsize:new f.aP(x,t.u_texsize),u_texture:new f.aI(x,t.u_texture),u_gamma_scale:new f.aJ(x,t.u_gamma_scale),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_is_halo:new f.aI(x,t.u_is_halo),u_translation:new f.aP(x,t.u_translation),u_pitched_scale:new f.aJ(x,t.u_pitched_scale)}),symbolTextAndIcon:(x,t)=>({u_is_size_zoom_constant:new f.aI(x,t.u_is_size_zoom_constant),u_is_size_feature_constant:new f.aI(x,t.u_is_size_feature_constant),u_size_t:new f.aJ(x,t.u_size_t),u_size:new f.aJ(x,t.u_size),u_camera_to_center_distance:new f.aJ(x,t.u_camera_to_center_distance),u_pitch:new f.aJ(x,t.u_pitch),u_rotate_symbol:new f.aI(x,t.u_rotate_symbol),u_aspect_ratio:new f.aJ(x,t.u_aspect_ratio),u_fade_change:new f.aJ(x,t.u_fade_change),u_matrix:new f.aK(x,t.u_matrix),u_label_plane_matrix:new f.aK(x,t.u_label_plane_matrix),u_coord_matrix:new f.aK(x,t.u_coord_matrix),u_is_text:new f.aI(x,t.u_is_text),u_pitch_with_map:new f.aI(x,t.u_pitch_with_map),u_is_along_line:new f.aI(x,t.u_is_along_line),u_is_variable_anchor:new f.aI(x,t.u_is_variable_anchor),u_texsize:new f.aP(x,t.u_texsize),u_texsize_icon:new f.aP(x,t.u_texsize_icon),u_texture:new f.aI(x,t.u_texture),u_texture_icon:new f.aI(x,t.u_texture_icon),u_gamma_scale:new f.aJ(x,t.u_gamma_scale),u_device_pixel_ratio:new f.aJ(x,t.u_device_pixel_ratio),u_is_halo:new f.aI(x,t.u_is_halo),u_translation:new f.aP(x,t.u_translation),u_pitched_scale:new f.aJ(x,t.u_pitched_scale)}),background:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_opacity:new f.aJ(x,t.u_opacity),u_color:new f.aM(x,t.u_color)}),backgroundPattern:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_opacity:new f.aJ(x,t.u_opacity),u_image:new f.aI(x,t.u_image),u_pattern_tl_a:new f.aP(x,t.u_pattern_tl_a),u_pattern_br_a:new f.aP(x,t.u_pattern_br_a),u_pattern_tl_b:new f.aP(x,t.u_pattern_tl_b),u_pattern_br_b:new f.aP(x,t.u_pattern_br_b),u_texsize:new f.aP(x,t.u_texsize),u_mix:new f.aJ(x,t.u_mix),u_pattern_size_a:new f.aP(x,t.u_pattern_size_a),u_pattern_size_b:new f.aP(x,t.u_pattern_size_b),u_scale_a:new f.aJ(x,t.u_scale_a),u_scale_b:new f.aJ(x,t.u_scale_b),u_pixel_coord_upper:new f.aP(x,t.u_pixel_coord_upper),u_pixel_coord_lower:new f.aP(x,t.u_pixel_coord_lower),u_tile_units_to_pixels:new f.aJ(x,t.u_tile_units_to_pixels)}),terrain:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_texture:new f.aI(x,t.u_texture),u_ele_delta:new f.aJ(x,t.u_ele_delta),u_fog_matrix:new f.aK(x,t.u_fog_matrix),u_fog_color:new f.aM(x,t.u_fog_color),u_fog_ground_blend:new f.aJ(x,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new f.aJ(x,t.u_fog_ground_blend_opacity),u_horizon_color:new f.aM(x,t.u_horizon_color),u_horizon_fog_blend:new f.aJ(x,t.u_horizon_fog_blend)}),terrainDepth:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_ele_delta:new f.aJ(x,t.u_ele_delta)}),terrainCoords:(x,t)=>({u_matrix:new f.aK(x,t.u_matrix),u_texture:new f.aI(x,t.u_texture),u_terrain_coords_id:new f.aJ(x,t.u_terrain_coords_id),u_ele_delta:new f.aJ(x,t.u_ele_delta)}),sky:(x,t)=>({u_sky_color:new f.aM(x,t.u_sky_color),u_horizon_color:new f.aM(x,t.u_horizon_color),u_horizon:new f.aJ(x,t.u_horizon),u_sky_horizon_blend:new f.aJ(x,t.u_sky_horizon_blend)})};class Ho{constructor(t,l,p){this.context=t;const m=t.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete l.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const l=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),l.bufferSubData(l.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const xa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class zr{constructor(t,l,p,m){this.length=l.length,this.attributes=p,this.itemSize=l.bytesPerElement,this.dynamicDraw=m,this.context=t;const b=t.gl;this.buffer=b.createBuffer(),t.bindVertexBuffer.set(this.buffer),b.bufferData(b.ARRAY_BUFFER,l.arrayBuffer,this.dynamicDraw?b.DYNAMIC_DRAW:b.STATIC_DRAW),this.dynamicDraw||delete l.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const l=this.context.gl;this.bind(),l.bufferSubData(l.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,l){for(let p=0;p0){const Be=f.H();f.aR(Be,oe.placementInvProjMatrix,x.transform.glCoordMatrix),f.aR(Be,Be,oe.placementViewportMatrix),R.push({circleArray:Me,circleOffset:G,transform:ye.posMatrix,invTransform:Be,coord:ye}),z+=Me.length/4,G=z}Ie&&L.draw(b,C.LINES,yi.disabled,qi.disabled,x.colorModeForRenderPass(),Ui.disabled,{u_matrix:ye.posMatrix,u_pixel_extrude_scale:[1/(q=x.transform).width,1/q.height]},x.style.map.terrain&&x.style.map.terrain.getTerrainData(ye),l.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,null,x.transform.zoom,null,null,Ie.collisionVertexBuffer)}var q;if(!m||!R.length)return;const K=x.useProgram("collisionCircle"),ee=new f.aS;ee.resize(4*z),ee._trim();let se=0;for(const fe of R)for(let ye=0;ye=0&&(fe[oe.associatedIconIndex]={shiftedAnchor:ri,angle:Ji})}else Qt(oe.numGlyphs,ue)}if(z){ae.clear();const ye=x.icon.placedSymbolArray;for(let oe=0;oex.style.map.terrain.getElevation(at,uc,Cn):null,za=l.layout.get("text-rotation-alignment")==="map";$(Nt,at.posMatrix,x,m,ra,Ra,fe,z,za,ue,at.toUnwrapped(),se.width,se.height,sa,an)}const Wn=at.posMatrix,ns=m&&ot||lc,yo=ye||ns?Sa:ra,Da=Kl,tr=wt&&l.paint.get(m?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ir;ir=wt?Nt.iconsInText?Zo(ri.kind,xi,oe,fe,ye,ns,x,Wn,yo,Da,sa,Qn,yr,At):sl(ri.kind,xi,oe,fe,ye,ns,x,Wn,yo,Da,sa,m,Qn,!0,At):va(ri.kind,xi,oe,fe,ye,ns,x,Wn,yo,Da,sa,m,Qn,At);const Bn={program:gi,buffers:ai,uniformValues:ir,atlasTexture:ts,atlasTextureIcon:$n,atlasInterpolation:$i,atlasInterpolationIcon:Sr,isSDF:wt,hasHalo:tr};if(Me&&Nt.canOverlap){Be=!0;const an=ai.segments.get();for(const za of an)Ct.push({segments:new f.a0([za]),sortKey:za.sortKey,state:Bn,terrainData:Qi})}else Ct.push({segments:ai.segments,sortKey:0,state:Bn,terrainData:Qi})}Be&&Ct.sort((at,ht)=>at.sortKey-ht.sortKey);for(const at of Ct){const ht=at.state;if(K.activeTexture.set(ee.TEXTURE0),ht.atlasTexture.bind(ht.atlasInterpolation,ee.CLAMP_TO_EDGE),ht.atlasTextureIcon&&(K.activeTexture.set(ee.TEXTURE1),ht.atlasTextureIcon&&ht.atlasTextureIcon.bind(ht.atlasInterpolationIcon,ee.CLAMP_TO_EDGE)),ht.isSDF){const Nt=ht.uniformValues;ht.hasHalo&&(Nt.u_is_halo=1,Us(ht.buffers,at.segments,l,x,ht.program,Qe,G,q,Nt,at.terrainData)),Nt.u_is_halo=0}Us(ht.buffers,at.segments,l,x,ht.program,Qe,G,q,ht.uniformValues,at.terrainData)}}function Us(x,t,l,p,m,b,C,L,R,z){const G=p.context;m.draw(G,G.gl.TRIANGLES,b,C,L,Ui.disabled,R,z,l.id,x.layoutVertexBuffer,x.indexBuffer,t,l.paint,p.transform.zoom,x.programConfigurations.get(l.id),x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer)}function pr(x,t,l,p,m){if(!l||!p||!p.imageAtlas)return;const b=p.imageAtlas.patternPositions;let C=b[l.to.toString()],L=b[l.from.toString()];if(!C&&L&&(C=L),!L&&C&&(L=C),!C||!L){const R=m.getPaintProperty(t);C=b[R],L=b[R]}C&&L&&x.setConstantPatternPositions(C,L)}function yl(x,t,l,p,m,b,C){const L=x.context.gl,R="fill-pattern",z=l.paint.get(R),G=z&&z.constantOr(1),q=l.getCrossfadeParameters();let K,ee,se,ue,ae;C?(ee=G&&!l.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",K=L.LINES):(ee=G?"fillPattern":"fill",K=L.TRIANGLES);const fe=z.constantOr(null);for(const ye of p){const oe=t.getTile(ye);if(G&&!oe.patternsLoaded())continue;const Ie=oe.getBucket(l);if(!Ie)continue;const Me=Ie.programConfigurations.get(l.id),Be=x.useProgram(ee,Me),Qe=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ye);G&&(x.context.activeTexture.set(L.TEXTURE0),oe.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Me.updatePaintBuffers(q)),pr(Me,R,fe,oe,l);const ot=Qe?ye:null,Ct=x.translatePosMatrix(ot?ot.posMatrix:ye.posMatrix,oe,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor"));if(C){ue=Ie.indexBuffer2,ae=Ie.segments2;const At=[L.drawingBufferWidth,L.drawingBufferHeight];se=ee==="fillOutlinePattern"&&G?Yi(Ct,x,q,oe,At):il(Ct,At)}else ue=Ie.indexBuffer,ae=Ie.segments,se=G?so(Ct,x,q,oe):ro(Ct);Be.draw(x.context,K,m,x.stencilModeForClipping(ye),b,Ui.disabled,se,Qe,l.id,Ie.layoutVertexBuffer,ue,ae,l.paint,x.transform.zoom,Me)}}function Ta(x,t,l,p,m,b,C){const L=x.context,R=L.gl,z="fill-extrusion-pattern",G=l.paint.get(z),q=G.constantOr(1),K=l.getCrossfadeParameters(),ee=l.paint.get("fill-extrusion-opacity"),se=G.constantOr(null);for(const ue of p){const ae=t.getTile(ue),fe=ae.getBucket(l);if(!fe)continue;const ye=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ue),oe=fe.programConfigurations.get(l.id),Ie=x.useProgram(q?"fillExtrusionPattern":"fillExtrusion",oe);q&&(x.context.activeTexture.set(R.TEXTURE0),ae.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),oe.updatePaintBuffers(K)),pr(oe,z,se,ae,l);const Me=x.translatePosMatrix(ue.posMatrix,ae,l.paint.get("fill-extrusion-translate"),l.paint.get("fill-extrusion-translate-anchor")),Be=l.paint.get("fill-extrusion-vertical-gradient"),Qe=q?ya(Me,x,Be,ee,ue,K,ae):Vo(Me,x,Be,ee);Ie.draw(L,L.gl.TRIANGLES,m,b,C,Ui.backCCW,Qe,ye,l.id,fe.layoutVertexBuffer,fe.indexBuffer,fe.segments,l.paint,x.transform.zoom,oe,x.style.map.terrain&&fe.centroidVertexBuffer)}}function Ca(x,t,l,p,m,b,C){const L=x.context,R=L.gl,z=l.fbo;if(!z)return;const G=x.useProgram("hillshade"),q=x.style.map.terrain&&x.style.map.terrain.getTerrainData(t);L.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,z.colorAttachment.get()),G.draw(L,R.TRIANGLES,m,b,C,Ui.disabled,((K,ee,se,ue)=>{const ae=se.paint.get("hillshade-shadow-color"),fe=se.paint.get("hillshade-highlight-color"),ye=se.paint.get("hillshade-accent-color");let oe=se.paint.get("hillshade-illumination-direction")*(Math.PI/180);se.paint.get("hillshade-illumination-anchor")==="viewport"&&(oe-=K.transform.angle);const Ie=!K.options.moving;return{u_matrix:ue?ue.posMatrix:K.transform.calculatePosMatrix(ee.tileID.toUnwrapped(),Ie),u_image:0,u_latrange:Nn(0,ee.tileID),u_light:[se.paint.get("hillshade-exaggeration"),oe],u_shadow:ae,u_highlight:fe,u_accent:ye}})(x,l,p,q?t:null),q,p.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}function ks(x,t,l,p,m,b){const C=x.context,L=C.gl,R=t.dem;if(R&&R.data){const z=R.dim,G=R.stride,q=R.getPixels();if(C.activeTexture.set(L.TEXTURE1),C.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||x.getTileTexture(G),t.demTexture){const ee=t.demTexture;ee.update(q,{premultiply:!1}),ee.bind(L.NEAREST,L.CLAMP_TO_EDGE)}else t.demTexture=new Se(C,q,L.RGBA,{premultiply:!1}),t.demTexture.bind(L.NEAREST,L.CLAMP_TO_EDGE);C.activeTexture.set(L.TEXTURE0);let K=t.fbo;if(!K){const ee=new Se(C,{width:z,height:z,data:null},L.RGBA);ee.bind(L.LINEAR,L.CLAMP_TO_EDGE),K=t.fbo=C.createFramebuffer(z,z,!0,!1),K.colorAttachment.set(ee.texture)}C.bindFramebuffer.set(K.framebuffer),C.viewport.set([0,0,z,z]),x.useProgram("hillshadePrepare").draw(C,L.TRIANGLES,p,m,b,Ui.disabled,((ee,se)=>{const ue=se.stride,ae=f.H();return f.aQ(ae,0,f.X,-f.X,0,0,1),f.J(ae,ae,[0,-f.X,0]),{u_matrix:ae,u_image:1,u_dimension:[ue,ue],u_zoom:ee.overscaledZ,u_unpack:se.getUnpackVector()}})(t.tileID,R),null,l.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ea(x,t,l,p,m,b){const C=p.paint.get("raster-fade-duration");if(!b&&C>0){const L=N.now(),R=(L-x.timeAdded)/C,z=t?(L-t.timeAdded)/C:-1,G=l.getSource(),q=m.coveringZoomLevel({tileSize:G.tileSize,roundZoom:G.roundZoom}),K=!t||Math.abs(t.tileID.overscaledZ-q)>Math.abs(x.tileID.overscaledZ-q),ee=K&&x.refreshedUponExpiration?1:f.ad(K?R:1-z,0,1);return x.refreshedUponExpiration&&R>=1&&(x.refreshedUponExpiration=!1),t?{opacity:1,mix:1-ee}:{opacity:ee,mix:0}}return{opacity:1,mix:0}}const Pa=new f.aN(1,0,0,1),co=new f.aN(0,1,0,1),ho=new f.aN(0,0,1,1),Xl=new f.aN(1,0,1,1),Vs=new f.aN(0,1,1,1);function Ss(x,t,l,p){fo(x,0,t+l/2,x.transform.width,l,p)}function _l(x,t,l,p){fo(x,t-l/2,0,l,x.transform.height,p)}function fo(x,t,l,p,m,b){const C=x.context,L=C.gl;L.enable(L.SCISSOR_TEST),L.scissor(t*x.pixelRatio,l*x.pixelRatio,p*x.pixelRatio,m*x.pixelRatio),C.clear({color:b}),L.disable(L.SCISSOR_TEST)}function _i(x,t,l){const p=x.context,m=p.gl,b=l.posMatrix,C=x.useProgram("debug"),L=yi.disabled,R=qi.disabled,z=x.colorModeForRenderPass(),G="$debug",q=x.style.map.terrain&&x.style.map.terrain.getTerrainData(l);p.activeTexture.set(m.TEXTURE0);const K=t.getTileByID(l.key).latestRawTileData,ee=Math.floor((K&&K.byteLength||0)/1024),se=t.getTile(l).tileSize,ue=512/Math.min(se,512)*(l.overscaledZ/x.transform.zoom)*.5;let ae=l.canonical.toString();l.overscaledZ!==l.canonical.z&&(ae+=` => ${l.overscaledZ}`),function(fe,ye){fe.initDebugOverlayCanvas();const oe=fe.debugOverlayCanvas,Ie=fe.context.gl,Me=fe.debugOverlayCanvas.getContext("2d");Me.clearRect(0,0,oe.width,oe.height),Me.shadowColor="white",Me.shadowBlur=2,Me.lineWidth=1.5,Me.strokeStyle="white",Me.textBaseline="top",Me.font="bold 36px Open Sans, sans-serif",Me.fillText(ye,5,5),Me.strokeText(ye,5,5),fe.debugOverlayTexture.update(oe),fe.debugOverlayTexture.bind(Ie.LINEAR,Ie.CLAMP_TO_EDGE)}(x,`${ae} ${ee}kB`),C.draw(p,m.TRIANGLES,L,R,Ni.alphaBlended,Ui.disabled,Gr(b,f.aN.transparent,ue),null,G,x.debugBuffer,x.quadTriangleIndexBuffer,x.debugSegments),C.draw(p,m.LINE_STRIP,L,R,z,Ui.disabled,Gr(b,f.aN.red),q,G,x.debugBuffer,x.tileBorderIndexBuffer,x.debugSegments)}function ta(x,t,l){const p=x.context,m=p.gl,b=x.colorModeForRenderPass(),C=new yi(m.LEQUAL,yi.ReadWrite,x.depthRangeFor3D),L=x.useProgram("terrain"),R=t.getTerrainMesh();p.bindFramebuffer.set(null),p.viewport.set([0,0,x.width,x.height]);for(const z of l){const G=x.renderToTexture.getTexture(z),q=t.getTerrainData(z.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,G.texture);const K=x.transform.calculatePosMatrix(z.tileID.toUnwrapped()),ee=t.getMeshFrameDelta(x.transform.zoom),se=x.transform.calculateFogMatrix(z.tileID.toUnwrapped()),ue=tl(K,ee,se,x.style.sky,x.transform.pitch);L.draw(p,m.TRIANGLES,C,qi.disabled,b,Ui.backCCW,ue,q,"terrain",R.vertexBuffer,R.indexBuffer,R.segments)}}class vl{constructor(t,l,p){this.vertexBuffer=t,this.indexBuffer=l,this.segments=p}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class mr{constructor(t,l){this.context=new pl(t),this.transform=l,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:f.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=rt.maxUnderzooming+rt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new cr}resize(t,l,p){if(this.width=Math.floor(t*p),this.height=Math.floor(l*p),this.pixelRatio=p,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const m of this.style._order)this.style._layers[m].resize()}setup(){const t=this.context,l=new f.aX;l.emplaceBack(0,0),l.emplaceBack(f.X,0),l.emplaceBack(0,f.X),l.emplaceBack(f.X,f.X),this.tileExtentBuffer=t.createVertexBuffer(l,no.members),this.tileExtentSegments=f.a0.simpleSegment(0,0,4,2);const p=new f.aX;p.emplaceBack(0,0),p.emplaceBack(f.X,0),p.emplaceBack(0,f.X),p.emplaceBack(f.X,f.X),this.debugBuffer=t.createVertexBuffer(p,no.members),this.debugSegments=f.a0.simpleSegment(0,0,4,5);const m=new f.$;m.emplaceBack(0,0,0,0),m.emplaceBack(f.X,0,f.X,0),m.emplaceBack(0,f.X,0,f.X),m.emplaceBack(f.X,f.X,f.X,f.X),this.rasterBoundsBuffer=t.createVertexBuffer(m,Yn.members),this.rasterBoundsSegments=f.a0.simpleSegment(0,0,4,2);const b=new f.aX;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(b,no.members),this.viewportSegments=f.a0.simpleSegment(0,0,4,2);const C=new f.aZ;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(C);const L=new f.aY;L.emplaceBack(0,1,2),L.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(L);const R=this.context.gl;this.stencilClearMode=new qi({func:R.ALWAYS,mask:0},0,255,R.ZERO,R.ZERO,R.ZERO)}clearStencil(){const t=this.context,l=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const p=f.H();f.aQ(p,0,this.width,this.height,0,0,1),f.K(p,p,[l.drawingBufferWidth,l.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,l.TRIANGLES,yi.disabled,this.stencilClearMode,Ni.disabled,Ui.disabled,zn(p),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,l){if(this.currentStencilSource===t.source||!t.isTileClipped()||!l||!l.length)return;this.currentStencilSource=t.source;const p=this.context,m=p.gl;this.nextStencilID+l.length>256&&this.clearStencil(),p.setColorMode(Ni.disabled),p.setDepthMode(yi.disabled);const b=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const C of l){const L=this._tileClippingMaskIDs[C.key]=this.nextStencilID++,R=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C);b.draw(p,m.TRIANGLES,yi.disabled,new qi({func:m.ALWAYS,mask:0},L,255,m.KEEP,m.KEEP,m.REPLACE),Ni.disabled,Ui.disabled,zn(C.posMatrix),R,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,l=this.context.gl;return new qi({func:l.NOTEQUAL,mask:255},t,255,l.KEEP,l.KEEP,l.REPLACE)}stencilModeForClipping(t){const l=this.context.gl;return new qi({func:l.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,l.KEEP,l.KEEP,l.REPLACE)}stencilConfigForOverlap(t){const l=this.context.gl,p=t.sort((C,L)=>L.overscaledZ-C.overscaledZ),m=p[p.length-1].overscaledZ,b=p[0].overscaledZ-m+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const C={};for(let L=0;L({u_sky_color:ye.properties.get("sky-color"),u_horizon_color:ye.properties.get("horizon-color"),u_horizon:(oe.height/2+oe.getHorizon())*Ie,u_sky_horizon_blend:ye.properties.get("sky-horizon-blend")*oe.height/2*Ie}))(G,z.style.map.transform,z.pixelRatio),se=new yi(K.LEQUAL,yi.ReadWrite,[0,1]),ue=qi.disabled,ae=z.colorModeForRenderPass(),fe=z.useProgram("sky");if(!G.mesh){const ye=new f.aX;ye.emplaceBack(-1,-1),ye.emplaceBack(1,-1),ye.emplaceBack(1,1),ye.emplaceBack(-1,1);const oe=new f.aY;oe.emplaceBack(0,1,2),oe.emplaceBack(0,2,3),G.mesh=new vl(q.createVertexBuffer(ye,no.members),q.createIndexBuffer(oe),f.a0.simpleSegment(0,0,ye.length,oe.length))}fe.draw(q,K.TRIANGLES,se,ue,ae,Ui.disabled,ee,void 0,"sky",G.mesh.vertexBuffer,G.mesh.indexBuffer,G.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=l.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const z=this.style._layers[m[this.currentLayer]],G=b[z.source],q=C[z.source];this._renderTileClippingMasks(z,q),this.renderLayer(this,G,z,q)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerfe.source&&!fe.isHidden(q)?[G.sourceCaches[fe.source]]:[]),se=ee.filter(fe=>fe.getSource().type==="vector"),ue=ee.filter(fe=>fe.getSource().type!=="vector"),ae=fe=>{(!K||K.getSource().maxzoomae(fe)),K||ue.forEach(fe=>ae(fe)),K}(this.style,this.transform.zoom);z&&function(G,q,K){for(let ee=0;ee0),m&&(f.b0(l,p),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(b,C){const L=b.context,R=L.gl,z=Ni.unblended,G=new yi(R.LEQUAL,yi.ReadWrite,[0,1]),q=C.getTerrainMesh(),K=C.sourceCache.getRenderableTiles(),ee=b.useProgram("terrainDepth");L.bindFramebuffer.set(C.getFramebuffer("depth").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:f.aN.transparent,depth:1});for(const se of K){const ue=C.getTerrainData(se.tileID),ae={u_matrix:b.transform.calculatePosMatrix(se.tileID.toUnwrapped()),u_ele_delta:C.getMeshFrameDelta(b.transform.zoom)};ee.draw(L,R.TRIANGLES,G,qi.disabled,z,Ui.backCCW,ae,ue,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain),function(b,C){const L=b.context,R=L.gl,z=Ni.unblended,G=new yi(R.LEQUAL,yi.ReadWrite,[0,1]),q=C.getTerrainMesh(),K=C.getCoordsTexture(),ee=C.sourceCache.getRenderableTiles(),se=b.useProgram("terrainCoords");L.bindFramebuffer.set(C.getFramebuffer("coords").framebuffer),L.viewport.set([0,0,b.width/devicePixelRatio,b.height/devicePixelRatio]),L.clear({color:f.aN.transparent,depth:1}),C.coordsIndex=[];for(const ue of ee){const ae=C.getTerrainData(ue.tileID);L.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,K.texture);const fe={u_matrix:b.transform.calculatePosMatrix(ue.tileID.toUnwrapped()),u_terrain_coords_id:(255-C.coordsIndex.length)/255,u_texture:0,u_ele_delta:C.getMeshFrameDelta(b.transform.zoom)};se.draw(L,R.TRIANGLES,G,qi.disabled,z,Ui.backCCW,fe,ae,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),C.coordsIndex.push(ue.tileID.key)}L.bindFramebuffer.set(null),L.viewport.set([0,0,b.width,b.height])}(this,this.style.map.terrain))}renderLayer(t,l,p,m){if(!p.isHidden(this.transform.zoom)&&(p.type==="background"||p.type==="custom"||(m||[]).length))switch(this.id=p.id,p.type){case"symbol":(function(b,C,L,R,z){if(b.renderPass!=="translucent")return;const G=qi.disabled,q=b.colorModeForRenderPass();(L._unevaluatedLayout.hasValue("text-variable-anchor")||L._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(K,ee,se,ue,ae,fe,ye,oe,Ie){const Me=ee.transform,Be=io(),Qe=ae==="map",ot=fe==="map";for(const Ct of K){const At=ue.getTile(Ct),at=At.getBucket(se);if(!at||!at.text||!at.text.segments.get().length)continue;const ht=f.ah(at.textSizeData,Me.zoom),Nt=Yt(At,1,ee.transform.zoom),ai=In(Ct.posMatrix,ot,Qe,ee.transform,Nt),gt=se.layout.get("icon-text-fit")!=="none"&&at.hasIconData();if(ht){const wt=Math.pow(2,Me.zoom-At.tileID.overscaledZ),ri=ee.style.map.terrain?(gi,xi)=>ee.style.map.terrain.getElevation(Ct,gi,xi):null,Ji=Be.translatePosition(Me,At,ye,oe);Ea(at,Qe,ot,Ie,Me,ai,Ct.posMatrix,wt,ht,gt,Be,Ji,Ct.toUnwrapped(),ri)}}}(R,b,L,C,L.layout.get("text-rotation-alignment"),L.layout.get("text-pitch-alignment"),L.paint.get("text-translate"),L.paint.get("text-translate-anchor"),z),L.paint.get("icon-opacity").constantOr(1)!==0&&ws(b,C,L,R,!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"),G,q),L.paint.get("text-opacity").constantOr(1)!==0&&ws(b,C,L,R,!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"),G,q),C.map.showCollisionBoxes&&(Wl(b,C,L,R,!0),Wl(b,C,L,R,!1))})(t,l,p,m,this.style.placement.variableOffsets);break;case"circle":(function(b,C,L,R){if(b.renderPass!=="translucent")return;const z=L.paint.get("circle-opacity"),G=L.paint.get("circle-stroke-width"),q=L.paint.get("circle-stroke-opacity"),K=!L.layout.get("circle-sort-key").isConstant();if(z.constantOr(1)===0&&(G.constantOr(1)===0||q.constantOr(1)===0))return;const ee=b.context,se=ee.gl,ue=b.depthModeForSublayer(0,yi.ReadOnly),ae=qi.disabled,fe=b.colorModeForRenderPass(),ye=[];for(let oe=0;oeoe.sortKey-Ie.sortKey);for(const oe of ye){const{programConfiguration:Ie,program:Me,layoutVertexBuffer:Be,indexBuffer:Qe,uniformValues:ot,terrainData:Ct}=oe.state;Me.draw(ee,se.TRIANGLES,ue,ae,fe,Ui.disabled,ot,Ct,L.id,Be,Qe,oe.segments,L.paint,b.transform.zoom,Ie)}})(t,l,p,m);break;case"heatmap":(function(b,C,L,R){if(L.paint.get("heatmap-opacity")!==0)if(b.renderPass==="offscreen"){const z=b.context,G=z.gl,q=qi.disabled,K=new Ni([G.ONE,G.ONE],f.aN.transparent,[!0,!0,!0,!0]);(function(ee,se,ue){const ae=ee.gl;ee.activeTexture.set(ae.TEXTURE1),ee.viewport.set([0,0,se.width/4,se.height/4]);let fe=ue.heatmapFbo;if(fe)ae.bindTexture(ae.TEXTURE_2D,fe.colorAttachment.get()),ee.bindFramebuffer.set(fe.framebuffer);else{const ye=ae.createTexture();ae.bindTexture(ae.TEXTURE_2D,ye),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_WRAP_S,ae.CLAMP_TO_EDGE),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_WRAP_T,ae.CLAMP_TO_EDGE),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_MIN_FILTER,ae.LINEAR),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_MAG_FILTER,ae.LINEAR),fe=ue.heatmapFbo=ee.createFramebuffer(se.width/4,se.height/4,!1,!1),function(oe,Ie,Me,Be){var Qe,ot;const Ct=oe.gl,At=(Qe=oe.HALF_FLOAT)!==null&&Qe!==void 0?Qe:Ct.UNSIGNED_BYTE,at=(ot=oe.RGBA16F)!==null&&ot!==void 0?ot:Ct.RGBA;Ct.texImage2D(Ct.TEXTURE_2D,0,at,Ie.width/4,Ie.height/4,0,Ct.RGBA,At,null),Be.colorAttachment.set(Me)}(ee,se,ye,fe)}})(z,b,L),z.clear({color:f.aN.transparent});for(let ee=0;ee{const oe=f.H();f.aQ(oe,0,ue.width,ue.height,0,0,1);const Ie=ue.context.gl;return{u_matrix:oe,u_world:[Ie.drawingBufferWidth,Ie.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ae.paint.get("heatmap-opacity")}})(z,G),null,G.id,z.viewportBuffer,z.quadTriangleIndexBuffer,z.viewportSegments,G.paint,z.transform.zoom)}(b,L))})(t,l,p,m);break;case"line":(function(b,C,L,R){if(b.renderPass!=="translucent")return;const z=L.paint.get("line-opacity"),G=L.paint.get("line-width");if(z.constantOr(1)===0||G.constantOr(1)===0)return;const q=b.depthModeForSublayer(0,yi.ReadOnly),K=b.colorModeForRenderPass(),ee=L.paint.get("line-dasharray"),se=L.paint.get("line-pattern"),ue=se.constantOr(1),ae=L.paint.get("line-gradient"),fe=L.getCrossfadeParameters(),ye=ue?"linePattern":ee?"lineSDF":ae?"lineGradient":"line",oe=b.context,Ie=oe.gl;let Me=!0;for(const Be of R){const Qe=C.getTile(Be);if(ue&&!Qe.patternsLoaded())continue;const ot=Qe.getBucket(L);if(!ot)continue;const Ct=ot.programConfigurations.get(L.id),At=b.context.program.get(),at=b.useProgram(ye,Ct),ht=Me||at.program!==At,Nt=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Be),ai=se.constantOr(null);if(ai&&Qe.imageAtlas){const ri=Qe.imageAtlas,Ji=ri.patternPositions[ai.to.toString()],gi=ri.patternPositions[ai.from.toString()];Ji&&gi&&Ct.setConstantPatternPositions(Ji,gi)}const gt=Nt?Be:null,wt=ue?nl(b,Qe,L,fe,gt):ee?Go(b,Qe,L,ee,fe,gt):ae?_a(b,Qe,L,ot.lineClipsArray.length,gt):qo(b,Qe,L,gt);if(ue)oe.activeTexture.set(Ie.TEXTURE0),Qe.imageAtlasTexture.bind(Ie.LINEAR,Ie.CLAMP_TO_EDGE),Ct.updatePaintBuffers(fe);else if(ee&&(ht||b.lineAtlas.dirty))oe.activeTexture.set(Ie.TEXTURE0),b.lineAtlas.bind(oe);else if(ae){const ri=ot.gradients[L.id];let Ji=ri.texture;if(L.gradientVersion!==ri.version){let gi=256;if(L.stepInterpolant){const xi=C.getSource().maxzoom,Qi=Be.canonical.z===xi?Math.ceil(1<0?l.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const l=this.imageManager.getPattern(t.from.toString()),p=this.imageManager.getPattern(t.to.toString());return!l||!p}useProgram(t,l){this.cache=this.cache||{};const p=t+(l?l.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new Uo(this.context,hr[t],l,Xo[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[p]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Se(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:l}=this.context.gl;return this.width!==t||this.height!==l}}class Fn{constructor(t,l){this.points=t,this.planes=l}static fromInvProjectionMatrix(t,l,p){const m=Math.pow(2,p),b=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(L=>{const R=1/(L=f.ag([],L,t))[3]/l*m;return f.b1(L,L,[R,R,1/L[3],R])}),C=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(L=>{const R=function(K,ee){var se=ee[0],ue=ee[1],ae=ee[2],fe=se*se+ue*ue+ae*ae;return fe>0&&(fe=1/Math.sqrt(fe)),K[0]=ee[0]*fe,K[1]=ee[1]*fe,K[2]=ee[2]*fe,K}([],function(K,ee,se){var ue=ee[0],ae=ee[1],fe=ee[2],ye=se[0],oe=se[1],Ie=se[2];return K[0]=ae*Ie-fe*oe,K[1]=fe*ye-ue*Ie,K[2]=ue*oe-ae*ye,K}([],Ze([],b[L[0]],b[L[1]]),Ze([],b[L[2]],b[L[1]]))),z=-((G=R)[0]*(q=b[L[1]])[0]+G[1]*q[1]+G[2]*q[2]);var G,q;return R.concat(z)});return new Fn(b,C)}}class v{constructor(t,l){this.min=t,this.max=l,this.center=function(p,m,b){return p[0]=.5*m[0],p[1]=.5*m[1],p[2]=.5*m[2],p}([],function(p,m,b){return p[0]=m[0]+b[0],p[1]=m[1]+b[1],p[2]=m[2]+b[2],p}([],this.min,this.max))}quadrant(t){const l=[t%2==0,t<2],p=ze(this.min),m=ze(this.max);for(let b=0;b=0&&C++;if(C===0)return 0;C!==l.length&&(p=!1)}if(p)return 2;for(let m=0;m<3;m++){let b=Number.MAX_VALUE,C=-Number.MAX_VALUE;for(let L=0;Lthis.max[m]-this.min[m])return 0}return 1}}class r{constructor(t=0,l=0,p=0,m=0){if(isNaN(t)||t<0||isNaN(l)||l<0||isNaN(p)||p<0||isNaN(m)||m<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=l,this.left=p,this.right=m}interpolate(t,l,p){return l.top!=null&&t.top!=null&&(this.top=f.z.number(t.top,l.top,p)),l.bottom!=null&&t.bottom!=null&&(this.bottom=f.z.number(t.bottom,l.bottom,p)),l.left!=null&&t.left!=null&&(this.left=f.z.number(t.left,l.left,p)),l.right!=null&&t.right!=null&&(this.right=f.z.number(t.right,l.right,p)),this}getCenter(t,l){const p=f.ad((this.left+t-this.right)/2,0,t),m=f.ad((this.top+l-this.bottom)/2,0,l);return new f.P(p,m)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new r(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const a=85.051129;class u{constructor(t,l,p,m,b){this.tileSize=512,this._renderWorldCopies=b===void 0||!!b,this._minZoom=t||0,this._maxZoom=l||22,this._minPitch=p??0,this._maxPitch=m??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new f.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new r,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new u(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new f.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const l=-f.b3(t,-180,180)*Math.PI/180;this.angle!==l&&(this._unmodified=!1,this.angle=l,this._calcMatrices(),this.rotationMatrix=function(){var p=new f.A(4);return f.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}(),function(p,m,b){var C=m[0],L=m[1],R=m[2],z=m[3],G=Math.sin(b),q=Math.cos(b);p[0]=C*q+R*G,p[1]=L*q+z*G,p[2]=C*-G+R*q,p[3]=L*-G+z*q}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const l=f.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==l&&(this._unmodified=!1,this._pitch=l,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const l=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==l&&(this._unmodified=!1,this._zoom=l,this.tileZoom=Math.max(0,Math.floor(l)),this.scale=this.zoomScale(l),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,l,p){this._unmodified=!1,this._edgeInsets.interpolate(t,l,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const l=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,l)}getVisibleUnwrappedCoordinates(t){const l=[new f.b4(0,t)];if(this._renderWorldCopies){const p=this.pointCoordinate(new f.P(0,0)),m=this.pointCoordinate(new f.P(this.width,0)),b=this.pointCoordinate(new f.P(this.width,this.height)),C=this.pointCoordinate(new f.P(0,this.height)),L=Math.floor(Math.min(p.x,m.x,b.x,C.x)),R=Math.floor(Math.max(p.x,m.x,b.x,C.x)),z=1;for(let G=L-z;G<=R+z;G++)G!==0&&l.push(new f.b4(G,t))}return l}coveringTiles(t){var l,p;let m=this.coveringZoomLevel(t);const b=m;if(t.minzoom!==void 0&&mt.maxzoom&&(m=t.maxzoom);const C=this.pointCoordinate(this.getCameraPoint()),L=f.Z.fromLngLat(this.center),R=Math.pow(2,m),z=[R*C.x,R*C.y,0],G=[R*L.x,R*L.y,0],q=Fn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,m);let K=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(K=m);const ee=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,se=oe=>({aabb:new v([oe*R,0,0],[(oe+1)*R,R,0]),zoom:0,x:0,y:0,wrap:oe,fullyVisible:!1}),ue=[],ae=[],fe=m,ye=t.reparseOverscaled?b:m;if(this._renderWorldCopies)for(let oe=1;oe<=3;oe++)ue.push(se(-oe)),ue.push(se(oe));for(ue.push(se(0));ue.length>0;){const oe=ue.pop(),Ie=oe.x,Me=oe.y;let Be=oe.fullyVisible;if(!Be){const at=oe.aabb.intersects(q);if(at===0)continue;Be=at===2}const Qe=t.terrain?z:G,ot=oe.aabb.distanceX(Qe),Ct=oe.aabb.distanceY(Qe),At=Math.max(Math.abs(ot),Math.abs(Ct));if(oe.zoom===fe||At>ee+(1<=K){const at=fe-oe.zoom,ht=z[0]-.5-(Ie<>1),ai=oe.zoom+1;let gt=oe.aabb.quadrant(at);if(t.terrain){const wt=new f.S(ai,oe.wrap,ai,ht,Nt),ri=t.terrain.getMinMaxElevation(wt),Ji=(l=ri.minElevation)!==null&&l!==void 0?l:this.elevation,gi=(p=ri.maxElevation)!==null&&p!==void 0?p:this.elevation;gt=new v([gt.min[0],gt.min[1],Ji],[gt.max[0],gt.max[1],gi])}ue.push({aabb:gt,zoom:ai,x:ht,y:Nt,wrap:oe.wrap,fullyVisible:Be})}}return ae.sort((oe,Ie)=>oe.distanceSq-Ie.distanceSq).map(oe=>oe.tileID)}resize(t,l){this.width=t,this.height=l,this.pixelsToGLUnits=[2/t,-2/l],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const l=f.ad(t.lat,-85.051129,a);return new f.P(f.O(t.lng)*this.worldSize,f.Q(l)*this.worldSize)}unproject(t){return new f.Z(t.x/this.worldSize,t.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(t){const l=this.elevation,p=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,m=this.pointLocation(this.centerPoint,t),b=t.getElevationForLngLatZoom(m,this.tileZoom);if(!(this.elevation-b))return;const C=p+l-b,L=Math.cos(this._pitch)*this.cameraToCenterDistance/C/f.b5(1,m.lat),R=this.scaleZoom(L/this.tileSize);this._elevation=b,this._center=m,this.zoom=R}setLocationAtPoint(t,l){const p=this.pointCoordinate(l),m=this.pointCoordinate(this.centerPoint),b=this.locationCoordinate(t),C=new f.Z(b.x-(p.x-m.x),b.y-(p.y-m.y));this.center=this.coordinateLocation(C),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,l){return l?this.coordinatePoint(this.locationCoordinate(t),l.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,l){return this.coordinateLocation(this.pointCoordinate(t,l))}locationCoordinate(t){return f.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,l){if(l){const K=l.pointCoordinate(t);if(K!=null)return K}const p=[t.x,t.y,0,1],m=[t.x,t.y,1,1];f.ag(p,p,this.pixelMatrixInverse),f.ag(m,m,this.pixelMatrixInverse);const b=p[3],C=m[3],L=p[1]/b,R=m[1]/C,z=p[2]/b,G=m[2]/C,q=z===G?0:(0-z)/(G-z);return new f.Z(f.z.number(p[0]/b,m[0]/C,q)/this.worldSize,f.z.number(L,R,q)/this.worldSize)}coordinatePoint(t,l=0,p=this.pixelMatrix){const m=[t.x*this.worldSize,t.y*this.worldSize,l,1];return f.ag(m,m,p),new f.P(m[0]/m[3],m[1]/m[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Ne().extend(this.pointLocation(new f.P(0,t))).extend(this.pointLocation(new f.P(this.width,t))).extend(this.pointLocation(new f.P(this.width,this.height))).extend(this.pointLocation(new f.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Ne([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(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,a])}calculateTileMatrix(t){const l=t.canonical,p=this.worldSize/this.zoomScale(l.z),m=l.x+Math.pow(2,l.z)*t.wrap,b=f.ao(new Float64Array(16));return f.J(b,b,[m*p,l.y*p,0]),f.K(b,b,[p/f.X,p/f.X,1]),b}calculatePosMatrix(t,l=!1){const p=t.key,m=l?this._alignedPosMatrixCache:this._posMatrixCache;if(m[p])return m[p];const b=this.calculateTileMatrix(t);return f.L(b,l?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,b),m[p]=new Float32Array(b),m[p]}calculateFogMatrix(t){const l=t.key,p=this._fogMatrixCache;if(p[l])return p[l];const m=this.calculateTileMatrix(t);return f.L(m,this.fogMatrix,m),p[l]=new Float32Array(m),p[l]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,l){l=f.ad(+l,this.minZoom,this.maxZoom);const p={center:new f.N(t.lng,t.lat),zoom:l};let m=this.lngRange;if(!this._renderWorldCopies&&m===null){const oe=179.9999999999;m=[-oe,oe]}const b=this.tileSize*this.zoomScale(p.zoom);let C=0,L=b,R=0,z=b,G=0,q=0;const{x:K,y:ee}=this.size;if(this.latRange){const oe=this.latRange;C=f.Q(oe[1])*b,L=f.Q(oe[0])*b,L-CL&&(fe=L-oe)}if(m){const oe=(R+z)/2;let Ie=se;this._renderWorldCopies&&(Ie=f.b3(se,oe-b/2,oe+b/2));const Me=K/2;Ie-Mez&&(ae=z-Me)}if(ae!==void 0||fe!==void 0){const oe=new f.P(ae??se,fe??ue);p.center=this.unproject.call({worldSize:b},oe).wrap()}return p}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:l,zoom:p}=this.getConstrained(this.center,this.zoom);this.center=l,this.zoom=p,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,l=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=f.b5(1,this.center.lat)*this.worldSize;let m=f.ao(new Float64Array(16));f.K(m,m,[this.width/2,-this.height/2,1]),f.J(m,m,[1,-1,0]),this.labelPlaneMatrix=m,m=f.ao(new Float64Array(16)),f.K(m,m,[1,-1,1]),f.J(m,m,[-1,-1,0]),f.K(m,m,[2/this.width,2/this.height,1]),this.glCoordMatrix=m;const b=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),C=Math.min(this.elevation,this.minElevationForCurrentTile),L=b-C*this._pixelPerMeter/Math.cos(this._pitch),R=C<0?L:b,z=Math.PI/2+this._pitch,G=this._fov*(.5+t.y/this.height),q=Math.sin(G)*R/Math.sin(f.ad(Math.PI-z-G,.01,Math.PI-.01)),K=this.getHorizon(),ee=2*Math.atan(K/this.cameraToCenterDistance)*(.5+t.y/(2*K)),se=Math.sin(ee)*R/Math.sin(f.ad(Math.PI-z-ee,.01,Math.PI-.01)),ue=Math.min(q,se);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ue+R),this.nearZ=this.height/50,m=new Float64Array(16),f.b6(m,this._fov,this.width/this.height,this.nearZ,this.farZ),m[8]=2*-t.x/this.width,m[9]=2*t.y/this.height,this.projectionMatrix=f.af(m),f.K(m,m,[1,-1,1]),f.J(m,m,[0,0,-this.cameraToCenterDistance]),f.b7(m,m,this._pitch),f.ae(m,m,this.angle),f.J(m,m,[-l,-p,0]),this.mercatorMatrix=f.K([],m,[this.worldSize,this.worldSize,this.worldSize]),f.K(m,m,[1,1,this._pixelPerMeter]),this.pixelMatrix=f.L(new Float64Array(16),this.labelPlaneMatrix,m),f.J(m,m,[0,0,-this.elevation]),this.modelViewProjectionMatrix=m,this.invModelViewProjectionMatrix=f.at([],m),this.fogMatrix=new Float64Array(16),f.b6(this.fogMatrix,this._fov,this.width/this.height,b,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,f.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),f.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),f.b7(this.fogMatrix,this.fogMatrix,this._pitch),f.ae(this.fogMatrix,this.fogMatrix,this.angle),f.J(this.fogMatrix,this.fogMatrix,[-l,-p,0]),f.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),f.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=f.L(new Float64Array(16),this.labelPlaneMatrix,m);const ae=this.width%2/2,fe=this.height%2/2,ye=Math.cos(this.angle),oe=Math.sin(this.angle),Ie=l-Math.round(l)+ye*ae+oe*fe,Me=p-Math.round(p)+ye*fe+oe*ae,Be=new Float64Array(m);if(f.J(Be,Be,[Ie>.5?Ie-1:Ie,Me>.5?Me-1:Me,0]),this.alignedModelViewProjectionMatrix=Be,m=f.at(new Float64Array(16),this.pixelMatrix),!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new f.P(0,0)),l=[t.x*this.worldSize,t.y*this.worldSize,0,1];return f.ag(l,l,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new f.P(0,t))}getCameraQueryGeometry(t){const l=this.getCameraPoint();if(t.length===1)return[t[0],l];{let p=l.x,m=l.y,b=l.x,C=l.y;for(const L of t)p=Math.min(p,L.x),m=Math.min(m,L.y),b=Math.max(b,L.x),C=Math.max(C,L.y);return[new f.P(p,m),new f.P(b,m),new f.P(b,C),new f.P(p,C),new f.P(p,m)]}}lngLatToCameraDepth(t,l){const p=this.locationCoordinate(t),m=[p.x*this.worldSize,p.y*this.worldSize,l,1];return f.ag(m,m,this.modelViewProjectionMatrix),m[2]/m[3]}}function y(x,t){let l,p=!1,m=null,b=null;const C=()=>{m=null,p&&(x.apply(b,l),m=setTimeout(C,t),p=!1)};return(...L)=>(p=!0,b=this,l=L,m||C(),m)}class E{constructor(t){this._getCurrentHash=()=>{const l=window.location.hash.replace("#","");if(this._hashName){let p;return l.split("&").map(m=>m.split("=")).forEach(m=>{m[0]===this._hashName&&(p=m)}),(p&&p[1]||"").split("/")}return l.split("/")},this._onHashChange=()=>{const l=this._getCurrentHash();if(l.length>=3&&!l.some(p=>isNaN(p))){const p=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(l[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+l[2],+l[1]],zoom:+l[0],bearing:p,pitch:+(l[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const l=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,l)},this._removeHash=()=>{const l=this._getCurrentHash();if(l.length===0)return;const p=l.join("/");let m=p;m.split("&").length>0&&(m=m.split("&")[0]),this._hashName&&(m=`${this._hashName}=${p}`);let b=window.location.hash.replace(m,"");b.startsWith("#&")?b=b.slice(0,1)+b.slice(2):b==="#"&&(b="");let C=window.location.href.replace(/(#.+)?$/,b);C=C.replace("&&","&"),window.history.replaceState(window.history.state,null,C)},this._updateHash=y(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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()),this._removeHash(),delete this._map,this}getHashString(t){const l=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,m=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,m),C=Math.round(l.lng*b)/b,L=Math.round(l.lat*b)/b,R=this._map.getBearing(),z=this._map.getPitch();let G="";if(G+=t?`/${C}/${L}/${p}`:`${p}/${L}/${C}`,(R||z)&&(G+="/"+Math.round(10*R)/10),z&&(G+=`/${Math.round(z)}`),this._hashName){const q=this._hashName;let K=!1;const ee=window.location.hash.slice(1).split("&").map(se=>{const ue=se.split("=")[0];return ue===q?(K=!0,`${ue}=${G}`):se}).filter(se=>se);return K||ee.push(`${q}=${G}`),`#${ee.join("&")}`}return`#${G}`}}const M={linearity:.3,easing:f.b8(0,0,.3,1)},B=f.e({deceleration:2500,maxSpeed:1400},M),W=f.e({deceleration:20,maxSpeed:1400},M),ie=f.e({deceleration:1e3,maxSpeed:360},M),me=f.e({deceleration:1e3,maxSpeed:90},M);class Ee{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:N.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,l=N.now();for(;t.length>0&&l-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const l={zoom:0,bearing:0,pitch:0,pan:new f.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)l.zoom+=b.zoomDelta||0,l.bearing+=b.bearingDelta||0,l.pitch+=b.pitchDelta||0,b.panDelta&&l.pan._add(b.panDelta),b.around&&(l.around=b.around),b.pinchAround&&(l.pinchAround=b.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,m={};if(l.pan.mag()){const b=ct(l.pan.mag(),p,f.e({},B,t||{}));m.offset=l.pan.mult(b.amount/l.pan.mag()),m.center=this._map.transform.center,He(m,b)}if(l.zoom){const b=ct(l.zoom,p,W);m.zoom=this._map.transform.zoom+b.amount,He(m,b)}if(l.bearing){const b=ct(l.bearing,p,ie);m.bearing=this._map.transform.bearing+f.ad(b.amount,-179,179),He(m,b)}if(l.pitch){const b=ct(l.pitch,p,me);m.pitch=this._map.transform.pitch+b.amount,He(m,b)}if(m.zoom||m.bearing){const b=l.pinchAround===void 0?l.around:l.pinchAround;m.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),f.e(m,{noMoveStart:!0})}}function He(x,t){(!x.duration||x.durationl.unproject(R)),L=b.reduce((R,z,G,q)=>R.add(z.div(q.length)),new f.P(0,0));super(t,{points:b,point:L,lngLats:C,lngLat:l.unproject(L),originalEvent:p}),this._defaultPrevented=!1}}class ni extends f.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,l,p){super(t,{originalEvent:p}),this._defaultPrevented=!1}}class ci{constructor(t,l){this._map=t,this._clickTolerance=l.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ni(t.type,this._map,t))}mousedown(t,l){return this._mousedownPos=l,this._firePreventable(new tt(t.type,this._map,t))}mouseup(t){this._map.fire(new tt(t.type,this._map,t))}click(t,l){this._mousedownPos&&this._mousedownPos.dist(l)>=this._clickTolerance||this._map.fire(new tt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new tt(t.type,this._map,t))}mouseover(t){this._map.fire(new tt(t.type,this._map,t))}mouseout(t){this._map.fire(new tt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Kt(t.type,this._map,t))}touchmove(t){this._map.fire(new Kt(t.type,this._map,t))}touchend(t){this._map.fire(new Kt(t.type,this._map,t))}touchcancel(t){this._map.fire(new Kt(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ci{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new tt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new tt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ri{constructor(t){this._map=t}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(t){return this.transform.pointLocation(f.P.convert(t),this._map.terrain)}}class wn{constructor(t,l){this._map=t,this._tr=new Ri(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=l.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,l){this.isEnabled()&&t.shiftKey&&t.button===0&&(V.disableDrag(),this._startPos=this._lastPos=l,this._active=!0)}mousemoveWindow(t,l){if(!this._active)return;const p=l;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)b.fitScreenCoordinates(p,m,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(V.remove(this._box),this._box=null),V.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,l){return this._map.fire(new f.k(t,{originalEvent:l}))}}function kn(x,t){if(x.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${x.length}, points ${t.length}`);const l={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),p.length===this.numTouches&&(this.centroid=function(m){const b=new f.P(0,0);for(const C of m)b._add(C);return b.div(m.length)}(l),this.touches=kn(p,l)))}touchmove(t,l,p){if(this.aborted||!this.centroid)return;const m=kn(p,l);for(const b in this.touches){const C=m[b];(!C||C.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(t,l,p){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const m=!this.aborted&&this.centroid;if(this.reset(),m)return m}}}class Nr{constructor(t){this.singleTap=new gr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,l,p){this.singleTap.touchstart(t,l,p)}touchmove(t,l,p){this.singleTap.touchmove(t,l,p)}touchend(t,l,p){const m=this.singleTap.touchend(t,l,p);if(m){const b=t.timeStamp-this.lastTime<500,C=!this.lastTap||this.lastTap.dist(m)<30;if(b&&C||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=m,this.count===this.numTaps)return this.reset(),m}}}class Is{constructor(t){this._tr=new Ri(t),this._zoomIn=new Nr({numTouches:1,numTaps:2}),this._zoomOut=new Nr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,l,p){this._zoomIn.touchstart(t,l,p),this._zoomOut.touchstart(t,l,p)}touchmove(t,l,p){this._zoomIn.touchmove(t,l,p),this._zoomOut.touchmove(t,l,p)}touchend(t,l,p){const m=this._zoomIn.touchend(t,l,p),b=this._zoomOut.touchend(t,l,p),C=this._tr;return m?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom+1,around:C.unproject(m)},{originalEvent:t})}):b?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:L=>L.easeTo({duration:300,zoom:C.zoom-1,around:C.unproject(b)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Li{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const l=this._moveFunction(...t);if(l.bearingDelta||l.pitchDelta||l.around||l.panDelta)return this._active=!0,l}dragStart(t,l){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=l.length?l[0]:l,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,l){if(!this.isEnabled())return;const p=this._lastPoint;if(!p)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const m=l.length?l[0]:l;return!this._moved&&m.dist(p){x.mousedown=x.dragStart,x.mousemoveWindow=x.dragMove,x.mouseup=x.dragEnd,x.contextmenu=t=>{t.preventDefault()}},na=({enable:x,clickTolerance:t,bearingDegreesPerPixelMoved:l=.8})=>{const p=new yn({checkCorrectEvent:m=>V.mouseButton(m)===0&&m.ctrlKey||V.mouseButton(m)===2});return new Li({clickTolerance:t,move:(m,b)=>({bearingDelta:(b.x-m.x)*l}),moveStateManager:p,enable:x,assignEvents:po})},Qr=({enable:x,clickTolerance:t,pitchDegreesPerPixelMoved:l=-.5})=>{const p=new yn({checkCorrectEvent:m=>V.mouseButton(m)===0&&m.ctrlKey||V.mouseButton(m)===2});return new Li({clickTolerance:t,move:(m,b)=>({pitchDelta:(b.y-m.y)*l}),moveStateManager:p,enable:x,assignEvents:po})};class xl{constructor(t,l){this._clickTolerance=t.clickTolerance||1,this._map=l,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new f.P(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(t,l,p){return this._calculateTransform(t,l,p)}touchmove(t,l,p){if(this._active&&!(p.length0&&(this._active=!0);const m=kn(p,l),b=new f.P(0,0),C=new f.P(0,0);let L=0;for(const z in m){const G=m[z],q=this._touches[z];q&&(b._add(G),C._add(G.sub(q)),L++,m[z]=G)}if(this._touches=m,LMath.abs(x.x)}class Yu extends bl{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,l,p){super.touchstart(t,l,p),this._currentTouchCount=p.length}_start(t){this._lastPoints=t,qs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,l,p){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const m=t[0].sub(this._lastPoints[0]),b=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(m,b,p.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(m.y+b.y)/2*-.5}):void 0}gestureBeginsVertically(t,l,p){if(this._valid!==void 0)return this._valid;const m=t.mag()>=2,b=l.mag()>=2;if(!m&&!b)return;if(!m||!b)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const C=t.y>0==l.y>0;return qs(t)&&qs(l)&&C}}const sh={panStep:100,bearingStep:15,pitchStep:10};class Ku{constructor(t){this._tr=new Ri(t);const l=sh;this._panStep=l.panStep,this._bearingStep=l.bearingStep,this._pitchStep=l.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let l=0,p=0,m=0,b=0,C=0;switch(t.keyCode){case 61:case 107:case 171:case 187:l=1;break;case 189:case 109:case 173:l=-1;break;case 37:t.shiftKey?p=-1:(t.preventDefault(),b=-1);break;case 39:t.shiftKey?p=1:(t.preventDefault(),b=1);break;case 38:t.shiftKey?m=1:(t.preventDefault(),C=-1);break;case 40:t.shiftKey?m=-1:(t.preventDefault(),C=1);break;default:return}return this._rotationDisabled&&(p=0,m=0),{cameraAnimation:L=>{const R=this._tr;L.easeTo({duration:300,easeId:"keyboardHandler",easing:oh,zoom:l?Math.round(R.zoom)+l*(t.shiftKey?2:1):R.zoom,bearing:R.bearing+p*this._bearingStep,pitch:R.pitch+m*this._pitchStep,offset:[-b*this._panStep,-C*this._panStep],center:R.center},{originalEvent:t})}}}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 oh(x){return x*(2-x)}const Ju=4.000244140625;class Qu{constructor(t,l){this._onTimeout=p=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(p)},this._map=t,this._tr=new Ri(t),this._triggerRenderFrame=l,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled()||this._map.cooperativeGestures.shouldPreventWheelEvent(t))return;let l=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const p=N.now(),m=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,l!==0&&l%Ju==0?this._type="wheel":l!==0&&Math.abs(l)<4?this._type="trackpad":m>400?(this._type=null,this._lastValue=l,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(m*l)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,l+=this._lastValue)),t.shiftKey&&l&&(l/=4),this._type&&(this._lastWheelEvent=t,this._delta-=l,this._active||this._start(t)),t.preventDefault()}_start(t){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 l=V.mousePos(this._map.getCanvas(),t),p=this._tr;this._around=l.y>p.transform.height/2-p.transform.getHorizon()?f.N.convert(this._aroundCenter?p.center:p.unproject(l)):f.N.convert(p.center),this._aroundPoint=p.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const R=this._type==="wheel"&&Math.abs(this._delta)>Ju?this._wheelZoomRate:this._defaultZoomRate;let z=2/(1+Math.exp(-Math.abs(this._delta*R)));this._delta<0&&z!==0&&(z=1/z);const G=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(G*z))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const l=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,p=this._startZoom,m=this._easing;let b,C=!1;const L=N.now()-this._lastWheelEventTime;if(this._type==="wheel"&&p&&m&&L){const R=Math.min(L/200,1),z=m(R);b=f.z.number(p,l,z),R<1?this._frameId||(this._frameId=!0):C=!0}else b=l,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:b-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let l=f.b9;if(this._prevEase){const p=this._prevEase,m=(N.now()-p.start)/p.duration,b=p.easing(m+.01)-p.easing(m),C=.27/Math.sqrt(b*b+1e-4)*.01,L=Math.sqrt(.0729-C*C);l=f.b8(C,L,.25,1)}return this._prevEase={start:N.now(),duration:t,easing:l},l}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class $u{constructor(t,l){this._clickZoom=t,this._tapZoom=l}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 kl{constructor(t){this._tr=new Ri(t),this.reset()}reset(){this._active=!1}dblclick(t,l){return t.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(l)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ah{constructor(){this._tap=new Nr({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(t,l,p){if(!this._swipePoint)if(this._tapTime){const m=l[0],b=t.timeStamp-this._tapTime<500,C=this._tapPoint.dist(m)<30;b&&C?p.length>0&&(this._swipePoint=m,this._swipeTouch=p[0].identifier):this.reset()}else this._tap.touchstart(t,l,p)}touchmove(t,l,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const m=l[0],b=m.y-this._swipePoint.y;return this._swipePoint=m,t.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(t,l,p)}touchend(t,l,p){if(this._tapTime)this._swipePoint&&p.length===0&&this.reset();else{const m=this._tap.touchend(t,l,p);m&&(this._tapTime=t.timeStamp,this._tapPoint=m)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wr{constructor(t,l,p){this._el=t,this._mousePan=l,this._touchPan=p}enable(t){this._inertiaOptions=t||{},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 $r{constructor(t,l,p){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=l,this._mousePitch=p}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 ec{constructor(t,l,p,m){this._el=t,this._touchZoom=l,this._touchRotate=p,this._tapDragZoom=m,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),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 es{constructor(t,l){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=l,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=V.create("div","maplibregl-cooperative-gesture-screen",t);let l=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(l=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const p=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),m=document.createElement("div");m.className="maplibregl-desktop-message",m.textContent=l,this._container.appendChild(m);const b=document.createElement("div");b.className="maplibregl-mobile-message",b.textContent=p,this._container.appendChild(b),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(V.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(t){this._onCooperativeGesture(t.touches.length===1)}wheel(t){if(!this._map.scrollZoom.isEnabled())return;const l=this.shouldPreventWheelEvent(t);this._onCooperativeGesture(l)}shouldPreventWheelEvent(t){return!!this.isEnabled()&&!(t[this._bypassKey]||t.ctrlKey)}_onCooperativeGesture(t){this._enabled&&t&&(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Gs=x=>x.zoom||x.drag||x.pitch||x.rotate;class jf extends f.k{}function tc(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class Uf{constructor(t,l){this.handleWindowEvent=m=>{this.handleEvent(m,`${m.type}Window`)},this.handleEvent=(m,b)=>{if(m.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const C=m.type==="renderFrame"?void 0:m,L={needsRenderFrame:!1},R={},z={},G=m.touches,q=G?this._getMapTouches(G):void 0,K=q?V.touchPos(this._map.getCanvas(),q):V.mousePos(this._map.getCanvas(),m);for(const{handlerName:ue,handler:ae,allowed:fe}of this._handlers){if(!ae.isEnabled())continue;let ye;this._blockedByActive(z,fe,ue)?ae.reset():ae[b||m.type]&&(ye=ae[b||m.type](m,K,q),this.mergeHandlerResult(L,R,ye,ue,C),ye&&ye.needsRenderFrame&&this._triggerRenderFrame()),(ye||ae.isActive())&&(z[ue]=ae)}const ee={};for(const ue in this._previousActiveHandlers)z[ue]||(ee[ue]=C);this._previousActiveHandlers=z,(Object.keys(ee).length||tc(L))&&(this._changes.push([L,R,ee]),this._triggerRenderFrame()),(Object.keys(z).length||tc(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=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ee(t),this._bearingSnap=l.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(l);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[m,b,C]of this._listeners)V.addEventListener(m,b,m===document?this.handleWindowEvent:this.handleEvent,C)}destroy(){for(const[t,l,p]of this._listeners)V.removeEventListener(t,l,t===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(t){const l=this._map,p=l.getCanvasContainer();this._add("mapEvent",new ci(l,t));const m=l.boxZoom=new wn(l,t);this._add("boxZoom",m),t.interactive&&t.boxZoom&&m.enable();const b=l.cooperativeGestures=new es(l,t.cooperativeGestures);this._add("cooperativeGestures",b),t.cooperativeGestures&&b.enable();const C=new Is(l),L=new kl(l);l.doubleClickZoom=new $u(L,C),this._add("tapZoom",C),this._add("clickZoom",L),t.interactive&&t.doubleClickZoom&&l.doubleClickZoom.enable();const R=new ah;this._add("tapDragZoom",R);const z=l.touchPitch=new Yu(l);this._add("touchPitch",z),t.interactive&&t.touchPitch&&l.touchPitch.enable(t.touchPitch);const G=na(t),q=Qr(t);l.dragRotate=new $r(t,G,q),this._add("mouseRotate",G,["mousePitch"]),this._add("mousePitch",q,["mouseRotate"]),t.interactive&&t.dragRotate&&l.dragRotate.enable();const K=(({enable:ye,clickTolerance:oe})=>{const Ie=new yn({checkCorrectEvent:Me=>V.mouseButton(Me)===0&&!Me.ctrlKey});return new Li({clickTolerance:oe,move:(Me,Be)=>({around:Be,panDelta:Be.sub(Me)}),activateOnStart:!0,moveStateManager:Ie,enable:ye,assignEvents:po})})(t),ee=new xl(t,l);l.dragPan=new Wr(p,K,ee),this._add("mousePan",K),this._add("touchPan",ee,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&l.dragPan.enable(t.dragPan);const se=new Hu,ue=new Wu;l.touchZoomRotate=new ec(p,ue,se,R),this._add("touchRotate",se,["touchPan","touchZoom"]),this._add("touchZoom",ue,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&l.touchZoomRotate.enable(t.touchZoomRotate);const ae=l.scrollZoom=new Qu(l,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),t.interactive&&t.scrollZoom&&l.scrollZoom.enable(t.scrollZoom);const fe=l.keyboard=new Ku(l);this._add("keyboard",fe),t.interactive&&t.keyboard&&l.keyboard.enable(),this._add("blockableMapEvent",new Ci(l))}_add(t,l,p){this._handlers.push({handlerName:t,handler:l,allowed:p}),this._handlersById[t]=l}stop(t){if(!this._updatingCamera){for(const{handler:l}of this._handlers)l.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Gs(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,l,p){for(const m in t)if(m!==p&&(!l||l.indexOf(m)<0))return!0;return!1}_getMapTouches(t){const l=[];for(const p of t)this._el.contains(p.target)&&l.push(p);return l}mergeHandlerResult(t,l,p,m,b){if(!p)return;f.e(t,p);const C={handlerName:m,originalEvent:p.originalEvent||b};p.zoomDelta!==void 0&&(l.zoom=C),p.panDelta!==void 0&&(l.drag=C),p.pitchDelta!==void 0&&(l.pitch=C),p.bearingDelta!==void 0&&(l.rotate=C)}_applyChanges(){const t={},l={},p={};for(const[m,b,C]of this._changes)m.panDelta&&(t.panDelta=(t.panDelta||new f.P(0,0))._add(m.panDelta)),m.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+m.zoomDelta),m.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+m.bearingDelta),m.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+m.pitchDelta),m.around!==void 0&&(t.around=m.around),m.pinchAround!==void 0&&(t.pinchAround=m.pinchAround),m.noInertia&&(t.noInertia=m.noInertia),f.e(l,b),f.e(p,C);this._updateMapTransform(t,l,p),this._changes=[]}_updateMapTransform(t,l,p){const m=this._map,b=m._getTransformForUpdate(),C=m.terrain;if(!(tc(t)||C&&this._terrainMovement))return this._fireEvents(l,p,!0);let{panDelta:L,zoomDelta:R,bearingDelta:z,pitchDelta:G,around:q,pinchAround:K}=t;K!==void 0&&(q=K),m._stop(!0),q=q||m.transform.centerPoint;const ee=b.pointLocation(L?q.sub(L):q);z&&(b.bearing+=z),G&&(b.pitch+=G),R&&(b.zoom+=R),C?this._terrainMovement||!l.drag&&!l.zoom?l.drag&&this._terrainMovement?b.center=b.pointLocation(b.centerPoint.sub(L)):b.setLocationAtPoint(ee,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,b.setLocationAtPoint(ee,q)):b.setLocationAtPoint(ee,q),m._applyUpdatedTransform(b),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(l,p,!0)}_fireEvents(t,l,p){const m=Gs(this._eventsInProgress),b=Gs(t),C={};for(const q in t){const{originalEvent:K}=t[q];this._eventsInProgress[q]||(C[`${q}start`]=K),this._eventsInProgress[q]=t[q]}!m&&b&&this._fireEvent("movestart",b.originalEvent);for(const q in C)this._fireEvent(q,C[q]);b&&this._fireEvent("move",b.originalEvent);for(const q in t){const{originalEvent:K}=t[q];this._fireEvent(q,K)}const L={};let R;for(const q in this._eventsInProgress){const{handlerName:K,originalEvent:ee}=this._eventsInProgress[q];this._handlersById[K].isActive()||(delete this._eventsInProgress[q],R=l[K]||ee,L[`${q}end`]=R)}for(const q in L)this._fireEvent(q,L[q]);const z=Gs(this._eventsInProgress),G=(m||b)&&!z;if(G&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const q=this._map._getTransformForUpdate();q.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(q)}if(p&&G){this._updatingCamera=!0;const q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),K=ee=>ee!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new jf("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Vf extends f.E{constructor(t,l){super(),this._renderFrameCallback=()=>{const p=Math.min((N.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=l.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new f.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,l){return this.jumpTo({center:t},l)}panBy(t,l,p){return t=f.P.convert(t).mult(-1),this.panTo(this.transform.center,f.e({offset:t},l),p)}panTo(t,l,p){return this.easeTo(f.e({center:t},l),p)}getZoom(){return this.transform.zoom}setZoom(t,l){return this.jumpTo({zoom:t},l),this}zoomTo(t,l,p){return this.easeTo(f.e({zoom:t},l),p)}zoomIn(t,l){return this.zoomTo(this.getZoom()+1,t,l),this}zoomOut(t,l){return this.zoomTo(this.getZoom()-1,t,l),this}getBearing(){return this.transform.bearing}setBearing(t,l){return this.jumpTo({bearing:t},l),this}getPadding(){return this.transform.padding}setPadding(t,l){return this.jumpTo({padding:t},l),this}rotateTo(t,l,p){return this.easeTo(f.e({bearing:t},l),p)}resetNorth(t,l){return this.rotateTo(0,f.e({duration:1e3},t),l),this}resetNorthPitch(t,l){return this.easeTo(f.e({bearing:0,pitch:0,duration:1e3},t),l),this}snapToNorth(t,l){return Math.abs(this.getBearing()){if(this._zooming&&(m.zoom=f.z.number(b,ae,Qe)),this._rotating&&(m.bearing=f.z.number(C,z,Qe)),this._pitching&&(m.pitch=f.z.number(L,G,Qe)),this._padding&&(m.interpolatePadding(R,q,Qe),ee=m.centerPoint.add(K)),this.terrain&&!t.freezeElevation&&this._updateElevation(Qe),Ie)m.setLocationAtPoint(Ie,Me);else{const ot=m.zoomScale(m.zoom-b),Ct=ae>b?Math.min(2,oe):Math.max(.5,oe),At=Math.pow(Ct,1-Qe),at=m.unproject(fe.add(ye.mult(Qe*At)).mult(ot));m.setLocationAtPoint(m.renderWorldCopies?at.wrap():at,ee)}this._applyUpdatedTransform(m),this._fireMoveEvents(l)},Qe=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(l,Qe)},t),this}_prepareEase(t,l,p={}){this._moving=!0,l||p.moving||this.fire(new f.k("movestart",t)),this._zooming&&!p.zooming&&this.fire(new f.k("zoomstart",t)),this._rotating&&!p.rotating&&this.fire(new f.k("rotatestart",t)),this._pitching&&!p.pitching&&this.fire(new f.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const l=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&l!==this._elevationTarget){const p=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(p-(l-(p*t+this._elevationStart))/(1-t)),this._elevationTarget=l}this.transform.elevation=f.z.number(this._elevationStart,this._elevationTarget,t)}_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(t){if(!this.transformCameraUpdate)return;const l=t.clone(),{center:p,zoom:m,pitch:b,bearing:C,elevation:L}=this.transformCameraUpdate(l);p&&(l.center=p),m!==void 0&&(l.zoom=m),b!==void 0&&(l.pitch=b),C!==void 0&&(l.bearing=C),L!==void 0&&(l.elevation=L),this.transform.apply(l)}_fireMoveEvents(t){this.fire(new f.k("move",t)),this._zooming&&this.fire(new f.k("zoom",t)),this._rotating&&this.fire(new f.k("rotate",t)),this._pitching&&this.fire(new f.k("pitch",t))}_afterEase(t,l){if(this._easeId&&l&&this._easeId===l)return;delete this._easeId;const p=this._zooming,m=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new f.k("zoomend",t)),m&&this.fire(new f.k("rotateend",t)),b&&this.fire(new f.k("pitchend",t)),this.fire(new f.k("moveend",t))}flyTo(t,l){var p;if(!t.essential&&N.prefersReducedMotion){const wt=f.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(wt,l)}this.stop(),t=f.e({offset:[0,0],speed:1.2,curve:1.42,easing:f.b9},t);const m=this._getTransformForUpdate(),b=this.getZoom(),C=this.getBearing(),L=this.getPitch(),R=this.getPadding(),z="bearing"in t?this._normalizeBearing(t.bearing,C):C,G="pitch"in t?+t.pitch:L,q="padding"in t?t.padding:m.padding,K=f.P.convert(t.offset);let ee=m.centerPoint.add(K);const se=m.pointLocation(ee),{center:ue,zoom:ae}=m.getConstrained(f.N.convert(t.center||se),(p=t.zoom)!==null&&p!==void 0?p:b);this._normalizeCenter(ue);const fe=m.zoomScale(ae-b),ye=m.project(se),oe=m.project(ue).sub(ye);let Ie=t.curve;const Me=Math.max(m.width,m.height),Be=Me/fe,Qe=oe.mag();if("minZoom"in t){const wt=f.ad(Math.min(t.minZoom,b,ae),m.minZoom,m.maxZoom),ri=Me/m.zoomScale(wt-b);Ie=Math.sqrt(ri/Qe*2)}const ot=Ie*Ie;function Ct(wt){const ri=(Be*Be-Me*Me+(wt?-1:1)*ot*ot*Qe*Qe)/(2*(wt?Be:Me)*ot*Qe);return Math.log(Math.sqrt(ri*ri+1)-ri)}function At(wt){return(Math.exp(wt)-Math.exp(-wt))/2}function at(wt){return(Math.exp(wt)+Math.exp(-wt))/2}const ht=Ct(!1);let Nt=function(wt){return at(ht)/at(ht+Ie*wt)},ai=function(wt){return Me*((at(ht)*(At(ri=ht+Ie*wt)/at(ri))-At(ht))/ot)/Qe;var ri},gt=(Ct(!0)-ht)/Ie;if(Math.abs(Qe)<1e-6||!isFinite(gt)){if(Math.abs(Me-Be)<1e-6)return this.easeTo(t,l);const wt=Be0,Nt=ri=>Math.exp(wt*Ie*ri)}return t.duration="duration"in t?+t.duration:1e3*gt/("screenSpeed"in t?+t.screenSpeed/Ie:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=C!==z,this._pitching=G!==L,this._padding=!m.isPaddingEqual(q),this._prepareEase(l,!1),this.terrain&&this._prepareElevation(ue),this._ease(wt=>{const ri=wt*gt,Ji=1/Nt(ri);m.zoom=wt===1?ae:b+m.scaleZoom(Ji),this._rotating&&(m.bearing=f.z.number(C,z,wt)),this._pitching&&(m.pitch=f.z.number(L,G,wt)),this._padding&&(m.interpolatePadding(R,q,wt),ee=m.centerPoint.add(K)),this.terrain&&!t.freezeElevation&&this._updateElevation(wt);const gi=wt===1?ue:m.unproject(ye.add(oe.mult(ai(ri))).mult(Ji));m.setLocationAtPoint(m.renderWorldCopies?gi.wrap():gi,ee),this._applyUpdatedTransform(m),this._fireMoveEvents(l)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(l)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,l){var p;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,l)}return t||(p=this.handlers)===null||p===void 0||p.stop(!1),this}_ease(t,l,p){p.animate===!1||p.duration===0?(t(1),l()):(this._easeStart=N.now(),this._easeOptions=p,this._onEaseFrame=t,this._onEaseEnd=l,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,l){t=f.b3(t,-180,180);const p=Math.abs(t-l);return Math.abs(t-360-l)180?-360:p<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(f.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const ic={compact:!0,customAttribution:'MapLibre'};class La{constructor(t=ic){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=l=>{!l||l.sourceDataType!=="metadata"&&l.sourceDataType!=="visibility"&&l.dataType!=="style"&&l.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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=V.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=V.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=V.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(){V.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(t,l){const p=this._map._getUIString(`AttributionControl.${l}`);t.title=p,t.setAttribute("aria-label",p)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(m=>typeof m!="string"?"":m)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const m=this._map.style.stylesheet;this.styleOwner=m.owner,this.styleId=m.id}const l=this._map.style.sourceCaches;for(const m in l){const b=l[m];if(b.used||b.usedForTerrain){const C=b.getSource();C.attribution&&t.indexOf(C.attribution)<0&&t.push(C.attribution)}}t=t.filter(m=>String(m).trim()),t.sort((m,b)=>m.length-b.length),t=t.filter((m,b)=>{for(let C=b+1;C=0)return!1;return!0});const p=t.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,t.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Es{constructor(t={}){this._updateCompact=()=>{const l=this._container.children;if(l.length){const p=l[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&p.classList.add("maplibregl-compact"):p.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=V.create("div","maplibregl-ctrl");const l=V.create("a","maplibregl-ctrl-logo");return l.target="_blank",l.rel="noopener nofollow",l.href="https://maplibre.org/",l.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),l.setAttribute("rel","noopener nofollow"),this._container.appendChild(l),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){V.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Rt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const l=++this._id;return this._queue.push({callback:t,id:l,cancelled:!1}),l}remove(t){const l=this._currentlyRunning,p=l?this._queue.concat(l):this._queue;for(const m of p)if(m.id===t)return void(m.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const l=this._currentlyRunning=this._queue;this._queue=[];for(const p of l)if(!p.cancelled&&(p.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var lh=f.Y([{name:"a_pos3d",type:"Int16",components:3}]);class nc extends f.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,l){this.sourceCache.update(t,l),this._renderableTilesKeys=[];const p={};for(const m of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:l}))p[m.key]=!0,this._renderableTilesKeys.push(m.key),this._tiles[m.key]||(m.posMatrix=new Float64Array(16),f.aQ(m.posMatrix,0,f.X,0,f.X,0,1),this._tiles[m.key]=new gs(m,this.tileSize));for(const m in this._tiles)p[m]||delete this._tiles[m]}freeRtt(t){for(const l in this._tiles){const p=this._tiles[l];(!t||p.tileID.equals(t)||p.tileID.isChildOf(t)||t.isChildOf(p.tileID))&&(p.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const l={};for(const p of this._renderableTilesKeys){const m=this._tiles[p].tileID;if(m.canonical.equals(t.canonical)){const b=t.clone();b.posMatrix=new Float64Array(16),f.aQ(b.posMatrix,0,f.X,0,f.X,0,1),l[p]=b}else if(m.canonical.isChildOf(t.canonical)){const b=t.clone();b.posMatrix=new Float64Array(16);const C=m.canonical.z-t.canonical.z,L=m.canonical.x-(m.canonical.x>>C<>C<>C;f.aQ(b.posMatrix,0,z,0,z,0,1),f.J(b.posMatrix,b.posMatrix,[-L*z,-R*z,0]),l[p]=b}else if(t.canonical.isChildOf(m.canonical)){const b=t.clone();b.posMatrix=new Float64Array(16);const C=t.canonical.z-m.canonical.z,L=t.canonical.x-(t.canonical.x>>C<>C<>C;f.aQ(b.posMatrix,0,f.X,0,f.X,0,1),f.J(b.posMatrix,b.posMatrix,[L*z,R*z,0]),f.K(b.posMatrix,b.posMatrix,[1/2**C,1/2**C,0]),l[p]=b}}return l}getSourceTile(t,l){const p=this.sourceCache._source;let m=t.overscaledZ-this.deltaZoom;if(m>p.maxzoom&&(m=p.maxzoom),m=p.minzoom&&(!b||!b.dem);)b=this.sourceCache.getTileByID(t.scaledTo(m--).key);return b}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(l=>l.timeAdded>=t)}}class uh{constructor(t,l,p){this.painter=t,this.sourceCache=new nc(l),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,l,p,m=f.X){var b;if(!(l>=0&&l=0&&pt.canonical.z&&(t.canonical.z>=m?b=t.canonical.z-m:f.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const C=t.canonical.x-(t.canonical.x>>b<>b<>8<<4|b>>8,l[C+3]=0;const p=new f.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(l.buffer)),m=new Se(t,p,t.gl.RGBA,{premultiply:!1});return m.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=m,m}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const l=new Uint8Array(4),p=this.painter.context,m=p.gl,b=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),C=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),L=Math.round(this.painter.height/devicePixelRatio);p.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),m.readPixels(b,L-C-1,1,1,m.RGBA,m.UNSIGNED_BYTE,l),p.bindFramebuffer.set(null);const R=l[0]+(l[2]>>4<<8),z=l[1]+((15&l[2])<<8),G=this.coordsIndex[255-l[3]],q=G&&this.sourceCache.getTileByID(G);if(!q)return null;const K=this._coordsTextureSize,ee=(1<t.id!==l),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const l of this._recentlyUsed)if(!this._objects[l].inUse)return this._objects[l];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length!t.inUse)===!1}}const Ts={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ch{constructor(t,l){this.painter=t,this.terrain=l,this.pool=new Sl(t.context,30,l.sourceCache.tileSize*l.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,l){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(p=>!t._layers[p].isHidden(l)),this._coordsDescendingInv={};for(const p in t.sourceCaches){this._coordsDescendingInv[p]={};const m=t.sourceCaches[p].getVisibleCoordinates();for(const b of m){const C=this.terrain.sourceCache.getTerrainCoords(b);for(const L in C)this._coordsDescendingInv[p][L]||(this._coordsDescendingInv[p][L]=[]),this._coordsDescendingInv[p][L].push(C[L])}}this._coordsDescendingInvStr={};for(const p of t._order){const m=t._layers[p],b=m.source;if(Ts[m.type]&&!this._coordsDescendingInvStr[b]){this._coordsDescendingInvStr[b]={};for(const C in this._coordsDescendingInv[b])this._coordsDescendingInvStr[b][C]=this._coordsDescendingInv[b][C].map(L=>L.key).sort().join()}}for(const p of this._renderableTiles)for(const m in this._coordsDescendingInvStr){const b=this._coordsDescendingInvStr[m][p.tileID.key];b&&b!==p.rttCoords[m]&&(p.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const l=t.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ts[l]&&(this._prevType&&Ts[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(t.id),!m))return!0;if(Ts[this._prevType]||Ts[l]&&m){this._prevType=l;const b=this._stacks.length-1,C=this._stacks[b]||[];for(const L of this._renderableTiles){if(this.pool.isFull()&&(ta(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(L),L.rtt[b]){const z=this.pool.getObjectForId(L.rtt[b].id);if(z.stamp===L.rtt[b].stamp){this.pool.useObject(z);continue}}const R=this.pool.getOrCreateFreeObject();this.pool.useObject(R),this.pool.stampObject(R),L.rtt[b]={id:R.id,stamp:R.stamp},p.context.bindFramebuffer.set(R.fbo.framebuffer),p.context.clear({color:f.aN.transparent,stencil:0}),p.currentStencilSource=void 0;for(let z=0;z{x.touchstart=x.dragStart,x.touchmoveWindow=x.dragMove,x.touchend=x.dragEnd},sc={showCompass:!0,showZoom:!0,visualizePitch:!1};class fh{constructor(t,l,p=!1){this.mousedown=C=>{this.startMouse(f.e({},C,{ctrlKey:!0,preventDefault:()=>C.preventDefault()}),V.mousePos(this.element,C)),V.addEventListener(window,"mousemove",this.mousemove),V.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=C=>{this.moveMouse(C,V.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=V.touchPos(this.element,C.targetTouches)[0],this.startTouch(C,this._startPos),V.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),V.addEventListener(window,"touchend",this.touchend))},this.touchmove=C=>{C.targetTouches.length!==1?this.reset():(this._lastPos=V.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 m=t.dragRotate._mouseRotate.getClickTolerance(),b=t.dragRotate._mousePitch.getClickTolerance();this.element=l,this.mouseRotate=na({clickTolerance:m,enable:!0}),this.touchRotate=(({enable:C,clickTolerance:L,bearingDegreesPerPixelMoved:R=.8})=>{const z=new ia;return new Li({clickTolerance:L,move:(G,q)=>({bearingDelta:(q.x-G.x)*R}),moveStateManager:z,enable:C,assignEvents:hh})})({clickTolerance:m,enable:!0}),this.map=t,p&&(this.mousePitch=Qr({clickTolerance:b,enable:!0}),this.touchPitch=(({enable:C,clickTolerance:L,pitchDegreesPerPixelMoved:R=-.5})=>{const z=new ia;return new Li({clickTolerance:L,move:(G,q)=>({pitchDelta:(q.y-G.y)*R}),moveStateManager:z,enable:C,assignEvents:hh})})({clickTolerance:b,enable:!0})),V.addEventListener(l,"mousedown",this.mousedown),V.addEventListener(l,"touchstart",this.touchstart,{passive:!1}),V.addEventListener(l,"touchcancel",this.reset)}startMouse(t,l){this.mouseRotate.dragStart(t,l),this.mousePitch&&this.mousePitch.dragStart(t,l),V.disableDrag()}startTouch(t,l){this.touchRotate.dragStart(t,l),this.touchPitch&&this.touchPitch.dragStart(t,l),V.disableDrag()}moveMouse(t,l){const p=this.map,{bearingDelta:m}=this.mouseRotate.dragMove(t,l)||{};if(m&&p.setBearing(p.getBearing()+m),this.mousePitch){const{pitchDelta:b}=this.mousePitch.dragMove(t,l)||{};b&&p.setPitch(p.getPitch()+b)}}moveTouch(t,l){const p=this.map,{bearingDelta:m}=this.touchRotate.dragMove(t,l)||{};if(m&&p.setBearing(p.getBearing()+m),this.touchPitch){const{pitchDelta:b}=this.touchPitch.dragMove(t,l)||{};b&&p.setPitch(p.getPitch()+b)}}off(){const t=this.element;V.removeEventListener(t,"mousedown",this.mousedown),V.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),V.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),V.removeEventListener(window,"touchend",this.touchend),V.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){V.enableDrag(),V.removeEventListener(window,"mousemove",this.mousemove),V.removeEventListener(window,"mouseup",this.mouseup),V.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),V.removeEventListener(window,"touchend",this.touchend)}}let mo;function dh(x,t,l){const p=new f.N(x.lng,x.lat);if(x=new f.N(x.lng,x.lat),t){const m=new f.N(x.lng-360,x.lat),b=new f.N(x.lng+360,x.lat),C=l.locationPoint(x).distSqr(t);l.locationPoint(m).distSqr(t)180;){const m=l.locationPoint(x);if(m.x>=0&&m.y>=0&&m.x<=l.width&&m.y<=l.height)break;x.lng>l.center.lng?x.lng-=360:x.lng+=360}return x.lng!==p.lng&&l.locationPoint(x).y>l.height/2-l.getHorizon()?x:p}const oc={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 go(x,t,l){const p=x.classList;for(const m in oc)p.remove(`maplibregl-${l}-anchor-${m}`);p.add(`maplibregl-${l}-anchor-${t}`)}class Gi extends f.E{constructor(t){if(super(),this._onKeyPress=l=>{const p=l.code,m=l.charCode||l.keyCode;p!=="Space"&&p!=="Enter"&&m!==32&&m!==13||this.togglePopup()},this._onMapClick=l=>{const p=l.originalEvent.target,m=this._element;this._popup&&(p===m||m.contains(p))&&this.togglePopup()},this._update=l=>{var p;if(!this._map)return;const m=this._map.loaded()&&!this._map.isMoving();((l==null?void 0:l.type)==="terrain"||(l==null?void 0:l.type)==="render"&&!m)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?dh(this._lngLat,this._flatPos,this._map.transform):(p=this._lngLat)===null||p===void 0?void 0:p.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let b="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?b=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(b=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let C="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?C="rotateX(0deg)":this._pitchAlignment==="map"&&(C=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||l&&l.type!=="moveend"||(this._pos=this._pos.round()),V.setTransform(this._element,`${oc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${C} ${b}`),N.frameAsync(new AbortController).then(()=>{this._updateOpacity(l&&l.type==="moveend")}).catch(()=>{})},this._onMove=l=>{if(!this._isDragging){const p=this._clickTolerance||this._map._clickTolerance;this._isDragging=l.point.dist(this._pointerdownPos)>=p}this._isDragging&&(this._pos=l.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 f.k("dragstart"))),this.fire(new f.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 f.k("dragend")),this._state="inactive"},this._addDragHandler=l=>{this._element.contains(l.originalEvent.target)&&(l.preventDefault(),this._positionDelta=l.point.sub(this._pos).add(this._offset),this._pointerdownPos=l.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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=f.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=V.create("div");const l=V.createNS("http://www.w3.org/2000/svg","svg"),p=41,m=27;l.setAttributeNS(null,"display","block"),l.setAttributeNS(null,"height",`${p}px`),l.setAttributeNS(null,"width",`${m}px`),l.setAttributeNS(null,"viewBox",`0 0 ${m} ${p}`);const b=V.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"stroke","none"),b.setAttributeNS(null,"stroke-width","1"),b.setAttributeNS(null,"fill","none"),b.setAttributeNS(null,"fill-rule","evenodd");const C=V.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill-rule","nonzero");const L=V.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(3.0, 29.0)"),L.setAttributeNS(null,"fill","#000000");const R=[{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 fe of R){const ye=V.createNS("http://www.w3.org/2000/svg","ellipse");ye.setAttributeNS(null,"opacity","0.04"),ye.setAttributeNS(null,"cx","10.5"),ye.setAttributeNS(null,"cy","5.80029008"),ye.setAttributeNS(null,"rx",fe.rx),ye.setAttributeNS(null,"ry",fe.ry),L.appendChild(ye)}const z=V.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"fill",this._color);const G=V.createNS("http://www.w3.org/2000/svg","path");G.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"),z.appendChild(G);const q=V.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"fill","#000000");const K=V.createNS("http://www.w3.org/2000/svg","path");K.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"),q.appendChild(K);const ee=V.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ee.setAttributeNS(null,"fill","#FFFFFF");const se=V.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ue=V.createNS("http://www.w3.org/2000/svg","circle");ue.setAttributeNS(null,"fill","#000000"),ue.setAttributeNS(null,"opacity","0.25"),ue.setAttributeNS(null,"cx","5.5"),ue.setAttributeNS(null,"cy","5.5"),ue.setAttributeNS(null,"r","5.4999962");const ae=V.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),se.appendChild(ue),se.appendChild(ae),C.appendChild(L),C.appendChild(z),C.appendChild(q),C.appendChild(ee),C.appendChild(se),l.appendChild(C),l.setAttributeNS(null,"height",p*this._scale+"px"),l.setAttributeNS(null,"width",m*this._scale+"px"),this._element.appendChild(l),this._offset=f.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",l=>{l.preventDefault()}),this._element.addEventListener("mousedown",l=>{l.preventDefault()}),go(this._element,this._anchor,"marker"),t&&t.className)for(const l of t.className.split(" "))this._element.classList.add(l);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.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("terrain",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),V.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=f.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const m=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[m,-1*(38.1-13.5+m)],"bottom-right":[-m,-1*(38.1-13.5+m)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var l,p;if(!(!((l=this._map)===null||l===void 0)&&l.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const m=this._map,b=m.terrain.depthAtPoint(this._pos),C=m.terrain.getElevationForLngLatZoom(this._lngLat,m.transform.tileZoom);if(m.transform.lngLatToCameraDepth(this._lngLat,C)-b<.006)return void(this._element.style.opacity=this._opacity);const L=-this._offset.y/m.transform._pixelPerMeter,R=Math.sin(m.getPitch()*Math.PI/180)*L,z=m.terrain.depthAtPoint(new f.P(this._pos.x,this._pos.y-this._offset.y)),G=m.transform.lngLatToCameraDepth(this._lngLat,C+R)-z>.006;!((p=this._popup)===null||p===void 0)&&p.isOpen()&&G&&this._popup.remove(),this._element.style.opacity=G?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=f.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,l){return t===void 0&&l===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),l!==void 0&&(this._opacityWhenCovered=l),this._map&&this._updateOpacity(!0),this}}const Hl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Aa=0,Ma=!1;const ph={maxWidth:100,unit:"metric"};function ac(x,t,l){const p=l&&l.maxWidth||100,m=x._container.clientHeight/2,b=x.unproject([0,m]),C=x.unproject([p,m]),L=b.distanceTo(C);if(l&&l.unit==="imperial"){const R=3.2808*L;R>5280?Il(t,p,R/5280,x._getUIString("ScaleControl.Miles")):Il(t,p,R,x._getUIString("ScaleControl.Feet"))}else l&&l.unit==="nautical"?Il(t,p,L/1852,x._getUIString("ScaleControl.NauticalMiles")):L>=1e3?Il(t,p,L/1e3,x._getUIString("ScaleControl.Kilometers")):Il(t,p,L,x._getUIString("ScaleControl.Meters"))}function Il(x,t,l,p){const m=function(b){const C=Math.pow(10,`${Math.floor(b)}`.length-1);let L=b/C;return L=L>=10?10:L>=5?5:L>=3?3:L>=2?2:L>=1?1:function(R){const z=Math.pow(10,Math.ceil(-Math.log(R)/Math.LN10));return Math.round(R*z)/z}(L),C*L}(l);x.style.width=t*(m/l)+"px",x.innerHTML=`${m} ${p}`}const Cs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Yl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Xt(x){if(x){if(typeof x=="number"){const t=Math.round(Math.abs(x)/Math.SQRT2);return{center:new f.P(0,0),top:new f.P(0,x),"top-left":new f.P(t,t),"top-right":new f.P(-t,t),bottom:new f.P(0,-x),"bottom-left":new f.P(t,-t),"bottom-right":new f.P(-t,-t),left:new f.P(x,0),right:new f.P(-x,0)}}if(x instanceof f.P||Array.isArray(x)){const t=f.P.convert(x);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:f.P.convert(x.center||[0,0]),top:f.P.convert(x.top||[0,0]),"top-left":f.P.convert(x["top-left"]||[0,0]),"top-right":f.P.convert(x["top-right"]||[0,0]),bottom:f.P.convert(x.bottom||[0,0]),"bottom-left":f.P.convert(x["bottom-left"]||[0,0]),"bottom-right":f.P.convert(x["bottom-right"]||[0,0]),left:f.P.convert(x.left||[0,0]),right:f.P.convert(x.right||[0,0])}}return Xt(new f.P(0,0))}const ii=D;I.AJAXError=f.bg,I.Evented=f.E,I.LngLat=f.N,I.MercatorCoordinate=f.Z,I.Point=f.P,I.addProtocol=f.bh,I.config=f.a,I.removeProtocol=f.bi,I.AttributionControl=La,I.BoxZoomHandler=wn,I.CanvasSource=Mn,I.CooperativeGesturesHandler=es,I.DoubleClickZoomHandler=$u,I.DragPanHandler=Wr,I.DragRotateHandler=$r,I.EdgeInsets=r,I.FullscreenControl=class extends f.E{constructor(x={}){super(),this._onFullscreenChange=()=>{var t;let l=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=l==null?void 0:l.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)l=l.shadowRoot.fullscreenElement;l===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,x&&x.container&&(x.container instanceof HTMLElement?this._container=x.container:f.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(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const x=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);V.create("span","maplibregl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.title=x}_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 f.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new f.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()}},I.GeoJSONSource=to,I.GeolocateControl=class extends f.E{constructor(x){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new f.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new f.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const l=new f.N(t.coords.longitude,t.coords.latitude),p=t.coords.accuracy,m=this._map.getBearing(),b=f.e({bearing:m},this.options.fitBoundsOptions),C=Ne.fromLngLat(l,p);this._map.fitBounds(C,b,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const l=new f.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(l).addTo(this._map),this._userLocationDotMarker.setLngLat(l).addTo(this._map),this._accuracy=t.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=t=>{if(this._map){if(this.options.trackUserLocation)if(t.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 l=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=l,this._geolocateButton.setAttribute("aria-label",l),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Ma)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new f.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=V.create("button","maplibregl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){f.w("Geolocation support is not available so the GeolocateControl will be disabled.");const l=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=l,this._geolocateButton.setAttribute("aria-label",l)}else{const l=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=l,this._geolocateButton.setAttribute("aria-label",l)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=V.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Gi({element:this._dotElement}),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Gi({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",l=>{l.geolocateSource||this._watchState!=="ACTIVE_LOCK"||l.originalEvent&&l.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 f.k("trackuserlocationend")),this.fire(new f.k("userlocationlostfocus")))})}},this.options=f.e({},Hl,x)}onAdd(x){return this._map=x,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return f._(this,arguments,void 0,function*(t=!1){if(mo!==void 0&&!t)return mo;if(window.navigator.permissions===void 0)return mo=!!window.navigator.geolocation,mo;try{mo=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{mo=!!window.navigator.geolocation}return mo})}().then(t=>this._finishSetupUI(t)),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(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Aa=0,Ma=!1}_isOutOfMapMaxBounds(x){const t=this._map.getMaxBounds(),l=x.coords;return t&&(l.longitudet.getEast()||l.latitudet.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 x=this._map.getBounds(),t=x.getSouthEast(),l=x.getNorthEast(),p=t.distanceTo(l),m=Math.ceil(this._accuracy/(p/this._map._container.clientHeight)*2);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}px`}trigger(){if(!this._setup)return f.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 f.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Aa--,Ma=!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 f.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 f.k("trackuserlocationstart")),this.fire(new f.k("userlocationfocus"));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 x;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Aa++,Aa>1?(x={maximumAge:6e5,timeout:0},Ma=!0):(x=this.options.positionOptions,Ma=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,x)}}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)}},I.Hash=E,I.ImageSource=Kr,I.KeyboardHandler=Ku,I.LngLatBounds=Ne,I.LogoControl=Es,I.Map=class extends Vf{constructor(x){f.be.mark(f.bf.create);const t=Object.assign(Object.assign({},qf),x);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new u(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Rt,this._controls=[],this._mapId=f.a4(),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new f.k("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new f.k("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Et),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ke.addThrottleControl(()=>this.isMoving()),this._requestManager=new Re(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1;const p=y(m=>{this._trackResize&&!this._removed&&this.resize(m)._update()},50);this._resizeObserver=new ResizeObserver(m=>{l?p(m):l=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Uf(this,t),this._hash=t.hash&&new E(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,f.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new La(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Es,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new f.k(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new f.k(`${l.dataType}dataloading`,l))}),this.on("dataabort",l=>{this.fire(new f.k("sourcedataabort",l))})}_getMapId(){return this._mapId}addControl(x,t){if(t===void 0&&(t=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.onAdd)return this.fire(new f.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const l=x.onAdd(this);this._controls.push(x);const p=this._controlPositions[t];return t.indexOf("bottom")!==-1?p.insertBefore(l,p.firstChild):p.appendChild(l),this}removeControl(x){if(!x||!x.onRemove)return this.fire(new f.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(x);return t>-1&&this._controls.splice(t,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}calculateCameraOptionsFromTo(x,t,l,p){return p==null&&this.terrain&&(p=this.terrain.getElevationForLngLatZoom(l,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(x,t,l,p)}resize(x){var t;const l=this._containerDimensions(),p=l[0],m=l[1],b=this._getClampedPixelRatio(p,m);if(this._resizeCanvas(p,m,b),this.painter.resize(p,m,b),this.painter.overLimit()){const L=this.painter.context.gl;this._maxCanvasSize=[L.drawingBufferWidth,L.drawingBufferHeight];const R=this._getClampedPixelRatio(p,m);this._resizeCanvas(p,m,R),this.painter.resize(p,m,R)}this.transform.resize(p,m),(t=this._requestedCameraState)===null||t===void 0||t.resize(p,m);const C=!this._moving;return C&&(this.stop(),this.fire(new f.k("movestart",x)).fire(new f.k("move",x))),this.fire(new f.k("resize",x)),C&&this.fire(new f.k("moveend",x)),this}_getClampedPixelRatio(x,t){const{0:l,1:p}=this._maxCanvasSize,m=this.getPixelRatio(),b=x*m,C=t*m;return Math.min(b>l?l/b:1,C>p?p/C:1)*m}getPixelRatio(){var x;return(x=this._overridePixelRatio)!==null&&x!==void 0?x:devicePixelRatio}setPixelRatio(x){this._overridePixelRatio=x,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(x){return this.transform.setMaxBounds(Ne.convert(x)),this._update()}setMinZoom(x){if((x=x??-2)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x&&this.setZoom(x),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x&&this.setPitch(x),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this._update()}project(x){return this.transform.locationPoint(f.N.convert(x),this.style&&this.terrain)}unproject(x){return this.transform.pointLocation(f.P.convert(x),this.terrain)}isMoving(){var x;return this._moving||((x=this.handlers)===null||x===void 0?void 0:x.isMoving())}isZooming(){var x;return this._zooming||((x=this.handlers)===null||x===void 0?void 0:x.isZooming())}isRotating(){var x;return this._rotating||((x=this.handlers)===null||x===void 0?void 0:x.isRotating())}_createDelegatedListener(x,t,l){if(x==="mouseenter"||x==="mouseover"){let p=!1;return{layer:t,listener:l,delegates:{mousemove:b=>{const C=this.getLayer(t)?this.queryRenderedFeatures(b.point,{layers:[t]}):[];C.length?p||(p=!0,l.call(this,new tt(x,this,b.originalEvent,{features:C}))):p=!1},mouseout:()=>{p=!1}}}}if(x==="mouseleave"||x==="mouseout"){let p=!1;return{layer:t,listener:l,delegates:{mousemove:C=>{(this.getLayer(t)?this.queryRenderedFeatures(C.point,{layers:[t]}):[]).length?p=!0:p&&(p=!1,l.call(this,new tt(x,this,C.originalEvent)))},mouseout:C=>{p&&(p=!1,l.call(this,new tt(x,this,C.originalEvent)))}}}}{const p=m=>{const b=this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[];b.length&&(m.features=b,l.call(this,m),delete m.features)};return{layer:t,listener:l,delegates:{[x]:p}}}}on(x,t,l){if(l===void 0)return super.on(x,t);const p=this._createDelegatedListener(x,t,l);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(p);for(const m in p.delegates)this.on(m,p.delegates[m]);return this}once(x,t,l){if(l===void 0)return super.once(x,t);const p=this._createDelegatedListener(x,t,l);for(const m in p.delegates)this.once(m,p.delegates[m]);return this}off(x,t,l){return l===void 0?super.off(x,t):(this._delegatedListeners&&this._delegatedListeners[x]&&(p=>{const m=this._delegatedListeners[x];for(let b=0;bthis._updateStyle(x,t));const l=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!x)),x?(this.style=new qr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x,t,l):this.style.loadJSON(x,t,l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new qr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,t){if(typeof x=="string"){const l=this._requestManager.transformRequest(x,"Style");f.h(l,new AbortController).then(p=>{this._updateDiff(p.data,t)}).catch(p=>{p&&this.fire(new f.j(p))})}else typeof x=="object"&&this._updateDiff(x,t)}_updateDiff(x,t){try{this.style.setState(x,t)&&this._update(!0)}catch(l){f.w(`Unable to perform style diff: ${l.message||l.error||l}. Rebuilding the style from scratch.`),this._updateStyle(x,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():f.w("There is no style added to the map.")}addSource(x,t){return this._lazyInitEmptyStyle(),this.style.addSource(x,t),this._update(!0)}isSourceLoaded(x){const t=this.style&&this.style.sourceCaches[x];if(t!==void 0)return t.loaded();this.fire(new f.j(new Error(`There is no source with ID '${x}'`)))}setTerrain(x){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),x){const t=this.style.sourceCaches[x.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${x.source}`);this.terrain===null&&t.reload();for(const l in this.style._layers){const p=this.style._layers[l];p.type==="hillshade"&&p.source===x.source&&f.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 uh(this.painter,t,x),this.painter.renderToTexture=new ch(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=l=>{l.dataType==="style"?this.terrain.sourceCache.freeRtt():l.dataType==="source"&&l.tile&&(l.sourceId!==x.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(l.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 f.k("terrain",{terrain:x})),this}getTerrain(){var x,t;return(t=(x=this.terrain)===null||x===void 0?void 0:x.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const x=this.style&&this.style.sourceCaches;for(const t in x){const l=x[t]._tiles;for(const p in l){const m=l[p];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}removeSource(x){return this.style.removeSource(x),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,t,l={}){const{pixelRatio:p=1,sdf:m=!1,stretchX:b,stretchY:C,content:L,textFitWidth:R,textFitHeight:z}=l;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||f.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new f.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:G,height:q,data:K}=t,ee=t;return this.style.addImage(x,{data:new f.R({width:G,height:q},new Uint8Array(K)),pixelRatio:p,stretchX:b,stretchY:C,content:L,textFitWidth:R,textFitHeight:z,sdf:m,version:0,userImage:ee}),ee.onAdd&&ee.onAdd(this,x),this}}{const{width:G,height:q,data:K}=N.getImageData(t);this.style.addImage(x,{data:new f.R({width:G,height:q},K),pixelRatio:p,stretchX:b,stretchY:C,content:L,textFitWidth:R,textFitHeight:z,sdf:m,version:0})}}updateImage(x,t){const l=this.style.getImage(x);if(!l)return this.fire(new f.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=t instanceof HTMLImageElement||f.b(t)?N.getImageData(t):t,{width:m,height:b,data:C}=p;if(m===void 0||b===void 0)return this.fire(new f.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==l.data.width||b!==l.data.height)return this.fire(new f.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const L=!(t instanceof HTMLImageElement||f.b(t));return l.data.replace(C,L),this.style.updateImage(x,l),this}getImage(x){return this.style.getImage(x)}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new f.j(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x){return ke.getImage(this._requestManager.transformRequest(x,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(x,t){return this._lazyInitEmptyStyle(),this.style.addLayer(x,t),this._update(!0)}moveLayer(x,t){return this.style.moveLayer(x,t),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(x,t,l){return this.style.setLayerZoomRange(x,t,l),this._update(!0)}setFilter(x,t,l={}){return this.style.setFilter(x,t,l),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,t,l,p={}){return this.style.setPaintProperty(x,t,l,p),this._update(!0)}getPaintProperty(x,t){return this.style.getPaintProperty(x,t)}setLayoutProperty(x,t,l,p={}){return this.style.setLayoutProperty(x,t,l,p),this._update(!0)}getLayoutProperty(x,t){return this.style.getLayoutProperty(x,t)}setGlyphs(x,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(x,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(x,t,l={}){return this._lazyInitEmptyStyle(),this.style.addSprite(x,t,l,p=>{p||this._update(!0)}),this}removeSprite(x){return this._lazyInitEmptyStyle(),this.style.removeSprite(x),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(x,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(x,t,l=>{l||this._update(!0)}),this}setLight(x,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(x){return this._lazyInitEmptyStyle(),this.style.setSky(x),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(x,t){return this.style.setFeatureState(x,t),this._update()}removeFeatureState(x,t){return this.style.removeFeatureState(x,t),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let x=0,t=0;return this._container&&(x=this._container.clientWidth||400,t=this._container.clientHeight||300),[x,t]}_setupContainer(){const x=this._container;x.classList.add("maplibregl-map");const t=this._canvasContainer=V.create("div","maplibregl-canvas-container",x);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=V.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const l=this._containerDimensions(),p=this._getClampedPixelRatio(l[0],l[1]);this._resizeCanvas(l[0],l[1],p);const m=this._controlContainer=V.create("div","maplibregl-control-container",x),b=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(C=>{b[C]=V.create("div",`maplibregl-ctrl-${C} `,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,t,l){this._canvas.width=Math.floor(l*x),this._canvas.height=Math.floor(l*t),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const x={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",p=>{t={requestedAttributes:x},p&&(t.statusMessage=p.statusMessage,t.type=p.type)},{once:!0});const l=this._canvas.getContext("webgl2",x)||this._canvas.getContext("webgl",x);if(!l){const p="Failed to initialize WebGL";throw t?(t.message=p,new Error(JSON.stringify(t))):new Error(p)}this.painter=new mr(l,this.transform),ne.testSupport(l)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_render(x){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(x),this._removed)return;let l=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const m=this.transform.zoom,b=N.now();this.style.zoomHistory.update(m,b);const C=new f.a9(m,{now:b,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),L=C.crossFadingFactor();L===1&&L===this._crossFadingFactor||(l=!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,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new f.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,f.be.mark(f.bf.load),this.fire(new f.k("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new f.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,f.be.mark(f.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var x;this._hash&&this._hash.remove();for(const l of this._controls)l.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),ke.removeThrottleControl(this._imageQueueHandle),(x=this._resizeObserver)===null||x===void 0||x.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),f.be.clearMetrics(),this._removed=!0,this.fire(new f.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then(x=>{f.be.frame(x),this._frameRequest=null,this._render(x)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get version(){return rc}getCameraTargetElevation(){return this.transform.elevation}},I.MapMouseEvent=tt,I.MapTouchEvent=Kt,I.MapWheelEvent=ni,I.Marker=Gi,I.NavigationControl=class{constructor(x){this._updateZoomButtons=()=>{const t=this._map.getZoom(),l=t===this._map.getMaxZoom(),p=t===this._map.getMinZoom();this._zoomInButton.disabled=l,this._zoomOutButton.disabled=p,this._zoomInButton.setAttribute("aria-disabled",l.toString()),this._zoomOutButton.setAttribute("aria-disabled",p.toString())},this._rotateCompassArrow=()=>{const t=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=t},this._setButtonTitle=(t,l)=>{const p=this._map._getUIString(`NavigationControl.${l}`);t.title=p,t.setAttribute("aria-label",p)},this.options=f.e({},sc,x),this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),V.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),V.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=V.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(x){return this._map=x,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 fh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.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(x,t){const l=V.create("button",x,this._container);return l.type="button",l.addEventListener("click",t),l}},I.Popup=class extends f.E{constructor(x){super(),this.remove=()=>(this._content&&V.remove(this._content),this._container&&(V.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 f.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var l;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=V.create("div","maplibregl-popup",this._map.getContainer()),this._tip=V.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._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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?dh(this._lngLat,this._flatPos,this._map.transform):(l=this._lngLat)===null||l===void 0?void 0:l.wrap(),this._trackPointer&&!t)return;const p=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let m=this.options.anchor;const b=Xt(this.options.offset);if(!m){const L=this._container.offsetWidth,R=this._container.offsetHeight;let z;z=p.y+b.bottom.ythis._map.transform.height-R?["bottom"]:[],p.xthis._map.transform.width-L/2&&z.push("right"),m=z.length===0?"bottom":z.join("-")}let C=p.add(b[m]);this.options.subpixelPositioning||(C=C.round()),V.setTransform(this._container,`${oc[m]} translate(${C.x}px,${C.y}px)`),go(this._container,m,"popup")},this._onClose=()=>{this.remove()},this.options=f.e(Object.create(Cs),x)}addTo(x){return this._map&&this.remove(),this._map=x,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 f.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(x){return this._lngLat=f.N.convert(x),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(x){return this.setDOMContent(document.createTextNode(x))}setHTML(x){const t=document.createDocumentFragment(),l=document.createElement("body");let p;for(l.innerHTML=x;p=l.firstChild,p;)t.appendChild(p);return this.setDOMContent(t)}getMaxWidth(){var x;return(x=this._container)===null||x===void 0?void 0:x.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=V.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(x),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(x){return this._container&&this._container.classList.add(x),this}removeClassName(x){return this._container&&this._container.classList.remove(x),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){if(this._container)return this._container.classList.toggle(x)}setSubpixelPositioning(x){this.options.subpixelPositioning=x}_createCloseButton(){this.options.closeButton&&(this._closeButton=V.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const x=this._container.querySelector(Yl);x&&x.focus()}},I.RasterDEMTileSource=Hi,I.RasterTileSource=Je,I.ScaleControl=class{constructor(x){this._onMove=()=>{ac(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ac(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ph),x)}getDefaultPosition(){return"bottom-left"}onAdd(x){return this._map=x,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-scale",x.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},I.ScrollZoomHandler=Qu,I.Style=qr,I.TerrainControl=class{constructor(x){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=x}onAdd(x){return this._map=x,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain",this._container),V.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(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},I.TwoFingersTouchPitchHandler=Yu,I.TwoFingersTouchRotateHandler=Hu,I.TwoFingersTouchZoomHandler=Wu,I.TwoFingersTouchZoomRotateHandler=ec,I.VectorTileSource=Hn,I.VideoSource=hi,I.addSourceType=(x,t)=>f._(void 0,void 0,void 0,function*(){if(zs(x))throw new Error(`A source type called "${x}" already exists.`);((l,p)=>{ms[l]=p})(x,t)}),I.clearPrewarmedResources=function(){const x=vt;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(et),vt=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()"))},I.getMaxParallelImageRequests=function(){return f.a.MAX_PARALLEL_IMAGE_REQUESTS},I.getRTLTextPluginStatus=function(){return ti().getRTLTextPluginStatus()},I.getVersion=function(){return ii},I.getWorkerCount=function(){return Ot.workerCount},I.getWorkerUrl=function(){return f.a.WORKER_URL},I.importScriptInWorkers=function(x){return yt().broadcast("IS",x)},I.prewarm=function(){vi().acquire(et)},I.setMaxParallelImageRequests=function(x){f.a.MAX_PARALLEL_IMAGE_REQUESTS=x},I.setRTLTextPlugin=function(x,t){return ti().setRTLTextPlugin(x,t)},I.setWorkerCount=function(x){Ot.workerCount=x},I.setWorkerUrl=function(x){f.a.WORKER_URL=x}});var k=c;return k})})(Xv);var sw=Xv.exports;const fs=rw(sw);function oy(s){let o;return c=>{if(c)for(let d in c){let _=o==null?void 0:o[d],k=c[d];_!==k&&s(d,k,_)}else if(o)for(let d in o)s(d,void 0,o[d]);o=c}}function ow(s,...o){let c=[s];for(let d of o)if(d)Array.isArray(d)&&d[0]===s?c.push(...d.slice(1)):c.push(d);else continue;if(c.length!==1)return c.length===2?c[1]:c}function aw(s){return s===!0?["has","point_count"]:s===!1?["!",["has","point_count"]]:void 0}function of(s,o){return["case",["boolean",["feature-state","hover"],!1],o,s]}var Hc=lw;function lw(s){var o,c,d;if(s){if(Array.isArray(s)){for(o=[],c=s.length,d=0;d{d=null}),ps())},i(_){c||(Bt(d),c=!0)},o(_){$t(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function cw(s,o,c){let d,_,k,I,f,D,F,j,N,V,ne,re,{$$slots:Ae={},$$scope:we}=o,{id:Te=eh("layer")}=o,{source:Ce=void 0}=o,{sourceLayer:ke=void 0}=o,{beforeId:Re=void 0}=o,{beforeLayerType:ze=void 0}=o,{type:Oe}=o,{paint:Ze=void 0}=o,{layout:je=void 0}=o,{filter:Ve=void 0}=o,{applyToClusters:st=void 0}=o,{minzoom:Se=void 0}=o,{maxzoom:Lt=void 0}=o,{manageHoverState:_t=!1}=o,{hovered:We=null}=o,{interactive:dt=!0}=o,{hoverCursor:bt=void 0}=o,{eventsIfTopMost:lt=!1}=o;const It=Mf(),{map:Wt,source:it,self:Ft,minzoom:Ut,maxzoom:Gt,eventTopMost:et,layerInfo:Ot}=tw();Ln(s,Wt,xe=>c(31,N=xe)),Ln(s,it,xe=>c(32,V=xe)),Ln(s,Ft,xe=>c(0,j=xe)),Ln(s,Ut,xe=>c(34,re=xe)),Ln(s,Gt,xe=>c(33,ne=xe)),Ro(()=>{j&&N&&(Ot.delete(j),N==null||N.removeLayer(j))});let pt;function vt(xe){var Xi,Hn;if(!dt||!j||!N||lt&&et(xe)!==j)return;let Dt=xe.features??[],Ke=(Hn=(Xi=Dt[0])==null?void 0:Xi.properties)==null?void 0:Hn.cluster_id,Ne={event:xe,map:N,clusterId:Ke,layer:j,source:f,features:Dt};It(xe.type,Ne)}function _e(xe){var Xi,Hn;if(!dt||!j||!N||lt&&et(xe)!==j)return;bt&&(N.getCanvas().style.cursor=bt);let Dt=xe.features??[];c(6,We=Dt[0]??null);let Ke=(Hn=(Xi=Dt[0])==null?void 0:Xi.properties)==null?void 0:Hn.cluster_id;It("mouseenter",{event:xe,map:N,clusterId:Ke,layer:j,source:f,features:Dt})}function vi(xe){var Xi,Hn,Je;if(!dt||!N)return;if(lt&&et(xe)!==j){c(6,We=null),_t&&pt!==void 0&&(N==null||N.setFeatureState({source:f,sourceLayer:ke,id:pt},{hover:!1}),pt=void 0);return}N.getCanvas().style.cursor=bt;let Dt=xe.features??[],Ke=(Hn=(Xi=Dt[0])==null?void 0:Xi.properties)==null?void 0:Hn.cluster_id,Ne=(Je=Dt[0])==null?void 0:Je.id;Ne!==pt&&(_t&&(pt!==void 0&&(N==null||N.setFeatureState({source:f,id:pt,sourceLayer:ke},{hover:!1})),N==null||N.setFeatureState({source:f,id:Ne,sourceLayer:ke},{hover:!0})),pt=Ne,c(6,We=Dt[0]??null)),It("mousemove",{event:xe,map:N,clusterId:Ke,layer:j,source:f,features:Dt})}function Jt(xe){if(!(!dt||!j||!N)){if(bt&&(N.getCanvas().style.cursor=""),c(6,We=null),_t&&pt!==void 0){const Dt={source:f,id:pt,sourceLayer:ke};N==null||N.setFeatureState(Dt,{hover:!1}),pt=void 0}It("mouseleave",{map:N,layer:j,source:f})}}let yt=!0;function he(xe){N&&(N.off("click",xe,vt),N.off("dblclick",xe,vt),N.off("contextmenu",xe,vt),N.off("mouseenter",xe,_e),N.off("mousemove",xe,vi),N.off("mouseleave",xe,Jt))}return Ro(()=>{N&&j&&he(j)}),s.$$set=xe=>{"id"in xe&&c(7,Te=xe.id),"source"in xe&&c(8,Ce=xe.source),"sourceLayer"in xe&&c(9,ke=xe.sourceLayer),"beforeId"in xe&&c(10,Re=xe.beforeId),"beforeLayerType"in xe&&c(11,ze=xe.beforeLayerType),"type"in xe&&c(12,Oe=xe.type),"paint"in xe&&c(13,Ze=xe.paint),"layout"in xe&&c(14,je=xe.layout),"filter"in xe&&c(15,Ve=xe.filter),"applyToClusters"in xe&&c(16,st=xe.applyToClusters),"minzoom"in xe&&c(17,Se=xe.minzoom),"maxzoom"in xe&&c(18,Lt=xe.maxzoom),"manageHoverState"in xe&&c(19,_t=xe.manageHoverState),"hovered"in xe&&c(6,We=xe.hovered),"interactive"in xe&&c(20,dt=xe.interactive),"hoverCursor"in xe&&c(21,bt=xe.hoverCursor),"eventsIfTopMost"in xe&&c(22,lt=xe.eventsIfTopMost),"$$scope"in xe&&c(35,we=xe.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&65536&&c(30,d=aw(st)),s.$$.dirty[0]&1073774592&&c(24,_=ow("all",d,Ve)),s.$$.dirty[0]&131072|s.$$.dirty[1]&8&&c(26,k=Se??re),s.$$.dirty[0]&262144|s.$$.dirty[1]&4&&c(25,I=Lt??ne),s.$$.dirty[0]&256|s.$$.dirty[1]&2&&c(29,f=Ce||V),s.$$.dirty[0]&654343809|s.$$.dirty[1]&1&&N&&j!==Te&&f){j&&(he(j),Ot.delete(j));let xe=Re;if(!Re&&ze){let Dt=N.getStyle().layers,Ke=typeof ze=="function"?ze:Xi=>Xi.type===ze,Ne=Dt==null?void 0:Dt.find(Ke);Ne&&(xe=Ne.id)}Co(Ft,j=Te,j),N.addLayer(Hc({id:j,type:Oe,source:f,"source-layer":ke,filter:_,paint:Ze,layout:je,minzoom:k,maxzoom:I}),xe),c(23,yt=!0),N.on("click",j,vt),N.on("dblclick",j,vt),N.on("contextmenu",j,vt),N.on("mouseenter",j,_e),N.on("mousemove",j,vi),N.on("mouseleave",j,Jt)}s.$$.dirty[0]&1048577&&j&&Ot.set(j,{interactive:dt}),s.$$.dirty[0]&1|s.$$.dirty[1]&1&&c(28,D=j?oy((xe,Dt)=>N==null?void 0:N.setPaintProperty(j,xe,Dt)):void 0),s.$$.dirty[0]&1|s.$$.dirty[1]&1&&c(27,F=j?oy((xe,Dt)=>N==null?void 0:N.setLayoutProperty(j,xe,Dt)):void 0),s.$$.dirty[0]&268443648&&(D==null||D(Ze)),s.$$.dirty[0]&134234112&&(F==null||F(je)),s.$$.dirty[0]&100663297|s.$$.dirty[1]&1&&j&&(N==null||N.setLayerZoomRange(j,k,I)),s.$$.dirty[0]&25165825|s.$$.dirty[1]&1&&j&&(yt?c(23,yt=!1):N==null||N.setFilter(j,_))},[j,Wt,it,Ft,Ut,Gt,We,Te,Ce,ke,Re,ze,Oe,Ze,je,Ve,st,Se,Lt,_t,dt,bt,lt,yt,_,I,k,F,D,f,d,N,V,ne,re,we,Ae]}class Yv extends qn{constructor(o){super(),Vn(this,o,cw,uw,gn,{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 hw(s){let o;const c=s[15].default,d=Po(c,s,s[23],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&8388608)&&Ao(d,c,_,_[23],o?Lo(c,_[23],k,null):Mo(_[23]),null)},i(_){o||(Bt(d,_),o=!0)},o(_){$t(d,_),o=!1},d(_){d&&d.d(_)}}}function fw(s){let o,c,d;function _(I){s[16](I)}let k={id:s[1],type:"fill",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],minzoom:s[9],maxzoom:s[10],hoverCursor:s[11],manageHoverState:s[12],eventsIfTopMost:s[13],interactive:s[14],$$slots:{default:[hw]},$$scope:{ctx:s}};return s[0]!==void 0&&(k.hovered=s[0]),o=new Yv({props:k}),pa.push(()=>Df(o,"hovered",_)),o.$on("click",s[17]),o.$on("dblclick",s[18]),o.$on("contextmenu",s[19]),o.$on("mouseenter",s[20]),o.$on("mousemove",s[21]),o.$on("mouseleave",s[22]),{c(){un(o.$$.fragment)},m(I,f){rn(o,I,f),d=!0},p(I,[f]){const D={};f&2&&(D.id=I[1]),f&4&&(D.source=I[2]),f&8&&(D.sourceLayer=I[3]),f&16&&(D.beforeId=I[4]),f&32&&(D.beforeLayerType=I[5]),f&64&&(D.paint=I[6]),f&128&&(D.layout=I[7]),f&256&&(D.filter=I[8]),f&512&&(D.minzoom=I[9]),f&1024&&(D.maxzoom=I[10]),f&2048&&(D.hoverCursor=I[11]),f&4096&&(D.manageHoverState=I[12]),f&8192&&(D.eventsIfTopMost=I[13]),f&16384&&(D.interactive=I[14]),f&8388608&&(D.$$scope={dirty:f,ctx:I}),!c&&f&1&&(c=!0,D.hovered=I[0],Rf(()=>c=!1)),o.$set(D)},i(I){d||(Bt(o.$$.fragment,I),d=!0)},o(I){$t(o.$$.fragment,I),d=!1},d(I){sn(o,I)}}}function dw(s,o,c){let{$$slots:d={},$$scope:_}=o,{id:k=eh("fill")}=o,{source:I=void 0}=o,{sourceLayer:f=void 0}=o,{beforeId:D=void 0}=o,{beforeLayerType:F=void 0}=o,{paint:j}=o,{layout:N=void 0}=o,{filter:V=void 0}=o,{minzoom:ne=void 0}=o,{maxzoom:re=void 0}=o,{hoverCursor:Ae=void 0}=o,{manageHoverState:we=!1}=o,{hovered:Te=null}=o,{eventsIfTopMost:Ce=!1}=o,{interactive:ke=!0}=o;function Re(Se){Te=Se,c(0,Te)}function ze(Se){cs.call(this,s,Se)}function Oe(Se){cs.call(this,s,Se)}function Ze(Se){cs.call(this,s,Se)}function je(Se){cs.call(this,s,Se)}function Ve(Se){cs.call(this,s,Se)}function st(Se){cs.call(this,s,Se)}return s.$$set=Se=>{"id"in Se&&c(1,k=Se.id),"source"in Se&&c(2,I=Se.source),"sourceLayer"in Se&&c(3,f=Se.sourceLayer),"beforeId"in Se&&c(4,D=Se.beforeId),"beforeLayerType"in Se&&c(5,F=Se.beforeLayerType),"paint"in Se&&c(6,j=Se.paint),"layout"in Se&&c(7,N=Se.layout),"filter"in Se&&c(8,V=Se.filter),"minzoom"in Se&&c(9,ne=Se.minzoom),"maxzoom"in Se&&c(10,re=Se.maxzoom),"hoverCursor"in Se&&c(11,Ae=Se.hoverCursor),"manageHoverState"in Se&&c(12,we=Se.manageHoverState),"hovered"in Se&&c(0,Te=Se.hovered),"eventsIfTopMost"in Se&&c(13,Ce=Se.eventsIfTopMost),"interactive"in Se&&c(14,ke=Se.interactive),"$$scope"in Se&&c(23,_=Se.$$scope)},[Te,k,I,f,D,F,j,N,V,ne,re,Ae,we,Ce,ke,d,Re,ze,Oe,Ze,je,Ve,st,_]}class Kv extends qn{constructor(o){super(),Vn(this,o,dw,fw,gn,{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 pw(s,o,c){let d;const{map:_}=Ol();Ln(s,_,D=>c(4,d=D));let{position:k="top-left"}=o,{container:I=void 0}=o,f=null;return Ro(()=>{d!=null&&d.loaded()&&f&&d.removeControl(f)}),s.$$set=D=>{"position"in D&&c(1,k=D.position),"container"in D&&c(2,I=D.container)},s.$$.update=()=>{if(s.$$.dirty&30&&d&&!f){let D;typeof I=="string"?D=document.querySelector(I)??void 0:D=I,c(3,f=new fs.FullscreenControl({container:D})),d.addControl(f,k)}},[_,k,I,f,d]}class mw extends qn{constructor(o){super(),Vn(this,o,pw,null,gn,{position:1,container:2})}}function Jv(s,o,c,d,_){let k=!1;s.getSource(o)&&(k=!0,s.removeSource(o));const I=()=>{d(o)&&(s.addSource(o,c),_())};if(k){const f=()=>{o&&(s.getSource(o)?setTimeout(f,1):I())};f()}else I()}function Qv(s,o,c){Vb().then(()=>{let d=Db(s);if(!d)return;d.getSource(o)===c&&d.removeSource(o)})}function uy(s){let o=s[0],c,d,_=cy(s);return{c(){_.c(),c=Yr()},m(k,I){_.m(k,I),Tt(k,c,I),d=!0},p(k,I){I&1&&gn(o,o=k[0])?(ds(),$t(_,1,1,bn),ps(),_=cy(k),_.c(),Bt(_,1),_.m(c.parentNode,c)):_.p(k,I)},i(k){d||(Bt(_),d=!0)},o(k){$t(_),d=!1},d(k){k&&St(c),_.d(k)}}}function cy(s){let o;const c=s[19].default,d=Po(c,s,s[18],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&262144)&&Ao(d,c,_,_[18],o?Lo(c,_[18],k,null):Mo(_[18]),null)},i(_){o||(Bt(d,_),o=!0)},o(_){$t(d,_),o=!1},d(_){d&&d.d(_)}}}function gw(s){let o,c,d=s[0]&&uy(s);return{c(){d&&d.c(),o=Yr()},m(_,k){d&&d.m(_,k),Tt(_,o,k),c=!0},p(_,[k]){_[0]?d?(d.p(_,k),k&1&&Bt(d,1)):(d=uy(_),d.c(),Bt(d,1),d.m(o.parentNode,o)):d&&(ds(),$t(d,1,1,()=>{d=null}),ps())},i(_){c||(Bt(d),c=!0)},o(_){$t(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function yw(s,o,c){let d,_,k,{$$slots:I={},$$scope:f}=o,{id:D=eh("geojson")}=o,{data:F}=o,{generateId:j=!1}=o,{promoteId:N=void 0}=o,{filter:V=void 0}=o,{lineMetrics:ne=void 0}=o,{cluster:re=void 0}=o,{maxzoom:Ae=void 0}=o,{attribution:we=void 0}=o,{buffer:Te=void 0}=o,{tolerance:Ce=void 0}=o;const{map:ke,cluster:Re,self:ze}=Wv();Ln(s,ke,je=>c(17,_=je)),Ln(s,Re,je=>c(20,k=je)),Ln(s,ze,je=>c(0,d=je));let Oe,Ze=!0;return Ro(()=>{d&&Oe&&_&&(Qv(ke,d,Oe),Co(ze,d=null,d),c(15,Oe=void 0))}),s.$$set=je=>{"id"in je&&c(4,D=je.id),"data"in je&&c(5,F=je.data),"generateId"in je&&c(6,j=je.generateId),"promoteId"in je&&c(7,N=je.promoteId),"filter"in je&&c(8,V=je.filter),"lineMetrics"in je&&c(9,ne=je.lineMetrics),"cluster"in je&&c(10,re=je.cluster),"maxzoom"in je&&c(11,Ae=je.maxzoom),"attribution"in je&&c(12,we=je.attribution),"buffer"in je&&c(13,Te=je.buffer),"tolerance"in je&&c(14,Ce=je.tolerance),"$$scope"in je&&c(18,f=je.$$scope)},s.$$.update=()=>{s.$$.dirty&1024&&Co(Re,k=re,k),s.$$.dirty&196593&&_&&d!==D&&(Co(ze,d=D,d),Jv(_,d,Hc({type:"geojson",data:F,filter:V,lineMetrics:ne,generateId:j,promoteId:N,cluster:!!re,clusterMinPoints:re==null?void 0:re.minPoints,clusterMaxZoom:re==null?void 0:re.maxZoom,clusterRadius:re==null?void 0:re.radius,clusterProperties:re==null?void 0:re.properties,maxzoom:Ae,attribution:we,buffer:Te,tolerance:Ce}),je=>_&&je===d,()=>{d&&(c(15,Oe=_==null?void 0:_.getSource(d)),c(16,Ze=!0))})),s.$$.dirty&131088&&(_==null||_.on("style.load",()=>{c(15,Oe=_==null?void 0:_.getSource(D))})),s.$$.dirty&98336&&Oe&&(Ze?c(16,Ze=!1):Oe.setData(F)),s.$$.dirty&33792&&(Oe==null||Oe.setClusterOptions(Hc({cluster:!!re,clusterMaxZoom:re==null?void 0:re.maxZoom,clusterRadius:re==null?void 0:re.radius})))},[d,ke,Re,ze,D,F,j,N,V,ne,re,Ae,we,Te,Ce,Oe,Ze,_,f,I]}class _w extends qn{constructor(o){super(),Vn(this,o,yw,gw,gn,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}}function vw(s,o,c){let d;const{map:_}=Ol();Ln(s,_,V=>c(8,d=V));let{position:k="top-left"}=o,{positionOptions:I=void 0}=o,{fitBoundsOptions:f=void 0}=o,{trackUserLocation:D=!1}=o,{showAccuracyCircle:F=!0}=o,{showUserLocation:j=!0}=o,{control:N=null}=o;return Ro(()=>{d!=null&&d.loaded()&&N&&d.removeControl(N)}),s.$$set=V=>{"position"in V&&c(2,k=V.position),"positionOptions"in V&&c(3,I=V.positionOptions),"fitBoundsOptions"in V&&c(4,f=V.fitBoundsOptions),"trackUserLocation"in V&&c(5,D=V.trackUserLocation),"showAccuracyCircle"in V&&c(6,F=V.showAccuracyCircle),"showUserLocation"in V&&c(7,j=V.showUserLocation),"control"in V&&c(1,N=V.control)},s.$$.update=()=>{s.$$.dirty&510&&d&&!N&&(c(1,N=new fs.GeolocateControl({positionOptions:I,fitBoundsOptions:f,trackUserLocation:D,showAccuracyCircle:F,showUserLocation:j})),d.addControl(N,k))},[_,N,k,I,f,D,F,j,d]}class xw extends qn{constructor(o){super(),Vn(this,o,vw,null,gn,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function bw(s){let o;const c=s[15].default,d=Po(c,s,s[23],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&8388608)&&Ao(d,c,_,_[23],o?Lo(c,_[23],k,null):Mo(_[23]),null)},i(_){o||(Bt(d,_),o=!0)},o(_){$t(d,_),o=!1},d(_){d&&d.d(_)}}}function ww(s){let o,c,d;function _(I){s[16](I)}let k={id:s[1],type:"line",source:s[2],sourceLayer:s[3],beforeId:s[4],beforeLayerType:s[5],paint:s[6],layout:s[7],filter:s[8],minzoom:s[9],maxzoom:s[10],hoverCursor:s[11],manageHoverState:s[12],eventsIfTopMost:s[13],interactive:s[14],$$slots:{default:[bw]},$$scope:{ctx:s}};return s[0]!==void 0&&(k.hovered=s[0]),o=new Yv({props:k}),pa.push(()=>Df(o,"hovered",_)),o.$on("click",s[17]),o.$on("dblclick",s[18]),o.$on("contextmenu",s[19]),o.$on("mouseenter",s[20]),o.$on("mousemove",s[21]),o.$on("mouseleave",s[22]),{c(){un(o.$$.fragment)},m(I,f){rn(o,I,f),d=!0},p(I,[f]){const D={};f&2&&(D.id=I[1]),f&4&&(D.source=I[2]),f&8&&(D.sourceLayer=I[3]),f&16&&(D.beforeId=I[4]),f&32&&(D.beforeLayerType=I[5]),f&64&&(D.paint=I[6]),f&128&&(D.layout=I[7]),f&256&&(D.filter=I[8]),f&512&&(D.minzoom=I[9]),f&1024&&(D.maxzoom=I[10]),f&2048&&(D.hoverCursor=I[11]),f&4096&&(D.manageHoverState=I[12]),f&8192&&(D.eventsIfTopMost=I[13]),f&16384&&(D.interactive=I[14]),f&8388608&&(D.$$scope={dirty:f,ctx:I}),!c&&f&1&&(c=!0,D.hovered=I[0],Rf(()=>c=!1)),o.$set(D)},i(I){d||(Bt(o.$$.fragment,I),d=!0)},o(I){$t(o.$$.fragment,I),d=!1},d(I){sn(o,I)}}}function kw(s,o,c){let{$$slots:d={},$$scope:_}=o,{id:k=eh("line")}=o,{source:I=void 0}=o,{sourceLayer:f=void 0}=o,{beforeId:D=void 0}=o,{beforeLayerType:F=void 0}=o,{paint:j}=o,{layout:N=void 0}=o,{filter:V=void 0}=o,{minzoom:ne=void 0}=o,{maxzoom:re=void 0}=o,{hoverCursor:Ae=void 0}=o,{manageHoverState:we=!1}=o,{hovered:Te=null}=o,{eventsIfTopMost:Ce=!1}=o,{interactive:ke=!0}=o;function Re(Se){Te=Se,c(0,Te)}function ze(Se){cs.call(this,s,Se)}function Oe(Se){cs.call(this,s,Se)}function Ze(Se){cs.call(this,s,Se)}function je(Se){cs.call(this,s,Se)}function Ve(Se){cs.call(this,s,Se)}function st(Se){cs.call(this,s,Se)}return s.$$set=Se=>{"id"in Se&&c(1,k=Se.id),"source"in Se&&c(2,I=Se.source),"sourceLayer"in Se&&c(3,f=Se.sourceLayer),"beforeId"in Se&&c(4,D=Se.beforeId),"beforeLayerType"in Se&&c(5,F=Se.beforeLayerType),"paint"in Se&&c(6,j=Se.paint),"layout"in Se&&c(7,N=Se.layout),"filter"in Se&&c(8,V=Se.filter),"minzoom"in Se&&c(9,ne=Se.minzoom),"maxzoom"in Se&&c(10,re=Se.maxzoom),"hoverCursor"in Se&&c(11,Ae=Se.hoverCursor),"manageHoverState"in Se&&c(12,we=Se.manageHoverState),"hovered"in Se&&c(0,Te=Se.hovered),"eventsIfTopMost"in Se&&c(13,Ce=Se.eventsIfTopMost),"interactive"in Se&&c(14,ke=Se.interactive),"$$scope"in Se&&c(23,_=Se.$$scope)},[Te,k,I,f,D,F,j,N,V,ne,re,Ae,we,Ce,ke,d,Re,ze,Oe,Ze,je,Ve,st,_]}class Gp extends qn{constructor(o){super(),Vn(this,o,kw,ww,gn,{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 Sw(s,o,c){let d;const _=Mf();let{layer:k=void 0}=o;const{map:I}=Ol();Ln(s,I,j=>c(2,d=j));function f(j){_(j.type,{...j,map:I})}const D=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],F=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return Ro(()=>{if(d)if(k)for(const j of D)d.off(j,k,f);else for(const j of F)d.off(j,f)}),s.$$set=j=>{"layer"in j&&c(1,k=j.layer)},s.$$.update=()=>{if(s.$$.dirty&6&&d)if(k)for(const j of D)d.on(j,k,f);else for(const j of F)d.on(j,f)},[I,k,d]}class Iw extends qn{constructor(o){super(),Vn(this,o,Sw,null,gn,{layer:1})}}function Ew(s){let o=s.getCenter(),c=Math.round(s.getZoom()*100)/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,d),k=Math.round(o.lat*_)/_,I=Math.round(o.lng*_)/_,f=`${c}/${k}/${I}`,D=s.getBearing(),F=s.getPitch();return(D||F)&&(f+=`/${Math.round(D*10)/10}`),F&&(f+=`/${Math.round(F)}`),`#${f}`}function Tw(s){return s.replace("#","").split("/").map(parseFloat)}var mu=Zp;function Zp(s,o){return s===o||s!==s&&o!==o?!0:typeof s!=typeof o||{}.toString.call(s)!={}.toString.call(o)||s!==Object(s)||!s?!1:Array.isArray(s)?hy(s,o):{}.toString.call(s)=="[object Set]"?hy(Array.from(s),Array.from(o)):{}.toString.call(s)=="[object Object]"?Pw(s,o):Cw(s,o)}function Cw(s,o){return s.toString()===o.toString()}function hy(s,o){var c=s.length;if(c!=o.length)return!1;for(var d=0;dc(6,d=j));let{position:k="top-left"}=o,{showCompass:I=!0}=o,{showZoom:f=!0}=o,{visualizePitch:D=!1}=o,F=null;return Ro(()=>{d!=null&&d.loaded()&&F&&d.removeControl(F)}),s.$$set=j=>{"position"in j&&c(1,k=j.position),"showCompass"in j&&c(2,I=j.showCompass),"showZoom"in j&&c(3,f=j.showZoom),"visualizePitch"in j&&c(4,D=j.visualizePitch)},s.$$.update=()=>{s.$$.dirty&126&&d&&!F&&(c(5,F=new fs.NavigationControl({showCompass:I,showZoom:f,visualizePitch:D})),d.addControl(F,k))},[_,k,I,f,D,F,d]}class Aw extends qn{constructor(o){super(),Vn(this,o,Lw,null,gn,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function Mw(s,o,c){let d;const{map:_}=Ol();Ln(s,_,F=>c(5,d=F));let{position:k="bottom-left"}=o,{maxWidth:I=void 0}=o,{unit:f="metric"}=o,D=null;return Ro(()=>{d!=null&&d.loaded()&&D&&d.removeControl(D)}),s.$$set=F=>{"position"in F&&c(1,k=F.position),"maxWidth"in F&&c(2,I=F.maxWidth),"unit"in F&&c(3,f=F.unit)},s.$$.update=()=>{s.$$.dirty&62&&d&&!D&&(c(4,D=new fs.ScaleControl({maxWidth:I,unit:f})),d.addControl(D,k))},[_,k,I,f,D,d]}class Rw extends qn{constructor(o){super(),Vn(this,o,Mw,null,gn,{position:1,maxWidth:2,unit:3})}}const{window:Dw}=Ob,zw=s=>({map:s[0]&16,loadedImages:s[0]&32,allImagesLoaded:s[0]&64}),fy=s=>({map:s[4],loadedImages:s[5],allImagesLoaded:s[6]});function dy(s){let o,c,d=s[3]&&py(s);const _=s[40].default,k=Po(_,s,s[39],fy);return{c(){d&&d.c(),o=qt(),k&&k.c()},m(I,f){d&&d.m(I,f),Tt(I,o,f),k&&k.m(I,f),c=!0},p(I,f){I[3]?d?(d.p(I,f),f[0]&8&&Bt(d,1)):(d=py(I),d.c(),Bt(d,1),d.m(o.parentNode,o)):d&&(ds(),$t(d,1,1,()=>{d=null}),ps()),k&&k.p&&(!c||f[0]&112|f[1]&256)&&Ao(k,_,I,I[39],c?Lo(_,I[39],f,zw):Mo(I[39]),fy)},i(I){c||(Bt(d),Bt(k,I),c=!0)},o(I){$t(d),$t(k,I),c=!1},d(I){I&&St(o),d&&d.d(I),k&&k.d(I)}}}function py(s){let o,c,d,_,k,I,f,D;return o=new Aw({props:{position:s[7]}}),d=new xw({props:{position:s[7],fitBoundsOptions:{maxZoom:12}}}),k=new mw({props:{position:s[7]}}),f=new Rw({props:{position:s[7]}}),{c(){un(o.$$.fragment),c=qt(),un(d.$$.fragment),_=qt(),un(k.$$.fragment),I=qt(),un(f.$$.fragment)},m(F,j){rn(o,F,j),Tt(F,c,j),rn(d,F,j),Tt(F,_,j),rn(k,F,j),Tt(F,I,j),rn(f,F,j),D=!0},p(F,j){const N={};j[0]&128&&(N.position=F[7]),o.$set(N);const V={};j[0]&128&&(V.position=F[7]),d.$set(V);const ne={};j[0]&128&&(ne.position=F[7]),k.$set(ne);const re={};j[0]&128&&(re.position=F[7]),f.$set(re)},i(F){D||(Bt(o.$$.fragment,F),Bt(d.$$.fragment,F),Bt(k.$$.fragment,F),Bt(f.$$.fragment,F),D=!0)},o(F){$t(o.$$.fragment,F),$t(d.$$.fragment,F),$t(k.$$.fragment,F),$t(f.$$.fragment,F),D=!1},d(F){F&&(St(c),St(_),St(I)),sn(o,F),sn(d,F),sn(k,F),sn(f,F)}}}function Nw(s){let o,c,d,_,k,I=s[4]&&s[0]&&dy(s);return{c(){o=mt("div"),I&&I.c(),An(o,"class",c=ty(s[2])+" svelte-p00lfq"),An(o,"data-testid","map-container"),iy(o,"expand-map",!s[2])},m(f,D){Tt(f,o,D),I&&I.m(o,null),s[41](o),d=!0,_||(k=[xr(Dw,"hashchange",s[11]),Nb(s[10].call(null,o))],_=!0)},p(f,D){f[4]&&f[0]?I?(I.p(f,D),D[0]&17&&Bt(I,1)):(I=dy(f),I.c(),Bt(I,1),I.m(o,null)):I&&(ds(),$t(I,1,1,()=>{I=null}),ps()),(!d||D[0]&4&&c!==(c=ty(f[2])+" svelte-p00lfq"))&&An(o,"class",c),(!d||D[0]&4)&&iy(o,"expand-map",!f[2])},i(f){d||(Bt(I),d=!0)},o(f){$t(I),d=!1},d(f){f&&St(o),I&&I.d(),s[41](null),_=!1,ma(k)}}}function Ow(s,o,c){let d,_,k,I,{$$slots:f={},$$scope:D}=o,{map:F=null}=o,{mapContainer:j=void 0}=o,{class:N=void 0}=o,{style:V}=o,{diffStyleUpdates:ne=!1}=o,{center:re=void 0}=o,{zoom:Ae=void 0}=o,{pitch:we=0}=o,{bearing:Te=0}=o,{bounds:Ce=void 0}=o,{hash:ke=!1}=o,{updateHash:Re=xe=>{window.history.replaceState(window.history.state,"",xe)}}=o,{loaded:ze=!1}=o,{minZoom:Oe=0}=o,{maxZoom:Ze=22}=o,{antialias:je=void 0}=o,{zoomOnDoubleClick:Ve=!0}=o,{locale:st=void 0}=o,{interactive:Se=!0}=o,{attributionControl:Lt=!0}=o,{cooperativeGestures:_t=!1}=o,{preserveDrawingBuffer:We=!1}=o,{maxBounds:dt=void 0}=o,{images:bt=[]}=o,{standardControls:lt=!1}=o,{filterLayers:It=void 0}=o,{transformRequest:Wt=void 0}=o;const it=Mf(),{map:Ft,loadedImages:Ut}=ew();Ln(s,Ft,xe=>c(4,k=xe)),Ln(s,Ut,xe=>c(5,I=xe));let Gt=new Set;async function et(xe,Dt=!1){if(k&&!(!k.loaded()&&!Dt))if("url"in xe){Gt.add(xe.id);try{let Ke=await k.loadImage(xe.url);k==null||k.addImage(xe.id,Ke.data,xe.options),I.add(xe.id),Ut.set(I)}catch(Ke){it("error",Ke)}finally{Gt.delete(xe.id)}}else k.addImage(xe.id,xe.data,xe.options),I.add(xe.id),Ut.set(I)}let Ot,pt,vt,_e;function vi(xe){return yt(),Co(Ft,k=new fs.Map(Hc({container:xe,style:V,locale:st,center:re,zoom:Ae,pitch:we,bearing:Te,minZoom:Oe,maxZoom:Ze,antialias:je,interactive:Se,preserveDrawingBuffer:We,maxBounds:dt,bounds:Ce,attributionControl:Lt,transformRequest:Wt,cooperativeGestures:_t})),k),k.on("load",Dt=>{Dt.target.getContainer().setAttribute("data-testid","map"),Dt.target.getCanvas().setAttribute("data-testid","map-canvas"),c(0,ze=!0),it("load",k)}),k.on("error",Dt=>it("error",{...Dt,map:k})),k.on("movestart",Dt=>it("movestart",{...Dt,map:k})),k.on("moveend",Dt=>{if(c(12,re=Dt.target.getCenter()),c(13,Ae=Dt.target.getZoom()),c(14,we=Dt.target.getPitch()),c(15,Te=Dt.target.getBearing()),c(16,Ce=Dt.target.getBounds()),it("moveend",{...Dt,map:k}),ke){let Ke=new URL(window.location.href.replace(/(#.+)?$/,Ew(k)));Re(Ke)}}),k.on("click",Dt=>it("click",{...Dt,map:k})),k.on("dblclick",Dt=>it("dblclick",{...Dt,map:k})),k.on("contextmenu",Dt=>it("contextmenu",{...Dt,map:k})),k.on("zoomstart",Dt=>it("zoomstart",{...Dt,map:k})),k.on("zoom",Dt=>{it("zoom",{...Dt,map:k})}),k.on("zoomend",Dt=>{it("zoomend",{...Dt,map:k})}),k.on("style.load",()=>{if(k){const Dt=k.getStyle();if(c(36,Ot=Dt.layers.map(Ke=>Ke.id)),c(37,pt=Object.keys(Dt.sources)),_e)for(const[Ke,Ne]of Object.entries(_e))k.addSource(Ke,Ne);if(vt)for(const Ke of vt)k.addLayer(Ke);for(const Ke of bt)et(Ke,!0)}}),k.on("styledata",Dt=>{if(k&&It){const Ke=k.getStyle().layers;if(Ke)for(let Ne of Ke)It(Ne)||k.setLayoutProperty(Ne.id,"visibility","none")}it("styledata",{...Dt,map:k})}),{destroy(){c(0,ze=!1),k==null||k.remove(),Co(Ft,k=null,k)}}}let Jt=V;function yt(){if(ke){let xe=Tw(window.location.hash);xe.length>=3&&(c(13,Ae=xe[0]),c(12,re=[xe[2],xe[1]])),xe.length==5&&(c(15,Te=xe[3]),c(14,we=xe[4]))}}function he(xe){pa[xe?"unshift":"push"](()=>{j=xe,c(1,j)})}return s.$$set=xe=>{"map"in xe&&c(17,F=xe.map),"mapContainer"in xe&&c(1,j=xe.mapContainer),"class"in xe&&c(2,N=xe.class),"style"in xe&&c(18,V=xe.style),"diffStyleUpdates"in xe&&c(19,ne=xe.diffStyleUpdates),"center"in xe&&c(12,re=xe.center),"zoom"in xe&&c(13,Ae=xe.zoom),"pitch"in xe&&c(14,we=xe.pitch),"bearing"in xe&&c(15,Te=xe.bearing),"bounds"in xe&&c(16,Ce=xe.bounds),"hash"in xe&&c(20,ke=xe.hash),"updateHash"in xe&&c(21,Re=xe.updateHash),"loaded"in xe&&c(0,ze=xe.loaded),"minZoom"in xe&&c(22,Oe=xe.minZoom),"maxZoom"in xe&&c(23,Ze=xe.maxZoom),"antialias"in xe&&c(24,je=xe.antialias),"zoomOnDoubleClick"in xe&&c(25,Ve=xe.zoomOnDoubleClick),"locale"in xe&&c(26,st=xe.locale),"interactive"in xe&&c(27,Se=xe.interactive),"attributionControl"in xe&&c(28,Lt=xe.attributionControl),"cooperativeGestures"in xe&&c(29,_t=xe.cooperativeGestures),"preserveDrawingBuffer"in xe&&c(30,We=xe.preserveDrawingBuffer),"maxBounds"in xe&&c(31,dt=xe.maxBounds),"images"in xe&&c(32,bt=xe.images),"standardControls"in xe&&c(3,lt=xe.standardControls),"filterLayers"in xe&&c(33,It=xe.filterLayers),"transformRequest"in xe&&c(34,Wt=xe.transformRequest),"$$scope"in xe&&c(39,D=xe.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&8&&c(7,d=typeof lt=="boolean"?void 0:lt),s.$$.dirty[0]&16&&c(17,F=k),s.$$.dirty[0]&786448|s.$$.dirty[1]&224&&k&&!mu(V,Jt)){const xe=k.getStyle();if(Ot&&(vt=xe.layers.filter(Dt=>!Ot.includes(Dt.id))),pt){const Dt=Object.keys(xe.sources).filter(Ke=>!pt.includes(Ke));_e={};for(const Ke of Dt)_e[Ke]=xe.sources[Ke]}c(38,Jt=V),k.setStyle(V,{diff:ne}),Co(Ut,I=new Set,I),c(35,Gt=new Set)}if(s.$$.dirty[0]&49|s.$$.dirty[1]&18&&ze&&k!=null&&k.loaded())for(let xe of bt)!I.has(xe.id)&&!Gt.has(xe.id)&&!k.hasImage(xe.id)&&et(xe);if(s.$$.dirty[0]&32|s.$$.dirty[1]&2&&c(6,_=bt.every(xe=>I.has(xe.id))),s.$$.dirty[0]&61456&&k){let xe={};re!=null&&!mu(re,k==null?void 0:k.getCenter())&&(xe.center=re),Ae!=null&&!mu(Ae,k==null?void 0:k.getZoom())&&(xe.zoom=Ae),Te!=null&&!mu(Te,k==null?void 0:k.getBearing())&&(xe.bearing=Te),we!=null&&!mu(we,k==null?void 0:k.getPitch())&&(xe.pitch=we),Object.keys(xe).length&&k.easeTo(xe)}s.$$.dirty[0]&65552&&Ce&&!mu(Ce,k==null?void 0:k.getBounds())&&(k==null||k.fitBounds(Ce)),s.$$.dirty[0]&33554448&&(Ve?k==null||k.doubleClickZoom.enable():k==null||k.doubleClickZoom.disable())},[ze,j,N,lt,k,I,_,d,Ft,Ut,vi,yt,re,Ae,we,Te,Ce,F,V,ne,ke,Re,Oe,Ze,je,Ve,st,Se,Lt,_t,We,dt,bt,It,Wt,Gt,Ot,pt,Jt,D,f,he]}class Fw extends qn{constructor(o){super(),Vn(this,o,Ow,Nw,gn,{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 Bw=s=>({features:s[0]&16,data:s[0]&16,map:s[0]&4,close:s[0]&1}),my=s=>{var o;return{features:s[4],data:((o=s[4])==null?void 0:o[0])??null,map:s[2],close:s[31]}};function gy(s){var _;let o,c,d=(((_=s[4])==null?void 0:_.length)||s[3]instanceof fs.Marker)&&yy(s);return{c(){o=mt("div"),d&&d.c()},m(k,I){Tt(k,o,I),d&&d.m(o,null),s[32](o),c=!0},p(k,I){var f;(f=k[4])!=null&&f.length||k[3]instanceof fs.Marker?d?(d.p(k,I),I[0]&24&&Bt(d,1)):(d=yy(k),d.c(),Bt(d,1),d.m(o,null)):d&&(ds(),$t(d,1,1,()=>{d=null}),ps())},i(k){c||(Bt(d),c=!0)},o(k){$t(d),c=!1},d(k){k&&St(o),d&&d.d(),s[32](null)}}}function yy(s){let o;const c=s[30].default,d=Po(c,s,s[29],my);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k[0]&536870933)&&Ao(d,c,_,_[29],o?Lo(c,_[29],k,Bw):Mo(_[29]),my)},i(_){o||(Bt(d,_),o=!0)},o(_){$t(d,_),o=!1},d(_){d&&d.d(_)}}}function jw(s){let o,c,d=s[9].default&&gy(s);return{c(){d&&d.c(),o=Yr()},m(_,k){d&&d.m(_,k),Tt(_,o,k),c=!0},p(_,k){_[9].default?d?(d.p(_,k),k[0]&512&&Bt(d,1)):(d=gy(_),d.c(),Bt(d,1),d.m(o.parentNode,o)):d&&(ds(),$t(d,1,1,()=>{d=null}),ps())},i(_){c||(Bt(d),c=!0)},o(_){$t(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function Uw(s,o,c){let d,_,k,I,f,D,{$$slots:F={},$$scope:j}=o;const N=zb(F);let{closeButton:V=void 0}=o,{closeOnClickOutside:ne=!0}=o,{closeOnClickInside:re=!1}=o,{closeOnMove:Ae=!1}=o,{openOn:we="click"}=o,{openIfTopMost:Te=!0}=o,{focusAfterOpen:Ce=!0}=o,{anchor:ke=void 0}=o,{offset:Re=void 0}=o,{popupClass:ze=void 0}=o,{maxWidth:Oe=void 0}=o,{lngLat:Ze=void 0}=o,{html:je=void 0}=o,{open:Ve=!1}=o;const st=Mf(),{map:Se,popupTarget:Lt,layerEvent:_t,layer:We,eventTopMost:dt}=Ol();Ln(s,Se,Ke=>c(2,k=Ke)),Ln(s,Lt,Ke=>c(3,f=Ke)),Ln(s,_t,Ke=>c(28,I=Ke)),Ln(s,We,Ke=>c(35,D=Ke));const bt=["click","dblclick","contextmenu"];let lt,It=!1,Wt;function it(){if(!lt)return;let Ke=lt.getElement();!Ke||Ke===Wt||(Wt=Ke,we==="hover"&&(Wt.style.pointerEvents="none"),Wt.addEventListener("mouseenter",()=>{c(24,It=!0)},{passive:!0}),Wt.addEventListener("mouseleave",()=>{c(24,It=!1)},{passive:!0}),Wt.addEventListener("click",()=>{re&&c(0,Ve=!1)},{passive:!0}))}jb(()=>{if(k)return k.on("click",yt),k.on("contextmenu",yt),typeof f=="string"&&(k.on("click",f,Ot),k.on("dblclick",f,Ot),k.on("contextmenu",f,Ot),k.on("mousemove",f,Jt),k.on("mouseleave",f,vi),k.on("touchstart",f,vt),k.on("touchend",f,_e)),()=>{k!=null&&k.loaded()&&(lt==null||lt.remove(),k.off("click",yt),k.off("contextmenu",yt),f instanceof fs.Marker?f.getPopup()===lt&&f.setPopup(void 0):typeof f=="string"&&(k.off("click",f,Ot),k.off("dblclick",f,Ot),k.off("contextmenu",f,Ot),k.off("mousemove",f,Jt),k.off("mouseleave",f,vi),k.off("touchstart",f,vt),k.off("touchend",f,_e)))}});function Ft(Ke){return Te?!("marker"in Ke)&&!iw(Ke)&&dt(Ke)!==D:!1}let Ut=null,Gt="normal";function et(Ke){"layerType"in Ke&&Ke.layerType==="deckgl"?(c(10,Ze=Ke.coordinate),c(4,Ut=Ke.object?[Ke.object]:null)):(c(10,Ze=Ke.lngLat),c(4,Ut=Ke.features??[]))}function Ot(Ke){Ke.type!==we||Ft(Ke)||(et(Ke),setTimeout(()=>c(0,Ve=!0)))}let pt=null;function vt(Ke){pt=Ke.point}function _e(Ke){if(!pt||we!=="hover")return;let Ne=pt.dist(Ke.point);pt=null,Ne<3&&(c(10,Ze=Ke.lngLat),c(4,Ut=Ke.features??[]),lt.isOpen()?c(25,Gt="justOpened"):(c(25,Gt="opening"),c(0,Ve=!0)))}function vi(Ke){we!=="hover"||pt||Gt!=="normal"||(c(0,Ve=!1),c(4,Ut=null))}function Jt(Ke){if(!(we!=="hover"||pt||Gt!=="normal")){if(Ft(Ke)){c(0,Ve=!1),c(4,Ut=null);return}c(0,Ve=!0),c(4,Ut=Ke.features??[]),c(10,Ze=Ke.lngLat)}}function yt(Ke){if(Gt==="justOpened"){c(25,Gt="normal");return}if(!ne)return;let Ne=[Wt,f instanceof fs.Marker?f==null?void 0:f.getElement():null];Ve&<.isOpen()&&!Ne.some(Xi=>Xi==null?void 0:Xi.contains(Ke.originalEvent.target))&&(Ke.type==="contextmenu"&&we==="contextmenu"||Ke.type!=="contextmenu")&&c(0,Ve=!1)}Ro(()=>{k&&(lt!=null&<.isOpen())&<.remove()});let he;const xe=()=>c(0,Ve=!1);function Dt(Ke){pa[Ke?"unshift":"push"](()=>{he=Ke,c(1,he)})}return s.$$set=Ke=>{"closeButton"in Ke&&c(11,V=Ke.closeButton),"closeOnClickOutside"in Ke&&c(12,ne=Ke.closeOnClickOutside),"closeOnClickInside"in Ke&&c(13,re=Ke.closeOnClickInside),"closeOnMove"in Ke&&c(14,Ae=Ke.closeOnMove),"openOn"in Ke&&c(15,we=Ke.openOn),"openIfTopMost"in Ke&&c(16,Te=Ke.openIfTopMost),"focusAfterOpen"in Ke&&c(17,Ce=Ke.focusAfterOpen),"anchor"in Ke&&c(18,ke=Ke.anchor),"offset"in Ke&&c(19,Re=Ke.offset),"popupClass"in Ke&&c(20,ze=Ke.popupClass),"maxWidth"in Ke&&c(21,Oe=Ke.maxWidth),"lngLat"in Ke&&c(10,Ze=Ke.lngLat),"html"in Ke&&c(22,je=Ke.html),"open"in Ke&&c(0,Ve=Ke.open),"$$scope"in Ke&&c(29,j=Ke.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&14336&&c(27,d=V??(!ne&&!re)),s.$$.dirty[0]&146685952&&(lt||(c(23,lt=new fs.Popup({closeButton:d,closeOnClick:!1,closeOnMove:Ae,focusAfterOpen:Ce,maxWidth:Oe,className:ze,anchor:ke,offset:Re})),Wt=lt.getElement(),lt.on("open",()=>{c(0,Ve=!0),it(),st("open",lt)}),lt.on("close",()=>{c(0,Ve=!1),st("close",lt)}),lt.on("hover",()=>{st("hover",lt)}))),s.$$.dirty[0]&8421384&<&&f instanceof fs.Marker&&(we==="click"?f.setPopup(lt):f.getPopup()===lt&&f.setPopup(void 0)),s.$$.dirty[0]&268468224&&bt.includes(we)&&(I==null?void 0:I.type)===we&&(Ot(I),Co(_t,I=null,I)),s.$$.dirty[0]&268468224&&c(26,_=we==="hover"&&((I==null?void 0:I.type)==="mousemove"||(I==null?void 0:I.type)==="mouseenter")),s.$$.dirty[0]&352354304&&we==="hover"&&_t&&(_&&I&&et(I),c(0,Ve=(_||It)??!1)),s.$$.dirty[0]&12582914&&(he?lt.setDOMContent(he):je&<.setHTML(je)),s.$$.dirty[0]&8389632&&Ze&<.setLngLat(Ze),s.$$.dirty[0]&41943045&&k){let Ke=lt.isOpen();Ve&&!Ke?(lt.addTo(k),Gt==="opening"&&c(25,Gt="justOpened")):!Ve&&Ke&<.remove()}},[Ve,he,k,f,Ut,Se,Lt,_t,We,N,Ze,V,ne,re,Ae,we,Te,Ce,ke,Re,ze,Oe,je,lt,It,Gt,_,d,I,j,F,xe,Dt]}class Wp extends qn{constructor(o){super(),Vn(this,o,Uw,jw,gn,{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 Iu=Math.pow,Ar=(s,o,c)=>new Promise((d,_)=>{var k=D=>{try{f(c.next(D))}catch(F){_(F)}},I=D=>{try{f(c.throw(D))}catch(F){_(F)}},f=D=>D.done?d(D.value):Promise.resolve(D.value).then(k,I);f((c=c.apply(s,o)).next())}),hs=Uint8Array,wu=Uint16Array,Vw=Int32Array,$v=new hs([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]),e0=new hs([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]),qw=new hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t0=function(s,o){for(var c=new wu(31),d=0;d<31;++d)c[d]=o+=1<>1|(Bi&21845)<<1,ca=(ca&52428)>>2|(ca&13107)<<2,ca=(ca&61680)>>4|(ca&3855)<<4,lp[Bi]=((ca&65280)>>8|(ca&255)<<8)>>1;var ca,Bi,Uc=function(s,o,c){for(var d=s.length,_=0,k=new wu(o);_>D]=F}else for(f=new wu(d),_=0;_>15-s[_]);return f},th=new hs(288);for(Bi=0;Bi<144;++Bi)th[Bi]=8;var Bi;for(Bi=144;Bi<256;++Bi)th[Bi]=9;var Bi;for(Bi=256;Bi<280;++Bi)th[Bi]=7;var Bi;for(Bi=280;Bi<288;++Bi)th[Bi]=8;var Bi,r0=new hs(32);for(Bi=0;Bi<32;++Bi)r0[Bi]=5;var Bi,Xw=Uc(th,9,1),Hw=Uc(r0,5,1),zd=function(s){for(var o=s[0],c=1;co&&(o=s[c]);return o},Hs=function(s,o,c){var d=o/8|0;return(s[d]|s[d+1]<<8)>>(o&7)&c},Nd=function(s,o){var c=o/8|0;return(s[c]|s[c+1]<<8|s[c+2]<<16)>>(o&7)},Yw=function(s){return(s+7)/8|0},Kw=function(s,o,c){(o==null||o<0)&&(o=0),(c==null||c>s.length)&&(c=s.length);var d=new hs(c-o);return d.set(s.subarray(o,c)),d},Jw=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],us=function(s,o,c){var d=new Error(o||Jw[s]);if(d.code=s,Error.captureStackTrace&&Error.captureStackTrace(d,us),!c)throw d;return d},Xp=function(s,o,c,d){var _=s.length,k=d?d.length:0;if(!_||o.f&&!o.l)return c||new hs(0);var I=!c||o.i!=2,f=o.i;c||(c=new hs(_*3));var D=function(Jt){var yt=c.length;if(Jt>yt){var he=new hs(Math.max(yt*2,Jt));he.set(c),c=he}},F=o.f||0,j=o.p||0,N=o.b||0,V=o.l,ne=o.d,re=o.m,Ae=o.n,we=_*8;do{if(!V){F=Hs(s,j,1);var Te=Hs(s,j+1,3);if(j+=3,Te)if(Te==1)V=Xw,ne=Hw,re=9,Ae=5;else if(Te==2){var ze=Hs(s,j,31)+257,Oe=Hs(s,j+10,15)+4,Ze=ze+Hs(s,j+5,31)+1;j+=14;for(var je=new hs(Ze),Ve=new hs(19),st=0;st>4;if(Ce<16)je[st++]=Ce;else{var dt=0,bt=0;for(Ce==16?(bt=3+Hs(s,j,3),j+=2,dt=je[st-1]):Ce==17?(bt=3+Hs(s,j,7),j+=3):Ce==18&&(bt=11+Hs(s,j,127),j+=7);bt--;)je[st++]=dt}}var lt=je.subarray(0,ze),It=je.subarray(ze);re=zd(lt),Ae=zd(It),V=Uc(lt,re,1),ne=Uc(It,Ae,1)}else us(1);else{var Ce=Yw(j)+4,ke=s[Ce-4]|s[Ce-3]<<8,Re=Ce+ke;if(Re>_){f&&us(0);break}I&&D(N+ke),c.set(s.subarray(Ce,Re),N),o.b=N+=ke,o.p=j=Re*8,o.f=F;continue}if(j>we){f&&us(0);break}}I&&D(N+131072);for(var Wt=(1<>4;if(j+=dt&15,j>we){f&&us(0);break}if(dt||us(2),Ut<256)c[N++]=Ut;else if(Ut==256){Ft=j,V=null;break}else{var Gt=Ut-254;if(Ut>264){var st=Ut-257,et=$v[st];Gt=Hs(s,j,(1<>4;Ot||us(3),j+=Ot&15;var It=Ww[pt];if(pt>3){var et=e0[pt];It+=Nd(s,j)&(1<we){f&&us(0);break}I&&D(N+131072);var vt=N+Gt;if(N>3&1)+(o>>4&1);d>0;d-=!s[c++]);return c+(o&2)},e2=function(s){var o=s.length;return(s[o-4]|s[o-3]<<8|s[o-2]<<16|s[o-1]<<24)>>>0},t2=function(s,o){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&us(6,"invalid zlib data"),(s[1]>>5&1)==+!o&&us(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function i2(s,o){return Xp(s,{i:2},o&&o.out,o&&o.dictionary)}function n2(s,o){var c=$w(s);return c+8>s.length&&us(6,"invalid gzip data"),Xp(s.subarray(c,-8),{i:2},o&&o.out||new hs(e2(s)),o&&o.dictionary)}function r2(s,o){return Xp(s.subarray(t2(s,o&&o.dictionary),-4),{i:2},o&&o.out,o&&o.dictionary)}function up(s,o){return s[0]==31&&s[1]==139&&s[2]==8?n2(s,o):(s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31?i2(s,o):r2(s,o)}var s2=typeof TextDecoder<"u"&&new TextDecoder,o2=0;try{s2.decode(Qw,{stream:!0}),o2=1}catch{}var s0=(s,o)=>s*Iu(2,o),Lc=(s,o)=>Math.floor(s/Iu(2,o)),af=(s,o)=>s0(s.getUint16(o+1,!0),8)+s.getUint8(o),o0=(s,o)=>s0(s.getUint32(o+2,!0),16)+s.getUint16(o,!0),a2=(s,o,c,d,_)=>{if(s!==d.getUint8(_))return s-d.getUint8(_);const k=af(d,_+1);if(o!==k)return o-k;const I=af(d,_+4);return c!==I?c-I:0},l2=(s,o,c,d)=>{const _=a0(s,o|128,c,d);return _?{z:o,x:c,y:d,offset:_[0],length:_[1],isDir:!0}:null},_y=(s,o,c,d)=>{const _=a0(s,o,c,d);return _?{z:o,x:c,y:d,offset:_[0],length:_[1],isDir:!1}:null},a0=(s,o,c,d)=>{let _=0,k=s.byteLength/17-1;for(;_<=k;){const I=k+_>>1,f=a2(o,c,d,s,I*17);if(f>0)_=I+1;else if(f<0)k=I-1;else return[o0(s,I*17+7),s.getUint32(I*17+13,!0)]}return null},u2=(s,o)=>s.isDir&&!o.isDir?1:!s.isDir&&o.isDir?-1:s.z!==o.z?s.z-o.z:s.x!==o.x?s.x-o.x:s.y-o.y,l0=(s,o)=>{const c=s.getUint8(o*17);return{z:c&127,x:af(s,o*17+1),y:af(s,o*17+4),offset:o0(s,o*17+7),length:s.getUint32(o*17+13,!0),isDir:c>>7===1}},vy=s=>{const o=[],c=new DataView(s);for(let d=0;d{s.sort(u2);const o=new ArrayBuffer(17*s.length),c=new Uint8Array(o);for(let d=0;d>8&255,c[d*17+3]=_.x>>16&255,c[d*17+4]=_.y&255,c[d*17+5]=_.y>>8&255,c[d*17+6]=_.y>>16&255,c[d*17+7]=_.offset&255,c[d*17+8]=Lc(_.offset,8)&255,c[d*17+9]=Lc(_.offset,16)&255,c[d*17+10]=Lc(_.offset,24)&255,c[d*17+11]=Lc(_.offset,32)&255,c[d*17+12]=Lc(_.offset,48)&255,c[d*17+13]=_.length&255,c[d*17+14]=_.length>>8&255,c[d*17+15]=_.length>>16&255,c[d*17+16]=_.length>>24&255}return o},h2=(s,o)=>{if(s.byteLength<17)return null;const c=s.byteLength/17,d=l0(s,c-1);if(d.isDir){const _=d.z,k=o.z-_,I=Math.trunc(o.x/(1<(o,c)=>{if(c instanceof AbortController)return s(o,c);const d=new AbortController;return s(o,d).then(_=>c(void 0,_.data,_.cacheControl||"",_.expires||""),_=>c(_)).catch(_=>c(_)),{cancel:()=>d.abort()}},m2=class{constructor(){this.tilev4=(s,o)=>Ar(this,null,function*(){if(s.type==="json"){const N=s.url.substr(10);let V=this.tiles.get(N);V||(V=new xy(N),this.tiles.set(N,V));const ne=yield V.getHeader();return{data:{tiles:[`${s.url}/{z}/{x}/{y}`],minzoom:ne.minZoom,maxzoom:ne.maxZoom,bounds:[ne.minLon,ne.minLat,ne.maxLon,ne.maxLat]}}}const c=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),d=s.url.match(c);if(!d)throw new Error("Invalid PMTiles protocol URL");const _=d[1];let k=this.tiles.get(_);k||(k=new xy(_),this.tiles.set(_,k));const I=d[2],f=d[3],D=d[4],F=yield k.getHeader(),j=yield k==null?void 0:k.getZxy(+I,+f,+D,o.signal);return j?{data:new Uint8Array(j.data),cacheControl:j.cacheControl,expires:j.expires}:F.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=p2(this.tilev4),this.tiles=new Map}add(s){this.tiles.set(s.source.getKey(),s)}get(s){return this.tiles.get(s)}};function gu(s,o){return(o>>>0)*4294967296+(s>>>0)}function g2(s,o){const c=o.buf;let d=c[o.pos++],_=(d&112)>>4;if(d<128||(d=c[o.pos++],_|=(d&127)<<3,d<128)||(d=c[o.pos++],_|=(d&127)<<10,d<128)||(d=c[o.pos++],_|=(d&127)<<17,d<128)||(d=c[o.pos++],_|=(d&127)<<24,d<128)||(d=c[o.pos++],_|=(d&1)<<31,d<128))return gu(s,_);throw new Error("Expected varint not more than 10 bytes")}function Ac(s){const o=s.buf;let c=o[s.pos++],d=c&127;return c<128||(c=o[s.pos++],d|=(c&127)<<7,c<128)||(c=o[s.pos++],d|=(c&127)<<14,c<128)||(c=o[s.pos++],d|=(c&127)<<21,c<128)?d:(c=o[s.pos],d|=(c&15)<<28,g2(d,s))}function y2(s,o,c,d){if(d===0){c===1&&(o[0]=s-1-o[0],o[1]=s-1-o[1]);const _=o[0];o[0]=o[1],o[1]=_}}var _2=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function v2(s,o,c){if(s>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(o>Iu(2,s)-1||c>Iu(2,s)-1)throw Error("tile x/y outside zoom level bounds");const d=_2[s],_=Iu(2,s);let k=0,I=0,f=0;const D=[o,c];let F=_/2;for(;F>0;)k=(D[0]&F)>0?1:0,I=(D[1]&F)>0?1:0,f+=F*F*(3*k^I),y2(F,D,k,I),F=F/2;return d+f}function c0(s,o){return Ar(this,null,function*(){if(o===1||o===0)return s;if(o===2){if(typeof globalThis.DecompressionStream>"u")return up(new Uint8Array(s));const c=new Response(s).body;if(!c)throw Error("Failed to read response stream");const d=c.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(d).arrayBuffer()}throw Error("Compression method not supported")})}var x2=127;function b2(s,o){let c=0,d=s.length-1;for(;c<=d;){const _=d+c>>1,k=o-s[_].tileId;if(k>0)c=_+1;else if(k<0)d=_-1;else return s[_]}return d>=0&&(s[d].runLength===0||o-s[d].tileId=300)throw Error(`Bad response code: ${D.status}`);const j=D.headers.get("Content-Length");if(D.status===200&&(!j||+j>o))throw _&&_.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield D.arrayBuffer(),etag:F||void 0,cacheControl:D.headers.get("Cache-Control")||void 0,expires:D.headers.get("Expires")||void 0}})}};function Ys(s,o){const c=s.getUint32(o+4,!0),d=s.getUint32(o+0,!0);return c*Iu(2,32)+d}function k2(s,o){const c=new DataView(s),d=c.getUint8(7);if(d>3)throw Error(`Archive is spec version ${d} but this library supports up to spec version 3`);return{specVersion:d,rootDirectoryOffset:Ys(c,8),rootDirectoryLength:Ys(c,16),jsonMetadataOffset:Ys(c,24),jsonMetadataLength:Ys(c,32),leafDirectoryOffset:Ys(c,40),leafDirectoryLength:Ys(c,48),tileDataOffset:Ys(c,56),tileDataLength:Ys(c,64),numAddressedTiles:Ys(c,72),numTileEntries:Ys(c,80),numTileContents:Ys(c,88),clustered:c.getUint8(96)===1,internalCompression:c.getUint8(97),tileCompression:c.getUint8(98),tileType:c.getUint8(99),minZoom:c.getUint8(100),maxZoom:c.getUint8(101),minLon:c.getInt32(102,!0)/1e7,minLat:c.getInt32(106,!0)/1e7,maxLon:c.getInt32(110,!0)/1e7,maxLat:c.getInt32(114,!0)/1e7,centerZoom:c.getUint8(118),centerLon:c.getInt32(119,!0)/1e7,centerLat:c.getInt32(123,!0)/1e7,etag:o}}function h0(s){const o={buf:new Uint8Array(s),pos:0},c=Ac(o),d=[];let _=0;for(let k=0;k0?d[k].offset=d[k-1].offset+d[k-1].length:d[k].offset=I-1}return d}function S2(s){const o=new DataView(s);return o.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):o.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var cp=class extends Error{};function I2(s,o){return Ar(this,null,function*(){const c=yield s.getBytes(0,16384);if(new DataView(c.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(S2(c.data)<3)return[yield u0.getHeader(s)];const _=c.data.slice(0,x2),k=k2(_,c.etag),I=c.data.slice(k.rootDirectoryOffset,k.rootDirectoryOffset+k.rootDirectoryLength),f=`${s.getKey()}|${k.etag||""}|${k.rootDirectoryOffset}|${k.rootDirectoryLength}`,D=h0(yield o(I,k.internalCompression));return[k,[f,D.length,D]]})}function E2(s,o,c,d,_){return Ar(this,null,function*(){const k=yield s.getBytes(c,d,void 0,_.etag),I=yield o(k.data,_.internalCompression),f=h0(I);if(f.length===0)throw new Error("Empty directory is invalid");return f})}var T2=class{constructor(s=100,o=!0,c=c0){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=s,this.counter=1,this.decompress=c}getHeader(s){return Ar(this,null,function*(){const o=s.getKey(),c=this.cache.get(o);if(c)return c.lastUsed=this.counter++,yield c.data;const d=new Promise((_,k)=>{I2(s,this.decompress).then(I=>{I[1]&&this.cache.set(I[1][0],{lastUsed:this.counter++,data:Promise.resolve(I[1][2])}),_(I[0]),this.prune()}).catch(I=>{k(I)})});return this.cache.set(o,{lastUsed:this.counter++,data:d}),d})}getDirectory(s,o,c,d){return Ar(this,null,function*(){const _=`${s.getKey()}|${d.etag||""}|${o}|${c}`,k=this.cache.get(_);if(k)return k.lastUsed=this.counter++,yield k.data;const I=new Promise((f,D)=>{E2(s,this.decompress,o,c,d).then(F=>{f(F),this.prune()}).catch(F=>{D(F)})});return this.cache.set(_,{lastUsed:this.counter++,data:I}),I})}getArrayBuffer(s,o,c,d){return Ar(this,null,function*(){const _=`${s.getKey()}|${d.etag||""}|${o}|${c}`,k=this.cache.get(_);if(k)return k.lastUsed=this.counter++,yield k.data;const I=new Promise((f,D)=>{s.getBytes(o,c,void 0,d.etag).then(F=>{f(F.data),this.cache.has(_),this.prune()}).catch(F=>{D(F)})});return this.cache.set(_,{lastUsed:this.counter++,data:I}),I})}prune(){if(this.cache.size>=this.maxCacheEntries){let s=1/0,o;this.cache.forEach((c,d)=>{c.lastUsed{this.getHeader(s).then(k=>{d(),this.invalidations.delete(o)}).catch(k=>{_(k)})});this.invalidations.set(o,c)})}},xy=class{constructor(s,o,c){typeof s=="string"?this.source=new w2(s):this.source=s,c?this.decompress=c:this.decompress=c0,o?this.cache=o:this.cache=new T2}getHeader(){return Ar(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(s,o,c,d){return Ar(this,null,function*(){const _=v2(s,o,c),k=yield this.cache.getHeader(this.source);if(k.specVersion<3)return u0.getZxy(k,this.source,this.cache,s,o,c,d);if(sk.maxZoom)return;let I=k.rootDirectoryOffset,f=k.rootDirectoryLength;for(let D=0;D<=3;D++){const F=yield this.cache.getDirectory(this.source,I,f,k),j=b2(F,_);if(j){if(j.runLength>0){const N=yield this.source.getBytes(k.tileDataOffset+j.offset,j.length,d,k.etag);return{data:yield this.decompress(N.data,k.tileCompression),cacheControl:N.cacheControl,expires:N.expires}}I=k.leafDirectoryOffset+j.offset,f=j.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(s,o,c,d){return Ar(this,null,function*(){try{return yield this.getZxyAttempt(s,o,c,d)}catch(_){if(_ instanceof cp)return this.cache.invalidate(this.source),yield this.getZxyAttempt(s,o,c,d);throw _}})}getMetadataAttempt(){return Ar(this,null,function*(){const s=yield this.cache.getHeader(this.source),o=yield this.source.getBytes(s.jsonMetadataOffset,s.jsonMetadataLength,void 0,s.etag),c=yield this.decompress(o.data,s.internalCompression),d=new TextDecoder("utf-8");return JSON.parse(d.decode(c))})}getMetadata(){return Ar(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(s){if(s instanceof cp)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw s}})}};function by(s){let o=s[0],c,d,_=wy(s);return{c(){_.c(),c=Yr()},m(k,I){_.m(k,I),Tt(k,c,I),d=!0},p(k,I){I&1&&gn(o,o=k[0])?(ds(),$t(_,1,1,bn),ps(),_=wy(k),_.c(),Bt(_,1),_.m(c.parentNode,c)):_.p(k,I)},i(k){d||(Bt(_),d=!0)},o(k){$t(_),d=!1},d(k){k&&St(c),_.d(k)}}}function wy(s){let o;const c=s[15].default,d=Po(c,s,s[14],null);return{c(){d&&d.c()},m(_,k){d&&d.m(_,k),o=!0},p(_,k){d&&d.p&&(!o||k&16384)&&Ao(d,c,_,_[14],o?Lo(c,_[14],k,null):Mo(_[14]),null)},i(_){o||(Bt(d,_),o=!0)},o(_){$t(d,_),o=!1},d(_){d&&d.d(_)}}}function C2(s){let o,c,d=s[0]&&by(s);return{c(){d&&d.c(),o=Yr()},m(_,k){d&&d.m(_,k),Tt(_,o,k),c=!0},p(_,[k]){_[0]?d?(d.p(_,k),k&1&&Bt(d,1)):(d=by(_),d.c(),Bt(d,1),d.m(o.parentNode,o)):d&&(ds(),$t(d,1,1,()=>{d=null}),ps())},i(_){c||(Bt(d),c=!0)},o(_){$t(d),c=!1},d(_){_&&St(o),d&&d.d(_)}}}function P2(s,o,c){let d,_,{$$slots:k={},$$scope:I}=o,{id:f=eh("vector")}=o,{url:D=null}=o,{tiles:F=null}=o,{promoteId:j=null}=o,{bounds:N=null}=o,{scheme:V=null}=o,{attribution:ne=null}=o,{minzoom:re=null}=o,{maxzoom:Ae=null}=o,{volatile:we=null}=o;if(D&&D.includes("pmtiles://")&&!fs.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let Re=new m2;fs.addProtocol("pmtiles",Re.tile)}const{map:Te,self:Ce}=Wv();Ln(s,Te,Re=>c(13,_=Re)),Ln(s,Ce,Re=>c(0,d=Re));let ke;return Ro(()=>{d&&_&&(Qv(Te,d,ke),Co(Ce,d=null,d),ke=void 0)}),s.$$set=Re=>{"id"in Re&&c(3,f=Re.id),"url"in Re&&c(4,D=Re.url),"tiles"in Re&&c(5,F=Re.tiles),"promoteId"in Re&&c(6,j=Re.promoteId),"bounds"in Re&&c(7,N=Re.bounds),"scheme"in Re&&c(8,V=Re.scheme),"attribution"in Re&&c(9,ne=Re.attribution),"minzoom"in Re&&c(10,re=Re.minzoom),"maxzoom"in Re&&c(11,Ae=Re.maxzoom),"volatile"in Re&&c(12,we=Re.volatile),"$$scope"in Re&&c(14,I=Re.$$scope)},s.$$.update=()=>{s.$$.dirty&16377&&_&&d!==f&&(Co(Ce,d=f,d),Jv(_,d,Hc({type:"vector",url:D,tiles:F,promoteId:j,bounds:N,scheme:V,attribution:ne,minzoom:re,maxzoom:Ae,volatile:we}),Re=>_&&Re===d,()=>{d&&(ke=_==null?void 0:_.getSource(d))})),s.$$.dirty&8200&&(_==null||_.on("style.load",()=>{ke=_==null?void 0:_.getSource(f)}))},[d,Te,Ce,f,D,F,j,N,V,ne,re,Ae,we,_,I,k]}class f0 extends qn{constructor(o){super(),Vn(this,o,P2,C2,gn,{id:3,url:4,tiles:5,promoteId:6,bounds:7,scheme:8,attribution:9,minzoom:10,maxzoom:11,volatile:12})}}const L2="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(L2);const A2=[{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"}],M2={decimalLatitude:40.123,decimalLongitude:-74.123},R2=[{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}],D2=[{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},{verbatimCoordinates:"53 16.3863,4 52.8171",verbatimLatitude:"53 16.3863",verbatimLongitude:"4 52.8171",decimalLatitude:53.273105,decimalLongitude:4.88029},{verbatimCoordinates:"50 8.2914,-5 2.4447",verbatimLatitude:"50 8.2914",verbatimLongitude:"-5 2.4447",decimalLatitude:50.13819,decimalLongitude:-5.040745},{verbatimCoordinates:"N 48° 30,6410', E 18° 57,4583'",verbatimLatitude:"N 48° 30,6410'",verbatimLongitude:"E 18° 57,4583'",decimalLatitude:48.51068,decimalLongitude:18.95764},{verbatimCoordinates:"1.23456, 18.33453",verbatimLatitude:"1.23456",verbatimLongitude:"18.33453",decimalLatitude:1.23456,decimalLongitude:18.33453}];function z2(){const s=[];return A2.forEach(o=>{o.decimalLatitude?s.push(o):s.push({...o,...M2})}),[...s,...R2,...D2]}const N2=z2();N2.map(s=>s.verbatimCoordinates);var Yc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d0(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function O2(s){if(s.__esModule)return s;var o=s.default;if(typeof o=="function"){var c=function d(){return this instanceof d?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};c.prototype=o.prototype}else c={};return Object.defineProperty(c,"__esModule",{value:!0}),Object.keys(s).forEach(function(d){var _=Object.getOwnPropertyDescriptor(s,d);Object.defineProperty(c,d,_.get?_:{enumerable:!0,get:function(){return s[d]}})}),c}var ky=Object.prototype.toString,p0=function(s){var o=ky.call(s),c=o==="[object Arguments]";return c||(c=o!=="[object Array]"&&s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&ky.call(s.callee)==="[object Function]"),c},Od,Sy;function F2(){if(Sy)return Od;Sy=1;var s;if(!Object.keys){var o=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=p0,_=Object.prototype.propertyIsEnumerable,k=!_.call({toString:null},"toString"),I=_.call(function(){},"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],D=function(V){var ne=V.constructor;return ne&&ne.prototype===V},F={$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},j=function(){if(typeof window>"u")return!1;for(var V in window)try{if(!F["$"+V]&&o.call(window,V)&&window[V]!==null&&typeof window[V]=="object")try{D(window[V])}catch{return!0}}catch{return!0}return!1}(),N=function(V){if(typeof window>"u"||!j)return D(V);try{return D(V)}catch{return!1}};s=function(V){var ne=V!==null&&typeof V=="object",re=c.call(V)==="[object Function]",Ae=d(V),we=ne&&c.call(V)==="[object String]",Te=[];if(!ne&&!re&&!Ae)throw new TypeError("Object.keys called on a non-object");var Ce=I&&re;if(we&&V.length>0&&!o.call(V,0))for(var ke=0;ke0)for(var Re=0;Re"u"||!ar?Pi:ar(Uint8Array),zl={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Pi:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pi:ArrayBuffer,"%ArrayIteratorPrototype%":yu&&ar?ar([][Symbol.iterator]()):Pi,"%AsyncFromSyncIteratorPrototype%":Pi,"%AsyncFunction%":bu,"%AsyncGenerator%":bu,"%AsyncGeneratorFunction%":bu,"%AsyncIteratorPrototype%":bu,"%Atomics%":typeof Atomics>"u"?Pi:Atomics,"%BigInt%":typeof BigInt>"u"?Pi:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pi:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pi:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pi:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":ok,"%eval%":eval,"%EvalError%":ak,"%Float32Array%":typeof Float32Array>"u"?Pi:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pi:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pi:FinalizationRegistry,"%Function%":y0,"%GeneratorFunction%":bu,"%Int8Array%":typeof Int8Array>"u"?Pi:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pi:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pi:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":yu&&ar?ar(ar([][Symbol.iterator]())):Pi,"%JSON%":typeof JSON=="object"?JSON:Pi,"%Map%":typeof Map>"u"?Pi:Map,"%MapIteratorPrototype%":typeof Map>"u"||!yu||!ar?Pi:ar(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pi:Promise,"%Proxy%":typeof Proxy>"u"?Pi:Proxy,"%RangeError%":lk,"%ReferenceError%":uk,"%Reflect%":typeof Reflect>"u"?Pi:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pi:Set,"%SetIteratorPrototype%":typeof Set>"u"||!yu||!ar?Pi:ar(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pi:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":yu&&ar?ar(""[Symbol.iterator]()):Pi,"%Symbol%":yu?Symbol:Pi,"%SyntaxError%":Tu,"%ThrowTypeError%":hk,"%TypedArray%":dk,"%TypeError%":Eu,"%Uint8Array%":typeof Uint8Array>"u"?Pi:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pi:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pi:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pi:Uint32Array,"%URIError%":ck,"%WeakMap%":typeof WeakMap>"u"?Pi:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pi:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pi:WeakSet};if(ar)try{null.error}catch(s){var pk=ar(ar(s));zl["%Error.prototype%"]=pk}var mk=function s(o){var c;if(o==="%AsyncFunction%")c=Bd("async function () {}");else if(o==="%GeneratorFunction%")c=Bd("function* () {}");else if(o==="%AsyncGeneratorFunction%")c=Bd("async function* () {}");else if(o==="%AsyncGenerator%"){var d=s("%AsyncGeneratorFunction%");d&&(c=d.prototype)}else if(o==="%AsyncIteratorPrototype%"){var _=s("%AsyncGenerator%");_&&ar&&(c=ar(_.prototype))}return zl[o]=c,c},Py={__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"]},ih=Kp,lf=g0,gk=ih.call(Function.call,Array.prototype.concat),yk=ih.call(Function.apply,Array.prototype.splice),Ly=ih.call(Function.call,String.prototype.replace),uf=ih.call(Function.call,String.prototype.slice),_k=ih.call(Function.call,RegExp.prototype.exec),vk=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,xk=/\\(\\)?/g,bk=function(s){var o=uf(s,0,1),c=uf(s,-1);if(o==="%"&&c!=="%")throw new Tu("invalid intrinsic syntax, expected closing `%`");if(c==="%"&&o!=="%")throw new Tu("invalid intrinsic syntax, expected opening `%`");var d=[];return Ly(s,vk,function(_,k,I,f){d[d.length]=I?Ly(f,xk,"$1"):k||_}),d},wk=function(s,o){var c=s,d;if(lf(Py,c)&&(d=Py[c],c="%"+d[0]+"%"),lf(zl,c)){var _=zl[c];if(_===bu&&(_=mk(c)),typeof _>"u"&&!o)throw new Eu("intrinsic "+s+" exists, but is not available. Please file an issue!");return{alias:d,name:c,value:_}}throw new Tu("intrinsic "+s+" does not exist!")},zo=function(s,o){if(typeof s!="string"||s.length===0)throw new Eu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof o!="boolean")throw new Eu('"allowMissing" argument must be a boolean');if(_k(/^%?[^%]*%?$/,s)===null)throw new Tu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var c=bk(s),d=c.length>0?c[0]:"",_=wk("%"+d+"%",o),k=_.name,I=_.value,f=!1,D=_.alias;D&&(d=D[0],yk(c,gk([0,1],D)));for(var F=1,j=!0;F=c.length){var re=Dl(I,N);j=!!re,j&&"get"in re&&!("originalValue"in re.get)?I=re.get:I=I[N]}else j=lf(I,N),I=I[N];j&&!f&&(zl[k]=I)}}return I},kk=zo,Yh=kk("%Object.defineProperty%",!0)||!1;if(Yh)try{Yh({},"a",{value:1})}catch{Yh=!1}var Jp=Yh,Sk=zo,Kh=Sk("%Object.getOwnPropertyDescriptor%",!0);if(Kh)try{Kh([],"length")}catch{Kh=null}var Qp=Kh,Ay=Jp,Ik=m0,_u=Qa,My=Qp,$p=function(s,o,c){if(!s||typeof s!="object"&&typeof s!="function")throw new _u("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new _u("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _u("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _u("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _u("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _u("`loose`, if provided, must be a boolean");var d=arguments.length>3?arguments[3]:null,_=arguments.length>4?arguments[4]:null,k=arguments.length>5?arguments[5]:null,I=arguments.length>6?arguments[6]:!1,f=!!My&&My(s,o);if(Ay)Ay(s,o,{configurable:k===null&&f?f.configurable:!k,enumerable:d===null&&f?f.enumerable:!d,value:c,writable:_===null&&f?f.writable:!_});else if(I||!d&&!_&&!k)s[o]=c;else throw new Ik("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},hp=Jp,_0=function(){return!!hp};_0.hasArrayLengthDefineBug=function(){if(!hp)return null;try{return hp([],"length",{value:1}).length!==1}catch{return!0}};var em=_0,Ek=Hp,Tk=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Ck=Object.prototype.toString,Pk=Array.prototype.concat,Ry=$p,Lk=function(s){return typeof s=="function"&&Ck.call(s)==="[object Function]"},v0=em(),Ak=function(s,o,c,d){if(o in s){if(d===!0){if(s[o]===c)return}else if(!Lk(d)||!d())return}v0?Ry(s,o,c,!0):Ry(s,o,c)},x0=function(s,o){var c=arguments.length>2?arguments[2]:{},d=Ek(o);Tk&&(d=Pk.call(d,Object.getOwnPropertySymbols(o)));for(var _=0;_4294967295||Dk(o)!==o)throw new Ny("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],d=!0,_=!0;if("length"in s&&zy){var k=zy(s,"length");k&&!k.configurable&&(d=!1),k&&!k.writable&&(_=!1)}return(d||_||!c)&&(Rk?Dy(s,"length",o,!0,!0):Dy(s,"length",o)),s};(function(s){var o=Kp,c=zo,d=zk,_=Qa,k=c("%Function.prototype.apply%"),I=c("%Function.prototype.call%"),f=c("%Reflect.apply%",!0)||o.call(I,k),D=Jp,F=c("%Math.max%");s.exports=function(N){if(typeof N!="function")throw new _("a function is required");var V=f(o,I,arguments);return d(V,1+F(0,N.length-(arguments.length-1)),!0)};var j=function(){return f(o,k,arguments)};D?D(s.exports,"apply",{value:j}):s.exports.apply=j})(b0);var Ru=b0.exports,w0=zo,k0=Ru,Nk=k0(w0("String.prototype.indexOf")),Ds=function(s,o){var c=w0(s,!!o);return typeof c=="function"&&Nk(s,".prototype.")>-1?k0(c):c},Ok=Hp,S0=zf(),I0=Ds,Oy=Object,Fk=I0("Array.prototype.push"),Fy=I0("Object.prototype.propertyIsEnumerable"),Bk=S0?Object.getOwnPropertySymbols:null,E0=function(s,o){if(s==null)throw new TypeError("target must be an object");var c=Oy(s);if(arguments.length===1)return c;for(var d=1;d2&&!!arguments[2];return(!c||tS)&&(eS?By(s,"name",o,!0,!0):By(s,"name",o)),s},rS=nS,sS=Qa,oS=Object,L0=rS(function(){if(this==null||this!==oS(this))throw new sS("RegExp.prototype.flags getter called on non-object");var s="";return this.hasIndices&&(s+="d"),this.global&&(s+="g"),this.ignoreCase&&(s+="i"),this.multiline&&(s+="m"),this.dotAll&&(s+="s"),this.unicode&&(s+="u"),this.unicodeSets&&(s+="v"),this.sticky&&(s+="y"),s},"get flags",!0),aS=L0,lS=Fl.supportsDescriptors,uS=Object.getOwnPropertyDescriptor,A0=function(){if(lS&&/a/mig.flags==="gim"){var s=uS(RegExp.prototype,"flags");if(s&&typeof s.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var o="",c={};if(Object.defineProperty(c,"hasIndices",{get:function(){o+="d"}}),Object.defineProperty(c,"sticky",{get:function(){o+="y"}}),o==="dy")return s.get}}return aS},cS=Fl.supportsDescriptors,hS=A0,fS=Object.getOwnPropertyDescriptor,dS=Object.defineProperty,pS=TypeError,jy=Object.getPrototypeOf,mS=/a/,gS=function(){if(!cS||!jy)throw new pS("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var s=hS(),o=jy(mS),c=fS(o,"flags");return(!c||c.get!==s)&&dS(o,"flags",{configurable:!0,enumerable:!1,get:s}),s},yS=Fl,_S=Ru,vS=L0,M0=A0,xS=gS,R0=_S(M0());yS(R0,{getPolyfill:M0,implementation:vS,shim:xS});var bS=R0,Jh={exports:{}},wS=zf,Bl=function(){return wS()&&!!Symbol.toStringTag},kS=Bl(),SS=Ds,fp=SS("Object.prototype.toString"),Nf=function(s){return kS&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:fp(s)==="[object Arguments]"},D0=function(s){return Nf(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&fp(s)!=="[object Array]"&&fp(s.callee)==="[object Function]"},IS=function(){return Nf(arguments)}();Nf.isLegacyArguments=D0;var z0=IS?Nf:D0;const ES={},TS=Object.freeze(Object.defineProperty({__proto__:null,default:ES},Symbol.toStringTag,{value:"Module"})),CS=O2(TS);var tm=typeof Map=="function"&&Map.prototype,Ud=Object.getOwnPropertyDescriptor&&tm?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,cf=tm&&Ud&&typeof Ud.get=="function"?Ud.get:null,Uy=tm&&Map.prototype.forEach,im=typeof Set=="function"&&Set.prototype,Vd=Object.getOwnPropertyDescriptor&&im?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,hf=im&&Vd&&typeof Vd.get=="function"?Vd.get:null,Vy=im&&Set.prototype.forEach,PS=typeof WeakMap=="function"&&WeakMap.prototype,qc=PS?WeakMap.prototype.has:null,LS=typeof WeakSet=="function"&&WeakSet.prototype,Gc=LS?WeakSet.prototype.has:null,AS=typeof WeakRef=="function"&&WeakRef.prototype,qy=AS?WeakRef.prototype.deref:null,MS=Boolean.prototype.valueOf,RS=Object.prototype.toString,DS=Function.prototype.toString,zS=String.prototype.match,nm=String.prototype.slice,Xa=String.prototype.replace,NS=String.prototype.toUpperCase,Gy=String.prototype.toLowerCase,N0=RegExp.prototype.test,Zy=Array.prototype.concat,So=Array.prototype.join,OS=Array.prototype.slice,Wy=Math.floor,dp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,qd=Object.getOwnPropertySymbols,pp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Cu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Mr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Cu||!0)?Symbol.toStringTag:null,O0=Object.prototype.propertyIsEnumerable,Xy=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(s){return s.__proto__}:null);function Hy(s,o){if(s===1/0||s===-1/0||s!==s||s&&s>-1e3&&s<1e3||N0.call(/e/,o))return o;var c=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof s=="number"){var d=s<0?-Wy(-s):Wy(s);if(d!==s){var _=String(d),k=nm.call(o,_.length+1);return Xa.call(_,c,"$&_")+"."+Xa.call(Xa.call(k,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xa.call(o,c,"$&_")}var mp=CS,Yy=mp.custom,Ky=B0(Yy)?Yy:null,FS=function s(o,c,d,_){var k=c||{};if(Za(k,"quoteStyle")&&k.quoteStyle!=="single"&&k.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Za(k,"maxStringLength")&&(typeof k.maxStringLength=="number"?k.maxStringLength<0&&k.maxStringLength!==1/0:k.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var I=Za(k,"customInspect")?k.customInspect:!0;if(typeof I!="boolean"&&I!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Za(k,"indent")&&k.indent!==null&&k.indent!==" "&&!(parseInt(k.indent,10)===k.indent&&k.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Za(k,"numericSeparator")&&typeof k.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=k.numericSeparator;if(typeof o>"u")return"undefined";if(o===null)return"null";if(typeof o=="boolean")return o?"true":"false";if(typeof o=="string")return U0(o,k);if(typeof o=="number"){if(o===0)return 1/0/o>0?"0":"-0";var D=String(o);return f?Hy(o,D):D}if(typeof o=="bigint"){var F=String(o)+"n";return f?Hy(o,F):F}var j=typeof k.depth>"u"?5:k.depth;if(typeof d>"u"&&(d=0),d>=j&&j>0&&typeof o=="object")return gp(o)?"[Array]":"[Object]";var N=iI(k,d);if(typeof _>"u")_=[];else if(j0(_,o)>=0)return"[Circular]";function V(_t,We,dt){if(We&&(_=OS.call(_),_.push(We)),dt){var bt={depth:k.depth};return Za(k,"quoteStyle")&&(bt.quoteStyle=k.quoteStyle),s(_t,bt,d+1,_)}return s(_t,k,d+1,_)}if(typeof o=="function"&&!Jy(o)){var ne=XS(o),re=Bh(o,V);return"[Function"+(ne?": "+ne:" (anonymous)")+"]"+(re.length>0?" { "+So.call(re,", ")+" }":"")}if(B0(o)){var Ae=Cu?Xa.call(String(o),/^(Symbol\(.*\))_[^)]*$/,"$1"):pp.call(o);return typeof o=="object"&&!Cu?Mc(Ae):Ae}if($S(o)){for(var we="<"+Gy.call(String(o.nodeName)),Te=o.attributes||[],Ce=0;Ce",we}if(gp(o)){if(o.length===0)return"[]";var ke=Bh(o,V);return N&&!tI(ke)?"["+yp(ke,N)+"]":"[ "+So.call(ke,", ")+" ]"}if(US(o)){var Re=Bh(o,V);return!("cause"in Error.prototype)&&"cause"in o&&!O0.call(o,"cause")?"{ ["+String(o)+"] "+So.call(Zy.call("[cause]: "+V(o.cause),Re),", ")+" }":Re.length===0?"["+String(o)+"]":"{ ["+String(o)+"] "+So.call(Re,", ")+" }"}if(typeof o=="object"&&I){if(Ky&&typeof o[Ky]=="function"&&mp)return mp(o,{depth:j-d});if(I!=="symbol"&&typeof o.inspect=="function")return o.inspect()}if(HS(o)){var ze=[];return Uy&&Uy.call(o,function(_t,We){ze.push(V(We,o,!0)+" => "+V(_t,o))}),Qy("Map",cf.call(o),ze,N)}if(JS(o)){var Oe=[];return Vy&&Vy.call(o,function(_t){Oe.push(V(_t,o))}),Qy("Set",hf.call(o),Oe,N)}if(YS(o))return Gd("WeakMap");if(QS(o))return Gd("WeakSet");if(KS(o))return Gd("WeakRef");if(qS(o))return Mc(V(Number(o)));if(ZS(o))return Mc(V(dp.call(o)));if(GS(o))return Mc(MS.call(o));if(VS(o))return Mc(V(String(o)));if(typeof window<"u"&&o===window)return"{ [object Window] }";if(typeof globalThis<"u"&&o===globalThis||typeof Yc<"u"&&o===Yc)return"{ [object globalThis] }";if(!jS(o)&&!Jy(o)){var Ze=Bh(o,V),je=Xy?Xy(o)===Object.prototype:o instanceof Object||o.constructor===Object,Ve=o instanceof Object?"":"null prototype",st=!je&&Mr&&Object(o)===o&&Mr in o?nm.call($a(o),8,-1):Ve?"Object":"",Se=je||typeof o.constructor!="function"?"":o.constructor.name?o.constructor.name+" ":"",Lt=Se+(st||Ve?"["+So.call(Zy.call([],st||[],Ve||[]),": ")+"] ":"");return Ze.length===0?Lt+"{}":N?Lt+"{"+yp(Ze,N)+"}":Lt+"{ "+So.call(Ze,", ")+" }"}return String(o)};function F0(s,o,c){var d=(c.quoteStyle||o)==="double"?'"':"'";return d+s+d}function BS(s){return Xa.call(String(s),/"/g,""")}function gp(s){return $a(s)==="[object Array]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function jS(s){return $a(s)==="[object Date]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function Jy(s){return $a(s)==="[object RegExp]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function US(s){return $a(s)==="[object Error]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function VS(s){return $a(s)==="[object String]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function qS(s){return $a(s)==="[object Number]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function GS(s){return $a(s)==="[object Boolean]"&&(!Mr||!(typeof s=="object"&&Mr in s))}function B0(s){if(Cu)return s&&typeof s=="object"&&s instanceof Symbol;if(typeof s=="symbol")return!0;if(!s||typeof s!="object"||!pp)return!1;try{return pp.call(s),!0}catch{}return!1}function ZS(s){if(!s||typeof s!="object"||!dp)return!1;try{return dp.call(s),!0}catch{}return!1}var WS=Object.prototype.hasOwnProperty||function(s){return s in this};function Za(s,o){return WS.call(s,o)}function $a(s){return RS.call(s)}function XS(s){if(s.name)return s.name;var o=zS.call(DS.call(s),/^function\s*([\w$]+)/);return o?o[1]:null}function j0(s,o){if(s.indexOf)return s.indexOf(o);for(var c=0,d=s.length;co.maxStringLength){var c=s.length-o.maxStringLength,d="... "+c+" more character"+(c>1?"s":"");return U0(nm.call(s,0,o.maxStringLength),o)+d}var _=Xa.call(Xa.call(s,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,eI);return F0(_,"single",o)}function eI(s){var o=s.charCodeAt(0),c={8:"b",9:"t",10:"n",12:"f",13:"r"}[o];return c?"\\"+c:"\\x"+(o<16?"0":"")+NS.call(o.toString(16))}function Mc(s){return"Object("+s+")"}function Gd(s){return s+" { ? }"}function Qy(s,o,c,d){var _=d?yp(c,d):So.call(c,", ");return s+" ("+o+") {"+_+"}"}function tI(s){for(var o=0;o=0)return!1;return!0}function iI(s,o){var c;if(s.indent===" ")c=" ";else if(typeof s.indent=="number"&&s.indent>0)c=So.call(Array(s.indent+1)," ");else return null;return{base:c,prev:So.call(Array(o+1),c)}}function yp(s,o){if(s.length===0)return"";var c=` +`+o.prev+o.base;return c+So.call(s,","+c)+` +`+o.prev}function Bh(s,o){var c=gp(s),d=[];if(c){d.length=s.length;for(var _=0;_=c)return o+1;var d=o_(s,o);if(d<55296||d>56319)return o+1;var _=o_(s,o+1);return _<56320||_>57343?o+1:o+2},Wd=function(s){var o=0;return{next:function(){var c=o>=s.length,d;return c||(d=s[o],o+=1),{done:c,value:d}}}},a_=function(s,o){if(EI(s)||i_(s))return Wd(s);if(TI(s)){var c=0;return{next:function(){var d=AI(s,c),_=LI(s,c,d);return c=d,{done:d>s.length,value:_}}}}if(o&&typeof s["_es6-shim iterator_"]<"u")return s["_es6-shim iterator_"]()};if(!CI&&!PI)Jh.exports=function(s){if(s!=null)return a_(s,!0)};else{var MI=X0,RI=Y0,l_=Ks("Map.prototype.forEach",!0),u_=Ks("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var c_=Ks("Map.prototype.iterator",!0),h_=Ks("Set.prototype.iterator",!0);var f_=Ks("Map.prototype.@@iterator",!0)||Ks("Map.prototype._es6-shim iterator_",!0),d_=Ks("Set.prototype.@@iterator",!0)||Ks("Set.prototype._es6-shim iterator_",!0),DI=function(s){if(MI(s)){if(c_)return n_(c_(s));if(f_)return f_(s);if(l_){var o=[];return l_(s,function(d,_){s_(o,[_,d])}),Wd(o)}}if(RI(s)){if(h_)return n_(h_(s));if(d_)return d_(s);if(u_){var c=[];return u_(s,function(d){s_(c,d)}),Wd(c)}}};Jh.exports=function(s){return DI(s)||a_(s)}}}var zI=Jh.exports,p_=function(s){return s!==s},K0=function(s,o){return s===0&&o===0?1/s===1/o:!!(s===o||p_(s)&&p_(o))},NI=K0,J0=function(){return typeof Object.is=="function"?Object.is:NI},OI=J0,FI=Fl,BI=function(){var s=OI();return FI(Object,{is:s},{is:function(){return Object.is!==s}}),s},jI=Fl,UI=Ru,VI=K0,Q0=J0,qI=BI,$0=UI(Q0(),Object);jI($0,{getPolyfill:Q0,implementation:VI,shim:qI});var GI=$0,ZI=Ru,e1=Ds,WI=zo,_p=WI("%ArrayBuffer%",!0),Qh=e1("ArrayBuffer.prototype.byteLength",!0),XI=e1("Object.prototype.toString"),m_=!!_p&&!Qh&&new _p(0).slice,g_=!!m_&&ZI(m_),t1=Qh||g_?function(s){if(!s||typeof s!="object")return!1;try{return Qh?Qh(s):g_(s,0),!0}catch{return!1}}:_p?function(s){return XI(s)==="[object ArrayBuffer]"}:function(s){return!1},HI=Date.prototype.getDay,YI=function(s){try{return HI.call(s),!0}catch{return!1}},KI=Object.prototype.toString,JI="[object Date]",QI=Bl(),$I=function(s){return typeof s!="object"||s===null?!1:QI?YI(s):KI.call(s)===JI},vp=Ds,i1=Bl(),n1,r1,xp,bp;if(i1){n1=vp("Object.prototype.hasOwnProperty"),r1=vp("RegExp.prototype.exec"),xp={};var Xd=function(){throw xp};bp={toString:Xd,valueOf:Xd},typeof Symbol.toPrimitive=="symbol"&&(bp[Symbol.toPrimitive]=Xd)}var eE=vp("Object.prototype.toString"),tE=Object.getOwnPropertyDescriptor,iE="[object RegExp]",nE=i1?function(s){if(!s||typeof s!="object")return!1;var o=tE(s,"lastIndex"),c=o&&n1(o,"value");if(!c)return!1;try{r1(s,bp)}catch(d){return d===xp}}:function(s){return!s||typeof s!="object"&&typeof s!="function"?!1:eE(s)===iE},rE=Ds,y_=rE("SharedArrayBuffer.prototype.byteLength",!0),sE=y_?function(s){if(!s||typeof s!="object")return!1;try{return y_(s),!0}catch{return!1}}:function(s){return!1},oE=Number.prototype.toString,aE=function(s){try{return oE.call(s),!0}catch{return!1}},lE=Object.prototype.toString,uE="[object Number]",cE=Bl(),hE=function(s){return typeof s=="number"?!0:typeof s!="object"?!1:cE?aE(s):lE.call(s)===uE},s1=Ds,fE=s1("Boolean.prototype.toString"),dE=s1("Object.prototype.toString"),pE=function(s){try{return fE(s),!0}catch{return!1}},mE="[object Boolean]",gE=Bl(),yE=function(s){return typeof s=="boolean"?!0:s===null||typeof s!="object"?!1:gE&&Symbol.toStringTag in s?pE(s):dE(s)===mE},wp={exports:{}},_E=Object.prototype.toString,vE=Yp();if(vE){var xE=Symbol.prototype.toString,bE=/^Symbol\(.*\)$/,wE=function(s){return typeof s.valueOf()!="symbol"?!1:bE.test(xE.call(s))};wp.exports=function(s){if(typeof s=="symbol")return!0;if(_E.call(s)!=="[object Symbol]")return!1;try{return wE(s)}catch{return!1}}}else wp.exports=function(s){return!1};var kE=wp.exports,kp={exports:{}},__=typeof BigInt<"u"&&BigInt,SE=function(){return typeof __=="function"&&typeof BigInt=="function"&&typeof __(42)=="bigint"&&typeof BigInt(42)=="bigint"},IE=SE();if(IE){var EE=BigInt.prototype.valueOf,TE=function(s){try{return EE.call(s),!0}catch{}return!1};kp.exports=function(s){return s===null||typeof s>"u"||typeof s=="boolean"||typeof s=="string"||typeof s=="number"||typeof s=="symbol"||typeof s=="function"?!1:typeof s=="bigint"?!0:TE(s)}}else kp.exports=function(s){return!1};var CE=kp.exports,PE=Z0,LE=hE,AE=yE,ME=kE,RE=CE,DE=function(s){if(s==null||typeof s!="object"&&typeof s!="function")return null;if(PE(s))return"String";if(LE(s))return"Number";if(AE(s))return"Boolean";if(ME(s))return"Symbol";if(RE(s))return"BigInt"},pf=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,v_=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,mf;pf||(mf=function(s){return!1});var Sp=pf?pf.prototype.has:null,Hd=v_?v_.prototype.has:null;!mf&&!Sp&&(mf=function(s){return!1});var zE=mf||function(s){if(!s||typeof s!="object")return!1;try{if(Sp.call(s,Sp),Hd)try{Hd.call(s,Hd)}catch{return!0}return s instanceof pf}catch{}return!1},Ip={exports:{}},NE=zo,o1=Ds,OE=NE("%WeakSet%",!0),Yd=o1("WeakSet.prototype.has",!0);if(Yd){var Kd=o1("WeakMap.prototype.has",!0);Ip.exports=function(s){if(!s||typeof s!="object")return!1;try{if(Yd(s,Yd),Kd)try{Kd(s,Kd)}catch{return!0}return s instanceof OE}catch{}return!1}}else Ip.exports=function(s){return!1};var FE=Ip.exports,BE=X0,jE=Y0,UE=zE,VE=FE,qE=function(s){if(s&&typeof s=="object"){if(BE(s))return"Map";if(jE(s))return"Set";if(UE(s))return"WeakMap";if(VE(s))return"WeakSet"}return!1},a1=Function.prototype.toString,ku=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ep,$h;if(typeof ku=="function"&&typeof Object.defineProperty=="function")try{Ep=Object.defineProperty({},"length",{get:function(){throw $h}}),$h={},ku(function(){throw 42},null,Ep)}catch(s){s!==$h&&(ku=null)}else ku=null;var GE=/^\s*class\b/,Tp=function(s){try{var o=a1.call(s);return GE.test(o)}catch{return!1}},Jd=function(s){try{return Tp(s)?!1:(a1.call(s),!0)}catch{return!1}},ef=Object.prototype.toString,ZE="[object Object]",WE="[object Function]",XE="[object GeneratorFunction]",HE="[object HTMLAllCollection]",YE="[object HTML document.all class]",KE="[object HTMLCollection]",JE=typeof Symbol=="function"&&!!Symbol.toStringTag,QE=!(0 in[,]),Cp=function(){return!1};if(typeof document=="object"){var $E=document.all;ef.call($E)===ef.call(document.all)&&(Cp=function(s){if((QE||!s)&&(typeof s>"u"||typeof s=="object"))try{var o=ef.call(s);return(o===HE||o===YE||o===KE||o===ZE)&&s("")==null}catch{}return!1})}var eT=ku?function(s){if(Cp(s))return!0;if(!s||typeof s!="function"&&typeof s!="object")return!1;try{ku(s,null,Ep)}catch(o){if(o!==$h)return!1}return!Tp(s)&&Jd(s)}:function(s){if(Cp(s))return!0;if(!s||typeof s!="function"&&typeof s!="object")return!1;if(JE)return Jd(s);if(Tp(s))return!1;var o=ef.call(s);return o!==WE&&o!==XE&&!/^\[object HTML/.test(o)?!1:Jd(s)},tT=eT,iT=Object.prototype.toString,l1=Object.prototype.hasOwnProperty,nT=function(s,o,c){for(var d=0,_=s.length;d<_;d++)l1.call(s,d)&&(c==null?o(s[d],d,s):o.call(c,s[d],d,s))},rT=function(s,o,c){for(var d=0,_=s.length;d<_;d++)c==null?o(s.charAt(d),d,s):o.call(c,s.charAt(d),d,s)},sT=function(s,o,c){for(var d in s)l1.call(s,d)&&(c==null?o(s[d],d,s):o.call(c,s[d],d,s))},oT=function(s,o,c){if(!tT(o))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=c),iT.call(s)==="[object Array]"?nT(s,o,d):typeof s=="string"?rT(s,o,d):sT(s,o,d)},aT=oT,lT=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Qd=lT,uT=typeof globalThis>"u"?Yc:globalThis,cT=function(){for(var s=[],o=0;o"u"?Yc:globalThis,Pp=hT(),um=lm("String.prototype.slice"),$d=Object.getPrototypeOf,dT=lm("Array.prototype.indexOf",!0)||function(s,o){for(var c=0;c-1?o:o!=="Object"?!1:mT(s)}return tf?pT(s):null},yT=Ds,w_=yT("ArrayBuffer.prototype.byteLength",!0),_T=t1,vT=function(s){return _T(s)?w_?w_(s):s.byteLength:NaN},c1=Jk,No=Ds,k_=bS,xT=zo,Pu=zI,bT=q0,S_=GI,I_=z0,E_=G0,T_=t1,C_=$I,P_=nE,L_=sE,A_=Hp,M_=DE,R_=qE,D_=gT,z_=vT,N_=No("SharedArrayBuffer.prototype.byteLength",!0),O_=No("Date.prototype.getTime"),ep=Object.getPrototypeOf,F_=No("Object.prototype.toString"),_f=xT("%Set%",!0),Lp=No("Map.prototype.has",!0),vf=No("Map.prototype.get",!0),B_=No("Map.prototype.size",!0),xf=No("Set.prototype.add",!0),h1=No("Set.prototype.delete",!0),bf=No("Set.prototype.has",!0),nf=No("Set.prototype.size",!0);function j_(s,o,c,d){for(var _=Pu(s),k;(k=_.next())&&!k.done;)if(Qs(o,k.value,c,d))return h1(s,k.value),!0;return!1}function f1(s){if(typeof s>"u")return null;if(typeof s!="object")return typeof s=="symbol"?!1:typeof s=="string"||typeof s=="number"?+s==+s:!0}function wT(s,o,c,d,_,k){var I=f1(c);if(I!=null)return I;var f=vf(o,I),D=c1({},_,{strict:!1});return typeof f>"u"&&!Lp(o,I)||!Qs(d,f,D,k)?!1:!Lp(s,I)&&Qs(d,f,D,k)}function kT(s,o,c){var d=f1(c);return d??(bf(o,d)&&!bf(s,d))}function U_(s,o,c,d,_,k){for(var I=Pu(s),f,D;(f=I.next())&&!f.done;)if(D=f.value,Qs(c,D,_,k)&&Qs(d,vf(o,D),_,k))return h1(s,D),!0;return!1}function Qs(s,o,c,d){var _=c||{};if(_.strict?S_(s,o):s===o)return!0;var k=M_(s),I=M_(o);if(k!==I)return!1;if(!s||!o||typeof s!="object"&&typeof o!="object")return _.strict?S_(s,o):s==o;var f=d.has(s),D=d.has(o),F;if(f&&D){if(d.get(s)===d.get(o))return!0}else F={};return f||d.set(s,F),D||d.set(o,F),ET(s,o,_,d)}function V_(s){return!s||typeof s!="object"||typeof s.length!="number"||typeof s.copy!="function"||typeof s.slice!="function"||s.length>0&&typeof s[0]!="number"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function ST(s,o,c,d){if(nf(s)!==nf(o))return!1;for(var _=Pu(s),k=Pu(o),I,f,D;(I=_.next())&&!I.done;)if(I.value&&typeof I.value=="object")D||(D=new _f),xf(D,I.value);else if(!bf(o,I.value)){if(c.strict||!kT(s,o,I.value))return!1;D||(D=new _f),xf(D,I.value)}if(D){for(;(f=k.next())&&!f.done;)if(f.value&&typeof f.value=="object"){if(!j_(D,f.value,c.strict,d))return!1}else if(!c.strict&&!bf(s,f.value)&&!j_(D,f.value,c.strict,d))return!1;return nf(D)===0}return!0}function IT(s,o,c,d){if(B_(s)!==B_(o))return!1;for(var _=Pu(s),k=Pu(o),I,f,D,F,j,N;(I=_.next())&&!I.done;)if(F=I.value[0],j=I.value[1],F&&typeof F=="object")D||(D=new _f),xf(D,F);else if(N=vf(o,F),typeof N>"u"&&!Lp(o,F)||!Qs(j,N,c,d)){if(c.strict||!wT(s,o,F,j,c,d))return!1;D||(D=new _f),xf(D,F)}if(D){for(;(f=k.next())&&!f.done;)if(F=f.value[0],N=f.value[1],F&&typeof F=="object"){if(!U_(D,s,F,N,c,d))return!1}else if(!c.strict&&(!s.has(F)||!Qs(vf(s,F),N,c,d))&&!U_(D,s,F,N,c1({},c,{strict:!1}),d))return!1;return nf(D)===0}return!0}function ET(s,o,c,d){var _,k;if(typeof s!=typeof o||s==null||o==null||F_(s)!==F_(o)||I_(s)!==I_(o))return!1;var I=E_(s),f=E_(o);if(I!==f)return!1;var D=s instanceof Error,F=o instanceof Error;if(D!==F||(D||F)&&(s.name!==o.name||s.message!==o.message))return!1;var j=P_(s),N=P_(o);if(j!==N||(j||N)&&(s.source!==o.source||k_(s)!==k_(o)))return!1;var V=C_(s),ne=C_(o);if(V!==ne||(V||ne)&&O_(s)!==O_(o)||c.strict&&ep&&ep(s)!==ep(o))return!1;var re=D_(s),Ae=D_(o);if(re!==Ae)return!1;if(re||Ae){if(s.length!==o.length)return!1;for(_=0;_=0;_--)if(Oe[_]!=Ze[_])return!1;for(_=Oe.length-1;_>=0;_--)if(k=Oe[_],!Qs(s[k],o[k],c,d))return!1;var je=R_(s),Ve=R_(o);return je!==Ve?!1:je==="Set"||Ve==="Set"?ST(s,o,c,d):je==="Map"?IT(s,o,c,d):!0}var TT=function(s,o,c){return Qs(s,o,c,bT())};const CT=d0(TT);var PT=Object.defineProperty,Wi=(s,o)=>PT(s,"name",{value:o,configurable:!0}),LT=class{constructor(s){this.direction=!1,this.compareProperties=!0;var o,c,d;this.precision=10**-((o=s==null?void 0:s.precision)!=null?o:17),this.direction=(c=s==null?void 0:s.direction)!=null?c:!1,this.compareProperties=(d=s==null?void 0:s.compareProperties)!=null?d:!0}compare(s,o){if(s.type!==o.type||!Oc(s,o))return!1;switch(s.type){case"Point":return this.compareCoord(s.coordinates,o.coordinates);case"LineString":return this.compareLine(s.coordinates,o.coordinates);case"Polygon":return this.comparePolygon(s,o);case"GeometryCollection":return this.compareGeometryCollection(s,o);case"Feature":return this.compareFeature(s,o);case"FeatureCollection":return this.compareFeatureCollection(s,o);default:if(s.type.startsWith("Multi")){const c=Ap(s),d=Ap(o);return c.every(_=>d.some(k=>this.compare(_,k)))}}return!1}compareCoord(s,o){return s.length===o.length&&s.every((c,d)=>Math.abs(c-o[d])=0&&(c=[].concat(s.slice(d,s.length),s.slice(1,d+1))),c}comparePath(s,o){return s.every((c,d)=>this.compareCoord(c,o[d]))}comparePolygon(s,o){if(this.compareLine(s.coordinates[0],o.coordinates[0],1,!0)){const c=s.coordinates.slice(1,s.coordinates.length),d=o.coordinates.slice(1,o.coordinates.length);return c.every(_=>d.some(k=>this.compareLine(_,k,1,!0)))}return!1}compareGeometryCollection(s,o){return Oc(s.geometries,o.geometries)&&this.compareBBox(s,o)&&s.geometries.every((c,d)=>this.compare(c,o.geometries[d]))}compareFeature(s,o){return s.id===o.id&&(this.compareProperties?CT(s.properties,o.properties):!0)&&this.compareBBox(s,o)&&this.compare(s.geometry,o.geometry)}compareFeatureCollection(s,o){return Oc(s.features,o.features)&&this.compareBBox(s,o)&&s.features.every((c,d)=>this.compare(c,o.features[d]))}compareBBox(s,o){return!s.bbox&&!o.bbox||(s.bbox&&o.bbox?this.compareCoord(s.bbox,o.bbox):!1)}};Wi(LT,"GeojsonEquality");function Oc(s,o){return s.coordinates?s.coordinates.length===o.coordinates.length:s.length===o.length}Wi(Oc,"sameLength");function Ap(s){return s.coordinates.map(o=>({type:s.type.replace("Multi",""),coordinates:o}))}Wi(Ap,"explode");var Hr=63710088e-1,d1={centimeters:Hr*100,centimetres:Hr*100,degrees:360/(2*Math.PI),feet:Hr*3.28084,inches:Hr*39.37,kilometers:Hr/1e3,kilometres:Hr/1e3,meters:Hr,metres:Hr,miles:Hr/1609.344,millimeters:Hr*1e3,millimetres:Hr*1e3,nauticalmiles:Hr/1852,radians:1,yards:Hr*1.0936},q_={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 eo(s,o,c={}){const d={type:"Feature"};return(c.id===0||c.id)&&(d.id=c.id),c.bbox&&(d.bbox=c.bbox),d.properties=o||{},d.geometry=s,d}Wi(eo,"feature");function AT(s,o,c={}){switch(s){case"Point":return Io(o).geometry;case"LineString":return fa(o).geometry;case"Polygon":return nh(o).geometry;case"MultiPoint":return m1(o).geometry;case"MultiLineString":return p1(o).geometry;case"MultiPolygon":return Of(o).geometry;default:throw new Error(s+" is invalid")}}Wi(AT,"geometry");function Io(s,o,c={}){if(!s)throw new Error("coordinates is required");if(!Array.isArray(s))throw new Error("coordinates must be an Array");if(s.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!wf(s[0])||!wf(s[1]))throw new Error("coordinates must contain numbers");return eo({type:"Point",coordinates:s},o,c)}Wi(Io,"point");function MT(s,o,c={}){return Ka(s.map(d=>Io(d,o)),c)}Wi(MT,"points");function nh(s,o,c={}){for(const d of s){if(d.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(d[d.length-1].length!==d[0].length)throw new Error("First and last Position are not equivalent.");for(let _=0;_nh(d,o)),c)}Wi(RT,"polygons");function fa(s,o,c={}){if(s.length<2)throw new Error("coordinates must be an array of two or more positions");return eo({type:"LineString",coordinates:s},o,c)}Wi(fa,"lineString");function DT(s,o,c={}){return Ka(s.map(d=>fa(d,o)),c)}Wi(DT,"lineStrings");function Ka(s,o={}){const c={type:"FeatureCollection"};return o.id&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.features=s,c}Wi(Ka,"featureCollection");function p1(s,o,c={}){return eo({type:"MultiLineString",coordinates:s},o,c)}Wi(p1,"multiLineString");function m1(s,o,c={}){return eo({type:"MultiPoint",coordinates:s},o,c)}Wi(m1,"multiPoint");function Of(s,o,c={}){return eo({type:"MultiPolygon",coordinates:s},o,c)}Wi(Of,"multiPolygon");function zT(s,o,c={}){return eo({type:"GeometryCollection",geometries:s},o,c)}Wi(zT,"geometryCollection");function NT(s,o=0){if(o&&!(o>=0))throw new Error("precision must be a positive number");const c=Math.pow(10,o||0);return Math.round(s*c)/c}Wi(NT,"round");function cm(s,o="kilometers"){const c=d1[o];if(!c)throw new Error(o+" units is invalid");return s*c}Wi(cm,"radiansToLength");function Ff(s,o="kilometers"){const c=d1[o];if(!c)throw new Error(o+" units is invalid");return s/c}Wi(Ff,"lengthToRadians");function OT(s,o){return g1(Ff(s,o))}Wi(OT,"lengthToDegrees");function FT(s){let o=s%360;return o<0&&(o+=360),o}Wi(FT,"bearingToAzimuth");function g1(s){return s%(2*Math.PI)*180/Math.PI}Wi(g1,"radiansToDegrees");function BT(s){return s%360*Math.PI/180}Wi(BT,"degreesToRadians");function jT(s,o="kilometers",c="kilometers"){if(!(s>=0))throw new Error("length must be a positive number");return cm(Ff(s,o),c)}Wi(jT,"convertLength");function UT(s,o="meters",c="kilometers"){if(!(s>=0))throw new Error("area must be a positive number");const d=q_[o];if(!d)throw new Error("invalid original units");const _=q_[c];if(!_)throw new Error("invalid final units");return s/d*_}Wi(UT,"convertArea");function wf(s){return!isNaN(s)&&s!==null&&!Array.isArray(s)}Wi(wf,"isNumber");function hm(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}Wi(hm,"isObject");function VT(s){if(!s)throw new Error("bbox is required");if(!Array.isArray(s))throw new Error("bbox must be an Array");if(s.length!==4&&s.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");s.forEach(o=>{if(!wf(o))throw new Error("bbox must only contain numbers")})}Wi(VT,"validateBBox");function qT(s){if(!s)throw new Error("id is required");if(["string","number"].indexOf(typeof s)===-1)throw new Error("id must be a number or a string")}Wi(qT,"validateId");/** + * 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 GT(s,o){var c={label:0,sent:function(){if(k[0]&1)throw k[1];return k[1]},trys:[],ops:[]},d,_,k,I;return I={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function f(F){return function(j){return D([F,j])}}function D(F){if(d)throw new TypeError("Generator is already executing.");for(;c;)try{if(d=1,_&&(k=F[0]&2?_.return:F[0]?_.throw||((k=_.return)&&k.call(_),0):_.next)&&!(k=k.call(_,F[1])).done)return k;switch(_=0,k&&(F=[F[0]&2,k.value]),F[0]){case 0:case 1:k=F;break;case 4:return c.label++,{value:F[1],done:!1};case 5:c.label++,_=F[1],F=[0];continue;case 7:F=c.ops.pop(),c.trys.pop();continue;default:if(k=c.trys,!(k=k.length>0&&k[k.length-1])&&(F[0]===6||F[0]===2)){c=0;continue}if(F[0]===3&&(!k||F[1]>k[0]&&F[1]o?1:s0){if(o.right===null)break;if(c(s,o.right.key)>0){var f=o.right;if(o.right=f.left,f.left=o,o=f,o.right===null)break}_.right=o,_=o,o=o.right}else break}return _.right=o.left,k.left=o.right,o.left=d.right,o.right=d.left,o}function tp(s,o,c,d){var _=new Ja(s,o);if(c===null)return _.left=_.right=null,_;c=Wa(s,c,d);var k=d(s,c.key);return k<0?(_.left=c.left,_.right=c,c.left=null):k>=0&&(_.right=c.right,_.left=c,c.right=null),_}function G_(s,o,c){var d=null,_=null;if(o){o=Wa(s,o,c);var k=c(o.key,s);k===0?(d=o.left,_=o.right):k<0?(_=o.right,o.right=null,d=o):(d=o.left,o.left=null,_=o)}return{left:d,right:_}}function WT(s,o,c){return o===null?s:(s===null||(o=Wa(s.key,o,c),o.left=s),o)}function Mp(s,o,c,d,_){if(s){d(""+o+(c?"└── ":"├── ")+_(s)+` +`);var k=o+(c?" ":"│ ");s.left&&Mp(s.left,k,!1,d,_),s.right&&Mp(s.right,k,!0,d,_)}}var fm=function(){function s(o){o===void 0&&(o=ZT),this._root=null,this._size=0,this._comparator=o}return s.prototype.insert=function(o,c){return this._size++,this._root=tp(o,c,this._root,this._comparator)},s.prototype.add=function(o,c){var d=new Ja(o,c);this._root===null&&(d.left=d.right=null,this._size++,this._root=d);var _=this._comparator,k=Wa(o,this._root,_),I=_(o,k.key);return I===0?this._root=k:(I<0?(d.left=k.left,d.right=k,k.left=null):I>0&&(d.right=k.right,d.left=k,k.right=null),this._size++,this._root=d),this._root},s.prototype.remove=function(o){this._root=this._remove(o,this._root,this._comparator)},s.prototype._remove=function(o,c,d){var _;if(c===null)return null;c=Wa(o,c,d);var k=d(o,c.key);return k===0?(c.left===null?_=c.right:(_=Wa(o,c.left,d),_.right=c.right),this._size--,_):c},s.prototype.pop=function(){var o=this._root;if(o){for(;o.left;)o=o.left;return this._root=Wa(o.key,this._root,this._comparator),this._root=this._remove(o.key,this._root,this._comparator),{key:o.key,data:o.data}}return null},s.prototype.findStatic=function(o){for(var c=this._root,d=this._comparator;c;){var _=d(o,c.key);if(_===0)return c;_<0?c=c.left:c=c.right}return null},s.prototype.find=function(o){return this._root&&(this._root=Wa(o,this._root,this._comparator),this._comparator(o,this._root.key)!==0)?null:this._root},s.prototype.contains=function(o){for(var c=this._root,d=this._comparator;c;){var _=d(o,c.key);if(_===0)return!0;_<0?c=c.left:c=c.right}return!1},s.prototype.forEach=function(o,c){for(var d=this._root,_=[],k=!1;!k;)d!==null?(_.push(d),d=d.left):_.length!==0?(d=_.pop(),o.call(c,d),d=d.right):k=!0;return this},s.prototype.range=function(o,c,d,_){for(var k=[],I=this._comparator,f=this._root,D;k.length!==0||f;)if(f)k.push(f),f=f.left;else{if(f=k.pop(),D=I(f.key,c),D>0)break;if(I(f.key,o)>=0&&d.call(_,f))return this;f=f.right}return this},s.prototype.keys=function(){var o=[];return this.forEach(function(c){var d=c.key;return o.push(d)}),o},s.prototype.values=function(){var o=[];return this.forEach(function(c){var d=c.data;return o.push(d)}),o},s.prototype.min=function(){return this._root?this.minNode(this._root).key:null},s.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},s.prototype.minNode=function(o){if(o===void 0&&(o=this._root),o)for(;o.left;)o=o.left;return o},s.prototype.maxNode=function(o){if(o===void 0&&(o=this._root),o)for(;o.right;)o=o.right;return o},s.prototype.at=function(o){for(var c=this._root,d=!1,_=0,k=[];!d;)if(c)k.push(c),c=c.left;else if(k.length>0){if(c=k.pop(),_===o)return c;_++,c=c.right}else d=!0;return null},s.prototype.next=function(o){var c=this._root,d=null;if(o.right){for(d=o.right;d.left;)d=d.left;return d}for(var _=this._comparator;c;){var k=_(o.key,c.key);if(k===0)break;k<0?(d=c,c=c.left):c=c.right}return d},s.prototype.prev=function(o){var c=this._root,d=null;if(o.left!==null){for(d=o.left;d.right;)d=d.right;return d}for(var _=this._comparator;c;){var k=_(o.key,c.key);if(k===0)break;k<0?c=c.left:(d=c,c=c.right)}return d},s.prototype.clear=function(){return this._root=null,this._size=0,this},s.prototype.toList=function(){return HT(this._root)},s.prototype.load=function(o,c,d){c===void 0&&(c=[]),d===void 0&&(d=!1);var _=o.length,k=this._comparator;if(d&&zp(o,c,0,_-1,k),this._root===null)this._root=Rp(o,c,0,_),this._size=_;else{var I=YT(this.toList(),XT(o,c),k);_=this._size+_,this._root=Dp({head:I},0,_)}return this},s.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(s.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),s.prototype.toString=function(o){o===void 0&&(o=function(d){return String(d.key)});var c=[];return Mp(this._root,"",!0,function(d){return c.push(d)},o),c.join("")},s.prototype.update=function(o,c,d){var _=this._comparator,k=G_(o,this._root,_),I=k.left,f=k.right;_(o,c)<0?f=tp(c,d,f,_):I=tp(c,d,I,_),this._root=WT(I,f,_)},s.prototype.split=function(o){return G_(o,this._root,this._comparator)},s.prototype[Symbol.iterator]=function(){var o,c,d;return GT(this,function(_){switch(_.label){case 0:o=this._root,c=[],d=!1,_.label=1;case 1:return d?[3,6]:o===null?[3,2]:(c.push(o),o=o.left,[3,5]);case 2:return c.length===0?[3,4]:(o=c.pop(),[4,o]);case 3:return _.sent(),o=o.right,[3,5];case 4:d=!0,_.label=5;case 5:return[3,1];case 6:return[2]}})},s}();function Rp(s,o,c,d){var _=d-c;if(_>0){var k=c+Math.floor(_/2),I=s[k],f=o[k],D=new Ja(I,f);return D.left=Rp(s,o,c,k),D.right=Rp(s,o,k+1,d),D}return null}function XT(s,o){for(var c=new Ja(null,null),d=c,_=0;_0?(o=k=k.next=c.pop(),o=o.right):d=!0;return k.next=null,_.next}function Dp(s,o,c){var d=c-o;if(d>0){var _=o+Math.floor(d/2),k=Dp(s,o,_),I=s.head;return I.left=k,s.head=s.head.next,I.right=Dp(s,_+1,c),I}return null}function YT(s,o,c){for(var d=new Ja(null,null),_=d,k=s,I=o;k!==null&&I!==null;)c(k.key,I.key)<0?(_.next=k,k=k.next):(_.next=I,I=I.next),_=_.next;return k!==null?_.next=k:I!==null&&(_.next=I),d.next}function zp(s,o,c,d,_){if(!(c>=d)){for(var k=s[c+d>>1],I=c-1,f=d+1;;){do I++;while(_(s[I],k)<0);do f--;while(_(s[f],k)>0);if(I>=f)break;var D=s[I];s[I]=s[f],s[f]=D,D=o[I],o[I]=o[f],o[f]=D}zp(s,o,c,f,_),zp(s,o,f+1,d,_)}}const da=11102230246251565e-32,Lr=134217729,KT=(3+8*da)*da;function ip(s,o,c,d,_){let k,I,f,D,F=o[0],j=d[0],N=0,V=0;j>F==j>-F?(k=F,F=o[++N]):(k=j,j=d[++V]);let ne=0;if(NF==j>-F?(I=F+k,f=k-(I-F),F=o[++N]):(I=j+k,f=k-(I-j),j=d[++V]),k=I,f!==0&&(_[ne++]=f);NF==j>-F?(I=k+F,D=I-k,f=k-(I-D)+(F-D),F=o[++N]):(I=k+j,D=I-k,f=k-(I-D)+(j-D),j=d[++V]),k=I,f!==0&&(_[ne++]=f);for(;N=We||-_t>=We||(N=s-Ve,f=s-(Ve+N)+(N-_),N=c-st,F=c-(st+N)+(N-_),N=o-Se,D=o-(Se+N)+(N-k),N=d-Lt,j=d-(Lt+N)+(N-k),f===0&&D===0&&F===0&&j===0)||(We=eC*I+KT*Math.abs(_t),_t+=Ve*j+Lt*f-(Se*F+st*D),_t>=We||-_t>=We))return _t;Re=f*Lt,V=Lr*f,ne=V-(V-f),re=f-ne,V=Lr*Lt,Ae=V-(V-Lt),we=Lt-Ae,ze=re*we-(Re-ne*Ae-re*Ae-ne*we),Oe=D*st,V=Lr*D,ne=V-(V-D),re=D-ne,V=Lr*st,Ae=V-(V-st),we=st-Ae,Ze=re*we-(Oe-ne*Ae-re*Ae-ne*we),Te=ze-Ze,N=ze-Te,jr[0]=ze-(Te+N)+(N-Ze),Ce=Re+Te,N=Ce-Re,ke=Re-(Ce-N)+(Te-N),Te=ke-Oe,N=ke-Te,jr[1]=ke-(Te+N)+(N-Oe),je=Ce+Te,N=je-Ce,jr[2]=Ce-(je-N)+(Te-N),jr[3]=je;const dt=ip(4,vu,4,jr,Z_);Re=Ve*j,V=Lr*Ve,ne=V-(V-Ve),re=Ve-ne,V=Lr*j,Ae=V-(V-j),we=j-Ae,ze=re*we-(Re-ne*Ae-re*Ae-ne*we),Oe=Se*F,V=Lr*Se,ne=V-(V-Se),re=Se-ne,V=Lr*F,Ae=V-(V-F),we=F-Ae,Ze=re*we-(Oe-ne*Ae-re*Ae-ne*we),Te=ze-Ze,N=ze-Te,jr[0]=ze-(Te+N)+(N-Ze),Ce=Re+Te,N=Ce-Re,ke=Re-(Ce-N)+(Te-N),Te=ke-Oe,N=ke-Te,jr[1]=ke-(Te+N)+(N-Oe),je=Ce+Te,N=je-Ce,jr[2]=Ce-(je-N)+(Te-N),jr[3]=je;const bt=ip(dt,Z_,4,jr,W_);Re=f*j,V=Lr*f,ne=V-(V-f),re=f-ne,V=Lr*j,Ae=V-(V-j),we=j-Ae,ze=re*we-(Re-ne*Ae-re*Ae-ne*we),Oe=D*F,V=Lr*D,ne=V-(V-D),re=D-ne,V=Lr*F,Ae=V-(V-F),we=F-Ae,Ze=re*we-(Oe-ne*Ae-re*Ae-ne*we),Te=ze-Ze,N=ze-Te,jr[0]=ze-(Te+N)+(N-Ze),Ce=Re+Te,N=Ce-Re,ke=Re-(Ce-N)+(Te-N),Te=ke-Oe,N=ke-Te,jr[1]=ke-(Te+N)+(N-Oe),je=Ce+Te,N=je-Ce,jr[2]=Ce-(je-N)+(Te-N),jr[3]=je;const lt=ip(bt,W_,4,jr,X_);return X_[lt-1]}function iC(s,o,c,d,_,k){const I=(o-k)*(c-_),f=(s-_)*(d-k),D=I-f,F=Math.abs(I+f);return Math.abs(D)>=QT*F?D:-tC(s,o,c,d,_,k,F)}const zc=(s,o)=>s.ll.x<=o.x&&o.x<=s.ur.x&&s.ll.y<=o.y&&o.y<=s.ur.y,Np=(s,o)=>{if(o.ur.x{if(-Has.x*o.y-s.y*o.x,y1=(s,o)=>s.x*o.x+s.y*o.y,K_=(s,o,c)=>{const d=iC(s.x,s.y,o.x,o.y,c.x,c.y);return d>0?-1:d<0?1:0},kf=s=>Math.sqrt(y1(s,s)),sC=(s,o,c)=>{const d={x:o.x-s.x,y:o.y-s.y},_={x:c.x-s.x,y:c.y-s.y};return rf(_,d)/kf(_)/kf(d)},oC=(s,o,c)=>{const d={x:o.x-s.x,y:o.y-s.y},_={x:c.x-s.x,y:c.y-s.y};return y1(_,d)/kf(_)/kf(d)},J_=(s,o,c)=>o.y===0?null:{x:s.x+o.x/o.y*(c-s.y),y:c},Q_=(s,o,c)=>o.x===0?null:{x:c,y:s.y+o.y/o.x*(c-s.x)},aC=(s,o,c,d)=>{if(o.x===0)return Q_(c,d,s.x);if(d.x===0)return Q_(s,o,c.x);if(o.y===0)return J_(c,d,s.y);if(d.y===0)return J_(s,o,c.y);const _=rf(o,d);if(_==0)return null;const k={x:c.x-s.x,y:c.y-s.y},I=rf(k,o)/_,f=rf(k,d)/_,D=s.x+f*o.x,F=c.x+I*d.x,j=s.y+f*o.y,N=c.y+I*d.y,V=(D+F)/2,ne=(j+N)/2;return{x:V,y:ne}};class Ms{static compare(o,c){const d=Ms.comparePoints(o.point,c.point);return d!==0?d:(o.point!==c.point&&o.link(c),o.isLeft!==c.isLeft?o.isLeft?1:-1:Ya.compare(o.segment,c.segment))}static comparePoints(o,c){return o.xc.x?1:o.yc.y?1:0}constructor(o,c){o.events===void 0?o.events=[this]:o.events.push(this),this.point=o,this.isLeft=c}link(o){if(o.point===this.point)throw new Error("Tried to link already linked events");const c=o.point.events;for(let d=0,_=c.length;d<_;d++){const k=c[d];this.point.events.push(k),k.point=this.point}this.checkForConsuming()}checkForConsuming(){const o=this.point.events.length;for(let c=0;c{const k=_.otherSE;c.set(_,{sine:sC(this.point,o.point,k.point),cosine:oC(this.point,o.point,k.point)})};return(_,k)=>{c.has(_)||d(_),c.has(k)||d(k);const{sine:I,cosine:f}=c.get(_),{sine:D,cosine:F}=c.get(k);return I>=0&&D>=0?fF?-1:0:I<0&&D<0?fF?1:0:DI?1:0}}}let lC=0;class Ya{static compare(o,c){const d=o.leftSE.point.x,_=c.leftSE.point.x,k=o.rightSE.point.x,I=c.rightSE.point.x;if(If&&D>F)return-1;const N=o.comparePoint(c.leftSE.point);if(N<0)return 1;if(N>0)return-1;const V=c.comparePoint(o.rightSE.point);return V!==0?V:-1}if(d>_){if(fD&&f>j)return 1;const N=c.comparePoint(o.leftSE.point);if(N!==0)return N;const V=o.comparePoint(c.rightSE.point);return V<0?1:V>0?-1:1}if(fD)return 1;if(kI){const N=o.comparePoint(c.rightSE.point);if(N<0)return 1;if(N>0)return-1}if(k!==I){const N=F-f,V=k-d,ne=j-D,re=I-_;if(N>V&&nere)return-1}return k>I?1:kj?1:o.idc.id?1:0}constructor(o,c,d,_){this.id=++lC,this.leftSE=o,o.segment=this,o.otherSE=c,this.rightSE=c,c.segment=this,c.otherSE=o,this.rings=d,this.windings=_}static fromRing(o,c,d){let _,k,I;const f=Ms.comparePoints(o,c);if(f<0)_=o,k=c,I=1;else if(f>0)_=c,k=o,I=-1;else throw new Error(`Tried to create degenerate segment at [${o.x}, ${o.y}]`);const D=new Ms(_,!0),F=new Ms(k,!1);return new Ya(D,F,[d],[I])}replaceRightSE(o){this.rightSE=o,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const o=this.leftSE.point.y,c=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:oc?o:c}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(o){return o.x===this.leftSE.point.x&&o.y===this.leftSE.point.y||o.x===this.rightSE.point.x&&o.y===this.rightSE.point.y}comparePoint(o){if(this.isAnEndpoint(o))return 0;const c=this.leftSE.point,d=this.rightSE.point,_=this.vector();if(c.x===d.x)return o.x===c.x?0:o.x0&&f.swapEvents(),Ms.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),d&&(_.checkForConsuming(),k.checkForConsuming()),c}swapEvents(){const o=this.rightSE;this.rightSE=this.leftSE,this.leftSE=o,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let c=0,d=this.windings.length;c0){const k=c;c=d,d=k}if(c.prev===d){const k=c;c=d,d=k}for(let k=0,I=d.rings.length;k_.length===1&&_[0].isSubject;this._isInResult=d(o)!==d(c);break}default:throw new Error(`Unrecognized operation type found ${Js.type}`)}return this._isInResult}}class $_{constructor(o,c,d){if(!Array.isArray(o)||o.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=c,this.isExterior=d,this.segments=[],typeof o[0][0]!="number"||typeof o[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const _=Jc.round(o[0][0],o[0][1]);this.bbox={ll:{x:_.x,y:_.y},ur:{x:_.x,y:_.y}};let k=_;for(let I=1,f=o.length;Ithis.bbox.ur.x&&(this.bbox.ur.x=D.x),D.y>this.bbox.ur.y&&(this.bbox.ur.y=D.y),k=D)}(_.x!==k.x||_.y!==k.y)&&this.segments.push(Ya.fromRing(k,_,this))}getSweepEvents(){const o=[];for(let c=0,d=this.segments.length;cthis.bbox.ur.x&&(this.bbox.ur.x=k.bbox.ur.x),k.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=k.bbox.ur.y),this.interiorRings.push(k)}this.multiPoly=c}getSweepEvents(){const o=this.exteriorRing.getSweepEvents();for(let c=0,d=this.interiorRings.length;cthis.bbox.ur.x&&(this.bbox.ur.x=k.bbox.ur.x),k.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=k.bbox.ur.y),this.polys.push(k)}this.isSubject=c}getSweepEvents(){const o=[];for(let c=0,d=this.polys.length;c0&&(o=I)}let c=o.segment.prevInResult(),d=c?c.prevInResult():null;for(;;){if(!c)return null;if(!d)return c.ringOut;if(d.ringOut!==c.ringOut)return d.ringOut.enclosingRing()!==c.ringOut?c.ringOut:c.ringOut.enclosingRing();c=d.prevInResult(),d=c?c.prevInResult():null}}}class tv{constructor(o){this.exteriorRing=o,o.poly=this,this.interiorRings=[]}addInterior(o){this.interiorRings.push(o),o.poly=this}getGeom(){const o=[this.exteriorRing.getGeom()];if(o[0]===null)return null;for(let c=0,d=this.interiorRings.length;c1&&arguments[1]!==void 0?arguments[1]:Ya.compare;this.queue=o,this.tree=new fm(c),this.segments=[]}process(o){const c=o.segment,d=[];if(o.consumedBy)return o.isLeft?this.queue.remove(o.otherSE):this.tree.remove(c),d;const _=o.isLeft?this.tree.add(c):this.tree.find(c);if(!_)throw new Error(`Unable to find segment #${c.id} [${c.leftSE.point.x}, ${c.leftSE.point.y}] -> [${c.rightSE.point.x}, ${c.rightSE.point.y}] in SweepLine tree.`);let k=_,I=_,f,D;for(;f===void 0;)k=this.tree.prev(k),k===null?f=null:k.key.consumedBy===void 0&&(f=k.key);for(;D===void 0;)I=this.tree.next(I),I===null?D=null:I.key.consumedBy===void 0&&(D=I.key);if(o.isLeft){let F=null;if(f){const N=f.getIntersection(c);if(N!==null&&(c.isAnEndpoint(N)||(F=N),!f.isAnEndpoint(N))){const V=this._splitSafely(f,N);for(let ne=0,re=V.length;ne0?(this.tree.remove(c),d.push(o)):(this.segments.push(c),c.prev=f)}else{if(f&&D){const F=f.getIntersection(D);if(F!==null){if(!f.isAnEndpoint(F)){const j=this._splitSafely(f,F);for(let N=0,V=j.length;Niv)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const I=new hC(k);let f=k.size,D=k.pop();for(;D;){const j=D.key;if(k.size===f){const V=j.segment;throw new Error(`Unable to pop() ${j.isLeft?"left":"right"} SweepEvent [${j.point.x}, ${j.point.y}] from segment #${V.id} [${V.leftSE.point.x}, ${V.leftSE.point.y}] -> [${V.rightSE.point.x}, ${V.rightSE.point.y}] from queue.`)}if(k.size>iv)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(I.segments.length>fC)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const N=I.process(j);for(let V=0,ne=N.length;V1?o-1:0),d=1;d1?o-1:0),d=1;d1?o-1:0),d=1;d1?o-1:0),d=1;d_C(s,"name",{value:o,configurable:!0});function zu(s,o,c){if(s!==null)for(var d,_,k,I,f,D,F,j=0,N=0,V,ne=s.type,re=ne==="FeatureCollection",Ae=ne==="Feature",we=re?s.features.length:1,Te=0;TeD||re>F||Ae>j){f=N,D=d,F=re,j=Ae,k=0;return}var we=fa([f,N],c.properties);if(o(we,d,_,Ae,k)===!1)return!1;k++,f=N})===!1)return!1}}})}br(x1,"segmentEach");function IC(s,o,c){var d=c,_=!1;return x1(s,function(k,I,f,D,F){_===!1&&c===void 0?d=k:d=o(d,k,I,f,D,F),_=!0}),d}br(IC,"segmentReduce");function b1(s,o){if(!s)throw new Error("geojson is required");Bf(s,function(c,d,_){if(c.geometry!==null){var k=c.geometry.type,I=c.geometry.coordinates;switch(k){case"LineString":if(o(c,d,_,0,0)===!1)return!1;break;case"Polygon":for(var f=0;fPC(s,"name",{value:o,configurable:!0});function AC(s,o={}){const c=[];if(jl(s,_=>{c.push(_.coordinates)}),c.length<2)throw new Error("Must have at least 2 geometries");const d=_1.union(c[0],...c.slice(1));return d.length===0?null:d.length===1?nh(d[0],o.properties):Of(d,o.properties)}LC(AC,"union");var MC=Object.defineProperty,RC=(s,o)=>MC(s,"name",{value:o,configurable:!0});function w1(s,o={}){if(s.bbox!=null&&o.recompute!==!0)return s.bbox;const c=[1/0,1/0,-1/0,-1/0];return zu(s,d=>{c[0]>d[0]&&(c[0]=d[0]),c[1]>d[1]&&(c[1]=d[1]),c[2]DC(s,"name",{value:o,configurable:!0});function k1(s,o={}){const c=w1(s),d=(c[0]+c[2])/2,_=(c[1]+c[3])/2;return Io([d,_],o.properties,o)}zC(k1,"center");var S1={exports:{}};(function(s,o){(function(c,d){s.exports=d()})(Yc,function(){function c(v,r){if(!(v instanceof r))throw new TypeError("Cannot call a class as a function")}function d(v,r){for(var a=0;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function F(v,r,a){return F=D()?Reflect.construct:function(u,y,E){var M=[null];M.push.apply(M,y);var B=new(Function.bind.apply(u,M));return E&&f(B,E.prototype),B},F.apply(null,arguments)}function j(v){var r=typeof Map=="function"?new Map:void 0;return j=function(a){if(a===null||(u=a,Function.toString.call(u).indexOf("[native code]")===-1))return a;var u;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(r!==void 0){if(r.has(a))return r.get(a);r.set(a,y)}function y(){return F(a,arguments,I(this).constructor)}return y.prototype=Object.create(a.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),f(y,a)},j(v)}function N(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function V(v,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return N(v)}function ne(v){var r=D();return function(){var a,u=I(v);if(r){var y=I(this).constructor;a=Reflect.construct(u,arguments,y)}else a=u.apply(this,arguments);return V(this,a)}}function re(v,r,a){return re=typeof Reflect<"u"&&Reflect.get?Reflect.get:function(u,y,E){var M=function(W,ie){for(;!Object.prototype.hasOwnProperty.call(W,ie)&&(W=I(W))!==null;);return W}(u,y);if(M){var B=Object.getOwnPropertyDescriptor(M,y);return B.get?B.get.call(E):B.value}},re(v,r,a||v)}function Ae(v){return function(r){if(Array.isArray(r))return Te(r)}(v)||function(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}(v)||we(v)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function we(v,r){if(v){if(typeof v=="string")return Te(v,r);var a=Object.prototype.toString.call(v).slice(8,-1);return a==="Object"&&v.constructor&&(a=v.constructor.name),a==="Map"||a==="Set"?Array.from(v):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Te(v,r):void 0}}function Te(v,r){(r==null||r>v.length)&&(r=v.length);for(var a=0,u=new Array(r);a=v.length?{done:!0}:{done:!1,value:v[u++]}},e:function(W){throw W},f:y}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var E,M=!0,B=!1;return{s:function(){a=a.call(v)},n:function(){var W=a.next();return M=W.done,W},e:function(W){B=!0,E=W},f:function(){try{M||a.return==null||a.return()}finally{if(B)throw E}}}}var ke=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=v.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=v.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==v.JOIN_ROUND&&(this._quadrantSegments=v.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(r){this._joinStyle=r}},{key:"setSimplifyFactor",value:function(r){this._simplifyFactor=r<0?0:r}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(r){this._endCapStyle=r}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(r){this._mitreLimit=r}},{key:"setSingleSided",value:function(r){this._isSingleSided=r}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=v.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=v.CAP_ROUND,this._joinStyle=v.JOIN_ROUND,this._mitreLimit=v.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=v.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setQuadrantSegments(r)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];this.setQuadrantSegments(a),this.setEndCapStyle(u)}else if(arguments.length===4){var y=arguments[0],E=arguments[1],M=arguments[2],B=arguments[3];this.setQuadrantSegments(y),this.setEndCapStyle(E),this.setJoinStyle(M),this.setMitreLimit(B)}}}},{key:"bufferDistanceError",value:function(r){var a=Math.PI/2/r;return 1-Math.cos(a/2)}}]),v}();ke.CAP_ROUND=1,ke.CAP_FLAT=2,ke.CAP_SQUARE=3,ke.JOIN_ROUND=1,ke.JOIN_MITRE=2,ke.JOIN_BEVEL=3,ke.DEFAULT_QUADRANT_SEGMENTS=8,ke.DEFAULT_MITRE_LIMIT=5,ke.DEFAULT_SIMPLIFY_FACTOR=.01;var Re=function(v){k(a,v);var r=ne(a);function a(u){var y;return c(this,a),(y=r.call(this,u)).name=Object.keys({Exception:a})[0],y}return _(a,[{key:"toString",value:function(){return this.message}}]),a}(j(Error)),ze=function(v){k(a,v);var r=ne(a);function a(u){var y;return c(this,a),(y=r.call(this,u)).name=Object.keys({IllegalArgumentException:a})[0],y}return a}(Re),Oe=function(){function v(){c(this,v)}return _(v,[{key:"filter",value:function(r){}}]),v}();function Ze(){}function je(){}function Ve(){}var st,Se,Lt,_t,We,dt,bt,lt,It=function(){function v(){c(this,v)}return _(v,null,[{key:"equalsWithTolerance",value:function(r,a,u){return Math.abs(r-a)<=u}}]),v}(),Wt=function(){function v(r,a){c(this,v),this.low=a||0,this.high=r||0}return _(v,null,[{key:"toBinaryString",value:function(r){var a,u="";for(a=2147483648;a>0;a>>>=1)u+=(r.high&a)===a?"1":"0";for(a=2147483648;a>0;a>>>=1)u+=(r.low&a)===a?"1":"0";return u}}]),v}();function it(){}function Ft(){}it.NaN=NaN,it.isNaN=function(v){return Number.isNaN(v)},it.isInfinite=function(v){return!Number.isFinite(v)},it.MAX_VALUE=Number.MAX_VALUE,it.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,it.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(dt=2146435072,bt=new Float64Array(1),lt=new Int32Array(bt.buffer),it.doubleToLongBits=function(v){bt[0]=v;var r=0|lt[0],a=0|lt[1];return(a&dt)===dt&&1048575&a&&r!==0&&(r=0,a=2146959360),new Wt(a,r)},it.longBitsToDouble=function(v){return lt[0]=v.low,lt[1]=v.high,bt[0]}):(st=1023,Se=Math.log2,Lt=Math.floor,_t=Math.pow,We=function(){for(var v=53;v>0;v--){var r=_t(2,v)-1;if(Lt(Se(r))+1===v)return r}return 0}(),it.doubleToLongBits=function(v){var r,a,u,y,E,M,B,W,ie;if(v<0||1/v===Number.NEGATIVE_INFINITY?(M=1<<31,v=-v):M=0,v===0)return new Wt(W=M,ie=0);if(v===1/0)return new Wt(W=2146435072|M,ie=0);if(v!=v)return new Wt(W=2146959360,ie=0);if(y=0,ie=0,(r=Lt(v))>1)if(r<=We)(y=Lt(Se(r)))<=20?(ie=0,W=r<<20-y&1048575):(ie=r%(a=_t(2,u=y-20))<<32-u,W=r/a&1048575);else for(u=r,ie=0;(u=Lt(a=u/2))!==0;)y++,ie>>>=1,ie|=(1&W)<<31,W>>>=1,a!==u&&(W|=524288);if(B=y+st,E=r===0,r=v-r,y<52&&r!==0)for(u=0;;){if((a=2*r)>=1?(r=a-1,E?(B--,E=!1):(u<<=1,u|=1,y++)):(r=a,E?--B==0&&(y++,E=!1):(u<<=1,y++)),y===20)W|=u,u=0;else if(y===52){ie|=u;break}if(a===1){y<20?W|=u<<20-y:y<52&&(ie|=u<<52-y);break}}return W|=B<<20,new Wt(W|=M,ie)},it.longBitsToDouble=function(v){var r,a,u,y,E=v.high,M=v.low,B=E&1<<31?-1:1;for(u=((2146435072&E)>>20)-st,y=0,a=1<<19,r=1;r<=20;r++)E&a&&(y+=_t(2,-r)),a>>>=1;for(a=1<<31,r=21;r<=52;r++)M&a&&(y+=_t(2,-r)),a>>>=1;if(u===-1023){if(y===0)return 0*B;u=-1022}else{if(u===1024)return y===0?B/0:NaN;y+=1}return B*y*_t(2,u)});var Ut=function(v){k(a,v);var r=ne(a);function a(u){var y;return c(this,a),(y=r.call(this,u)).name=Object.keys({RuntimeException:a})[0],y}return a}(Re),Gt=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,null,[{key:"constructor_",value:function(){if(arguments.length===0)Ut.constructor_.call(this);else if(arguments.length===1){var u=arguments[0];Ut.constructor_.call(this,u)}}}]),a}(Ut),et=function(){function v(){c(this,v)}return _(v,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)v.shouldNeverReachHere(null);else if(arguments.length===1){var r=arguments[0];throw new Gt("Should never reach here"+(r!==null?": "+r:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var r=arguments[0];v.isTrue(r,null)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];if(!a)throw u===null?new Gt:new Gt(u)}}},{key:"equals",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];v.equals(r,a,null)}else if(arguments.length===3){var u=arguments[0],y=arguments[1],E=arguments[2];if(!y.equals(u))throw new Gt("Expected "+u+" but encountered "+y+(E!==null?": "+E:""))}}}]),v}(),Ot=new ArrayBuffer(8),pt=new Float64Array(Ot),vt=new Int32Array(Ot),_e=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getM",value:function(){return it.NaN}},{key:"setOrdinate",value:function(r,a){switch(r){case v.X:this.x=a;break;case v.Y:this.y=a;break;case v.Z:this.setZ(a);break;default:throw new ze("Invalid ordinate index: "+r)}}},{key:"equals2D",value:function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var a=arguments[0],u=arguments[1];return!!It.equalsWithTolerance(this.x,a.x,u)&&!!It.equalsWithTolerance(this.y,a.y,u)}}},{key:"setM",value:function(r){throw new ze("Invalid ordinate index: "+v.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(r){switch(r){case v.X:return this.x;case v.Y:return this.y;case v.Z:return this.getZ()}throw new ze("Invalid ordinate index: "+r)}},{key:"equals3D",value:function(r){return this.x===r.x&&this.y===r.y&&(this.getZ()===r.getZ()||it.isNaN(this.getZ())&&it.isNaN(r.getZ()))}},{key:"equals",value:function(r){return r instanceof v&&this.equals2D(r)}},{key:"equalInZ",value:function(r,a){return It.equalsWithTolerance(this.getZ(),r.getZ(),a)}},{key:"setX",value:function(r){this.x=r}},{key:"compareTo",value:function(r){var a=r;return this.xa.x?1:this.ya.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(r){this.z=r}},{key:"clone",value:function(){try{return null}catch(r){if(r instanceof CloneNotSupportedException)return et.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw r}}},{key:"copy",value:function(){return new v(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(r){var a=this.x-r.x,u=this.y-r.y,y=this.getZ()-r.getZ();return Math.sqrt(a*a+u*u+y*y)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(r){this.y=r}},{key:"distance",value:function(r){var a=this.x-r.x,u=this.y-r.y;return Math.sqrt(a*a+u*u)}},{key:"hashCode",value:function(){var r=17;return r=37*(r=37*r+v.hashCode(this.x))+v.hashCode(this.y)}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ()}},{key:"interfaces_",get:function(){return[Ze,je,Ve]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)v.constructor_.call(this,0,0);else if(arguments.length===1){var r=arguments[0];v.constructor_.call(this,r.x,r.y,r.getZ())}else if(arguments.length===2){var a=arguments[0],u=arguments[1];v.constructor_.call(this,a,u,v.NULL_ORDINATE)}else if(arguments.length===3){var y=arguments[0],E=arguments[1],M=arguments[2];this.x=y,this.y=E,this.z=M}}},{key:"hashCode",value:function(r){return pt[0]=r,vt[0]^vt[1]}}]),v}(),vi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compare",value:function(r,a){var u=v.compare(r.x,a.x);if(u!==0)return u;var y=v.compare(r.y,a.y);return y!==0?y:this._dimensionsToTest<=2?0:v.compare(r.getZ(),a.getZ())}},{key:"interfaces_",get:function(){return[Ft]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)v.constructor_.call(this,2);else if(arguments.length===1){var r=arguments[0];if(r!==2&&r!==3)throw new ze("only 2 or 3 dimensions may be specified");this._dimensionsToTest=r}}},{key:"compare",value:function(r,a){return ra?1:it.isNaN(r)?it.isNaN(a)?0:-1:it.isNaN(a)?1:0}}]),v}();_e.DimensionalComparator=vi,_e.NULL_ORDINATE=it.NaN,_e.X=0,_e.Y=1,_e.Z=2,_e.M=3;var Jt=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(r){if(!(r instanceof v))return!1;var a=r;return this.isNull()?a.isNull():this._maxx===a.getMaxX()&&this._maxy===a.getMaxY()&&this._minx===a.getMinX()&&this._miny===a.getMinY()}},{key:"intersection",value:function(r){if(this.isNull()||r.isNull()||!this.intersects(r))return new v;var a=this._minx>r._minx?this._minx:r._minx,u=this._miny>r._miny?this._miny:r._miny;return new v(a,this._maxx=this._minx&&a.getMaxX()<=this._maxx&&a.getMinY()>=this._miny&&a.getMaxY()<=this._maxy}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];return!this.isNull()&&u>=this._minx&&u<=this._maxx&&y>=this._miny&&y<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return!this.isNull()&&!r.isNull()&&!(r._minx>this._maxx||r._maxxthis._maxy||r._maxythis._maxx)return!1;var M=u.x>y.x?u.x:y.x;if(Mthis._maxy)return!1;var W=u.y>y.y?u.y:y.y;return!(Wthis._maxx||iethis._maxy||methis._maxx&&(this._maxx=a._maxx),a._minythis._maxy&&(this._maxy=a._maxy))}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];this.isNull()?(this._minx=u,this._maxx=u,this._miny=y,this._maxy=y):(uthis._maxx&&(this._maxx=u),ythis._maxy&&(this._maxy=y))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var r=this.getWidth(),a=this.getHeight();return ra._minx?1:this._minya._miny?1:this._maxxa._maxx?1:this._maxya._maxy?1:0}},{key:"translate",value:function(r,a){if(this.isNull())return null;this.init(this.getMinX()+r,this.getMaxX()+r,this.getMinY()+a,this.getMaxY()+a)}},{key:"copy",value:function(){return new v(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(r){return!(!this.isNull()&&!r.isNull())||r._minx>this._maxx||r._maxxthis._maxy||r._maxya?r:a}},{key:"expandBy",value:function(){if(arguments.length===1){var r=arguments[0];this.expandBy(r,r)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];if(this.isNull())return null;this._minx-=a,this._maxx+=a,this._miny-=u,this._maxy+=u,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.covers(r)}if(arguments[0]instanceof _e){var a=arguments[0];return this.covers(a)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];return this.covers(u,y)}}},{key:"centre",value:function(){return this.isNull()?null:new _e((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof _e){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof v){var a=arguments[0];this._minx=a._minx,this._maxx=a._maxx,this._miny=a._miny,this._maxy=a._maxy}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];this.init(u.x,y.x,u.y,y.y)}else if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3];Er._maxx&&(a=this._minx-r._maxx);var u=0;return this._maxyr._maxy&&(u=this._miny-r._maxy),a===0?u:u===0?a:Math.sqrt(a*a+u*u)}},{key:"hashCode",value:function(){var r=17;return r=37*(r=37*(r=37*(r=37*r+_e.hashCode(this._minx))+_e.hashCode(this._maxx))+_e.hashCode(this._miny))+_e.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[Ze,Ve]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof _e){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof v){var a=arguments[0];this.init(a)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1];this.init(u.x,y.x,u.y,y.y)}else if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3];this.init(E,M,B,W)}}},{key:"intersects",value:function(){if(arguments.length===3){var r=arguments[0],a=arguments[1],u=arguments[2];return u.x>=(r.xa.x?r.x:a.x)&&u.y>=(r.ya.y?r.y:a.y)}if(arguments.length===4){var y=arguments[0],E=arguments[1],M=arguments[2],B=arguments[3],W=Math.min(M.x,B.x),ie=Math.max(M.x,B.x),me=Math.min(y.x,E.x),Ee=Math.max(y.x,E.x);return!(me>ie)&&!(Eeie)&&!(Ee=this.size())throw new to;return this.array[u]}},{key:"push",value:function(u){return this.array.push(u),u}},{key:"pop",value:function(){if(this.array.length===0)throw new Hi;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Hi;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(u){return this.array.indexOf(u)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),a}(Yn);function hi(v,r){return v.interfaces_&&v.interfaces_.indexOf(r)>-1}var Mn=function(){function v(r){c(this,v),this.str=r}return _(v,[{key:"append",value:function(r){this.str+=r}},{key:"setCharAt",value:function(r,a){this.str=this.str.substr(0,r)+a+this.str.substr(r+1)}},{key:"toString",value:function(){return this.str}}]),v}(),ms=function(){function v(r){c(this,v),this.value=r}return _(v,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(r){return this.valuer?1:0}}],[{key:"compare",value:function(r,a){return ra?1:0}},{key:"isNan",value:function(r){return Number.isNaN(r)}},{key:"valueOf",value:function(r){return new v(r)}}]),v}(),zs=function(){function v(){c(this,v)}return _(v,null,[{key:"isWhitespace",value:function(r){return r<=32&&r>=0||r===127}},{key:"toUpperCase",value:function(r){return r.toUpperCase()}}]),v}(),Ge=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"le",value:function(r){return this._hi9?(Ee=!0,He="9"):He="0"+me,B.append(He),u=u.subtract(v.valueOf(me)).multiply(v.TEN),Ee&&u.selfAdd(v.TEN);var ct=!0,tt=v.magnitude(u._hi);if(tt<0&&Math.abs(tt)>=W-ie&&(ct=!1),!ct)break}return a[0]=y,B.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var a=arguments[0];return this.add(-a)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof v){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0];return this.isNaN()?this:this.selfAdd(-a,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(r){return this.le(r)?this:r}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0];return this.selfDivide(a,0)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1],E=null,M=null,B=null,W=null,ie=null,me=null,Ee=null,He=null;return ie=this._hi/u,He=(E=(me=v.SPLIT*ie)-(E=me-ie))*(B=(He=v.SPLIT*u)-(B=He-u))-(Ee=ie*u)+E*(W=u-B)+(M=ie-E)*B+M*W,He=ie+(me=(this._hi-Ee-He+this._lo-ie*y)/u),this._hi=He,this._lo=ie-He+me,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof v){var r=arguments[0],a=null,u=null,y=null,E=null,M=null,B=null,W=null,ie=null;u=(M=this._hi/r._hi)-(a=(B=v.SPLIT*M)-(a=B-M)),ie=a*(y=(ie=v.SPLIT*r._hi)-(y=ie-r._hi))-(W=M*r._hi)+a*(E=r._hi-y)+u*y+u*E;var me=ie=M+(B=(this._hi-W-ie+this._lo-M*r._lo)/r._hi),Ee=M-ie+B;return new v(me,Ee)}if(typeof arguments[0]=="number"){var He=arguments[0];return it.isNaN(He)?v.createNaN():v.copy(this).selfDivide(He,0)}}},{key:"ge",value:function(r){return this._hi>r._hi||this._hi===r._hi&&this._lo>=r._lo}},{key:"pow",value:function(r){if(r===0)return v.valueOf(1);var a=new v(this),u=v.valueOf(1),y=Math.abs(r);if(y>1)for(;y>0;)y%2==1&&u.selfMultiply(a),(y/=2)>0&&(a=a.sqr());else u=a;return r<0?u.reciprocal():u}},{key:"ceil",value:function(){if(this.isNaN())return v.NaN;var r=Math.ceil(this._hi),a=0;return r===this._hi&&(a=Math.ceil(this._lo)),new v(r,a)}},{key:"compareTo",value:function(r){var a=r;return this._hia._hi?1:this._loa._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var a=arguments[0];return this.init(a),this}}},{key:"max",value:function(r){return this.ge(r)?this:r}},{key:"sqrt",value:function(){if(this.isZero())return v.valueOf(0);if(this.isNegative())return v.NaN;var r=1/Math.sqrt(this._hi),a=this._hi*r,u=v.valueOf(a),y=this.subtract(u.sqr())._hi*(.5*r);return u.add(y)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0],u=null,y=null,E=null,M=null,B=null,W=null;return M=(E=this._hi+a)-(B=E-this._hi),y=(W=(M=a-B+(this._hi-M))+this._lo)+(E-(u=E+W)),this._hi=u+y,this._lo=y+(u-this._hi),this}}else if(arguments.length===2){var ie=arguments[0],me=arguments[1],Ee=null,He=null,ct=null,tt=null,Kt=null,ni=null,ci=null;tt=this._hi+ie,He=this._lo+me,Kt=tt-(ni=tt-this._hi),ct=He-(ci=He-this._lo);var Ci=(Ee=tt+(ni=(Kt=ie-ni+(this._hi-Kt))+He))+(ni=(ct=me-ci+(this._lo-ct))+(ni+(tt-Ee))),Ri=ni+(Ee-Ci);return this._hi=Ci,this._lo=Ri,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof v){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var a=arguments[0];return this.selfMultiply(a,0)}}else if(arguments.length===2){var u=arguments[0],y=arguments[1],E=null,M=null,B=null,W=null,ie=null,me=null;E=(ie=v.SPLIT*this._hi)-this._hi,me=v.SPLIT*u,E=ie-E,M=this._hi-E,B=me-u;var Ee=(ie=this._hi*u)+(me=E*(B=me-B)-ie+E*(W=u-B)+M*B+M*W+(this._hi*y+this._lo*u)),He=me+(E=ie-Ee);return this._hi=Ee,this._lo=He,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return v.NaN;var r=Math.floor(this._hi),a=0;return r===this._hi&&(a=Math.floor(this._lo)),new v(r,a)}},{key:"negate",value:function(){return this.isNaN()?this:new v(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(r){if(r instanceof CloneNotSupportedException)return null;throw r}}},{key:"multiply",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return r.isNaN()?v.createNaN():v.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var a=arguments[0];return it.isNaN(a)?v.createNaN():v.copy(this).selfMultiply(a,0)}}},{key:"isNaN",value:function(){return it.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var r=v.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var r=this.getSpecialNumberString();if(r!==null)return r;var a=new Array(1).fill(null),u=this.extractSignificantDigits(!0,a),y=a[0]+1,E=u;if(u.charAt(0)===".")E="0"+u;else if(y<0)E="0."+v.stringOfChar("0",-y)+u;else if(u.indexOf(".")===-1){var M=y-u.length;E=u+v.stringOfChar("0",M)+".0"}return this.isNegative()?"-"+E:E}},{key:"reciprocal",value:function(){var r,a,u,y,E=null,M=null,B=null,W=null;r=(u=1/this._hi)-(E=(B=v.SPLIT*u)-(E=B-u)),M=(W=v.SPLIT*this._hi)-this._hi;var ie=u+(B=(1-(y=u*this._hi)-(W=E*(M=W-M)-y+E*(a=this._hi-M)+r*M+r*a)-u*this._lo)/this._hi);return new v(ie,u-ie+B)}},{key:"toSciNotation",value:function(){if(this.isZero())return v.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var a=new Array(1).fill(null),u=this.extractSignificantDigits(!1,a),y=v.SCI_NOT_EXPONENT_CHAR+a[0];if(u.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+u);var E="";u.length>1&&(E=u.substring(1));var M=u.charAt(0)+"."+E;return this.isNegative()?"-"+M+y:M+y}},{key:"abs",value:function(){return this.isNaN()?v.NaN:this.isNegative()?this.negate():new v(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(r){return this._hir._hi||this._hi===r._hi&&this._lo>r._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?v.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[Ve,Ze,je]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this.init(r)}else if(arguments[0]instanceof v){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var u=arguments[0];v.constructor_.call(this,v.parse(u))}}else if(arguments.length===2){var y=arguments[0],E=arguments[1];this.init(y,E)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1],u=arguments[2],y=arguments[3];return v.determinant(v.valueOf(r),v.valueOf(a),v.valueOf(u),v.valueOf(y))}if(arguments[3]instanceof v&&arguments[2]instanceof v&&arguments[0]instanceof v&&arguments[1]instanceof v){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3],ie=E.multiply(W).selfSubtract(M.multiply(B));return ie}}},{key:"sqr",value:function(r){return v.valueOf(r).selfMultiply(r)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var r=arguments[0];return v.parse(r)}if(typeof arguments[0]=="number"){var a=arguments[0];return new v(a)}}},{key:"sqrt",value:function(r){return v.valueOf(r).sqrt()}},{key:"parse",value:function(r){for(var a=0,u=r.length;zs.isWhitespace(r.charAt(a));)a++;var y=!1;if(a=u);){var Ee=r.charAt(a);if(a++,zs.isDigit(Ee)){var He=Ee-"0";M.selfMultiply(v.TEN),M.selfAdd(He),B++}else{if(Ee!=="."){if(Ee==="e"||Ee==="E"){var ct=r.substring(a);try{ie=ms.parseInt(ct)}catch(Ci){throw Ci instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+ct+" in string "+r):Ci}break}throw new NumberFormatException("Unexpected character '"+Ee+"' at position "+a+" in string "+r)}W=B,me=!0}}var tt=M;me||(W=B);var Kt=B-W-ie;if(Kt===0)tt=M;else if(Kt>0){var ni=v.TEN.pow(Kt);tt=M.divide(ni)}else if(Kt<0){var ci=v.TEN.pow(-Kt);tt=M.multiply(ci)}return y?tt.negate():tt}},{key:"createNaN",value:function(){return new v(it.NaN,it.NaN)}},{key:"copy",value:function(r){return new v(r)}},{key:"magnitude",value:function(r){var a=Math.abs(r),u=Math.log(a)/Math.log(10),y=Math.trunc(Math.floor(u));return 10*Math.pow(10,y)<=a&&(y+=1),y}},{key:"stringOfChar",value:function(r,a){for(var u=new Mn,y=0;y0){if(M<=0)return v.signum(B);y=E+M}else{if(!(E<0)||M>=0)return v.signum(B);y=-E-M}var W=v.DP_SAFE_EPSILON*y;return B>=W||-B>=W?v.signum(B):2}},{key:"signum",value:function(r){return r>0?1:r<0?-1:0}}]),v}();wr.DP_SAFE_EPSILON=1e-15;var li=function(){function v(){c(this,v)}return _(v,[{key:"getM",value:function(r){if(this.hasM()){var a=this.getDimension()-this.getMeasures();return this.getOrdinate(r,a)}return it.NaN}},{key:"setOrdinate",value:function(r,a,u){}},{key:"getZ",value:function(r){return this.hasZ()?this.getOrdinate(r,2):it.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(r,a){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(r){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(r){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(r){}},{key:"copy",value:function(){}},{key:"getY",value:function(r){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[je]}}]),v}();li.X=0,li.Y=1,li.Z=2,li.M=3;var ti=function(){function v(){c(this,v)}return _(v,null,[{key:"index",value:function(r,a,u){return wr.orientationIndex(r,a,u)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var r=arguments[0],a=r.length-1;if(a<3)throw new ze("Ring has fewer than 4 points, so orientation cannot be determined");for(var u=r[0],y=0,E=1;E<=a;E++){var M=r[E];M.y>u.y&&(u=M,y=E)}var B=y;do(B-=1)<0&&(B=a);while(r[B].equals2D(u)&&B!==y);var W=y;do W=(W+1)%a;while(r[W].equals2D(u)&&W!==y);var ie=r[B],me=r[W];if(ie.equals2D(u)||me.equals2D(u)||ie.equals2D(me))return!1;var Ee=v.index(ie,u,me),He=null;return He=Ee===0?ie.x>me.x:Ee>0,He}if(hi(arguments[0],li)){var ct=arguments[0],tt=ct.size()-1;if(tt<3)throw new ze("Ring has fewer than 4 points, so orientation cannot be determined");for(var Kt=ct.getCoordinate(0),ni=0,ci=1;ci<=tt;ci++){var Ci=ct.getCoordinate(ci);Ci.y>Kt.y&&(Kt=Ci,ni=ci)}var Ri=null,wn=ni;do(wn-=1)<0&&(wn=tt),Ri=ct.getCoordinate(wn);while(Ri.equals2D(Kt)&&wn!==ni);var kn=null,gr=ni;do gr=(gr+1)%tt,kn=ct.getCoordinate(gr);while(kn.equals2D(Kt)&&gr!==ni);if(Ri.equals2D(Kt)||kn.equals2D(Kt)||Ri.equals2D(kn))return!1;var Nr=v.index(Ri,Kt,kn);return Nr===0?Ri.x>kn.x:Nr>0}}}]),v}();ti.CLOCKWISE=-1,ti.RIGHT=ti.CLOCKWISE,ti.COUNTERCLOCKWISE=1,ti.LEFT=ti.COUNTERCLOCKWISE,ti.COLLINEAR=0,ti.STRAIGHT=ti.COLLINEAR;var gs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(r,a){var u=this.getRightmostSideOfSegment(r,a);return u<0&&(u=this.getRightmostSideOfSegment(r,a-1)),u<0&&(this._minCoord=null,this.checkForRightmostCoordinate(r)),u}},{key:"findRightmostEdgeAtVertex",value:function(){var r=this._minDe.getEdge().getCoordinates();et.isTrue(this._minIndex>0&&this._minIndexthis._minCoord.y&&u.y>this._minCoord.y&&y===ti.CLOCKWISE)&&(E=!0),E&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(r,a){var u=r.getEdge().getCoordinates();if(a<0||a+1>=u.length||u[a].y===u[a+1].y)return-1;var y=Je.LEFT;return u[a].ythis._minCoord.x)&&(this._minDe=r,this._minIndex=u,this._minCoord=a[u])}},{key:"findRightmostEdgeAtNode",value:function(){var r=this._minDe.getNode().getEdges();this._minDe=r.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(r){for(var a=r.iterator();a.hasNext();){var u=a.next();u.isForward()&&this.checkForRightmostCoordinate(u)}et.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,this.getRightmostSide(this._minDe,this._minIndex)===Je.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),v}(),ut=function(v){k(a,v);var r=ne(a);function a(u,y){var E;return c(this,a),(E=r.call(this,y?u+" [ "+y+" ]":u)).pt=y?new _e(y):void 0,E.name=Object.keys({TopologyException:a})[0],E}return _(a,[{key:"getCoordinate",value:function(){return this.pt}}]),a}(Ut),mi=function(){function v(){c(this,v),this.array=[]}return _(v,[{key:"addLast",value:function(r){this.array.push(r)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}]),v}(),rt=function(v,r){k(u,v);var a=ne(u);function u(y){var E;return c(this,u),(E=a.call(this)).array=[],y instanceof xe&&E.addAll(y),E}return _(u,[{key:"interfaces_",get:function(){return[Yn,xe]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(y){return arguments.length===1?this.array.push(y):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(y){var E,M=Ce(y);try{for(M.s();!(E=M.n()).done;){var B=E.value;this.array.push(B)}}catch(W){M.e(W)}finally{M.f()}}},{key:"set",value:function(y,E){var M=this.array[y];return this.array[y]=E,M}},{key:"iterator",value:function(){return new Kn(this)}},{key:"get",value:function(y){if(y<0||y>=this.size())throw new to;return this.array[y]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(y){y?this.array.sort(function(E,M){return y.compare(E,M)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(y){for(var E=0,M=this.array.length;E=1&&a.getDepth(Je.LEFT)<=0&&!a.isInteriorAreaEdge()&&a.setInResult(!0)}}},{key:"computeDepths",value:function(r){var a=new Xi,u=new mi,y=r.getNode();for(u.addLast(y),a.add(y),r.setVisited(!0);!u.isEmpty();){var E=u.removeFirst();a.add(E),this.computeNodeDepth(E);for(var M=E.getEdges().iterator();M.hasNext();){var B=M.next().getSym();if(!B.isVisited()){var W=B.getNode();a.contains(W)||(u.addLast(W),a.add(W))}}}}},{key:"compareTo",value:function(r){var a=r;return this._rightMostCoord.xa._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var r=new Jt,a=this._dirEdgeList.iterator();a.hasNext();)for(var u=a.next().getEdge().getCoordinates(),y=0;ya.x?r.x:a.x,W=r.y>a.y?r.y:a.y,ie=u.xy.x?u.x:y.x,He=u.y>y.y?u.y:y.y,ct=((E>ie?E:ie)+(Bme?M:me)+(Wu?u:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var y=arguments[0],E=arguments[1],M=arguments[2];return yM?M:y}}},{key:"wrap",value:function(r,a){return r<0?a- -r%a:r%a}},{key:"max",value:function(){if(arguments.length===3){var r=arguments[0],a=arguments[1],u=arguments[2],y=r;return a>y&&(y=a),u>y&&(y=u),y}if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3],ie=E;return M>ie&&(ie=M),B>ie&&(ie=B),W>ie&&(ie=W),ie}}},{key:"average",value:function(r,a){return(r+a)/2}}]),v}();ur.LOG_10=Math.log(10);var In=function(){function v(){c(this,v)}return _(v,null,[{key:"segmentToSegment",value:function(r,a,u,y){if(r.equals(a))return v.pointToSegment(r,u,y);if(u.equals(y))return v.pointToSegment(y,r,a);var E=!1;if(Jt.intersects(r,a,u,y)){var M=(a.x-r.x)*(y.y-u.y)-(a.y-r.y)*(y.x-u.x);if(M===0)E=!0;else{var B=(r.y-u.y)*(y.x-u.x)-(r.x-u.x)*(y.y-u.y),W=((r.y-u.y)*(a.x-r.x)-(r.x-u.x)*(a.y-r.y))/M,ie=B/M;(ie<0||ie>1||W<0||W>1)&&(E=!0)}}else E=!0;return E?ur.min(v.pointToSegment(r,u,y),v.pointToSegment(a,u,y),v.pointToSegment(u,r,a),v.pointToSegment(y,r,a)):0}},{key:"pointToSegment",value:function(r,a,u){if(a.x===u.x&&a.y===u.y)return r.distance(a);var y=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),E=((r.x-a.x)*(u.x-a.x)+(r.y-a.y)*(u.y-a.y))/y;if(E<=0)return r.distance(a);if(E>=1)return r.distance(u);var M=((a.y-r.y)*(u.x-a.x)-(a.x-r.x)*(u.y-a.y))/y;return Math.abs(M)*Math.sqrt(y)}},{key:"pointToLinePerpendicular",value:function(r,a,u){var y=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),E=((a.y-r.y)*(u.x-a.x)-(a.x-r.x)*(u.y-a.y))/y;return Math.abs(E)*Math.sqrt(y)}},{key:"pointToSegmentString",value:function(r,a){if(a.length===0)throw new ze("Line array must contain at least one vertex");for(var u=r.distance(a[0]),y=0;y0)&&(M=W,E=B)}return E}}},{key:"extend",value:function(r,a,u){var y=r.create(u,a.getDimension()),E=a.size();if(v.copy(a,0,y,0,E),E>0)for(var M=E;M0)&&(a=y)}return a}}]),v}(),Q=function(){function v(){c(this,v)}return _(v,null,[{key:"toDimensionSymbol",value:function(r){switch(r){case v.FALSE:return v.SYM_FALSE;case v.TRUE:return v.SYM_TRUE;case v.DONTCARE:return v.SYM_DONTCARE;case v.P:return v.SYM_P;case v.L:return v.SYM_L;case v.A:return v.SYM_A}throw new ze("Unknown dimension value: "+r)}},{key:"toDimensionValue",value:function(r){switch(zs.toUpperCase(r)){case v.SYM_FALSE:return v.FALSE;case v.SYM_TRUE:return v.TRUE;case v.SYM_DONTCARE:return v.DONTCARE;case v.SYM_P:return v.P;case v.SYM_L:return v.L;case v.SYM_A:return v.A}throw new ze("Unknown dimension symbol: "+r)}}]),v}();Q.P=0,Q.L=1,Q.A=2,Q.FALSE=-1,Q.TRUE=-2,Q.DONTCARE=-3,Q.SYM_FALSE="F",Q.SYM_TRUE="T",Q.SYM_DONTCARE="*",Q.SYM_P="0",Q.SYM_L="1",Q.SYM_A="2";var ge=function(){function v(){c(this,v)}return _(v,[{key:"filter",value:function(r){}}]),v}(),be=function(){function v(){c(this,v)}return _(v,[{key:"filter",value:function(r,a){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),v}(),Le=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new Jt:this._points.expandEnvelope(new Jt)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new a(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof yt){var u=arguments[0],y=arguments[1];if(!this.isEquivalentClass(u))return!1;var E=u;if(this._points.size()!==E._points.size())return!1;for(var M=0;M0){var E=this._points.copy();$.reverse(E),this._points=E}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?Q.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var u=this._points.copy();return $.reverse(u),this.getFactory().createLineString(u)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return yt.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return H.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var u=arguments[0],y=u,E=0,M=0;E= 2)");this._points=u}},{key:"isCoordinate",value:function(u){for(var y=0;y=1&&this.getCoordinateSequence().size()= 4)")}},{key:"getGeometryType",value:function(){return yt.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var u=arguments[0],y=arguments[1];Le.constructor_.call(this,u,y),this.validateConstruction()}}]),a}(Le);zi.MINIMUM_VALID_SIZE=4;var ji=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"setOrdinate",value:function(u,y){switch(u){case a.X:this.x=y;break;case a.Y:this.y=y;break;default:throw new ze("Invalid ordinate index: "+u)}}},{key:"getZ",value:function(){return _e.NULL_ORDINATE}},{key:"getOrdinate",value:function(u){switch(u){case a.X:return this.x;case a.Y:return this.y}throw new ze("Invalid ordinate index: "+u)}},{key:"setZ",value:function(u){throw new ze("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(u){this.x=u.x,this.y=u.y,this.z=u.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)_e.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof a){var u=arguments[0];_e.constructor_.call(this,u.x,u.y)}else if(arguments[0]instanceof _e){var y=arguments[0];_e.constructor_.call(this,y.x,y.y)}}else if(arguments.length===2){var E=arguments[0],M=arguments[1];_e.constructor_.call(this,E,M,_e.NULL_ORDINATE)}}}]),a}(_e);ji.X=0,ji.Y=1,ji.Z=-1,ji.M=-1;var fi=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(u,y){switch(u){case a.X:this.x=y;break;case a.Y:this.y=y;break;case a.M:this._m=y;break;default:throw new ze("Invalid ordinate index: "+u)}}},{key:"setM",value:function(u){this._m=u}},{key:"getZ",value:function(){return _e.NULL_ORDINATE}},{key:"getOrdinate",value:function(u){switch(u){case a.X:return this.x;case a.Y:return this.y;case a.M:return this._m}throw new ze("Invalid ordinate index: "+u)}},{key:"setZ",value:function(u){throw new ze("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(u){this.x=u.x,this.y=u.y,this.z=u.getZ(),this._m=u.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)_e.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof a){var u=arguments[0];_e.constructor_.call(this,u.x,u.y),this._m=u._m}else if(arguments[0]instanceof _e){var y=arguments[0];_e.constructor_.call(this,y.x,y.y),this._m=this.getM()}}else if(arguments.length===3){var E=arguments[0],M=arguments[1],B=arguments[2];_e.constructor_.call(this,E,M,_e.NULL_ORDINATE),this._m=B}}}]),a}(_e);fi.X=0,fi.Y=1,fi.Z=-1,fi.M=2;var Ii=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(u,y){switch(u){case _e.X:this.x=y;break;case _e.Y:this.y=y;break;case _e.Z:this.z=y;break;case _e.M:this._m=y;break;default:throw new ze("Invalid ordinate index: "+u)}}},{key:"setM",value:function(u){this._m=u}},{key:"getOrdinate",value:function(u){switch(u){case _e.X:return this.x;case _e.Y:return this.y;case _e.Z:return this.getZ();case _e.M:return this.getM()}throw new ze("Invalid ordinate index: "+u)}},{key:"copy",value:function(){return new a(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(u){this.x=u.x,this.y=u.y,this.z=u.getZ(),this._m=u.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)_e.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof a){var u=arguments[0];_e.constructor_.call(this,u),this._m=u._m}else if(arguments[0]instanceof _e){var y=arguments[0];_e.constructor_.call(this,y),this._m=this.getM()}}else if(arguments.length===4){var E=arguments[0],M=arguments[1],B=arguments[2],W=arguments[3];_e.constructor_.call(this,E,M,B),this._m=W}}}]),a}(_e),Mi=function(){function v(){c(this,v)}return _(v,null,[{key:"measures",value:function(r){return r instanceof ji?0:r instanceof fi||r instanceof Ii?1:0}},{key:"dimension",value:function(r){return r instanceof ji?2:r instanceof fi?3:r instanceof Ii?4:3}},{key:"create",value:function(){if(arguments.length===1){var r=arguments[0];return v.create(r,0)}if(arguments.length===2){var a=arguments[0],u=arguments[1];return a===2?new ji:a===3&&u===0?new _e:a===3&&u===1?new fi:a===4&&u===1?new Ii:new _e}}}]),v}(),tn=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getCoordinate",value:function(u){return this.get(u)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&hi(arguments[0],xe)){for(var u=arguments[0],y=arguments[1],E=!1,M=u.iterator();M.hasNext();)this.add(M.next(),y),E=!0;return E}return re(I(a.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var u=re(I(a.prototype),"clone",this).call(this),y=0;y=1){var W=this.get(this.size()-1);if(W.equals2D(M))return null}re(I(a.prototype),"add",this).call(this,M)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var ie=arguments[0],me=arguments[1];return this.add(ie,me),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Ee=arguments[0],He=arguments[1],ct=arguments[2];if(ct)for(var tt=0;tt=0;Kt--)this.add(Ee[Kt],He);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof _e){var ni=arguments[0],ci=arguments[1],Ci=arguments[2];if(!Ci){var Ri=this.size();if(Ri>0){if(ni>0){var wn=this.get(ni-1);if(wn.equals2D(ci))return null}if(niLi&&(Or=-1);for(var yn=Is;yn!==Li;yn+=Or)this.add(gr[yn],Nr);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var u=this.get(0).copy();this.add(u,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var y=arguments[0],E=arguments[1];this.ensureCapacity(y.length),this.add(y,E)}}}}]),a}(rt);tn.coordArrayType=new Array(0).fill(null);var wi=function(){function v(){c(this,v)}return _(v,null,[{key:"isRing",value:function(r){return!(r.length<4)&&!!r[0].equals2D(r[r.length-1])}},{key:"ptNotInList",value:function(r,a){for(var u=0;u=r?a:[]}},{key:"indexOf",value:function(r,a){for(var u=0;u0)&&(a=r[u]);return a}},{key:"extract",value:function(r,a,u){a=ur.clamp(a,0,r.length);var y=(u=ur.clamp(u,-1,r.length))-a+1;u<0&&(y=0),a>=r.length&&(y=0),uy.length)return 1;if(u.length===0)return 0;var E=wi.compare(u,y);return wi.isEqualReversed(u,y)?0:E}},{key:"OLDcompare",value:function(r,a){var u=r,y=a;if(u.lengthy.length)return 1;if(u.length===0)return 0;for(var E=wi.increasingDirection(u),M=wi.increasingDirection(y),B=E>0?0:u.length-1,W=M>0?0:u.length-1,ie=0;ie0){var r=new ki(17*this._coordinates.length);r.append("("),r.append(this._coordinates[0]);for(var a=1;a3&&(y=3),y<2&&(y=2),new Ns(u,y)}if(arguments.length===3){var E=arguments[0],M=arguments[1],B=arguments[2],W=M-B;return B>1&&(B=1),W>3&&(W=3),W<2&&(W=2),new Ns(E,W+B,B)}}}},{key:"interfaces_",get:function(){return[Dr,Ve]}}],[{key:"instance",value:function(){return v.instanceObject}}]),v}();Fo.instanceObject=new Fo;var Gn=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"copyInternal",value:function(){for(var u=new Array(this._geometries.length).fill(null),y=0;y=0?r:a}}]),v}(),hn=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"readResolve",value:function(){return v.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[Ve]}}],[{key:"constructor_",value:function(){this._name=null;var r=arguments[0];this._name=r,v.nameToTypeMap.put(r,this)}}]),v}();hn.nameToTypeMap=new Fu,nn.Type=hn,nn.FIXED=new hn("FIXED"),nn.FLOATING=new hn("FLOATING"),nn.FLOATING_SINGLE=new hn("FLOATING SINGLE"),nn.maximumPreciseValue=9007199254740992;var io=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"copyInternal",value:function(){for(var u=new Array(this._geometries.length).fill(null),y=0;y1){if(W instanceof jt)return this.createMultiPolygon(v.toPolygonArray(r));if(W instanceof Le)return this.createMultiLineString(v.toLineStringArray(r));if(W instanceof Ue)return this.createMultiPoint(v.toPointArray(r));et.shouldNeverReachHere("Unhandled geometry type: "+W.getGeometryType())}return W}},{key:"createMultiPointFromCoords",value:function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof _e){var r=arguments[0];return this.createPoint(r!==null?this.getCoordinateSequenceFactory().create([r]):null)}if(hi(arguments[0],li)){var a=arguments[0];return new Ue(a,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(hi(arguments[0],li)){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Array){var a=arguments[0];return this.createPolygon(this.createLinearRing(a))}if(arguments[0]instanceof zi){var u=arguments[0];return this.createPolygon(u,null)}}else if(arguments.length===2){var y=arguments[0],E=arguments[1];return new jt(y,E,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new Yt(null,this);if(arguments.length===1){var r=arguments[0];return new Yt(r,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return this.createLinearRing(r!==null?this.getCoordinateSequenceFactory().create(r):null)}if(hi(arguments[0],li)){var a=arguments[0];return new zi(a,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new Gn(null,this);if(arguments.length===1){var r=arguments[0];return new Gn(r,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new Ai(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new Ai(r,this)}if(hi(arguments[0],li)){var a=arguments[0];if(a===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(a.size()).fill(null),y=0;y="a"&&r<="z"||r>="A"&&r<="Z"}},{key:"isNumeric_",value:function(r,a){return r>="0"&&r<="9"||r=="."&&!(a!==void 0&&a)}},{key:"isWhiteSpace_",value:function(r){return r==" "||r==" "||r=="\r"||r==` +`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var r,a=this.nextChar_(),u=this.index_,y=a;if(a=="(")r=Dn;else if(a==",")r=hr;else if(a==")")r=qr;else if(this.isNumeric_(a)||a=="-")r=no,y=this.readNumber_();else if(this.isAlpha_(a))r=ys,y=this.readText_();else{if(this.isWhiteSpace_(a))return this.nextToken();if(a!=="")throw new Error("Unexpected character: "+a);r=Si}return{position:u,value:y,type:r}}},{key:"readNumber_",value:function(){var r,a=this.index_,u=!1,y=!1;do r=="."?u=!0:r!="e"&&r!="E"||(y=!0),r=this.nextChar_();while(this.isNumeric_(r,u)||!y&&(r=="e"||r=="E")||y&&(r=="-"||r=="+"));return parseFloat(this.wkt.substring(a,this.index_--))}},{key:"readText_",value:function(){var r,a=this.index_;do r=this.nextChar_();while(this.isAlpha_(r));return this.wkt.substring(a,this.index_--).toUpperCase()}}]),v}(),jo=function(){function v(r,a){c(this,v),this.lexer_=r,this.token_,this.layout_=on,this.factory=a}return _(v,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(r){return this.token_.type==r}},{key:"match",value:function(r){var a=this.isTokenType(r);return a&&this.consume_(),a}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var r=on,a=this.token_;if(this.isTokenType(ys)){var u=a.value;u==="Z"?r=Jr:u==="M"?r=Os:u==="ZM"&&(r=fn),r!==on&&this.consume_()}return r}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Dn)){var r=[];do r.push(this.parseGeometry_());while(this.match(hr));if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Dn)){var r=this.parsePoint_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Dn)){var r=this.parsePointList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Dn)){var r=this.parseLineStringTextList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var r;if(this.match(Dn)){if(r=this.token_.type==Dn?this.parsePointTextList_():this.parsePointList_(),this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Dn)){var r=this.parseLineStringTextList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Dn)){var r=this.parsePolygonTextList_();if(this.match(qr))return r}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var r=[],a=this.layout_.length,u=0;u1?r.createPolygon(ci[0],ci.slice(1)):r.createPolygon(ci[0])},y=this.token_;if(this.match(ys)){var E=y.value;if(this.layout_=this.parseGeometryLayout_(),E=="GEOMETRYCOLLECTION"){var M=this.parseGeometryCollectionText_();return r.createGeometryCollection(M)}switch(E){case"POINT":var B=this.parsePointText_();return B?r.createPoint(F(_e,Ae(B))):r.createPoint();case"LINESTRING":var W=this.parseLineStringText_().map(a);return r.createLineString(W);case"LINEARRING":var ie=this.parseLineStringText_().map(a);return r.createLinearRing(ie);case"POLYGON":var me=this.parsePolygonText_();return me&&me.length!==0?u(me):r.createPolygon();case"MULTIPOINT":var Ee=this.parseMultiPointText_();if(!Ee||Ee.length===0)return r.createMultiPoint();var He=Ee.map(a).map(function(ni){return r.createPoint(ni)});return r.createMultiPoint(He);case"MULTILINESTRING":var ct=this.parseMultiLineStringText_().map(function(ni){return r.createLineString(ni.map(a))});return r.createMultiLineString(ct);case"MULTIPOLYGON":var tt=this.parseMultiPolygonText_();if(!tt||tt.length===0)return r.createMultiPolygon();var Kt=tt.map(u);return r.createMultiPolygon(Kt);default:throw new Error("Invalid geometry type: "+E)}}throw new Error(this.formatErrorMessage_())}}]),v}();function Uo(v){if(v.isEmpty())return"";var r=v.getCoordinate(),a=[r.x,r.y];return r.z===void 0||Number.isNaN(r.z)||a.push(r.z),r.m===void 0||Number.isNaN(r.m)||a.push(r.m),a.join(" ")}function _s(v){for(var r=v.getCoordinates().map(function(E){var M=[E.x,E.y];return E.z===void 0||Number.isNaN(E.z)||M.push(E.z),E.m===void 0||Number.isNaN(E.m)||M.push(E.m),M}),a=[],u=0,y=r.length;u0&&(r+=" "+u),v.isEmpty()?r+" "+cr:r+" ("+a(v)+")"}var so=function(){function v(r){c(this,v),this.geometryFactory=r||new Vr,this.precisionModel=this.geometryFactory.getPrecisionModel()}return _(v,[{key:"read",value:function(r){var a=new tl(r);return new jo(a,this.geometryFactory).parse()}},{key:"write",value:function(r){return ro(r)}}]),v}(),il=function(){function v(r){c(this,v),this.parser=new so(r)}return _(v,[{key:"write",value:function(r){return this.parser.write(r)}}],[{key:"toLineString",value:function(r,a){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+a.x+" "+a.y+" )"}}]),v}(),Yi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getIndexAlongSegment",value:function(r,a){return this.computeIntLineIndex(),this._intLineIndex[r][a]}},{key:"getTopologySummary",value:function(){var r=new ki;return this.isEndPoint()&&r.append(" endpoint"),this._isProper&&r.append(" proper"),this.isCollinear()&&r.append(" collinear"),r.toString()}},{key:"computeIntersection",value:function(r,a,u,y){this._inputLines[0][0]=r,this._inputLines[0][1]=a,this._inputLines[1][0]=u,this._inputLines[1][1]=y,this._result=this.computeIntersect(r,a,u,y)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var r=arguments[0],a=this.getEdgeDistance(r,0),u=this.getEdgeDistance(r,1);a>u?(this._intLineIndex[r][0]=0,this._intLineIndex[r][1]=1):(this._intLineIndex[r][0]=1,this._intLineIndex[r][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(r){this._precisionModel=r}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var r=arguments[0],a=0;aE?y:E;else{var B=Math.abs(r.x-a.x),W=Math.abs(r.y-a.y);(M=y>E?B:W)!==0||r.equals(a)||(M=Math.max(B,W))}return et.isTrue(!(M===0&&!r.equals(a)),"Bad distance calculation"),M}},{key:"nonRobustComputeEdgeDistance",value:function(r,a,u){var y=r.x-a.x,E=r.y-a.y,M=Math.sqrt(y*y+E*E);return et.isTrue(!(M===0&&!r.equals(a)),"Invalid distance calculation"),M}}]),v}();Yi.DONT_INTERSECT=0,Yi.DO_INTERSECT=1,Yi.COLLINEAR=2,Yi.NO_INTERSECTION=0,Yi.POINT_INTERSECTION=1,Yi.COLLINEAR_INTERSECTION=2;var vs=function(v){k(a,v);var r=ne(a);function a(){return c(this,a),r.call(this)}return _(a,[{key:"isInSegmentEnvelopes",value:function(u){var y=new Jt(this._inputLines[0][0],this._inputLines[0][1]),E=new Jt(this._inputLines[1][0],this._inputLines[1][1]);return y.contains(u)&&E.contains(u)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return re(I(a.prototype),"computeIntersection",this).apply(this,arguments);var u=arguments[0],y=arguments[1],E=arguments[2];if(this._isProper=!1,Jt.intersects(y,E,u)&&ti.index(y,E,u)===0&&ti.index(E,y,u)===0)return this._isProper=!0,(u.equals(y)||u.equals(E))&&(this._isProper=!1),this._result=Yi.POINT_INTERSECTION,null;this._result=Yi.NO_INTERSECTION}},{key:"intersection",value:function(u,y,E,M){var B=this.intersectionSafe(u,y,E,M);return this.isInSegmentEnvelopes(B)||(B=new _e(a.nearestEndpoint(u,y,E,M))),this._precisionModel!==null&&this._precisionModel.makePrecise(B),B}},{key:"checkDD",value:function(u,y,E,M,B){var W=wr.intersection(u,y,E,M),ie=this.isInSegmentEnvelopes(W);cn.out.println("DD in env = "+ie+" --------------------- "+W),B.distance(W)>1e-4&&cn.out.println("Distance = "+B.distance(W))}},{key:"intersectionSafe",value:function(u,y,E,M){var B=si.intersection(u,y,E,M);return B===null&&(B=a.nearestEndpoint(u,y,E,M)),B}},{key:"computeCollinearIntersection",value:function(u,y,E,M){var B=Jt.intersects(u,y,E),W=Jt.intersects(u,y,M),ie=Jt.intersects(E,M,u),me=Jt.intersects(E,M,y);return B&&W?(this._intPt[0]=E,this._intPt[1]=M,Yi.COLLINEAR_INTERSECTION):ie&&me?(this._intPt[0]=u,this._intPt[1]=y,Yi.COLLINEAR_INTERSECTION):B&&ie?(this._intPt[0]=E,this._intPt[1]=u,!E.equals(u)||W||me?Yi.COLLINEAR_INTERSECTION:Yi.POINT_INTERSECTION):B&&me?(this._intPt[0]=E,this._intPt[1]=y,!E.equals(y)||W||ie?Yi.COLLINEAR_INTERSECTION:Yi.POINT_INTERSECTION):W&&ie?(this._intPt[0]=M,this._intPt[1]=u,!M.equals(u)||B||me?Yi.COLLINEAR_INTERSECTION:Yi.POINT_INTERSECTION):W&&me?(this._intPt[0]=M,this._intPt[1]=y,!M.equals(y)||B||ie?Yi.COLLINEAR_INTERSECTION:Yi.POINT_INTERSECTION):Yi.NO_INTERSECTION}},{key:"computeIntersect",value:function(u,y,E,M){if(this._isProper=!1,!Jt.intersects(u,y,E,M))return Yi.NO_INTERSECTION;var B=ti.index(u,y,E),W=ti.index(u,y,M);if(B>0&&W>0||B<0&&W<0)return Yi.NO_INTERSECTION;var ie=ti.index(E,M,u),me=ti.index(E,M,y);return ie>0&&me>0||ie<0&&me<0?Yi.NO_INTERSECTION:B===0&&W===0&&ie===0&&me===0?this.computeCollinearIntersection(u,y,E,M):(B===0||W===0||ie===0||me===0?(this._isProper=!1,u.equals2D(E)||u.equals2D(M)?this._intPt[0]=u:y.equals2D(E)||y.equals2D(M)?this._intPt[0]=y:B===0?this._intPt[0]=new _e(E):W===0?this._intPt[0]=new _e(M):ie===0?this._intPt[0]=new _e(u):me===0&&(this._intPt[0]=new _e(y))):(this._isProper=!0,this._intPt[0]=this.intersection(u,y,E,M)),Yi.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(u,y,E,M){var B=u,W=In.pointToSegment(u,E,M),ie=In.pointToSegment(y,E,M);return iey&&(u=a.x,y=r.x),this._p.x>=u&&this._p.x<=y&&(this._isPointOnSegment=!0),null}if(r.y>this._p.y&&a.y<=this._p.y||a.y>this._p.y&&r.y<=this._p.y){var E=ti.index(r,a,this._p);if(E===ti.COLLINEAR)return this._isPointOnSegment=!0,null;a.ythis.location.length){var a=new Array(3).fill(null);a[Je.ON]=this.location[Je.ON],a[Je.LEFT]=he.NONE,a[Je.RIGHT]=he.NONE,this.location=a}for(var u=0;u1&&r.append(he.toLocationSymbol(this.location[Je.LEFT])),r.append(he.toLocationSymbol(this.location[Je.ON])),this.location.length>1&&r.append(he.toLocationSymbol(this.location[Je.RIGHT])),r.toString()}},{key:"setLocations",value:function(r,a,u){this.location[Je.ON]=r,this.location[Je.LEFT]=a,this.location[Je.RIGHT]=u}},{key:"get",value:function(r){return r1}},{key:"isAnyNull",value:function(){for(var r=0;rthis._maxNodeDegree&&(this._maxNodeDegree=a),r=this.getNext(r)}while(r!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(r,a,u){var y=r.getCoordinates();if(a){var E=1;u&&(E=0);for(var M=E;M=0;W--)this._pts.add(y[W])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)}},{key:"containsPoint",value:function(r){var a=this.getLinearRing();if(!a.getEnvelopeInternal().contains(r)||!Gr.isInRing(r,a.getCoordinates()))return!1;for(var u=this._holes.iterator();u.hasNext();)if(u.next().containsPoint(r))return!1;return!0}},{key:"addHole",value:function(r){this._holes.add(r)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var r=arguments[0];this.mergeLabel(r,0),this.mergeLabel(r,1)}else if(arguments.length===2){var a=arguments[0],u=arguments[1],y=a.getLocation(u,Je.RIGHT);if(y===he.NONE)return null;if(this._label.getLocation(u)===he.NONE)return this._label.setLocation(u,y),null}}},{key:"setShell",value:function(r){this._shell=r,r!==null&&r.addHole(this)}},{key:"toPolygon",value:function(r){for(var a=new Array(this._holes.size()).fill(null),u=0;u=2,"found partial label"),this.computeIM(r)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0&&arguments.length===1){var r=arguments[0];this._label=r}}}]),v}(),Go=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"isIncidentEdgeInResult",value:function(){for(var u=this.getEdges().getEdges().iterator();u.hasNext();)if(u.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(u){u.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(u){}},{key:"computeMergedLocation",value:function(u,y){var E=he.NONE;if(E=this._label.getLocation(y),!u.isNull(y)){var M=u.getLocation(y);E!==he.BOUNDARY&&(E=M)}return E}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return re(I(a.prototype),"setLabel",this).apply(this,arguments);var u=arguments[0],y=arguments[1];this._label===null?this._label=new Ki(u,y):this._label.setLocation(u,y)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof a){var u=arguments[0];this.mergeLabel(u._label)}else if(arguments[0]instanceof Ki)for(var y=arguments[0],E=0;E<2;E++){var M=this.computeMergedLocation(y,E),B=this._label.getLocation(E);B===he.NONE&&this._label.setLocation(E,M)}}},{key:"add",value:function(u){this._edges.insert(u),u.setNode(this)}},{key:"setLabelBoundary",value:function(u){if(this._label===null)return null;var y=he.NONE;this._label!==null&&(y=this._label.getLocation(u));var E=null;switch(y){case he.BOUNDARY:E=he.INTERIOR;break;case he.INTERIOR:default:E=he.BOUNDARY}this._label.setLocation(u,E)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var u=arguments[0],y=arguments[1];this._coord=u,this._edges=y,this._label=new Ki(0,he.NONE)}}]),a}(nl),Fs=function(v){k(a,v);var r=ne(a);function a(){return c(this,a),r.apply(this,arguments)}return a}(Jn);function rl(v){return v==null?0:v.color}function Ti(v){return v==null?null:v.parent}function Zr(v,r){v!==null&&(v.color=r)}function va(v){return v==null?null:v.left}function sl(v){return v==null?null:v.right}var Zo=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),(u=r.call(this)).root_=null,u.size_=0,u}return _(a,[{key:"get",value:function(u){for(var y=this.root_;y!==null;){var E=u.compareTo(y.key);if(E<0)y=y.left;else{if(!(E>0))return y.value;y=y.right}}return null}},{key:"put",value:function(u,y){if(this.root_===null)return this.root_={key:u,value:y,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var E,M,B=this.root_;do if(E=B,(M=u.compareTo(B.key))<0)B=B.left;else{if(!(M>0)){var W=B.value;return B.value=y,W}B=B.right}while(B!==null);var ie={key:u,left:null,right:null,value:y,parent:E,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return M<0?E.left=ie:E.right=ie,this.fixAfterInsertion(ie),this.size_++,null}},{key:"fixAfterInsertion",value:function(u){var y;for(u.color=1;u!=null&&u!==this.root_&&u.parent.color===1;)Ti(u)===va(Ti(Ti(u)))?rl(y=sl(Ti(Ti(u))))===1?(Zr(Ti(u),0),Zr(y,0),Zr(Ti(Ti(u)),1),u=Ti(Ti(u))):(u===sl(Ti(u))&&(u=Ti(u),this.rotateLeft(u)),Zr(Ti(u),0),Zr(Ti(Ti(u)),1),this.rotateRight(Ti(Ti(u)))):rl(y=va(Ti(Ti(u))))===1?(Zr(Ti(u),0),Zr(y,0),Zr(Ti(Ti(u)),1),u=Ti(Ti(u))):(u===va(Ti(u))&&(u=Ti(u),this.rotateRight(u)),Zr(Ti(u),0),Zr(Ti(Ti(u)),1),this.rotateLeft(Ti(Ti(u))));this.root_.color=0}},{key:"values",value:function(){var u=new rt,y=this.getFirstEntry();if(y!==null)for(u.add(y.value);(y=a.successor(y))!==null;)u.add(y.value);return u}},{key:"entrySet",value:function(){var u=new Xi,y=this.getFirstEntry();if(y!==null)for(u.add(y);(y=a.successor(y))!==null;)u.add(y);return u}},{key:"rotateLeft",value:function(u){if(u!=null){var y=u.right;u.right=y.left,y.left!=null&&(y.left.parent=u),y.parent=u.parent,u.parent==null?this.root_=y:u.parent.left===u?u.parent.left=y:u.parent.right=y,y.left=u,u.parent=y}}},{key:"rotateRight",value:function(u){if(u!=null){var y=u.left;u.left=y.right,y.right!=null&&(y.right.parent=u),y.parent=u.parent,u.parent==null?this.root_=y:u.parent.right===u?u.parent.right=y:u.parent.left=y,y.right=u,u.parent=y}}},{key:"getFirstEntry",value:function(){var u=this.root_;if(u!=null)for(;u.left!=null;)u=u.left;return u}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(u){for(var y=this.root_;y!==null;){var E=u.compareTo(y.key);if(E<0)y=y.left;else{if(!(E>0))return!0;y=y.right}}return!1}}],[{key:"successor",value:function(u){var y;if(u===null)return null;if(u.right!==null){for(y=u.right;y.left!==null;)y=y.left;return y}y=u.parent;for(var E=u;y!==null&&E===y.right;)E=y,y=y.parent;return y}}]),a}(Fs),Wo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"find",value:function(r){return this.nodeMap.get(r)}},{key:"addNode",value:function(){if(arguments[0]instanceof _e){var r=arguments[0],a=this.nodeMap.get(r);return a===null&&(a=this.nodeFact.createNode(r),this.nodeMap.put(r,a)),a}if(arguments[0]instanceof Go){var u=arguments[0],y=this.nodeMap.get(u.getCoordinate());return y===null?(this.nodeMap.put(u.getCoordinate(),u),u):(y.mergeLabel(u),y)}}},{key:"print",value:function(r){for(var a=this.iterator();a.hasNext();)a.next().print(r)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(r){for(var a=new rt,u=this.iterator();u.hasNext();){var y=u.next();y.getLabel().getLocation(r)===he.BOUNDARY&&a.add(y)}return a}},{key:"add",value:function(r){var a=r.getCoordinate();this.addNode(a).add(r)}}],[{key:"constructor_",value:function(){this.nodeMap=new Zo,this.nodeFact=null;var r=arguments[0];this.nodeFact=r}}]),v}(),En=function(){function v(){c(this,v)}return _(v,null,[{key:"isNorthern",value:function(r){return r===v.NE||r===v.NW}},{key:"isOpposite",value:function(r,a){return r!==a&&(r-a+4)%4===2}},{key:"commonHalfPlane",value:function(r,a){if(r===a)return r;if((r-a+4)%4===2)return-1;var u=ra?r:a)===3?3:u}},{key:"isInHalfPlane",value:function(r,a){return a===v.SE?r===v.SE||r===v.SW:r===a||r===a+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1];if(r===0&&a===0)throw new ze("Cannot compute the quadrant for point ( "+r+", "+a+" )");return r>=0?a>=0?v.NE:v.SE:a>=0?v.NW:v.SW}if(arguments[0]instanceof _e&&arguments[1]instanceof _e){var u=arguments[0],y=arguments[1];if(y.x===u.x&&y.y===u.y)throw new ze("Cannot compute the quadrant for two identical points "+u);return y.x>=u.x?y.y>=u.y?v.NE:v.SE:y.y>=u.y?v.NW:v.SW}}}]),v}();En.NE=0,En.NW=1,En.SW=2,En.SE=3;var Xo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compareDirection",value:function(r){return this._dx===r._dx&&this._dy===r._dy?0:this._quadrant>r._quadrant?1:this._quadrant2){M.linkDirectedEdgesForMinimalEdgeRings();var B=M.buildMinimalRings(),W=this.findShell(B);W!==null?(this.placePolygonHoles(W,B),a.add(W)):u.addAll(B)}else y.add(M)}return y}},{key:"buildMaximalEdgeRings",value:function(r){for(var a=new rt,u=r.iterator();u.hasNext();){var y=u.next();if(y.isInResult()&&y.getLabel().isArea()&&y.getEdgeRing()===null){var E=new _a(y,this._geometryFactory);a.add(E),E.setInResult()}}return a}},{key:"placePolygonHoles",value:function(r,a){for(var u=a.iterator();u.hasNext();){var y=u.next();y.isHole()&&y.setShell(r)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(r){for(var a=0,u=null,y=r.iterator();y.hasNext();){var E=y.next();E.isHole()||(u=E,a++)}return et.isTrue(a<=1,"found two shells in MinimalEdgeRing list"),u}},{key:"add",value:function(){if(arguments.length===1){var r=arguments[0];this.add(r.getEdgeEnds(),r.getNodes())}else if(arguments.length===2){var a=arguments[0],u=arguments[1];zr.linkResultDirectedEdges(u);var y=this.buildMaximalEdgeRings(a),E=new rt,M=this.buildMinimalEdgeRings(y,this._shellList,E);this.sortShellsAndHoles(M,this._shellList,E),this.placeFreeHoles(this._shellList,E)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new rt;var r=arguments[0];this._geometryFactory=r}},{key:"findEdgeRingContaining",value:function(r,a){for(var u=r.getLinearRing(),y=u.getEnvelopeInternal(),E=u.getCoordinateN(0),M=null,B=null,W=a.iterator();W.hasNext();){var ie=W.next(),me=ie.getLinearRing(),Ee=me.getEnvelopeInternal();if(!Ee.equals(y)&&Ee.contains(y)){E=wi.ptNotInList(u.getCoordinates(),me.getCoordinates());var He=!1;Gr.isInRing(E,me.getCoordinates())&&(He=!0),He&&(M===null||B.contains(Ee))&&(B=(M=ie).getLinearRing().getEnvelopeInternal())}}return M}}]),v}(),Bs=function(){function v(){c(this,v)}return _(v,[{key:"getBounds",value:function(){}}]),v}(),pi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[Bs,Ve]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var r=arguments[0],a=arguments[1];this._bounds=r,this._item=a}}]),v}(),xs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"poll",value:function(){if(this.isEmpty())return null;var r=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),r}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(r){for(var a=null,u=this._items.get(r);2*r<=this._size&&((a=2*r)!==this._size&&this._items.get(a+1).compareTo(this._items.get(a))<0&&a++,this._items.get(a).compareTo(u)<0);r=a)this._items.set(r,this._items.get(a));this._items.set(r,u)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(r){this._items.add(null),this._size+=1;var a=this._size;for(this._items.set(0,r);r.compareTo(this._items.get(Math.trunc(a/2)))<0;a/=2)this._items.set(a,this._items.get(Math.trunc(a/2)));this._items.set(a,r)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new rt,this._items.add(null)}}]),v}(),ju=function(){function v(){c(this,v)}return _(v,[{key:"insert",value:function(r,a){}},{key:"remove",value:function(r,a){}},{key:"query",value:function(){}}]),v}(),Zn=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(r){et.isTrue(this._bounds===null),this._childBoundables.add(r)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[Bs,Ve]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new rt,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var r=arguments[0];this._level=r}}}]),v}(),oo={reverseOrder:function(){return{compare:function(v,r){return r.compareTo(v)}}},min:function(v){return oo.sort(v),v.get(0)},sort:function(v,r){var a=v.toArray();r?Fe.sort(a,r):Fe.sort(a);for(var u=v.iterator(),y=0,E=a.length;yv.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,r,a),null):(this.expand(this._boundable2,this._boundable1,!0,r,a),null);if(u)return this.expand(this._boundable1,this._boundable2,!1,r,a),null;if(y)return this.expand(this._boundable2,this._boundable1,!0,r,a),null;throw new ze("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(v.isComposite(this._boundable1)||v.isComposite(this._boundable2))}},{key:"compareTo",value:function(r){var a=r;return this._distancea._distance?1:0}},{key:"expand",value:function(r,a,u,y,E){for(var M=r.getChildBoundables().iterator();M.hasNext();){var B=M.next(),W=null;(W=u?new v(a,B,this._itemDistance):new v(B,a,this._itemDistance)).getDistance()-2),y.getLevel()===u)return E.add(y),null;for(var M=y.getChildBoundables().iterator();M.hasNext();){var B=M.next();B instanceof Zn?this.boundablesAtLevel(u,B,E):(et.isTrue(B instanceof pi),u===-1&&E.add(B))}return null}}},{key:"query",value:function(){if(arguments.length===1){var r=arguments[0];this.build();var a=new rt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.queryInternal(r,this._root,a),a}if(arguments.length===2){var u=arguments[0],y=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),u)&&this.queryInternal(u,this._root,y)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.remove(r,this._root,a)}if(arguments.length===3){var u=arguments[0],y=arguments[1],E=arguments[2],M=this.removeItem(y,E);if(M)return!0;for(var B=null,W=y.getChildBoundables().iterator();W.hasNext();){var ie=W.next();if(this.getIntersectsOp().intersects(ie.getBounds(),u)&&ie instanceof Zn&&(M=this.remove(u,ie,E))){B=ie;break}}return B!==null&&B.getChildBoundables().isEmpty()&&y.getChildBoundables().remove(B),M}}},{key:"createHigherLevels",value:function(r,a){et.isTrue(!r.isEmpty());var u=this.createParentBoundables(r,a+1);return u.size()===1?u.get(0):this.createHigherLevels(u,a+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var r=arguments[0],a=0,u=r.getChildBoundables().iterator();u.hasNext();){var y=u.next();if(y instanceof Zn){var E=this.depth(y);E>a&&(a=E)}}return a+1}}},{key:"createParentBoundables",value:function(r,a){et.isTrue(!r.isEmpty());var u=new rt;u.add(this.createNode(a));var y=new rt(r);oo.sort(y,this.getComparator());for(var E=y.iterator();E.hasNext();){var M=E.next();this.lastNode(u).getChildBoundables().size()===this.getNodeCapacity()&&u.add(this.createNode(a)),this.lastNode(u).addChildBoundable(M)}return u}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[Ve]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new rt,this._nodeCapacity=null,arguments.length===0)v.constructor_.call(this,v.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var r=arguments[0];et.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}}},{key:"compareDoubles",value:function(r,a){return r>a?1:r0);for(var E=new rt,M=0;M=0;){var Ee=ie.poll(),He=Ee.getDistance();if(He>=W)break;if(Ee.isLeaves())if(me.size()He&&(me.poll(),me.add(Ee));var tt=me.peek();W=tt.getDistance()}else Ee.expandToQueue(ie,W)}return a.getItems(me)}}},{key:"createNode",value:function(u){return new ll(u)}},{key:"size",value:function(){return arguments.length===0?re(I(a.prototype),"size",this).call(this):re(I(a.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof Jt))return re(I(a.prototype),"insert",this).apply(this,arguments);var u=arguments[0],y=arguments[1];if(u.isNull())return null;re(I(a.prototype),"insert",this).call(this,u,y)}},{key:"getIntersectsOp",value:function(){return a.intersectsOp}},{key:"verticalSlices",value:function(u,y){for(var E=Math.trunc(Math.ceil(u.size()/y)),M=new Array(y).fill(null),B=u.iterator(),W=0;W0;){var ie=W.poll(),me=ie.getDistance();if(me>=M)break;ie.isLeaves()?(M=me,B=ie):ie.expandToQueue(W,M)}return B===null?null:[B.getBoundable(0).getItem(),B.getBoundable(1).getItem()]}}else{if(arguments.length===2){var Ee=arguments[0],He=arguments[1];if(this.isEmpty()||Ee.isEmpty())return null;var ct=new lo(this.getRoot(),Ee.getRoot(),He);return this.nearestNeighbour(ct)}if(arguments.length===3){var tt=arguments[0],Kt=arguments[1],ni=arguments[2],ci=new pi(tt,Kt),Ci=new lo(this.getRoot(),ci,ni);return this.nearestNeighbour(Ci)[0]}if(arguments.length===4){var Ri=arguments[0],wn=arguments[1],kn=arguments[2],gr=arguments[3],Nr=new pi(Ri,wn),Is=new lo(this.getRoot(),Nr,kn);return this.nearestNeighbourK(Is,gr)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var u=arguments[0],y=arguments[1],E=it.POSITIVE_INFINITY,M=new xs;for(M.add(u);!M.isEmpty();){var B=M.poll(),W=B.getDistance();if(W>y)return!1;if(B.maximumDistance()<=y)return!0;if(B.isLeaves()){if((E=W)<=y)return!0}else B.expandToQueue(M,E)}return!1}if(arguments.length===3){var ie=arguments[0],me=arguments[1],Ee=arguments[2],He=new lo(this.getRoot(),ie.getRoot(),me);return this.isWithinDistance(He,Ee)}}},{key:"interfaces_",get:function(){return[ju,Ve]}}],[{key:"constructor_",value:function(){if(arguments.length===0)a.constructor_.call(this,a.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var u=arguments[0];uo.constructor_.call(this,u)}}},{key:"centreX",value:function(u){return a.avg(u.getMinX(),u.getMaxX())}},{key:"avg",value:function(u,y){return(u+y)/2}},{key:"getItems",value:function(u){for(var y=new Array(u.size()).fill(null),E=0;!u.isEmpty();){var M=u.poll();y[E]=M.getBoundable(0).getItem(),E++}return y}},{key:"centreY",value:function(u){return a.avg(u.getMinY(),u.getMaxY())}}]),a}(uo),ll=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"computeBounds",value:function(){for(var u=null,y=this.getChildBoundables().iterator();y.hasNext();){var E=y.next();u===null?u=new Jt(E.getBounds()):u.expandToInclude(E.getBounds())}return u}}],[{key:"constructor_",value:function(){var u=arguments[0];Zn.constructor_.call(this,u)}}]),a}(Zn);kr.STRtreeNode=ll,kr.xComparator=new(function(){function v(){c(this,v)}return _(v,[{key:"interfaces_",get:function(){return[Ft]}},{key:"compare",value:function(r,a){return uo.compareDoubles(kr.centreX(r.getBounds()),kr.centreX(a.getBounds()))}}]),v}()),kr.yComparator=new(function(){function v(){c(this,v)}return _(v,[{key:"interfaces_",get:function(){return[Ft]}},{key:"compare",value:function(r,a){return uo.compareDoubles(kr.centreY(r.getBounds()),kr.centreY(a.getBounds()))}}]),v}()),kr.intersectsOp=new(function(){function v(){c(this,v)}return _(v,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(r,a){return r.intersects(a)}}]),v}()),kr.DEFAULT_NODE_CAPACITY=10;var Vl=function(){function v(){c(this,v)}return _(v,null,[{key:"relativeSign",value:function(r,a){return ra?1:0}},{key:"compare",value:function(r,a,u){if(a.equals2D(u))return 0;var y=v.relativeSign(a.x,u.x),E=v.relativeSign(a.y,u.y);switch(r){case 0:return v.compareValue(y,E);case 1:return v.compareValue(E,y);case 2:return v.compareValue(E,-y);case 3:return v.compareValue(-y,E);case 4:return v.compareValue(-y,-E);case 5:return v.compareValue(-E,-y);case 6:return v.compareValue(-E,y);case 7:return v.compareValue(y,-E)}return et.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(r,a){return r<0?-1:r>0?1:a<0?-1:a>0?1:0}}]),v}(),ql=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(r){var a=r;return this.segmentIndexa.segmentIndex?1:this.coord.equals2D(a.coord)?0:this._isInterior?a._isInterior?Vl.compare(this._segmentOctant,this.coord,a.coord):1:-1}},{key:"isEndPoint",value:function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var r=arguments[0],a=arguments[1],u=arguments[2],y=arguments[3];this._segString=r,this.coord=new _e(a),this.segmentIndex=u,this._segmentOctant=y,this._isInterior=!a.equals2D(r.getCoordinate(u))}}]),v}(),Gl=function(){function v(){c(this,v)}return _(v,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),v}(),js=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getSplitCoordinates",value:function(){var r=new tn;this.addEndpoints();for(var a=this.iterator(),u=a.next();a.hasNext();){var y=a.next();this.addEdgeCoordinates(u,y,r),u=y}return r.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var r=new rt;this.findCollapsesFromInsertedNodes(r),this.findCollapsesFromExistingVertices(r);for(var a=r.iterator();a.hasNext();){var u=a.next().intValue();this.add(this._edge.getCoordinate(u),u)}}},{key:"createSplitEdgePts",value:function(r,a){var u=a.segmentIndex-r.segmentIndex+2;if(u===2)return[new _e(r.coord),new _e(a.coord)];var y=this._edge.getCoordinate(a.segmentIndex),E=a.isInterior()||!a.coord.equals2D(y);E||u--;var M=new Array(u).fill(null),B=0;M[B++]=new _e(r.coord);for(var W=r.segmentIndex+1;W<=a.segmentIndex;W++)M[B++]=this._edge.getCoordinate(W);return E&&(M[B]=new _e(a.coord)),M}},{key:"print",value:function(r){r.println("Intersections:");for(var a=this.iterator();a.hasNext();)a.next().print(r)}},{key:"findCollapsesFromExistingVertices",value:function(r){for(var a=0;a=0?a>=0?u>=y?0:1:u>=y?7:6:a>=0?u>=y?3:2:u>=y?4:5}if(arguments[0]instanceof _e&&arguments[1]instanceof _e){var E=arguments[0],M=arguments[1],B=M.x-E.x,W=M.y-E.y;if(B===0&&W===0)throw new ze("Cannot compute the octant for two identical points "+E);return v.octant(B,W)}}}]),v}(),Uu=function(){function v(){c(this,v)}return _(v,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(r){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(r){}},{key:"getData",value:function(){}}]),v}(),Vu=function(){function v(){c(this,v)}return _(v,[{key:"addIntersection",value:function(r,a){}},{key:"interfaces_",get:function(){return[Uu]}}]),v}(),bs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(r){return this._pts[r]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))}},{key:"setData",value:function(r){this._data=r}},{key:"safeOctant",value:function(r,a){return r.equals2D(a)?0:Zl.octant(r,a)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];this.addIntersectionNode(r,a)}else if(arguments.length===4){var u=arguments[0],y=arguments[1],E=arguments[3],M=new _e(u.getIntersection(E));this.addIntersection(M,y)}}},{key:"toString",value:function(){return il.toLineString(new Ns(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(r,a){var u=a,y=u+1;if(y=0&&u>=0||a<=0&&u<=0?Math.max(a,u):0}if(arguments[0]instanceof _e){var y=arguments[0];return ti.index(this.p0,this.p1,y)}}},{key:"toGeometry",value:function(r){return r.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(r){if(!(r instanceof v))return!1;var a=r;return this.p0.equals(a.p0)&&this.p1.equals(a.p1)}},{key:"intersection",value:function(r){var a=new vs;return a.computeIntersection(this.p0,this.p1,r.p0,r.p1),a.hasIntersection()?a.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof _e){var r=arguments[0];if(r.equals(this.p0)||r.equals(this.p1))return new _e(r);var a=this.projectionFactor(r),u=new _e;return u.x=this.p0.x+a*(this.p1.x-this.p0.x),u.y=this.p0.y+a*(this.p1.y-this.p0.y),u}if(arguments[0]instanceof v){var y=arguments[0],E=this.projectionFactor(y.p0),M=this.projectionFactor(y.p1);if(E>=1&&M>=1||E<=0&&M<=0)return null;var B=this.project(y.p0);E<0&&(B=this.p0),E>1&&(B=this.p1);var W=this.project(y.p1);return M<0&&(W=this.p0),M>1&&(W=this.p1),new v(B,W)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(r){return r===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(r){return In.pointToLinePerpendicular(r,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return v.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(r){if(r.equals(this.p0))return 0;if(r.equals(this.p1))return 1;var a=this.p1.x-this.p0.x,u=this.p1.y-this.p0.y,y=a*a+u*u;return y<=0?it.NaN:((r.x-this.p0.x)*a+(r.y-this.p0.y)*u)/y}},{key:"closestPoints",value:function(r){var a=this.intersection(r);if(a!==null)return[a,a];var u=new Array(2).fill(null),y=it.MAX_VALUE,E=null,M=this.closestPoint(r.p0);y=M.distance(r.p0),u[0]=M,u[1]=r.p0;var B=this.closestPoint(r.p1);(E=B.distance(r.p1))0&&a<1?this.project(r):this.p0.distance(r)1||it.isNaN(a))&&(a=1),a}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(r){var a=this.p1.getY()-this.p0.getY(),u=this.p0.getX()-this.p1.getX(),y=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),E=a*a+u*u,M=a*a-u*u,B=r.getX(),W=r.getY();return new _e((-M*B-2*a*u*W-2*a*y)/E,(M*W-2*a*u*B-2*u*y)/E)}},{key:"distance",value:function(){if(arguments[0]instanceof v){var r=arguments[0];return In.segmentToSegment(this.p0,this.p1,r.p0,r.p1)}if(arguments[0]instanceof _e){var a=arguments[0];return In.pointToSegment(a,this.p0,this.p1)}}},{key:"pointAlong",value:function(r){var a=new _e;return a.x=this.p0.x+r*(this.p1.x-this.p0.x),a.y=this.p0.y+r*(this.p1.y-this.p0.y),a}},{key:"hashCode",value:function(){var r=it.doubleToLongBits(this.p0.x);r^=31*it.doubleToLongBits(this.p0.y);var a=Math.trunc(r)^Math.trunc(r>>32),u=it.doubleToLongBits(this.p1.x);return u^=31*it.doubleToLongBits(this.p1.y),a^(Math.trunc(u)^Math.trunc(u>>32))}},{key:"interfaces_",get:function(){return[Ze,Ve]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)v.constructor_.call(this,new _e,new _e);else if(arguments.length===1){var r=arguments[0];v.constructor_.call(this,r.p0,r.p1)}else if(arguments.length===2){var a=arguments[0],u=arguments[1];this.p0=a,this.p1=u}else if(arguments.length===4){var y=arguments[0],E=arguments[1],M=arguments[2],B=arguments[3];v.constructor_.call(this,new _e(y,E),new _e(M,B))}}},{key:"midPoint",value:function(r,a){return new _e((r.x+a.x)/2,(r.y+a.y)/2)}}]),v}(),qu=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"overlap",value:function(){if(arguments.length!==2&&arguments.length===4){var r=arguments[0],a=arguments[1],u=arguments[2],y=arguments[3];r.getLineSegment(a,this._overlapSeg1),u.getLineSegment(y,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Tn,this._overlapSeg2=new Tn}}]),v}(),Yo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getLineSegment",value:function(r,a){a.p0=this._pts[r],a.p1=this._pts[r+1]}},{key:"computeSelect",value:function(r,a,u,y){var E=this._pts[a],M=this._pts[u];if(u-a==1)return y.select(this,a),null;if(!r.intersects(E,M))return null;var B=Math.trunc((a+u)/2);a=r.length-1)return r.length-1;for(var y=En.quadrant(r[u],r[u+1]),E=a+1;EE.getId()&&(E.computeOverlaps(B,u),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new rt,this._index=new kr,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0&&arguments.length===1){var u=arguments[0];cl.constructor_.call(this,u)}}}]),a}(cl),hl=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"overlap",value:function(){if(arguments.length!==4)return re(I(a.prototype),"overlap",this).apply(this,arguments);var u=arguments[0],y=arguments[1],E=arguments[2],M=arguments[3],B=u.getContext(),W=E.getContext();this._si.processIntersections(B,y,W,M)}}],[{key:"constructor_",value:function(){this._si=null;var u=arguments[0];this._si=u}}]),a}(qu);ba.SegmentOverlapAction=hl;var fr=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"isDeletable",value:function(r,a,u,y){var E=this._inputLine[r],M=this._inputLine[a],B=this._inputLine[u];return!!this.isConcave(E,M,B)&&!!this.isShallow(E,M,B,y)&&this.isShallowSampled(E,M,r,u,y)}},{key:"deleteShallowConcavities",value:function(){for(var r=1,a=this.findNextNonDeletedIndex(r),u=this.findNextNonDeletedIndex(a),y=!1;u=0;y--)this.addPt(r[y])}},{key:"isRedundant",value:function(r){if(this._ptList.size()<1)return!1;var a=this._ptList.get(this._ptList.size()-1);return r.distance(a)Math.PI;)r-=v.PI_TIMES_2;for(;r<=-Math.PI;)r+=v.PI_TIMES_2;return r}},{key:"angle",value:function(){if(arguments.length===1){var r=arguments[0];return Math.atan2(r.y,r.x)}if(arguments.length===2){var a=arguments[0],u=arguments[1],y=u.x-a.x,E=u.y-a.y;return Math.atan2(E,y)}}},{key:"isAcute",value:function(r,a,u){var y=r.x-a.x,E=r.y-a.y;return y*(u.x-a.x)+E*(u.y-a.y)>0}},{key:"isObtuse",value:function(r,a,u){var y=r.x-a.x,E=r.y-a.y;return y*(u.x-a.x)+E*(u.y-a.y)<0}},{key:"interiorAngle",value:function(r,a,u){var y=v.angle(a,r),E=v.angle(a,u);return Math.abs(E-y)}},{key:"normalizePositive",value:function(r){if(r<0){for(;r<0;)r+=v.PI_TIMES_2;r>=v.PI_TIMES_2&&(r=0)}else{for(;r>=v.PI_TIMES_2;)r-=v.PI_TIMES_2;r<0&&(r=0)}return r}},{key:"angleBetween",value:function(r,a,u){var y=v.angle(a,r),E=v.angle(a,u);return v.diff(y,E)}},{key:"diff",value:function(r,a){var u=null;return(u=rMath.PI&&(u=2*Math.PI-u),u}},{key:"toRadians",value:function(r){return r*Math.PI/180}},{key:"getTurn",value:function(r,a){var u=Math.sin(a-r);return u>0?v.COUNTERCLOCKWISE:u<0?v.CLOCKWISE:v.NONE}},{key:"angleBetweenOriented",value:function(r,a,u){var y=v.angle(a,r),E=v.angle(a,u)-y;return E<=-Math.PI?E+v.PI_TIMES_2:E>Math.PI?E-v.PI_TIMES_2:E}}]),v}();On.PI_TIMES_2=2*Math.PI,On.PI_OVER_2=Math.PI/2,On.PI_OVER_4=Math.PI/4,On.COUNTERCLOCKWISE=ti.COUNTERCLOCKWISE,On.CLOCKWISE=ti.CLOCKWISE,On.NONE=ti.COLLINEAR;var dr=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"addNextSegment",value:function(r,a){if(this._s0=this._s1,this._s1=this._s2,this._s2=r,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 u=ti.index(this._s0,this._s1,this._s2),y=u===ti.CLOCKWISE&&this._side===Je.LEFT||u===ti.COUNTERCLOCKWISE&&this._side===Je.RIGHT;u===0?this.addCollinear(a):y?this.addOutsideTurn(u,a):this.addInsideTurn(u,a)}},{key:"addLineEndCap",value:function(r,a){var u=new Tn(r,a),y=new Tn;this.computeOffsetSegment(u,Je.LEFT,this._distance,y);var E=new Tn;this.computeOffsetSegment(u,Je.RIGHT,this._distance,E);var M=a.x-r.x,B=a.y-r.y,W=Math.atan2(B,M);switch(this._bufParams.getEndCapStyle()){case ke.CAP_ROUND:this._segList.addPt(y.p1),this.addDirectedFillet(a,W+Math.PI/2,W-Math.PI/2,ti.CLOCKWISE,this._distance),this._segList.addPt(E.p1);break;case ke.CAP_FLAT:this._segList.addPt(y.p1),this._segList.addPt(E.p1);break;case ke.CAP_SQUARE:var ie=new _e;ie.x=Math.abs(this._distance)*Math.cos(W),ie.y=Math.abs(this._distance)*Math.sin(W);var me=new _e(y.p1.x+ie.x,y.p1.y+ie.y),Ee=new _e(E.p1.x+ie.x,E.p1.y+ie.y);this._segList.addPt(me),this._segList.addPt(Ee)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(r,a,u,y){var E=si.intersection(a.p0,a.p1,u.p0,u.p1);if(E!==null&&(y<=0?1:E.distance(r)/Math.abs(y))<=this._bufParams.getMitreLimit())return this._segList.addPt(E),null;this.addLimitedMitreJoin(a,u,y,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(r,a){if(this._offset0.p1.distance(this._offset1.p0)=Ee&&(W-=2*Math.PI),this._segList.addPt(a),this.addDirectedFillet(r,W,Ee,y,E),this._segList.addPt(u)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(r,a,u){this._s1=r,this._s2=a,this._side=u,this._seg1.setCoordinates(r,a),this.computeOffsetSegment(this._seg1,u,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(r,a,u,y){var E=this._seg0.p1,M=On.angle(E,this._seg0.p0),B=On.angleBetweenOriented(this._seg0.p0,E,this._seg1.p1)/2,W=On.normalize(M+B),ie=On.normalize(W+Math.PI),me=y*u,Ee=u-me*Math.abs(Math.sin(B)),He=E.x+me*Math.cos(ie),ct=E.y+me*Math.sin(ie),tt=new _e(He,ct),Kt=new Tn(E,tt),ni=Kt.pointAlongOffset(1,Ee),ci=Kt.pointAlongOffset(1,-Ee);this._side===Je.LEFT?(this._segList.addPt(ni),this._segList.addPt(ci)):(this._segList.addPt(ci),this._segList.addPt(ni))}},{key:"addDirectedFillet",value:function(r,a,u,y,E){var M=y===ti.CLOCKWISE?-1:1,B=Math.abs(a-u),W=Math.trunc(B/this._filletAngleQuantum+.5);if(W<1)return null;for(var ie=B/W,me=new _e,Ee=0;Ee0){var u=new _e((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(u);var y=new _e((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(y)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(r){var a=new _e(r.x+this._distance,r.y);this._segList.addPt(a),this.addDirectedFillet(r,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(r,a){this._segList.addPt(r.p1),this._segList.addPt(a.p0)}},{key:"init",value:function(r){this._distance=r,this._maxCurveSegmentError=r*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new fl,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(r*v.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(r){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===ke.JOIN_BEVEL||this._bufParams.getJoinStyle()===ke.JOIN_MITRE?(r&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,ti.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){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 Tn,this._seg1=new Tn,this._offset0=new Tn,this._offset1=new Tn,this._side=0,this._hasNarrowConcaveAngle=!1;var r=arguments[0],a=arguments[1],u=arguments[2];this._precisionModel=r,this._bufParams=a,this._li=new vs,this._filletAngleQuantum=Math.PI/2/a.getQuadrantSegments(),a.getQuadrantSegments()>=8&&a.getJoinStyle()===ke.JOIN_ROUND&&(this._closingSegLengthFactor=v.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)}}]),v}();dr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,dr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,dr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,dr.MAX_CLOSING_SEG_LEN_FACTOR=80;var Ko=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getOffsetCurve",value:function(r,a){if(this._distance=a,a===0)return null;var u=a<0,y=Math.abs(a),E=this.getSegGen(y);r.length<=1?this.computePointCurve(r[0],E):this.computeOffsetCurve(r,u,E);var M=E.getCoordinates();return u&&wi.reverse(M),M}},{key:"computeSingleSidedBufferCurve",value:function(r,a,u){var y=this.simplifyTolerance(this._distance);if(a){u.addSegments(r,!0);var E=fr.simplify(r,-y),M=E.length-1;u.initSideSegments(E[M],E[M-1],Je.LEFT),u.addFirstSegment();for(var B=M-2;B>=0;B--)u.addNextSegment(E[B],!0)}else{u.addSegments(r,!1);var W=fr.simplify(r,y),ie=W.length-1;u.initSideSegments(W[0],W[1],Je.LEFT),u.addFirstSegment();for(var me=2;me<=ie;me++)u.addNextSegment(W[me],!0)}u.addLastSegment(),u.closeRing()}},{key:"computeRingBufferCurve",value:function(r,a,u){var y=this.simplifyTolerance(this._distance);a===Je.RIGHT&&(y=-y);var E=fr.simplify(r,y),M=E.length-1;u.initSideSegments(E[M-1],E[0],a);for(var B=1;B<=M;B++){var W=B!==1;u.addNextSegment(E[B],W)}u.closeRing()}},{key:"computeLineBufferCurve",value:function(r,a){var u=this.simplifyTolerance(this._distance),y=fr.simplify(r,u),E=y.length-1;a.initSideSegments(y[0],y[1],Je.LEFT);for(var M=2;M<=E;M++)a.addNextSegment(y[M],!0);a.addLastSegment(),a.addLineEndCap(y[E-1],y[E]);var B=fr.simplify(r,-u),W=B.length-1;a.initSideSegments(B[W],B[W-1],Je.LEFT);for(var ie=W-2;ie>=0;ie--)a.addNextSegment(B[ie],!0);a.addLastSegment(),a.addLineEndCap(B[1],B[0]),a.closeRing()}},{key:"computePointCurve",value:function(r,a){switch(this._bufParams.getEndCapStyle()){case ke.CAP_ROUND:a.createCircle(r);break;case ke.CAP_SQUARE:a.createSquare(r)}}},{key:"getLineCurve",value:function(r,a){if(this._distance=a,this.isLineOffsetEmpty(a))return null;var u=Math.abs(a),y=this.getSegGen(u);if(r.length<=1)this.computePointCurve(r[0],y);else if(this._bufParams.isSingleSided()){var E=a<0;this.computeSingleSidedBufferCurve(r,E,y)}else this.computeLineBufferCurve(r,y);return y.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(r){return r*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(r,a,u){if(this._distance=u,r.length<=2)return this.getLineCurve(r,u);if(u===0)return v.copyCoordinates(r);var y=this.getSegGen(u);return this.computeRingBufferCurve(r,a,y),y.getCoordinates()}},{key:"computeOffsetCurve",value:function(r,a,u){var y=this.simplifyTolerance(this._distance);if(a){var E=fr.simplify(r,-y),M=E.length-1;u.initSideSegments(E[M],E[M-1],Je.LEFT),u.addFirstSegment();for(var B=M-2;B>=0;B--)u.addNextSegment(E[B],!0)}else{var W=fr.simplify(r,y),ie=W.length-1;u.initSideSegments(W[0],W[1],Je.LEFT),u.addFirstSegment();for(var me=2;me<=ie;me++)u.addNextSegment(W[me],!0)}u.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(r){return r===0||r<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(r){return new dr(this._precisionModel,this._bufParams,r)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],a=arguments[1];this._precisionModel=r,this._bufParams=a}},{key:"copyCoordinates",value:function(r){for(var a=new Array(r.length).fill(null),u=0;uE.getMaxY()||this.findStabbedSegments(r,y.getDirectedEdges(),a)}return a}if(arguments.length===3){if(hi(arguments[2],Yn)&&arguments[0]instanceof _e&&arguments[1]instanceof Ho)for(var M=arguments[0],B=arguments[1],W=arguments[2],ie=B.getEdge().getCoordinates(),me=0;methis._seg.p1.y&&this._seg.reverse();var Ee=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(Eethis._seg.p1.y||ti.index(this._seg.p0,this._seg.p1,M)===ti.RIGHT)){var He=B.getDepth(Je.LEFT);this._seg.p0.equals(ie[me])||(He=B.getDepth(Je.RIGHT));var ct=new ka(this._seg,He);W.add(ct)}}else if(hi(arguments[2],Yn)&&arguments[0]instanceof _e&&hi(arguments[1],Yn))for(var tt=arguments[0],Kt=arguments[1],ni=arguments[2],ci=Kt.iterator();ci.hasNext();){var Ci=ci.next();Ci.isForward()&&this.findStabbedSegments(tt,Ci,ni)}}}},{key:"getDepth",value:function(r){var a=this.findStabbedSegments(r);return a.size()===0?0:oo.min(a)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Tn;var r=arguments[0];this._subgraphs=r}}]),v}(),ka=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compareTo",value:function(r){var a=r;if(this._upwardSeg.minX()>=a._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=a._upwardSeg.minX())return-1;var u=this._upwardSeg.orientationIndex(a._upwardSeg);return u!==0||(u=-1*a._upwardSeg.orientationIndex(this._upwardSeg))!==0?u:this._upwardSeg.compareTo(a._upwardSeg)}},{key:"compareX",value:function(r,a){var u=r.p0.compareTo(a.p0);return u!==0?u:r.p1.compareTo(a.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],a=arguments[1];this._upwardSeg=new Tn(r),this._leftDepth=a}}]),v}();wa.DepthSegment=ka;var dl=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,null,[{key:"constructor_",value:function(){Re.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),a}(Re),Jo=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"getY",value:function(){var r=this.y/this.w;if(it.isNaN(r)||it.isInfinite(r))throw new dl;return r}},{key:"getX",value:function(){var r=this.x/this.w;if(it.isNaN(r)||it.isInfinite(r))throw new dl;return r}},{key:"getCoordinate",value:function(){var r=new _e;return r.x=this.getX(),r.y=this.getY(),r}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var r=arguments[0];this.x=r.x,this.y=r.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var a=arguments[0],u=arguments[1];this.x=a,this.y=u,this.w=1}else if(arguments[0]instanceof v&&arguments[1]instanceof v){var y=arguments[0],E=arguments[1];this.x=y.y*E.w-E.y*y.w,this.y=E.x*y.w-y.x*E.w,this.w=y.x*E.y-E.x*y.y}else if(arguments[0]instanceof _e&&arguments[1]instanceof _e){var M=arguments[0],B=arguments[1];this.x=M.y-B.y,this.y=B.x-M.x,this.w=M.x*B.y-B.x*M.y}}else if(arguments.length===3){var W=arguments[0],ie=arguments[1],me=arguments[2];this.x=W,this.y=ie,this.w=me}else if(arguments.length===4){var Ee=arguments[0],He=arguments[1],ct=arguments[2],tt=arguments[3],Kt=Ee.y-He.y,ni=He.x-Ee.x,ci=Ee.x*He.y-He.x*Ee.y,Ci=ct.y-tt.y,Ri=tt.x-ct.x,wn=ct.x*tt.y-tt.x*ct.y;this.x=ni*wn-Ri*ci,this.y=Ci*ci-Kt*wn,this.w=Kt*Ri-Ci*ni}}}]),v}(),Ni=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"area",value:function(){return v.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return v.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(r){if(r===null)throw new ze("Supplied point is null.");return v.interpolateZ(r,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return v.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return v.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return v.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return v.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return v.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return v.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var r=arguments[0],a=arguments[1],u=arguments[2];this.p0=r,this.p1=a,this.p2=u}},{key:"area",value:function(r,a,u){return Math.abs(((u.x-r.x)*(a.y-r.y)-(a.x-r.x)*(u.y-r.y))/2)}},{key:"signedArea",value:function(r,a,u){return((u.x-r.x)*(a.y-r.y)-(a.x-r.x)*(u.y-r.y))/2}},{key:"det",value:function(r,a,u,y){return r*y-a*u}},{key:"interpolateZ",value:function(r,a,u,y){var E=a.x,M=a.y,B=u.x-E,W=y.x-E,ie=u.y-M,me=y.y-M,Ee=B*me-W*ie,He=r.x-E,ct=r.y-M,tt=(me*He-W*ct)/Ee,Kt=(-ie*He+B*ct)/Ee;return a.getZ()+tt*(u.getZ()-a.getZ())+Kt*(y.getZ()-a.getZ())}},{key:"longestSideLength",value:function(r,a,u){var y=r.distance(a),E=a.distance(u),M=u.distance(r),B=y;return E>B&&(B=E),M>B&&(B=M),B}},{key:"circumcentreDD",value:function(r,a,u){var y=Ge.valueOf(r.x).subtract(u.x),E=Ge.valueOf(r.y).subtract(u.y),M=Ge.valueOf(a.x).subtract(u.x),B=Ge.valueOf(a.y).subtract(u.y),W=Ge.determinant(y,E,M,B).multiply(2),ie=y.sqr().add(E.sqr()),me=M.sqr().add(B.sqr()),Ee=Ge.determinant(E,ie,B,me),He=Ge.determinant(y,ie,M,me),ct=Ge.valueOf(u.x).subtract(Ee.divide(W)).doubleValue(),tt=Ge.valueOf(u.y).add(He.divide(W)).doubleValue();return new _e(ct,tt)}},{key:"isAcute",value:function(r,a,u){return!!On.isAcute(r,a,u)&&!!On.isAcute(a,u,r)&&!!On.isAcute(u,r,a)}},{key:"circumcentre",value:function(r,a,u){var y=u.x,E=u.y,M=r.x-y,B=r.y-E,W=a.x-y,ie=a.y-E,me=2*v.det(M,B,W,ie),Ee=v.det(B,M*M+B*B,ie,W*W+ie*ie),He=v.det(M,M*M+B*B,W,W*W+ie*ie);return new _e(y-Ee/me,E+He/me)}},{key:"perpendicularBisector",value:function(r,a){var u=a.x-r.x,y=a.y-r.y,E=new Jo(r.x+u/2,r.y+y/2,1),M=new Jo(r.x-y+u/2,r.y+u+y/2,1);return new Jo(E,M)}},{key:"angleBisector",value:function(r,a,u){var y=a.distance(r),E=y/(y+a.distance(u)),M=u.x-r.x,B=u.y-r.y;return new _e(r.x+E*M,r.y+E*B)}},{key:"area3D",value:function(r,a,u){var y=a.x-r.x,E=a.y-r.y,M=a.getZ()-r.getZ(),B=u.x-r.x,W=u.y-r.y,ie=u.getZ()-r.getZ(),me=E*ie-M*W,Ee=M*B-y*ie,He=y*W-E*B,ct=me*me+Ee*Ee+He*He,tt=Math.sqrt(ct)/2;return tt}},{key:"centroid",value:function(r,a,u){var y=(r.x+a.x+u.x)/3,E=(r.y+a.y+u.y)/3;return new _e(y,E)}},{key:"inCentre",value:function(r,a,u){var y=a.distance(u),E=r.distance(u),M=r.distance(a),B=y+E+M,W=(y*r.x+E*a.x+M*u.x)/B,ie=(y*r.y+E*a.y+M*u.y)/B;return new _e(W,ie)}}]),v}(),pl=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"addRingSide",value:function(r,a,u,y,E){if(a===0&&r.length=zi.MINIMUM_VALID_SIZE&&ti.isCCW(r)&&(M=E,B=y,u=Je.opposite(u));var W=this._curveBuilder.getRingCurve(r,u,a);this.addCurve(W,M,B)}},{key:"addRingBothSides",value:function(r,a){this.addRingSide(r,a,Je.LEFT,he.EXTERIOR,he.INTERIOR),this.addRingSide(r,a,Je.RIGHT,he.INTERIOR,he.EXTERIOR)}},{key:"addPoint",value:function(r){if(this._distance<=0)return null;var a=r.getCoordinates(),u=this._curveBuilder.getLineCurve(a,this._distance);this.addCurve(u,he.EXTERIOR,he.INTERIOR)}},{key:"addPolygon",value:function(r){var a=this._distance,u=Je.LEFT;this._distance<0&&(a=-this._distance,u=Je.RIGHT);var y=r.getExteriorRing(),E=wi.removeRepeatedPoints(y.getCoordinates());if(this._distance<0&&this.isErodedCompletely(y,this._distance)||this._distance<=0&&E.length<3)return null;this.addRingSide(E,a,u,he.EXTERIOR,he.INTERIOR);for(var M=0;M0&&this.isErodedCompletely(B,-this._distance)||this.addRingSide(W,a,Je.opposite(u),he.INTERIOR,he.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(r,a){var u=new Ni(r[0],r[1],r[2]),y=u.inCentre();return In.pointToSegment(y,u.p0,u.p1)E}},{key:"addCollection",value:function(r){for(var a=0;a=this._max)throw new Dt;var r=this._parent.getGeometryN(this._index++);return r instanceof Yt?(this._subcollectionIterator=new v(r),this._subcollectionIterator.next()):r}},{key:"remove",value:function(){throw new Ke(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Gl]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var r=arguments[0];this._parent=r,this._atStart=!0,this._index=0,this._max=r.getNumGeometries()}},{key:"isAtomic",value:function(r){return!(r instanceof Yt)}}]),v}(),qi=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"locate",value:function(r){return v.locate(r,this._geom)}},{key:"interfaces_",get:function(){return[yi]}}],[{key:"constructor_",value:function(){this._geom=null;var r=arguments[0];this._geom=r}},{key:"locatePointInPolygon",value:function(r,a){if(a.isEmpty())return he.EXTERIOR;var u=a.getExteriorRing(),y=v.locatePointInRing(r,u);if(y!==he.INTERIOR)return y;for(var E=0;E=0;E--){var M=this._edgeList.get(E),B=M.getSym();y===null&&(y=B),u!==null&&B.setNext(u),u=M}y.setNext(u)}},{key:"computeDepths",value:function(){if(arguments.length===1){var u=arguments[0],y=this.findIndex(u),E=u.getDepth(Je.LEFT),M=u.getDepth(Je.RIGHT),B=this.computeDepths(y+1,this._edgeList.size(),E),W=this.computeDepths(0,y,B);if(W!==M)throw new ut("depth mismatch at "+u.getCoordinate())}else if(arguments.length===3){for(var ie=arguments[0],me=arguments[1],Ee=arguments[2],He=Ee,ct=ie;ct=0;B--){var W=this._resultAreaEdgeList.get(B),ie=W.getSym();switch(y===null&&W.getEdgeRing()===u&&(y=W),M){case this._SCANNING_FOR_INCOMING:if(ie.getEdgeRing()!==u)continue;E=ie,M=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(W.getEdgeRing()!==u)continue;E.setNextMin(W),M=this._SCANNING_FOR_INCOMING}}M===this._LINKING_TO_OUTGOING&&(et.isTrue(y!==null,"found null for first outgoing dirEdge"),et.isTrue(y.getEdgeRing()===u,"unable to link last incoming dirEdge"),E.setNextMin(y))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var u=0,y=this.iterator();y.hasNext();){var E=y.next();E.isInResult()&&u++}return u}if(arguments.length===1){for(var M=arguments[0],B=0,W=this.iterator();W.hasNext();){var ie=W.next();ie.getEdgeRing()===M&&B++}return B}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var u=he.NONE,y=this.iterator();y.hasNext();){var E=y.next(),M=E.getSym();if(!E.isLineEdge()){if(E.isInResult()){u=he.INTERIOR;break}if(M.isInResult()){u=he.EXTERIOR;break}}}if(u===he.NONE)return null;for(var B=u,W=this.iterator();W.hasNext();){var ie=W.next(),me=ie.getSym();ie.isLineEdge()?ie.getEdge().setCovered(B===he.INTERIOR):(ie.isInResult()&&(B=he.EXTERIOR),me.isInResult()&&(B=he.INTERIOR))}}},{key:"computeLabelling",value:function(u){re(I(a.prototype),"computeLabelling",this).call(this,u),this._label=new Ki(he.NONE);for(var y=this.iterator();y.hasNext();)for(var E=y.next().getEdge().getLabel(),M=0;M<2;M++){var B=E.getLocation(M);B!==he.INTERIOR&&B!==he.BOUNDARY||this._label.setLocation(M,he.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),a}(Ui),Wl=function(v){k(a,v);var r=ne(a);function a(){return c(this,a),r.call(this)}return _(a,[{key:"createNode",value:function(u){return new Go(u,new Qo)}}]),a}(xa),Sa=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"compareTo",value:function(r){var a=r;return v.compareOriented(this._pts,this._orientation,a._pts,a._orientation)}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var r=arguments[0];this._pts=r,this._orientation=v.orientation(r)}},{key:"orientation",value:function(r){return wi.increasingDirection(r)===1}},{key:"compareOriented",value:function(r,a,u,y){for(var E=a?1:-1,M=y?1:-1,B=a?r.length:-1,W=y?u.length:-1,ie=a?0:r.length-1,me=y?0:u.length-1;;){var Ee=r[ie].compareTo(u[me]);if(Ee!==0)return Ee;var He=(ie+=E)===B,ct=(me+=M)===W;if(He&&!ct)return-1;if(!He&&ct)return 1;if(He&&ct)return 0}}}]),v}(),Ia=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"print",value:function(r){r.print("MULTILINESTRING ( ");for(var a=0;a0&&r.print(","),r.print("(");for(var y=u.getCoordinates(),E=0;E0&&r.print(","),r.print(y[E].x+" "+y[E].y);r.println(")")}r.print(") ")}},{key:"addAll",value:function(r){for(var a=r.iterator();a.hasNext();)this.add(a.next())}},{key:"findEdgeIndex",value:function(r){for(var a=0;ar?1:this.dista?1:0}},{key:"interfaces_",get:function(){return[Ze]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var r=arguments[0],a=arguments[1],u=arguments[2];this.coord=new _e(r),this.segmentIndex=a,this.dist=u}}]),v}(),ws=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"print",value:function(r){r.println("Intersections:");for(var a=this.iterator();a.hasNext();)a.next().print(r)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(r){this.addEndpoints();for(var a=this.iterator(),u=a.next();a.hasNext();){var y=a.next(),E=this.createSplitEdge(u,y);r.add(E),u=y}}},{key:"addEndpoints",value:function(){var r=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[r],r,0)}},{key:"createSplitEdge",value:function(r,a){var u=a.segmentIndex-r.segmentIndex+2,y=this.edge.pts[a.segmentIndex],E=a.dist>0||!a.coord.equals2D(y);E||u--;var M=new Array(u).fill(null),B=0;M[B++]=new _e(r.coord);for(var W=r.segmentIndex+1;W<=a.segmentIndex;W++)M[B++]=this.edge.pts[W];return E&&(M[B]=a.coord),new ks(M,new Ki(this.edge._label))}},{key:"add",value:function(r,a,u){var y=new gl(r,a,u),E=this._nodeMap.get(y);return E!==null?E:(this._nodeMap.put(y,y),y)}},{key:"isIntersection",value:function(r){for(var a=this.iterator();a.hasNext();)if(a.next().coord.equals(r))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Zo,this.edge=null;var r=arguments[0];this.edge=r}}]),v}(),Us=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])||v.isTrue(this._matrix[he.INTERIOR][he.BOUNDARY])||v.isTrue(this._matrix[he.BOUNDARY][he.INTERIOR])||v.isTrue(this._matrix[he.BOUNDARY][he.BOUNDARY]))&&this._matrix[he.EXTERIOR][he.INTERIOR]===Q.FALSE&&this._matrix[he.EXTERIOR][he.BOUNDARY]===Q.FALSE}},{key:"isCoveredBy",value:function(){return(v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])||v.isTrue(this._matrix[he.INTERIOR][he.BOUNDARY])||v.isTrue(this._matrix[he.BOUNDARY][he.INTERIOR])||v.isTrue(this._matrix[he.BOUNDARY][he.BOUNDARY]))&&this._matrix[he.INTERIOR][he.EXTERIOR]===Q.FALSE&&this._matrix[he.BOUNDARY][he.EXTERIOR]===Q.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var r=arguments[0],a=0;a=0&&a>=0&&this.setAtLeast(r,a,u)}},{key:"isWithin",value:function(){return v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&this._matrix[he.INTERIOR][he.EXTERIOR]===Q.FALSE&&this._matrix[he.BOUNDARY][he.EXTERIOR]===Q.FALSE}},{key:"isTouches",value:function(r,a){return r>a?this.isTouches(a,r):(r===Q.A&&a===Q.A||r===Q.L&&a===Q.L||r===Q.L&&a===Q.A||r===Q.P&&a===Q.A||r===Q.P&&a===Q.L)&&this._matrix[he.INTERIOR][he.INTERIOR]===Q.FALSE&&(v.isTrue(this._matrix[he.INTERIOR][he.BOUNDARY])||v.isTrue(this._matrix[he.BOUNDARY][he.INTERIOR])||v.isTrue(this._matrix[he.BOUNDARY][he.BOUNDARY]))}},{key:"isOverlaps",value:function(r,a){return r===Q.P&&a===Q.P||r===Q.A&&a===Q.A?v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&v.isTrue(this._matrix[he.INTERIOR][he.EXTERIOR])&&v.isTrue(this._matrix[he.EXTERIOR][he.INTERIOR]):r===Q.L&&a===Q.L&&this._matrix[he.INTERIOR][he.INTERIOR]===1&&v.isTrue(this._matrix[he.INTERIOR][he.EXTERIOR])&&v.isTrue(this._matrix[he.EXTERIOR][he.INTERIOR])}},{key:"isEquals",value:function(r,a){return r===a&&v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&this._matrix[he.INTERIOR][he.EXTERIOR]===Q.FALSE&&this._matrix[he.BOUNDARY][he.EXTERIOR]===Q.FALSE&&this._matrix[he.EXTERIOR][he.INTERIOR]===Q.FALSE&&this._matrix[he.EXTERIOR][he.BOUNDARY]===Q.FALSE}},{key:"toString",value:function(){for(var r=new ki("123456789"),a=0;a<3;a++)for(var u=0;u<3;u++)r.setCharAt(3*a+u,Q.toDimensionSymbol(this._matrix[a][u]));return r.toString()}},{key:"setAll",value:function(r){for(var a=0;a<3;a++)for(var u=0;u<3;u++)this._matrix[a][u]=r}},{key:"get",value:function(r,a){return this._matrix[r][a]}},{key:"transpose",value:function(){var r=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=r,r=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=r,r=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=r,this}},{key:"matches",value:function(r){if(r.length!==9)throw new ze("Should be length 9: "+r);for(var a=0;a<3;a++)for(var u=0;u<3;u++)if(!v.matches(this._matrix[a][u],r.charAt(3*a+u)))return!1;return!0}},{key:"add",value:function(r){for(var a=0;a<3;a++)for(var u=0;u<3;u++)this.setAtLeast(a,u,r.get(a,u))}},{key:"isDisjoint",value:function(){return this._matrix[he.INTERIOR][he.INTERIOR]===Q.FALSE&&this._matrix[he.INTERIOR][he.BOUNDARY]===Q.FALSE&&this._matrix[he.BOUNDARY][he.INTERIOR]===Q.FALSE&&this._matrix[he.BOUNDARY][he.BOUNDARY]===Q.FALSE}},{key:"isCrosses",value:function(r,a){return r===Q.P&&a===Q.L||r===Q.P&&a===Q.A||r===Q.L&&a===Q.A?v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&v.isTrue(this._matrix[he.INTERIOR][he.EXTERIOR]):r===Q.L&&a===Q.P||r===Q.A&&a===Q.P||r===Q.A&&a===Q.L?v.isTrue(this._matrix[he.INTERIOR][he.INTERIOR])&&v.isTrue(this._matrix[he.EXTERIOR][he.INTERIOR]):r===Q.L&&a===Q.L&&this._matrix[he.INTERIOR][he.INTERIOR]===0}},{key:"interfaces_",get:function(){return[je]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(Q.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var r=arguments[0];v.constructor_.call(this),this.set(r)}else if(arguments[0]instanceof v){var a=arguments[0];v.constructor_.call(this),this._matrix[he.INTERIOR][he.INTERIOR]=a._matrix[he.INTERIOR][he.INTERIOR],this._matrix[he.INTERIOR][he.BOUNDARY]=a._matrix[he.INTERIOR][he.BOUNDARY],this._matrix[he.INTERIOR][he.EXTERIOR]=a._matrix[he.INTERIOR][he.EXTERIOR],this._matrix[he.BOUNDARY][he.INTERIOR]=a._matrix[he.BOUNDARY][he.INTERIOR],this._matrix[he.BOUNDARY][he.BOUNDARY]=a._matrix[he.BOUNDARY][he.BOUNDARY],this._matrix[he.BOUNDARY][he.EXTERIOR]=a._matrix[he.BOUNDARY][he.EXTERIOR],this._matrix[he.EXTERIOR][he.INTERIOR]=a._matrix[he.EXTERIOR][he.INTERIOR],this._matrix[he.EXTERIOR][he.BOUNDARY]=a._matrix[he.EXTERIOR][he.BOUNDARY],this._matrix[he.EXTERIOR][he.EXTERIOR]=a._matrix[he.EXTERIOR][he.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var r=arguments[0],a=arguments[1];return a===Q.SYM_DONTCARE||a===Q.SYM_TRUE&&(r>=0||r===Q.TRUE)||a===Q.SYM_FALSE&&r===Q.FALSE||a===Q.SYM_P&&r===Q.P||a===Q.SYM_L&&r===Q.L||a===Q.SYM_A&&r===Q.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var u=arguments[0],y=arguments[1],E=new v(u);return E.matches(y)}}},{key:"isTrue",value:function(r){return r>=0||r===Q.TRUE}}]),v}(),pr=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(r){return r===null||r.length===0?null:(this.ensureCapacity(this._size+r.length),cn.arraycopy(r,0,this._data,this._size,r.length),void(this._size+=r.length))}},{key:"ensureCapacity",value:function(r){if(r<=this._data.length)return null;var a=Math.max(r,2*this._data.length);this._data=Fe.copyOf(this._data,a)}},{key:"toArray",value:function(){var r=new Array(this._size).fill(null);return cn.arraycopy(this._data,0,r,0,this._size),r}},{key:"add",value:function(r){this.ensureCapacity(this._size+1),this._data[this._size]=r,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)v.constructor_.call(this,10);else if(arguments.length===1){var r=arguments[0];this._data=new Array(r).fill(null)}}}]),v}(),yl=function(){function v(){c(this,v)}return _(v,[{key:"getChainStartIndices",value:function(r){var a=0,u=new pr(Math.trunc(r.length/2));u.add(a);do{var y=this.findChainEnd(r,a);u.add(y),a=y}while(au?a:u}},{key:"getMinX",value:function(r){var a=this.pts[this.startIndex[r]].x,u=this.pts[this.startIndex[r+1]].x;return aa&&(y=1),this._depth[r][u]=y}}}},{key:"getDelta",value:function(r){return this._depth[r][Je.RIGHT]-this._depth[r][Je.LEFT]}},{key:"getLocation",value:function(r,a){return this._depth[r][a]<=0?he.EXTERIOR:he.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var r=arguments[0],a=0;a<2;a++)for(var u=1;u<3;u++){var y=r.getLocation(a,u);y!==he.EXTERIOR&&y!==he.INTERIOR||(this.isNull(a,u)?this._depth[a][u]=v.depthAtLocation(y):this._depth[a][u]+=v.depthAtLocation(y))}else if(arguments.length===3){var E=arguments[0],M=arguments[1],B=arguments[2];B===he.INTERIOR&&this._depth[E][M]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var r=0;r<2;r++)for(var a=0;a<3;a++)this._depth[r][a]=v.NULL_VALUE}},{key:"depthAtLocation",value:function(r){return r===he.EXTERIOR?0:r===he.INTERIOR?1:v.NULL_VALUE}}]),v}();Ca.NULL_VALUE=-1;var ks=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var u=new Array(2).fill(null);return u[0]=this.pts[0],u[1]=this.pts[1],new a(u,Ki.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(u){this._isIsolated=u}},{key:"setName",value:function(u){this._name=u}},{key:"equals",value:function(u){if(!(u instanceof a))return!1;var y=u;if(this.pts.length!==y.pts.length)return!1;for(var E=!0,M=!0,B=this.pts.length,W=0;W0?this.pts[0]:null;if(arguments.length===1){var u=arguments[0];return this.pts[u]}}},{key:"print",value:function(u){u.print("edge "+this._name+": "),u.print("LINESTRING (");for(var y=0;y0&&u.print(","),u.print(this.pts[y].x+" "+this.pts[y].y);u.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(u){a.updateIM(this._label,u)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(u){u.print("edge "+this._name+": ");for(var y=this.pts.length-1;y>=0;y--)u.print(this.pts[y]+" ");u.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Ta(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new Jt;for(var u=0;u0&&u.append(","),u.append(this.pts[y].x+" "+this.pts[y].y);return u.append(") "+this._label+" "+this._depthDelta),u.toString()}},{key:"isPointwiseEqual",value:function(u){if(this.pts.length!==u.pts.length)return!1;for(var y=0;yy||this._maxyM;if(B)return!1;var W=this.intersectsToleranceSquare(r,a);return et.isTrue(!(B&&W),"Found bad envelope test"),W}},{key:"initCorners",value:function(r){var a=.5;this._minx=r.x-a,this._maxx=r.x+a,this._miny=r.y-a,this._maxy=r.y+a,this._corner[0]=new _e(this._maxx,this._maxy),this._corner[1]=new _e(this._minx,this._maxy),this._corner[2]=new _e(this._minx,this._miny),this._corner[3]=new _e(this._maxx,this._miny)}},{key:"intersects",value:function(r,a){return this._scaleFactor===1?this.intersectsScaled(r,a):(this.copyScaled(r,this._p0Scaled),this.copyScaled(a,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(r){return Math.round(r*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(r,a){a.x=this.scale(r.x),a.y=this.scale(r.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var r=v.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Jt(this._originalPt.x-r,this._originalPt.x+r,this._originalPt.y-r,this._originalPt.y+r)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(r,a){return this._li.computeIntersection(r,a,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,a,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,a,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,a,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(r,a){var u=!1,y=!1;return this._li.computeIntersection(r,a,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(r,a,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(u=!0),this._li.computeIntersection(r,a,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(y=!0),this._li.computeIntersection(r,a,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!u||!y)||!!r.equals(this._pt)||!!a.equals(this._pt))))}},{key:"addSnappedNode",value:function(r,a){var u=r.getCoordinate(a),y=r.getCoordinate(a+1);return!!this.intersects(u,y)&&(r.addIntersection(this.getCoordinate(),a),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var r=arguments[0],a=arguments[1],u=arguments[2];if(this._originalPt=r,this._pt=r,this._scaleFactor=a,this._li=u,a<=0)throw new ze("Scale factor must be non-zero");a!==1&&(this._pt=new _e(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new _e,this._p1Scaled=new _e),this.initCorners(this._pt)}}]),v}();ho.SAFE_ENV_EXPANSION_FACTOR=.75;var Xl=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"select",value:function(){if(arguments.length!==1&&arguments.length===2){var r=arguments[0],a=arguments[1];r.getLineSegment(a,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Tn}}]),v}(),Vs=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"snap",value:function(){if(arguments.length===1){var r=arguments[0];return this.snap(r,null,-1)}if(arguments.length===3){var a=arguments[0],u=arguments[1],y=arguments[2],E=a.getSafeEnvelope(),M=new Ss(a,u,y);return this._index.query(E,new(function(){function B(){c(this,B)}return _(B,[{key:"interfaces_",get:function(){return[al]}},{key:"visitItem",value:function(W){W.select(E,M)}}]),B}())),M.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var r=arguments[0];this._index=r}}]),v}(),Ss=function(v){k(a,v);var r=ne(a);function a(){var u;return c(this,a),u=r.call(this),a.constructor_.apply(N(u),arguments),u}return _(a,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof Yo))return re(I(a.prototype),"select",this).apply(this,arguments);var u=arguments[0],y=arguments[1],E=u.getContext();if(this._parentEdge===E&&(y===this._hotPixelVertexIndex||y+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(E,y)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var u=arguments[0],y=arguments[1],E=arguments[2];this._hotPixel=u,this._parentEdge=y,this._hotPixelVertexIndex=E}}]),a}(Xl);Vs.HotPixelSnapAction=Ss;var _l=function(){function v(){c(this,v),v.constructor_.apply(this,arguments)}return _(v,[{key:"processIntersections",value:function(r,a,u,y){if(r===u&&a===y)return null;var E=r.getCoordinates()[a],M=r.getCoordinates()[a+1],B=u.getCoordinates()[y],W=u.getCoordinates()[y+1];if(this._li.computeIntersection(E,M,B,W),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var ie=0;ie=0;r--){try{this.bufferReducedPrecision(r)}catch(E){if(!(E instanceof ut))throw E;this._saveException=E}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],u=v.precisionScaleFactor(this._argGeom,this._distance,a),y=new nn(u);this.bufferFixedPrecision(y)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var r=this._argGeom.getFactory().getPrecisionModel();r.getType()===nn.FIXED?this.bufferFixedPrecision(r):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(r){this._bufParams.setQuadrantSegments(r)}},{key:"bufferOriginalPrecision",value:function(){try{var r=new ea(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(a){if(!(a instanceof Ut))throw a;this._saveException=a}}},{key:"getResultGeometry",value:function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(r){this._bufParams.setEndCapStyle(r)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new ke,this._resultGeometry=null,this._saveException=null,arguments.length===1){var r=arguments[0];this._argGeom=r}else if(arguments.length===2){var a=arguments[0],u=arguments[1];this._argGeom=a,this._bufParams=u}}},{key:"bufferOp",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1],u=new v(r),y=u.getResultGeometry(a);return y}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var E=arguments[0],M=arguments[1],B=arguments[2],W=new v(E);W.setQuadrantSegments(B);var ie=W.getResultGeometry(M);return ie}if(arguments[2]instanceof ke&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var me=arguments[0],Ee=arguments[1],He=arguments[2],ct=new v(me,He),tt=ct.getResultGeometry(Ee);return tt}}else if(arguments.length===4){var Kt=arguments[0],ni=arguments[1],ci=arguments[2],Ci=arguments[3],Ri=new v(Kt);Ri.setQuadrantSegments(ci),Ri.setEndCapStyle(Ci);var wn=Ri.getResultGeometry(ni);return wn}}},{key:"precisionScaleFactor",value:function(r,a,u){var y=r.getEnvelopeInternal(),E=ur.max(Math.abs(y.getMaxX()),Math.abs(y.getMaxY()),Math.abs(y.getMinX()),Math.abs(y.getMinY()))+2*(a>0?a:0),M=u-Math.trunc(Math.log(E)/Math.log(10)+1);return Math.pow(10,M)}}]),v}();_i.CAP_ROUND=ke.CAP_ROUND,_i.CAP_BUTT=ke.CAP_FLAT,_i.CAP_FLAT=ke.CAP_FLAT,_i.CAP_SQUARE=ke.CAP_SQUARE,_i.MAX_PRECISION_DIGITS=12;var ta=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],vl=function(){function v(r){c(this,v),this.geometryFactory=r||new Vr}return _(v,[{key:"read",value:function(r){var a,u=(a=typeof r=="string"?JSON.parse(r):r).type;if(!mr[u])throw new Error("Unknown GeoJSON type: "+a.type);return ta.indexOf(u)!==-1?mr[u].call(this,a.coordinates):u==="GeometryCollection"?mr[u].call(this,a.geometries):mr[u].call(this,a)}},{key:"write",value:function(r){var a=r.getGeometryType();if(!Fn[a])throw new Error("Geometry is not supported");return Fn[a].call(this,r)}}]),v}(),mr={Feature:function(v){var r={};for(var a in v)r[a]=v[a];if(v.geometry){var u=v.geometry.type;if(!mr[u])throw new Error("Unknown GeoJSON type: "+v.type);r.geometry=this.read(v.geometry)}return v.bbox&&(r.bbox=mr.bbox.call(this,v.bbox)),r},FeatureCollection:function(v){var r={};if(v.features){r.features=[];for(var a=0;a1?0:s<-1?Di:Math.acos(s)}function Nl(s){return s>1?To:s<-1?-To:Math.asin(s)}function Fc(){}function Tf(s,o){s&&ov.hasOwnProperty(s.type)&&ov[s.type](s,o)}var sv={Feature:function(s,o){Tf(s.geometry,o)},FeatureCollection:function(s,o){for(var c=s.features,d=-1,_=c.length;++d<_;)Tf(c[d].geometry,o)}},ov={Sphere:function(s,o){o.sphere()},Point:function(s,o){s=s.coordinates,o.point(s[0],s[1],s[2])},MultiPoint:function(s,o){for(var c=s.coordinates,d=-1,_=c.length;++d<_;)s=c[d],o.point(s[0],s[1],s[2])},LineString:function(s,o){Op(s.coordinates,o,0)},MultiLineString:function(s,o){for(var c=s.coordinates,d=-1,_=c.length;++d<_;)Op(c[d],o,0)},Polygon:function(s,o){av(s.coordinates,o)},MultiPolygon:function(s,o){for(var c=s.coordinates,d=-1,_=c.length;++d<_;)av(c[d],o)},GeometryCollection:function(s,o){for(var c=s.geometries,d=-1,_=c.length;++d<_;)Tf(c[d],o)}};function Op(s,o,c){var d=-1,_=s.length-c,k;for(o.lineStart();++d<_;)k=s[d],o.point(k[0],k[1],k[2]);o.lineEnd()}function av(s,o){var c=-1,d=s.length;for(o.polygonStart();++cDi?s-Do:s<-Di?s+Do:s,o]}jp.invert=jp;function jC(s,o,c){return(s%=Do)?o||c?E1(uv(s),cv(o,c)):uv(s):o||c?cv(o,c):jp}function lv(s){return function(o,c){return o+=s,[o>Di?o-Do:o<-Di?o+Do:o,c]}}function uv(s){var o=lv(s);return o.invert=lv(-s),o}function cv(s,o){var c=vn(s),d=xn(s),_=vn(o),k=xn(o);function I(f,D){var F=vn(D),j=vn(f)*F,N=xn(f)*F,V=xn(D),ne=V*c+j*d;return[Lu(N*_-ne*k,j*c-V*d),Nl(ne*_+N*k)]}return I.invert=function(f,D){var F=vn(D),j=vn(f)*F,N=xn(f)*F,V=xn(D),ne=V*_-N*k;return[Lu(N*_+V*k,j*c+ne*d),Nl(ne*c-j*d)]},I}function UC(s,o,c,d,_,k){if(c){var I=vn(o),f=xn(o),D=d*c;_==null?(_=o+d*Do,k=o-D/2):(_=hv(I,_),k=hv(I,k),(d>0?_k)&&(_+=d*Do));for(var F,j=_;d>0?j>k:j1&&s.push(s.pop().concat(s.shift()))},result:function(){var c=s;return s=[],o=null,c}}}function VC(s,o,c,d,_,k){var I=s[0],f=s[1],D=o[0],F=o[1],j=0,N=1,V=D-I,ne=F-f,re;if(re=c-I,!(!V&&re>0)){if(re/=V,V<0){if(re0){if(re>N)return;re>j&&(j=re)}if(re=_-I,!(!V&&re<0)){if(re/=V,V<0){if(re>N)return;re>j&&(j=re)}else if(V>0){if(re0)){if(re/=ne,ne<0){if(re0){if(re>N)return;re>j&&(j=re)}if(re=k-f,!(!ne&&re<0)){if(re/=ne,ne<0){if(re>N)return;re>j&&(j=re)}else if(ne>0){if(re0&&(s[0]=I+j*V,s[1]=f+j*ne),N<1&&(o[0]=I+N*V,o[1]=f+N*ne),!0}}}}}function sf(s,o){return lr(s[0]-o[0])=0;--f)_.point((N=j[f])[0],N[1]);else d(V.x,V.p.x,-1,_);V=V.p}V=V.o,j=V.z,ne=!ne}while(!V.v);_.lineEnd()}}}function fv(s){if(o=s.length){for(var o,c=0,d=s[0],_;++co?1:s>=o?0:NaN}function qC(s){return s.length===1&&(s=GC(s)),{left:function(o,c,d,_){for(d==null&&(d=0),_==null&&(_=o.length);d<_;){var k=d+_>>>1;s(o[k],c)<0?d=k+1:_=k}return d},right:function(o,c,d,_){for(d==null&&(d=0),_==null&&(_=o.length);d<_;){var k=d+_>>>1;s(o[k],c)>0?_=k:d=k+1}return d}}}function GC(s){return function(o,c){return P1(s(o),c)}}qC(P1);function L1(s){for(var o=s.length,c,d=-1,_=0,k,I;++d=0;)for(I=s[o],c=I.length;--c>=0;)k[--_]=I[c];return k}var Bc=1e9,Wh=-Bc;function ZC(s,o,c,d){function _(F,j){return s<=F&&F<=c&&o<=j&&j<=d}function k(F,j,N,V){var ne=0,re=0;if(F==null||(ne=I(F,N))!==(re=I(j,N))||D(F,j)<0^N>0)do V.point(ne===0||ne===3?s:c,ne>1?d:o);while((ne=(ne+N+4)%4)!==re);else V.point(j[0],j[1])}function I(F,j){return lr(F[0]-s)0?0:3:lr(F[0]-c)0?2:1:lr(F[1]-o)0?1:0:j>0?3:2}function f(F,j){return D(F.x,j.x)}function D(F,j){var N=I(F,1),V=I(j,1);return N!==V?N-V:N===0?j[1]-F[1]:N===1?F[0]-j[0]:N===2?F[1]-j[1]:j[0]-F[0]}return function(F){var j=F,N=T1(),V,ne,re,Ae,we,Te,Ce,ke,Re,ze,Oe,Ze={point:je,lineStart:Lt,lineEnd:_t,polygonStart:st,polygonEnd:Se};function je(dt,bt){_(dt,bt)&&j.point(dt,bt)}function Ve(){for(var dt=0,bt=0,lt=ne.length;btd&&(et-Ut)*(d-Gt)>(Ot-Gt)*(s-Ut)&&++dt:Ot<=d&&(et-Ut)*(d-Gt)<(Ot-Gt)*(s-Ut)&&--dt;return dt}function st(){j=N,V=[],ne=[],Oe=!0}function Se(){var dt=Ve(),bt=Oe&&dt,lt=(V=L1(V)).length;(bt||lt)&&(F.polygonStart(),bt&&(F.lineStart(),k(null,null,1,F),F.lineEnd()),lt&&C1(V,f,dt,k,F),F.polygonEnd()),j=F,V=ne=re=null}function Lt(){Ze.point=We,ne&&ne.push(re=[]),ze=!0,Re=!1,Ce=ke=NaN}function _t(){V&&(We(Ae,we),Te&&Re&&N.rejoin(),V.push(N.result())),Ze.point=je,Re&&j.lineEnd()}function We(dt,bt){var lt=_(dt,bt);if(ne&&re.push([dt,bt]),ze)Ae=dt,we=bt,Te=lt,ze=!1,lt&&(j.lineStart(),j.point(dt,bt));else if(lt&&Re)j.point(dt,bt);else{var It=[Ce=Math.max(Wh,Math.min(Bc,Ce)),ke=Math.max(Wh,Math.min(Bc,ke))],Wt=[dt=Math.max(Wh,Math.min(Bc,dt)),bt=Math.max(Wh,Math.min(Bc,bt))];VC(It,Wt,s,o,c,d)?(Re||(j.lineStart(),j.point(It[0],It[1])),j.point(Wt[0],Wt[1]),lt||j.lineEnd(),Oe=!1):lt&&(j.lineStart(),j.point(dt,bt),Oe=!1)}Ce=dt,ke=bt,Re=lt}return Ze}}var rp=el();function WC(s,o){var c=o[0],d=o[1],_=[xn(c),-vn(c),0],k=0,I=0;rp.reset();for(var f=0,D=s.length;f=0?1:-1,je=Ze*Oe,Ve=je>Di,st=re*Re;if(rp.add(Lu(st*Ze*xn(je),Ae*ze+st*vn(je))),k+=Ve?Oe+Ze*Do:Oe,Ve^V>=c^Ce>=c){var Se=Cf(Au(N),Au(Te));Bp(Se);var Lt=Cf(_,Se);Bp(Lt);var _t=(Ve^Oe>=0?-1:1)*Nl(Lt[2]);(d>_t||d===_t&&(Se[0]||Se[1]))&&(I+=Ve^Oe>=0?1:-1)}}return(k<-ln||kQc&&(Qc=s),oLf&&(Lf=o)}el();function A1(s,o,c,d){return function(_,k){var I=o(k),f=_.invert(d[0],d[1]),D=T1(),F=o(D),j=!1,N,V,ne,re={point:Ae,lineStart:Te,lineEnd:Ce,polygonStart:function(){re.point=ke,re.lineStart=Re,re.lineEnd=ze,V=[],N=[]},polygonEnd:function(){re.point=Ae,re.lineStart=Te,re.lineEnd=Ce,V=L1(V);var Oe=WC(N,f);V.length?(j||(k.polygonStart(),j=!0),C1(V,YC,Oe,c,k)):Oe&&(j||(k.polygonStart(),j=!0),k.lineStart(),c(null,null,1,k),k.lineEnd()),j&&(k.polygonEnd(),j=!1),V=N=null},sphere:function(){k.polygonStart(),k.lineStart(),c(null,null,1,k),k.lineEnd(),k.polygonEnd()}};function Ae(Oe,Ze){var je=_(Oe,Ze);s(Oe=je[0],Ze=je[1])&&k.point(Oe,Ze)}function we(Oe,Ze){var je=_(Oe,Ze);I.point(je[0],je[1])}function Te(){re.point=we,I.lineStart()}function Ce(){re.point=Ae,I.lineEnd()}function ke(Oe,Ze){ne.push([Oe,Ze]);var je=_(Oe,Ze);F.point(je[0],je[1])}function Re(){F.lineStart(),ne=[]}function ze(){ke(ne[0][0],ne[0][1]),F.lineEnd();var Oe=F.clean(),Ze=D.result(),je,Ve=Ze.length,st,Se,Lt;if(ne.pop(),N.push(ne),ne=null,!!Ve){if(Oe&1){if(Se=Ze[0],(st=Se.length-1)>0){for(j||(k.polygonStart(),j=!0),k.lineStart(),je=0;je1&&Oe&2&&Ze.push(Ze.pop().concat(Ze.shift())),V.push(Ze.filter(HC))}}return re}}function HC(s){return s.length>1}function YC(s,o){return((s=s.x)[0]<0?s[1]-To-ln:To-s[1])-((o=o.x)[0]<0?o[1]-To-ln:To-o[1])}const mv=A1(function(){return!0},KC,QC,[-Di,-To]);function KC(s){var o=NaN,c=NaN,d=NaN,_;return{lineStart:function(){s.lineStart(),_=1},point:function(k,I){var f=k>0?Di:-Di,D=lr(k-o);lr(D-Di)0?To:-To),s.point(d,c),s.lineEnd(),s.lineStart(),s.point(f,c),s.point(k,c),_=0):d!==f&&D>=Di&&(lr(o-d)ln?FC((xn(o)*(k=vn(d))*xn(c)-xn(d)*(_=vn(o))*xn(s))/(_*k*I)):(o+d)/2}function QC(s,o,c,d){var _;if(s==null)_=c*To,d.point(-Di,_),d.point(0,_),d.point(Di,_),d.point(Di,0),d.point(Di,-_),d.point(0,-_),d.point(-Di,-_),d.point(-Di,0),d.point(-Di,_);else if(lr(s[0]-o[0])>ln){var k=s[0]0,_=lr(c)>ln;function k(j,N,V,ne){UC(ne,s,o,V,j,N)}function I(j,N){return vn(j)*vn(N)>c}function f(j){var N,V,ne,re,Ae;return{lineStart:function(){re=ne=!1,Ae=1},point:function(we,Te){var Ce=[we,Te],ke,Re=I(we,Te),ze=d?Re?0:F(we,Te):Re?F(we+(we<0?Di:-Di),Te):0;if(!N&&(re=ne=Re)&&j.lineStart(),Re!==ne&&(ke=D(N,Ce),(!ke||sf(N,ke)||sf(Ce,ke))&&(Ce[0]+=ln,Ce[1]+=ln,Re=I(Ce[0],Ce[1]))),Re!==ne)Ae=0,Re?(j.lineStart(),ke=D(Ce,N),j.point(ke[0],ke[1])):(ke=D(N,Ce),j.point(ke[0],ke[1]),j.lineEnd()),N=ke;else if(_&&N&&d^Re){var Oe;!(ze&V)&&(Oe=D(Ce,N,!0))&&(Ae=0,d?(j.lineStart(),j.point(Oe[0][0],Oe[0][1]),j.point(Oe[1][0],Oe[1][1]),j.lineEnd()):(j.point(Oe[1][0],Oe[1][1]),j.lineEnd(),j.lineStart(),j.point(Oe[0][0],Oe[0][1])))}Re&&(!N||!sf(N,Ce))&&j.point(Ce[0],Ce[1]),N=Ce,ne=Re,V=ze},lineEnd:function(){ne&&j.lineEnd(),N=null},clean:function(){return Ae|(re&&ne)<<1}}}function D(j,N,V){var ne=Au(j),re=Au(N),Ae=[1,0,0],we=Cf(ne,re),Te=qh(we,we),Ce=we[0],ke=Te-Ce*Ce;if(!ke)return!V&&j;var Re=c*Te/ke,ze=-c*Ce/ke,Oe=Cf(Ae,we),Ze=Gh(Ae,Re),je=Gh(we,ze);np(Ze,je);var Ve=Oe,st=qh(Ze,Ve),Se=qh(Ve,Ve),Lt=st*st-Se*(qh(Ze,Ze)-1);if(!(Lt<0)){var _t=Nu(Lt),We=Gh(Ve,(-st-_t)/Se);if(np(We,Ze),We=Fp(We),!V)return We;var dt=j[0],bt=N[0],lt=j[1],It=N[1],Wt;bt0^We[1]<(lr(We[0]-dt)Di^(dt<=We[0]&&We[0]<=bt)){var Gt=Gh(Ve,(-st+_t)/Se);return np(Gt,Ze),[We,Fp(Gt)]}}}function F(j,N){var V=d?s:Di-s,ne=0;return j<-V?ne|=1:j>V&&(ne|=2),N<-V?ne|=4:N>V&&(ne|=8),ne}return A1(I,f,k,d?[0,-s]:[-Di,s-Di])}function M1(s){return function(o){var c=new Up;for(var d in s)c[d]=s[d];return c.stream=o,c}}function Up(){}Up.prototype={constructor:Up,point:function(s,o){this.stream.point(s,o)},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 R1(s,o,c){var d=o[1][0]-o[0][0],_=o[1][1]-o[0][1],k=s.clipExtent&&s.clipExtent();s.scale(150).translate([0,0]),k!=null&&s.clipExtent(null),BC(c,s.stream(pv));var I=pv.result(),f=Math.min(d/(I[1][0]-I[0][0]),_/(I[1][1]-I[0][1])),D=+o[0][0]+(d-f*(I[1][0]+I[0][0]))/2,F=+o[0][1]+(_-f*(I[1][1]+I[0][1]))/2;return k!=null&&s.clipExtent(k),s.scale(f*150).translate([D,F])}function eP(s,o,c){return R1(s,[[0,0],o],c)}var gv=16,tP=vn(30*As);function yv(s,o){return+o?nP(s,o):iP(s)}function iP(s){return M1({point:function(o,c){o=s(o,c),this.stream.point(o[0],o[1])}})}function nP(s,o){function c(d,_,k,I,f,D,F,j,N,V,ne,re,Ae,we){var Te=F-d,Ce=j-_,ke=Te*Te+Ce*Ce;if(ke>4*o&&Ae--){var Re=I+V,ze=f+ne,Oe=D+re,Ze=Nu(Re*Re+ze*ze+Oe*Oe),je=Nl(Oe/=Ze),Ve=lr(lr(Oe)-1)o||lr((Te*_t+Ce*We)/ke-.5)>.3||I*V+f*ne+D*re2?We[2]%360*As:0,Lt()):[F*Ga,j*Ga,N*Ga]},Ve.precision=function(We){return arguments.length?(Oe=yv(Se,ze=We*We),_t()):Nu(ze)},Ve.fitExtent=function(We,dt){return R1(Ve,We,dt)},Ve.fitSize=function(We,dt){return eP(Ve,We,dt)};function Lt(){ne=E1(V=jC(F,j,N),o);var We=o(f,D);return k=d-We[0]*c,I=_+We[1]*c,_t()}function _t(){return Ze=je=null,Ve}return function(){return o=s.apply(this,arguments),Ve.invert=o.invert&&st,Lt()}}function D1(s){return function(o,c){var d=vn(o),_=vn(c),k=s(d*_);return[k*_*xn(o),k*xn(c)]}}function z1(s){return function(o,c){var d=Nu(o*o+c*c),_=s(d),k=xn(_),I=vn(_);return[Lu(o*k,d*I),Nl(d&&c*k/d)]}}var aP=D1(function(s){return Nu(2/(1+s))});aP.invert=z1(function(s){return 2*Nl(s/2)});var N1=D1(function(s){return(s=I1(s))&&s/xn(s)});N1.invert=z1(function(s){return s});function lP(){return sP(N1).scale(79.4188).clipAngle(180-.001)}function _v(s,o){return[s,o]}_v.invert=_v;var uP=Object.defineProperty,Ou=(s,o)=>uP(s,"name",{value:o,configurable:!0}),{BufferOp:cP,GeoJSONReader:hP,GeoJSONWriter:fP}=OC;function dP(s,o,c){c=c||{};var d=c.units||"kilometers",_=c.steps||8;if(!s)throw new Error("geojson is required");if(typeof c!="object")throw new Error("options must be an object");if(typeof _!="number")throw new Error("steps must be an number");if(o===void 0)throw new Error("radius is required");if(_<=0)throw new Error("steps must be greater than 0");var k=[];switch(s.type){case"GeometryCollection":return jl(s,function(I){var f=Zc(I,o,d,_);f&&k.push(f)}),Ka(k);case"FeatureCollection":return If(s,function(I){var f=Zc(I,o,d,_);f&&If(f,function(D){D&&k.push(D)})}),Ka(k)}return Zc(s,o,d,_)}Ou(dP,"buffer");function Zc(s,o,c,d){var _=s.properties||{},k=s.type==="Feature"?s.geometry:s;if(k.type==="GeometryCollection"){var I=[];return jl(s,function(Ae){var we=Zc(Ae,o,c,d);we&&I.push(we)}),Ka(I)}var f=O1(k),D={type:k.type,coordinates:pm(k.coordinates,f)},F=new hP,j=F.read(D),N=cm(Ff(o,c),"meters"),V=cP.bufferOp(j,N,d),ne=new fP;if(V=ne.write(V),!dm(V.coordinates)){var re={type:V.type,coordinates:mm(V.coordinates,f)};return eo(re,_)}}Ou(Zc,"bufferFeature");function dm(s){return Array.isArray(s[0])?dm(s[0]):isNaN(s[0])}Ou(dm,"coordsIsNaN");function pm(s,o){return typeof s[0]!="object"?o(s):s.map(function(c){return pm(c,o)})}Ou(pm,"projectCoords");function mm(s,o){return typeof s[0]!="object"?o.invert(s):s.map(function(c){return mm(c,o)})}Ou(mm,"unprojectCoords");function O1(s){var o=k1(s).geometry.coordinates,c=[-o[0],-o[1]];return lP().rotate(c).scale(Hr)}Ou(O1,"defineProjection");var pP=Object.defineProperty,mP=(s,o)=>pP(s,"name",{value:o,configurable:!0});function gP(s){const o=[];if(jl(s,_=>{o.push(_.coordinates)}),o.length<2)throw new Error("Must have at least two features");const c=s.features[0].properties||{},d=_1.difference(o[0],...o.slice(1));return d.length===0?null:d.length===1?nh(d[0],c):Of(d,c)}mP(gP,"difference");Ka([]);const yP=[{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"}],_P={decimalLatitude:40.123,decimalLongitude:-74.123},vP=[{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}],xP=[{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},{verbatimCoordinates:"53 16.3863,4 52.8171",verbatimLatitude:"53 16.3863",verbatimLongitude:"4 52.8171",decimalLatitude:53.273105,decimalLongitude:4.88029},{verbatimCoordinates:"50 8.2914,-5 2.4447",verbatimLatitude:"50 8.2914",verbatimLongitude:"-5 2.4447",decimalLatitude:50.13819,decimalLongitude:-5.040745},{verbatimCoordinates:"N 48° 30,6410', E 18° 57,4583'",verbatimLatitude:"N 48° 30,6410'",verbatimLongitude:"E 18° 57,4583'",decimalLatitude:48.51068,decimalLongitude:18.95764},{verbatimCoordinates:"1.23456, 18.33453",verbatimLatitude:"1.23456",verbatimLongitude:"18.33453",decimalLatitude:1.23456,decimalLongitude:18.33453}];function bP(){const s=[];return yP.forEach(o=>{o.decimalLatitude?s.push(o):s.push({...o,..._P})}),[...s,...vP,...xP]}const wP=bP();wP.map(s=>s.verbatimCoordinates);function vv(s,o,c){let d=["match",s];for(let[_,k]of Object.entries(o))d.push(_),d.push(k);return d.push(c),d}const kP={scenario:"U",showRatings:{green:!0,amber:!0,red:!0},showClasses:{A:!0,B:!0,C:!0,Unclassified:!0},showDirections:{both:!0,"one-way":!0}},$s={green:"#006853",amber:"#ffd833",red:"#b73d25"},Af=["U","X","Y","Z"],xv=["red","amber","green"];function bv(s,o,c){const d=s.slice();return d[4]=o[c],d}function wv(s){let o,c=(s[3].properties.name||"Unnamed road")+"",d,_,k,I,f=s[3].properties.class+"",D,F,j,N,V,ne=s[3].properties.direction+"",re,Ae,we,Te,Ce=s[3].properties.length+"",ke,Re,ze,Oe,Ze,je,Ve,st=s[3].properties.road_average_width+"",Se,Lt,_t=s[3].properties.road_minimum_width+"",We,dt,bt,lt,It,Wt=s[3].properties.pavement_average_width+"",it,Ft,Ut,Gt,et,Ot=Eo(Af),pt=[];for(let vt=0;vt({3:d}),({data:d})=>d?8:0]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,_){const k={};_&136&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function EP(s){let o,c;return o=new Gp({props:{sourceLayer:"pavements",filter:Sv(s[2]),layout:{visibility:s[0]=="roads"?"visible":"none"},manageHoverState:!0,paint:{"line-width":of(5,10),"line-color":vv(["get",`rating_${s[2].scenario}`],$s,"black")},beforeId:"Road numbers",$$slots:{default:[IP]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,_){const k={};_&4&&(k.filter=Sv(d[2])),_&1&&(k.layout={visibility:d[0]=="roads"?"visible":"none"}),_&4&&(k.paint={"line-width":of(5,10),"line-color":vv(["get",`rating_${d[2].scenario}`],$s,"black")}),_&128&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function TP(s){let o,c;return o=new f0({props:{url:`pmtiles://${s[1]}`,$$slots:{default:[EP]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,[_]){const k={};_&2&&(k.url=`pmtiles://${d[1]}`),_&133&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function Sv(s){let o=Object.entries(s.showRatings).filter(_=>_[1]).map(_=>_[0]),c=Object.entries(s.showClasses).filter(_=>_[1]).map(_=>_[0]),d=Object.entries(s.showDirections).filter(_=>_[1]).map(_=>_[0]);return["all",["has","class"],["in",["get","class"],["literal",c]],["in",["get",`rating_${s.scenario}`],["literal",o]],["in",["get","direction"],["literal",d]]]}function CP(s,o,c){let{show:d}=o,{url:_}=o,{roadFilters:k}=o;return s.$$set=I=>{"show"in I&&c(0,d=I.show),"url"in I&&c(1,_=I.url),"roadFilters"in I&&c(2,k=I.roadFilters)},[d,_,k]}class PP extends qn{constructor(o){super(),Vn(this,o,CP,TP,gn,{show:0,url:1,roadFilters:2})}}function Iv(s,o,c){const d=s.slice();return d[3]=o[c],d}function Ev(s,o,c){const d=s.slice();d[6]=o[c];const _=d[2].properties[`counts_${d[3]}_${d[6]}`];d[7]=_;const k=d[2].properties[`lengths_${d[3]}_${d[6]}`];return d[8]=k,d}function Tv(s){let o,c=s[2].properties.name+"",d,_,k,I,f,D,F,j,N,V,ne,re,Ae=Eo(Af),we=[];for(let Te=0;Te({2:d}),({data:d})=>d?4:0]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,_){const k={};_&2052&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function MP(s){let o,c,d,_;return o=new Kv({props:{filter:["all",["has","name"],["in",s[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]],layout:{visibility:s[0].endsWith("-summary")?"visible":"none"},manageHoverState:!0,paint:{"fill-color":"cyan","fill-opacity":of(.2,.8)},beforeId:"Road numbers",$$slots:{default:[AP]},$$scope:{ctx:s}}}),d=new Gp({props:{filter:["all",["has","name"],["in",s[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]],layout:{visibility:s[0].endsWith("-summary")?"visible":"none"},paint:{"line-width":5,"line-color":"black"}}}),{c(){un(o.$$.fragment),c=qt(),un(d.$$.fragment)},m(k,I){rn(o,k,I),Tt(k,c,I),rn(d,k,I),_=!0},p(k,I){const f={};I&1&&(f.filter=["all",["has","name"],["in",k[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]]),I&1&&(f.layout={visibility:k[0].endsWith("-summary")?"visible":"none"}),I&2048&&(f.$$scope={dirty:I,ctx:k}),o.$set(f);const D={};I&1&&(D.filter=["all",["has","name"],["in",k[0]=="lad-summary"?"LAD_":"CA_",["get","name"]]]),I&1&&(D.layout={visibility:k[0].endsWith("-summary")?"visible":"none"}),d.$set(D)},i(k){_||(Bt(o.$$.fragment,k),Bt(d.$$.fragment,k),_=!0)},o(k){$t(o.$$.fragment,k),$t(d.$$.fragment,k),_=!1},d(k){k&&St(c),sn(o,k),sn(d,k)}}}function RP(s){let o,c;return o=new _w({props:{data:s[1],generateId:!0,$$slots:{default:[MP]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,[_]){const k={};_&2&&(k.data=d[1]),_&2049&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function DP(s,o,c){let{show:d}=o,{url:_}=o;return s.$$set=k=>{"show"in k&&c(0,d=k.show),"url"in k&&c(1,_=k.url)},[d,_]}class zP extends qn{constructor(o){super(),Vn(this,o,DP,RP,gn,{show:0,url:1})}}function Lv(s,o,c){const d=s.slice();return d[11]=o[c],d[12]=o,d[13]=c,d}function Av(s,o,c){const d=s.slice();return d[14]=o[c][0],d[15]=o[c][1],d}function Mv(s){let o,c,d,_=s[14]+"",k,I,f=s[15]+"",D,F,j,N,V;return j=jv(s[4][0]),{c(){o=mt("label"),c=mt("input"),d=qt(),k=di(_),I=di(": "),D=di(f),F=qt(),An(c,"type","radio"),c.__value=s[14],Nc(c,c.__value),j.p(c)},m(ne,re){Tt(ne,o,re),Xe(o,c),c.checked=c.__value===s[0].scenario,Xe(o,d),Xe(o,k),Xe(o,I),Xe(o,D),Xe(o,F),N||(V=xr(c,"change",s[3]),N=!0)},p(ne,re){re&1&&(c.checked=c.__value===ne[0].scenario)},d(ne){ne&&St(o),j.r(),N=!1,V()}}}function Rv(s){let o,c,d,_=s[11]+"",k,I,f,D;function F(){s[8].call(c,s[11])}return{c(){o=mt("label"),c=mt("input"),d=qt(),k=di(_),I=qt(),An(c,"type","checkbox")},m(j,N){Tt(j,o,N),Xe(o,c),c.checked=s[0].showClasses[s[11]],Xe(o,d),Xe(o,k),Xe(o,I),f||(D=xr(c,"change",F),f=!0)},p(j,N){s=j,N&3&&(c.checked=s[0].showClasses[s[11]])},d(j){j&&St(o),f=!1,D()}}}function NP(s){let o,c,d,_,k,I,f,D,F,j,N,V,ne,re,Ae,we,Te,Ce,ke,Re,ze,Oe,Ze,je,Ve,st,Se,Lt,_t,We,dt,bt,lt,It,Wt,it=Eo(s[2]),Ft=[];for(let et=0;et{"filters"in re&&c(0,d=re.filters)},[d,_,k,f,I,D,F,j,N,V,ne]}class FP extends qn{constructor(o){super(),Vn(this,o,OP,NP,gn,{filters:0})}}function Dv(s){let o,c=s[3].properties.GEO_ID+"",d,_,k,I,f=s[3].properties.aggregate_kerb_length.toLocaleString()+"",D,F,j,N,V,ne=s[3].properties.number_of_cars_and_vans.toLocaleString()+"",re,Ae,we,Te,Ce=s[3].properties.kerb_length_per_car.toLocaleString()+"",ke,Re;return{c(){o=mt("h1"),d=di(c),_=qt(),k=mt("p"),I=di("aggregate_kerb_length: "),D=di(f),F=di(` + meters`),j=qt(),N=mt("p"),V=di("number_of_cars_and_vans: "),re=di(ne),Ae=qt(),we=mt("p"),Te=di("kerb_length_per_car: "),ke=di(Ce),Re=di(` + meters`)},m(ze,Oe){Tt(ze,o,Oe),Xe(o,d),Tt(ze,_,Oe),Tt(ze,k,Oe),Xe(k,I),Xe(k,D),Xe(k,F),Tt(ze,j,Oe),Tt(ze,N,Oe),Xe(N,V),Xe(N,re),Tt(ze,Ae,Oe),Tt(ze,we,Oe),Xe(we,Te),Xe(we,ke),Xe(we,Re)},p(ze,Oe){Oe&8&&c!==(c=ze[3].properties.GEO_ID+"")&&Ur(d,c),Oe&8&&f!==(f=ze[3].properties.aggregate_kerb_length.toLocaleString()+"")&&Ur(D,f),Oe&8&&ne!==(ne=ze[3].properties.number_of_cars_and_vans.toLocaleString()+"")&&Ur(re,ne),Oe&8&&Ce!==(Ce=ze[3].properties.kerb_length_per_car.toLocaleString()+"")&&Ur(ke,Ce)},d(ze){ze&&(St(o),St(_),St(k),St(j),St(N),St(Ae),St(we))}}}function BP(s){var d;let o,c=((d=s[3])==null?void 0:d.properties)&&Dv(s);return{c(){c&&c.c(),o=Yr()},m(_,k){c&&c.m(_,k),Tt(_,o,k)},p(_,k){var I;(I=_[3])!=null&&I.properties?c?c.p(_,k):(c=Dv(_),c.c(),c.m(o.parentNode,o)):c&&(c.d(1),c=null)},d(_){_&&St(o),c&&c.d(_)}}}function jP(s){let o,c;return o=new Wp({props:{openOn:"hover",$$slots:{default:[BP,({data:d})=>({3:d}),({data:d})=>d?8:0]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,_){const k={};_&24&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function UP(s){let o,c,d,_;return o=new Kv({props:{sourceLayer:"pavements",layout:{visibility:s[0]=="census-area"?"visible":"none"},manageHoverState:!0,paint:{"fill-color":s[2],"fill-opacity":of(.6,.9)},beforeId:"Road numbers",$$slots:{default:[jP]},$$scope:{ctx:s}}}),d=new Gp({props:{layout:{visibility:s[0].endsWith("-area")?"visible":"none"},paint:{"line-width":2,"line-color":"black"}}}),{c(){un(o.$$.fragment),c=qt(),un(d.$$.fragment)},m(k,I){rn(o,k,I),Tt(k,c,I),rn(d,k,I),_=!0},p(k,I){const f={};I&1&&(f.layout={visibility:k[0]=="census-area"?"visible":"none"}),I&16&&(f.$$scope={dirty:I,ctx:k}),o.$set(f);const D={};I&1&&(D.layout={visibility:k[0].endsWith("-area")?"visible":"none"}),d.$set(D)},i(k){_||(Bt(o.$$.fragment,k),Bt(d.$$.fragment,k),_=!0)},o(k){$t(o.$$.fragment,k),$t(d.$$.fragment,k),_=!1},d(k){k&&St(c),sn(o,k),sn(d,k)}}}function VP(s){let o,c;return o=new f0({props:{url:`pmtiles://${s[1]}`,$$slots:{default:[UP]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,[_]){const k={};_&2&&(k.url=`pmtiles://${d[1]}`),_&17&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function qP(s,o,c){let{show:d}=o,{url:_}=o,k=["let","kerb_length_per_car_js",["/",["get","aggregate_kerb_length"],["get","number_of_cars_and_vans"]],["interpolate-hcl",["linear"],["var","kerb_length_per_car_js"],0,["to-color","#ff0000"],2.5,["to-color","#ff1111"],5,["to-color","#ff2222"],7.5,["to-color","#ff4444"],15,["to-color","#ffdddd"],20,["to-color","#ffffff"]]];return s.$$set=I=>{"show"in I&&c(0,d=I.show),"url"in I&&c(1,_=I.url)},[d,_,k]}class GP extends qn{constructor(o){super(),Vn(this,o,qP,VP,gn,{show:0,url:1})}}const ZP=s=>({dialog:s&1}),zv=s=>({dialog:s[0]});function WP(s){let o,c,d,_,k;const I=s[4].default,f=Po(I,s,s[3],zv);return{c(){o=mt("dialog"),c=mt("article"),f&&f.c(),o.open=!0},m(D,F){Tt(D,o,F),Xe(o,c),f&&f.m(c,null),s[6](o),d=!0,_||(k=[xr(window,"click",s[1]),xr(window,"keydown",s[2]),xr(o,"close",s[5])],_=!0)},p(D,[F]){f&&f.p&&(!d||F&9)&&Ao(f,I,D,D[3],d?Lo(I,D[3],F,ZP):Mo(D[3]),zv)},i(D){d||(Bt(f,D),d=!0)},o(D){$t(f,D),d=!1},d(D){D&&St(o),f&&f.d(D),s[6](null),_=!1,ma(k)}}}function XP(s,o,c){let{$$slots:d={},$$scope:_}=o,k;function I(j){k.open&&j.target==k&&k.close()}function f(j){(j.key=="Escape"||j.key=="Enter")&&(j.stopPropagation(),k.close())}function D(j){cs.call(this,s,j)}function F(j){pa[j?"unshift":"push"](()=>{k=j,c(0,k)})}return s.$$set=j=>{"$$scope"in j&&c(3,_=j.$$scope)},[k,I,f,_,d,D,F]}class HP extends qn{constructor(o){super(),Vn(this,o,XP,WP,gn,{})}}function Nv(s){let o,c;return o=new HP({props:{$$slots:{default:[YP]},$$scope:{ctx:s}}}),o.$on("close",s[3]),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,_){const k={};_&17&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function YP(s){let o,c,d,_,k,I,f,D,F,j,N,V,ne,re,Ae,we,Te,Ce,ke,Re,ze,Oe,Ze,je,Ve,st,Se,Lt,_t,We,dt,bt,lt,It,Wt,it,Ft,Ut,Gt,et,Ot,pt,vt,_e,vi;return{c(){o=mt("h1"),o.textContent="About this tool",c=qt(),d=mt("p"),d.textContent=`This uses OS MasterMap Highways Network data, using road classification + and average width. According to the table below (thresholds and + methodology TBD), each road is assigned a rating.`,_=qt(),k=mt("table"),I=mt("tr"),I.innerHTML=' A Roads B Roads C Roads Unclassified Roads',f=qt(),D=mt("tr"),F=mt("th"),F.textContent="Green",j=qt(),N=mt("td"),N.textContent="≥ ???",V=qt(),ne=mt("td"),ne.textContent="≥ 12.8m",re=qt(),Ae=mt("td"),Ae.textContent="≥ 10.0m",we=qt(),Te=mt("td"),Te.textContent="≥ 9.5m",Ce=qt(),ke=mt("tr"),Re=mt("th"),Re.textContent="Amber",ze=qt(),Oe=mt("td"),Oe.textContent="???m - ???",Ze=qt(),je=mt("td"),je.textContent="11.5m - 12.8m",Ve=qt(),st=mt("td"),st.textContent="9.1m - 10.0m",Se=qt(),Lt=mt("td"),Lt.textContent="8.4m - 9.5m",_t=qt(),We=mt("tr"),dt=mt("th"),dt.textContent="Red",bt=qt(),lt=mt("td"),lt.textContent="< ???",It=qt(),Wt=mt("td"),Wt.textContent="< 11.5m",it=qt(),Ft=mt("td"),Ft.textContent="< 9.1m",Ut=qt(),Gt=mt("td"),Gt.textContent="< 8.4m",et=qt(),Ot=mt("p"),Ot.textContent="OS data is copyright to Ordnance Survey.",pt=qt(),vt=mt("button"),vt.textContent="OK",An(F,"class","svelte-dgq6bh"),Rs(F,"color",$s.green),An(Re,"class","svelte-dgq6bh"),Rs(Re,"color",$s.amber),An(dt,"class","svelte-dgq6bh"),Rs(dt,"color",$s.red)},m(Jt,yt){Tt(Jt,o,yt),Tt(Jt,c,yt),Tt(Jt,d,yt),Tt(Jt,_,yt),Tt(Jt,k,yt),Xe(k,I),Xe(k,f),Xe(k,D),Xe(D,F),Xe(D,j),Xe(D,N),Xe(D,V),Xe(D,ne),Xe(D,re),Xe(D,Ae),Xe(D,we),Xe(D,Te),Xe(k,Ce),Xe(k,ke),Xe(ke,Re),Xe(ke,ze),Xe(ke,Oe),Xe(ke,Ze),Xe(ke,je),Xe(ke,Ve),Xe(ke,st),Xe(ke,Se),Xe(ke,Lt),Xe(k,_t),Xe(k,We),Xe(We,dt),Xe(We,bt),Xe(We,lt),Xe(We,It),Xe(We,Wt),Xe(We,it),Xe(We,Ft),Xe(We,Ut),Xe(We,Gt),Tt(Jt,et,yt),Tt(Jt,Ot,yt),Tt(Jt,pt,yt),Tt(Jt,vt,yt),_e||(vi=xr(vt,"click",s[2]),_e=!0)},p:bn,d(Jt){Jt&&(St(o),St(c),St(d),St(_),St(k),St(et),St(Ot),St(pt),St(vt)),_e=!1,vi()}}}function KP(s){let o,c,d,_,k,I,f=s[0]&&Nv(s);return{c(){o=mt("button"),o.textContent="About",c=qt(),f&&f.c(),d=Yr()},m(D,F){Tt(D,o,F),Tt(D,c,F),f&&f.m(D,F),Tt(D,d,F),_=!0,k||(I=xr(o,"click",s[1]),k=!0)},p(D,[F]){D[0]?f?(f.p(D,F),F&1&&Bt(f,1)):(f=Nv(D),f.c(),Bt(f,1),f.m(d.parentNode,d)):f&&(ds(),$t(f,1,1,()=>{f=null}),ps())},i(D){_||(Bt(f),_=!0)},o(D){$t(f),_=!1},d(D){D&&(St(o),St(c),St(d)),f&&f.d(D),k=!1,I()}}}function JP(s,o,c){let d=!1;return[d,()=>c(0,d=!0),()=>c(0,d=!1),()=>c(0,d=!1)]}class QP extends qn{constructor(o){super(),Vn(this,o,JP,KP,gn,{})}}function $P(s){let o;return{c(){o=mt("p"),o.innerHTML=`Data source not specified. If you're developing locally, try this + . Otherwise, you might not have access to this.`},m(c,d){Tt(c,o,d)},p:bn,i:bn,o:bn,d(c){c&&St(o)}}}function eL(s){let o,c;return o=new Jb({props:{$$slots:{main:[aL],left:[sL]},$$scope:{ctx:s}}}),{c(){un(o.$$.fragment)},m(d,_){rn(o,d,_),c=!0},p(d,_){const k={};_&131087&&(k.$$scope={dirty:_,ctx:d}),o.$set(k)},i(d){c||(Bt(o.$$.fragment,d),c=!0)},o(d){$t(o.$$.fragment,d),c=!1},d(d){sn(o,d)}}}function tL(s){let o;return{c(){o=mt("p"),o.textContent="Zoom in more to see Output Areas"},m(c,d){Tt(c,o,d)},p:bn,i:bn,o:bn,d(c){c&&St(o)}}}function iL(s){let o,c,d,_;const k=[rL,nL],I=[];function f(D,F){return D[3]>=10?0:1}return o=f(s),c=I[o]=k[o](s),{c(){c.c(),d=Yr()},m(D,F){I[o].m(D,F),Tt(D,d,F),_=!0},p(D,F){let j=o;o=f(D),o===j?I[o].p(D,F):(ds(),$t(I[j],1,1,()=>{I[j]=null}),ps(),c=I[o],c?c.p(D,F):(c=I[o]=k[o](D),c.c()),Bt(c,1),c.m(d.parentNode,d))},i(D){_||(Bt(c),_=!0)},o(D){$t(c),_=!1},d(D){D&&St(d),I[o].d(D)}}}function nL(s){let o;return{c(){o=mt("p"),o.textContent="Zoom in more to see roads"},m(c,d){Tt(c,o,d)},p:bn,i:bn,o:bn,d(c){c&&St(o)}}}function rL(s){let o,c,d;function _(I){s[15](I)}let k={};return s[2]!==void 0&&(k.filters=s[2]),o=new FP({props:k}),pa.push(()=>Df(o,"filters",_)),{c(){un(o.$$.fragment)},m(I,f){rn(o,I,f),d=!0},p(I,f){const D={};!c&&f&4&&(c=!0,D.filters=I[2],Rf(()=>c=!1)),o.$set(D)},i(I){d||(Bt(o.$$.fragment,I),d=!0)},o(I){$t(o.$$.fragment,I),d=!1},d(I){sn(o,I)}}}function sL(s){let o,c,d,_,k,I,f,D,F,j,N,V,ne,re,Ae,we,Te,Ce,ke,Re,ze,Oe,Ze,je,Ve,st,Se,Lt,_t,We;_=new QP({});const dt=[iL,tL],bt=[];function lt(It,Wt){return It[1]=="roads"?0:It[1]=="census-area"&&It[3]<10?1:-1}return~(Ve=lt(s))&&(st=bt[Ve]=dt[Ve](s)),Lt=jv(s[11][0]),{c(){o=mt("div"),c=mt("h1"),c.textContent="Pavement Parking",d=qt(),un(_.$$.fragment),k=qt(),I=mt("fieldset"),f=mt("legend"),f.textContent="Show:",D=qt(),F=mt("label"),j=mt("input"),N=di(` + Roads`),V=qt(),ne=mt("label"),re=mt("input"),Ae=di(` + LAD boundaries`),we=qt(),Te=mt("label"),Ce=mt("input"),ke=di(` + Combined Authority boundaries`),Re=qt(),ze=mt("label"),Oe=mt("input"),Ze=di(` + Parking demand by Output Area`),je=qt(),st&&st.c(),An(j,"type","radio"),j.__value="roads",Nc(j,j.__value),An(re,"type","radio"),re.__value="lad-summary",Nc(re,re.__value),An(Ce,"type","radio"),Ce.__value="ca-summary",Nc(Ce,Ce.__value),An(Oe,"type","radio"),Oe.__value="census-area",Nc(Oe,Oe.__value),An(o,"slot","left"),Lt.p(j,re,Ce,Oe)},m(It,Wt){Tt(It,o,Wt),Xe(o,c),Xe(o,d),rn(_,o,null),Xe(o,k),Xe(o,I),Xe(I,f),Xe(I,D),Xe(I,F),Xe(F,j),j.checked=j.__value===s[1],Xe(F,N),Xe(I,V),Xe(I,ne),Xe(ne,re),re.checked=re.__value===s[1],Xe(ne,Ae),Xe(I,we),Xe(I,Te),Xe(Te,Ce),Ce.checked=Ce.__value===s[1],Xe(Te,ke),Xe(I,Re),Xe(I,ze),Xe(ze,Oe),Oe.checked=Oe.__value===s[1],Xe(ze,Ze),Xe(o,je),~Ve&&bt[Ve].m(o,null),Se=!0,_t||(We=[xr(j,"change",s[10]),xr(re,"change",s[12]),xr(Ce,"change",s[13]),xr(Oe,"change",s[14])],_t=!0)},p(It,Wt){Wt&2&&(j.checked=j.__value===It[1]),Wt&2&&(re.checked=re.__value===It[1]),Wt&2&&(Ce.checked=Ce.__value===It[1]),Wt&2&&(Oe.checked=Oe.__value===It[1]);let it=Ve;Ve=lt(It),Ve===it?~Ve&&bt[Ve].p(It,Wt):(st&&(ds(),$t(bt[it],1,1,()=>{bt[it]=null}),ps()),~Ve?(st=bt[Ve],st?st.p(It,Wt):(st=bt[Ve]=dt[Ve](It),st.c()),Bt(st,1),st.m(o,null)):st=null)},i(It){Se||(Bt(_.$$.fragment,It),Bt(st),Se=!0)},o(It){$t(_.$$.fragment,It),$t(st),Se=!1},d(It){It&&St(o),sn(_),~Ve&&bt[Ve].d(),Lt.r(),_t=!1,ma(We)}}}function oL(s){let o,c,d,_,k,I,f,D;return o=new Iw({}),o.$on("zoom",s[8]),d=new PP({props:{show:s[1],url:s[5],roadFilters:s[2]}}),k=new zP({props:{show:s[1],url:s[6]}}),f=new GP({props:{show:s[1],url:s[7]}}),{c(){un(o.$$.fragment),c=qt(),un(d.$$.fragment),_=qt(),un(k.$$.fragment),I=qt(),un(f.$$.fragment)},m(F,j){rn(o,F,j),Tt(F,c,j),rn(d,F,j),Tt(F,_,j),rn(k,F,j),Tt(F,I,j),rn(f,F,j),D=!0},p(F,j){const N={};j&2&&(N.show=F[1]),j&4&&(N.roadFilters=F[2]),d.$set(N);const V={};j&2&&(V.show=F[1]),k.$set(V);const ne={};j&2&&(ne.show=F[1]),f.$set(ne)},i(F){D||(Bt(o.$$.fragment,F),Bt(d.$$.fragment,F),Bt(k.$$.fragment,F),Bt(f.$$.fragment,F),D=!0)},o(F){$t(o.$$.fragment,F),$t(d.$$.fragment,F),$t(k.$$.fragment,F),$t(f.$$.fragment,F),D=!1},d(F){F&&(St(c),St(_),St(I)),sn(o,F),sn(d,F),sn(k,F),sn(f,F)}}}function aL(s){let o,c,d,_;function k(f){s[9](f)}let I={style:"https://api.maptiler.com/maps/uk-openzoomstack-light/style.json?key=MZEJTanw3WpxRvt7qDfo",hash:!0,bounds:s[4],$$slots:{default:[oL]},$$scope:{ctx:s}};return s[0]!==void 0&&(I.map=s[0]),c=new Fw({props:I}),pa.push(()=>Df(c,"map",k)),{c(){o=mt("div"),un(c.$$.fragment),An(o,"slot","main"),Rs(o,"position","relative"),Rs(o,"width","100%"),Rs(o,"height","100vh")},m(f,D){Tt(f,o,D),rn(c,o,null),_=!0},p(f,D){const F={};D&131078&&(F.$$scope={dirty:D,ctx:f}),!d&&D&1&&(d=!0,F.map=f[0],Rf(()=>d=!1)),c.$set(F)},i(f){_||(Bt(c.$$.fragment,f),_=!0)},o(f){$t(c.$$.fragment,f),_=!1},d(f){f&&St(o),sn(c)}}}function lL(s){let o,c,d,_;const k=[eL,$P],I=[];function f(D,F){return D[5]?0:1}return o=f(s),c=I[o]=k[o](s),{c(){c.c(),d=Yr()},m(D,F){I[o].m(D,F),Tt(D,d,F),_=!0},p(D,[F]){c.p(D,F)},i(D){_||(Bt(c),_=!0)},o(D){$t(c),_=!1},d(D){D&&St(d),I[o].d(D)}}}function uL(s,o,c){let d=window.location.hash?void 0:[-5.96,49.89,2.31,55.94],_="roads",k=kP,f=new URLSearchParams(window.location.search).get("data")||"",D=f.replace("pavements.pmtiles","summaries.geojson"),F=f.replace("pavements.pmtiles","output_areas.pmtiles"),j,N=0;function V(){c(3,N=j.getZoom())}const ne=[[]];function re(Re){j=Re,c(0,j)}function Ae(){_=this.__value,c(1,_)}function we(){_=this.__value,c(1,_)}function Te(){_=this.__value,c(1,_)}function Ce(){_=this.__value,c(1,_)}function ke(Re){k=Re,c(2,k)}return s.$$.update=()=>{s.$$.dirty&1&&j&&V()},[j,_,k,N,d,f,D,F,V,re,Ae,ne,we,Te,Ce,ke]}class cL extends qn{constructor(o){super(),Vn(this,o,uL,lL,gn,{})}}new cL({target:document.getElementById("app")}); diff --git a/index.html b/index.html index 12bde9a..aaeb168 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Pavement parking - +